Skip to content
Snippets Groups Projects
Commit 2410f141 authored by leandro's avatar leandro
Browse files

fix in import type customForm

parent 5d4d8855
Branches
Tags
3 merge requests!3add export-geojson & fix slug vs title in feature_list route,!2add extra_form to feature_edit,!1format date for derniers signalements, detect click outside menu dropdown and...
...@@ -469,6 +469,15 @@ export default { ...@@ -469,6 +469,15 @@ export default {
data() { data() {
return { return {
choices: {
boolean: "Booléen",
string: "Chaîne de caractères",
date: "Date",
list: "Liste de valeurs",
integer: "Nombre entier",
decimal: "Nombre décimal",
text: "Texte multiligne",
},
labelCustomForm: [ labelCustomForm: [
'title', 'title',
'description', 'description',
...@@ -537,11 +546,18 @@ export default { ...@@ -537,11 +546,18 @@ export default {
isLabelProperties(value){ isLabelProperties(value){
return this.labelCustomForm.includes(value) return this.labelCustomForm.includes(value)
}, },
searchValue(key){
if (key in this.choices)
return this.choices[key]
},
capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
},
importGeoJson() { importGeoJson() {
if (Object.entries(this.jsonDict).length){ if (Object.entries(this.jsonDict).length){
// TODO : VALIDATION IF A JSONDICT HAS NOT FEATURES // TODO : VALIDATION IF A JSONDICT HAS NOT FEATURES
for (const [key, value] of Object.entries(this.jsonDict['features'])) { for (const [, value] of Object.entries(this.jsonDict['features'])) {
console.log('key', key)
this.form.title.value = value['properties']['feature_type'] this.form.title.value = value['properties']['feature_type']
this.form.geom_type.value = this.toFormatGeom(value['geometry']['type']) this.form.geom_type.value = this.toFormatGeom(value['geometry']['type'])
...@@ -558,8 +574,8 @@ export default { ...@@ -558,8 +574,8 @@ export default {
customForm['name']['value'] = val customForm['name']['value'] = val
} }
if (! this.isLabelProperties(k)){ if (! this.isLabelProperties(k)){
customForm['field_type']['value'] = val let typeof_val = this.searchValue(typeof val)
customForm['field_type']['field']['choices'] = typeof(val) customForm['field_type']['value'] = typeof_val
} }
//ENDFOR //ENDFOR
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment