Kobus 5 lat temu
rodzic
commit
633721b7d7

+ 16
- 14
src/components/admin/status/agentsUserManagementPage.vue Wyświetl plik

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

+ 18
- 19
src/components/admin/status/userManagementPage.vue Wyświetl plik

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

+ 5
- 3
src/components/user/updateProfileInfo.vue Wyświetl plik

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

+ 12
- 14
src/store/modules/user/individual.js Wyświetl plik

18
   },
18
   },
19
   getters: {},
19
   getters: {},
20
   actions: {
20
   actions: {
21
-    getIndividual({
22
-      commit,
23
-      rootGetters,
24
-    }, userId) {
21
+    getIndividual({ commit, rootGetters }, userId) {
25
       let id = 0;
22
       let id = 0;
26
       if (!userId || userId === 0) {
23
       if (!userId || userId === 0) {
27
         const rootItem = rootGetters['authentication/getUser'];
24
         const rootItem = rootGetters['authentication/getUser'];
30
       axios
27
       axios
31
         .get(`/api/individual/getIndividual/${id}`)
28
         .get(`/api/individual/getIndividual/${id}`)
32
         .then(r => commit('setItem', {
29
         .then(r => commit('setItem', {
33
-          name: 'indiv',
34
-          value: r.data,
35
-        }))
30
+            name: 'indiv',
31
+            value: r.data,
32
+          }),)
36
         .catch(console.error);
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 Wyświetl plik

54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
55
     },
55
     },
56
     updateAgency(state, type) {
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
     clearIndividual(state) {
60
     clearIndividual(state) {
63
       state.registerIndividual = {
61
       state.registerIndividual = {
90
     removeAgency(state, id) {
88
     removeAgency(state, id) {
91
       state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
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
   getters: {},
95
   getters: {},
95
   actions: {
96
   actions: {
96
-    getIndividuals({
97
-      commit,
98
-    }) {
97
+    getIndividuals({ commit }) {
99
       axios
98
       axios
100
         .get('/api/individual')
99
         .get('/api/individual')
101
         .then(result => commit('setIndividuals', result.data))
100
         .then(result => commit('setIndividuals', result.data))
102
         .catch(console.error);
101
         .catch(console.error);
103
     },
102
     },
104
-    getAgents({
105
-      commit,
106
-    }) {
103
+    getAgents({ commit }) {
107
       axios
104
       axios
108
         .get('/api/agent')
105
         .get('/api/agent')
109
         .then(result => commit('setAgents', result.data))
106
         .then(result => commit('setAgents', result.data))
118
     //     .catch(console.error);
115
     //     .catch(console.error);
119
     // },
116
     // },
120
 
117
 
121
-    saveIndividual({
122
-      commit,
123
-    }, item) {
118
+    saveIndividual({ commit }, item) {
124
       axios
119
       axios
125
         .post('/api/register/register', item)
120
         .post('/api/register/register', item)
126
         .then(result => commit('addIndividual', result.data))
121
         .then(result => commit('addIndividual', result.data))
127
         .catch(console.error);
122
         .catch(console.error);
128
     },
123
     },
129
-    saveAgency({
130
-      commit,
131
-    }, item) {
124
+    saveAgency({ commit }, item) {
132
       axios
125
       axios
133
         .post('/api/register/registeragency', item)
126
         .post('/api/register/registeragency', item)
134
         .then(result => commit('addAgency', result.data))
127
         .then(result => commit('addAgency', result.data))
135
         .catch(console.error);
128
         .catch(console.error);
136
     },
129
     },
137
-    saveAgent({
138
-      commit,
139
-    }, item) {
130
+    saveAgent({ commit }, item) {
140
       axios
131
       axios
141
         .post('/api/agent', item)
132
         .post('/api/agent', item)
142
         .then(result => commit('addAgent', result.data))
133
         .then(result => commit('addAgent', result.data))
168
     // }) {
159
     // }) {
169
     //   commit('clearAgency');
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
     // deleteAgency({
174
     // deleteAgency({
180
     //   commit,
175
     //   commit,
181
     // }, id) {
176
     // }, id) {

Ładowanie…
Anuluj
Zapisz