|
@@ -7,20 +7,20 @@
|
|
|
@if (!$add && !$update)
|
|
@if (!$add && !$update)
|
|
|
@include('components.report.list.verbali')
|
|
@include('components.report.list.verbali')
|
|
|
@else
|
|
@else
|
|
|
- <form>
|
|
|
|
|
- @include('components.report.modifica.header')
|
|
|
|
|
- @include('components.report.modifica.menu')
|
|
|
|
|
- <div class="tab-content" id="custom-tabs-three-tabContent">
|
|
|
|
|
- @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.segnaletica.segnaletica')
|
|
|
|
|
- @include('components.report.testimoni.testimone')
|
|
|
|
|
- @include('components.report.allegati.allegato')
|
|
|
|
|
- </div>
|
|
|
|
|
- @include('components.report.modifica.footer')
|
|
|
|
|
- </form>
|
|
|
|
|
|
|
+ <form>
|
|
|
|
|
+ @include('components.report.modifica.header')
|
|
|
|
|
+ @include('components.report.modifica.menu')
|
|
|
|
|
+ <div class="tab-content" id="custom-tabs-three-tabContent">
|
|
|
|
|
+ @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.segnaletica.segnaletica')
|
|
|
|
|
+ @include('components.report.testimoni.testimone')
|
|
|
|
|
+ @include('components.report.allegati.allegato')
|
|
|
|
|
+ </div>
|
|
|
|
|
+ @include('components.report.modifica.footer')
|
|
|
|
|
+ </form>
|
|
|
|
|
|
|
|
@include('components.report.anagrafica.anagrafica-modal')
|
|
@include('components.report.anagrafica.anagrafica-modal')
|
|
|
|
|
|
|
@@ -163,7 +163,17 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const anagrafiche = ["richiestaAnagrafica", "data_testi_oculari_0", "data_testi_oculari_1",
|
|
const anagrafiche = ["richiestaAnagrafica", "data_testi_oculari_0", "data_testi_oculari_1",
|
|
|
- "data_testi_oculari_2", "data_testi_oculari_3"
|
|
|
|
|
|
|
+ "data_testi_oculari_2", "data_testi_oculari_3","data_proprietari",
|
|
|
|
|
+ "data_coproprietari",
|
|
|
|
|
+ "data_conducenti",
|
|
|
|
|
+ "data_passeggero_0",
|
|
|
|
|
+ "data_passeggero_1",
|
|
|
|
|
+ "data_passeggero_2",
|
|
|
|
|
+ "data_passeggero_3",
|
|
|
|
|
+ "data_infortunato_extra_0",
|
|
|
|
|
+ "data_infortunato_extra_1",
|
|
|
|
|
+ "data_infortunato_extra_2",
|
|
|
|
|
+ "data_infortunato_extra_3"
|
|
|
];
|
|
];
|
|
|
anagrafiche.forEach(anagraficheSelect);
|
|
anagrafiche.forEach(anagraficheSelect);
|
|
|
|
|
|
|
@@ -433,98 +443,6 @@
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- Livewire.on('load-select-modal', () => {
|
|
|
|
|
-
|
|
|
|
|
- initializeSelect2Controls();
|
|
|
|
|
-
|
|
|
|
|
- const modals = [
|
|
|
|
|
- "data_proprietari", "data_coproprietari", "data_conducenti",
|
|
|
|
|
- "data_passeggero_0", "data_passeggero_1", "data_passeggero_2", "data_passeggero_3",
|
|
|
|
|
- "data_infortunato_extra_0", "data_infortunato_extra_1", "data_infortunato_extra_2",
|
|
|
|
|
- "data_infortunato_extra_3"
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- function initializeSelect2(element, url = '/anagrafica') {
|
|
|
|
|
- return $(element).select2({
|
|
|
|
|
- dropdownParent: document.body,
|
|
|
|
|
- theme: 'bootstrap4',
|
|
|
|
|
- ajax: {
|
|
|
|
|
- url: url,
|
|
|
|
|
- dataType: 'json'
|
|
|
|
|
- },
|
|
|
|
|
- width: '100%'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function initializeRelatedElements(value, data) {
|
|
|
|
|
- $('#' + value + "_cinture").hide();
|
|
|
|
|
- $('.' + value + "_edit").hide();
|
|
|
|
|
- $('.' + value + "_remove").hide();
|
|
|
|
|
- $('.' + value + "_add").hide();
|
|
|
|
|
-
|
|
|
|
|
- if (data > 0) {
|
|
|
|
|
- $('.' + value + "_edit").show();
|
|
|
|
|
- $('.' + value + "_remove").show();
|
|
|
|
|
- $('#' + value + "_cinture").show();
|
|
|
|
|
- } else {
|
|
|
|
|
- $('.' + value + "_add").show();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function modalsSelect(value) {
|
|
|
|
|
- const $select = $('.' + value);
|
|
|
|
|
- initializeSelect2($select);
|
|
|
|
|
-
|
|
|
|
|
- if (["data_proprietari", "data_coproprietari", "data_conducenti", "data_passeggero_0",
|
|
|
|
|
- "data_passeggero_1", "data_passeggero_2", "data_passeggero_3"
|
|
|
|
|
- ].includes(value)) {
|
|
|
|
|
- initializeRelatedElements(value, $select.val());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $select.on('change', function (e) {
|
|
|
|
|
- const data = $(this).val();
|
|
|
|
|
- @this.set(value, data);
|
|
|
|
|
-
|
|
|
|
|
- if (["data_proprietari", "data_coproprietari", "data_conducenti", "data_passeggero_0",
|
|
|
|
|
- "data_passeggero_1", "data_passeggero_2", "data_passeggero_3"
|
|
|
|
|
- ].includes(value)) {
|
|
|
|
|
- initializeRelatedElements(value, data);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- const currentValue = $select.val();
|
|
|
|
|
- const currentText = $select.find('option:selected').text();
|
|
|
|
|
- if (currentValue) {
|
|
|
|
|
- const option = new Option(currentText, currentValue, true, true);
|
|
|
|
|
- $select.append(option).trigger('change');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $('#veicoloDataParte select').each(function () {
|
|
|
|
|
- if ($(this).data('select2')) {
|
|
|
|
|
- $(this).select2('destroy');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- modals.forEach(modalsSelect);
|
|
|
|
|
-
|
|
|
|
|
- $('.data_polizze').each(function () {
|
|
|
|
|
- if ($(this).data('select2')) {
|
|
|
|
|
- $(this).select2('destroy');
|
|
|
|
|
- }
|
|
|
|
|
- initializeSelect2(this, '/polizze').on('change', function (e) {
|
|
|
|
|
- @this.set('data_polizze', $(this).val());
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $('#veicoloDataParte').on('hidden.bs.modal', function () {
|
|
|
|
|
- $('#veicoloDataParte select').each(function () {
|
|
|
|
|
- if ($(this).data('select2')) {
|
|
|
|
|
- $(this).select2('destroy');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
Livewire.on('load-select-pedone', () => {
|
|
Livewire.on('load-select-pedone', () => {
|
|
|
|
|
|
|
|
var x = $("#generalizzato").val();
|
|
var x = $("#generalizzato").val();
|
|
@@ -595,40 +513,6 @@
|
|
|
$("#allegatiModal").modal('hide');
|
|
$("#allegatiModal").modal('hide');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- Livewire.on('close-modal-parte-comune', () => {
|
|
|
|
|
- const selectFields = [
|
|
|
|
|
- 'data_polizze',
|
|
|
|
|
- 'data_proprietari',
|
|
|
|
|
- 'data_conducenti',
|
|
|
|
|
- 'data_passeggero_0',
|
|
|
|
|
- 'data_passeggero_1',
|
|
|
|
|
- 'data_passeggero_2',
|
|
|
|
|
- 'data_passeggero_3',
|
|
|
|
|
- 'data_infortunato_extra_0',
|
|
|
|
|
- 'data_infortunato_extra_1',
|
|
|
|
|
- 'data_infortunato_extra_2',
|
|
|
|
|
- 'data_infortunato_extra_3'
|
|
|
|
|
- ];
|
|
|
|
|
-
|
|
|
|
|
- selectFields.forEach(field => {
|
|
|
|
|
- if ($(`.${field}`).length) {
|
|
|
|
|
- $(`.${field}`).val(null).trigger('change');
|
|
|
|
|
- if ($(`.${field}`).data('select2')) {
|
|
|
|
|
- $(`.${field}`).select2('destroy');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $("#veicoloDataParte").modal('hide');
|
|
|
|
|
- });
|
|
|
|
|
- $(document).on('click', '[data-dismiss="modal"]', function (e) {
|
|
|
|
|
- const modalId = $(this).closest('.modal').attr('id');
|
|
|
|
|
- if (modalId === 'veicoloDataParte') {
|
|
|
|
|
- e.preventDefault();
|
|
|
|
|
- Livewire.emit('closeAndResetModal');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
Livewire.on('attachments', (allegati) => {
|
|
Livewire.on('attachments', (allegati) => {
|
|
|
$("#attachments").html('');
|
|
$("#attachments").html('');
|
|
|
allegati.split("|").forEach(function (item) {
|
|
allegati.split("|").forEach(function (item) {
|
|
@@ -734,36 +618,65 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- function initializeSelect2Controls() {
|
|
|
|
|
- console.log("initializeSelect2Controls");
|
|
|
|
|
- const modals = [
|
|
|
|
|
- "data_proprietari", "data_coproprietari", "data_conducenti",
|
|
|
|
|
- "data_passeggero_0", "data_passeggero_1", "data_passeggero_2", "data_passeggero_3",
|
|
|
|
|
- "data_infortunato_extra_0", "data_infortunato_extra_1", "data_infortunato_extra_2",
|
|
|
|
|
- "data_infortunato_extra_3"
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ Livewire.on('initializeVehicleAccordion', () => {
|
|
|
|
|
+ console.log('initializeVehicleAccordion');
|
|
|
|
|
+ $('.accordion').on('show.bs.collapse', function(e) {
|
|
|
|
|
+ // Prevent Bootstrap's default behavior
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
|
|
|
- modals.forEach(value => {
|
|
|
|
|
- $('.' + value).select2({
|
|
|
|
|
- dropdownParent: document.body,
|
|
|
|
|
|
|
+ const progressive = $(this).attr('id').replace('vehicleAccordion', '');
|
|
|
|
|
+ const collapseElement = $(this).find('.collapse');
|
|
|
|
|
+
|
|
|
|
|
+ // Let Livewire load the data first
|
|
|
|
|
+ Livewire.emit('editVeicoloData', progressive);
|
|
|
|
|
+
|
|
|
|
|
+ // Show the collapse after a brief delay to ensure data is loaded
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ collapseElement.collapse('show');
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $('.accordion').on('hide.bs.collapse', function(e) {
|
|
|
|
|
+ const progressive = $(this).attr('id').replace('vehicleAccordion', '');
|
|
|
|
|
+
|
|
|
|
|
+ // Clean up select2 instances
|
|
|
|
|
+ $(`#vehicleAccordion${progressive} select`).each(function() {
|
|
|
|
|
+ if ($(this).data('select2')) {
|
|
|
|
|
+ $(this).select2('destroy');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ Livewire.emit('closeAndResetModal');
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // Initialize controls when data is loaded
|
|
|
|
|
+ Livewire.on('load-select-modal', () => {
|
|
|
|
|
+ const openAccordion = $('.collapse.show');
|
|
|
|
|
+ if (openAccordion.length) {
|
|
|
|
|
+ const progressive = openAccordion.closest('.accordion').attr('id').replace('vehicleAccordion', '');
|
|
|
|
|
+ initializeSelect2Controls(progressive);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ function initializeSelect2Controls(progressive) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // Initialize polizze select2
|
|
|
|
|
+ const polizzeSelector = `#data_polizze_${progressive}`;
|
|
|
|
|
+ if ($(polizzeSelector).length && !$(polizzeSelector).data('select2')) {
|
|
|
|
|
+ $(polizzeSelector).select2({
|
|
|
theme: 'bootstrap4',
|
|
theme: 'bootstrap4',
|
|
|
ajax: {
|
|
ajax: {
|
|
|
- url: '/anagrafica',
|
|
|
|
|
|
|
+ url: '/polizze',
|
|
|
dataType: 'json'
|
|
dataType: 'json'
|
|
|
},
|
|
},
|
|
|
width: '100%'
|
|
width: '100%'
|
|
|
|
|
+ }).on('change', function(e) {
|
|
|
|
|
+ @this.set('data_polizze', $(this).val());
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $('.data_polizze').select2({
|
|
|
|
|
- dropdownParent: document.body,
|
|
|
|
|
- theme: 'bootstrap4',
|
|
|
|
|
- ajax: {
|
|
|
|
|
- url: '/polizze',
|
|
|
|
|
- dataType: 'json'
|
|
|
|
|
- },
|
|
|
|
|
- width: '100%'
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
</script>
|