index.blade.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. @if (!empty($data['parti_coinvolte']))
  2. @php
  3. $vehicles = collect($data['parti_coinvolte'])->filter(function ($item) {
  4. return $item->conducente_o_pedone == 2;
  5. });
  6. @endphp
  7. @if ($vehicles->count() > 0)
  8. <style>
  9. .striped-table {
  10. width: 100%;
  11. border-collapse: collapse;
  12. }
  13. .striped-table th, .striped-table td {
  14. border: 1px solid #000;
  15. padding: 8px;
  16. }
  17. .striped-table tr:nth-child(even) {
  18. background-color: #f2f2f2;
  19. }
  20. .striped-table tr:nth-child(odd) {
  21. background-color: #fff;
  22. }
  23. </style>
  24. <table width="100%" class="table-title">
  25. <tr>
  26. <td align="center">
  27. <h2>VEICOLI COINVOLTI</h2>
  28. </td>
  29. </tr>
  30. </table>
  31. <table class="table-content striped-table" width="100%">
  32. <thead>
  33. <tr>
  34. <th width="33%" align="center">VEICOLO</th>
  35. <th width="33%" align="center">TARGA</th>
  36. <th width="33%" align="center">CONDUCENTE</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. @foreach ($vehicles as $veicolo)
  41. <tr>
  42. <td width="33%" align="center">
  43. {{ optional(optional($veicolo->veicolo_data)->marca)->name }}
  44. {{ optional(optional($veicolo->veicolo_data)->modello)->name }}
  45. </td>
  46. <td width="33%" align="center">
  47. {{ optional($veicolo->veicolo_data)->targa }}
  48. </td>
  49. <td width="33%" align="center">
  50. {{ optional($veicolo->anagrafica_data)->lastname }}
  51. {{ optional($veicolo->anagrafica_data)->firstname }}
  52. </td>
  53. </tr>
  54. @endforeach
  55. </tbody>
  56. </table>
  57. @endif
  58. @endif