Pārlūkot izejas kodu

Roles Update Part 1

master
30117125 4 gadus atpakaļ
vecāks
revīzija
273dbdd6f4

+ 44
- 21
src/components/admin/property/propertyList.vue Parādīt failu

2
   <section id="contact2">
2
   <section id="contact2">
3
     <div class="container">
3
     <div class="container">
4
       <div class="section-header">
4
       <div class="section-header">
5
-        <h1>Property Admin</h1>
5
+        <h2>Property Admin</h2>
6
+      </div>
7
+      <div v-if="ROLE === 'Agency'">
8
+        <h6>{{ curAgency }}</h6>
9
+      </div>
10
+      <div v-if="ROLE === 'Agent'">
11
+        <h6>{{ agent[0].name + " " + agent[0].surname }}</h6>
6
       </div>
12
       </div>
7
       <div class="row">
13
       <div class="row">
8
         <div class="col-lg-6 offset-3">
14
         <div class="col-lg-6 offset-3">
93
           <div class="d-flex justify-content-between" v-if="showPager">
99
           <div class="d-flex justify-content-between" v-if="showPager">
94
             <div class="p-1">
100
             <div class="p-1">
95
               {{
101
               {{
96
-              currentPage +
97
-              " / " +
98
-              PageCount +
99
-              (" - (" + FilteredProperties.length + " items)")
102
+                currentPage + " / " + PageCount + (" - (" + FilteredProperties.length + " items)")
100
               }}
103
               }}
101
             </div>
104
             </div>
102
             <div class="p-1">
105
             <div class="p-1">
125
           <div class="p-2">
128
           <div class="p-2">
126
             <div class="d-flex flex-row">
129
             <div class="d-flex flex-row">
127
               <div>
130
               <div>
128
-                <button v-if="sortKey !== 'id'" class="btn-solid-blue" @click="ClearSort">Clear Sort</button>
131
+                <button v-if="sortKey !== 'id'" class="btn-solid-blue" @click="ClearSort">
132
+                  Clear Sort
133
+                </button>
129
               </div>
134
               </div>
130
             </div>
135
             </div>
131
           </div>
136
           </div>
145
 
150
 
146
 export default {
151
 export default {
147
   components: {
152
   components: {
148
-    BasePagination,
153
+    BasePagination
149
   },
154
   },
150
   data() {
155
   data() {
151
     return {
156
     return {
171
         "Suburb",
176
         "Suburb",
172
         "Status",
177
         "Status",
173
         "Type",
178
         "Type",
174
-        "Publish",
179
+        "Publish"
175
       ],
180
       ],
176
       columns: [
181
       columns: [
177
         "owner",
182
         "owner",
185
         "suburb",
190
         "suburb",
186
         "status",
191
         "status",
187
         "type",
192
         "type",
188
-        "isPublished",
189
-      ],
193
+        "isPublished"
194
+      ]
190
     };
195
     };
191
   },
196
   },
192
   methods: {
197
   methods: {
194
       "getAdminProperties",
199
       "getAdminProperties",
195
       "deleteProperty",
200
       "deleteProperty",
196
       "publishProperty",
201
       "publishProperty",
197
-      "unpublishProperty",
202
+      "unpublishProperty"
198
     ]),
203
     ]),
204
+    ...mapActions("register", ["getAgentById"]),
205
+    ...mapActions("timeshare", ["getAgencies"]),
199
     Publish(item) {
206
     Publish(item) {
200
       this.publishProperty(item);
207
       this.publishProperty(item);
201
     },
208
     },
227
     ClearSort() {
234
     ClearSort() {
228
       this.reverse = true;
235
       this.reverse = true;
229
       this.sortKey = "id";
236
       this.sortKey = "id";
230
-    },
237
+    }
231
   },
238
   },
232
   computed: {
239
   computed: {
233
     ...mapState("propertyList", ["properties"]),
240
     ...mapState("propertyList", ["properties"]),
241
+    ...mapState("register", ["agent"]),
242
+    ...mapState("timeshare", ["agencies"]),
234
     FilteredProperties() {
243
     FilteredProperties() {
235
       if (this.filter) {
244
       if (this.filter) {
236
-        const list = _.filter(this.properties, (item) =>
245
+        const list = _.filter(this.properties, item =>
237
           Object.values(item).some(
246
           Object.values(item).some(
238
-            (i) =>
247
+            i =>
239
               JSON.stringify(i)
248
               JSON.stringify(i)
240
                 .toLowerCase()
249
                 .toLowerCase()
241
                 .indexOf(this.filter.toLowerCase()) > -1
250
                 .indexOf(this.filter.toLowerCase()) > -1
248
     },
257
     },
249
     PageCount() {
258
     PageCount() {
250
       return this.visibleItemsPerPageCount !== 0
259
       return this.visibleItemsPerPageCount !== 0
251
-        ? Math.ceil(
252
-            this.FilteredProperties.length / this.visibleItemsPerPageCount
253
-          )
260
+        ? Math.ceil(this.FilteredProperties.length / this.visibleItemsPerPageCount)
254
         : 1;
261
         : 1;
255
     },
262
     },
263
+    curAgency() {
264
+      var selAgency = "";
265
+      this.agencies.forEach(agency => {
266
+        if (this.agent[0].agencyId === agency.id) {
267
+          selAgency = agency.agencyName;
268
+        }
269
+      });
270
+      return selAgency;
271
+    },
256
     DisplayItems() {
272
     DisplayItems() {
257
       const list = this.FilteredProperties;
273
       const list = this.FilteredProperties;
258
       const startSlice = (this.currentPage - 1) * this.visibleItemsPerPageCount;
274
       const startSlice = (this.currentPage - 1) * this.visibleItemsPerPageCount;
265
     SortDirection() {
281
     SortDirection() {
266
       return this.reverse ? "desc" : "asc";
282
       return this.reverse ? "desc" : "asc";
267
     },
283
     },
284
+    ROLE() {
285
+      return Log.getUser().role;
286
+    }
287
+  },
288
+  created() {
289
+    this.getAgentById(Log.getUser().id);
290
+    this.getAgencies();
268
   },
291
   },
269
   mounted() {
292
   mounted() {
270
     this.wait = true;
293
     this.wait = true;
271
-    this.getAdminProperties(this.userId).then((fulfuilled) => {
294
+    this.getAdminProperties(this.userId).then(fulfuilled => {
272
       this.wait = false;
295
       this.wait = false;
273
       if (this.itemsPerPageList && this.itemsPerPageList.length > 0) {
296
       if (this.itemsPerPageList && this.itemsPerPageList.length > 0) {
274
         const [startItem] = this.itemsPerPageList;
297
         const [startItem] = this.itemsPerPageList;
283
         if (val != oldVal) {
306
         if (val != oldVal) {
284
           this.currentPage = 1;
307
           this.currentPage = 1;
285
         }
308
         }
286
-      },
287
-    },
288
-  },
309
+      }
310
+    }
311
+  }
289
 };
312
 };
290
 </script>
313
 </script>
291
 
314
 

+ 54
- 45
src/components/admin/status/agentsUserManagementPage.vue Parādīt failu

1
 <template>
1
 <template>
2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
-  <div class="container">
4
-    <br />
5
-    <br />
6
-    <div class="row">
7
-      <div class="col-md-12 col-lg-8">
8
-        <div class="title-box-d">
9
-          <h1 class="title-d" style="text-align:left; font-size: 250%">Agent Management</h1>
3
+  <main id="main">
4
+    <div class="container">
5
+      <div class="row">
6
+        <div class="col-md-12 col-lg-8">
7
+          <div class="section-header">
8
+            <h2>Agent Management</h2>
9
+          </div>
10
         </div>
10
         </div>
11
       </div>
11
       </div>
12
-    </div>
13
-    <div class="row">
14
-      <div class="col-md-2 offset-1">
15
-        <button @click="routerGoTo('/status/userManagementPage')" type="button" class="btn btn-b-n">
16
-          Private Users
17
-        </button>
18
-      </div>
19
-      <div class="col-md-2 offset-2">
20
-        <button type="button" class="btn btn-b-n">Agents</button>
21
-      </div>
22
-      <div class="col-md-2 offset-2">
23
-        <button type="button" class="btn btn-b-n" data-toggle="modal" :data-target="'#myModal' + i">
24
-          New Agent
25
-        </button>
26
-        <div :id="'myModal' + i" class="modal fade" role="dialog">
27
-          <div class="modal-dialog modal-lg">
28
-            <div class="modal-content">
29
-              <div class="modal-header">
30
-                <button type="button" class="close" data-dismiss="modal">&times;</button>
12
+      <div class="row">
13
+        <div class="col-md-2 offset-1">
14
+          <button
15
+            @click="routerGoTo('/status/userManagementPage')"
16
+            type="button"
17
+            class="btn-solid-blue"
18
+          >
19
+            USERS
20
+          </button>
21
+        </div>
22
+        <div class="col-md-2 offset-2">
23
+          <button type="button" class="btn-solid-blue">AGENTS</button>
24
+        </div>
25
+        <div class="col-md-2 offset-2">
26
+          <button
27
+            type="button"
28
+            class="btn-solid-blue"
29
+            data-toggle="modal"
30
+            :data-target="'#myModal' + i"
31
+          >
32
+            NEW AGENT
33
+          </button>
34
+          <div :id="'myModal' + i" class="modal fade" role="dialog">
35
+            <div class="modal-dialog modal-lg">
36
+              <div class="modal-content">
37
+                <div class="modal-header">
38
+                  <button type="button" class="close" data-dismiss="modal">&times;</button>
39
+                </div>
40
+                <Agency name="Agency" :isAddAgent="false" :item="item" />
31
               </div>
41
               </div>
32
-              <Agency name="Agency" :isAddAgent="false" :item="item" />
33
             </div>
42
             </div>
34
           </div>
43
           </div>
35
         </div>
44
         </div>
36
       </div>
45
       </div>
46
+      <div class="container">
47
+        <ListView
48
+          :items="agents"
49
+          :showNew="false"
50
+          :editable="true"
51
+          :deleteable="true"
52
+          :showCustomAction="true"
53
+          :showColumnChooser="false"
54
+          :CustomActionHeading="'Reset Password'"
55
+          :displayColumns="columns"
56
+          :displayHeaders="headers"
57
+          @onEdit="Edit"
58
+          @onDelete="Delete"
59
+          @onResetPassword="PasswordReset"
60
+        />
61
+      </div>
37
     </div>
62
     </div>
38
-    <div class="container">
39
-      <ListView
40
-        :items="agents"
41
-        :showNew="false"
42
-        :editable="true"
43
-        :deleteable="true"
44
-        :showCustomAction="true"
45
-        :showColumnChooser="false"
46
-        :CustomActionHeading="'Reset Password'"
47
-        :displayColumns="columns"
48
-        :displayHeaders="headers"
49
-        @onEdit="Edit"
50
-        @onDelete="Delete"
51
-        @onResetPassword="PasswordReset"
52
-      />
53
-    </div>
54
-    <br />
55
-  </div>
63
+  </main>
56
 </template>
64
 </template>
57
 
65
 
58
 <script>
66
 <script>
67
+/* eslint-disable */
59
 import { mapState, mapActions } from "vuex";
68
 import { mapState, mapActions } from "vuex";
60
 import axios from "axios";
69
 import axios from "axios";
61
 import Agency from "../../user/registerAgencySection.vue";
70
 import Agency from "../../user/registerAgencySection.vue";

+ 8
- 9
src/components/admin/status/userManagementPage.vue Parādīt failu

13
       </div>
13
       </div>
14
       <div class="row">
14
       <div class="row">
15
         <div class="col-md-2 offset-1">
15
         <div class="col-md-2 offset-1">
16
-          <button type="button" class="btn btn-b-n">Private Users</button>
16
+          <button type="button" class="btn-solid-blue">USERS</button>
17
         </div>
17
         </div>
18
         <div class="col-md-2 offset-2">
18
         <div class="col-md-2 offset-2">
19
           <button
19
           <button
20
             @click="routerGoTo('/status/agentUserManagementPage')"
20
             @click="routerGoTo('/status/agentUserManagementPage')"
21
             type="button"
21
             type="button"
22
-            class="btn btn-b-n"
22
+            class="btn-solid-blue"
23
           >
23
           >
24
-            Agents
24
+            AGENTS
25
           </button>
25
           </button>
26
         </div>
26
         </div>
27
       </div>
27
       </div>
47
 </template>
47
 </template>
48
 
48
 
49
 <script>
49
 <script>
50
-import { mapState, mapActions } from "vuex";
50
+import { mapState, mapActions, mapGetters } from "vuex";
51
 // import alert from '../../shared/alert.vue';
51
 // import alert from '../../shared/alert.vue';
52
 import ListView from "../../shared/listView.vue";
52
 import ListView from "../../shared/listView.vue";
53
 
53
 
67
   props: {},
67
   props: {},
68
   methods: {
68
   methods: {
69
     ...mapActions("register", ["getIndividuals", "deleteIndividual"]),
69
     ...mapActions("register", ["getIndividuals", "deleteIndividual"]),
70
+    ...mapActions("role", ["retrieveRoles"]),
70
     routerGoTo(goTo) {
71
     routerGoTo(goTo) {
71
       this.$router.push(goTo);
72
       this.$router.push(goTo);
72
     },
73
     },
73
     Edit(item) {
74
     Edit(item) {
74
-      this.$router.push({
75
-        path: "/user/updateProfileInfo",
76
-        query: { id: item.id }
77
-      });
75
+      this.$router.push({ name: "UpdateInfo", params: { indivParam: item } });
78
     },
76
     },
79
     Delete(item) {
77
     Delete(item) {
80
       this.deleteIndividual(item.id);
78
       this.deleteIndividual(item.id);
84
     this.getIndividuals();
82
     this.getIndividuals();
85
   },
83
   },
86
   computed: {
84
   computed: {
87
-    ...mapState("register", ["individuals", "removeIndividual"])
85
+    ...mapState("register", ["individuals", "removeIndividual"]),
86
+    ...mapGetters("role", ["getRoles"])
88
   }
87
   }
89
 };
88
 };
90
 </script>
89
 </script>

+ 1
- 0
src/components/property/ListProperty/listPropertyPage.vue Parādīt failu

15
   components: {
15
   components: {
16
     contentSection
16
     contentSection
17
   },
17
   },
18
+
18
   created() {
19
   created() {
19
     if (!Log.getPerson().name) {
20
     if (!Log.getPerson().name) {
20
       this.$router.push({
21
       this.$router.push({

+ 6
- 1
src/components/property/commercial/createProperty/commercialCreateNew.vue Parādīt failu

445
       //     item.value = "no";
445
       //     item.value = "no";
446
       //   }
446
       //   }
447
       // });
447
       // });
448
-
448
+      if (Log.getUser().role === "Agency" || Log.getUser().role === "Agent") {
449
+        this.retrieveAgency().then(() => {
450
+          this.property.agentId = this.agent[0].id;
451
+          this.property.agencyId = this.agent[0].agencyId;
452
+        });
453
+      }
449
       console.log(this.property);
454
       console.log(this.property);
450
 
455
 
451
       this.saveProperty(this.property)
456
       this.saveProperty(this.property)

+ 12
- 1
src/components/property/residential/createProperty/residentialCreateNew.vue Parādīt failu

369
       "getPropertySavedFields",
369
       "getPropertySavedFields",
370
       "getSavedPropertyData"
370
       "getSavedPropertyData"
371
     ]),
371
     ]),
372
+    ...mapActions("register", ["getAgentById"]),
372
     updateLocation(place) {
373
     updateLocation(place) {
373
       this.addressSet = true;
374
       this.addressSet = true;
374
       this.property.streetNumber = place.streetNumber;
375
       this.property.streetNumber = place.streetNumber;
428
       //     item.value = "no";
429
       //     item.value = "no";
429
       //   }
430
       //   }
430
       // });
431
       // });
431
-
432
+      if (Log.getUser().role === "Agency" || Log.getUser().role === "Agent") {
433
+        this.retrieveAgency().then(() => {
434
+          this.property.agentId = this.agent[0].id;
435
+          this.property.agencyId = this.agent[0].agencyId;
436
+        });
437
+      }
438
+      //console.log(this.property);
432
       this.saveProperty(this.property)
439
       this.saveProperty(this.property)
433
         .then(fulfilled => {
440
         .then(fulfilled => {
434
           this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
441
           this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
437
           console.log(error.message);
444
           console.log(error.message);
438
         });
445
         });
439
     },
446
     },
447
+    async retrieveAgency() {
448
+      await this.getAgentById(Log.getUser().id);
449
+    },
440
     Close() {
450
     Close() {
441
       this.$router.push("/property/admin/list/my");
451
       this.$router.push("/property/admin/list/my");
442
     },
452
     },
528
     ]),
538
     ]),
529
     ...mapState("authentication", ["user"]),
539
     ...mapState("authentication", ["user"]),
530
     ...mapGetters("fees", ["getListingFee"]),
540
     ...mapGetters("fees", ["getListingFee"]),
541
+    ...mapState("register", ["agent"]),
531
     sortFields() {
542
     sortFields() {
532
       return this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
543
       return this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
533
     },
544
     },

+ 35
- 56
src/components/shared/navBar.vue Parādīt failu

148
                     <a href="#" class="sf-with-ul">Property Management</a>
148
                     <a href="#" class="sf-with-ul">Property Management</a>
149
                     <ul style="margin-top:-10px; text-align:left" :class="propManClass">
149
                     <ul style="margin-top:-10px; text-align:left" :class="propManClass">
150
                       <li>
150
                       <li>
151
-                        <router-link to="/propertyManagement">Sectional Title and HOA Management</router-link>
151
+                        <router-link to="/propertyManagement"
152
+                          >Sectional Title and HOA Management</router-link
153
+                        >
152
                       </li>
154
                       </li>
153
                       <li>
155
                       <li>
154
-                        <router-link
155
-                          to="/rentalPropertyManagement"
156
-                        >Rental Property Portfolio Management</router-link>
156
+                        <router-link to="/rentalPropertyManagement"
157
+                          >Rental Property Portfolio Management</router-link
158
+                        >
157
                       </li>
159
                       </li>
158
                     </ul>
160
                     </ul>
159
                   </li>
161
                   </li>
198
                         <router-link to="/status/timeshareAdmin">Timeshare Week Admin</router-link>
200
                         <router-link to="/status/timeshareAdmin">Timeshare Week Admin</router-link>
199
                       </li>
201
                       </li>
200
                       <li v-if="ROLE === 'Super Admin'">
202
                       <li v-if="ROLE === 'Super Admin'">
201
-                        <router-link to="/status/tenderWeekAdmin">Tender Week Management</router-link>
202
-                      </li>
203
-                      <!-- <li v-if="ROLE === 'Super Admin'">
204
-                        <router-link to="/unitConfiguration/list">Unit Configuration</router-link>
205
-                      </li>-->
206
-                      <!-- <li v-if="ROLE === 'Super Admin'">
207
-                        <router-link to="/communication/template">Templates</router-link>
208
-                      </li>-->
209
-                      <!-- <hr />
210
-                      <li v-if="ROLE === 'Super Admin'">
211
-                        <router-link to="/status/userManagementPage"
212
-                          >User Management & Access</router-link
203
+                        <router-link to="/status/tenderWeekAdmin"
204
+                          >Tender Week Management</router-link
213
                         >
205
                         >
214
-                      </li>-->
215
-                      <!-- <li v-if="ROLE === 'Super Admin'">
216
-                        <router-link to="/status/changeLogPage">Changes Logs</router-link>
217
-                      </li>
218
-                      <li v-if="ROLE === 'Super Admin'">
219
-                        <router-link to="/userDefinedGroups/list"
220
-                          >Property User Defined Groups</router-link
221
-                        >
222
-                      </li>
223
-                      <li v-if="ROLE === 'Super Admin'">
224
-                        <router-link to="/propertyTypes/list">Property Types</router-link>
225
                       </li>
206
                       </li>
226
-                      <hr />
227
-                      <li v-if="ROLE === 'Super Admin'">
228
-                        <router-link to="/searchLog">Search Logs</router-link>
207
+                      <li>
208
+                        <router-link to="/PropertyAdmin">Property Admin</router-link>
229
                       </li>
209
                       </li>
230
-                      <li v-if="ROLE === 'Super Admin'">
231
-                        <hr />
232
-                      </li>-->
233
                       <hr v-if="ROLE === 'Super Admin'" />
210
                       <hr v-if="ROLE === 'Super Admin'" />
234
                       <li v-if="ROLE === 'Super Admin'" class="menu-has-children">
211
                       <li v-if="ROLE === 'Super Admin'" class="menu-has-children">
235
                         <div
212
                         <div
245
                             <router-link to="/status/list">Status</router-link>
222
                             <router-link to="/status/list">Status</router-link>
246
                           </li>
223
                           </li>
247
                           <li>
224
                           <li>
248
-                            <router-link to="/unitConfiguration/list">Unit Configuration</router-link>
225
+                            <router-link to="/unitConfiguration/list"
226
+                              >Unit Configuration</router-link
227
+                            >
249
                           </li>
228
                           </li>
250
                           <li>
229
                           <li>
251
                             <router-link to="/communication/template">Templates</router-link>
230
                             <router-link to="/communication/template">Templates</router-link>
252
                           </li>
231
                           </li>
253
                           <li>
232
                           <li>
254
-                            <router-link to="/status/userManagementPage">User Management & Access</router-link>
255
-                          </li>
256
-                          <li>
257
-                            <router-link to="/userDefinedGroups/list">Property User Defined Groups</router-link>
233
+                            <router-link to="/status/userManagementPage"
234
+                              >User Management & Access</router-link
235
+                            >
258
                           </li>
236
                           </li>
259
                           <li>
237
                           <li>
260
-                            <router-link to="/PropertyAdmin">Property Admin</router-link>
238
+                            <router-link to="/userDefinedGroups/list"
239
+                              >Property User Defined Groups</router-link
240
+                            >
261
                           </li>
241
                           </li>
262
                           <li>
242
                           <li>
263
                             <router-link to="/propertyTypes/list">Property Types</router-link>
243
                             <router-link to="/propertyTypes/list">Property Types</router-link>
266
                             <router-link to="/fees">Fees</router-link>
246
                             <router-link to="/fees">Fees</router-link>
267
                           </li>
247
                           </li>
268
                           <li>
248
                           <li>
269
-                            <router-link to="/termsConditions">Edit Terms and Conditions</router-link>
270
-                          </li>
271
-                          <li>
272
-                            <router-link to="/UserRoles">User Roles</router-link>
249
+                            <router-link to="/termsConditions"
250
+                              >Edit Terms and Conditions</router-link
251
+                            >
273
                           </li>
252
                           </li>
274
                         </ul>
253
                         </ul>
275
                       </li>
254
                       </li>
284
                           :class="submenu1Class"
263
                           :class="submenu1Class"
285
                         >
264
                         >
286
                           <li>
265
                           <li>
287
-                            <router-link to="/status/changeLogPage">Changes Logs</router-link>
266
+                            <router-link to="/status/changeLogPage">Change Logs</router-link>
288
                           </li>
267
                           </li>
289
                           <li>
268
                           <li>
290
                             <router-link to="/searchLog">Search Logs</router-link>
269
                             <router-link to="/searchLog">Search Logs</router-link>
291
                           </li>
270
                           </li>
292
                         </ul>
271
                         </ul>
293
                       </li>
272
                       </li>
294
-                      <hr v-if="ROLE === 'Super Admin'" />
273
+                      <hr />
295
                       <li>
274
                       <li>
296
                         <router-link to="/Offers">Offers</router-link>
275
                         <router-link to="/Offers">Offers</router-link>
297
                       </li>
276
                       </li>
298
                       <!-- <li v-if="ROLE === 'Super Admin'">
277
                       <!-- <li v-if="ROLE === 'Super Admin'">
299
                         <router-link to="/Carousel">Carousel</router-link>
278
                         <router-link to="/Carousel">Carousel</router-link>
300
                       </li>-->
279
                       </li>-->
301
-                      <li v-if="ROLE === 'Super Admin'">
280
+                      <li>
302
                         <router-link to="/user/updateProfileInfo">Update Info</router-link>
281
                         <router-link to="/user/updateProfileInfo">Update Info</router-link>
303
                       </li>
282
                       </li>
304
                       <li v-if="ROLE === 'Super Admin'">
283
                       <li v-if="ROLE === 'Super Admin'">
308
                         <router-link to="/landingPages">Landing Pages / Campaignes</router-link>
287
                         <router-link to="/landingPages">Landing Pages / Campaignes</router-link>
309
                       </li>
288
                       </li>
310
                       <li>
289
                       <li>
311
-                        <router-link class="btn-white-border p-2" to="/user/login">Logout</router-link>
290
+                        <router-link class="btn-white-border p-2" to="/user/login"
291
+                          >Logout</router-link
292
+                        >
312
                       </li>
293
                       </li>
313
                     </ul>
294
                     </ul>
314
                   </li>
295
                   </li>
315
 
296
 
316
                   <li v-if="!USER">
297
                   <li v-if="!USER">
317
-                    <router-link class="btn-white-border p-2 ml-1 mr-1" to="/user/login">Login</router-link>
298
+                    <router-link class="btn-white-border p-2 ml-1 mr-1" to="/user/login"
299
+                      >Login</router-link
300
+                    >
318
                   </li>
301
                   </li>
319
 
302
 
320
                   <li v-if="!USER">
303
                   <li v-if="!USER">
321
-                    <router-link class="btn-solid-blue pt-2 pb-2" to="/user/register">Register</router-link>
304
+                    <router-link class="btn-solid-blue pt-2 pb-2" to="/user/register"
305
+                      >Register</router-link
306
+                    >
322
                   </li>
307
                   </li>
323
                   <!-- <li v-if="!isLoggedIn" class="menu-has-children">
308
                   <!-- <li v-if="!isLoggedIn" class="menu-has-children">
324
                     <div
309
                     <div
411
     this.retrieveListingFee();
396
     this.retrieveListingFee();
412
   },
397
   },
413
   computed: {
398
   computed: {
414
-    ...mapState("authentication", [
415
-      "user",
416
-      "flag",
417
-      "status",
418
-      "person",
419
-      "token"
420
-    ]),
399
+    ...mapState("authentication", ["user", "flag", "status", "person", "token"]),
421
     isLoggedIn() {
400
     isLoggedIn() {
422
       return Log.isLoggedIn();
401
       return Log.isLoggedIn();
423
     },
402
     },

+ 39
- 39
src/components/user/Roles/contentSection.vue Parādīt failu

1
 <template>
1
 <template>
2
-  <main id="main" style="margin-top:-20px; padding-bottom:50px">
3
-    <!-- eslint-disable max-len -->
4
-    <div class="container">
5
-      <br />
6
-      <br />
7
-      <div class="row">
8
-        <div class="col-md-12 col-lg-8">
9
-          <div class="section-header">
10
-            <h2>User Roles</h2>
11
-          </div>
12
-        </div>
13
-      </div>
2
+  <div>
3
+    <div v-if="wait" id="preloader"></div>
4
+    <main id="main" style="margin-top:-20px; padding-bottom:50px">
5
+      <!-- eslint-disable max-len -->
14
       <div class="container">
6
       <div class="container">
15
-        <ListView
16
-          :items="individuals"
17
-          :showNew="false"
18
-          :editable="true"
19
-          :showCustomAction="true"
20
-          :showColumnChooser="false"
21
-          :displayColumns="columns"
22
-          :displayHeaders="headers"
23
-          @onEdit="Edit"
24
-        />
25
         <br />
7
         <br />
8
+        <br />
9
+        <div class="row">
10
+          <div class="col-md-12 col-lg-8">
11
+            <div class="section-header">
12
+              <h2>User Roles</h2>
13
+            </div>
14
+          </div>
15
+        </div>
16
+        <div class="container">
17
+          <ListView
18
+            :items="individuals"
19
+            :showNew="false"
20
+            :editable="true"
21
+            :showCustomAction="true"
22
+            :showColumnChooser="false"
23
+            :displayColumns="columns"
24
+            :displayHeaders="headers"
25
+            @onEdit="Edit"
26
+          />
27
+          <br />
28
+        </div>
26
       </div>
29
       </div>
27
-    </div>
28
-  </main>
30
+    </main>
31
+  </div>
29
 </template>
32
 </template>
30
 
33
 
31
 <script>
34
 <script>
32
-import { mapState, mapActions } from "vuex";
33
-// import alert from '../../shared/alert.vue';
35
+/* eslint-disable */
36
+import { mapState, mapActions, mapGetters } from "vuex";
34
 import ListView from "../../shared/listView.vue";
37
 import ListView from "../../shared/listView.vue";
35
 
38
 
36
 export default {
39
 export default {
41
   },
44
   },
42
   data() {
45
   data() {
43
     return {
46
     return {
44
-      columns: [
45
-        "id",
46
-        "name",
47
-        "surname",
48
-        "cellNumber",
49
-        "telephone",
50
-        "email",
51
-        "isDeleted",
52
-        "role"
53
-      ],
47
+      columns: ["id", "name", "surname", "cellNumber", "telephone", "email", "isDeleted", "role"],
54
       headers: ["", "", "", "", "", "", "", ""],
48
       headers: ["", "", "", "", "", "", "", ""],
55
-      item: {}
49
+      item: {},
50
+      wait: true
56
     };
51
     };
57
   },
52
   },
58
   props: {},
53
   props: {},
54
+  created() {
55
+    this.retrieveUserRoles().then(() => {
56
+      this.wait = false;
57
+    });
58
+  },
59
   methods: {
59
   methods: {
60
-    ...mapActions("register", ["getIndividuals", "deleteIndividual"]),
60
+    ...mapActions("role", ["retrieveUserRoles"]),
61
     routerGoTo(goTo) {
61
     routerGoTo(goTo) {
62
       this.$router.push(goTo);
62
       this.$router.push(goTo);
63
     },
63
     },
75
     this.getIndividuals();
75
     this.getIndividuals();
76
   },
76
   },
77
   computed: {
77
   computed: {
78
-    ...mapState("register", ["individuals", "removeIndividual"])
78
+    ...mapGetters("role", ["getRoles"])
79
   }
79
   }
80
 };
80
 };
81
 </script>
81
 </script>

+ 444
- 12
src/components/user/updateProfileInfo.vue Parādīt failu

9
         </div>
9
         </div>
10
       </div>
10
       </div>
11
       <div class="row mb-4">
11
       <div class="row mb-4">
12
-        <div class="container col-md-10">
13
-          <form
14
-            id="mainForm"
15
-            method="POST"
16
-            action="/to-sell"
17
-            accept-charset="UTF-8"
18
-            enctype="multipart/form-data"
12
+        <div class="col">
13
+          <div class="section-header">
14
+            <h2>Detailed Individual Information</h2>
15
+          </div>
16
+        </div>
17
+      </div>
18
+      <!-- <DetailIndividual :currentUser="user" :showBank="true" :showAddress="true" /> -->
19
+      <div class="row mb-2">
20
+        <div class="form-group col-md-6">
21
+          <float-label>
22
+            <input
23
+              type="text"
24
+              name="name"
25
+              class="form-control uniInput"
26
+              id="name"
27
+              placeholder="Name"
28
+              data-rule="minlen:4"
29
+              data-msg="Please enter your name"
30
+              v-model="individual.name"
31
+            />
32
+          </float-label>
33
+
34
+          <div class="validation"></div>
35
+        </div>
36
+        <div class="form-group col-md-6">
37
+          <float-label>
38
+            <input
39
+              type="text"
40
+              class="form-control uniInput"
41
+              name="surname"
42
+              id="surname"
43
+              placeholder="Surname"
44
+              data-msg="Please enter your surname"
45
+              v-model="individual.surname"
46
+            />
47
+          </float-label>
48
+
49
+          <div class="validation"></div>
50
+        </div>
51
+      </div>
52
+      <div class="row mb-2">
53
+        <div class="form-group col-md-6">
54
+          <float-label>
55
+            <input
56
+              type="text"
57
+              name="idnum"
58
+              class="form-control uniInput"
59
+              id="idnum"
60
+              placeholder="ID Number"
61
+              data-rule="minlen:4"
62
+              data-msg="Please enter your ID number"
63
+              v-model="individual.idNumber"
64
+            />
65
+          </float-label>
66
+
67
+          <div class="validation"></div>
68
+        </div>
69
+        <div class="form-group col-md-6">
70
+          <float-label>
71
+            <input
72
+              type="text"
73
+              class="form-control uniInput"
74
+              name="company"
75
+              id="company"
76
+              placeholder="Company Reg Number"
77
+              data-rule="minlen:4"
78
+              data-msg="Please enter your company reg number"
79
+              v-model="individual.companyRegNumber"
80
+            />
81
+          </float-label>
82
+
83
+          <div class="validation"></div>
84
+        </div>
85
+      </div>
86
+      <div class="row mb-2">
87
+        <div class="form-group col-md-6">
88
+          <div class="input-group">
89
+            <span v-if="!individual.howMarried">
90
+              <label v-if="!individual.howMarried" for="howMarried" class="uniSelectLabel"
91
+                >Marital Status</label
92
+              >
93
+            </span>
94
+
95
+            <float-label label="Marital Status" style="width:100%">
96
+              <select
97
+                class="form-control uniSelect"
98
+                id="howMarried"
99
+                v-model="individual.howMarried"
100
+              >
101
+                <option value="N/A">N/A</option>
102
+                <option value="In Community Of Property">In Community Of Property</option>
103
+                <option value="Out of Community Of Property">Out of Community Of Property</option>
104
+                <option value="Other">Other</option>
105
+                <option value="Traditional Wedding">Traditional Wedding</option>
106
+                <option value="Single">Single</option>
107
+                <option value="Divorced">Divorced</option>
108
+                <option value="Widow">Widow</option>
109
+                <option value="Committed Relationship">Committed Relationship</option>
110
+                <option value="Partner">Partner</option>
111
+              </select>
112
+            </float-label>
113
+          </div>
114
+          <div class="validation"></div>
115
+        </div>
116
+        <div class="form-group col-md-6">
117
+          <float-label>
118
+            <input
119
+              type="text"
120
+              class="form-control uniInput"
121
+              name="email"
122
+              id="email"
123
+              placeholder="EMAIL ADDRESS"
124
+              data-msg="Please enter your email address"
125
+              v-model="individual.emailAddress"
126
+            />
127
+          </float-label>
128
+
129
+          <div class="validation"></div>
130
+        </div>
131
+      </div>
132
+      <div class="row">
133
+        <div class="form-group col-md-6">
134
+          <float-label>
135
+            <input
136
+              type="text"
137
+              name="cell"
138
+              class="form-control uniInput"
139
+              id="cell"
140
+              placeholder="CELL NUMBER"
141
+              data-rule="minlen:4"
142
+              data-msg="Please enter your cell number"
143
+              v-model="individual.cellNumner"
144
+            />
145
+          </float-label>
146
+
147
+          <div class="validation"></div>
148
+        </div>
149
+        <div class="form-group col-md-6">
150
+          <float-label>
151
+            <input
152
+              type="text"
153
+              class="form-control uniInput"
154
+              name="landline"
155
+              id="landline"
156
+              placeholder="LANDLINE NUMBER"
157
+              data-msg="Please enter your landline number"
158
+              v-model="individual.landlineNumber"
159
+            />
160
+          </float-label>
161
+
162
+          <div class="validation"></div>
163
+        </div>
164
+      </div>
165
+
166
+      <div v-if="individual.howMarried === 'In Community Of Property'" class="section-header">
167
+        <h2>Spouse Details</h2>
168
+      </div>
169
+      <div v-if="individual.howMarried === 'In Community Of Property'" class="form">
170
+        <div class="form-row mb-2">
171
+          <div class="form-group col-md-6 mt-2">
172
+            <float-label>
173
+              <input
174
+                type="text"
175
+                class="form-control"
176
+                placeholder="SPOUSE NAME"
177
+                data-msg="Please enter your spouse's name"
178
+                v-model="individual.spouseName"
179
+              />
180
+            </float-label>
181
+
182
+            <div class="validation"></div>
183
+          </div>
184
+          <div class="form-group col-md-6 mt-2">
185
+            <float-label>
186
+              <input
187
+                type="text"
188
+                class="form-control"
189
+                placeholder="SPOUSE SURNAME"
190
+                data-msg="Please enter your spouse's surname"
191
+                v-model="individual.spouseSurname"
192
+              />
193
+            </float-label>
194
+
195
+            <div class="validation"></div>
196
+          </div>
197
+          <div class="form-group col-md-6 mt-2">
198
+            <float-label>
199
+              <input
200
+                type="text"
201
+                class="form-control"
202
+                placeholder="SPOUSE EMAIL"
203
+                data-rule="minlen:4"
204
+                data-msg="Please enter your spouse's email"
205
+                v-model="individual.spouseEmail"
206
+              />
207
+            </float-label>
208
+
209
+            <div class="validation"></div>
210
+          </div>
211
+          <div class="form-group col-md-6 mt-2">
212
+            <float-label>
213
+              <input
214
+                type="text"
215
+                class="form-control"
216
+                placeholder="SPOUSE TELEPHONE"
217
+                data-rule="minlen:4"
218
+                data-msg="Please enter your spouse's telephone number"
219
+                v-model="individual.spouseTelephone"
220
+              />
221
+            </float-label>
222
+
223
+            <div class="validation"></div>
224
+          </div>
225
+          <div class="form-group col-md-6 mt-2">
226
+            <float-label>
227
+              <input
228
+                type="text"
229
+                class="form-control"
230
+                placeholder="SPOUSE CELL NUMBER"
231
+                data-rule="minlen:4"
232
+                data-msg="Please enter your spouse's cellphone number"
233
+                v-model="individual.spouseCellnumber"
234
+              />
235
+            </float-label>
236
+
237
+            <div class="validation"></div>
238
+          </div>
239
+        </div>
240
+      </div>
241
+      <div class="row">
242
+        <div class="col">
243
+          <div class="section-header">
244
+            <h2>Address</h2>
245
+          </div>
246
+        </div>
247
+      </div>
248
+      <div class="row">
249
+        <div class="form-group col-md-12">
250
+          <addressAutoComplete @GoogleAddress="UpdateAddress" />
251
+        </div>
252
+      </div>
253
+      <div class="form-row">
254
+        <div class="form-group col-md-6">
255
+          <input
256
+            type="text"
257
+            name="street-nr"
258
+            class="form-control"
259
+            id="street-nr"
260
+            placeholder="Street Number"
261
+            data-rule="minlen:4"
262
+            data-msg="Please enter your street number"
263
+            v-model="individual.address.streetNumber"
264
+            disabled
265
+          />
266
+
267
+          <div class="validation"></div>
268
+        </div>
269
+        <div class="form-group col-md-6">
270
+          <input
271
+            type="text"
272
+            class="form-control"
273
+            name="street"
274
+            id="street"
275
+            placeholder="Street Name"
276
+            data-msg="Please enter your street name"
277
+            disabled
278
+            v-model="individual.address.street"
279
+          />
280
+          <div class="validation"></div>
281
+        </div>
282
+        <div class="form-group col-md-6">
283
+          <input
284
+            type="text"
285
+            name="province"
286
+            class="form-control"
287
+            id="province"
288
+            placeholder="Province"
289
+            data-rule="minlen:4"
290
+            data-msg="Please enter your province"
291
+            disabled
292
+            v-model="individual.address.province"
293
+          />
294
+          <div class="validation"></div>
295
+        </div>
296
+        <div class="form-group col-md-6">
297
+          <input
298
+            type="text"
299
+            class="form-control"
300
+            name="city"
301
+            id="city"
302
+            placeholder="City"
303
+            data-rule="minlen:4"
304
+            data-msg="Please enter your city"
305
+            v-model="individual.address.city"
306
+            disabled
307
+          />
308
+          <div class="validation"></div>
309
+        </div>
310
+        <div class="form-group col-md-6">
311
+          <input
312
+            type="text"
313
+            name="suburb"
314
+            class="form-control"
315
+            id="suburb"
316
+            placeholder="Suburb"
317
+            data-rule="minlen:4"
318
+            data-msg="Please enter your suburb"
319
+            v-model="individual.address.suburb"
320
+            disabled
321
+          />
322
+          <div class="validation"></div>
323
+        </div>
324
+        <div class="form-group col-md-6">
325
+          <input
326
+            type="text"
327
+            class="form-control"
328
+            name="postal"
329
+            id="postal"
330
+            placeholder="Postal Code"
331
+            data-msg="Please enter your postal code"
332
+            v-model="individual.address.postalCode"
333
+            disabled
334
+          />
335
+          <div class="validation"></div>
336
+        </div>
337
+      </div>
338
+      <div v-if="pullUserRole === 'Super Admin'">
339
+        <div class="row">
340
+          <div class="col">
341
+            <div class="section-header">
342
+              <h2>Access Control</h2>
343
+            </div>
344
+          </div>
345
+        </div>
346
+        <div class="row">
347
+          <div class="col-md-6">
348
+            <float-label label="User Role" style="width:100%">
349
+              <select class="form-control uniSelect" id="howMarried" v-model="individual.user.role">
350
+                <option v-for="role in getRoles" :key="role.id" :value="role.roleName">
351
+                  {{ role.roleName }}
352
+                </option>
353
+              </select>
354
+            </float-label>
355
+          </div>
356
+          <div class="col-md-6">
357
+            <input
358
+              class="mr-2 mt-3"
359
+              name="changePass"
360
+              type="checkbox"
361
+              v-model="individual.user.loginPasswordChange"
362
+            />
363
+            <label for="changePass">Change Password on Next Login</label>
364
+          </div>
365
+        </div>
366
+        <div
367
+          v-if="
368
+            individual.user.role.toUpperCase() === 'AGENCY' ||
369
+              individual.user.role.toUpperCase() === 'AGENT' ||
370
+              individual.user.role.toUpperCase() === 'MANAGING AGENT'
371
+          "
372
+          class="row mt-4"
373
+        >
374
+          <div class="col-md-6">
375
+            <float-label fixed label="AGENCY" style="width:100%">
376
+              <select class="form-control uniSelect" v-model="individual.agencyId">
377
+                <option value="">Private User</option>
378
+                <option v-for="(item, i) in agencies" :key="i" :value="item.id">{{
379
+                  item.agencyName
380
+                }}</option>
381
+              </select>
382
+            </float-label>
383
+          </div>
384
+        </div>
385
+      </div>
386
+      <div class="row mt-5">
387
+        <div class="col">
388
+          <button class="btn-solid-blue" @click="sendToApi()">UPDATE</button>
389
+        </div>
390
+        <div class="col">
391
+          <router-link
392
+            v-if="pullUserRole === 'Super Admin'"
393
+            class="btn-solid-blue"
394
+            to="/status/userManagementPage"
395
+            >CANCEL</router-link
19
           >
396
           >
20
-            <div class="col-md-12" style="text-align:left"></div>
21
-            <DetailIndividual :currentUser="user" :showBank="true" :showAddress="true" />
22
-            <br />
23
-          </form>
24
         </div>
397
         </div>
25
       </div>
398
       </div>
26
     </div>
399
     </div>
28
 </template>
401
 </template>
29
 
402
 
30
 <script>
403
 <script>
404
+/* eslint-disable */
31
 import { mapState, mapActions, mapGetters } from "vuex";
405
 import { mapState, mapActions, mapGetters } from "vuex";
32
 import DetailIndividual from "./timeshareIndividual.vue";
406
 import DetailIndividual from "./timeshareIndividual.vue";
407
+import addressAutoComplete from "../shared/addressAutoComplete";
408
+import Log from "../../assets/Log";
33
 
409
 
34
 export default {
410
 export default {
35
   name: "UpdateInfo",
411
   name: "UpdateInfo",
38
   },
414
   },
39
   props: {},
415
   props: {},
40
   components: {
416
   components: {
41
-    DetailIndividual
417
+    DetailIndividual,
418
+    addressAutoComplete
42
   },
419
   },
43
   mounted() {
420
   mounted() {
44
     this.selectedItem = this.currentUser;
421
     this.selectedItem = this.currentUser;
45
   },
422
   },
423
+  created() {
424
+    this.retrieveUserRoles();
425
+    this.getIndividual(Log.getUser().id).then(() => {
426
+      if (this.$route.params.indivParam) {
427
+        this.individual = this.$route.params.indivParam;
428
+
429
+        if (this.individual.address === null) {
430
+          this.individual.address = {};
431
+        }
432
+
433
+        if (this.individual.user.role === "Agent" || this.individual.user.role === "Agency") {
434
+          this.getAgentById(this.individual.userId);
435
+          this.individual.agencyId = this.agent[0].agencyId;
436
+        }
437
+      } else {
438
+        console.log(this.indiv);
439
+        this.individual = this.indiv;
440
+        this.individual.user = Log.getUser();
441
+      }
442
+      this.getAgencies();
443
+    });
444
+  },
46
   computed: {
445
   computed: {
47
     ...mapState("timeshare", [
446
     ...mapState("timeshare", [
48
       "resorts",
447
       "resorts",
59
     ]),
458
     ]),
60
     ...mapState("individual", ["indiv"]),
459
     ...mapState("individual", ["indiv"]),
61
     ...mapState("authentication", ["isLoggedIn", "user"]),
460
     ...mapState("authentication", ["isLoggedIn", "user"]),
461
+    ...mapState("register", ["agent"]),
62
     ...mapGetters({
462
     ...mapGetters({
63
       user: "authentication/getUser",
463
       user: "authentication/getUser",
64
       person: "authentication/getPerson"
464
       person: "authentication/getPerson"
65
     }),
465
     }),
466
+    ...mapGetters("role", ["getRoles"]),
66
     isLoggedIn() {
467
     isLoggedIn() {
67
       return this.user && this.person;
468
       return this.user && this.person;
469
+    },
470
+    pullUserRole() {
471
+      return Log.getUser().role;
68
     }
472
     }
69
   },
473
   },
70
   methods: {
474
   methods: {
71
     ...mapActions("individual", ["getIndividual", "updateIndividual"]),
475
     ...mapActions("individual", ["getIndividual", "updateIndividual"]),
476
+    ...mapActions("role", ["retrieveUserRoles"]),
477
+    ...mapActions("register", ["getAgentById", "saveAgent"]),
478
+    ...mapActions("timeshare", ["getAgencies"]),
72
     onSelectedItemItemChange(item) {
479
     onSelectedItemItemChange(item) {
73
       this.currentUser = item;
480
       this.currentUser = item;
481
+    },
482
+    UpdateAddress(address) {
483
+      this.individual.address.streetNumber = address.streetNumber;
484
+      this.individual.address.street = address.streetName;
485
+      this.individual.address.province = address.province;
486
+      this.individual.address.city = address.city;
487
+      this.individual.address.suburb = address.suburb;
488
+      this.individual.address.postalCode = address.postalCode;
489
+    },
490
+    sendToApi() {
491
+      if (
492
+        this.individual.user.role === "Agency" ||
493
+        this.individual.user.role === "Agent" ||
494
+        this.individual.user.role === "Managing Agent"
495
+      ) {
496
+        this.saveAgent(this.individual);
497
+      } else {
498
+        this.updateIndividual(this.individual).then(() => {
499
+          if (this.individual.user.role === "Super Admin") {
500
+            this.$router.push("/status/userManagementPage");
501
+          } else {
502
+            this.$router.push("/");
503
+          }
504
+        });
505
+      }
74
     }
506
     }
75
   }
507
   }
76
 };
508
 };

+ 3
- 0
src/router/index.js Parādīt failu

161
     {
161
     {
162
       path: "/user/updateProfileInfo",
162
       path: "/user/updateProfileInfo",
163
       name: "UpdateInfo",
163
       name: "UpdateInfo",
164
+      props: route => ({
165
+        ...route.params
166
+      }),
164
       component: UpdateInfo
167
       component: UpdateInfo
165
     },
168
     },
166
     {
169
     {

+ 3
- 1
src/store/index.js Parādīt failu

35
 import bank from "./modules/user/bank";
35
 import bank from "./modules/user/bank";
36
 import Fees from "./modules/financial/fees";
36
 import Fees from "./modules/financial/fees";
37
 import TermsConditions from "./modules/misc/termsConditions";
37
 import TermsConditions from "./modules/misc/termsConditions";
38
+import Roles from './modules/user/role'
38
 
39
 
39
 Vue.use(Vuex);
40
 Vue.use(Vuex);
40
 /* eslint no-param-reassign: ["error", { "props": false }] */
41
 /* eslint no-param-reassign: ["error", { "props": false }] */
72
     placeHolderFormat: PlaceHolderFormat,
73
     placeHolderFormat: PlaceHolderFormat,
73
     fees: Fees,
74
     fees: Fees,
74
     termsConditions: TermsConditions,
75
     termsConditions: TermsConditions,
75
-    bank: bank
76
+    bank: bank,
77
+    role: Roles
76
   }
78
   }
77
 });
79
 });

+ 5
- 5
src/store/modules/user/individual.js Parādīt failu

18
   },
18
   },
19
   getters: {},
19
   getters: {},
20
   actions: {
20
   actions: {
21
-    getIndividual({ commit, rootGetters }, userId) {
21
+    async getIndividual({ commit, rootGetters }, userId) {
22
       let id = 0;
22
       let id = 0;
23
       if (!userId || userId === 0) {
23
       if (!userId || userId === 0) {
24
         const rootItem = rootGetters["authentication/getUser"];
24
         const rootItem = rootGetters["authentication/getUser"];
29
         id = 0;
29
         id = 0;
30
       }
30
       }
31
 
31
 
32
-      axios
32
+
33
+      await axios
33
         .get(`/api/individual/getIndividual/${id}`)
34
         .get(`/api/individual/getIndividual/${id}`)
34
         .then(r => {
35
         .then(r => {
35
-          console.log(JSON.stringify(r));
36
           commit("setItem", {
36
           commit("setItem", {
37
             name: "indiv",
37
             name: "indiv",
38
             value: r.data
38
             value: r.data
51
         })
51
         })
52
         .catch(console.error);
52
         .catch(console.error);
53
     },
53
     },
54
-    updateIndividual({ commit }, item) {
55
-      axios
54
+    async updateIndividual({ commit }, item) {
55
+      await axios
56
         .put("/api/individual", item)
56
         .put("/api/individual", item)
57
         .then(result => commit("setItem", item))
57
         .then(result => commit("setItem", item))
58
         .catch(console.error);
58
         .catch(console.error);

+ 18
- 2
src/store/modules/user/register.js Parādīt failu

1
+/* eslint-disable */
1
 import axios from "axios";
2
 import axios from "axios";
2
 
3
 
3
 export default {
4
 export default {
5
   state: {
6
   state: {
6
     individuals: [],
7
     individuals: [],
7
     agents: [],
8
     agents: [],
9
+    agent: {},
8
     registerIndividual: {
10
     registerIndividual: {
9
       name: "",
11
       name: "",
10
       surname: "",
12
       surname: "",
39
     setAgents(state, type) {
41
     setAgents(state, type) {
40
       state.agents = type;
42
       state.agents = type;
41
     },
43
     },
44
+    setSingleAgent(state, agent){
45
+      state.agent = agent
46
+    },
42
     setAgency(state, type) {
47
     setAgency(state, type) {
43
       state.registerAgency = type;
48
       state.registerAgency = type;
44
     },
49
     },
109
         .then(result => commit("setAgents", result.data))
114
         .then(result => commit("setAgents", result.data))
110
         .catch(console.error);
115
         .catch(console.error);
111
     },
116
     },
117
+    async getAgentById({commit}, userId){
118
+      await axios
119
+        .get('/api/agent/single/' +  userId)
120
+        .then((result) => {
121
+          console.log(result);
122
+          commit("setSingleAgent", result.data)
123
+        })
124
+        .catch((e) => {
125
+          console.log(e);
126
+        })
127
+    },
112
     // getAgency({
128
     // getAgency({
113
     //   commit,
129
     //   commit,
114
     // }, id) {
130
     // }, id) {
136
     },
152
     },
137
     saveAgent({ commit }, item) {
153
     saveAgent({ commit }, item) {
138
       axios
154
       axios
139
-        .post("/api/agent", item)
155
+        .post("/api/agent/AgentFromUser", item)
140
         .then(result => commit("addAgent", result.data))
156
         .then(result => commit("addAgent", result.data))
141
         .catch(console.error);
157
         .catch(console.error);
142
     },
158
     },
143
     async updateIndividual({ commit }, userParam) {
159
     async updateIndividual({ commit }, userParam) {
144
       await axios
160
       await axios
145
-        .put("/api/user", userParam)
161
+        .put("/api/user/", userParam)
146
         .then(result => console.log(result))
162
         .then(result => console.log(result))
147
         .catch(console.error);
163
         .catch(console.error);
148
     },
164
     },

+ 26
- 0
src/store/modules/user/role.js Parādīt failu

1
+/* eslint-disable */
2
+import axios from 'axios';
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    roles: [],
8
+  },
9
+  mutations: {
10
+    getRoles(state, roles) {
11
+      state.roles = roles;
12
+    },
13
+  },
14
+  getters: {
15
+    getRoles: (state) => state.roles
16
+  },
17
+  actions: {
18
+    async retrieveUserRoles({commit}){
19
+        await axios.get('/api/userRole')
20
+        .then((result) => {
21
+            commit('getRoles', result.data)
22
+        })
23
+        .catch((e) => console.log(e))
24
+    }
25
+  },
26
+};

Notiek ielāde…
Atcelt
Saglabāt