Skip to content
Snippets Groups Projects
Commit 27e2424d authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'ticket/V2/11132' into 'develop'

ticket V2 11132

See merge request geocontrib/geocontrib-frontend!14
parents 1024ff05 38e045bb
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,7 @@ const feature_type = {
async SEND_FEATURE_TYPE({ state, getters, rootGetters }, requestType) {
const data = {
'title': state.form.title.value,
'title_optional': state.form.title_optional.value,
'geom_type': state.form.geom_type.value,
'color': state.form.color.value,
'colors_style': state.form.colors_style.value,
......
......@@ -19,7 +19,7 @@
>
<!-- Feature Fields -->
<div class="two fields">
<div class="required field">
<div :class="field_title">
<label :for="form.title.id_for_label">{{ form.title.label }}</label>
<input
type="text"
......@@ -301,6 +301,7 @@ export default {
geom: {
label: "Localisation",
value: null,
errors: null,
},
},
};
......@@ -317,6 +318,15 @@ export default {
]),
...mapGetters("feature_type", ["feature_type"]),
field_title(){
if(this.feature_type){
if(this.feature_type.title_optional){
return 'field';
}
}
return 'required field';
},
currentRouteName() {
return this.$route.name;
},
......@@ -471,13 +481,41 @@ export default {
feature_id: this.feature ? this.feature.feature_id : "",
});
},
postForm() {
if (this.form.title.value) {
this.form.title.errors = null;
this.$store.dispatch("feature/SEND_FEATURE", this.currentRouteName);
} else {
this.form.title.errors = "Veuillez compléter ce champ.";
goBackToProject(message) {
this.$router.push({
name: "project_detail",
params: {
slug: this.$store.state.project_slug,
message,
},
});
},
async postForm() {
if (!this.feature_type.title_optional){
if (this.form.title.value && this.form.geom.value) {
this.form.title.errors = null;
await
this.$store.dispatch("feature/SEND_FEATURE")
.then(() => {
this.goBackToProject("Le signalement a été crée");
});
} else {
this.form.title.errors = "Veuillez compléter ce champ.";
this.form.geom.errors = "Veuillez compléter ce champ.";
}
}
else{
if (this.form.geom.value) {
this.form.title.errors = null;
await
this.$store.dispatch("feature/SEND_FEATURE")
.then(() => {
this.goBackToProject("Le signalement a été crée");
});
} else {
this.form.geom.errors = "Veuillez compléter ce champ.";
}
}
},
......@@ -487,7 +525,6 @@ export default {
linestring: "polyline",
polygon: "polygon",
};
// console.log(this.feature_type)
var geomType = this.feature_type.geom_type;
var drawConfig = {
polygon: false,
......
......@@ -71,6 +71,16 @@
<!-- {{ form.color.errors }} -->
</div>
</div>
<div class="field">
<div class="ui checkbox">
<input
:name="form.title_optional.html_name"
v-model="form.title_optional.value"
type="checkbox"
/>
<label>{{form.title_optional.label}}</label>
</div>
</div>
<!-- //* s'affiche après sélection d'option de type liste dans type de champ -->
<div
......@@ -207,6 +217,13 @@ export default {
html_name: "title",
value: null,
},
title_optional: {
errors: null,
id_for_label: "title_optional",
html_name: "title_optional",
label: "Titre du signalement optionnel",
value: false,
},
geom_type: {
id_for_label: "geom_type",
label: "Type de géométrie",
......@@ -322,6 +339,7 @@ export default {
this.$store.commit("feature_type/UPDATE_FORM", {
color: this.form.color,
title: this.form.title,
title_optional: this.form.title_optional,
geom_type: this.form.geom_type,
colors_style: this.form.colors_style,
});
......
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