changeset 1959:84e475938b75

define stretches: validation of start vs endpoint
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 22 Jan 2019 17:12:57 +0100
parents ae4ada3933af
children e5c5954fbd84
files client/src/components/ImportStretches.vue
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/ImportStretches.vue	Tue Jan 22 16:46:32 2019 +0100
+++ b/client/src/components/ImportStretches.vue	Tue Jan 22 17:12:57 2019 +0100
@@ -139,6 +139,11 @@
               </small>
             </span>
           </div>
+          <span class="text-left text-danger">
+            <small v-if="!pointsValid">
+              <translate>Startpoint is not before endpoint.</translate>
+            </small>
+          </span>
         </div>
         <div class="d-flex flex-row justify-content-between">
           <div class="mt-2  mr-2 w-50  text-left">
@@ -411,6 +416,7 @@
       const filterDistanceMarks = x => {
         return /^distance_marks/.test(x["id_"]);
       };
+      console.log(this.identifiedFeatures);
       const distanceMark = this.identifiedFeatures.filter(filterDistanceMarks);
       if (distanceMark.length > 0) {
         const value = distanceMark[0]["id_"]
@@ -426,7 +432,14 @@
   computed: {
     ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
     ...mapGetters("user", ["isSysAdmin"]),
-    ...mapState("imports", ["stretches"])
+    ...mapState("imports", ["stretches"]),
+    pointsValid() {
+      if (!this.startrhm || !this.endrhm) return true;
+      const start = this.startrhm.replace(/\D+/, "");
+      const end = this.endrhm.replace(/\D+/, "");
+      const result = start < end;
+      return result;
+    }
   }
 };
 </script>