|
|
@@ -52,7 +52,20 @@ class Report extends Component
|
|
|
array('id' => 3, 'name' => 'Segnaletica orizzontale'),
|
|
|
array('id' => 4, 'name' => 'Segnaletica verticale e orizzontale'),
|
|
|
array('id' => 5, 'name' => 'Segnaletica temporanea di cantiere'),
|
|
|
+ array('id' => 6, 'name' => 'Segnaletica verticale assente'),
|
|
|
+ array('id' => 7, 'name' => 'Segnaletica orizzontale assente'),
|
|
|
+ array('id' => 8, 'name' => 'Segnaletica di messa in sicurezza provvisoria'),
|
|
|
+
|
|
|
);
|
|
|
+
|
|
|
+ public $organi = array(
|
|
|
+ 'Comando',
|
|
|
+ 'Vigili del Fuoco',
|
|
|
+ 'Carabinieri',
|
|
|
+ 'Polizia di Stato',
|
|
|
+ 'Ufficio Tecnico'
|
|
|
+ );
|
|
|
+
|
|
|
public $linee = array(
|
|
|
array('id' => 4, 'name' => 'Assente'),
|
|
|
array('id' => 1, 'name' => 'Continua'),
|
|
|
@@ -150,6 +163,7 @@ class Report extends Component
|
|
|
$traffico;
|
|
|
|
|
|
public $segnaletica,
|
|
|
+ $organo,
|
|
|
$segnaletica_verticale_1_via,
|
|
|
$segnaletica_verticale_1_altro,
|
|
|
$segnaletica_verticale_1_limite_velocita,
|
|
|
@@ -416,6 +430,7 @@ class Report extends Component
|
|
|
$this->segnaletica_orizzontale_3 = [];
|
|
|
$this->segnaletica_orizzontale_4 = [];
|
|
|
$this->segnaletica = '';
|
|
|
+ $this->organo = '';
|
|
|
$this->segnaletica_verticale_1_via = '';
|
|
|
$this->segnaletica_verticale_1_altro = '';
|
|
|
$this->segnaletica_verticale_1_limite_velocita = '';
|
|
|
@@ -475,6 +490,8 @@ class Report extends Component
|
|
|
$this->allegatoId = 0;
|
|
|
$this->allegatoType = 0;
|
|
|
$this->allegatoGallery = 0;
|
|
|
+ $this->allegatoFotoSinistri = 0;
|
|
|
+ $this->allegatoDidascalia = '';
|
|
|
$this->allegatoName = '';
|
|
|
$this->allegatoVisible = false;
|
|
|
$this->allegatoFiles = '';
|
|
|
@@ -822,6 +839,7 @@ class Report extends Component
|
|
|
$this->segnaletica_orizzontale_3 = \App\Models\ReportSegnaleticaOrizzontale3::where('report_id', $idReport)->pluck('segnaletica_orizzontale_id');
|
|
|
$this->segnaletica_orizzontale_4 = \App\Models\ReportSegnaleticaOrizzontale4::where('report_id', $idReport)->pluck('segnaletica_orizzontale_id');
|
|
|
$this->segnaletica = $record->segnaletica;
|
|
|
+ $this->organo = $record->organo;
|
|
|
$this->segnaletica_verticale_1_via = $record->segnaletica_verticale_1_via;
|
|
|
$this->segnaletica_verticale_1_altro = $record->segnaletica_verticale_1_altro;
|
|
|
$this->segnaletica_verticale_1_limite_velocita = $record->segnaletica_verticale_1_limite_velocita;
|
|
|
@@ -1003,6 +1021,7 @@ class Report extends Component
|
|
|
'tipo_strada_altro' => $this->tipo_strada_altro,
|
|
|
'traffico' => $this->traffico,
|
|
|
'segnaletica' => $this->segnaletica,
|
|
|
+ 'organo' => $this->organo,
|
|
|
'segnaletica_verticale_1_via' => $this->segnaletica_verticale_1_via,
|
|
|
'segnaletica_verticale_1_altro' => $this->segnaletica_verticale_1_altro,
|
|
|
'segnaletica_verticale_1_limite_velocita' => $this->segnaletica_verticale_1_limite_velocita,
|
|
|
@@ -1054,167 +1073,176 @@ class Report extends Component
|
|
|
'validated' => $validate
|
|
|
];
|
|
|
|
|
|
- \App\Models\Report::whereId($this->dataId)->update($reportData);
|
|
|
+ if (str_pad($this->protocollo_num, 3, '0', STR_PAD_LEFT) != "000")
|
|
|
+ {
|
|
|
+ \App\Models\Report::whereId($this->dataId)->update($reportData);
|
|
|
|
|
|
- Log::info('Update report ' . $this->dataId . ' with data:', $reportData);
|
|
|
+ Log::info('Update report ' . $this->dataId . ' with data:', $reportData);
|
|
|
|
|
|
- \App\Models\ReportTipoUrto::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->tipo_urto as $x) {
|
|
|
- \App\Models\ReportTipoUrto::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'tipo_urto_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportTipoUrto::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->tipo_urto as $x) {
|
|
|
+ \App\Models\ReportTipoUrto::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'tipo_urto_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportTipoSegnalazione::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->tipo_segnalazione as $x) {
|
|
|
- \App\Models\ReportTipoSegnalazione::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'tipo_segnalazione_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportTipoSegnalazione::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->tipo_segnalazione as $x) {
|
|
|
+ \App\Models\ReportTipoSegnalazione::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'tipo_segnalazione_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnalazionePervenutaDa::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnalazione_pervenuta_da as $x) {
|
|
|
- \App\Models\ReportSegnalazionePervenutaDa::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnalazione_pervenuta_da_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnalazionePervenutaDa::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnalazione_pervenuta_da as $x) {
|
|
|
+ \App\Models\ReportSegnalazionePervenutaDa::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnalazione_pervenuta_da_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportMaterialeRecuperato::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->materiale_recuperato as $x) {
|
|
|
- \App\Models\ReportMaterialeRecuperato::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'materiale_recuperato_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportMaterialeRecuperato::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->materiale_recuperato as $x) {
|
|
|
+ \App\Models\ReportMaterialeRecuperato::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'materiale_recuperato_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportAusilioAltriEnti::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->ausilio_altri_enti as $x) {
|
|
|
- \App\Models\ReportAusilioAltriEnti::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'ausilio_altri_enti_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportAusilioAltriEnti::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->ausilio_altri_enti as $x) {
|
|
|
+ \App\Models\ReportAusilioAltriEnti::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'ausilio_altri_enti_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportCondizioniLuce::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->condizioni_luce as $x) {
|
|
|
- \App\Models\ReportCondizioniLuce::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'condizioni_luce_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportCondizioniLuce::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->condizioni_luce as $x) {
|
|
|
+ \App\Models\ReportCondizioniLuce::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'condizioni_luce_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportTipoStrada::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->tipo_strada as $x) {
|
|
|
- \App\Models\ReportTipoStrada::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'tipo_strada_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportTipoStrada::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->tipo_strada as $x) {
|
|
|
+ \App\Models\ReportTipoStrada::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'tipo_strada_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaVerticale1::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_verticale_1 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaVerticale1::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_verticale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaVerticale1::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_verticale_1 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaVerticale1::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_verticale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaVerticale2::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_verticale_2 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaVerticale2::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_verticale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaVerticale2::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_verticale_2 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaVerticale2::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_verticale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaVerticale3::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_verticale_3 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaVerticale3::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_verticale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaVerticale3::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_verticale_3 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaVerticale3::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_verticale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaVerticale4::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_verticale_4 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaVerticale4::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_verticale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaVerticale4::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_verticale_4 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaVerticale4::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_verticale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale1::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_orizzontale_1 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale1::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_orizzontale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale1::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_orizzontale_1 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale1::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_orizzontale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale2::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_orizzontale_2 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale2::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_orizzontale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale2::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_orizzontale_2 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale2::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_orizzontale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale3::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_orizzontale_3 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale3::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_orizzontale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale3::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_orizzontale_3 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale3::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_orizzontale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale4::where('report_id', $this->dataId)->delete();
|
|
|
- foreach ($this->segnaletica_orizzontale_4 as $x) {
|
|
|
- \App\Models\ReportSegnaleticaOrizzontale4::create([
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'segnaletica_orizzontale_id' => $x
|
|
|
- ]);
|
|
|
- }
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale4::where('report_id', $this->dataId)->delete();
|
|
|
+ foreach ($this->segnaletica_orizzontale_4 as $x) {
|
|
|
+ \App\Models\ReportSegnaleticaOrizzontale4::create([
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'segnaletica_orizzontale_id' => $x
|
|
|
+ ]);
|
|
|
+ }
|
|
|
|
|
|
- \App\Models\ReportDataTestimoniOculari::where('report_id', $this->dataId)->delete();
|
|
|
- try {
|
|
|
- \App\Models\ReportDataTestimoniOculari::create([
|
|
|
- 'progressive' => 0,
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'testi_oculari' => $this->data_testi_oculari_0,
|
|
|
- 'stato_testi_oculari' => $this->data_testi_oculari_stato_0
|
|
|
- ]);
|
|
|
- \App\Models\ReportDataTestimoniOculari::create([
|
|
|
- 'progressive' => 1,
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'testi_oculari' => $this->data_testi_oculari_1,
|
|
|
- 'stato_testi_oculari' => $this->data_testi_oculari_stato_1
|
|
|
- ]);
|
|
|
- \App\Models\ReportDataTestimoniOculari::create([
|
|
|
- 'progressive' => 2,
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'testi_oculari' => $this->data_testi_oculari_2,
|
|
|
- 'stato_testi_oculari' => $this->data_testi_oculari_stato_2
|
|
|
- ]);
|
|
|
- \App\Models\ReportDataTestimoniOculari::create([
|
|
|
- 'progressive' => 3,
|
|
|
- 'report_id' => $this->dataId,
|
|
|
- 'testi_oculari' => $this->data_testi_oculari_3,
|
|
|
- 'stato_testi_oculari' => $this->data_testi_oculari_stato_3
|
|
|
- ]);
|
|
|
- } catch (\Exception $ex) {
|
|
|
- Log::info('Error during save ' . $this->dataId . ' update:' . $ex->getMessage());
|
|
|
- session()->flash('error', 'Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
- }
|
|
|
+ \App\Models\ReportDataTestimoniOculari::where('report_id', $this->dataId)->delete();
|
|
|
+ try {
|
|
|
+ \App\Models\ReportDataTestimoniOculari::create([
|
|
|
+ 'progressive' => 0,
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'testi_oculari' => $this->data_testi_oculari_0,
|
|
|
+ 'stato_testi_oculari' => $this->data_testi_oculari_stato_0
|
|
|
+ ]);
|
|
|
+ \App\Models\ReportDataTestimoniOculari::create([
|
|
|
+ 'progressive' => 1,
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'testi_oculari' => $this->data_testi_oculari_1,
|
|
|
+ 'stato_testi_oculari' => $this->data_testi_oculari_stato_1
|
|
|
+ ]);
|
|
|
+ \App\Models\ReportDataTestimoniOculari::create([
|
|
|
+ 'progressive' => 2,
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'testi_oculari' => $this->data_testi_oculari_2,
|
|
|
+ 'stato_testi_oculari' => $this->data_testi_oculari_stato_2
|
|
|
+ ]);
|
|
|
+ \App\Models\ReportDataTestimoniOculari::create([
|
|
|
+ 'progressive' => 3,
|
|
|
+ 'report_id' => $this->dataId,
|
|
|
+ 'testi_oculari' => $this->data_testi_oculari_3,
|
|
|
+ 'stato_testi_oculari' => $this->data_testi_oculari_stato_3
|
|
|
+ ]);
|
|
|
+ } catch (\Exception $ex) {
|
|
|
+ Log::info('Error during save ' . $this->dataId . ' update:' . $ex->getMessage());
|
|
|
+ session()->flash('error', 'Errore in fase di salvataggio (' . $ex->getMessage() . ')');
|
|
|
+ }
|
|
|
|
|
|
- session()->flash('success', 'Record aggiornato');
|
|
|
+ session()->flash('success', 'Record aggiornato');
|
|
|
|
|
|
- if (!$print)
|
|
|
+ if (!$print)
|
|
|
+ {
|
|
|
+ $this->update = false;
|
|
|
+ $this->resetFields();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- $this->update = false;
|
|
|
- $this->resetFields();
|
|
|
+
|
|
|
+ session()->flash('error', 'Errore in fase di salvataggio, si è tentato di salvare dati nulli');
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} catch (\Exception $ex) {
|
|
|
@@ -1736,4 +1764,26 @@ class Report extends Component
|
|
|
$this->addError('verificatosi_in_data', 'Il campo Verificatosi in data deve essere nel formato corretto.');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function createAddress($value, $data, $text)
|
|
|
+ {
|
|
|
+ $s = new \App\Models\Stradario();
|
|
|
+ $s->codicetoponimo = 0;
|
|
|
+ $x = explode(" ", $text);
|
|
|
+ $s->toponimo = "";//$x[0];
|
|
|
+ $s->descrizione = $text;
|
|
|
+ $s->save();
|
|
|
+ $this->$value = $s->id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function reloadMarche($id)
|
|
|
+ {
|
|
|
+ $this->marche = \App\Models\MarcaVeicolo::orderBy('name')->get();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function reloadModelli($id)
|
|
|
+ {
|
|
|
+ $this->modelli = \App\Models\ModelloVeicolo::orderBy('name')->get();
|
|
|
+ }
|
|
|
+
|
|
|
}
|