Luca Parisio 1 ヶ月 前
コミット
616b34e3d4

+ 7 - 7
app/Http/Livewire/Prefettura.php

@@ -288,7 +288,7 @@ class Prefettura extends Component
                     }
                     $activeWorksheet->setCellValue('D' . $idx, $prov_code);
                     $activeWorksheet->setCellValue('E' . $idx, $town_code);
-                    $activeWorksheet->setCellValue('F' . $idx, "???");
+                    $activeWorksheet->setCellValue('F' . $idx, $report->tipo_incidente);
                     $tipo_strada = ' ';
                     $types_saved = \App\Models\ReportTipoStrada::where('report_id', $report->id)
                         ->pluck('tipo_strada_id')
@@ -302,7 +302,7 @@ class Prefettura extends Component
                         elseif (in_array(4, $types_saved))
                             $tipo_strada = 3;
                     }
-                    $activeWorksheet->setCellValue('G' . $idx, $tipo_strada);
+                    $activeWorksheet->setCellValue('G' . $idx, $report->tipo_strada_prefettura);
 
                     if ($report->localizzazione_incidente == Prefettura::LOCALIZZAZIONE_INCIDENTE_IN) {
                         switch ($report->nomenclatura_strada) {
@@ -365,8 +365,8 @@ class Prefettura extends Component
                             break;
                     }
                     
-                    $activeWorksheet->setCellValue('I' . $idx, $int);
-                    $activeWorksheet->setCellValue('J' . $idx, $report->condizione_strada == 2 ? "S" : "N");
+                    $activeWorksheet->setCellValue('I' . $idx, $report->autorita);
+                    $activeWorksheet->setCellValue('J' . $idx, $report->caratteristiche);
                     $activeWorksheet->setCellValue('K' . $idx, "N");
 
                     $deceduti = 0;
@@ -521,11 +521,11 @@ class Prefettura extends Component
 
                     $activeWorksheet->setCellValue('AF' . $idx, $km);
                     $activeWorksheet->setCellValue('AG' . $idx, $metri);
-                    $activeWorksheet->setCellValue('AH' . $idx, "");
+                    $activeWorksheet->setCellValue('AH' . $idx, $report->carreggiata);
                     $activeWorksheet->setCellValue('AI' . $idx, "");
                     $activeWorksheet->setCellValue('AJ' . $idx, "");
-                    $activeWorksheet->setCellValue('AK' . $idx, "???");
-                    $activeWorksheet->setCellValue('AL' . $idx, "???");
+                    $activeWorksheet->setCellValue('AK' . $idx, "");
+                    $activeWorksheet->setCellValue('AL' . $idx, $report->positivita);
                     $activeWorksheet->setCellValue('AM' . $idx, $report->cds);
                     $activeWorksheet->setCellValue('AN' . $idx, $item->latitude);
                     $activeWorksheet->setCellValue('AO' . $idx, $item->longitude);

+ 37 - 0
app/Http/Livewire/Report.php

@@ -162,6 +162,13 @@ class Report extends Component
         $tipo_strada_altro,
         $traffico;
 
+    public $tipo_incidente,
+        $tipo_strada_prefettura,
+        $autorita,
+        $caratteristiche,
+        $carreggiata,
+        $positivita;
+
     public $segnaletica,
         $organo,
         $segnaletica_verticale_1_via,
@@ -400,6 +407,12 @@ class Report extends Component
         $this->danni_cose_diverse_da_veicoli = '';
         $this->condizioni_luce = [];
         $this->tipo_strada = [];
+        $this->tipo_incidente = '';
+        $this->tipo_strada_prefettura = '';
+        $this->autorita = '';
+        $this->caratteristiche = '';
+        $this->carreggiata = '';
+        $this->positivita = '';
         $this->sinistro_ora = '';
         $this->sinistro_minuti = '';
         $this->localizzazione_incidente = '';
@@ -682,6 +695,14 @@ class Report extends Component
                     'segnalazione_ora' => $this->segnalazione_ora,
                     'segnalazione_minuti' => $this->segnalazione_minuti,
                     'sinistro_ora' => $this->sinistro_ora,
+
+                    'tipo_incidente' => $this->tipo_incidente,
+                    'tipo_strada_prefettura' => $this->tipo_strada_prefettura,
+                    'autorita' => $this->autorita,
+                    'caratteristiche' => $this->caratteristiche,
+                    'carreggiata' => $this->carreggiata,
+                    'positivita' => $this->positivita,
+
                     'sinistro_minuti' => $this->sinistro_minuti,
                     'localizzazione_incidente' => $this->localizzazione_incidente,
                     'nomenclatura_strada' => $this->nomenclatura_strada,
@@ -810,6 +831,14 @@ class Report extends Component
                 $this->condizioni_luce = \App\Models\ReportCondizioniLuce::where('report_id', $idReport)->pluck('condizioni_luce_id');
                 $this->tipo_strada = \App\Models\ReportTipoStrada::where('report_id', $idReport)->pluck('tipo_strada_id');
                 $this->sinistro_ora = $record->sinistro_ora;
+
+                $this->tipo_incidente = $record->tipo_incidente;
+                $this->tipo_strada_prefettura = $record->tipo_strada_prefettura;
+                $this->autorita = $record->autorita;
+                $this->caratteristiche = $record->caratteristiche;
+                $this->carreggiata = $record->carreggiata;
+                $this->positivita = $record->positivita;
+
                 $this->sinistro_minuti = $record->sinistro_minuti;
                 $this->localizzazione_incidente = $record->localizzazione_incidente;
                 $this->localizzazione_incidente_altro = $record->localizzazione_incidente_altro;
@@ -999,6 +1028,14 @@ class Report extends Component
                 'ripristino_ora_arrivo' => $this->ripristino_ora_arrivo,
                 'ripristino_minuti_arrivo' => $this->ripristino_minuti_arrivo,
                 'danni_cose_diverse_da_veicoli' => $this->danni_cose_diverse_da_veicoli,
+
+                'tipo_incidente' => $this->tipo_incidente,
+                'tipo_strada_prefettura' => $this->tipo_strada_prefettura,
+                'autorita' => $this->autorita,
+                'caratteristiche' => $this->caratteristiche,
+                'carreggiata' => $this->carreggiata,
+                'positivita' => $this->positivita,
+                
                 'sinistro_ora' => $this->sinistro_ora,
                 'sinistro_minuti' => $this->sinistro_minuti,
                 'localizzazione_incidente' => $this->localizzazione_incidente,

+ 7 - 1
app/Models/Report.php

@@ -154,7 +154,13 @@ public $timestamps = false;
         'locked' ,
         'locked_by' ,
         'latitude',
-        'longitude'
+        'longitude',
+        'tipo_incidente',
+        'tipo_strada_prefettura',
+        'autorita',
+        'caratteristiche',
+        'carreggiata',
+        'positivita'
     ];
 
     public function localita()

+ 34 - 0
database/migrations/2025_12_09_150000_add_prefettura_fields_to_fcf_reports_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    public function up()
+    {
+        Schema::table('fcf_reports_reports', function (Blueprint $table) {            
+            $table->string('tipo_incidente')->nullable();
+            $table->string('tipo_strada_prefettura')->nullable();
+            $table->string('autorita')->nullable();
+            $table->string('caratteristiche')->nullable();
+            $table->string('carreggiata')->nullable();
+            $table->string('positivita')->nullable();
+        });
+    }
+    /**
+     * Reverse the migrations.
+     */
+    public function down()
+    {
+        Schema::table('fcf_reports_reports', function (Blueprint $table) {
+            $table->dropColumn('tipo_incidente');
+            $table->dropColumn('tipo_strada_prefettura');
+            $table->dropColumn('autorita');
+            $table->dropColumn('caratteristiche');
+            $table->dropColumn('carreggiata');
+            $table->dropColumn('positivita');
+        });
+    }
+};

+ 101 - 0
public/targa.php

@@ -0,0 +1,101 @@
+<?php
+$targa = isset($_GET["targa"]) ? $_GET["targa"] : '';
+$targa = "FM636CP";
+try{
+    $wd = "dettaglioAutoveicoloBase";
+    $wd = "datiCartaCircolazioneAutoveicoloProprietario";
+
+    
+
+    $url = 'https://www.ilportaledellautomobilista.it/Info-ws/services';
+    $client = new \SoapClient($url . '/' . $wd . '/' . $wd . '.wsdl', array(
+        'stream_context' => stream_context_create(array(
+            'ssl' => array(
+                'verify_peer' => false,
+                'verify_peer_name' => false,
+                'allow_self_signed' => true
+            )
+        )),
+        'trace' => 1
+    ));
+
+    $utente = 'CMRM001301';
+    $password = '2PMPM*89';
+
+    $xml = '<wsse:Security
+    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
+    SOAP-ENV:mustUnderstand="1">
+    <wsse:UsernameToken
+        xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+        wsu:Id="XWSSGID-1253605895203984534550">
+        <wsse:Username>' . $utente . '</wsse:Username>
+        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>
+    </wsse:UsernameToken>
+    </wsse:Security>';
+
+    $header = new \SoapHeader(
+        'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',
+        'Security',
+        new \SoapVar($xml, XSD_ANYXML),
+        true
+    );
+    $client->__setSoapHeaders($header);
+    $classe = "dettaglioAutoveicoloBase";
+    $classe = "dettaglioCartaCircolazioneProprietarioAutoveicolo";
+
+    try {
+        $obj = $client->__soapCall($classe, array(
+            $classe . "Request" => array(
+                "login" => array(),
+                "targa" => array("numeroTarga" => $targa),
+                "pdf" => false
+            )
+        ));
+
+        echo "<h3>RESPONSE OBJECT</h3>";
+        print_r($obj);
+
+        echo "<hr><h3>SOAP REQUEST HEADERS</h3>";
+        echo "<pre>" . htmlspecialchars($client->__getLastRequestHeaders()) . "</pre>";
+
+        echo "<h3>SOAP REQUEST</h3>";
+        echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
+
+        echo "<hr><h3>SOAP RESPONSE HEADERS</h3>";
+        echo "<pre>" . htmlspecialchars($client->__getLastResponseHeaders()) . "</pre>";
+
+        echo "<h3>SOAP RESPONSE</h3>";
+        echo "<pre>" . htmlspecialchars($client->__getLastResponse()) . "</pre>";
+
+    } catch (\SoapFault $fault) {
+        $this->loadTarga = $fault->getMessage();
+
+        echo "<h3>SOAP ERROR</h3>";
+        echo $fault->getMessage();
+
+        echo "<h3>Last SOAP Request</h3>";
+        echo "<pre>" . htmlspecialchars($client->__getLastRequest()) . "</pre>";
+    }
+    /*
+    try {
+        $this->loadTarga = "OK";
+        $obj = $client->__soapCall($classe, array(
+            $classe . "Request" => array(
+                "login" => array(),
+                "targa" => array("numeroTarga" => $targa),
+                "pdf" => false
+            )
+        ));
+
+        
+        print_r($obj);
+        
+    } catch (\SoapFault $fault) {
+        $this->loadTarga = $fault->getMessage();
+    }
+        */
+} catch (\Exception $ex) {
+    print($ex->getMessage());
+}
+?>
+

+ 1 - 1
resources/views/components/report/campo-sinistro/campo-sinistro.blade.php

@@ -242,4 +242,4 @@
             </div>
         </div>
     </div>
-</div>
+</div>

+ 4 - 0
resources/views/components/report/modifica/menu.blade.php

@@ -30,5 +30,9 @@
             <a class="nav-link" id="tab7-tab" data-toggle="pill" href="#tab7" role="tab"
                 aria-controls="tab7" aria-selected="false">Allegati</a>
         </li>
+        <li class="nav-item" wire:ignore>
+            <a class="nav-link" id="tab8-tab" data-toggle="pill" href="#tab8" role="tab"
+                aria-controls="tab8" aria-selected="false">Prefettura</a>
+        </li>
     </ul>
 </div>

+ 123 - 0
resources/views/components/report/prefettura/prefettura.blade.php

@@ -0,0 +1,123 @@
+<div class="tab-pane fade mt-3" id="tab8" role="tabpanel" aria-labelledby="tab8-tab" wire:ignore.self>
+    <div class="row">
+        <div class="col">
+            <div class="card card-primary">
+                <div class="card-header">
+                    <h3 class="card-title">Prefettura</h3>
+                </div>
+                <div class="card-body">
+
+                    <div class="row">
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Tipo incidente</label>
+                                <select class="form-control" wire:model="tipo_incidente">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="1">SCONTRO FRONTALE</option>
+                                    <option value="2">SCONTRO LATERALE</option>
+                                    <option value="3">FUORIUSCITA/SBANDAMENTO</option>
+                                    <option value="4">TAMPONAMENTO</option>
+                                    <option value="5">URTO CON OSTACOLO FISSO</option>
+                                    <option value="6">INVESTIMENTO ANIMALE</option>
+                                    <option value="7">INVESTIMENTO PEDONE</option>
+                                    <option value="8">ALTRO</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Tipo strada</label>
+                                <select class="form-control" wire:model="tipo_strada_prefettura">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="0">ALTRO</option>
+                                    <option value="1">AUTOSTRADA</option>
+                                    <option value="2">STATALE</option>
+                                    <option value="3">REGIONALE</option>
+                                    <option value="4">PROVINCIALE</option>
+                                    <option value="5">COMUNALE</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Autorità</label>
+                                <select class="form-control" wire:model="autorita">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="1">POLIZIA STRADALE</option>
+                                    <option value="2">POLIZIA LOCALE</option>
+                                    <option value="3">CARABINIERI</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Caratteristiche</label>
+                                <select class="form-control" wire:model="caratteristiche">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="1">INCROCIO</option>
+                                    <option value="2">ROTATORIA</option>
+                                    <option value="3">INTERSEZIONE SEGNALATA</option>
+                                    <option value="4">INTERSEZIONE CON SEMAFORO O VIGILE</option>
+                                    <option value="5">INTERSEZIONE NON SEGNALATA</option>
+                                    <option value="6">PASSAGGIO A LIVELLO</option>
+                                    <option value="7">RETTILINEO</option>
+                                    <option value="8">CURVA</option>
+                                    <option value="9">RACCORDO CONVESSO (DOSSO)</option>
+                                    <option value="10">PENDENZA PERICOLOSA</option>
+                                    <option value="11">GALLERIA ILLUMINATA</option>
+                                    <option value="12">GALLERIA NON ILLUMINATA</option>
+                                    <option value="13">INTERSEZIONE CON SEMAF. GIALLO. LAMPEGG.</option>
+                                    <option value="14">PASSAGGIO A LIVELLO CUSTODITO</option>
+                                    <option value="15">PASSAGGIO A LIVELLO NON CUSTODITO</option>
+                                    <option value="16">RACCORDO CONCAVO (CUNETTA)</option>
+                                    <option value="17">STRETTOIA</option>
+                                    <option value="18">PIANEGGIANTE</option>
+                                    <option value="19">CURVA A DESTRA</option>
+                                    <option value="20">CURVA A SINISTRA</option>
+                                    <option value="21">SALITA</option>
+                                    <option value="22">DISCESA</option>
+                                    <option value="23">VIADOTTO</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Carreggiata</label>
+                                <select class="form-control" wire:model="carreggiata">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="1">UNA CARREGGIATA - SENSO UNICO DI MARCIA</option>
+                                    <option value="1">UNA CARREGGIATA - QUATTRO O PIU' CORSIE - SENSO UNICO</option>
+                                    <option value="2">UNA CARREGGIATA - DOPPIO SENSO DUE CORSIE</option>
+                                    <option value="2">UNA CARREGGIATA - TRE CORSIE CON ALTERNANZA DI SORPASSO</option>
+                                    <option value="2">UNA CARREGGIATA - TRE CORSIE SENZA ALTERNANZA DI SORPASSO</option>
+                                    <option value="2">UNA CARREGGIATA - QUATTRO O PIU' CORSIE - DOPPIO SENSO</option>
+                                    <option value="3">DUE CARREGGIATE</option>
+                                    <option value="4">PIU' DI DUE CARREGGIATE</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="col-sm-3">
+                            <div class="form-group">
+                                <label>Positività</label>
+                                <select class="form-control" wire:model="positivita">
+                                    <option value="">-- Seleziona --</option>
+                                    <option value="0">NEGATIVO</option>
+                                    <option value="1">ALCOL</option>
+                                    <option value="2">DROGA</option>
+                                    <option value="3">ALCOL E DROGA</option>
+                                </select>
+                            </div>
+                        </div>
+                        
+                    </div>
+                    
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 4 - 0
resources/views/components/report/veicoli/accordion/osservazioni-veicolo-accordion.blade.php

@@ -100,6 +100,10 @@
                         <option value="Anteriore">Anteriore</option>
                         <option value="Posteriore">Posteriore</option>
                         <option value="Laterale">Laterale</option>                        
+                        <option value="Anteriore-Posteriore">Anteriore-Posteriore</option>
+                        <option value="Anteriore-Laterale">Anteriore-Latereale</option>
+                        <option value="Posteriore-Laterale">Posteriore-Laterale</option>
+                        <option value="Anteriore-Posteriore-Latrale">Anteriore-Posteriore-Laterale</option>
                     </select>
                 </div>
             </div>

+ 2 - 1
resources/views/livewire/report.blade.php

@@ -14,10 +14,11 @@
                 @include('components.report.protocollo.protocollo')
                 @include('components.report.parti.parti-accertatori')
                 @include('components.report.segnalazione.segnalazione-page')
-                @include('components.report.campo-sinistro.campo-sinistro')
+                @include('components.report.campo-sinistro.campo-sinistro')                
                 @include('components.report.segnaletica.segnaletica')
                 @include('components.report.testimoni.testimone')
                 @include('components.report.allegati.allegato')
+                @include('components.report.prefettura.prefettura')
             </div>
             @include('components.report.modifica.footer')
         </form>