payment_method.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <div class="col card--ui" id="card--dashboard">
  2. @if(!$add && !$update)
  3. <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
  4. <div class="title--section_name d-flex align-items-center justify-content-between">
  5. <i class="ico--ui title_section utenti me-2"></i>
  6. <h2 class="primary">@if(!$add && !$update)metodi pagamento @else Inserimento/modifica metodo pagamento @endif</h2>
  7. </div>
  8. @if(!$add && !$update)
  9. <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
  10. <div class="btn--ui entrata d-flex justify-items-between">
  11. <a href="#" wire:click="add()" style="color:white">Aggiungi</a>
  12. </div>
  13. </div>
  14. @endif
  15. </header>
  16. <a class="btn--ui lightGrey" href="/settings?type=contabilita"><i class="fa-solid fa-arrow-left"></i></a><br>
  17. <section id="resume-table">
  18. <div class="compare--chart_wrapper d-none"></div>
  19. <!-- Toggle button to show/hide hidden items -->
  20. <div class="mb-3 mt-3">
  21. <button type="button" class="btn btn-outline-secondary btn-sm" wire:click="toggleShowHidden">
  22. @if($showHidden)
  23. <i class="fa-regular fa-eye-slash"></i> Nascondi elementi nascosti
  24. @else
  25. <i class="fa-regular fa-eye"></i> Mostra elementi nascosti
  26. @endif
  27. </button>
  28. </div>
  29. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  30. <thead>
  31. <tr>
  32. <th scope="col">Banca</th>
  33. <th scope="col">Nome</th>
  34. <th scope="col">Tipo</th>
  35. <th scope="col">Abilitato</th>
  36. <th scope="col">...</th>
  37. </tr>
  38. </thead>
  39. <tbody id="checkall-target">
  40. @foreach($records as $record)
  41. <tr @if(isset($record->hidden) && $record->hidden) style="opacity: 0.6; font-style: italic;" @endif>
  42. <td>{{$record->bank ? $record->bank : ''}}</td>
  43. <td>
  44. {{$record->name}}
  45. @if(isset($record->hidden) && $record->hidden)
  46. <span class="text-muted">(nascosto)</span>
  47. @endif
  48. </td>
  49. <td>
  50. @php
  51. switch ($record->type) {
  52. case 'IN':
  53. echo "Entrate";
  54. break;
  55. case 'OUT':
  56. echo "Uscite";
  57. break;
  58. case 'ALL':
  59. echo "Entrate/Uscite";
  60. break;
  61. }
  62. @endphp
  63. </td>
  64. <td> <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->enabled ? 'active' : 'suspended'}}">{{$record->enabled ? 'attivo' : 'disattivo'}}</span></span></td>
  65. <td>
  66. <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
  67. @if(isset($record->hidden) && $record->hidden)
  68. <button type="button" class="btn btn-success" wire:click="show({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Mostra"><i class="fa-regular fa-eye"></i></button>
  69. @else
  70. <button type="button" class="btn btn-secondary" onclick="confirm('Sei sicuro di voler nascondere questo metodo di pagamento?') || event.stopImmediatePropagation()" wire:click="hide({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Nascondi"><i class="fa-regular fa-eye-slash"></i></button>
  71. @endif
  72. </td>
  73. </tr>
  74. @endforeach
  75. </tbody>
  76. </table>
  77. </section>
  78. @else
  79. <div class="container">
  80. <a class="btn--ui lightGrey" href="/payment_methods"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  81. @if (session()->has('error'))
  82. <div class="alert alert-danger" role="alert">
  83. {{ session()->get('error') }}
  84. </div>
  85. @endif
  86. <div class="row">
  87. <div class="col">
  88. <form action="">
  89. <div class="row mb-3">
  90. <div class="col">
  91. <div class="form--item">
  92. <label for="name" class="form-label">Nome</label>
  93. <select class="form-control @error('name') is-invalid @enderror" id="name" wire:model="name">
  94. <option value="">Seleziona un metodo di pagamento</option>
  95. @foreach($paymentMethods as $method)
  96. <option value="{{ $method['name'] }}">{{ $method['name'] }} ({{ $method['code'] }})</option>
  97. @endforeach
  98. </select>
  99. @error('name')
  100. <div class="invalid-feedback">{{ $message }}</div>
  101. @enderror
  102. </div>
  103. </div>
  104. <div class="col">
  105. <label for="bank_id" class="form-label">Banca</label>
  106. <select name="bank_id" class="form-select" aria-label="Seleziona una banca" wire:model="bank_id">
  107. <option value="">--Seleziona--</option>
  108. @foreach($banks as $bank)
  109. <option value="{{$bank->id}}">{{$bank->name}}</option>
  110. @endforeach
  111. </select>
  112. </div>
  113. </div>
  114. <div class="row mb-3">
  115. <div class="col-md-6">
  116. <label for="type" class="form-label">Tipologia</label>
  117. <select name="type" class="form-select" aria-label="Seleziona una tipologia" wire:model="type">
  118. <option value="ALL">Entrate/Uscite</option>
  119. <option value="IN">Entrate</option>
  120. <option value="OUT">Uscite</option>
  121. </select>
  122. </div>
  123. </div>
  124. <div class="form--item mb-3">
  125. <div class="form--item">
  126. <label for="enabled" class="form-label">Abilitato</label>
  127. <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="enabled" wire:model="enabled">
  128. </div>
  129. </div>
  130. <div class="form--item mb-3">
  131. <div class="form-check form-check-inline">
  132. <input class="form-check-input" type="checkbox" id="money" wire:model="money">
  133. <label class="form-check-label" for="money">Decrementa borsellino virtuale</label>
  134. </div>
  135. </div>
  136. <div class="form--item mb-3">
  137. <div class="form-check form-check-inline">
  138. <input class="form-check-input" type="checkbox" id="corrispettivo_fiscale" wire:model="corrispettivo_fiscale">
  139. <label class="form-check-label" for="corrispettivo_fiscale">Utilizza per corrispettivo fiscale</label>
  140. </div>
  141. </div>
  142. <div class="form--item">
  143. <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
  144. @if($add)
  145. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  146. @endif
  147. @if($update)
  148. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  149. @endif
  150. </div>
  151. </form>
  152. </div>
  153. </div>
  154. </div>
  155. @endif
  156. </div>
  157. @if (session()->has('success'))
  158. <div class="alert alert-success alert-dismissible fade show mt-3" role="alert">
  159. {{ session()->get('success') }}
  160. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  161. </div>
  162. @endif
  163. @if (session()->has('error'))
  164. <div class="alert alert-danger alert-dismissible fade show mt-3" role="alert">
  165. {{ session()->get('error') }}
  166. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  167. </div>
  168. @endif
  169. @push('scripts')
  170. <link href="/css/datatables.css" rel="stylesheet" />
  171. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  172. <script src="/assets/js/datatables.js"></script>
  173. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  174. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  175. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  176. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  177. @endpush
  178. @push('scripts')
  179. <script>
  180. $(document).ready(function() {
  181. loadDataTable();
  182. });
  183. Livewire.on('load-data-table', () => {
  184. loadDataTable();
  185. });
  186. function loadDataTable(){
  187. if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
  188. $('#tablesaw-350').DataTable().destroy();
  189. }
  190. $('#tablesaw-350').DataTable({
  191. thead: {
  192. 'th': {'background-color': 'blue'}
  193. },
  194. layout: {
  195. topStart : null,
  196. topEnd : null,
  197. top1A: {
  198. buttons: [
  199. {
  200. extend: 'collection',
  201. text: 'ESPORTA',
  202. buttons: [
  203. {
  204. extend: 'excelHtml5',
  205. title: 'Metodi di pagamento',
  206. exportOptions: {
  207. columns: ":not(':last')"
  208. }
  209. },
  210. {
  211. extend: 'pdfHtml5',
  212. title: 'Metodi di pagamento',
  213. exportOptions: {
  214. columns: ":not(':last')"
  215. }
  216. },
  217. {
  218. extend: 'print',
  219. text: 'Stampa',
  220. title: 'Metodi di pagamento',
  221. exportOptions: {
  222. columns: ":not(':last')"
  223. }
  224. }
  225. ],
  226. dropup: true
  227. }
  228. ]
  229. },
  230. top1B : {
  231. pageLength: {
  232. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  233. }
  234. },
  235. top1C :'search',
  236. },
  237. pagingType: 'numbers',
  238. "language": {
  239. "url": "/assets/js/Italian.json"
  240. },
  241. "fnInitComplete": function (oSettings, json) {
  242. var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  243. $(".dt-search").append(html);
  244. }
  245. });
  246. $('#tablesaw-350 thead tr th').addClass('col');
  247. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  248. $(document).ready(function() {
  249. $(document).on("click",".addData",function() {
  250. $(".title--section_addButton").trigger("click")
  251. });
  252. });
  253. }
  254. </script>
  255. @endpush