Kobus 5 jaren geleden
bovenliggende
commit
633721b7d7

+ 16
- 14
src/components/admin/status/agentsUserManagementPage.vue Bestand weergeven

@@ -46,6 +46,9 @@
46 46
           <input v-model="searchItem" class="form-control" placeholder="Search ..." />
47 47
         </div>
48 48
       </div>
49
+      <div v-if="Delete === true">
50
+        <alert :text="'Private User removed successfully'" :type="'SUCCESS'" />
51
+      </div>
49 52
       <br />
50 53
       <table class="table table-bordered">
51 54
         <thead>
@@ -105,25 +108,15 @@
105 108
             <td>
106 109
               <button
107 110
                 type="button"
108
-                data-toggle="modal"
109
-                :data-target="'#myModal' + i"
110 111
                 class="btn"
111 112
                 style="margin:2px; color: #60CBEB"
113
+                @click="routerGoTo('/user/updateProfileInfo')"
112 114
               >Edit</button>
113
-              <div :id="'myModal' + i" class="modal fade" role="dialog">
114
-                <div class="modal-dialog modal-lg">
115
-                  <div class="modal-content">
116
-                    <div class="modal-header">
117
-                      <button type="button" class="close" data-dismiss="modal">&times;</button>
118
-                    </div>
119
-                    <Agency name="Agency" :isAddAgent="false" :item="item" />
120
-                  </div>
121
-                </div>
122
-              </div>
123 115
             </td>
124 116
             <td>
125 117
               <button
126 118
                 type="button"
119
+                @click="Delete(item.id)"
127 120
                 class="btn"
128 121
                 style="width: 85px; height:40px; color:#60CBEB"
129 122
               >Delete</button>
@@ -155,12 +148,17 @@ import _ from 'lodash';
155 148
 import ItemsPerPageList from '../../../assets/staticData/itemsPerPage';
156 149
 import BasePagination from '../../shared/basePagination.vue';
157 150
 import Agency from '../../user/registerAgencySection.vue';
151
+import alert from '../../shared/alert.vue';
158 152
 
159 153
 export default {
160 154
   name: 'agentManagementPage',
161 155
   components: {
162 156
     BasePagination,
163 157
     Agency,
158
+    alert,
159
+  },
160
+  props: {
161
+    delete: Boolean,
164 162
   },
165 163
   data() {
166 164
     return {
@@ -171,10 +169,11 @@ export default {
171 169
       visibleItemsPerPageCount: 0,
172 170
       currentPage: 1,
173 171
       item: {},
172
+      delete: false,
174 173
     };
175 174
   },
176 175
   methods: {
177
-    ...mapActions('register', ['getAgents']),
176
+    ...mapActions('register', ['getAgents', 'deleteAgent']),
178 177
     addNewAgent({ commit }) {
179 178
       axios
180 179
         .post('/api/agent')
@@ -206,6 +205,9 @@ export default {
206 205
         this.currentPage = 1;
207 206
       }
208 207
     },
208
+    Delete(id) {
209
+      this.deleteAgent(id);
210
+    },
209 211
   },
210 212
   mounted() {
211 213
     this.getAgents();
@@ -220,7 +222,7 @@ export default {
220 222
     }
221 223
   },
222 224
   computed: {
223
-    ...mapState('register', ['agents']),
225
+    ...mapState('register', ['agents', 'removeAgent']),
224 226
 
225 227
     SortDirection() {
226 228
       return this.reverse ? 'desc' : 'asc';

+ 18
- 19
src/components/admin/status/userManagementPage.vue Bestand weergeven

@@ -28,6 +28,9 @@
28 28
           <input v-model="searchItem" class="form-control" placeholder="Search ..." />
29 29
         </div>
30 30
       </div>
31
+      <div v-if="Delete === true">
32
+        <alert :text="'Private User removed successfully'" :type="'SUCCESS'" />
33
+      </div>
31 34
       <br />
32 35
       <table class="table table-bordered">
33 36
         <thead>
@@ -87,26 +90,18 @@
87 90
             <td>
88 91
               <button
89 92
                 type="button"
90
-                data-toggle="modal"
91
-                :data-target="'#myModal' + i"
92 93
                 class="btn"
93 94
                 style="margin:2px; color: #60CBEB"
95
+                @click="routerGoTo('/user/updateProfileInfo')"
94 96
               >Edit</button>
95
-              <div :id="'myModal' + i" class="modal fade" role="dialog">
96
-                <div class="modal-dialog modal-lg">
97
-                  <div class="modal-content">
98
-                    <div class="modal-header">
99
-                      <button type="button" class="close" data-dismiss="modal">&times;</button>
100
-                    </div>
101
-                    <div padding-left="20px">
102
-                      <Individual name="PrivateIndividual" :isAddIndividual="false" :item="item" />
103
-                    </div>
104
-                  </div>
105
-                </div>
106
-              </div>
107 97
             </td>
108 98
             <td>
109
-              <button type="button" class="btn" style="margin:2px; color: #60CBEB">Delete</button>
99
+              <button
100
+                type="button"
101
+                @click="Delete(item.id)"
102
+                class="btn"
103
+                style="margin:2px; color: #60CBEB"
104
+              >Delete</button>
110 105
             </td>
111 106
           </tr>
112 107
         </tbody>
@@ -133,13 +128,13 @@ import { mapState, mapActions } from 'vuex';
133 128
 import _ from 'lodash';
134 129
 import ItemsPerPageList from '../../../assets/staticData/itemsPerPage';
135 130
 import BasePagination from '../../shared/basePagination.vue';
136
-import Individual from '../../user/registerPage.vue';
131
+import alert from '../../shared/alert.vue';
137 132
 
138 133
 export default {
139 134
   name: 'userManagementPage',
140 135
   components: {
141 136
     BasePagination,
142
-    Individual,
137
+    alert,
143 138
   },
144 139
   data() {
145 140
     return {
@@ -152,8 +147,9 @@ export default {
152 147
       item: {},
153 148
     };
154 149
   },
150
+  props: {},
155 151
   methods: {
156
-    ...mapActions('register', ['getIndividuals']),
152
+    ...mapActions('register', ['getIndividuals', 'deleteIndividual']),
157 153
     routerGoTo(goTo) {
158 154
       this.$router.push(goTo);
159 155
     },
@@ -179,6 +175,9 @@ export default {
179 175
         this.currentPage = 1;
180 176
       }
181 177
     },
178
+    Delete(id) {
179
+      this.deleteIndividual(id);
180
+    },
182 181
   },
183 182
   mounted() {
184 183
     this.getIndividuals();
@@ -193,7 +192,7 @@ export default {
193 192
     }
194 193
   },
195 194
   computed: {
196
-    ...mapState('register', ['individuals']),
195
+    ...mapState('register', ['individuals', 'removeIndividual']),
197 196
 
198 197
     SortDirection() {
199 198
       return this.reverse ? 'desc' : 'asc';

+ 5
- 3
src/components/user/updateProfileInfo.vue Bestand weergeven

@@ -27,7 +27,7 @@ import { mapState, mapActions, mapGetters } from 'vuex';
27 27
 import DetailIndividual from './timeshareIndividual.vue';
28 28
 
29 29
 export default {
30
-  name: 'TimeshareToSell',
30
+  name: 'UpdateInfo',
31 31
   data() {
32 32
     return { selectedItem: {} };
33 33
   },
@@ -36,7 +36,7 @@ export default {
36 36
     DetailIndividual,
37 37
   },
38 38
   mounted() {
39
-    this.selectedItem = this.indiv;
39
+    this.selectedItem = this.currentUser;
40 40
   },
41 41
   computed: {
42 42
     ...mapState('timeshare', [
@@ -64,7 +64,9 @@ export default {
64 64
   },
65 65
   methods: {
66 66
     ...mapActions('individual', ['getIndividual']),
67
-    ...mapActions('timeshare', ['initTimeshare', 'onResortChange', 'saveWeek']),
67
+    onSelectedItemItemChange(item) {
68
+      this.currentUser = item;
69
+    },
68 70
   },
69 71
 };
70 72
 </script>

+ 12
- 14
src/store/modules/user/individual.js Bestand weergeven

@@ -18,10 +18,7 @@ export default {
18 18
   },
19 19
   getters: {},
20 20
   actions: {
21
-    getIndividual({
22
-      commit,
23
-      rootGetters,
24
-    }, userId) {
21
+    getIndividual({ commit, rootGetters }, userId) {
25 22
       let id = 0;
26 23
       if (!userId || userId === 0) {
27 24
         const rootItem = rootGetters['authentication/getUser'];
@@ -30,18 +27,19 @@ export default {
30 27
       axios
31 28
         .get(`/api/individual/getIndividual/${id}`)
32 29
         .then(r => commit('setItem', {
33
-          name: 'indiv',
34
-          value: r.data,
35
-        }))
30
+            name: 'indiv',
31
+            value: r.data,
32
+          }),)
36 33
         .catch(console.error);
37 34
     },
38
-    getAllIndividuals({
39
-      commit,
40
-    }) {
41
-      axios.get('/api/individual/getAllIndividuals').then(x => commit('setItem', {
42
-        name: 'items',
43
-        value: x.data,
44
-      })).catch(console.error);
35
+    getAllIndividuals({ commit }) {
36
+      axios
37
+        .get('/api/individual/getAllIndividuals')
38
+        .then(x => commit('setItem', {
39
+            name: 'items',
40
+            value: x.data,
41
+          }),)
42
+        .catch(console.error);
45 43
     },
46 44
   },
47 45
 };

+ 22
- 27
src/store/modules/user/register.js Bestand weergeven

@@ -54,10 +54,8 @@ export default {
54 54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
55 55
     },
56 56
     updateAgency(state, type) {
57
-      state.registerAgency.find(item => item.id === type.id).eaabeffcNumber = type
58
-        .eaabeffcNumber;
59
-      state.registerAgency.find(item => item.id === type.id).companyRegNumber = type
60
-        .companyRegNumber;
57
+      state.registerAgency.find(item => item.id === type.id).eaabeffcNumber = type.eaabeffcNumber;
58
+      state.registerAgency.find(item => item.id === type.id).companyRegNumber =        type.companyRegNumber;
61 59
     },
62 60
     clearIndividual(state) {
63 61
       state.registerIndividual = {
@@ -90,20 +88,19 @@ export default {
90 88
     removeAgency(state, id) {
91 89
       state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
92 90
     },
91
+    removeAgent(state, id) {
92
+      state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
93
+    },
93 94
   },
94 95
   getters: {},
95 96
   actions: {
96
-    getIndividuals({
97
-      commit,
98
-    }) {
97
+    getIndividuals({ commit }) {
99 98
       axios
100 99
         .get('/api/individual')
101 100
         .then(result => commit('setIndividuals', result.data))
102 101
         .catch(console.error);
103 102
     },
104
-    getAgents({
105
-      commit,
106
-    }) {
103
+    getAgents({ commit }) {
107 104
       axios
108 105
         .get('/api/agent')
109 106
         .then(result => commit('setAgents', result.data))
@@ -118,25 +115,19 @@ export default {
118 115
     //     .catch(console.error);
119 116
     // },
120 117
 
121
-    saveIndividual({
122
-      commit,
123
-    }, item) {
118
+    saveIndividual({ commit }, item) {
124 119
       axios
125 120
         .post('/api/register/register', item)
126 121
         .then(result => commit('addIndividual', result.data))
127 122
         .catch(console.error);
128 123
     },
129
-    saveAgency({
130
-      commit,
131
-    }, item) {
124
+    saveAgency({ commit }, item) {
132 125
       axios
133 126
         .post('/api/register/registeragency', item)
134 127
         .then(result => commit('addAgency', result.data))
135 128
         .catch(console.error);
136 129
     },
137
-    saveAgent({
138
-      commit,
139
-    }, item) {
130
+    saveAgent({ commit }, item) {
140 131
       axios
141 132
         .post('/api/agent', item)
142 133
         .then(result => commit('addAgent', result.data))
@@ -168,14 +159,18 @@ export default {
168 159
     // }) {
169 160
     //   commit('clearAgency');
170 161
     // },
171
-    // deleteIndividual({
172
-    //   commit,
173
-    // }, id) {
174
-    //   axios
175
-    //     .delete(`/api/individual/${id}`)
176
-    //     .then(result => commit('removeIndividual', id))
177
-    //     .catch(console.error);
178
-    // },
162
+    deleteIndividual({ commit }, id) {
163
+      axios
164
+        .delete(`/api/individual/${id}`)
165
+        .then(result => commit('removeIndividual', id))
166
+        .catch(console.error);
167
+    },
168
+    deleteAgent({ commit }, id) {
169
+      axios
170
+        .delete(`/api/agent/${id}`)
171
+        .then(result => commit('removeAgent', id))
172
+        .catch(console.error);
173
+    },
179 174
     // deleteAgency({
180 175
     //   commit,
181 176
     // }, id) {

Laden…
Annuleren
Opslaan