瀏覽代碼

Individual

master
Kobus 5 年之前
父節點
當前提交
04fdd3cf78

+ 11
- 7
src/components/misc/address.vue 查看文件

@@ -42,13 +42,13 @@
42 42
               name="propertyType"
43 43
               id="propertyType"
44 44
               @change="ProvinceSelected"
45
-              v-model="address.provinceId"
45
+              v-model="address.province"
46 46
             >
47 47
               <option value="0">Please select province</option>
48 48
               <option
49 49
                 v-for="province in provinces"
50 50
                 :value="province.id"
51
-                :key="province.id"
51
+                :key="province.description"
52 52
               >{{ province.description }}</option>
53 53
             </select>
54 54
           </div>
@@ -65,10 +65,14 @@
65 65
               name="propertyType"
66 66
               id="propertyType"
67 67
               @change="CitySelected"
68
-              v-model="address.cityId"
68
+              v-model="address.city"
69 69
             >
70 70
               <option value="0">Please select city</option>
71
-              <option v-for="city in cities" :value="city.id" :key="city.id">{{ city.description }}</option>
71
+              <option
72
+                v-for="city in cities"
73
+                :value="city.description"
74
+                :key="city.id"
75
+              >{{ city.description }}</option>
72 76
             </select>
73 77
           </div>
74 78
         </div>
@@ -82,14 +86,14 @@
82 86
               class="form-control"
83 87
               name="propertyType"
84 88
               id="suburbselector"
85
-              v-model="address.suburbId"
89
+              v-model="address.suburb"
86 90
               @change="getPostalCode"
87 91
             >
88 92
               <option value="0">Please select suburb</option>
89 93
               <option
90 94
                 v-for="suburb in suburbs"
91
-                :value="suburb.id"
92
-                :key="suburb.id"
95
+                :value="suburb.description"
96
+                :key="suburb.description"
93 97
               >{{ suburb.description }}</option>
94 98
             </select>
95 99
           </div>

+ 7
- 16
src/components/shared/bankAccount.vue 查看文件

@@ -14,7 +14,7 @@
14 14
             <span class="input-group-text">
15 15
               <eva-icon name="behance-outline" fill="#60CBEB"></eva-icon>
16 16
             </span>
17
-            <input class="form-control" type="text" name="bank" v-model="bankingDetails.bank" />
17
+            <input class="form-control" type="text" name="bank" v-model="bank.bank" />
18 18
           </div>
19 19
         </div>
20 20
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -23,12 +23,7 @@
23 23
             <span class="input-group-text">
24 24
               <eva-icon name="navigation-outline" fill="#60CBEB"></eva-icon>
25 25
             </span>
26
-            <input
27
-              class="form-control"
28
-              type="text"
29
-              name="accountnumber"
30
-              v-model="bankingDetails.accountNumber"
31
-            />
26
+            <input class="form-control" type="text" name="accountnumber" v-model="bank.accNumber" />
32 27
           </div>
33 28
         </div>
34 29
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -37,12 +32,7 @@
37 32
             <span class="input-group-text">
38 33
               <eva-icon name="person-done-outline" fill="#60CBEB"></eva-icon>
39 34
             </span>
40
-            <input
41
-              class="form-control"
42
-              type="text"
43
-              name="accountholder"
44
-              v-model="bankingDetails.accountHolder"
45
-            />
35
+            <input class="form-control" type="text" name="accountholder" v-model="bank.accHolder" />
46 36
           </div>
47 37
         </div>
48 38
       </div>
@@ -52,11 +42,12 @@
52 42
 
53 43
 <script>
54 44
 export default {
45
+  name: 'BankAccount',
55 46
   props: {
56
-    bankingDetails: {
47
+    bank: {
57 48
       bank: undefined,
58
-      accountNumber: undefined,
59
-      accountHolder: undefined,
49
+      accNumber: undefined,
50
+      accHolder: undefined,
60 51
     },
61 52
   },
62 53
 };

+ 58
- 51
src/components/shared/listView.vue 查看文件

@@ -7,61 +7,66 @@
7 7
         <input v-model="searchItem" class="form-control" placeholder="Search ..." />
8 8
       </div>
9 9
     </div>
10
-    <table id="table" class="table table-bordered table-hover">
11
-      <thead>
12
-        <tr class="dnd-moved">
13
-          <th v-for="(column, c) in Columns" :key="c">
14
-            <div @click="sortBy(column)">{{ column }}</div>
15
-          </th>
16
-          <th v-if="editable"></th>
17
-          <th v-if="deleteable"></th>
18
-        </tr>
19
-      </thead>
20
-      <tbody>
21
-        <tr
22
-          v-for="(item, i) in DisplayItems"
23
-          :key="i"
24
-          class="text-left dnd-moved"
25
-          @click="onRowClick(item)"
26
-        >
27
-          <td
28
-            v-for="(column, c) in Columns"
29
-            :key="c"
30
-          >{{ isObject(item[column]) ? item[column].display : item[column] }}</td>
31
-          <td v-if="editable" class="my-width">
32
-            <button type="button" class="btn my-btn" @click="onEdit(item)">Edit</button>
33
-          </td>
34
-          <td v-if="deleteable" class="my-width">
35
-            <button type="button" class="btn my-btn" @click="onDelete(item)">Delete</button>
36
-          </td>
37
-        </tr>
38
-      </tbody>
39
-    </table>
40
-    <div class="d-flex justify-content-between">
41
-      <div class="p-1">{{ currentPage + ' / ' + PageCount }}</div>
42
-      <div class="p-1">
43
-        <BasePagination
44
-          :currentPage="currentPage"
45
-          :pageCount="PageCount"
46
-          @nextPage="pageChangeHandle('next')"
47
-          @previousPage="pageChangeHandle('previous')"
48
-          @loadPage="pageChangeHandle"
49
-        />
50
-      </div>
51
-      <div class="p-2">
52
-        <div class="d-flex flex-row">
53
-          <div>
54
-            <select
55
-              class="form-control"
56
-              v-model="visibleItemsPerPageCount"
57
-              @change="onChangeItemsPerPage()"
58
-            >
59
-              <option v-for="(item, i) in itemsPerPageList" :key="i">{{ item }}</option>
60
-            </select>
10
+    <div v-if="items && items.length > 0">
11
+      <table id="table" class="table table-bordered table-hover">
12
+        <thead>
13
+          <tr class="dnd-moved">
14
+            <th v-for="(column, c) in Columns" :key="c">
15
+              <div @click="sortBy(column)">{{ column }}</div>
16
+            </th>
17
+            <th v-if="editable"></th>
18
+            <th v-if="deleteable"></th>
19
+          </tr>
20
+        </thead>
21
+        <tbody>
22
+          <tr
23
+            v-for="(item, i) in DisplayItems"
24
+            :key="i"
25
+            class="text-left dnd-moved"
26
+            @click="onRowClick(item)"
27
+          >
28
+            <td
29
+              v-for="(column, c) in Columns"
30
+              :key="c"
31
+            >{{ isObject(item[column]) ? item[column].display : item[column] }}</td>
32
+            <td v-if="editable" class="my-width">
33
+              <button type="button" class="btn my-btn" @click="onEdit(item)">Edit</button>
34
+            </td>
35
+            <td v-if="deleteable" class="my-width">
36
+              <button type="button" class="btn my-btn" @click="onDelete(item)">Delete</button>
37
+            </td>
38
+          </tr>
39
+        </tbody>
40
+      </table>
41
+      <div class="d-flex justify-content-between">
42
+        <div class="p-1">{{ currentPage + ' / ' + PageCount }}</div>
43
+        <div class="p-1">
44
+          <BasePagination
45
+            :currentPage="currentPage"
46
+            :pageCount="PageCount"
47
+            @nextPage="pageChangeHandle('next')"
48
+            @previousPage="pageChangeHandle('previous')"
49
+            @loadPage="pageChangeHandle"
50
+          />
51
+        </div>
52
+        <div class="p-2">
53
+          <div class="d-flex flex-row">
54
+            <div>
55
+              <select
56
+                class="form-control"
57
+                v-model="visibleItemsPerPageCount"
58
+                @change="onChangeItemsPerPage()"
59
+              >
60
+                <option v-for="(item, i) in itemsPerPageList" :key="i">{{ item }}</option>
61
+              </select>
62
+            </div>
61 63
           </div>
62 64
         </div>
63 65
       </div>
64 66
     </div>
67
+    <div v-else>
68
+      <Alert :text="'No items found ^-^'" :type="'INFO'" />
69
+    </div>
65 70
   </div>
66 71
 </template>
67 72
 
@@ -69,10 +74,12 @@
69 74
 import _ from 'lodash';
70 75
 import ItemsPerPageList from '../../assets/staticData/itemsPerPage';
71 76
 import BasePagination from './basePagination.vue';
77
+import Alert from './alert.vue';
72 78
 
73 79
 export default {
74 80
   components: {
75 81
     BasePagination,
82
+    Alert,
76 83
   },
77 84
   mounted() {
78 85
     try {

+ 2
- 2
src/components/timeshare/myWeeksPage.vue 查看文件

@@ -14,7 +14,7 @@
14 14
 </template>
15 15
 <script>
16 16
 import { mapState, mapActions } from 'vuex';
17
-import log from '../../assets/Log';
17
+import Log from '../../assets/Log';
18 18
 import ListView from '../shared/listView.vue';
19 19
 
20 20
 export default {
@@ -23,7 +23,7 @@ export default {
23 23
   },
24 24
   data() {
25 25
     return {
26
-      user: JSON.parse(log.getUser()),
26
+      user: Log.getUser(),
27 27
     };
28 28
   },
29 29
   mounted() {

+ 10
- 10
src/components/timeshare/sell/sellPage.vue 查看文件

@@ -297,11 +297,7 @@
297 297
               </div>
298 298
             </div>
299 299
 
300
-            <DetailIndividual :owner="sellItem.owner" />
301
-            <hr />
302
-            <Address :address="sellItem.owner.address" />
303
-            <hr />
304
-            <BankDetails :bankingDetails="sellItem.owner.bankingDetails" />
300
+            <DetailIndividual :currentUser="sellItem.owner" :showBank="true" />
305 301
             <hr />
306 302
           </div>
307 303
           <br />
@@ -509,10 +505,9 @@
509 505
   </div>
510 506
 </template>
511 507
 <script>
512
-import { mapState, mapActions } from 'vuex';
508
+import { mapState, mapActions, mapGetters } from 'vuex';
513 509
 import DetailIndividual from '../../user/timeshareIndividual.vue';
514
-import BankDetails from '../../shared/bankAccount.vue';
515
-import Address from '../../misc/address.vue';
510
+
516 511
 import Alert from '../../shared/alert.vue';
517 512
 
518 513
 export default {
@@ -524,8 +519,6 @@ export default {
524 519
   },
525 520
   components: {
526 521
     DetailIndividual,
527
-    BankDetails,
528
-    Address,
529 522
     Alert,
530 523
   },
531 524
   created() {
@@ -547,6 +540,10 @@ export default {
547 540
       'agents',
548 541
     ]),
549 542
     ...mapState('authentication', ['isLoggedIn']),
543
+    ...mapGetters({
544
+      user: 'authentication/getUser',
545
+      person: 'authentication/getPerson',
546
+    }),
550 547
     refAgent() {
551 548
       return this.sellItem && this.sellItem.referedByAgent;
552 549
     },
@@ -568,6 +565,9 @@ export default {
568 565
       }
569 566
       return _.sortBy(list, x => x.resortName);
570 567
     },
568
+    isLoggedIn() {
569
+      return this.user && this.person;
570
+    },
571 571
   },
572 572
   methods: {
573 573
     submitSale() {

+ 66
- 12
src/components/user/timeshareIndividual.vue 查看文件

@@ -7,7 +7,6 @@
7 7
       <div class="myWell">
8 8
         <h4>Detailed Individual Information</h4>
9 9
       </div>
10
-      <div class="form-group row"></div>
11 10
       <div class="row" style="text-align:left">
12 11
         <div class="col-md-6">
13 12
           <label>Name *</label>
@@ -15,7 +14,7 @@
15 14
             <span class="input-group-text">
16 15
               <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
17 16
             </span>
18
-            <input class="form-control" type="text" name="name" v-model="owner.name" />
17
+            <input class="form-control" type="text" name="name" v-model="currentUser.name" />
19 18
           </div>
20 19
         </div>
21 20
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -24,7 +23,7 @@
24 23
             <span class="input-group-text">
25 24
               <eva-icon name="book-outline" fill="#60CBEB"></eva-icon>
26 25
             </span>
27
-            <input class="form-control" type="text" name="surname" v-model="owner.surname" />
26
+            <input class="form-control" type="text" name="surname" v-model="currentUser.surname" />
28 27
           </div>
29 28
         </div>
30 29
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -33,7 +32,7 @@
33 32
             <span class="input-group-text">
34 33
               <eva-icon name="archive" fill="#60CBEB"></eva-icon>
35 34
             </span>
36
-            <input class="form-control" type="text" name="idnumber" v-model="owner.idNumber" />
35
+            <input class="form-control" type="text" name="idnumber" v-model="currentUser.idNumber" />
37 36
           </div>
38 37
         </div>
39 38
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -46,7 +45,7 @@
46 45
               class="form-control"
47 46
               type="text"
48 47
               name="companyregnumber"
49
-              v-model="owner.companyRegNumber"
48
+              v-model="currentUser.companyRegNumber"
50 49
             />
51 50
           </div>
52 51
         </div>
@@ -56,7 +55,7 @@
56 55
             <span class="input-group-text">
57 56
               <eva-icon name="people-outline" fill="#60CBEB"></eva-icon>
58 57
             </span>
59
-            <select class="form-control" name="maritalstatus" v-model="owner.maritalstatus">
58
+            <select class="form-control" name="maritalstatus" v-model="currentUser.maritalStatus">
60 59
               <option v-for="(item, i) in maritalStatus" :key="i">{{item}}</option>
61 60
             </select>
62 61
           </div>
@@ -67,7 +66,7 @@
67 66
             <span class="input-group-text">
68 67
               <eva-icon name="email-outline" fill="#60CBEB"></eva-icon>
69 68
             </span>
70
-            <input class="form-control" type="text" name="email" v-model="owner.email" />
69
+            <input class="form-control" type="text" name="email" v-model="currentUser.emailAddress" />
71 70
           </div>
72 71
         </div>
73 72
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -76,7 +75,12 @@
76 75
             <span class="input-group-text">
77 76
               <eva-icon name="smartphone-outline" fill="#60CBEB"></eva-icon>
78 77
             </span>
79
-            <input class="form-control" type="text" name="cellnumber" v-model="owner.cellNumber" />
78
+            <input
79
+              class="form-control"
80
+              type="text"
81
+              name="cellnumber"
82
+              v-model="currentUser.cellNumber"
83
+            />
80 84
           </div>
81 85
         </div>
82 86
         <div class="col-md-6" style="margin-bottom: 1em">
@@ -85,24 +89,74 @@
85 89
             <span class="input-group-text">
86 90
               <eva-icon name="phone-outline" fill="#60CBEB"></eva-icon>
87 91
             </span>
88
-            <input class="form-control" type="text" name="landline" v-model="owner.telephone" />
92
+            <input
93
+              class="form-control"
94
+              type="text"
95
+              name="landline"
96
+              v-model="currentUser.landlineNumber"
97
+            />
89 98
           </div>
90 99
         </div>
91 100
       </div>
92 101
     </div>
102
+    <div v-if="showAddress">
103
+      <hr />
104
+      <Address :address="currentUser ? currentUser.address : {}" />
105
+    </div>
106
+    <div v-if="showBank">
107
+      <hr />
108
+      <BankAccount :bank="currentUser ? currentUser.bankingDetails : {}" />
109
+    </div>
93 110
   </div>
94 111
 </template>
95 112
 
96 113
 <script>
97
-import { mapState } from 'vuex';
114
+import { mapState, mapGetters, mapActions } from 'vuex';
115
+import BankAccount from '../shared/bankAccount.vue';
116
+import Address from '../misc/address.vue';
98 117
 
99 118
 export default {
100
-  component: {},
119
+  components: {
120
+    BankAccount,
121
+    Address,
122
+  },
101 123
   props: {
102
-    owner: {},
124
+    currentUser: {
125
+      name: undefined,
126
+      surname: undefined,
127
+      idNumber: undefined,
128
+      companyRegNumber: undefined,
129
+      emailAddress: undefined,
130
+      cellNumber: undefined,
131
+      landlineNumber: undefined,
132
+      bankingDetails: {},
133
+      address: {},
134
+    },
135
+    showChangeCurrentUser: {
136
+      default: false,
137
+    },
138
+    showBank: {
139
+      default: false,
140
+    },
141
+    showAddress: {
142
+      default: false,
143
+    },
144
+  },
145
+  mounted() {
146
+    if (!this.currentUser) {
147
+      if (this.user) {
148
+        this.getIndividual(this.user.id);
149
+      }
150
+    }
103 151
   },
104 152
   computed: {
105 153
     ...mapState('timeshare', ['maritalStatus']),
154
+    ...mapGetters({
155
+      user: 'authentication/getUser',
156
+    }),
157
+  },
158
+  methods: {
159
+    ...mapActions('individual', ['getIndividual']),
106 160
   },
107 161
 };
108 162
 </script>

+ 2
- 0
src/store/index.js 查看文件

@@ -24,6 +24,7 @@ import Template from './modules/communication/template';
24 24
 import Info from './modules/communication/info';
25 25
 import PropertyEdit from './modules/property/propertyEdit';
26 26
 import Carousel from './modules/misc/carousel';
27
+import Individual from './modules/user/individual';
27 28
 
28 29
 Vue.use(Vuex);
29 30
 /* eslint no-param-reassign: ["error", { "props": false }] */
@@ -52,5 +53,6 @@ export default new Vuex.Store({
52 53
     info: Info,
53 54
     propertyEdit: PropertyEdit,
54 55
     carousel: Carousel,
56
+    individual: Individual,
55 57
   },
56 58
 });

+ 14
- 5
src/store/modules/user/authentication.js 查看文件

@@ -7,8 +7,8 @@ Vue.use(Vuex);
7 7
 export default {
8 8
   namespaced: true,
9 9
   state: {
10
-    username: 'UniVate2018',
11
-    password: 'UniVate2018',
10
+    username: 'kobusb',
11
+    password: '123123',
12 12
     isLoggedIn: log.isLoggedIn(),
13 13
     flag: false,
14 14
     status: undefined,
@@ -51,9 +51,13 @@ export default {
51 51
   },
52 52
   getters: {
53 53
     authStatus: state => state.status,
54
+    getPerson: () => log.getPerson(),
55
+    getUser: () => log.getUser(),
54 56
   },
55 57
   actions: {
56
-    init({ commit }) {
58
+    init({
59
+      commit,
60
+    }) {
57 61
       if (!log.isLoggedIn() && log.tokenExpired) {
58 62
         log.clearValues();
59 63
       } else log.updateTokenExpiry();
@@ -64,7 +68,10 @@ export default {
64 68
         agency: log.getJSONObject('agency'),
65 69
       });
66 70
     },
67
-    login({ commit, state }) {
71
+    login({
72
+      commit,
73
+      state,
74
+    }) {
68 75
       axios({
69 76
         url: '/api/register/authenticate',
70 77
         data: {
@@ -88,7 +95,9 @@ export default {
88 95
         });
89 96
       /* }); */
90 97
     },
91
-    logout({ commit }) {
98
+    logout({
99
+      commit,
100
+    }) {
92 101
       return new Promise(() => {
93 102
         commit('logout');
94 103
         log.clearValues();

+ 32
- 0
src/store/modules/user/individual.js 查看文件

@@ -0,0 +1,32 @@
1
+/* eslint-disable no-restricted-syntax */
2
+/* eslint-disable guard-for-in */
3
+import axios from 'axios';
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    items: [],
9
+    item: undefined,
10
+  },
11
+  mutations: {
12
+    addItem(state, item) {
13
+      state[item.name].push(item.value);
14
+    },
15
+    setItem(state, item) {
16
+      state[item.name] = item.value;
17
+    },
18
+  },
19
+  getters: {},
20
+  actions: {
21
+    getIndividual({
22
+      commit,
23
+    }, userId) {
24
+      axios
25
+        .get(`/api/individual/getIndividual/${userId}`)
26
+        .then(r => commit('setItem', {
27
+          name: 'item',
28
+          value: r.data,
29
+        })).catch(console.error);
30
+    },
31
+  },
32
+};

Loading…
取消
儲存