ソースを参照

Roles Update Part 1

master
30117125 4年前
コミット
273dbdd6f4

+ 44
- 21
src/components/admin/property/propertyList.vue ファイルの表示

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

+ 54
- 45
src/components/admin/status/agentsUserManagementPage.vue ファイルの表示

@@ -1,61 +1,70 @@
1 1
 <template>
2 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 10
         </div>
11 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 41
               </div>
32
-              <Agency name="Agency" :isAddAgent="false" :item="item" />
33 42
             </div>
34 43
           </div>
35 44
         </div>
36 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 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 64
 </template>
57 65
 
58 66
 <script>
67
+/* eslint-disable */
59 68
 import { mapState, mapActions } from "vuex";
60 69
 import axios from "axios";
61 70
 import Agency from "../../user/registerAgencySection.vue";

+ 8
- 9
src/components/admin/status/userManagementPage.vue ファイルの表示

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

+ 1
- 0
src/components/property/ListProperty/listPropertyPage.vue ファイルの表示

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

+ 6
- 1
src/components/property/commercial/createProperty/commercialCreateNew.vue ファイルの表示

@@ -445,7 +445,12 @@ export default {
445 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 454
       console.log(this.property);
450 455
 
451 456
       this.saveProperty(this.property)

+ 12
- 1
src/components/property/residential/createProperty/residentialCreateNew.vue ファイルの表示

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

+ 35
- 56
src/components/shared/navBar.vue ファイルの表示

@@ -148,12 +148,14 @@
148 148
                     <a href="#" class="sf-with-ul">Property Management</a>
149 149
                     <ul style="margin-top:-10px; text-align:left" :class="propManClass">
150 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 154
                       </li>
153 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 159
                       </li>
158 160
                     </ul>
159 161
                   </li>
@@ -198,38 +200,13 @@
198 200
                         <router-link to="/status/timeshareAdmin">Timeshare Week Admin</router-link>
199 201
                       </li>
200 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 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 209
                       </li>
230
-                      <li v-if="ROLE === 'Super Admin'">
231
-                        <hr />
232
-                      </li>-->
233 210
                       <hr v-if="ROLE === 'Super Admin'" />
234 211
                       <li v-if="ROLE === 'Super Admin'" class="menu-has-children">
235 212
                         <div
@@ -245,19 +222,22 @@
245 222
                             <router-link to="/status/list">Status</router-link>
246 223
                           </li>
247 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 228
                           </li>
250 229
                           <li>
251 230
                             <router-link to="/communication/template">Templates</router-link>
252 231
                           </li>
253 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 236
                           </li>
259 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 241
                           </li>
262 242
                           <li>
263 243
                             <router-link to="/propertyTypes/list">Property Types</router-link>
@@ -266,10 +246,9 @@
266 246
                             <router-link to="/fees">Fees</router-link>
267 247
                           </li>
268 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 252
                           </li>
274 253
                         </ul>
275 254
                       </li>
@@ -284,21 +263,21 @@
284 263
                           :class="submenu1Class"
285 264
                         >
286 265
                           <li>
287
-                            <router-link to="/status/changeLogPage">Changes Logs</router-link>
266
+                            <router-link to="/status/changeLogPage">Change Logs</router-link>
288 267
                           </li>
289 268
                           <li>
290 269
                             <router-link to="/searchLog">Search Logs</router-link>
291 270
                           </li>
292 271
                         </ul>
293 272
                       </li>
294
-                      <hr v-if="ROLE === 'Super Admin'" />
273
+                      <hr />
295 274
                       <li>
296 275
                         <router-link to="/Offers">Offers</router-link>
297 276
                       </li>
298 277
                       <!-- <li v-if="ROLE === 'Super Admin'">
299 278
                         <router-link to="/Carousel">Carousel</router-link>
300 279
                       </li>-->
301
-                      <li v-if="ROLE === 'Super Admin'">
280
+                      <li>
302 281
                         <router-link to="/user/updateProfileInfo">Update Info</router-link>
303 282
                       </li>
304 283
                       <li v-if="ROLE === 'Super Admin'">
@@ -308,17 +287,23 @@
308 287
                         <router-link to="/landingPages">Landing Pages / Campaignes</router-link>
309 288
                       </li>
310 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 293
                       </li>
313 294
                     </ul>
314 295
                   </li>
315 296
 
316 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 301
                   </li>
319 302
 
320 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 307
                   </li>
323 308
                   <!-- <li v-if="!isLoggedIn" class="menu-has-children">
324 309
                     <div
@@ -411,13 +396,7 @@ export default {
411 396
     this.retrieveListingFee();
412 397
   },
413 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 400
     isLoggedIn() {
422 401
       return Log.isLoggedIn();
423 402
     },

+ 39
- 39
src/components/user/Roles/contentSection.vue ファイルの表示

@@ -1,36 +1,39 @@
1 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 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 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 29
       </div>
27
-    </div>
28
-  </main>
30
+    </main>
31
+  </div>
29 32
 </template>
30 33
 
31 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 37
 import ListView from "../../shared/listView.vue";
35 38
 
36 39
 export default {
@@ -41,23 +44,20 @@ export default {
41 44
   },
42 45
   data() {
43 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 48
       headers: ["", "", "", "", "", "", "", ""],
55
-      item: {}
49
+      item: {},
50
+      wait: true
56 51
     };
57 52
   },
58 53
   props: {},
54
+  created() {
55
+    this.retrieveUserRoles().then(() => {
56
+      this.wait = false;
57
+    });
58
+  },
59 59
   methods: {
60
-    ...mapActions("register", ["getIndividuals", "deleteIndividual"]),
60
+    ...mapActions("role", ["retrieveUserRoles"]),
61 61
     routerGoTo(goTo) {
62 62
       this.$router.push(goTo);
63 63
     },
@@ -75,7 +75,7 @@ export default {
75 75
     this.getIndividuals();
76 76
   },
77 77
   computed: {
78
-    ...mapState("register", ["individuals", "removeIndividual"])
78
+    ...mapGetters("role", ["getRoles"])
79 79
   }
80 80
 };
81 81
 </script>

+ 444
- 12
src/components/user/updateProfileInfo.vue ファイルの表示

@@ -9,18 +9,391 @@
9 9
         </div>
10 10
       </div>
11 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 397
         </div>
25 398
       </div>
26 399
     </div>
@@ -28,8 +401,11 @@
28 401
 </template>
29 402
 
30 403
 <script>
404
+/* eslint-disable */
31 405
 import { mapState, mapActions, mapGetters } from "vuex";
32 406
 import DetailIndividual from "./timeshareIndividual.vue";
407
+import addressAutoComplete from "../shared/addressAutoComplete";
408
+import Log from "../../assets/Log";
33 409
 
34 410
 export default {
35 411
   name: "UpdateInfo",
@@ -38,11 +414,34 @@ export default {
38 414
   },
39 415
   props: {},
40 416
   components: {
41
-    DetailIndividual
417
+    DetailIndividual,
418
+    addressAutoComplete
42 419
   },
43 420
   mounted() {
44 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 445
   computed: {
47 446
     ...mapState("timeshare", [
48 447
       "resorts",
@@ -59,18 +458,51 @@ export default {
59 458
     ]),
60 459
     ...mapState("individual", ["indiv"]),
61 460
     ...mapState("authentication", ["isLoggedIn", "user"]),
461
+    ...mapState("register", ["agent"]),
62 462
     ...mapGetters({
63 463
       user: "authentication/getUser",
64 464
       person: "authentication/getPerson"
65 465
     }),
466
+    ...mapGetters("role", ["getRoles"]),
66 467
     isLoggedIn() {
67 468
       return this.user && this.person;
469
+    },
470
+    pullUserRole() {
471
+      return Log.getUser().role;
68 472
     }
69 473
   },
70 474
   methods: {
71 475
     ...mapActions("individual", ["getIndividual", "updateIndividual"]),
476
+    ...mapActions("role", ["retrieveUserRoles"]),
477
+    ...mapActions("register", ["getAgentById", "saveAgent"]),
478
+    ...mapActions("timeshare", ["getAgencies"]),
72 479
     onSelectedItemItemChange(item) {
73 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 ファイルの表示

@@ -161,6 +161,9 @@ export default new Router({
161 161
     {
162 162
       path: "/user/updateProfileInfo",
163 163
       name: "UpdateInfo",
164
+      props: route => ({
165
+        ...route.params
166
+      }),
164 167
       component: UpdateInfo
165 168
     },
166 169
     {

+ 3
- 1
src/store/index.js ファイルの表示

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

+ 5
- 5
src/store/modules/user/individual.js ファイルの表示

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

+ 18
- 2
src/store/modules/user/register.js ファイルの表示

@@ -1,3 +1,4 @@
1
+/* eslint-disable */
1 2
 import axios from "axios";
2 3
 
3 4
 export default {
@@ -5,6 +6,7 @@ export default {
5 6
   state: {
6 7
     individuals: [],
7 8
     agents: [],
9
+    agent: {},
8 10
     registerIndividual: {
9 11
       name: "",
10 12
       surname: "",
@@ -39,6 +41,9 @@ export default {
39 41
     setAgents(state, type) {
40 42
       state.agents = type;
41 43
     },
44
+    setSingleAgent(state, agent){
45
+      state.agent = agent
46
+    },
42 47
     setAgency(state, type) {
43 48
       state.registerAgency = type;
44 49
     },
@@ -109,6 +114,17 @@ export default {
109 114
         .then(result => commit("setAgents", result.data))
110 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 128
     // getAgency({
113 129
     //   commit,
114 130
     // }, id) {
@@ -136,13 +152,13 @@ export default {
136 152
     },
137 153
     saveAgent({ commit }, item) {
138 154
       axios
139
-        .post("/api/agent", item)
155
+        .post("/api/agent/AgentFromUser", item)
140 156
         .then(result => commit("addAgent", result.data))
141 157
         .catch(console.error);
142 158
     },
143 159
     async updateIndividual({ commit }, userParam) {
144 160
       await axios
145
-        .put("/api/user", userParam)
161
+        .put("/api/user/", userParam)
146 162
         .then(result => console.log(result))
147 163
         .catch(console.error);
148 164
     },

+ 26
- 0
src/store/modules/user/role.js ファイルの表示

@@ -0,0 +1,26 @@
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
+};

読み込み中…
キャンセル
保存