Browse Source

Editign, Login and Users

master
Lene Scholtz 5 years ago
parent
commit
7bb9cb2351

+ 10
- 2
src/assets/staticData/maritalStatus.js View File

1
-const items = ['ICOP (In Community of Property)', 'OCOP (Out of Community of Property)', 'Other',
2
-  'Traditional Wedding', 'Single', 'Divorced', 'Widow', 'Committed Relationship', 'Partner',
1
+const items = [
2
+  { id: 1, description: 'ICOP (In Community of Property)' },
3
+  { id: 2, description: 'OCOP (Out of Community of Property)' },
4
+  { id: 3, description: 'Other' },
5
+  { id: 4, description: 'Traditional Wedding' },
6
+  { id: 5, description: 'Single' },
7
+  { id: 6, description: 'Divorced' },
8
+  { id: 7, description: 'Widow' },
9
+  { id: 8, description: 'Committed Relationship' },
10
+  { id: 9, description: 'Partner' },
3
 ];
11
 ];
4
 export default items;
12
 export default items;

+ 5
- 2
src/components/admin/status/agentsUserManagementPage.vue View File

53
       <table class="table table-bordered">
53
       <table class="table table-bordered">
54
         <thead>
54
         <thead>
55
           <tr>
55
           <tr>
56
-            <td colspan="10">
56
+            <td colspan="11">
57
               <div class="myWell">
57
               <div class="myWell">
58
                 <h4>Agents</h4>
58
                 <h4>Agents</h4>
59
               </div>
59
               </div>
90
             <th>
90
             <th>
91
               <b>Remove</b>
91
               <b>Remove</b>
92
             </th>
92
             </th>
93
+            <th>
94
+              <b>Soft Delete</b>
95
+            </th>
93
           </tr>
96
           </tr>
94
         </thead>
97
         </thead>
95
         <tbody>
98
         <tbody>
121
                 style="width: 85px; height:40px; color:#60CBEB"
124
                 style="width: 85px; height:40px; color:#60CBEB"
122
               >Delete</button>
125
               >Delete</button>
123
             </td>
126
             </td>
127
+            <td>{{ item.isDeleted}}</td>
124
           </tr>
128
           </tr>
125
         </tbody>
129
         </tbody>
126
       </table>
130
       </table>
169
       visibleItemsPerPageCount: 0,
173
       visibleItemsPerPageCount: 0,
170
       currentPage: 1,
174
       currentPage: 1,
171
       item: {},
175
       item: {},
172
-      delete: false,
173
     };
176
     };
174
   },
177
   },
175
   methods: {
178
   methods: {

+ 5
- 1
src/components/admin/status/userManagementPage.vue View File

35
       <table class="table table-bordered">
35
       <table class="table table-bordered">
36
         <thead>
36
         <thead>
37
           <tr>
37
           <tr>
38
-            <td colspan="10">
38
+            <td colspan="11">
39
               <div class="myWell">
39
               <div class="myWell">
40
                 <h4>Private Users</h4>
40
                 <h4>Private Users</h4>
41
               </div>
41
               </div>
72
             <th>
72
             <th>
73
               <b>Remove</b>
73
               <b>Remove</b>
74
             </th>
74
             </th>
75
+            <th>
76
+              <b>Soft Delete</b>
77
+            </th>
75
           </tr>
78
           </tr>
76
         </thead>
79
         </thead>
77
         <tbody>
80
         <tbody>
103
                 style="margin:2px; color: #60CBEB"
106
                 style="margin:2px; color: #60CBEB"
104
               >Delete</button>
107
               >Delete</button>
105
             </td>
108
             </td>
109
+            <td>{{ item.isDeleted }}</td>
106
           </tr>
110
           </tr>
107
         </tbody>
111
         </tbody>
108
       </table>
112
       </table>

+ 113
- 80
src/components/misc/address.vue View File

10
       <div class="row" style="text-align:left">
10
       <div class="row" style="text-align:left">
11
         <div class="col-md-6" style="margin-bottom: 1em">
11
         <div class="col-md-6" style="margin-bottom: 1em">
12
           <label>Street Number *</label>
12
           <label>Street Number *</label>
13
-          <div class="input-group-prepend">
14
-            <span class="input-group-text">
15
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
16
-            </span>
17
-            <input
18
-              class="form-control"
19
-              type="text"
20
-              name="streetnumber"
21
-              v-model="address.streetNumber"
22
-            />
23
-          </div>
13
+          <prop-field
14
+            :display="address.streetNumber"
15
+            :editType="'text'"
16
+            :propertyName="'streetNumber'"
17
+            :mayEdit="true"
18
+            @UpdateValue="UpdateValue"
19
+          />
24
         </div>
20
         </div>
25
         <div class="col-md-6" style="margin-bottom: 1em">
21
         <div class="col-md-6" style="margin-bottom: 1em">
26
           <label>Street Name *</label>
22
           <label>Street Name *</label>
27
-          <div class="input-group-prepend">
28
-            <span class="input-group-text">
29
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
30
-            </span>
31
-            <input class="form-control" type="text" name="streetname" v-model="address.streetName" />
32
-          </div>
23
+          <prop-field
24
+            :display="address.street"
25
+            :editType="'text'"
26
+            :propertyName="'street'"
27
+            :mayEdit="true"
28
+            @UpdateValue="UpdateValue"
29
+          />
33
         </div>
30
         </div>
34
         <div class="col-md-6" style="margin-bottom: 1em">
31
         <div class="col-md-6" style="margin-bottom: 1em">
35
           <label>Province *</label>
32
           <label>Province *</label>
36
-          <div class="input-group-prepend">
37
-            <span class="input-group-text">
38
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
39
-            </span>
40
-            <select
41
-              class="form-control"
42
-              name="propertyType"
43
-              id="propertyType"
44
-              @change="ProvinceSelected"
45
-              v-model="address.province"
46
-            >
47
-              <option value="0">Please select province</option>
48
-              <option
49
-                v-for="province in provinces"
50
-                :value="province.id"
51
-                :key="province.description"
52
-              >{{ province.description }}</option>
53
-            </select>
54
-          </div>
33
+          <propField
34
+            :display="address.province"
35
+            :editType="'selector'"
36
+            :arrayObject="provinces"
37
+            :propertyName="'province'"
38
+            :mayEdit="true"
39
+            @UpdateValue="UpdateValue"
40
+          />
55
         </div>
41
         </div>
56
 
42
 
57
         <div class="col-md-6" style="margin-bottom: 1em">
43
         <div class="col-md-6" style="margin-bottom: 1em">
58
           <label>City *</label>
44
           <label>City *</label>
59
-          <div class="input-group-prepend">
60
-            <span class="input-group-text">
61
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
62
-            </span>
63
-            <select
64
-              class="form-control"
65
-              name="propertyType"
66
-              id="propertyType"
67
-              @change="CitySelected"
68
-              v-model="address.city"
69
-            >
70
-              <option value="0">Please select city</option>
71
-              <option
72
-                v-for="city in cities"
73
-                :value="city.description"
74
-                :key="city.id"
75
-              >{{ city.description }}</option>
76
-            </select>
77
-          </div>
45
+          <propField
46
+            :display="address.city"
47
+            :editType="'selector'"
48
+            :arrayObject="cities"
49
+            :propertyName="'city'"
50
+            :mayEdit="true"
51
+            @UpdateValue="UpdateValue"
52
+          />
78
         </div>
53
         </div>
79
         <div class="col-md-6" style="margin-bottom: 1em">
54
         <div class="col-md-6" style="margin-bottom: 1em">
80
           <label>Suburb *</label>
55
           <label>Suburb *</label>
81
-          <div class="input-group-prepend">
82
-            <span class="input-group-text">
83
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
84
-            </span>
85
-            <select
86
-              class="form-control"
87
-              name="propertyType"
88
-              id="suburbselector"
89
-              v-model="address.suburb"
90
-              @change="getPostalCode"
91
-            >
92
-              <option value="0">Please select suburb</option>
93
-              <option
94
-                v-for="suburb in suburbs"
95
-                :value="suburb.description"
96
-                :key="suburb.description"
97
-              >{{ suburb.description }}</option>
98
-            </select>
99
-          </div>
56
+          <propField
57
+            :display="address.suburb"
58
+            :editType="'selector'"
59
+            :arrayObject="suburbs"
60
+            :propertyName="'suburb'"
61
+            :mayEdit="true"
62
+            @UpdateValue="UpdateValue"
63
+          />
100
         </div>
64
         </div>
101
         <div class="col-md-6" style="margin-bottom: 1em">
65
         <div class="col-md-6" style="margin-bottom: 1em">
102
           <label>Postal Code *</label>
66
           <label>Postal Code *</label>
103
-          <div class="input-group-prepend">
104
-            <span class="input-group-text">
105
-              <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
106
-            </span>
107
-            <input class="form-control" type="text" name="postalcode" v-model="address.postalCode" />
108
-          </div>
67
+          <propField
68
+            :display="address.postalCode"
69
+            :editType="'text'"
70
+            :propertyName="'postalCode'"
71
+            :mayEdit="true"
72
+            @UpdateValue="UpdateValue"
73
+          />
109
         </div>
74
         </div>
110
       </div>
75
       </div>
111
     </div>
76
     </div>
114
 
79
 
115
 <script>
80
 <script>
116
 import { mapState, mapActions } from 'vuex';
81
 import { mapState, mapActions } from 'vuex';
82
+import propField from '../property/propertyFieldEditor.vue';
117
 
83
 
118
 export default {
84
 export default {
85
+  components: {
86
+    propField,
87
+  },
119
   data() {
88
   data() {
120
     return {
89
     return {
121
       propertyType: 'Residential',
90
       propertyType: 'Residential',
155
         item.target.options.selectedIndex - 1
124
         item.target.options.selectedIndex - 1
156
       ].postalCode;
125
       ].postalCode;
157
     },
126
     },
127
+    UpdateValue(item) {
128
+      if (item.fieldName) {
129
+        if (item.fieldName === 'streetNumber') {
130
+          this.address.streetNumber = item.value;
131
+        }
132
+        if (item.fieldName === 'street') {
133
+          this.address.street = item.value;
134
+        }
135
+        if (item.fieldName === 'province') {
136
+          if (item.value !== '') {
137
+            this.address.province = item.value;
138
+            this.getCities(Object.assign({}, { province: item.value }));
139
+            this.address.city = null;
140
+            this.address.suburb = null;
141
+            this.address.postalCode = '';
142
+          } else {
143
+            this.address.province = null;
144
+            this.address.city = null;
145
+            this.address.suburb = null;
146
+            this.address.postalCode = '';
147
+            this.cities = [];
148
+            this.suburbs = [];
149
+          }
150
+        }
151
+        if (item.fieldName === 'city') {
152
+          if (item.value !== '') {
153
+            this.address.city = item.value;
154
+            // this.address.city = newCity;
155
+            // this.address.cityId = newCity.id;
156
+            this.getSuburbs(
157
+              Object.assign(
158
+                {},
159
+                {
160
+                  province: item.value,
161
+                  city: item.value,
162
+                },
163
+              ),
164
+            );
165
+            this.address.suburb = null;
166
+            this.address.postalCode = '';
167
+          } else {
168
+            this.address.city = null;
169
+            this.address.suburb = null;
170
+            this.address.postalCode = '';
171
+            this.suburbs = [];
172
+          }
173
+        }
174
+        if (item.fieldName === 'suburb') {
175
+          if (item.value !== '') {
176
+            // const newSuburb = this.suburbs.find(
177
+            //   p => p.description === item.value,
178
+            // );
179
+            // this.address.suburb = newSuburb;
180
+            // this.address.suburbId = newSuburb.id;
181
+            console.log(item.value);
182
+            this.address.suburb = item.value;
183
+            this.address.postalCode = this.address.suburb.postalCode;
184
+          } else {
185
+            this.address.suburb = null;
186
+            this.address.postalCode = '';
187
+          }
188
+        }
189
+      }
190
+    },
158
   },
191
   },
159
   mounted() {
192
   mounted() {
160
     this.getProvince();
193
     this.getProvince();

+ 41
- 18
src/components/shared/bankAccount.vue View File

10
       <div class="row" style="text-align:left">
10
       <div class="row" style="text-align:left">
11
         <div class="col-md-6" style="margin-bottom: 1em">
11
         <div class="col-md-6" style="margin-bottom: 1em">
12
           <label>Bank *</label>
12
           <label>Bank *</label>
13
-          <div class="input-group-prepend">
14
-            <span class="input-group-text">
15
-              <eva-icon name="behance-outline" fill="#60CBEB"></eva-icon>
16
-            </span>
17
-            <input class="form-control" type="text" name="bank" v-model="bank.bank" />
18
-          </div>
13
+          <prop-field
14
+            :display="bank.bank"
15
+            :editType="'text'"
16
+            :propertyName="'bankID'"
17
+            :mayEdit="true"
18
+            @UpdateValue="UpdateValue"
19
+          />
19
         </div>
20
         </div>
20
         <div class="col-md-6" style="margin-bottom: 1em">
21
         <div class="col-md-6" style="margin-bottom: 1em">
21
           <label>Account Number *</label>
22
           <label>Account Number *</label>
22
-          <div class="input-group-prepend">
23
-            <span class="input-group-text">
24
-              <eva-icon name="navigation-outline" fill="#60CBEB"></eva-icon>
25
-            </span>
26
-            <input class="form-control" type="text" name="accountnumber" v-model="bank.accNumber" />
27
-          </div>
23
+          <prop-field
24
+            :display="bank.accNumber"
25
+            :editType="'text'"
26
+            :propertyName="'accountNumber'"
27
+            :mayEdit="true"
28
+            @UpdateValue="UpdateValue"
29
+          />
28
         </div>
30
         </div>
29
         <div class="col-md-6" style="margin-bottom: 1em">
31
         <div class="col-md-6" style="margin-bottom: 1em">
30
           <label>Account Holder *</label>
32
           <label>Account Holder *</label>
31
-          <div class="input-group-prepend">
32
-            <span class="input-group-text">
33
-              <eva-icon name="person-done-outline" fill="#60CBEB"></eva-icon>
34
-            </span>
35
-            <input class="form-control" type="text" name="accountholder" v-model="bank.accHolder" />
36
-          </div>
33
+          <prop-field
34
+            :display="bank.accHolder"
35
+            :editType="'text'"
36
+            :propertyName="'accountHolder'"
37
+            :mayEdit="true"
38
+            @UpdateValue="UpdateValue"
39
+          />
37
         </div>
40
         </div>
38
       </div>
41
       </div>
39
     </div>
42
     </div>
41
 </template>
44
 </template>
42
 
45
 
43
 <script>
46
 <script>
47
+import propField from '../property/propertyFieldEditor.vue';
48
+
44
 export default {
49
 export default {
45
   name: 'BankAccount',
50
   name: 'BankAccount',
51
+  components: {
52
+    propField,
53
+  },
46
   props: {
54
   props: {
47
     bank: {
55
     bank: {
48
       bank: undefined,
56
       bank: undefined,
50
       accHolder: undefined,
58
       accHolder: undefined,
51
     },
59
     },
52
   },
60
   },
61
+  methods: {
62
+    UpdateValue(item) {
63
+      if (item.fieldName) {
64
+        if (item.fieldName === 'bank') {
65
+          this.bank.bank = item.value;
66
+        }
67
+        if (item.fieldName === 'accNumber') {
68
+          this.bank.accNumber = item.value;
69
+        }
70
+        if (item.fieldName === 'accHolder') {
71
+          this.bank.accHolder = item.value;
72
+        }
73
+      }
74
+    },
75
+  },
53
 };
76
 };
54
 </script>
77
 </script>
55
 
78
 

+ 3
- 1
src/components/shared/listView.vue View File

145
     title: {
145
     title: {
146
       default: undefined,
146
       default: undefined,
147
     },
147
     },
148
+    sortKey: {
149
+      default: 'id',
150
+    },
148
   },
151
   },
149
   data() {
152
   data() {
150
     return {
153
     return {
151
       selectedItems: [],
154
       selectedItems: [],
152
       showControl: false,
155
       showControl: false,
153
-      sortKey: '',
154
       reverse: false,
156
       reverse: false,
155
       searchItem: '',
157
       searchItem: '',
156
       itemsPerPageList: ItemsPerPageList,
158
       itemsPerPageList: ItemsPerPageList,

+ 0
- 2
src/components/user/loginPage.vue View File

33
                   <input
33
                   <input
34
                     class="form-control"
34
                     class="form-control"
35
                     type="text"
35
                     type="text"
36
-                    name="username"
37
                     placeholder="Username"
36
                     placeholder="Username"
38
                     v-model="username"
37
                     v-model="username"
39
                     value
38
                     value
51
                     v-model="password"
50
                     v-model="password"
52
                     id="password"
51
                     id="password"
53
                     placeholder="Password"
52
                     placeholder="Password"
54
-                    name="password"
55
                     value
53
                     value
56
                   />
54
                   />
57
                   <div class="input-group-append">
55
                   <div class="input-group-append">

+ 198
- 66
src/components/user/timeshareIndividual.vue View File

11
       <div class="row" style="text-align:left">
11
       <div class="row" style="text-align:left">
12
         <div class="col-md-6">
12
         <div class="col-md-6">
13
           <label>Name *</label>
13
           <label>Name *</label>
14
-          <div class="input-group-prepend">
15
-            <span class="input-group-text">
16
-              <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
17
-            </span>
18
-            <input class="form-control" type="text" name="name" v-model="currentUser.name" />
19
-          </div>
14
+          <prop-field
15
+            :display="currentUser.name"
16
+            :editType="'text'"
17
+            :propertyName="'name'"
18
+            :mayEdit="true"
19
+            @UpdateValue="UpdateValue"
20
+          />
20
         </div>
21
         </div>
21
         <div class="col-md-6" style="margin-bottom: 1em">
22
         <div class="col-md-6" style="margin-bottom: 1em">
22
           <label>Surname *</label>
23
           <label>Surname *</label>
23
-          <div class="input-group-prepend">
24
-            <span class="input-group-text">
25
-              <eva-icon name="book-outline" fill="#60CBEB"></eva-icon>
26
-            </span>
27
-            <input class="form-control" type="text" name="surname" v-model="currentUser.surname" />
28
-          </div>
24
+          <prop-field
25
+            :display="currentUser.surname"
26
+            :editType="'text'"
27
+            :propertyName="'surname'"
28
+            :mayEdit="true"
29
+            @UpdateValue="UpdateValue"
30
+          />
29
         </div>
31
         </div>
30
         <div class="col-md-6" style="margin-bottom: 1em">
32
         <div class="col-md-6" style="margin-bottom: 1em">
31
           <label>ID Number *</label>
33
           <label>ID Number *</label>
32
-          <div class="input-group-prepend">
33
-            <span class="input-group-text">
34
-              <eva-icon name="archive" fill="#60CBEB"></eva-icon>
35
-            </span>
36
-            <input class="form-control" type="text" name="idnumber" v-model="currentUser.idNumber" />
37
-          </div>
34
+          <prop-field
35
+            :display="currentUser.idNumber"
36
+            :editType="'text'"
37
+            :propertyName="'idNumber'"
38
+            :mayEdit="true"
39
+            @UpdateValue="UpdateValue"
40
+          />
38
         </div>
41
         </div>
39
         <div class="col-md-6" style="margin-bottom: 1em">
42
         <div class="col-md-6" style="margin-bottom: 1em">
40
           <label>Company Reg Number *</label>
43
           <label>Company Reg Number *</label>
41
-          <div class="input-group-prepend">
42
-            <span class="input-group-text">
43
-              <eva-icon name="npm-outline" fill="#60CBEB"></eva-icon>
44
-            </span>
45
-            <input
46
-              class="form-control"
47
-              type="text"
48
-              name="companyregnumber"
49
-              v-model="currentUser.companyRegNumber"
50
-            />
51
-          </div>
44
+          <prop-field
45
+            :display="currentUser.companyRegNumber"
46
+            :editType="'text'"
47
+            :propertyName="'companyRegNumber'"
48
+            :mayEdit="true"
49
+            @UpdateValue="UpdateValue"
50
+          />
52
         </div>
51
         </div>
53
         <div class="col-md-6" style="margin-bottom: 1em">
52
         <div class="col-md-6" style="margin-bottom: 1em">
54
           <label>Marital Status *</label>
53
           <label>Marital Status *</label>
55
-          <div class="input-group-prepend">
56
-            <span class="input-group-text">
57
-              <eva-icon name="people-outline" fill="#60CBEB"></eva-icon>
58
-            </span>
59
-            <select class="form-control" name="maritalstatus" v-model="currentUser.maritalStatus">
60
-              <option v-for="(item, i) in maritalStatus" :key="i">{{item}}</option>
61
-            </select>
62
-          </div>
54
+          <prop-field
55
+            :display="currentUser.maritalStatus"
56
+            :arrayObject="maritalStatus"
57
+            :editType="'selector'"
58
+            :propertyName="'maritalStatus'"
59
+            :mayEdit="true"
60
+            @UpdateValue="UpdateValue"
61
+          />
63
         </div>
62
         </div>
64
         <div class="col-md-6" style="margin-bottom: 1em">
63
         <div class="col-md-6" style="margin-bottom: 1em">
65
           <label>Email Address *</label>
64
           <label>Email Address *</label>
66
-          <div class="input-group-prepend">
67
-            <span class="input-group-text">
68
-              <eva-icon name="email-outline" fill="#60CBEB"></eva-icon>
69
-            </span>
70
-            <input class="form-control" type="text" name="email" v-model="currentUser.emailAddress" />
71
-          </div>
65
+          <prop-field
66
+            :display="currentUser.emailAddress"
67
+            :editType="'text'"
68
+            :propertyName="'email'"
69
+            :mayEdit="true"
70
+            @UpdateValue="UpdateValue"
71
+          />
72
         </div>
72
         </div>
73
         <div class="col-md-6" style="margin-bottom: 1em">
73
         <div class="col-md-6" style="margin-bottom: 1em">
74
           <label>Cell Number *</label>
74
           <label>Cell Number *</label>
75
-          <div class="input-group-prepend">
76
-            <span class="input-group-text">
77
-              <eva-icon name="smartphone-outline" fill="#60CBEB"></eva-icon>
78
-            </span>
79
-            <input
80
-              class="form-control"
81
-              type="text"
82
-              name="cellnumber"
83
-              v-model="currentUser.cellNumber"
84
-            />
85
-          </div>
75
+          <prop-field
76
+            :display="currentUser.cellNumber"
77
+            :editType="'text'"
78
+            :propertyName="'cellNumber'"
79
+            :mayEdit="true"
80
+            @UpdateValue="UpdateValue"
81
+          />
86
         </div>
82
         </div>
87
         <div class="col-md-6" style="margin-bottom: 1em">
83
         <div class="col-md-6" style="margin-bottom: 1em">
88
           <label>Landline Number *</label>
84
           <label>Landline Number *</label>
89
-          <div class="input-group-prepend">
90
-            <span class="input-group-text">
91
-              <eva-icon name="phone-outline" fill="#60CBEB"></eva-icon>
92
-            </span>
93
-            <input
94
-              class="form-control"
95
-              type="text"
96
-              name="landline"
97
-              v-model="currentUser.landlineNumber"
98
-            />
99
-          </div>
85
+          <prop-field
86
+            :display="currentUser.landlineNumber"
87
+            :editType="'text'"
88
+            :propertyName="'landlineNumber'"
89
+            :mayEdit="true"
90
+            @UpdateValue="UpdateValue"
91
+          />
100
         </div>
92
         </div>
101
       </div>
93
       </div>
102
     </div>
94
     </div>
108
       <hr />
100
       <hr />
109
       <BankAccount :bank="currentUser ? currentUser.bankingDetails : {}" />
101
       <BankAccount :bank="currentUser ? currentUser.bankingDetails : {}" />
110
     </div>
102
     </div>
103
+    <div class="row">
104
+      <div class="col-md-2 offset-3">
105
+        <button @click="SubmitData()" type="button" class="btn btn-b-n">Save</button>
106
+      </div>
107
+      <div class="col-md-2 offset-3">
108
+        <button @click="Close()" type="button" class="btn btn-b-n">Close</button>
109
+      </div>
110
+    </div>
111
   </div>
111
   </div>
112
 </template>
112
 </template>
113
 
113
 
116
 import BankAccount from '../shared/bankAccount.vue';
116
 import BankAccount from '../shared/bankAccount.vue';
117
 import Address from '../misc/address.vue';
117
 import Address from '../misc/address.vue';
118
 import SelectIndividual from './selectIndividual.vue';
118
 import SelectIndividual from './selectIndividual.vue';
119
+import propField from '../property/propertyFieldEditor.vue';
120
+import items from '../../assets/staticData/itemsPerPage';
119
 
121
 
120
 export default {
122
 export default {
121
   components: {
123
   components: {
122
     BankAccount,
124
     BankAccount,
123
     Address,
125
     Address,
124
     SelectIndividual,
126
     SelectIndividual,
127
+    propField,
125
   },
128
   },
126
   data() {
129
   data() {
127
     return {
130
     return {
151
   },
154
   },
152
   computed: {
155
   computed: {
153
     ...mapState('timeshare', ['maritalStatus']),
156
     ...mapState('timeshare', ['maritalStatus']),
157
+    ...mapState('individual', ['indiv']),
158
+    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
154
     ...mapGetters({
159
     ...mapGetters({
155
       user: 'authentication/getUser',
160
       user: 'authentication/getUser',
156
     }),
161
     }),
157
   },
162
   },
158
   methods: {
163
   methods: {
159
-    ...mapActions('individual', ['getIndividual']),
164
+    ...mapActions('individual', ['getIndividual', 'updateIndividual']),
165
+    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
160
     onSelectedItemItemChange(item) {
166
     onSelectedItemItemChange(item) {
161
       this.currentUser = item;
167
       this.currentUser = item;
162
     },
168
     },
169
+    ProvinceSelected(item) {
170
+      if (item.target.options.selectedIndex > 0) {
171
+        this.selectedProvince = this.provinces[
172
+          item.target.options.selectedIndex - 1
173
+        ].description;
174
+        this.getCities(Object.assign({}, { province: this.selectedProvince }));
175
+      }
176
+    },
177
+    CitySelected(item) {
178
+      if (item.target.options.selectedIndex > 0) {
179
+        this.selectedCity = this.cities[
180
+          item.target.options.selectedIndex - 1
181
+        ].description;
182
+        this.getSuburbs(
183
+          Object.assign(
184
+            {},
185
+            { province: this.selectedProvince, city: this.selectedCity },
186
+          ),
187
+        );
188
+      }
189
+    },
190
+    getPostalCode(item) {
191
+      this.address.postalCode = this.suburbs[
192
+        item.target.options.selectedIndex - 1
193
+      ].postalCode;
194
+    },
195
+    UpdateValue(item) {
196
+      if (item.fieldName) {
197
+        if (item.fieldName === 'name') {
198
+          this.currentUser.name = item.value;
199
+        }
200
+        if (item.fieldName === 'surname') {
201
+          this.currentUser.surname = item.value;
202
+        }
203
+        if (item.fieldName === 'idNumber') {
204
+          this.currentUser.idNumber = item.value;
205
+        }
206
+        if (item.fieldName === 'companyRegNumber') {
207
+          this.currentUser.companyRegNumber = item.value;
208
+        }
209
+        if (item.fieldName === 'maritalStatus') {
210
+          this.currentUser.maritalStatus = item.value;
211
+        }
212
+        if (item.fieldName === 'email') {
213
+          this.currentUser.emailAddress = item.value;
214
+        }
215
+        if (item.fieldName === 'cellNumber') {
216
+          this.currentUser.cellNumber = item.value;
217
+        }
218
+        if (item.fieldName === 'landlineNumber') {
219
+          this.currentUser.landlineNumber = item.value;
220
+        }
221
+        if (item.fieldName === 'streetNumber') {
222
+          this.currentUser.address.streetNumber = item.value;
223
+        }
224
+        if (item.fieldName === 'street') {
225
+          this.currentUser.address.street = item.value;
226
+        }
227
+        if (item.fieldName === 'province') {
228
+          if (item.value !== '') {
229
+            this.address.province = this.provinces.find(
230
+              p => p.description === item.value,
231
+            );
232
+            this.address.provinceId = this.address.province.id;
233
+            this.getCities(Object.assign({}, { province: item.value }));
234
+            this.address.city = null;
235
+            this.address.suburb = null;
236
+            this.address.postalCode = '';
237
+          } else {
238
+            this.address.province = null;
239
+            this.address.city = null;
240
+            this.address.suburb = null;
241
+            this.address.postalCode = '';
242
+            this.cities = [];
243
+            this.suburbs = [];
244
+          }
245
+        }
246
+        if (item.fieldName === 'city') {
247
+          if (item.value !== '') {
248
+            const newCity = this.cities.find(p => p.description === item.value);
249
+            this.address.city = newCity;
250
+            this.address.cityId = newCity.id;
251
+            this.getSuburbs(
252
+              Object.assign(
253
+                {},
254
+                {
255
+                  province: this.address.province.description,
256
+                  city: item.value,
257
+                },
258
+              ),
259
+            );
260
+            this.address.suburb = null;
261
+            this.address.postalCode = '';
262
+          } else {
263
+            this.address.city = null;
264
+            this.address.suburb = null;
265
+            this.address.postalCode = '';
266
+            this.suburbs = [];
267
+          }
268
+        }
269
+        if (item.fieldName === 'suburb') {
270
+          if (item.value !== '') {
271
+            const newSuburb = this.suburbs.find(
272
+              p => p.description === item.value,
273
+            );
274
+            this.address.suburb = newSuburb;
275
+            this.address.suburbId = newSuburb.id;
276
+            this.address.postalCode = this.address.suburb.postalCode;
277
+          } else {
278
+            this.address.suburb = null;
279
+            this.address.postalCode = '';
280
+          }
281
+        }
282
+      }
283
+    },
284
+    SubmitData() {
285
+      console.log(this.currentUser);
286
+      this.updateIndividual(this.currentUser);
287
+      this.$router.push('/status/userManagementPage');
288
+    },
289
+    Close() {
290
+      this.$router.push('/status/userManagementPage');
291
+    },
292
+  },
293
+  mounted() {
294
+    this.getProvince();
163
   },
295
   },
164
 };
296
 };
165
 </script>
297
 </script>

+ 5
- 4
src/components/user/updateProfileInfo.vue View File

15
           enctype="multipart/form-data"
15
           enctype="multipart/form-data"
16
         >
16
         >
17
           <div class="col-md-12" style="text-align:left"></div>
17
           <div class="col-md-12" style="text-align:left"></div>
18
-          <DetailIndividual :currentUser="sellItem.owner" :showBank="true" :showAddress="true" />
18
+          <DetailIndividual :currentUser="user" :showBank="true" :showAddress="true" />
19
+          <br />
19
         </form>
20
         </form>
20
       </div>
21
       </div>
21
     </div>
22
     </div>
29
 export default {
30
 export default {
30
   name: 'UpdateInfo',
31
   name: 'UpdateInfo',
31
   data() {
32
   data() {
32
-    return { selectedItem: {} };
33
+    return { selectedItem: {}, individual: {} };
33
   },
34
   },
34
   props: {},
35
   props: {},
35
   components: {
36
   components: {
53
       'agents',
54
       'agents',
54
     ]),
55
     ]),
55
     ...mapState('individual', ['indiv']),
56
     ...mapState('individual', ['indiv']),
56
-    ...mapState('authentication', ['isLoggedIn']),
57
+    ...mapState('authentication', ['isLoggedIn', 'user']),
57
     ...mapGetters({
58
     ...mapGetters({
58
       user: 'authentication/getUser',
59
       user: 'authentication/getUser',
59
       person: 'authentication/getPerson',
60
       person: 'authentication/getPerson',
63
     },
64
     },
64
   },
65
   },
65
   methods: {
66
   methods: {
66
-    ...mapActions('individual', ['getIndividual']),
67
+    ...mapActions('individual', ['getIndividual', 'updateIndividual']),
67
     onSelectedItemItemChange(item) {
68
     onSelectedItemItemChange(item) {
68
       this.currentUser = item;
69
       this.currentUser = item;
69
     },
70
     },

+ 15
- 4
src/store/modules/user/individual.js View File

26
       } else id = userId;
26
       } else id = userId;
27
       axios
27
       axios
28
         .get(`/api/individual/getIndividual/${id}`)
28
         .get(`/api/individual/getIndividual/${id}`)
29
-        .then(r => commit('setItem', {
29
+        .then((r) => {
30
+          console.log(JSON.stringify(r));
31
+          commit('setItem', {
30
             name: 'indiv',
32
             name: 'indiv',
31
             value: r.data,
33
             value: r.data,
32
-          }),)
34
+          });
35
+        })
33
         .catch(console.error);
36
         .catch(console.error);
34
     },
37
     },
35
     getAllIndividuals({ commit }) {
38
     getAllIndividuals({ commit }) {
36
       axios
39
       axios
37
         .get('/api/individual/getAllIndividuals')
40
         .get('/api/individual/getAllIndividuals')
38
-        .then(x => commit('setItem', {
41
+        .then((x) => {
42
+          commit('setItem', {
39
             name: 'items',
43
             name: 'items',
40
             value: x.data,
44
             value: x.data,
41
-          }),)
45
+          });
46
+        })
47
+        .catch(console.error);
48
+    },
49
+    updateIndividual({ commit }, item) {
50
+      axios
51
+        .put('/api/individual', item)
52
+        .then(result => commit('setItem', item))
42
         .catch(console.error);
53
         .catch(console.error);
43
     },
54
     },
44
   },
55
   },

Loading…
Cancel
Save