Quellcode durchsuchen

Added add new agent button on user management screen

master
LeneS vor 5 Jahren
Ursprung
Commit
55e3904b07

+ 47
- 2
src/components/admin/status/userManagementPage.vue Datei anzeigen

@@ -13,6 +13,9 @@
13 13
         <br />
14 14
       </div>
15 15
     </div>
16
+    <button @click="addNewAgent" type="button" class="btn btn-b-n">Add New Agent</button>
17
+    <br />
18
+    <br />
16 19
     <div class="container">
17 20
       <table class="table table-bordered">
18 21
         <thead>
@@ -24,11 +27,17 @@
24 27
             <th>Telephone Number</th>
25 28
             <th>Email</th>
26 29
             <th>Role</th>
30
+            <th>Reset Password</th>
27 31
             <th></th>
28 32
             <th></th>
29 33
           </tr>
30 34
         </thead>
31 35
         <tbody>
36
+          <tr>
37
+            <td colspan="10">
38
+              <h5>Private Users</h5>
39
+            </td>
40
+          </tr>
32 41
           <tr v-for="(item, i) in individuals" :key="i">
33 42
             <td>{{ item.id }}</td>
34 43
             <td>{{ item.name }}</td>
@@ -38,6 +47,34 @@
38 47
             <td>{{ item.email }}</td>
39 48
             <td v-if="item.user">{{ item.user.role }}</td>
40 49
             <td v-else></td>
50
+            <td></td>
51
+            <td>
52
+              <button
53
+                type="button"
54
+                @click="Edit(item)"
55
+                class="btn btn-b-n"
56
+                style="width: 85px; height:40px;"
57
+              >Edit</button>
58
+            </td>
59
+            <td>
60
+              <button type="button" class="btn btn-b-n" style="width: 85px; height:40px">Delete</button>
61
+            </td>
62
+          </tr>
63
+          <tr>
64
+            <td colspan="10">
65
+              <h5>Agents</h5>
66
+            </td>
67
+          </tr>
68
+          <tr v-for="(item, i) in agents" :key="i">
69
+            <td>{{ item.id }}</td>
70
+            <td>{{ item.name }}</td>
71
+            <td>{{ item.surname }}</td>
72
+            <td>{{ item.cellNumber }}</td>
73
+            <td>{{ item.telephone }}</td>
74
+            <td>{{ item.email }}</td>
75
+            <td v-if="item.user">{{ item.user.role }}</td>
76
+            <td v-else></td>
77
+            <td></td>
41 78
             <td>
42 79
               <button
43 80
                 type="button"
@@ -58,6 +95,7 @@
58 95
 </template>
59 96
 <script>
60 97
 import { mapState, mapActions } from 'vuex';
98
+import axios from 'axios';
61 99
 
62 100
 export default {
63 101
   name: 'userManagementPage',
@@ -65,13 +103,20 @@ export default {
65 103
     return {};
66 104
   },
67 105
   methods: {
68
-    ...mapActions('registerIndividual', ['getIndividuals']),
106
+    ...mapActions('registerIndividual', ['getIndividuals', 'getAgents']),
107
+    addNewAgent({ commit }) {
108
+      axios
109
+        .post('/api/agent')
110
+        .then(result => commit('saveAgent', result.data))
111
+        .catch(console.error);
112
+    },
69 113
   },
70 114
   mounted() {
71 115
     this.getIndividuals();
116
+    this.getAgents();
72 117
   },
73 118
   computed: {
74
-    ...mapState('registerIndividual', ['individuals']),
119
+    ...mapState('registerIndividual', ['individuals', 'agents']),
75 120
   },
76 121
 };
77 122
 </script>

+ 1
- 13
src/components/shared/navBar.vue Datei anzeigen

@@ -136,7 +136,6 @@
136 136
 
137 137
             <li v-if="showLogout" class="nav-item dropdown">
138 138
               <a
139
-                v-if="showLogout"
140 139
                 class="nav-link dropdown-toggle"
141 140
                 href="#"
142 141
                 id="navbarDropdown"
@@ -146,43 +145,32 @@
146 145
                 aria-expanded="false"
147 146
               >Admin</a>
148 147
               <div class="dropdown-menu" aria-labelledby="navbarDropdown">
148
+                <a class="dropdown-item cursor-pointer" @click="routerGoTo('/status/list')">Status</a>
149 149
                 <a
150
-                  v-if="showLogout"
151
-                  class="dropdown-item cursor-pointer"
152
-                  @click="routerGoTo('/status/list')"
153
-                >Status</a>
154
-                <a
155
-                  v-if="showLogout"
156 150
                   class="dropdown-item cursor-pointer"
157 151
                   @click="routerGoTo('/status/timeshareAdmin')"
158 152
                 >Timeshare Week Admin</a>
159 153
                 <a
160
-                  v-if="showLogout"
161 154
                   class="dropdown-item cursor-pointer"
162 155
                   @click="routerGoTo('/status/tenderWeekAdmin')"
163 156
                 >Tender Week Management</a>
164 157
                 <a
165
-                  v-if="showLogout"
166 158
                   class="dropdown-item cursor-pointer"
167 159
                   @click="routerGoTo('/unitConfiguration/list')"
168 160
                 >Unit Configuration</a>
169 161
                 <a
170
-                  v-if="showLogout"
171 162
                   class="dropdown-item cursor-pointer"
172 163
                   @click="routerGoTo('/status/userManagementPage')"
173 164
                 >User Management & Access</a>
174 165
                 <a
175
-                  v-if="showLogout"
176 166
                   class="dropdown-item cursor-pointer"
177 167
                   @click="routerGoTo('/status/changeLogPage')"
178 168
                 >Changes Logs</a>
179 169
                 <a
180
-                  v-if="showLogout"
181 170
                   class="dropdown-item cursor-pointer"
182 171
                   @click="routerGoTo('/userDefinedGroups/list')"
183 172
                 >Property User Defined Groups</a>
184 173
                 <a
185
-                  v-if="showLogout"
186 174
                   class="dropdown-item cursor-pointer"
187 175
                   @click="routerGoTo('/propertyTypes/list')"
188 176
                 >Property Types</a>

+ 23
- 0
src/store/modules/user/register.js Datei anzeigen

@@ -4,6 +4,7 @@ export default {
4 4
   namespaced: true,
5 5
   state: {
6 6
     individuals: [],
7
+    agents: [],
7 8
     registerIndividual: {
8 9
       name: '',
9 10
       surname: '',
@@ -33,6 +34,9 @@ export default {
33 34
     setIndividuals(state, type) {
34 35
       state.individuals = type;
35 36
     },
37
+    setAgents(state, type) {
38
+      state.agents = type;
39
+    },
36 40
     setAgency(state, type) {
37 41
       state.registerAgency = type;
38 42
     },
@@ -42,6 +46,9 @@ export default {
42 46
     addAgency(state, type) {
43 47
       state.registerAgency = type;
44 48
     },
49
+    addAgent(state, type) {
50
+      state.registerIndividual = type;
51
+    },
45 52
     updateIndividual(state, type) {
46 53
       state.registerIndividual.find(item => item.id === type.id).username = type.username;
47 54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
@@ -94,6 +101,14 @@ export default {
94 101
         .then(result => commit('setIndividuals', result.data))
95 102
         .catch(console.error);
96 103
     },
104
+    getAgents({
105
+      commit,
106
+    }) {
107
+      axios
108
+        .get('/api/agent')
109
+        .then(result => commit('setAgents', result.data))
110
+        .catch(console.error);
111
+    },
97 112
     // getAgency({
98 113
     //   commit,
99 114
     // }, id) {
@@ -119,6 +134,14 @@ export default {
119 134
         .then(result => commit('addAgency', result.data))
120 135
         .catch(console.error);
121 136
     },
137
+    saveAgent({
138
+      commit,
139
+    }, item) {
140
+      axios
141
+        .post('/api/agent', item)
142
+        .then(result => commit('addAgent', result.data))
143
+        .catch(console.error);
144
+    },
122 145
     // updateIndividual({
123 146
     //   commit,
124 147
     // }, item) {

Laden…
Abbrechen
Speichern