verticale.blade.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. @php
  2. $verticaleAreas = [
  3. 'segnaletica_verticale_1',
  4. 'segnaletica_verticale_2',
  5. 'segnaletica_verticale_3',
  6. 'segnaletica_verticale_4'
  7. ];
  8. @endphp
  9. @foreach ($verticaleAreas as $index => $area)
  10. @php
  11. $viaKey = $area . '_via';
  12. $direzioneKey = $area . '_direzione';
  13. $altroKey = $area . '_altro';
  14. $hasData = isset($data['record']->{$viaKey}) && $data['record']->{$viaKey} != '' ||
  15. isset($data['record']->{$direzioneKey}) && $data['record']->{$direzioneKey} != '' ||
  16. isset($data['record']->{$altroKey}) && $data['record']->{$altroKey} != '' ||
  17. (isset($data[$area]) && count($data[$area]) > 0);
  18. @endphp
  19. @if ($hasData)
  20. <style>
  21. .striped-table {
  22. width: 100%;
  23. border-collapse: collapse;
  24. }
  25. .striped-table th,
  26. .striped-table td {
  27. border: 1px solid #000;
  28. padding: 8px;
  29. }
  30. .striped-table tr:nth-child(even) {
  31. background-color: #f2f2f2;
  32. }
  33. .striped-table tr:nth-child(odd) {
  34. background-color: #fff;
  35. }
  36. </style>
  37. <table width="100%" class="table-title">
  38. <tr>
  39. <td style="{{ $index !== 0 ? 'border: none;' : '' }}" align="center">
  40. <h2>SEGNALETICA VERTICALE {{$index + 1}}</h2>
  41. </td>
  42. </tr>
  43. </table>
  44. <table class="table-content striped-table" width="100%">
  45. @if (isset($data['record']->{$viaKey}) && $data['record']->{$viaKey} != '')
  46. <tr>
  47. <td width="100%" align="center" style="padding-bottom: 10px !important;border: none!important">
  48. <b>VIA DI RIFERIMENTO:</b>
  49. {{ optional($data['record']->{$viaKey . '_value'})->TOPONIMO }}
  50. {{ optional($data['record']->{$viaKey . '_value'})->DESCRIZIONE }}
  51. </td>
  52. </tr>
  53. @endif
  54. @if (isset($data['record']->{$direzioneKey}) && $data['record']->{$direzioneKey} != '')
  55. <tr>
  56. <td width="100%" align="center" style="padding-bottom: 10px !important;border: none!important">
  57. <b>DIREZIONE:</b> {{ $data['record']->{$direzioneKey} }}
  58. </td>
  59. </tr>
  60. @endif
  61. @if (isset($data[$area]) && count($data[$area]) > 0)
  62. @foreach ($data[$area] as $index => $segnaletica_verticale)
  63. <tr>
  64. <td align="center" width="100%" style="padding-bottom: 10px !important;border: none!important">
  65. <b>DETTAGLIO SEGNALETICA VERTICALE: {{$index + 1}}</b>
  66. {{ optional($segnaletica_verticale->segnaletica_verticale)->name }}
  67. </td>
  68. </tr>
  69. @endforeach
  70. @endif
  71. @if (isset($data['record']->{$altroKey}) && $data['record']->{$altroKey} != '')
  72. <tr>
  73. <td width="100%" align="center" style="padding-bottom: 10px !important;border: none!important">
  74. <b>ALTRO:</b>{{ $data['record']->{$altroKey} }}
  75. </td>
  76. </tr>
  77. @endif
  78. </table>
  79. @endif
  80. @endforeach