From 6aa5c4094a506f4954edd0a6eff546765d5d36a2 Mon Sep 17 00:00:00 2001 From: Matteo Chini Date: Wed, 11 Sep 2024 15:01:22 +0200 Subject: [PATCH 1/2] fixed tab selection and functions --- .../leaflet-map/GeoLocationSelectorMap.vue | 10 +++-- .../specific-modals/LocationFormModal.vue | 21 ++++++++- .../src/pages/locations/Locations.vue | 45 ++++++++++++------- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/console_aziendale/src/components/leaflet-map/GeoLocationSelectorMap.vue b/console_aziendale/src/components/leaflet-map/GeoLocationSelectorMap.vue index 48303a4..dd63823 100644 --- a/console_aziendale/src/components/leaflet-map/GeoLocationSelectorMap.vue +++ b/console_aziendale/src/components/leaflet-map/GeoLocationSelectorMap.vue @@ -100,6 +100,7 @@ export default { }, zoom: 10, dragging: false, + markerClick:false }; }, @@ -118,18 +119,19 @@ export default { }, 250); }, disableMap() { - this.$refs.map.mapObject.invalidateSize(); + this.markerClick = false; + this.$refs.map.mapObject.invalidateSize(); this.$refs.map.mapObject.dragging.disable(); this.$refs.map.mapObject.touchZoom.disable(); this.$refs.map.mapObject.doubleClickZoom.disable(); this.$refs.map.mapObject.scrollWheelZoom.disable(); this.$refs.map.mapObject.boxZoom.disable(); this.$refs.map.mapObject.keyboard.disable(); -if (this.$refs.map.mapObject.tap) this.$refs.map.mapObject.tap.disable(); + if (this.$refs.map.mapObject.tap) this.$refs.map.mapObject.tap.disable(); }, enableMap() { - + this.markerClick=true; this.$refs.map.mapObject.dragging.enable(); this.$refs.map.mapObject.touchZoom.enable(); this.$refs.map.mapObject.doubleClickZoom.enable(); @@ -194,7 +196,7 @@ if (this.$refs.map.mapObject.tap) this.$refs.map.mapObject.tap.disable(); }, async onMapClick(value) { console.log('this.addresIsValid',this.addresIsValid); - if (!this.addresIsValid) return; + if (!this.addresIsValid || !this.markerClick) return; this.position = value.latlng; }, onSearch(value) { diff --git a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue index 466356a..9454a28 100644 --- a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue +++ b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue @@ -243,12 +243,14 @@ In automatico A mano @@ -280,7 +282,7 @@ Imposta manualmente @@ -702,6 +704,23 @@ export default { } } }, + setTab(value) { + if (value == 1) { + this.$refs.geolocationSelector.disableMap(); + if (!this.$v.$invalid) { + if (this.geoResults.length > 0) { + this.addresIsValid = true; + this.showErrorLocation=false; + + } else { + this.showErrorLocation=true; + this.addresIsValid = false; + } + } + } else { + this.$refs.geolocationSelector.enableMap(); + } + }, autoPosition() { if (this.geoResults.length > 0) { console.log("AutoPosition", this.geoResults[0]); diff --git a/console_aziendale/src/pages/locations/Locations.vue b/console_aziendale/src/pages/locations/Locations.vue index 0e4e5f2..66d045b 100644 --- a/console_aziendale/src/pages/locations/Locations.vue +++ b/console_aziendale/src/pages/locations/Locations.vue @@ -7,7 +7,12 @@ color="secondary" rounded elevation="6" - @click="[selectActualLocation(null), openModal({type:'locationFormAdd', object:null})]" + @click=" + [ + selectActualLocation(null), + openModal({ type: 'locationFormAdd', object: null }), + ] + " class="mr-4" > mdi-plus @@ -18,7 +23,7 @@ color="secondary" rounded elevation="6" - @click="openModal({type:'locationImport', object:null})" + @click="openModal({ type: 'locationImport', object: null })" > mdi-file-import Aggiungi da file @@ -39,9 +44,8 @@
Non ci sono Sedi
- + - @@ -56,7 +60,13 @@ export default { components: { ProfiloLocation, GenericTable }, data: function () { return { - headerColumns: [{text:"Identificativo", value:"id"}, {text:"Cittá", value:"city"}, {text:"Indirizzo", value:"address"}, {text:"Numero", value:"streetNumber"}], + headerColumns: [ + { text: "Identificativo", value: "id" }, + { text: "Nome", value: "name" }, + { text: "Cittá", value: "city" }, + { text: "Indirizzo", value: "address" }, + { text: "Numero", value: "streetNumber" }, + ], tableTitle: "Sedi", newLocation: false, location: null, @@ -69,12 +79,12 @@ export default { submitStatus: null, // fileUploaded: null, inDragArea: false, - oldLocation:null + oldLocation: null, }; }, methods: { - ...mapActions("modal", {openModal:'openModal'}), + ...mapActions("modal", { openModal: "openModal" }), ...mapActions("location", { getAllLocations: "getAllLocations", selectActualLocation: "selectActualLocation", @@ -103,7 +113,7 @@ export default { this.selectActualLocation(location); //this.actualLocation = location; } - }else{ + } else { this.selectActualLocation(location); //this.actualLocation = location; } @@ -125,9 +135,9 @@ export default { this.deleteModalVisible = false; }, closeImportModal() { - this.modalImportLocationsOpen = false + this.modalImportLocationsOpen = false; }, - + deleteConfirm() { this.deleteModalVisible = false; this.deleteLocation({ @@ -152,10 +162,14 @@ export default { // fileName() { // return this.fileUploaded.item(0).name; // }, - nColsTable_calculator: function() { - if(this.actualLocation != null && this.actualLocation != undefined && this.actualLocation.item != null){ + nColsTable_calculator: function () { + if ( + this.actualLocation != null && + this.actualLocation != undefined && + this.actualLocation.item != null + ) { return 8; - } else{ + } else { return 12; } }, @@ -164,12 +178,11 @@ export default { created() { this.loadLocations(); }, - + mounted() { this.changePage({ title: "Lista sedi", route: "/GestioneSedi" }); }, }; - \ No newline at end of file + From b55d355a265c548c1f35ee9aecd95e79678e231b Mon Sep 17 00:00:00 2001 From: Matteo Chini Date: Wed, 11 Sep 2024 15:13:16 +0200 Subject: [PATCH 2/2] fixed warning for position --- .../modal/specific-modals/LocationFormModal.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue index 9454a28..4699311 100644 --- a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue +++ b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue @@ -355,7 +355,13 @@ - + + + +

ATTENZIONE!!! La posizione sarà utilizzata per la validazione dei viaggi dei dipendenti. Saranno validi solo i viaggi che iniziano o finiscono all'interno della zona delimitata dal cerchio rosso. +

+
+