From fc9e578b9ee9b4a04126b6dc87d7d1552d0d837c Mon Sep 17 00:00:00 2001
From: Chris Steinmann <steinmann@infai.org>
Date: Thu, 2 Sep 2021 16:29:31 +0200
Subject: [PATCH] #301 move btn, fix compilation error

---
 app/src/helper/transect.service.ts |  2 +-
 app/src/i18n/deutsch.json          |  3 ++-
 app/src/i18n/english.json          |  3 ++-
 app/src/views/TransectProfile.ts   |  9 ++++++++-
 app/src/views/TransectProfile.vue  | 16 ++++++++--------
 5 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/app/src/helper/transect.service.ts b/app/src/helper/transect.service.ts
index afede15e5..5f065f16f 100644
--- a/app/src/helper/transect.service.ts
+++ b/app/src/helper/transect.service.ts
@@ -332,7 +332,7 @@ export class TransectService {
      * @param userRoles roles that should be assigned to this user (in a string array)
      */
     public updateUserRolesForTransect = async (userId: string, userRoles: string[]) => {
-        let userRolesString = userRoles.join('","');
+        const userRolesString = userRoles.join('","');
         const query = `mutation {
             updateUser (
                 input: {
diff --git a/app/src/i18n/deutsch.json b/app/src/i18n/deutsch.json
index c4f4d05b8..7dd5a0daf 100644
--- a/app/src/i18n/deutsch.json
+++ b/app/src/i18n/deutsch.json
@@ -375,7 +375,8 @@
     }
   },
   "transectProfile": {
-    "assignUsersOrRoles": "Nutzer oder Rollen zum Transekt zuweisen",
+    "assignUsers": "Nutzer zum Transekt zuweisen",
+    "assignRoles": "Rollen zum Transekt-Benutzern zuweisen",
     "dialogTitle": "Zuweisung von Nutzern oder Rollen",
     "chooseUser": "Nutzer zuweisen",
     "chooseRole": "Rolle zuweisen",
diff --git a/app/src/i18n/english.json b/app/src/i18n/english.json
index 753fb54e3..8e557191d 100644
--- a/app/src/i18n/english.json
+++ b/app/src/i18n/english.json
@@ -375,7 +375,8 @@
     }
   },
   "transectProfile": {
-    "assignUsersOrRoles": "Assign users or roles",
+    "assignUsers": "Assign users to transect",
+    "assignRoles": "Assign roles to transect users",
     "dialogTitle": "Assign users or roles",
     "chooseUser": "Assign user",
     "chooseRole": "Assign role",
diff --git a/app/src/views/TransectProfile.ts b/app/src/views/TransectProfile.ts
index 6b4a628cd..6560d51b8 100644
--- a/app/src/views/TransectProfile.ts
+++ b/app/src/views/TransectProfile.ts
@@ -86,7 +86,7 @@ export default class TransectManagement extends Vue {
         }
     }
 
-    private assignUsersAndRolesToTransect() {
+    private assignUsersBtn() {
         this.showAssignDialog = true;
         this.isLoading = true;
         this.allUsers = [];
@@ -124,6 +124,11 @@ export default class TransectManagement extends Vue {
         this.failAlert = true;
     }
 
+    private hideAlerts() {
+        this.confirmationAlert = false;
+        this.failAlert = false;
+    }
+
     private isValidUserHistoryData(response: AxiosResponse) {
         return response && response.data && response.data.data &&
             response.data.data.transectUserHistories && response.data.data.transectUserHistories.collection;
@@ -163,6 +168,7 @@ export default class TransectManagement extends Vue {
             } 
             this.delay(2000).then(() => {
                 this.showAssignDialog = false;
+                this.hideAlerts();
             });
         });
     }
@@ -185,6 +191,7 @@ export default class TransectManagement extends Vue {
             } 
             this.delay(2000).then(() => {
                 this.showAssignDialog = false;
+                this.hideAlerts();
             });
         });
     }
diff --git a/app/src/views/TransectProfile.vue b/app/src/views/TransectProfile.vue
index cc8aada7c..ab1eba20a 100644
--- a/app/src/views/TransectProfile.vue
+++ b/app/src/views/TransectProfile.vue
@@ -4,6 +4,14 @@
             <div class="text-center">
                 <v-progress-circular v-show="isLoading" color="primary" indeterminate/>
             </div>
+            <v-row>
+                <v-col cols="8"/>
+                <v-col cols="4">
+                    <v-btn @click="assignUsersBtn()" width="100%" :disabled="isLoading">
+                        {{ $t('transectProfile.assignUsers') }}
+                    </v-btn>
+                </v-col>
+            </v-row>
             <v-row>
                 <v-container fluid>
                     <v-card width="100%" disabled>
@@ -49,14 +57,6 @@
                     </v-card>
                 </v-container>
             </v-row>
-            <v-row>
-                <v-col cols="7"/>
-                <v-col cols="5">
-                    <v-btn @click="assignUsersAndRolesToTransect()" width="100%" :disabled="isLoading">
-                        {{ $t('transectProfile.assignUsersOrRoles') }}
-                    </v-btn>
-                </v-col>
-            </v-row>
             <v-row>
                 <v-container fluid>
                     <v-card width="100%" disabled>
-- 
GitLab