Skip to content
Snippets Groups Projects
Commit 69f0f200 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

check unique custom form names, display errors & fix leaflet background color

parent 70cd9c28
No related branches found
No related tags found
No related merge requests found
......@@ -264,6 +264,11 @@ footer {
flex-direction: column;
justify-content: center;
}
.leaflet-container {
background: white !important;
}
@media screen and (min-width: 560px) {
.mobile {
display: none !important;
......
......@@ -283,6 +283,28 @@ export default {
return true;
},
checkUniqueName() {
console.log(this.$store);
console.log(this.$store.state);
console.log(this.$store.state.feature_type);
if (this.form.name.value) {
const occurences = this.$store.state.feature_type.customForms
.map((el) => el.name)
.filter((el) => el === this.form.name.value);
console.log("occurences", occurences);
console.log(occurences.length);
if (occurences.length > 1) {
console.log("duplicate", this.form.name.value);
this.form.name.errors = [
"Les champs personnalisés ne peuvent pas avoir des noms similaires.",
];
return false;
}
}
this.form.name.errors = [];
return true;
},
checkCustomForm() {
if (this.form.label.value === null) {
this.form.label.errors = ["Veuillez compléter ce champ."];
......@@ -297,10 +319,11 @@ export default {
];
this.form.label.errors = [];
return false;
} else if (this.checkUniqueName()) {
this.form.label.errors = [];
this.form.name.errors = [];
return true;
}
this.form.label.errors = [];
this.form.name.errors = [];
return true;
},
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment