From 2410f141df5c4b60852c3d3ccf040a6ca82cad97 Mon Sep 17 00:00:00 2001 From: leandro <leandroalmada86@gmail.com> Date: Wed, 25 Aug 2021 16:06:19 +0200 Subject: [PATCH] fix in import type customForm --- src/views/project/Project_detail.vue | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue index f65d3376..f2060f93 100644 --- a/src/views/project/Project_detail.vue +++ b/src/views/project/Project_detail.vue @@ -469,6 +469,15 @@ export default { data() { 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: [ 'title', 'description', @@ -537,11 +546,18 @@ export default { isLabelProperties(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() { if (Object.entries(this.jsonDict).length){ // TODO : VALIDATION IF A JSONDICT HAS NOT FEATURES - for (const [key, value] of Object.entries(this.jsonDict['features'])) { - console.log('key', key) + for (const [, value] of Object.entries(this.jsonDict['features'])) { + this.form.title.value = value['properties']['feature_type'] this.form.geom_type.value = this.toFormatGeom(value['geometry']['type']) @@ -558,8 +574,8 @@ export default { customForm['name']['value'] = val } if (! this.isLabelProperties(k)){ - customForm['field_type']['value'] = val - customForm['field_type']['field']['choices'] = typeof(val) + let typeof_val = this.searchValue(typeof val) + customForm['field_type']['value'] = typeof_val } //ENDFOR } -- GitLab