diff client/src/components/ImportStretches.vue @ 1827:27c4effba5b1

stretches only for sysadmin plus country code
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 16 Jan 2019 15:29:41 +0100
parents 7d37d9f5f272
children 3050d702913a
line wrap: on
line diff
--- a/client/src/components/ImportStretches.vue	Wed Jan 16 12:56:54 2019 +0100
+++ b/client/src/components/ImportStretches.vue	Wed Jan 16 15:29:41 2019 +0100
@@ -6,7 +6,7 @@
     </h6>
     <div class="ml-3 mr-3">
       <div class="d-flex flex-row justify-content-between">
-        <div class="mt-1 w-50 mr-2 text-left">
+        <div class="mt-2 w-50 mr-2 text-left">
           <small class="text-muted"> <translate>ID</translate> </small>
           <input
             id="id"
@@ -22,11 +22,13 @@
             </small>
           </span>
         </div>
-        <div class="mt-1 w-50 ml-2 text-left">
+        <div class="mt-2 w-50 ml-2 text-left">
           <small class="text-muted"><translate>Function</translate> </small>
           <select v-model="funktion" class="custom-select">
             <option value="section"><translate>Section</translate></option>
-            <option value="stretch"><translate>Stretch</translate></option>
+            <option v-if="isSysAdmin" value="stretch"
+              ><translate>Stretch</translate></option
+            >
           </select>
           <span class="text-left text-danger">
             <small v-if="funktionError && !funktion">
@@ -36,7 +38,7 @@
         </div>
       </div>
       <div class="d-flex flex-column  justify-content-between">
-        <div class="mt-1 text-left">
+        <div class="mt-2 text-left">
           <small class="text-muted"> <translate>Start rhm</translate> </small>
           <div class="d-flex flex-row">
             <input
@@ -61,7 +63,7 @@
             </small>
           </span>
         </div>
-        <div class="mt-1 text-left">
+        <div class="mt-2 text-left">
           <small class="text-muted"> <translate>End rhm</translate> </small>
           <div class="d-flex flex-row">
             <input
@@ -88,7 +90,7 @@
         </div>
       </div>
       <div class="d-flex flex-row justify-content-between">
-        <div class="mt-1  mr-2 w-50  text-left">
+        <div class="mt-2  mr-2 w-50  text-left">
           <small class="text-muted"> <translate>Object name</translate> </small>
           <input
             id="objbn"
@@ -104,7 +106,7 @@
             </small>
           </span>
         </div>
-        <div class="mt-1  ml-2 w-50  text-left">
+        <div class="mt-2  ml-2 w-50  text-left">
           <small class="text-muted">
             <translate>National Object name</translate>
           </small>
@@ -124,7 +126,7 @@
         </div>
       </div>
       <div class="d-flex flex-row justify-content-between">
-        <div class="mt-1 mr-2 w-50 text-left">
+        <div class="mt-2 mr-2 w-50 text-left">
           <small class="text-muted"> <translate>Date info</translate> </small>
           <input
             id="date_info"
@@ -140,7 +142,7 @@
             </small>
           </span>
         </div>
-        <div class="mt-1 ml-2 w-50 text-left">
+        <div class="mt-2 ml-2 w-50 text-left">
           <small class="text-muted"> <translate>Source</translate> </small>
           <input
             id="source"
@@ -157,8 +159,30 @@
           </span>
         </div>
       </div>
+      <div
+        v-if="funktion === 'stretch'"
+        class="d-flex flex-row justify-content-between"
+      >
+        <div class="mt-2 w-50 mr-2 text-left ">
+          <small class="text-muted"> <translate>Countrycode</translate> </small>
+          <input
+            id="countryCode"
+            type="text"
+            class="form-control"
+            placeholder="AT"
+            aria-label="id"
+            v-model="id"
+          />
+          <span class="text-left text-danger">
+            <small v-if="countryCodeError && !countryCode">
+              <translate>Please enter a countrycode </translate>
+            </small>
+          </span>
+        </div>
+        <div class="w-50 ml-2"></div>
+      </div>
     </div>
-    <div class="text-right mt-3 mr-3 mb-3">
+    <div class="text-right mt-2 mr-3 mb-3">
       <button
         @click="submit"
         type="submit"
@@ -184,7 +208,7 @@
  * Author(s):
  * Thomas Junk <thomas.junk@intevation.de>
  */
-import { mapState } from "vuex";
+import { mapState, mapGetters } from "vuex";
 import { displayInfo } from "@/lib/errors.js";
 
 export default {
@@ -197,6 +221,7 @@
       endrhm: "",
       objbn: "",
       nobjbn: "",
+      countryCode: "",
       date_info: new Date().toISOString().split("T")[0],
       source: "",
       pipetteStart: false,
@@ -208,7 +233,8 @@
       objbnError: false,
       nobjbnError: false,
       date_infoError: false,
-      sourceError: false
+      sourceError: false,
+      countryCodeError: false
     };
   },
   methods: {
@@ -266,7 +292,8 @@
     }
   },
   computed: {
-    ...mapState("map", ["identifiedFeatures", "currentMeasurement"])
+    ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
+    ...mapGetters("user", ["isSysAdmin"])
   }
 };
 </script>