From 3d2b39bb354d0d4fd23a9725e34efb900e14fd6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Fri, 30 Jun 2023 10:53:29 +0200
Subject: [PATCH] correct error message & reorder functions

---
 .../FeatureType/FeatureTypeCustomForm.vue     | 54 +++++++++----------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/components/FeatureType/FeatureTypeCustomForm.vue b/src/components/FeatureType/FeatureTypeCustomForm.vue
index 849b18bb..5b94ef23 100644
--- a/src/components/FeatureType/FeatureTypeCustomForm.vue
+++ b/src/components/FeatureType/FeatureTypeCustomForm.vue
@@ -391,6 +391,22 @@ export default {
       this.updateStore();
     },
 
+    updateStore() {
+      const data = {
+        dataKey: this.customForm.dataKey,
+        isMandatory: this.form.isFieldMandatory,
+        label: this.form.label.value,
+        name: this.form.name.value,
+        position: this.form.position.value,
+        field_type: this.form.field_type.value,
+        options: this.form.options.value,
+      };
+      this.$store.commit('feature-type/UPDATE_CUSTOM_FORM', data);
+      if (this.customForm.name === this.selectedColorStyle ) {
+        this.$emit('update', this.form.options.value);
+      }
+    },
+
     hasDuplicateOptions() {
       this.form.options.errors = [];
       const isDup =
@@ -421,6 +437,16 @@ export default {
         this.customForm.dataKey
       );
     },
+        
+    initSortable() {
+      this.sortable = new Sortable(document.getElementById(`list-options-${this.customForm.dataKey}`), {
+        animation: 150,
+        handle: '.draggable-row', // The element that is active to drag
+        ghostClass: 'blue-background-class',
+        dragClass: 'white-opacity-background-class',
+        onEnd: this.updateOptionOrder,
+      });
+    },
 
     updateOptionValue(index, e) {
       this.form.options.value[index] = e.target.value;
@@ -435,16 +461,6 @@ export default {
       this.updateStore();
     },
     
-    initSortable() {
-      this.sortable = new Sortable(document.getElementById(`list-options-${this.customForm.dataKey}`), {
-        animation: 150,
-        handle: '.draggable-row', // The element that is active to drag
-        ghostClass: 'blue-background-class',
-        dragClass: 'white-opacity-background-class',
-        onEnd: this.updateOptionOrder,
-      });
-    },
-    
     addOption() {
       this.form.options.value.push('');
     },
@@ -453,22 +469,6 @@ export default {
       this.form.options.value.splice(index, 1);
     },
 
-    updateStore() {
-      const data = {
-        dataKey: this.customForm.dataKey,
-        isMandatory: this.form.isFieldMandatory,
-        label: this.form.label.value,
-        name: this.form.name.value,
-        position: this.form.position.value,
-        field_type: this.form.field_type.value,
-        options: this.form.options.value,
-      };
-      this.$store.commit('feature-type/UPDATE_CUSTOM_FORM', data);
-      if (this.customForm.name === this.selectedColorStyle ) {
-        this.$emit('update', this.form.options.value);
-      }
-    },
-
     trimWhiteSpace(string) {
       // TODO : supprimer les espaces pour chaque option au début et à la fin QUE à la validation
       return string.replace(/\s*,\s*/gi, ',');
@@ -497,7 +497,7 @@ export default {
       }
       if (this.form.field_type.value === 'pre_recorded_list') {
         return this.form.options.value.length === 1 ?
-          '' : 'Veuillez renseigner une option.';
+          '' : 'Veuillez sélectionner une option.';
       }
       return '';
     },
-- 
GitLab