diff client/src/components/fairway/BottleneckDialogue.vue @ 5408:901b70f9c6bd marking-single-beam

disable cuts or differences if surveytype is 'marking'
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 06 Jul 2021 15:47:44 +0200
parents b5028b98e7c4
children 776e34886471
line wrap: on
line diff
--- a/client/src/components/fairway/BottleneckDialogue.vue	Tue Jul 06 15:26:20 2021 +0200
+++ b/client/src/components/fairway/BottleneckDialogue.vue	Tue Jul 06 15:47:44 2021 +0200
@@ -103,6 +103,7 @@
               <select
                 v-model="additionalSurvey"
                 class="form-control form-control-sm small"
+                :disabled="!areDifferecesAllowed"
               >
                 <option :value="null">None</option>
                 <option
@@ -264,7 +265,7 @@
               <button
                 class="btn btn-info btn-sm w-100"
                 @click="toggleCutTool"
-                :disabled="!selectedSurvey"
+                :disabled="!isCutAllowed"
               >
                 <font-awesome-icon :icon="cutToolEnabled ? 'times' : 'plus'" />
                 {{ cutToolEnabled ? "Cancel" : "New" }}
@@ -330,6 +331,7 @@
  *
  * Author(s):
  * Markus Kottländer <markus.kottlaender@intevation.de>
+ * Thomas Junk <thomas.junk@intevation.de>
  */
 import { mapState, mapGetters } from "vuex";
 import Feature from "ol/Feature";
@@ -358,6 +360,15 @@
       "surveys",
       "surveysLoading"
     ]),
+    selectedSurveyIsMarking() {
+      return this.selectedSurvey["survey_type"] === "marking";
+    },
+    areDifferecesAllowed() {
+      return !this.selectedSurveyIsMarking;
+    },
+    isCutAllowed() {
+      return !this.selectedSurveyIsMarking && !!this.selectedSurvey;
+    },
     isAllowedToDelete() {
       const userCountryCode = this.userCountries[this.user];
       const bottleneck = this.bottlenecksList.find(