diff --git a/console_aziendale/src/components/modal/specific-modals/CompanyFormModal.vue b/console_aziendale/src/components/modal/specific-modals/CompanyFormModal.vue index fc3bacf..8e364ba 100644 --- a/console_aziendale/src/components/modal/specific-modals/CompanyFormModal.vue +++ b/console_aziendale/src/components/modal/specific-modals/CompanyFormModal.vue @@ -1,604 +1,689 @@ - \ No newline at end of file + diff --git a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue index 3f38f4a..57cdd59 100644 --- a/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue +++ b/console_aziendale/src/components/modal/specific-modals/LocationFormModal.vue @@ -39,6 +39,7 @@ id="denominazione" autocomplete="null" v-model.trim="$v.name.$model" + :error-messages="denominazioneErrors" @input="$v.name.$touch()" @blur="$v.name.$touch()" outlined @@ -210,7 +211,9 @@ -

Localizzazione

+ + +

Localizzazione

@@ -259,6 +262,13 @@ utilizzare il posizionamento manuale.

+

+ mdi-alert + + La posizione non sembra corrispondere all’indirizzo. Si prega di + verificarla e se necessario correggerla. + +

In automatico @@ -273,7 +283,7 @@ inserito -
+
-
+
Imposta manualmente
-
- Annulla - Conferma +
+ Annulla + Conferma
@@ -502,7 +518,16 @@ export default { ); }, }, - name: {}, + name: { + unique() { + return ( + (this.actualLocation && + this.actualLocation.item && + this.name === this.actualLocation.item.name) || + !this.allLocations.items.find((l) => l.name === this.name) + ); + }, + }, address: { required, }, @@ -574,7 +599,7 @@ export default { arrayDays: [], datepicker: null, menu: false, - // manualPositionSet: false, + pointIsFar: false, zoom: 13, url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", attribution: @@ -664,7 +689,7 @@ export default { } }, manualPosition() { - console.log('manual'); + console.log("manual"); this.$refs.geolocationSelector.enableMap(); this.addresIsValid = true; // this.manualPositionSet = true; @@ -673,15 +698,18 @@ export default { setManualPosition() { //confirm location this.locationSelected = this.tmpLocationSelected; - this.latitude = this.tmpLocationSelected?.pos?.lat?this.tmpLocationSelected?.pos?.lat:this.tmpLatitude; - this.longitude = this.tmpLocationSelected?.pos?.lng?this.tmpLocationSelected?.pos?.lng:this.tmpLongitude; + this.latitude = this.tmpLocationSelected?.pos?.lat + ? this.tmpLocationSelected?.pos?.lat + : this.tmpLatitude; + this.longitude = this.tmpLocationSelected?.pos?.lng + ? this.tmpLocationSelected?.pos?.lng + : this.tmpLongitude; this.manualEnabling = false; this.$refs.geolocationSelector.disableMap(); - }, cancelManualPosition() { //return to previous position - this.$refs.geolocationSelector.resetPosition(this.latitude,this.longitude ) + this.$refs.geolocationSelector.resetPosition(this.latitude, this.longitude); this.$refs.geolocationSelector.disableMap(); this.manualEnabling = false; }, @@ -691,6 +719,12 @@ export default { this.tmpLocationSelected = input?.address; this.tmpLatitude = this.locationSelected?.pos?.lat; this.tmpLongitude = this.locationSelected?.pos?.lng; + if (this.isFarFromInput(input)) { + //show warning far + this.pointIsFar = true; + } else { + this.pointIsFar = false; + } // if ( // !this.address && // this.locationSelected && @@ -699,6 +733,12 @@ export default { // this.changeParamForm(this.locationSelected?.structuredValue); } }, + isFarFromInput(input) { + if (this.zip != input?.address?.structuredValue?.postcode) return true; + // if (this.city?.toUpperCase() != input?.address?.structuredValue?.town?.toUpperCase()) return true; + // if (this.country?.toUpperCase() != input?.address?.structuredValue?.country?.toUpperCase()) return true; + return false; + }, changeParamForm(structuredValue) { if (structuredValue.road) this.address = structuredValue.road; if (structuredValue.house_number) this.streetNumber = structuredValue.house_number; @@ -886,7 +926,12 @@ export default { if (!this.$v.id.$dirty) return errors; !this.$v.id.required && errors.push("Campo richiesto."); !this.$v.id.unique && errors.push("Valore gia' in uso."); - // !this.$v.id.valid && errors.push("Il valore non deve contenere spazi."); + return errors; + }, + denominazioneErrors() { + const errors = []; + if (!this.$v.id.$dirty) return errors; + !this.$v.name.unique && errors.push("Valore gia' in uso."); return errors; }, addressErrors() {