payment_method.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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">Origine</th>
  33. <th scope="col">Destinazione</th>
  34. <th scope="col">Nome</th>
  35. <th scope="col">Tipo</th>
  36. <th scope="col">Abilitato</th>
  37. <th scope="col">...</th>
  38. </tr>
  39. </thead>
  40. <tbody id="checkall-target">
  41. @foreach($records as $record)
  42. <tr @if(isset($record->hidden) && $record->hidden) style="opacity: 0.6; font-style: italic;" @endif>
  43. <td>{{$record->origin_id ? $record->origin->name : ''}}</td>
  44. <td>{{$record->destination_id ? $record->destination->name : ''}}</td>
  45. <td>
  46. {{$record->name}}
  47. @if(isset($record->hidden) && $record->hidden)
  48. <span class="text-muted">(nascosto)</span>
  49. @endif
  50. </td>
  51. <td>
  52. @php
  53. switch ($record->type) {
  54. case 'IN':
  55. echo "Entrate";
  56. break;
  57. case 'OUT':
  58. echo "Uscite";
  59. break;
  60. case 'ALL':
  61. echo "Entrate/Uscite";
  62. break;
  63. }
  64. @endphp
  65. </td>
  66. <td> <span class="tablesaw-cell-content"><span class="badge tessera-badge {{$record->enabled ? 'active' : 'suspended'}}">{{$record->enabled ? 'attivo' : 'disattivo'}}</span></span></td>
  67. <td>
  68. <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>
  69. @if(isset($record->hidden) && $record->hidden)
  70. <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>
  71. @else
  72. <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>
  73. @endif
  74. </td>
  75. </tr>
  76. @endforeach
  77. </tbody>
  78. </table>
  79. </section>
  80. @else
  81. <a class="btn--ui lightGrey" href="/payment_methods"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  82. <div class="container">
  83. @if (session()->has('error'))
  84. <div class="alert alert-danger" role="alert">
  85. {{ session()->get('error') }}
  86. </div>
  87. @endif
  88. <div class="row">
  89. <div class="col">
  90. <form action="">
  91. <div class="row mb-3">
  92. <div class="col">
  93. <div class="form--item">
  94. <label for="name" class="form-label">Nome</label>
  95. <select class="form-control @error('name') is-invalid @enderror" id="name" wire:model="name">
  96. <option value="">Seleziona un metodo di pagamento</option>
  97. @foreach($paymentMethods as $method)
  98. <option value="{{ $method['name'] }}">{{ $method['name'] }} ({{ $method['code'] }})</option>
  99. @endforeach
  100. </select>
  101. @error('name')
  102. <div class="invalid-feedback">{{ $message }}</div>
  103. @enderror
  104. </div>
  105. </div>
  106. <div class="col-md-6">
  107. <label for="type" class="form-label">Tipologia</label>
  108. <select name="type" class="form-select" aria-label="Seleziona una tipologia" wire:model="type">
  109. <option value="ALL">Entrate/Uscite</option>
  110. <option value="IN">Entrate</option>
  111. <option value="OUT">Uscite</option>
  112. </select>
  113. </div>
  114. </div>
  115. <div class="row mb-3">
  116. <div class="col">
  117. <label for="origin_id" class="form-label">Origine</label>
  118. <select name="origin_id" class="form-select" aria-label="Seleziona un'origine" wire:model="origin_id">
  119. <option value="">--Seleziona--
  120. @foreach($origins as $origin)
  121. <option value="{{$origin->id}}">{{$origin->name}}
  122. @endforeach
  123. </select>
  124. </div>
  125. <div class="col">
  126. <label for="destination_id" class="form-label">Destinazione</label>
  127. <select name="destination_id" class="form-select" aria-label="Seleziona una destinazione" wire:model="destination_id">
  128. <option value="">--Seleziona--
  129. @foreach($destinations as $destination)
  130. <option value="{{$destination->id}}">{{$destination->name}}
  131. @endforeach
  132. </select>
  133. </div>
  134. </div>
  135. <div class="form--item mb-3">
  136. <div class="form--item">
  137. <label for="enabled" class="form-label">Abilitato</label>
  138. <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="enabled" wire:model="enabled">
  139. </div>
  140. </div>
  141. <div class="form--item mb-3">
  142. <div class="form-check form-check-inline">
  143. <input class="form-check-input" type="checkbox" id="money" wire:model="money">
  144. <label class="form-check-label" for="money">Decrementa borsellino virtuale</label>
  145. </div>
  146. </div>
  147. <div class="form--item mb-3">
  148. <div class="form-check form-check-inline">
  149. <input class="form-check-input" type="checkbox" id="corrispettivo_fiscale" wire:model="corrispettivo_fiscale">
  150. <label class="form-check-label" for="corrispettivo_fiscale">Utilizza per corrispettivo fiscale</label>
  151. </div>
  152. </div>
  153. <div class="form--item">
  154. <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
  155. @if($add)
  156. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  157. @endif
  158. @if($update)
  159. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  160. @endif
  161. </div>
  162. </form>
  163. </div>
  164. </div>
  165. </div>
  166. @endif
  167. </div>
  168. @if (session()->has('success'))
  169. <div class="alert alert-success alert-dismissible fade show mt-3" role="alert">
  170. {{ session()->get('success') }}
  171. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  172. </div>
  173. @endif
  174. @if (session()->has('error'))
  175. <div class="alert alert-danger alert-dismissible fade show mt-3" role="alert">
  176. {{ session()->get('error') }}
  177. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  178. </div>
  179. @endif
  180. @push('scripts')
  181. <link href="/css/datatables.css" rel="stylesheet" />
  182. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  183. <script src="/assets/js/datatables.js"></script>
  184. <script src="https://cdn.datatables.net/buttons/3.0.2/js/buttons.dataTables.js"></script>
  185. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
  186. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
  187. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
  188. @endpush
  189. @push('scripts')
  190. <script>
  191. $(document).ready(function() {
  192. loadDataTable();
  193. });
  194. Livewire.on('load-data-table', () => {
  195. loadDataTable();
  196. });
  197. function loadDataTable(){
  198. let date = new Date();
  199. let date_export = `${date.getFullYear()}${date.getMonth()}${date.getDate()}_`;
  200. if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
  201. $('#tablesaw-350').DataTable().destroy();
  202. }
  203. $('#tablesaw-350').DataTable({
  204. processing: true,
  205. thead: {
  206. 'th': {'background-color': 'blue'}
  207. },
  208. order: [
  209. [2, 'asc']
  210. ],
  211. layout: {
  212. topStart : null,
  213. topEnd : null,
  214. top1A: {
  215. // buttons: [
  216. // {
  217. // extend: 'collection',
  218. // text: 'ESPORTA',
  219. buttons: [
  220. {
  221. extend: 'excelHtml5',
  222. text: '<i class="fa-solid fa-file-excel"></i>',
  223. action: newexportaction,
  224. title: date_export + 'Metodi di pagamento',
  225. exportOptions: {
  226. columns: ":not(':last')"
  227. }
  228. },
  229. {
  230. extend: 'pdfHtml5',
  231. text: '<i class="fa-solid fa-file-pdf"></i>',
  232. action: newexportaction,
  233. title: date_export + 'Metodi di pagamento',
  234. exportOptions: {
  235. columns: ":not(':last')"
  236. }
  237. },
  238. {
  239. extend: 'print',
  240. action: newexportaction,
  241. text: '<i class="fa-solid fa-print"></i>',
  242. title: date_export + 'Metodi di pagamento',
  243. exportOptions: {
  244. columns: ":not(':last')"
  245. }
  246. }
  247. ],
  248. // dropup: true
  249. // }
  250. // ]
  251. },
  252. top1B : {
  253. pageLength: {
  254. menu: [[10, 25, 50, 100, 100000], [10, 25, 50, 100, "Tutti"]]
  255. }
  256. },
  257. top1C :'search',
  258. },
  259. pagingType: 'first_last_numbers',
  260. language: {
  261. "url": "/assets/js/Italian.json",
  262. paginate: {
  263. first: '<i class="fa-solid fa-angles-left"></i>',
  264. last: '<i class="fa-solid fa-angles-right"></i>',
  265. }
  266. },
  267. "fnInitComplete": function (oSettings, json) {
  268. var html = '&nbsp;<a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
  269. $(".dt-search").append(html);
  270. }
  271. });
  272. $('#tablesaw-350 thead tr th').addClass('col');
  273. $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
  274. $(document).ready(function() {
  275. $(document).on("click",".addData",function() {
  276. $(".title--section_addButton").trigger("click")
  277. });
  278. });
  279. }
  280. </script>
  281. @endpush