|
|
@@ -1,5 +1,7 @@
|
|
|
<?php
|
|
|
+
|
|
|
namespace App\Http\Livewire;
|
|
|
+
|
|
|
use App\Http\Livewire\Traits\HasAccertatore;
|
|
|
use App\Http\Livewire\Traits\HasAnagrafica;
|
|
|
use App\Http\Livewire\Traits\HasNote;
|
|
|
@@ -21,7 +23,9 @@ use App\Models\ReportDataVeicoli;
|
|
|
use App\Models\Vehicle;
|
|
|
use \Illuminate\Support\Facades\DB;
|
|
|
use \Illuminate\Support\Facades\Log;
|
|
|
-class Report extends Component{
|
|
|
+
|
|
|
+class Report extends Component
|
|
|
+{
|
|
|
|
|
|
use WithPagination;
|
|
|
use WithFileUploads;
|
|
|
@@ -95,10 +99,10 @@ class Report extends Component{
|
|
|
$note_aggiuntive;
|
|
|
|
|
|
public $grado_accertatore_1,
|
|
|
- $grado_accertatore_2,
|
|
|
- $grado_accertatore_3,
|
|
|
- $grado_accertatore_4,
|
|
|
- $grado_accertatore_5;
|
|
|
+ $grado_accertatore_2,
|
|
|
+ $grado_accertatore_3,
|
|
|
+ $grado_accertatore_4,
|
|
|
+ $grado_accertatore_5;
|
|
|
|
|
|
public $rilievi_id;
|
|
|
|
|
|
@@ -277,6 +281,8 @@ class Report extends Component{
|
|
|
public $infortunato;
|
|
|
public $infortunato_ospedale;
|
|
|
public $cds;
|
|
|
+ public $showModal = false;
|
|
|
+
|
|
|
|
|
|
protected $rules = [
|
|
|
//'name' => 'required'
|
|
|
@@ -304,7 +310,8 @@ class Report extends Component{
|
|
|
'particolarita_strada.required' => 'Il campo particolarità strada è obbligatorio ai fini della validazione del verbale',
|
|
|
];
|
|
|
|
|
|
- public function resetFields(){
|
|
|
+ public function resetFields()
|
|
|
+ {
|
|
|
$this->name = '';
|
|
|
$this->validated = false;
|
|
|
$this->necessita_nulla_osta = false;
|
|
|
@@ -477,45 +484,48 @@ class Report extends Component{
|
|
|
$this->emit('load-select');
|
|
|
}
|
|
|
|
|
|
- public function showSegnaleticaVerticale(){
|
|
|
- if (!$this->div_segnaletica_verticale_2){
|
|
|
+ public function showSegnaleticaVerticale()
|
|
|
+ {
|
|
|
+ if (!$this->div_segnaletica_verticale_2) {
|
|
|
$this->div_segnaletica_verticale_2 = true;
|
|
|
- }
|
|
|
- else{
|
|
|
- if (!$this->div_segnaletica_verticale_3){
|
|
|
+ } else {
|
|
|
+ if (!$this->div_segnaletica_verticale_3) {
|
|
|
$this->div_segnaletica_verticale_3 = true;
|
|
|
- }
|
|
|
- else{
|
|
|
- if (!$this->div_segnaletica_verticale_4){
|
|
|
+ } else {
|
|
|
+ if (!$this->div_segnaletica_verticale_4) {
|
|
|
$this->div_segnaletica_verticale_4 = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function showSegnaleticaOrizzontale(){
|
|
|
- if (!$this->div_segnaletica_orizzontale_2){
|
|
|
+ public function showSegnaleticaOrizzontale()
|
|
|
+ {
|
|
|
+ if (!$this->div_segnaletica_orizzontale_2) {
|
|
|
$this->div_segnaletica_orizzontale_2 = true;
|
|
|
- } else{
|
|
|
- if (!$this->div_segnaletica_orizzontale_3){
|
|
|
+ } else {
|
|
|
+ if (!$this->div_segnaletica_orizzontale_3) {
|
|
|
$this->div_segnaletica_orizzontale_3 = true;
|
|
|
- }else{
|
|
|
- if (!$this->div_segnaletica_orizzontale_4){
|
|
|
+ } else {
|
|
|
+ if (!$this->div_segnaletica_orizzontale_4) {
|
|
|
$this->div_segnaletica_orizzontale_4 = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- public function hydrate(){
|
|
|
+ public function hydrate()
|
|
|
+ {
|
|
|
$this->emit('load-select');
|
|
|
$this->emit('load-check');
|
|
|
}
|
|
|
|
|
|
- public function updatingSearch(){
|
|
|
+ public function updatingSearch()
|
|
|
+ {
|
|
|
$this->resetPage();
|
|
|
}
|
|
|
|
|
|
- public function mount(){
|
|
|
+ public function mount()
|
|
|
+ {
|
|
|
$this->provinces = \App\Models\LocationProvince::orderBy('title')->get();
|
|
|
$this->rilievi = \App\Models\Rilievi::orderBy('name')->get();
|
|
|
$this->tipi_urto = \App\Models\TipoUrto::orderBy('name')->get();
|
|
|
@@ -545,12 +555,13 @@ class Report extends Component{
|
|
|
$this->data_polizze = 0;
|
|
|
}
|
|
|
|
|
|
- public function render(){
|
|
|
+ public function render()
|
|
|
+ {
|
|
|
$rows = \App\Models\Report::query()
|
|
|
->leftJoin('fcf_reports_stradario', 'fcf_reports_reports.localita_due', '=', 'fcf_reports_stradario.id')
|
|
|
- ->where(function($query) {
|
|
|
- $query->where('fcf_reports_reports.name', 'like', '%'.$this->search.'%')
|
|
|
- ->orWhere('fcf_reports_stradario.descrizione', 'like', '%'.$this->search.'%');
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->where('fcf_reports_reports.name', 'like', '%' . $this->search . '%')
|
|
|
+ ->orWhere('fcf_reports_stradario.descrizione', 'like', '%' . $this->search . '%');
|
|
|
})
|
|
|
->select('fcf_reports_reports.*')
|
|
|
->orderBy('protocollo_anno', 'DESC')
|
|
|
@@ -559,50 +570,94 @@ class Report extends Component{
|
|
|
|
|
|
return view('livewire.report', ['records' => $rows]);
|
|
|
}
|
|
|
- public function add(){
|
|
|
+
|
|
|
+ public function openModal()
|
|
|
+ {
|
|
|
$this->resetFields();
|
|
|
+ $this->showModal = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function closeModal()
|
|
|
+ {
|
|
|
+ $this->showModal = false;
|
|
|
+ $this->resetFields();
|
|
|
+ $this->emit('modalClosed');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public function add()
|
|
|
+ {
|
|
|
try {
|
|
|
+ $this->protocollo_num = DB::table('fcf_reports_reports')
|
|
|
+ ->where('protocollo_anno', date('Y'))
|
|
|
+ ->max('protocollo_num') + 1;
|
|
|
|
|
|
- $this->protocollo_num = DB::table('fcf_reports_reports')->where('protocollo_anno', date('Y'))->max('protocollo_num') + 1;
|
|
|
$this->protocollo_anno = date('Y');
|
|
|
$this->name = $this->protocollo_num . "/" . $this->protocollo_anno;
|
|
|
- $record = \App\Models\Report::create([
|
|
|
+
|
|
|
+ $reportData = [
|
|
|
'name' => $this->name,
|
|
|
'protocollo_num' => $this->protocollo_num,
|
|
|
'protocollo_anno' => $this->protocollo_anno,
|
|
|
'validated' => $this->validated,
|
|
|
'necessita_nulla_osta' => $this->necessita_nulla_osta,
|
|
|
'data_nulla_osta' => $this->data_nulla_osta,
|
|
|
+ 'localita_uno' => $this->localita_uno,
|
|
|
+ 'localita_due' => $this->localita_due,
|
|
|
+ 'verificatosi_in_data' => $this->verificatosi_in_data,
|
|
|
+ 'verificatosi_in_data_ora' => $this->verificatosi_in_data_ora,
|
|
|
+ 'verificatosi_in_data_minuti' => $this->verificatosi_in_data_minuti,
|
|
|
+ 'rilievi_id' => $this->rilievi_id,
|
|
|
+ 'segnalazione_data' => $this->segnalazione_data,
|
|
|
+ 'segnalazione_ora' => $this->segnalazione_ora,
|
|
|
+ 'segnalazione_minuti' => $this->segnalazione_minuti,
|
|
|
+ 'sinistro_ora' => $this->sinistro_ora,
|
|
|
+ 'sinistro_minuti' => $this->sinistro_minuti,
|
|
|
+ 'localizzazione_incidente' => $this->localizzazione_incidente,
|
|
|
+ 'nomenclatura_strada' => $this->nomenclatura_strada,
|
|
|
+ 'condizioni_atmosferiche' => $this->condizioni_atmosferiche,
|
|
|
+ 'pavimentazione' => $this->pavimentazione,
|
|
|
+ 'condizione_strada' => $this->condizione_strada,
|
|
|
+ 'fondo_stradale' => $this->fondo_stradale,
|
|
|
+ 'visibilita' => $this->visibilita,
|
|
|
+ 'particolarita_strada' => $this->particolarita_strada,
|
|
|
+ ];
|
|
|
|
|
|
- ]);
|
|
|
- session()->flash('success','Record creato');
|
|
|
+ Log::info('Creating report with data:', $reportData);
|
|
|
+
|
|
|
+ $record = \App\Models\Report::create($reportData);
|
|
|
+
|
|
|
+ session()->flash('success', 'Record creato');
|
|
|
+ $this->closeModal();
|
|
|
$this->edit($record->id);
|
|
|
} catch (\Exception $ex) {
|
|
|
- session()->flash('error','Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
+ session()->flash('error', 'Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public function store(){
|
|
|
+ public function store()
|
|
|
+ {
|
|
|
$this->validate();
|
|
|
try {
|
|
|
\App\Models\Report::create([
|
|
|
'name' => $this->name
|
|
|
]);
|
|
|
- session()->flash('success','Record creato');
|
|
|
+ session()->flash('success', 'Record creato');
|
|
|
$this->resetFields();
|
|
|
$this->add = false;
|
|
|
} catch (\Exception $ex) {
|
|
|
- session()->flash('error','Errore in fase di salvataggio');
|
|
|
+ session()->flash('error', 'Errore in fase di salvataggio');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function edit($idReport){
|
|
|
+ public function edit($idReport)
|
|
|
+ {
|
|
|
$this->resetFields();
|
|
|
try {
|
|
|
$record = \App\Models\Report::findOrFail($idReport);
|
|
|
- if( !$record) {
|
|
|
- session()->flash('error','Record non trovato');
|
|
|
+ if (!$record) {
|
|
|
+ session()->flash('error', 'Record non trovato');
|
|
|
} else {
|
|
|
$this->name = $record->name;
|
|
|
$this->validated = $record->validated;
|
|
|
@@ -764,13 +819,14 @@ class Report extends Component{
|
|
|
$this->add = false;
|
|
|
}
|
|
|
} catch (\Exception $ex) {
|
|
|
- session()->flash('error','Errore (' . $ex->getMessage() . ')');
|
|
|
+ session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
|
}
|
|
|
$this->emit('load-check', "");
|
|
|
}
|
|
|
|
|
|
- public function update($validate = false){
|
|
|
- if ($validate){
|
|
|
+ public function update($validate = false)
|
|
|
+ {
|
|
|
+ if ($validate) {
|
|
|
$rulesValidate = [
|
|
|
'localita_uno' => 'required',
|
|
|
'localita_due' => 'required',
|
|
|
@@ -796,7 +852,7 @@ class Report extends Component{
|
|
|
}
|
|
|
try {
|
|
|
\App\Models\Report::whereId($this->dataId)->update([
|
|
|
- 'name' => '0'.$this->protocollo_num . "/" . $this->protocollo_anno,
|
|
|
+ 'name' => '0' . $this->protocollo_num . "/" . $this->protocollo_anno,
|
|
|
'necessita_nulla_osta' => $this->necessita_nulla_osta,
|
|
|
'data_nulla_osta' => $this->data_nulla_osta,
|
|
|
'protocollo_num' => $this->protocollo_num,
|
|
|
@@ -921,8 +977,7 @@ class Report extends Component{
|
|
|
]);
|
|
|
|
|
|
\App\Models\ReportTipoUrto::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->tipo_urto as $x)
|
|
|
- {
|
|
|
+ foreach ($this->tipo_urto as $x) {
|
|
|
\App\Models\ReportTipoUrto::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'tipo_urto_id' => $x
|
|
|
@@ -930,8 +985,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportTipoSegnalazione::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->tipo_segnalazione as $x)
|
|
|
- {
|
|
|
+ foreach ($this->tipo_segnalazione as $x) {
|
|
|
\App\Models\ReportTipoSegnalazione::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'tipo_segnalazione_id' => $x
|
|
|
@@ -939,8 +993,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnalazionePervenutaDa::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnalazione_pervenuta_da as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnalazione_pervenuta_da as $x) {
|
|
|
\App\Models\ReportSegnalazionePervenutaDa::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnalazione_pervenuta_da_id' => $x
|
|
|
@@ -948,8 +1001,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportMaterialeRecuperato::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->materiale_recuperato as $x)
|
|
|
- {
|
|
|
+ foreach ($this->materiale_recuperato as $x) {
|
|
|
\App\Models\ReportMaterialeRecuperato::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'materiale_recuperato_id' => $x
|
|
|
@@ -957,8 +1009,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportAusilioAltriEnti::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->ausilio_altri_enti as $x)
|
|
|
- {
|
|
|
+ foreach ($this->ausilio_altri_enti as $x) {
|
|
|
\App\Models\ReportAusilioAltriEnti::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'ausilio_altri_enti_id' => $x
|
|
|
@@ -966,8 +1017,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportCondizioniLuce::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->condizioni_luce as $x)
|
|
|
- {
|
|
|
+ foreach ($this->condizioni_luce as $x) {
|
|
|
\App\Models\ReportCondizioniLuce::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'condizioni_luce_id' => $x
|
|
|
@@ -975,8 +1025,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportTipoStrada::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->tipo_strada as $x)
|
|
|
- {
|
|
|
+ foreach ($this->tipo_strada as $x) {
|
|
|
\App\Models\ReportTipoStrada::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'tipo_strada_id' => $x
|
|
|
@@ -984,8 +1033,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaVerticale1::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_verticale_1 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_verticale_1 as $x) {
|
|
|
\App\Models\ReportSegnaleticaVerticale1::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_verticale_id' => $x
|
|
|
@@ -993,8 +1041,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaVerticale2::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_verticale_2 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_verticale_2 as $x) {
|
|
|
\App\Models\ReportSegnaleticaVerticale2::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_verticale_id' => $x
|
|
|
@@ -1002,8 +1049,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaVerticale3::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_verticale_3 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_verticale_3 as $x) {
|
|
|
\App\Models\ReportSegnaleticaVerticale3::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_verticale_id' => $x
|
|
|
@@ -1011,8 +1057,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaVerticale4::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_verticale_4 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_verticale_4 as $x) {
|
|
|
\App\Models\ReportSegnaleticaVerticale4::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_verticale_id' => $x
|
|
|
@@ -1020,8 +1065,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaOrizzontale1::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_orizzontale_1 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_orizzontale_1 as $x) {
|
|
|
\App\Models\ReportSegnaleticaOrizzontale1::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_orizzontale_id' => $x
|
|
|
@@ -1029,8 +1073,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaOrizzontale2::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_orizzontale_2 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_orizzontale_2 as $x) {
|
|
|
\App\Models\ReportSegnaleticaOrizzontale2::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_orizzontale_id' => $x
|
|
|
@@ -1038,8 +1081,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaOrizzontale3::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_orizzontale_3 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_orizzontale_3 as $x) {
|
|
|
\App\Models\ReportSegnaleticaOrizzontale3::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_orizzontale_id' => $x
|
|
|
@@ -1047,8 +1089,7 @@ class Report extends Component{
|
|
|
}
|
|
|
|
|
|
\App\Models\ReportSegnaleticaOrizzontale4::where('report_id', $this->dataId)->delete();
|
|
|
- foreach($this->segnaletica_orizzontale_4 as $x)
|
|
|
- {
|
|
|
+ foreach ($this->segnaletica_orizzontale_4 as $x) {
|
|
|
\App\Models\ReportSegnaleticaOrizzontale4::create([
|
|
|
'report_id' => $this->dataId,
|
|
|
'segnaletica_orizzontale_id' => $x
|
|
|
@@ -1082,18 +1123,19 @@ class Report extends Component{
|
|
|
'stato_testi_oculari' => $this->data_testi_oculari_stato_3
|
|
|
]);
|
|
|
} catch (\Exception $ex) {
|
|
|
- session()->flash('error','Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
+ session()->flash('error', 'Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
}
|
|
|
|
|
|
- session()->flash('success','Record aggiornato');
|
|
|
+ session()->flash('success', 'Record aggiornato');
|
|
|
$this->resetFields();
|
|
|
$this->update = false;
|
|
|
} catch (\Exception $ex) {
|
|
|
- session()->flash('error','Errore (' . $ex->getMessage() . ')');
|
|
|
+ session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function cancel(){
|
|
|
+ public function cancel()
|
|
|
+ {
|
|
|
$this->add = false;
|
|
|
$this->update = false;
|
|
|
$this->resetFields();
|
|
|
@@ -1102,46 +1144,51 @@ class Report extends Component{
|
|
|
$this->resetVeicoloData();
|
|
|
}
|
|
|
|
|
|
- public function delete($id){
|
|
|
- try{
|
|
|
+ public function delete($id)
|
|
|
+ {
|
|
|
+ try {
|
|
|
\App\Models\Report::find($id)->delete();
|
|
|
- session()->flash('success',"Record eliminato");
|
|
|
- }catch(\Exception $e){
|
|
|
- session()->flash('error',"Errore");
|
|
|
+ session()->flash('success', "Record eliminato");
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ session()->flash('error', "Errore");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function closeAndResetModal(){
|
|
|
+ public function closeAndResetModal()
|
|
|
+ {
|
|
|
logger('closeAndResetModal called');
|
|
|
$this->resetVeicoloData();
|
|
|
$this->emit('close-modal-parte-comune');
|
|
|
-
|
|
|
}
|
|
|
- public function addTesteOculare($x){
|
|
|
+ public function addTesteOculare($x)
|
|
|
+ {
|
|
|
$this->resetAnagrafica();
|
|
|
$this->currentTeste = $x;
|
|
|
$this->emit('load-anagrafica-modal');
|
|
|
}
|
|
|
|
|
|
- public function addConducente() {
|
|
|
+ public function addConducente()
|
|
|
+ {
|
|
|
$this->resetAnagrafica();
|
|
|
$this->currentConducente = 99;
|
|
|
$this->emit('load-anagrafica-modal');
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public function removeConducente() {
|
|
|
+ public function removeConducente()
|
|
|
+ {
|
|
|
$this->data_conducenti = 0;
|
|
|
$this->emit('add-default-value', $this->data_conducenti, '', 'data_conducenti');
|
|
|
}
|
|
|
|
|
|
- public function editConducente(){
|
|
|
+ public function editConducente()
|
|
|
+ {
|
|
|
$this->currentConducente = $this->data_conducenti;
|
|
|
$this->editAnagrafica($this->data_conducenti);
|
|
|
$this->emit('load-anagrafica-modal');
|
|
|
}
|
|
|
|
|
|
- public function addInfortunato($x){
|
|
|
+ public function addInfortunato($x)
|
|
|
+ {
|
|
|
$this->resetAnagrafica();
|
|
|
$this->currentInfortunato = $x;
|
|
|
$this->emit('load-anagrafica-modal');
|
|
|
@@ -1154,8 +1201,7 @@ class Report extends Component{
|
|
|
|
|
|
public function getLocalita($localita)
|
|
|
{
|
|
|
- if ($localita > 0)
|
|
|
- {
|
|
|
+ if ($localita > 0) {
|
|
|
$ret = \App\Models\LocationTown::where('id', $localita)->first();
|
|
|
if ($ret)
|
|
|
return $ret->title;
|
|
|
@@ -1165,24 +1211,23 @@ class Report extends Component{
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- public function getStradario($stradario){
|
|
|
- if ($stradario > 0)
|
|
|
- {
|
|
|
+ public function getStradario($stradario)
|
|
|
+ {
|
|
|
+ if ($stradario > 0) {
|
|
|
$ret = \App\Models\Stradario::findOrFail($stradario);
|
|
|
return $ret->TOPONIMO . " " . $ret->DESCRIZIONE;
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- public function getByTarga(){
|
|
|
+ public function getByTarga()
|
|
|
+ {
|
|
|
|
|
|
- if ($this->vei_targa != '')
|
|
|
- {
|
|
|
+ if ($this->vei_targa != '') {
|
|
|
|
|
|
$targa = $this->vei_targa;
|
|
|
|
|
|
- try
|
|
|
- {
|
|
|
+ try {
|
|
|
$wd = "dettaglioAutoveicoloBase";
|
|
|
$wd = "datiCartaCircolazioneAutoveicoloProprietario";
|
|
|
$url = env('MCTC_URL', 'https://e-servizicoll.dtt.ilportaledellautomobilista.it/Info-ws-sh/services');
|
|
|
@@ -1193,8 +1238,8 @@ class Report extends Component{
|
|
|
'verify_peer_name' => false,
|
|
|
'allow_self_signed' => true
|
|
|
)
|
|
|
- )),
|
|
|
- 'trace'=>1
|
|
|
+ )),
|
|
|
+ 'trace' => 1
|
|
|
));
|
|
|
$utente = env('MCTC_USER', '');
|
|
|
$password = env('MCTC_PASSWORD', '');
|
|
|
@@ -1209,22 +1254,21 @@ class Report extends Component{
|
|
|
</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
|
|
|
- );
|
|
|
+ $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
|
|
|
- {
|
|
|
+ try {
|
|
|
$this->loadTarga = "OK";
|
|
|
$obj = $client->__soapCall($classe, array(
|
|
|
$classe . "Request" => array(
|
|
|
- "login" => array(
|
|
|
- ),
|
|
|
+ "login" => array(),
|
|
|
"targa" => array("numeroTarga" => $targa),
|
|
|
"pdf" => false
|
|
|
)
|
|
|
@@ -1235,30 +1279,23 @@ class Report extends Component{
|
|
|
$this->vei_carta_circolazione_rilasciata_il = @$obj->DatiAmministrativiVeicolo[0]->DataEmissioneDocumento;
|
|
|
$this->vei_cilindrata = @$obj->DatiTecniciVeicolo->CilindrataInCentimetriCubi;
|
|
|
$this->vei_peso_complessivo = @$obj->DatiTecniciVeicolo->TaraInKG;
|
|
|
- }
|
|
|
- catch(\SoapFault $fault)
|
|
|
- {
|
|
|
+ } catch (\SoapFault $fault) {
|
|
|
$this->loadTarga = $fault->getMessage();
|
|
|
}
|
|
|
- }
|
|
|
- catch(\Exception $ex)
|
|
|
- {
|
|
|
+ } catch (\Exception $ex) {
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btTarga');
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public function getByPatente()
|
|
|
{
|
|
|
|
|
|
- if ($this->anag_documento_numero != '')
|
|
|
- {
|
|
|
+ if ($this->anag_documento_numero != '') {
|
|
|
$patente = $this->anag_documento_numero;
|
|
|
|
|
|
- try{
|
|
|
+ try {
|
|
|
$wd = "dettaglioPatenteBase";
|
|
|
$url = env('MCTC_URL', 'https://e-servizicoll.dtt.ilportaledellautomobilista.it/Info-ws-sh/services');
|
|
|
$client = new \SoapClient($url . '/' . $wd . '/' . $wd . '.wsdl', array(
|
|
|
@@ -1268,8 +1305,8 @@ class Report extends Component{
|
|
|
'verify_peer_name' => false,
|
|
|
'allow_self_signed' => true
|
|
|
)
|
|
|
- )),
|
|
|
- 'trace'=>1
|
|
|
+ )),
|
|
|
+ 'trace' => 1
|
|
|
));
|
|
|
|
|
|
$utente = env('MCTC_USER', '');
|
|
|
@@ -1285,19 +1322,18 @@ class Report extends Component{
|
|
|
</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
|
|
|
- );
|
|
|
+ $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 = "dettaglioPatente";
|
|
|
- try{
|
|
|
+ try {
|
|
|
$obj = $client->__soapCall($classe, array(
|
|
|
$classe . "Request" => array(
|
|
|
- "login" => array(
|
|
|
-
|
|
|
- ),
|
|
|
+ "login" => array(),
|
|
|
"ambitoPatenteBase" => array(
|
|
|
"patente" => array("numeroPatente" => $patente),
|
|
|
),
|
|
|
@@ -1313,26 +1349,21 @@ class Report extends Component{
|
|
|
$this->anag_residenza_address = @$obj->dettaglioPatenteBaseOutput->datiResidenza->indirizzoResidenza;
|
|
|
$this->anag_documento_scadenza_il = @$obj->dettaglioPatenteBaseOutput->datiPatente->dataScadenza;
|
|
|
$this->anag_documento_rilasciato_il = @$obj->dettaglioPatenteBaseOutput->datiPatente->dataEmissione;
|
|
|
- }
|
|
|
- catch(\SoapFault $fault)
|
|
|
- {
|
|
|
+ } catch (\SoapFault $fault) {
|
|
|
echo 'Request : <br/><xmp>',
|
|
|
$client->__getLastRequest(),
|
|
|
'</xmp><br/><br/> Error Message : <br/>',
|
|
|
$fault->getMessage();
|
|
|
}
|
|
|
- }
|
|
|
- catch(\SoapFault $ex)
|
|
|
- {
|
|
|
+ } catch (\SoapFault $ex) {
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btPatente');
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public function print($id){
|
|
|
+ public function print($id)
|
|
|
+ {
|
|
|
|
|
|
$record = \App\Models\Report::findOrFail($id);
|
|
|
$parti_coinvolte = ReportDataPartiCoinvolte::where('report_id', $id)->get();
|
|
|
@@ -1344,8 +1375,7 @@ class Report extends Component{
|
|
|
$datiCascoOmologazione = array();
|
|
|
$datiCasco = array();
|
|
|
$datiCintureSicurezza = array();
|
|
|
- foreach($parti_coinvolte as $pr)
|
|
|
- {
|
|
|
+ foreach ($parti_coinvolte as $pr) {
|
|
|
$datiVeicolo[$pr->progressive] = ReportDataVeicoli::where('progressive', $pr->progressive)->where('report_id', $id)->first();
|
|
|
$datiPedoni[$pr->progressive] = \App\Models\ReportDataPedoni::where('progressive', $pr->progressive)->where('report_id', $id)->get();
|
|
|
$datiInfortunati[$pr->progressive] = \App\Models\ReportDataInfortunati::where('progressive', $this->currentProgressive)->where('report_id', $id)->get();
|
|
|
@@ -1372,19 +1402,34 @@ class Report extends Component{
|
|
|
$segnaletica_orizzontale_3 = \App\Models\ReportSegnaleticaOrizzontale3::where('report_id', $id)->get();
|
|
|
$segnaletica_orizzontale_4 = \App\Models\ReportSegnaleticaOrizzontale4::where('report_id', $id)->get();
|
|
|
$allegati = \App\Models\ReportAllegatiGallery::where('report_id', $id)->get();
|
|
|
- $data = array('record' => $record, 'parti_coinvolte' => $parti_coinvolte, 'tipo_urto' => $tipo_urto,
|
|
|
- 'tipo_segnalazione' => $tipo_segnalazione, 'segnalazione_pervenuta_da' => $segnalazione_pervenuta_da,
|
|
|
- 'ausilio_altri_enti' => $ausilio_altri_enti,
|
|
|
- 'materiale_recuperato' => $materiale_recuperato,
|
|
|
- 'condizioni_luce' => $condizioni_luce, 'tipo_strada' => $tipo_strada,
|
|
|
- 'segnaletica_orizzontale_1' => $segnaletica_orizzontale_1, 'segnaletica_orizzontale_2' => $segnaletica_orizzontale_2,
|
|
|
- 'segnaletica_orizzontale_3' => $segnaletica_orizzontale_3, 'segnaletica_orizzontale_4' => $segnaletica_orizzontale_4,
|
|
|
- 'segnaletica_verticale_1' => $segnaletica_verticale_1, 'segnaletica_verticale_2' => $segnaletica_verticale_2,
|
|
|
- 'segnaletica_verticale_3' => $segnaletica_verticale_3, 'segnaletica_verticale_4' => $segnaletica_verticale_4,
|
|
|
- 'datiPedoni' => $datiPedoni,
|
|
|
- 'datiVeicolo' => $datiVeicolo, 'datiInfortunati' => $datiInfortunati, 'datiPasseggeri' => $datiPasseggeri,
|
|
|
- 'datiCascoOmologazione' => $datiCascoOmologazione,
|
|
|
- 'datiCasco' => $datiCasco, 'datiCintureSicurezza' => $datiCintureSicurezza, 'testi_oculari' => $testi_oculari,'allegati' => $allegati);
|
|
|
+ $data = array(
|
|
|
+ 'record' => $record,
|
|
|
+ 'parti_coinvolte' => $parti_coinvolte,
|
|
|
+ 'tipo_urto' => $tipo_urto,
|
|
|
+ 'tipo_segnalazione' => $tipo_segnalazione,
|
|
|
+ 'segnalazione_pervenuta_da' => $segnalazione_pervenuta_da,
|
|
|
+ 'ausilio_altri_enti' => $ausilio_altri_enti,
|
|
|
+ 'materiale_recuperato' => $materiale_recuperato,
|
|
|
+ 'condizioni_luce' => $condizioni_luce,
|
|
|
+ 'tipo_strada' => $tipo_strada,
|
|
|
+ 'segnaletica_orizzontale_1' => $segnaletica_orizzontale_1,
|
|
|
+ 'segnaletica_orizzontale_2' => $segnaletica_orizzontale_2,
|
|
|
+ 'segnaletica_orizzontale_3' => $segnaletica_orizzontale_3,
|
|
|
+ 'segnaletica_orizzontale_4' => $segnaletica_orizzontale_4,
|
|
|
+ 'segnaletica_verticale_1' => $segnaletica_verticale_1,
|
|
|
+ 'segnaletica_verticale_2' => $segnaletica_verticale_2,
|
|
|
+ 'segnaletica_verticale_3' => $segnaletica_verticale_3,
|
|
|
+ 'segnaletica_verticale_4' => $segnaletica_verticale_4,
|
|
|
+ 'datiPedoni' => $datiPedoni,
|
|
|
+ 'datiVeicolo' => $datiVeicolo,
|
|
|
+ 'datiInfortunati' => $datiInfortunati,
|
|
|
+ 'datiPasseggeri' => $datiPasseggeri,
|
|
|
+ 'datiCascoOmologazione' => $datiCascoOmologazione,
|
|
|
+ 'datiCasco' => $datiCasco,
|
|
|
+ 'datiCintureSicurezza' => $datiCintureSicurezza,
|
|
|
+ 'testi_oculari' => $testi_oculari,
|
|
|
+ 'allegati' => $allegati
|
|
|
+ );
|
|
|
|
|
|
$pdf = Pdf::loadView('pdf.verbale', array('data' => $data));
|
|
|
$pdf->render();
|
|
|
@@ -1394,14 +1439,13 @@ class Report extends Component{
|
|
|
$pdfName = "verbale_" . $record->protocollo_num . '_' . $record->protocollo_anno . ".pdf";
|
|
|
$pdfContent = $pdf->output();
|
|
|
return $pdf->stream($pdfName, $pdfContent);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public function updated($property, $value){
|
|
|
+ public function updated($property, $value)
|
|
|
+ {
|
|
|
if ($property === 'verificatosi_in_data' && !preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
|
|
|
$this->verificatosi_in_data = null;
|
|
|
$this->addError('verificatosi_in_data', 'Il campo Verificatosi in data deve essere aggiornato solo dal selettore.');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|