소스 검색

Added add new agent button on user management screen

master
LeneS 5 년 전
부모
커밋
55e3904b07
3개의 변경된 파일71개의 추가작업 그리고 15개의 파일을 삭제
  1. 47
    2
      src/components/admin/status/userManagementPage.vue
  2. 1
    13
      src/components/shared/navBar.vue
  3. 23
    0
      src/store/modules/user/register.js

+ 47
- 2
src/components/admin/status/userManagementPage.vue 파일 보기

13
         <br />
13
         <br />
14
       </div>
14
       </div>
15
     </div>
15
     </div>
16
+    <button @click="addNewAgent" type="button" class="btn btn-b-n">Add New Agent</button>
17
+    <br />
18
+    <br />
16
     <div class="container">
19
     <div class="container">
17
       <table class="table table-bordered">
20
       <table class="table table-bordered">
18
         <thead>
21
         <thead>
24
             <th>Telephone Number</th>
27
             <th>Telephone Number</th>
25
             <th>Email</th>
28
             <th>Email</th>
26
             <th>Role</th>
29
             <th>Role</th>
30
+            <th>Reset Password</th>
27
             <th></th>
31
             <th></th>
28
             <th></th>
32
             <th></th>
29
           </tr>
33
           </tr>
30
         </thead>
34
         </thead>
31
         <tbody>
35
         <tbody>
36
+          <tr>
37
+            <td colspan="10">
38
+              <h5>Private Users</h5>
39
+            </td>
40
+          </tr>
32
           <tr v-for="(item, i) in individuals" :key="i">
41
           <tr v-for="(item, i) in individuals" :key="i">
33
             <td>{{ item.id }}</td>
42
             <td>{{ item.id }}</td>
34
             <td>{{ item.name }}</td>
43
             <td>{{ item.name }}</td>
38
             <td>{{ item.email }}</td>
47
             <td>{{ item.email }}</td>
39
             <td v-if="item.user">{{ item.user.role }}</td>
48
             <td v-if="item.user">{{ item.user.role }}</td>
40
             <td v-else></td>
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
             <td>
78
             <td>
42
               <button
79
               <button
43
                 type="button"
80
                 type="button"
58
 </template>
95
 </template>
59
 <script>
96
 <script>
60
 import { mapState, mapActions } from 'vuex';
97
 import { mapState, mapActions } from 'vuex';
98
+import axios from 'axios';
61
 
99
 
62
 export default {
100
 export default {
63
   name: 'userManagementPage',
101
   name: 'userManagementPage',
65
     return {};
103
     return {};
66
   },
104
   },
67
   methods: {
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
   mounted() {
114
   mounted() {
71
     this.getIndividuals();
115
     this.getIndividuals();
116
+    this.getAgents();
72
   },
117
   },
73
   computed: {
118
   computed: {
74
-    ...mapState('registerIndividual', ['individuals']),
119
+    ...mapState('registerIndividual', ['individuals', 'agents']),
75
   },
120
   },
76
 };
121
 };
77
 </script>
122
 </script>

+ 1
- 13
src/components/shared/navBar.vue 파일 보기

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

+ 23
- 0
src/store/modules/user/register.js 파일 보기

4
   namespaced: true,
4
   namespaced: true,
5
   state: {
5
   state: {
6
     individuals: [],
6
     individuals: [],
7
+    agents: [],
7
     registerIndividual: {
8
     registerIndividual: {
8
       name: '',
9
       name: '',
9
       surname: '',
10
       surname: '',
33
     setIndividuals(state, type) {
34
     setIndividuals(state, type) {
34
       state.individuals = type;
35
       state.individuals = type;
35
     },
36
     },
37
+    setAgents(state, type) {
38
+      state.agents = type;
39
+    },
36
     setAgency(state, type) {
40
     setAgency(state, type) {
37
       state.registerAgency = type;
41
       state.registerAgency = type;
38
     },
42
     },
42
     addAgency(state, type) {
46
     addAgency(state, type) {
43
       state.registerAgency = type;
47
       state.registerAgency = type;
44
     },
48
     },
49
+    addAgent(state, type) {
50
+      state.registerIndividual = type;
51
+    },
45
     updateIndividual(state, type) {
52
     updateIndividual(state, type) {
46
       state.registerIndividual.find(item => item.id === type.id).username = type.username;
53
       state.registerIndividual.find(item => item.id === type.id).username = type.username;
47
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
94
         .then(result => commit('setIndividuals', result.data))
101
         .then(result => commit('setIndividuals', result.data))
95
         .catch(console.error);
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
     // getAgency({
112
     // getAgency({
98
     //   commit,
113
     //   commit,
99
     // }, id) {
114
     // }, id) {
119
         .then(result => commit('addAgency', result.data))
134
         .then(result => commit('addAgency', result.data))
120
         .catch(console.error);
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
     // updateIndividual({
145
     // updateIndividual({
123
     //   commit,
146
     //   commit,
124
     // }, item) {
147
     // }, item) {

Loading…
취소
저장