Browse Source

fix componenti grafiche verbale

FabioFratini 1 year ago
parent
commit
d62e1a4f40

+ 11 - 1
resources/views/components/verbale/allegati/index.blade.php

@@ -1,7 +1,17 @@
 {{-- resources/views/components/allegati/index.blade.php --}}
 {{-- resources/views/components/allegati/index.blade.php --}}
 @props(['allegati' => []])
 @props(['allegati' => []])
 
 
-@if(isset($allegati) && count($allegati) > 0)
+@php
+    $hasVisibleAllegati = false;
+    foreach ($allegati as $allegato) {
+        if ($allegato->is_visible && $allegato->files) {
+            $hasVisibleAllegati = true;
+            break;
+        }
+    }
+@endphp
+
+@if($hasVisibleAllegati)
     <table width="100%">
     <table width="100%">
         <tr>
         <tr>
             <td width="100%" valign="top" align="center">
             <td width="100%" valign="top" align="center">

+ 49 - 197
resources/views/components/verbale/campo-sinistro/index.blade.php

@@ -1,217 +1,69 @@
 @php
 @php
-    $localizazioneIncidenteMap = [
-        1 => "NELL'ABITATO",
-        2 => "FUORI DALL'ABITATO"
-    ];
-
-    $visibilitaMap = [
-        1 => 'BUONA',
-        2 => 'LIMITATA'
-    ];
-
-    $trafficoMap = [
-        1 => 'NORMALE',
-        2 => 'SCARSO',
-        3 => 'INTENSO'
-    ];
+    $hasData = isset($data['record']->localizzazione_incidente) && $data['record']->localizzazione_incidente != null ||
+               isset($data['record']->condizioni_atmosferiche) && $data['record']->condizioni_atmosferiche != '' ||
+               isset($data['record']->traffico) && $data['record']->traffico != '' ||
+               isset($data['tipo_strada']) && count($data['tipo_strada']) > 0 ||
+               isset($data['record']->tipo_strada_specifica) && $data['record']->tipo_strada_specifica != '';
 @endphp
 @endphp
 
 
-<table width="100%" class="table-title">
-    <tr>
-        <td align="center">
-            <h2>CAMPO DEL SINISTRO</h2>
-        </td>
-    </tr>
-</table>
-
-<table class="table-content" width="100%">
-    @if ($data['record']->sinistro_ora != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>ORA INTERVENTO:</b>
-                {{ $data['record']->sinistro_ora }}:{{ $data['record']->sinistro_minuti }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->localizzazione_incidente != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>LOCALIZZAZIONE INCIDENTE:</b>
-                {{ $localizazioneIncidenteMap[$data['record']->localizzazione_incidente] ?? '' }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->localizzazione_incidente_altro != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->localizzazione_incidente_altro }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->nomenclatura_strada != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>NOMENCLATURA:</b>
-                @php
-                    $nomenclaturaParts = array_filter([
-                        optional($data['record']->nomenclatura)->name,
-                        $data['record']->nomenclatura_strada_numero,
-                        $data['record']->nomenclatura_strada_altro
-                    ]);
-                @endphp
-                {{ implode(', ', $nomenclaturaParts) }}
-            </td>
-        </tr>
-    @endif
-
-    @if (!isset($data['record']->condizioni_atmosferiche))
-        <tr>
-            <td width="100%" align="center">
-                <b>CONDIZIONI ATMOSFERICHE:</b>
-                {{ $data['record']->condizioniatmosferiche }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->condizioni_atmosferiche_altro != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->condizioni_atmosferiche_altro }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->pavimentazione != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>PAVIMENTAZIONE:</b>
-                {{ optional($data['record']->pavimentazione_value)->name }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->pavimentazione_altro != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->pavimentazione_altro }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->condizione_strada != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>CONDIZIONE STRADA:</b>
-                {{ optional($data['record']->condizione_strada_value)->name }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->condizione_strada_altro != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->condizione_strada_altro }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->fondo_stradale != '')
+@if ($hasData)
+    <table width="100%" class="table-title">
         <tr>
         <tr>
-            <td width="100%" align="center">
-                <b>FONDO STRADALE:</b>
-                {{ optional($data['record']->fondo_stradale_value)->name }}
+            <td align="center">
+                <h2>CAMPO DEL SINISTRO</h2>
             </td>
             </td>
         </tr>
         </tr>
-    @endif
+    </table>
 
 
-    @if ($data['record']->fondo_stradale_specifica != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->fondo_stradale_specifica }}
-            </td>
-        </tr>
-    @endif
 
 
-    @if (count($data['condizioni_luce']) > 0)
-        <tr class="tr-title">
-            <td width="100%" align="center">
-                CONDIZIONI DI LUCE:
-            </td>
-        </tr>
-        @foreach ($data['condizioni_luce'] as $condizioni_luce)
+    <table width="100%">
+        @if (isset($data['record']->localizzazione_incidente) && $data['record']->localizzazione_incidente !== null)
             <tr>
             <tr>
-                <td align="center">
-                    {{ optional($condizioni_luce->condizioni_luce)->name }}
+                <td width="100%" align="center">
+                    <b>LOCALIZZAZIONE INCIDENTE:</b>
+                    {{ $localizazioneIncidenteMap[$data['record']->localizzazione_incidente] ?? '' }}
                 </td>
                 </td>
             </tr>
             </tr>
-        @endforeach
-    @endif
-
-    @if ($data['record']->visibilita != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>VISIBILITA':</b>
-                {{ $visibilitaMap[$data['record']->visibilita] ?? '' }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->visibilita_specifica != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->visibilita_specifica }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->particolarita_strada != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>PARTICOLARITA' STRADA:</b>
-                {{ optional($data['record']->particolarita_strada_value)->name }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->particolarita_strada_specifica != '')
-        <tr>
-            <td width="100%" align="center">
-                {{ $data['record']->particolarita_strada_specifica }}
-            </td>
-        </tr>
-    @endif
-
-    @if ($data['record']->traffico != '')
-        <tr>
-            <td width="100%" align="center">
-                <b>TRAFFICO:</b>
-                {{ $trafficoMap[$data['record']->traffico] ?? '' }}
-            </td>
-        </tr>
-    @endif
+        @endif
 
 
-    @if (count($data['tipo_strada']) > 0)
-        <tr class="tr-title">
-            <td width="100%" align="center">
-                TIPO STRADA:
-            </td>
-        </tr>
-        @foreach ($data['tipo_strada'] as $tipo_strada)
+        @if (isset($data['record']->condizioni_atmosferiche) && $data['record']->condizioni_atmosferiche != '')
             <tr>
             <tr>
-                <td align="center">
-                    {{ optional($tipo_strada->tipo_strada)->name }}
+                <td width="100%" align="center">
+                    <b>CONDIZIONI ATMOSFERICHE:</b>
+                    {{ $data['record']->condizioni_atmosferiche }}
                 </td>
                 </td>
             </tr>
             </tr>
-        @endforeach
-        @if ($data['record']->tipo_strada_specifica != '')
+        @endif
+
+        @if (isset($data['record']->traffico) && $data['record']->traffico != '')
             <tr>
             <tr>
                 <td width="100%" align="center">
                 <td width="100%" align="center">
-                    {{ $data['record']->tipo_strada_specifica }}
+                    <b>TRAFFICO:</b>
+                    {{ $trafficoMap[$data['record']->traffico] ?? '' }}
+                </td>
+            </tr>
+        @endif
+
+        @if (isset($data['tipo_strada']) && count($data['tipo_strada']) > 0)
+            <tr class="tr-title">
+                <td width="100%" align="center">
+                    TIPO STRADA:
                 </td>
                 </td>
             </tr>
             </tr>
+            @foreach ($data['tipo_strada'] as $tipo_strada)
+                <tr>
+                    <td align="center">
+                        {{ optional($tipo_strada->tipo_strada)->name }}
+                    </td>
+                </tr>
+            @endforeach
+            @if (isset($data['record']->tipo_strada_specifica) && $data['record']->tipo_strada_specifica != '')
+                <tr>
+                    <td width="100%" align="center">
+                        {{ $data['record']->tipo_strada_specifica }}
+                    </td>
+                </tr>
+            @endif
         @endif
         @endif
-    @endif
-</table>
+    </table>
+@endif

+ 5 - 5
resources/views/components/verbale/intestazione/index.blade.php

@@ -1,15 +1,15 @@
 <table width="100%">
 <table width="100%">
     <tr>
     <tr>
-        <td style='width:50%'>
-            <h2>
+        <td style='width:70%'>
+            <h2 style="color: darkblue; font-size: 20px; font-weight: bold; text-transform: uppercase;">
                 COPIA
                 COPIA
             </h2>
             </h2>
             Protocollo n. {{ @$data['record']->protocollo_num }} / {{ @$data['record']->protocollo_anno }}
             Protocollo n. {{ @$data['record']->protocollo_num }} / {{ @$data['record']->protocollo_anno }}
         </td>
         </td>
-        <td style='width:50%;'>
-            <p style="color: gray; font-style: italic; text-transform: none;">Si rilascia il presente atto composto da n.{{ @$data['total_pages'] }} pagine in carta libera per uso
+        <td class="pt-0 mt-0" style='width:30%;'>
+            <p style="color: grey; font-style: italic!important;font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;font-size: 14px;line-height: 1.4;text-transform: none!important;">Si rilascia il presente atto composto<br> da n.{{ @$data['total_pages'] }} pagine in carta libera per<br> uso
                 consentito</p>
                 consentito</p>
-            <h3>Comm. coor. Francesco Marozza</h3>
+            <h5>Comm. coor. Francesco Marozza</h3>
         </td>
         </td>
     </tr>
     </tr>
 </table>
 </table>

+ 79 - 61
resources/views/components/verbale/segnalazione/index.blade.php

@@ -1,86 +1,104 @@
-<table width="100%" class="table-title">
-    <tr>
-        <td align="center">
-            <h2>SEGNALAZIONE</h2>
-        </td>
-    </tr>
-</table>
+@php
+    $hasData = (isset($data['record']->segnalazione_data) && !empty($data['record']->segnalazione_data)  && \Carbon\Carbon::parse($data['record']->segnalazione_data)->year > 0) ||
+               (isset($data['record']->segnalazione_ora) && !empty($data['record']->segnalazione_ora)) ||
+               (isset($data['record']->segnalazione_minuti) && !empty($data['record']->segnalazione_minuti)) ||
+               (isset($data['tipo_segnalazione']) && count($data['tipo_segnalazione']) > 0) ||
+               (isset($data['record']->segnalazione_altro) && !empty($data['record']->segnalazione_altro)) ||
+               (isset($data['segnalazione_pervenuta_da']) && count($data['segnalazione_pervenuta_da']) > 0) ||
+               (isset($data['ausilio_altri_enti']) && count($data['ausilio_altri_enti']) > 0) ||
+               (isset($data['record']->ausilio_altri_enti_motivo) && !empty($data['record']->ausilio_altri_enti_motivo)) ||
+               (isset($data['record']->ausilio_altri_enti_ora_intervento) && !empty($data['record']->ausilio_altri_enti_ora_intervento));
+@endphp
 
 
-<table class="table-content" width="100%">
-    @if ($data['record']->segnalazione_data != '')
-        <tr>
-            <td width="100%" align="center">
-                SEGNALAZIONE DEL {{ \Carbon\Carbon::parse($data['record']->segnalazione_data)->format('d/m/Y') }}
-                DELLE {{ $data['record']->segnalazione_ora }}:{{ $data['record']->segnalazione_minuti }}
-            </td>
-        </tr>
-    @endif
-
-    <tr class="tr-title">
-        <td width="100%" align="center">
-            A MEZZO:
-        </td>
-    </tr>
-
-    @foreach ($data['tipo_segnalazione'] as $tipo_segnalazione)
+@if ($hasData)
+    <table width="100%" class="table-title">
         <tr>
         <tr>
             <td align="center">
             <td align="center">
-                {{ optional($tipo_segnalazione->tipo_segnalazione)->name }}
+                <h2>SEGNALAZIONE</h2>
             </td>
             </td>
         </tr>
         </tr>
-    @endforeach
+    </table>
 
 
-    @if ($data['record']->segnalazione_altro != '')
+    <table class="table-content" width="100%">
+        @if (isset($data['record']->segnalazione_data) && !empty($data['record']->segnalazione_data) && \Carbon\Carbon::parse($data['record']->segnalazione_data)->year > 0)
         <tr>
         <tr>
-            <td align="center">
-                {{ $data['record']->segnalazione_altro }}
+            <td width="100%" align="center">
+                SEGNALAZIONE DEL {{ \Carbon\Carbon::parse($data['record']->segnalazione_data)->format('d/m/Y') }}
+                @if (isset($data['record']->segnalazione_ora) && isset($data['record']->segnalazione_minuti))
+                    DELLE {{ $data['record']->segnalazione_ora }}:{{ $data['record']->segnalazione_minuti }}
+                @endif
             </td>
             </td>
         </tr>
         </tr>
     @endif
     @endif
 
 
-    <tr class="tr-title">
-        <td width="100%" align="center">
-            PERVENUTA DA:
-        </td>
-    </tr>
-    @foreach ($data['segnalazione_pervenuta_da'] as $segnalazione_pervenuta_da)
-        <tr>
-            <td align="center">
-                {{ optional($segnalazione_pervenuta_da->segnalazione_pervenuta_da)->name }}
-            </td>
-        </tr>
-    @endforeach
-
-    @if (count($data['ausilio_altri_enti']) > 0)
-        <tr class="tr-title">
-            <td width="100%" align="center">
-                AUSILIO ALTRI ENTI:
-            </td>
-        </tr>
+        @if (isset($data['tipo_segnalazione']) && count($data['tipo_segnalazione']) > 0)
+            <tr class="tr-title">
+                <td width="100%" align="center">
+                    A MEZZO:
+                </td>
+            </tr>
+            @foreach ($data['tipo_segnalazione'] as $tipo_segnalazione)
+                <tr>
+                    <td align="center">
+                        {{ optional($tipo_segnalazione->tipo_segnalazione)->name }}
+                    </td>
+                </tr>
+            @endforeach
+        @endif
 
 
-        @foreach ($data['ausilio_altri_enti'] as $ausilio_altri_enti)
+        @if (isset($data['record']->segnalazione_altro) && !empty($data['record']->segnalazione_altro))
             <tr>
             <tr>
                 <td align="center">
                 <td align="center">
-                    {{ optional($ausilio_altri_enti->ausilio_altri_enti)->name }}
+                    {{ $data['record']->segnalazione_altro }}
                 </td>
                 </td>
             </tr>
             </tr>
-        @endforeach
+        @endif
 
 
-        @if ($data['record']->ausilio_altri_enti_motivo != '')
-            <tr>
-                <td align="center">
-                    {{ $data['record']->ausilio_altri_enti_motivo }}
+        @if (isset($data['segnalazione_pervenuta_da']) && count($data['segnalazione_pervenuta_da']) > 0)
+            <tr class="tr-title">
+                <td width="100%" align="center">
+                    PERVENUTA DA:
                 </td>
                 </td>
             </tr>
             </tr>
+            @foreach ($data['segnalazione_pervenuta_da'] as $segnalazione_pervenuta_da)
+                <tr>
+                    <td align="center">
+                        {{ optional($segnalazione_pervenuta_da->segnalazione_pervenuta_da)->name }}
+                    </td>
+                </tr>
+            @endforeach
         @endif
         @endif
 
 
-        @if ($data['record']->ausilio_altri_enti_ora_intervento != '')
-            <tr>
+        @if (isset($data['ausilio_altri_enti']) && count($data['ausilio_altri_enti']) > 0)
+            <tr class="tr-title">
                 <td width="100%" align="center">
                 <td width="100%" align="center">
-                    ORA INTERVENTO:
-                    {{ $data['record']->ausilio_altri_enti_ora_intervento }}:{{ $data['record']->ausilio_altri_enti_minuti_intervento }}
+                    AUSILIO ALTRI ENTI:
                 </td>
                 </td>
             </tr>
             </tr>
+            @foreach ($data['ausilio_altri_enti'] as $ausilio_altri_enti)
+                <tr>
+                    <td align="center">
+                        {{ optional($ausilio_altri_enti->ausilio_altri_enti)->name }}
+                    </td>
+                </tr>
+            @endforeach
+
+            @if (isset($data['record']->ausilio_altri_enti_motivo) && !empty($data['record']->ausilio_altri_enti_motivo))
+                <tr>
+                    <td align="center">
+                        {{ $data['record']->ausilio_altri_enti_motivo }}
+                    </td>
+                </tr>
+            @endif
+
+            @if (isset($data['record']->ausilio_altri_enti_ora_intervento) && !empty($data['record']->ausilio_altri_enti_ora_intervento))
+                <tr>
+                    <td width="100%" align="center">
+                        ORA INTERVENTO:
+                        {{ $data['record']->ausilio_altri_enti_ora_intervento }}:{{ $data['record']->ausilio_altri_enti_minuti_intervento }}
+                    </td>
+                </tr>
+            @endif
         @endif
         @endif
-    @endif
-</table>
+    </table>
+@endif