changeset 2569:2d18b8d5b9db

define_stretch: tolerance only visible for new stretch definitions
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 11 Mar 2019 12:39:39 +0100
parents c546e38008de
children c4242b9d59fe
files client/src/components/ImportStretches.vue
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/ImportStretches.vue	Mon Mar 11 12:05:38 2019 +0100
+++ b/client/src/components/ImportStretches.vue	Mon Mar 11 12:39:39 2019 +0100
@@ -64,7 +64,7 @@
               placeholder="AT_Section_12"
               aria-label="id"
               v-model="id"
-              :disabled="!idEditable"
+              :disabled="editExistingStretch"
             />
             <span class="text-left text-danger">
               <small v-if="idError && !id">
@@ -151,7 +151,10 @@
             </small>
           </span>
         </div>
-        <div class="d-flex flex-row justify-content-between">
+        <div
+          v-if="!editExistingStretch"
+          class="d-flex flex-row justify-content-between"
+        >
           <div class="mt-2  mr-2 w-50  text-left">
             <small class="text-muted">
               <translate>Tolerance for snapping of waterway axis</translate>
@@ -283,7 +286,7 @@
   data() {
     return {
       edit: false,
-      idEditable: true,
+      editExistingStretch: false,
       id: "",
       funktion: "",
       startrhm: "",
@@ -363,8 +366,7 @@
       this.edit = true;
       this.startrhm = properties.lower;
       this.endrhm = properties.upper;
-      this.tolerance = properties.tolerance;
-      this.idEditable = false;
+      this.editExistingStretch = true;
     },
     deleteStretch(stretch) {
       this.$store.commit("application/popup", {
@@ -415,7 +417,7 @@
     clean() {
       this.id = "";
       this.edit = false;
-      this.idEditable = true;
+      this.editExistingStretch = false;
       this.funktion = "";
       this.startrhm = "";
       this.tolerance = 5;
@@ -480,7 +482,7 @@
         !this.id ||
         !this.startrhm ||
         !this.endrhm ||
-        !this.tolerance ||
+        (!this.tolerance && this.editExistingStretch) ||
         !this.source ||
         !this.date_info ||
         !this.objbn ||
@@ -491,7 +493,6 @@
         name: this.id,
         from: this.startrhm,
         to: this.endrhm,
-        tolerance: this.tolerance,
         "source-organization": this.source,
         "date-info": this.date_info,
         objnam: this.objbn,
@@ -500,6 +501,9 @@
           return x.trim();
         })
       };
+      if (!this.editExistingStretch) {
+        data["tolerance"] = this.tolerance;
+      }
       this.$store
         .dispatch("imports/saveStretch", data)
         .then(() => {