-
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() {