verticale.blade.php 3.6 KB

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