diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue index f65d33768f9b17dd505140307fbcc16f92284d4d..f2060f93a1242e61f285ab09a77e72734d9d355a 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 }