category.blade.php 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <div class="col card--ui" id="card--dashboard">
  2. @if(!$add && !$update)
  3. <a class="btn--ui lightGrey" href="/settings?type=anagrafica"><i class="fa-solid fa-arrow-left"></i></a>
  4. <header id="title--section" class="d-flex align-items-center justify-content-between" style="display:none !important">
  5. <div class="title--section_name d-flex align-items-center justify-content-between">
  6. <i class="ico--ui title_section utenti me-2"></i>
  7. <h2 class="primary">@if(!$add && !$update)Categorie @else Inserimento/modifica categoria @endif</h2>
  8. </div>
  9. </header>
  10. @if(!$add && !$update)
  11. <div class="title--section_addButton d-flex justify-content-end" >
  12. {{-- <button type="button" class="btn--ui entrata" wire:click="openImportModal" onclick="openImportModal()">Importa</button> --}}
  13. <div class="btn--ui entrata d-flex justify-items-between" wire:click="add()" style="cursor: pointer;">
  14. <a href="#" wire:click="add()" style="color:white">AGGIUNGI</a>
  15. </div>
  16. </div><br>
  17. @endif
  18. <section id="resume-table">
  19. <div class="compare--chart_wrapper d-none"></div>
  20. <table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
  21. <thead>
  22. <tr>
  23. <th scope="col">Nome</th>
  24. <th scope="col">...</th>
  25. </tr>
  26. </thead>
  27. <tbody id="checkall-target">
  28. @foreach($records as $record)
  29. <tr>
  30. <td style="font-weight: bold">{{$record->name}}</td>
  31. <td>
  32. <button type="button" class="btn btn-outline-success btn-sm" wire:click="addLevel({{ $record->id }})">Aggiungi livello</button>
  33. <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>
  34. <button type="button" class="btn" onclick="confirm('Sei sicuro?') || event.stopImmediatePropagation()" wire:click="delete({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Elimina"><i class="fa-regular fa-trash-can"></i></button>
  35. </td>
  36. </tr>
  37. @if(count($record->childs))
  38. @include('livewire/category_child',['records' => $record->childs->sortBy('name'), 'indentation' => 1])
  39. @endif
  40. @endforeach
  41. </tbody>
  42. </table>
  43. </section>
  44. @else
  45. <a class="btn--ui lightGrey" href="/categories"><i class="fa-solid fa-arrow-left"></i></a><br><br>
  46. @if (session()->has('error'))
  47. <div class="alert alert-danger" role="alert">
  48. {{ session()->get('error') }}
  49. </div>
  50. @endif
  51. <div class="row">
  52. <div class="col">
  53. <form action="">
  54. @if($parent != '')
  55. <h3>Aggiungi livello a {{$parent}}</h3><br>
  56. @endif
  57. <div class="row mb-3">
  58. <div class="col">
  59. <div class="form--item">
  60. <label for="inputName" class="form-label">Nome</label>
  61. <input class="form-control js-keyupTitle @error('name') is-invalid @enderror" type="text" id="name" placeholder="Nome" wire:model="name">
  62. @error('name')
  63. <div class="invalid-feedback">{{ $message }}</div>
  64. @enderror
  65. </div>
  66. </div>
  67. </div>
  68. <div class="form--item">
  69. <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
  70. @if($add)
  71. <button type="submit" class="btn--ui" wire:click.prevent="store()">Salva</button>
  72. @endif
  73. @if($update)
  74. <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
  75. @endif
  76. </div>
  77. </form>
  78. </div>
  79. </div>
  80. @endif
  81. </div>