Kobus il y a 5 ans
Parent
révision
462dcbe28d

+ 24
- 8
src/App.vue Voir le fichier

@@ -54,6 +54,22 @@ hr {
54 54
   fill: #60cbeb;
55 55
   color: #60cbeb;
56 56
 }
57
+.mySuccess {
58
+  border-color: rgba(2, 184, 117, 0.5);
59
+  background-color: rgba(2, 184, 117, 0.5);
60
+}
61
+.myInfo {
62
+  border-color: rgba(23, 162, 184, 0.5);
63
+  background-color: rgba(23, 162, 184, 0.5);
64
+}
65
+.myWarning {
66
+  border-color: rgba(240, 173, 78, 0.5);
67
+  background-color: rgba(240, 173, 78, 0.5);
68
+}
69
+.myError {
70
+  border-color: rgba(217, 83, 79, 0.5);
71
+  background-color: rgba(217, 83, 79, 0.5);
72
+}
57 73
 a {
58 74
   cursor: pointer;
59 75
 }
@@ -70,14 +86,14 @@ a:hover {
70 86
 .cursor-pointer {
71 87
   cursor: pointer;
72 88
 }
73
-    body,
74
-    html {
75
-        font-size: 13.7px !important;
76
-        color: #666;
77
-        font-family: "Roboto", sans-serif;
78
-        height: 100%;
79
-        margin: 0;
80
-    }
89
+body,
90
+html {
91
+  font-size: 13.7px !important;
92
+  color: #666;
93
+  font-family: "Roboto", sans-serif;
94
+  height: 100%;
95
+  margin: 0;
96
+}
81 97
 </style>
82 98
 
83 99
 <style scoped>

+ 25
- 4
src/components/admin/status/agentsUserManagementPage.vue Voir le fichier

@@ -22,7 +22,22 @@
22 22
         <button type="button" class="btn btn-b-n">Agents</button>
23 23
       </div>
24 24
       <div class="col-md-2 offset-2">
25
-        <button type="button" class="btn btn-b-n">New Agent</button>
25
+        <button
26
+          type="button"
27
+          class="btn btn-b-n"
28
+          data-toggle="modal"
29
+          :data-target="'#myModal' + i"
30
+        >New Agent</button>
31
+        <div :id="'myModal' + i" class="modal fade" role="dialog">
32
+          <div class="modal-dialog modal-lg">
33
+            <div class="modal-content">
34
+              <div class="modal-header">
35
+                <button type="button" class="close" data-dismiss="modal">&times;</button>
36
+              </div>
37
+              <Agency name="Agency" :isAddAgent="false" :item="item" />
38
+            </div>
39
+          </div>
40
+        </div>
26 41
       </div>
27 42
     </div>
28 43
     <div class="container">
@@ -66,8 +81,12 @@
66 81
             <th>
67 82
               <b>Reset Password</b>
68 83
             </th>
69
-            <th></th>
70
-            <th></th>
84
+            <th>
85
+              <b>Modify</b>
86
+            </th>
87
+            <th>
88
+              <b>Remove</b>
89
+            </th>
71 90
           </tr>
72 91
         </thead>
73 92
         <tbody>
@@ -80,7 +99,9 @@
80 99
             <td>{{ item.email }}</td>
81 100
             <td v-if="item.user">{{ item.user.role }}</td>
82 101
             <td v-else></td>
83
-            <td></td>
102
+            <td>
103
+              <button type="button" class="btn" style="margin:2px; color: #60CBEB">Reset</button>
104
+            </td>
84 105
             <td>
85 106
               <button
86 107
                 type="button"

+ 9
- 3
src/components/admin/status/userManagementPage.vue Voir le fichier

@@ -63,8 +63,12 @@
63 63
             <th>
64 64
               <b>Reset Password</b>
65 65
             </th>
66
-            <th></th>
67
-            <th></th>
66
+            <th>
67
+              <b>Modify</b>
68
+            </th>
69
+            <th>
70
+              <b>Remove</b>
71
+            </th>
68 72
           </tr>
69 73
         </thead>
70 74
         <tbody>
@@ -77,7 +81,9 @@
77 81
             <td>{{ item.email }}</td>
78 82
             <td v-if="item.user">{{ item.user.role }}</td>
79 83
             <td v-else></td>
80
-            <td></td>
84
+            <td>
85
+              <button type="button" class="btn" style="margin:2px; color: #60CBEB">Reset</button>
86
+            </td>
81 87
             <td>
82 88
               <button
83 89
                 type="button"

+ 567
- 0
src/components/property/propertyCreate.vue Voir le fichier

@@ -0,0 +1,567 @@
1
+<template>
2
+  <!-- eslint-disable max-len -->
3
+  <div>
4
+    <div class="container">
5
+      <div class="col-sm-12">
6
+        <br />
7
+        <div class="tobuy-img-box">
8
+          <img
9
+            v-if="propertyType === 'Commercial'"
10
+            src="img/Commercial-Property.jpg"
11
+            alt="Timeshare To Buy"
12
+            class="img-fluid"
13
+            style="width:800px;height:400px; border-radius:10px"
14
+          />
15
+          <img
16
+            v-else
17
+            src="img/Listing3.2.jpg"
18
+            alt="Timeshare To Buy"
19
+            class="img-fluid"
20
+            style="width:800px;height:400px; border-radius:10px"
21
+          />
22
+        </div>
23
+        <div class="sinse-box" style="opacity:0.7; border: white solid 3px; border-radius: 15px">
24
+          <h3 class="sinse-title">List {{ propertyType }} {{ salesType }} Property CREATE PAGE</h3>
25
+        </div>
26
+      </div>
27
+      <br />
28
+      <div class="row">
29
+        <div class="container col-md-10">
30
+          <div class="title-box-d">
31
+            <h5 class="title-d" style="text-align:left">Property Overview</h5>
32
+          </div>
33
+        </div>
34
+      </div>
35
+      <div class="row mb-3">
36
+        <div class="container col-md-10" style="text-align:left">
37
+          <form id="mainForm">
38
+            <div class="form-goup row">
39
+              <div class="col-md-4">
40
+                <label>Usage Type</label>
41
+                <div class="input-group-prepend">
42
+                  <span class="input-group-text" style="color: #60CBEB">
43
+                    <b>U</b>
44
+                  </span>
45
+                  <select
46
+                    class="form-control"
47
+                    name="propertyUsageType"
48
+                    id="propertyUsageType"
49
+                    v-model="property.propertyUsageType"
50
+                    @change="TypeChanged"
51
+                  >
52
+                    <option value="Residential">Residential</option>
53
+                    <option value="Commercial">Commercial</option>
54
+                  </select>
55
+                </div>
56
+              </div>
57
+            </div>
58
+            <div class="form-group row">
59
+              <div class="col-md-4">
60
+                <label>Property Type</label>
61
+                <div class="input-group-prepend">
62
+                  <span class="input-group-text" style="color: #60CBEB">
63
+                    <b>T</b>
64
+                  </span>
65
+                  <select
66
+                    class="form-control"
67
+                    name="propertyType"
68
+                    id="propertyType"
69
+                    v-model="property.propertyTypeId"
70
+                  >
71
+                    <option value="0">Please select type</option>
72
+                    <option
73
+                      v-for="item in propertyTypes"
74
+                      :value="item.id"
75
+                      :key="item.id"
76
+                    >{{ item.description }}</option>
77
+                  </select>
78
+                </div>
79
+              </div>
80
+              <div v-if="propertyType === 'Commercial'" class="col-md-4">
81
+                <label>Property Name</label>
82
+                <div class="input-group-prepend">
83
+                  <span class="input-group-text" style="color: #60CBEB">
84
+                    <b>N</b>
85
+                  </span>
86
+                  <input
87
+                    class="form-control"
88
+                    type="text"
89
+                    name="propertyName"
90
+                    id="propertyName"
91
+                    v-model="property.propertyName"
92
+                  />
93
+                </div>
94
+              </div>
95
+              <div v-if="propertyType === 'Commercial'" class="col-md-4">
96
+                <label>Unit</label>
97
+                <div class="input-group-prepend">
98
+                  <span class="input-group-text" style="color: #60CBEB">
99
+                    <b>U#</b>
100
+                  </span>
101
+                  <input
102
+                    class="form-control"
103
+                    type="text"
104
+                    name="unit"
105
+                    id="unit"
106
+                    v-model="property.unit"
107
+                  />
108
+                </div>
109
+              </div>
110
+            </div>
111
+            <div class="form-group row">
112
+              <div class="col-md-6" style="margin-bottom: 1em">
113
+                <label>Street Number</label>
114
+                <div class="input-group-prepend">
115
+                  <span class="input-group-text">
116
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
117
+                  </span>
118
+                  <input
119
+                    class="form-control"
120
+                    type="text"
121
+                    name="streetnumber"
122
+                    v-model="property.addressLine1"
123
+                  />
124
+                </div>
125
+              </div>
126
+              <div class="col-md-6" style="margin-bottom: 1em">
127
+                <label>Street Name</label>
128
+                <div class="input-group-prepend">
129
+                  <span class="input-group-text">
130
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
131
+                  </span>
132
+                  <input
133
+                    class="form-control"
134
+                    type="text"
135
+                    name="streetname"
136
+                    id="streetname"
137
+                    v-model="property.addressLine2"
138
+                  />
139
+                </div>
140
+              </div>
141
+              <div class="col-md-6" style="margin-bottom: 1em">
142
+                <label>Province</label>
143
+                <div class="input-group-prepend">
144
+                  <span class="input-group-text">
145
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
146
+                  </span>
147
+                  <select
148
+                    class="form-control"
149
+                    name="propertyType"
150
+                    id="propertyType"
151
+                    @change="ProvinceSelected"
152
+                    v-model="property.provinceId"
153
+                  >
154
+                    <option value="0">Please select province</option>
155
+                    <option
156
+                      v-for="province in provinces"
157
+                      :value="province.id"
158
+                      :key="province.id"
159
+                    >{{ province.description }}</option>
160
+                  </select>
161
+                </div>
162
+              </div>
163
+
164
+              <div class="col-md-6" style="margin-bottom: 1em">
165
+                <label>City</label>
166
+                <div class="input-group-prepend">
167
+                  <span class="input-group-text">
168
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
169
+                  </span>
170
+                  <select
171
+                    class="form-control"
172
+                    name="propertyType"
173
+                    id="propertyType"
174
+                    @change="CitySelected"
175
+                    v-model="property.cityId"
176
+                  >
177
+                    <option value="0">Please select city</option>
178
+                    <option
179
+                      v-for="city in cities"
180
+                      :value="city.id"
181
+                      :key="city.id"
182
+                    >{{ city.description }}</option>
183
+                  </select>
184
+                </div>
185
+              </div>
186
+              <div class="col-md-6" style="margin-bottom: 1em">
187
+                <label>Suburb</label>
188
+                <div class="input-group-prepend">
189
+                  <span class="input-group-text">
190
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
191
+                  </span>
192
+                  <select
193
+                    class="form-control"
194
+                    name="propertyType"
195
+                    id="suburbselector"
196
+                    v-model="property.suburbId"
197
+                    @change="getPostalCode"
198
+                  >
199
+                    <option value="0">Please select suburb</option>
200
+                    <option
201
+                      v-for="suburb in suburbs"
202
+                      :value="suburb.id"
203
+                      :key="suburb.id"
204
+                    >{{ suburb.description }}</option>
205
+                  </select>
206
+                </div>
207
+              </div>
208
+              <div class="col-md-6" style="margin-bottom: 1em">
209
+                <label>Postal Code</label>
210
+                <div class="input-group-prepend">
211
+                  <span class="input-group-text">
212
+                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
213
+                  </span>
214
+                  <input
215
+                    class="form-control"
216
+                    type="text"
217
+                    name="postalcode"
218
+                    v-model="property.addressLine3"
219
+                  />
220
+                </div>
221
+              </div>
222
+            </div>
223
+
224
+            <div class="form-group row">
225
+              <div class="col-md-6">
226
+                <label v-if="salesType === 'Rental'">Rental Price</label>
227
+                <label v-if="salesType !== 'Rental'">Sales Price</label>
228
+                <div class="input-group-prepend">
229
+                  <span class="input-group-text" style="color: #60CBEB">
230
+                    <b>R</b>
231
+                  </span>
232
+                  <input
233
+                    class="form-control"
234
+                    type="number"
235
+                    name="price"
236
+                    id="price"
237
+                    placeholder="R"
238
+                    v-model="property.price"
239
+                  />
240
+                </div>
241
+              </div>
242
+              <div class="col-md-6" v-if="salesType === 'Rental'">
243
+                <label>Per</label>
244
+                <div class="input-group-prepend">
245
+                  <span class="input-group-text" style="color: #60CBEB">
246
+                    <b>D/M</b>
247
+                  </span>
248
+                  <select
249
+                    class="form-control"
250
+                    name="propertyType"
251
+                    id="propertyType"
252
+                    v-model="property.pricePer"
253
+                  >
254
+                    <option value>Please select</option>
255
+                    <option value="Month">Month</option>
256
+                    <option value="Day">Day</option>
257
+                  </select>
258
+                </div>
259
+              </div>
260
+            </div>
261
+            <div class="form-group row">
262
+              <div class="col-md-12">
263
+                <label for="Property Description">Description</label>
264
+                <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
265
+                <br />
266
+                <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
267
+              </div>
268
+            </div>
269
+            <div class="form-group row" />
270
+            <UserField
271
+              v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
272
+              :fields="propertyOverviewFields[0].fields"
273
+              @UpdateUserDefinedFields="UpdateUserDefinedFields"
274
+              :id="1"
275
+            ></UserField>
276
+            <div class="form-group row" />
277
+            <div v-for="item in propertyFields" :key="item.id">
278
+              <div class="row">
279
+                <div class="col-sm-12">
280
+                  <div class="title-box-d">
281
+                    <h5 class="title-d">{{ item.name }}</h5>
282
+                  </div>
283
+                </div>
284
+              </div>
285
+              <UserField
286
+                :fields="item.fields"
287
+                :id="item.name"
288
+                @UpdateUserDefinedFields="UpdateUserDefinedFields"
289
+                :fieldValues="item.fields"
290
+              />
291
+            </div>
292
+            <div class="form-group row" />
293
+            <div class="row">
294
+              <div class="col-sm-12">
295
+                <div class="title-box-d">
296
+                  <h5 class="title-d">Media</h5>
297
+                </div>
298
+              </div>
299
+            </div>
300
+            <div class="form-group row">
301
+              <div class="col-md-12">
302
+                <label>Virtual Tour (URL)</label>
303
+                <div class="input-group-prepend">
304
+                  <span class="input-group-text" style="color: #60CBEB">
305
+                    <b>VT</b>
306
+                  </span>
307
+                  <input
308
+                    class="form-control"
309
+                    type="link"
310
+                    name="vtlink"
311
+                    id="vtlink"
312
+                    v-model="property.virtualTour"
313
+                  />
314
+                </div>
315
+              </div>
316
+            </div>
317
+            <div class="form-group row">
318
+              <div class="col-md-12">
319
+                <label>Video (URL)</label>
320
+                <div class="input-group-prepend">
321
+                  <span class="input-group-text" style="color: #60CBEB">
322
+                    <b>V</b>
323
+                  </span>
324
+                  <input
325
+                    class="form-control"
326
+                    type="link"
327
+                    name="vlink"
328
+                    id="vlink"
329
+                    v-model="property.video"
330
+                  />
331
+                </div>
332
+              </div>
333
+            </div>
334
+            <div class="form-group row">
335
+              <div class="col-md-6">
336
+                <label>Images</label>
337
+                <div class="input-group-prepend"></div>
338
+              </div>
339
+            </div>
340
+            <ImageLoad
341
+              :loadedImages="loadedImages"
342
+              :savedImages="propertyImages"
343
+              @DefaultImage="UpdateDefaultImage"
344
+            />
345
+            <button
346
+              v-if="!wait"
347
+              type="button"
348
+              @click="SubmitData()"
349
+              class="btn btn-b-n"
350
+              style="width: 85px; height:40px;"
351
+            >Save</button>
352
+            <button
353
+              v-if="isEdit"
354
+              type="button"
355
+              @click="Close()"
356
+              class="btn btn-b-n"
357
+              style="width: 85px; height:40px;"
358
+            >Close</button>
359
+            <div v-if="wait" id="preloader"></div>
360
+          </form>
361
+        </div>
362
+      </div>
363
+    </div>
364
+  </div>
365
+</template>
366
+
367
+<script>
368
+import { mapState, mapActions } from 'vuex';
369
+import { VueEditor } from 'vue2-editor';
370
+import { setTimeout } from 'timers';
371
+import UserField from './propertyUserField.vue';
372
+import ImageLoad from './propertyImage.vue';
373
+
374
+export default {
375
+  name: 'PropertyEdit',
376
+  components: {
377
+    UserField,
378
+    ImageLoad,
379
+    VueEditor,
380
+  },
381
+  data() {
382
+    return {
383
+      propertyType: 'Residential',
384
+      salesType: 'Rental',
385
+      selectedProvince: '',
386
+      selectedCity: '',
387
+      images: [],
388
+      propertyFieldValues: [],
389
+      defaultImage: 0,
390
+      wait: false,
391
+      customToolbar: [
392
+        [{ header: [false, 1, 2, 3, 4, 5, 6] }],
393
+        ['bold', 'italic', 'underline', 'strike'],
394
+        [
395
+          { align: '' },
396
+          { align: 'center' },
397
+          { align: 'right' },
398
+          { align: 'justify' },
399
+        ],
400
+        [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
401
+        [{ script: 'sub' }, { script: 'super' }],
402
+        [{ indent: '-1' }, { indent: '+1' }],
403
+      ],
404
+    };
405
+  },
406
+  methods: {
407
+    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
408
+    ...mapActions('property', [
409
+      'getPropertyTypes',
410
+      'getPropertyOverviewFields',
411
+      'getPropertyFields',
412
+      'saveProperty',
413
+      'getProperty',
414
+      'getPropertyImages',
415
+      'clearProperty',
416
+      'clearPropertyImages',
417
+      'getPropertyEditDisplay',
418
+      'getPropertySavedOverviewFields',
419
+      'getPropertySavedFields',
420
+      'getSavedPropertyData',
421
+    ]),
422
+    TypeChanged() {
423
+      this.propertyType = this.property.propertyUsageType;
424
+    },
425
+    SubmitData() {
426
+      this.wait = true;
427
+      if (this.salesType === 'Sale') {
428
+        this.property.isSale = true;
429
+      }
430
+      // eslint-disable-next-line no-plusplus
431
+      for (let i = 0; i < this.images.length; i++) {
432
+        let setAsDefault = false;
433
+        if (i === this.defaultImage) {
434
+          setAsDefault = true;
435
+        }
436
+        this.property.propertyImages.push({
437
+          image: this.images[i],
438
+          isDefault: setAsDefault,
439
+        });
440
+      }
441
+      this.property.propertyUserFields = this.propertyFieldValues;
442
+
443
+      this.property.userId = this.user.id;
444
+      this.saveProperty(this.property);
445
+      setTimeout(
446
+        () => this.$router.push({
447
+            path: '/property/Search',
448
+            query: {
449
+              salesType: this.salesType,
450
+              propertyUsageType: this.propertyType,
451
+            },
452
+          }),
453
+        3000,
454
+      );
455
+    },
456
+    Close() {
457
+      this.$router.push('/property/admin/list/my');
458
+    },
459
+    ProvinceSelected(item) {
460
+      if (item.target.options.selectedIndex > 0) {
461
+        this.selectedProvince = this.provinces[
462
+          item.target.options.selectedIndex - 1
463
+        ].description;
464
+        this.getCities(Object.assign({}, { province: this.selectedProvince }));
465
+      }
466
+    },
467
+    CitySelected(item) {
468
+      if (item.target.options.selectedIndex > 0) {
469
+        this.selectedCity = this.cities[
470
+          item.target.options.selectedIndex - 1
471
+        ].description;
472
+        this.getSuburbs(
473
+          Object.assign(
474
+            {},
475
+            { province: this.selectedProvince, city: this.selectedCity },
476
+          ),
477
+        );
478
+      }
479
+    },
480
+    getPostalCode(item) {
481
+      this.property.addressLine3 = this.suburbs[
482
+        item.target.options.selectedIndex - 1
483
+      ].postalCode;
484
+    },
485
+    loadedImages(values) {
486
+      this.images = values;
487
+    },
488
+    UpdateUserDefinedFields(item) {
489
+      let update = false;
490
+      this.propertyFieldValues.forEach((element) => {
491
+        if (element.userDefinedFieldId === item.userDefinedFieldId) {
492
+          element.value = item.value;
493
+          update = true;
494
+        }
495
+      });
496
+      if (!update) {
497
+        this.propertyFieldValues.push(item);
498
+      }
499
+    },
500
+    UpdateDefaultImage(item) {
501
+      this.defaultImage = item;
502
+    },
503
+  },
504
+  mounted() {
505
+    this.wait = false;
506
+    this.clearProperty();
507
+    this.clearPropertyImages();
508
+    this.images = [];
509
+    this.defaultImage = 0;
510
+
511
+    if (this.propertyOverviewFields.length > 0) {
512
+      this.propertyOverviewFields = [];
513
+    }
514
+    if (this.propertyFields.length > 0) {
515
+      this.propertyFields = [];
516
+    }
517
+    if (this.property.description !== '') {
518
+      this.property.description = '';
519
+    }
520
+
521
+    if (this.$route.params.propertyUsageType) {
522
+      this.propertyType = this.$route.params.propertyUsageType;
523
+    }
524
+    this.salesType = this.$route.params.saleType;
525
+
526
+    this.getPropertyTypes(this.propertyType);
527
+
528
+    this.getProvince();
529
+    this.getPropertyOverviewFields();
530
+    this.getPropertyFields(this.propertyType);
531
+  },
532
+  computed: {
533
+    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
534
+    ...mapState('property', [
535
+      'propertyTypes',
536
+      'propertyOverviewFields',
537
+      'propertyFields',
538
+      'property',
539
+      'propertyImages',
540
+    ]),
541
+    ...mapState('authentication', ['user']),
542
+    SalesTypeChanged() {
543
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
544
+      // this.propertyType = this.$route.params.propType;
545
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
546
+      this.salesType = this.$route.params.saleType;
547
+      if (this.property && this.property.propertyUsageType) {
548
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
549
+        this.propertyType = this.property.propertyUsageType;
550
+      }
551
+
552
+      if (!this.$route.query.id) {
553
+        this.getPropertyFields(this.propertyType);
554
+      }
555
+
556
+      this.getPropertyTypes(this.propertyType);
557
+
558
+      return this.propertyType;
559
+    },
560
+  },
561
+  watch: {
562
+    SalesTypeChanged() {
563
+      return null;
564
+    },
565
+  },
566
+};
567
+</script>

+ 110
- 0
src/components/property/propertyFieldEditor.vue Voir le fichier

@@ -0,0 +1,110 @@
1
+<template>
2
+  <div>
3
+    <div>
4
+      <div v-if="!edit" class="input-group-prepend">
5
+        <input
6
+          class="form-control"
7
+          type="text"
8
+          name="currentField.name"
9
+          id="currentField.id"
10
+          v-model="display"
11
+          disabled
12
+        />
13
+        <span @click="EditClick()" class="input-group-text" style="color: #60CBEB">
14
+          <eva-icon name="edit-outline" fill="#60CBEB"></eva-icon>
15
+        </span>
16
+      </div>
17
+      <div v-if="edit" class="input-group-prepend">
18
+        <!-- Text -->
19
+        <input
20
+          v-if="editType === 'text'"
21
+          class="form-control"
22
+          type="text"
23
+          name="currentField.name"
24
+          id="currentField.id"
25
+          v-model="display"
26
+        />
27
+        <!-- Number -->
28
+        <input
29
+          v-if="editType === 'number'"
30
+          class="form-control"
31
+          type="number"
32
+          name="currentField.name"
33
+          id="currentField.id"
34
+          v-model="display"
35
+        />
36
+        <!-- Selector -->
37
+        <select
38
+          v-if="editType === 'selector'"
39
+          class="form-control"
40
+          v-model="selectorSelection"
41
+          @change="SelectorSelected"
42
+        >
43
+          <option value="0">Please select type</option>
44
+          <option v-for="item in arrayObject" :value="item.id" :key="item.id">{{ item.description }}</option>
45
+        </select>
46
+        <!-- yesno -->
47
+        <select v-if="editType === 'yesno'" class="form-control" @change="YesNoSelected">
48
+          <option></option>
49
+          <option value="yes">Yes</option>
50
+          <option value="no">No</option>
51
+        </select>
52
+        <span @click="Save()" class="input-group-text" style="color: #60CBEB">
53
+          <eva-icon name="checkmark-outline" fill="#60CBEB"></eva-icon>
54
+        </span>
55
+        <span @click="Close()" class="input-group-text" style="color: #60CBEB">
56
+          <eva-icon name="close-outline" fill="#60CBEB"></eva-icon>
57
+        </span>
58
+      </div>
59
+    </div>
60
+  </div>
61
+</template>
62
+
63
+<script>
64
+export default {
65
+  name: 'propertyFieldEdit',
66
+  props: {
67
+    display: String,
68
+    arrayObject: [],
69
+    canEdit: Boolean,
70
+    editType: String,
71
+  },
72
+  data() {
73
+    return {
74
+      edit: false,
75
+      selectorSelection: Object,
76
+    };
77
+  },
78
+  methods: {
79
+    EditClick() {
80
+      this.edit = true;
81
+    },
82
+    Save() {
83
+      this.edit = false;
84
+
85
+      // Need to emit the parent controller
86
+    },
87
+    Close() {
88
+      this.edit = false;
89
+    },
90
+    SelectorSelected(item) {
91
+      if (item.target.options.selectedIndex > 0) {
92
+        this.display = this.arrayObject[
93
+          item.target.options.selectedIndex - 1
94
+        ].description;
95
+        console.log(
96
+          this.arrayObject[item.target.options.selectedIndex - 1].description,
97
+        );
98
+      }
99
+    },
100
+    YesNoSelected(item) {
101
+      if (item.target.options.selectedIndex === 1) {
102
+        this.display = 'Yes';
103
+      }
104
+      if (item.target.options.selectedIndex === 2) {
105
+        this.display = 'No';
106
+      }
107
+    },
108
+  },
109
+};
110
+</script>

+ 14
- 6
src/components/property/propertyList.vue Voir le fichier

@@ -61,7 +61,12 @@
61 61
               >Edit</button>
62 62
             </td>
63 63
             <td>
64
-              <button type="button" class="btn" style="margin:2px; color: #60CBEB" disabled>Delete</button>
64
+              <button
65
+                type="button"
66
+                @click="Delete(item)"
67
+                class="btn btn-b-n"
68
+                style="width: 85px; height:40px;"
69
+              >Delete</button>
65 70
             </td>
66 71
           </tr>
67 72
         </tbody>
@@ -79,19 +84,21 @@ export default {
79 84
   data() {
80 85
     return {
81 86
       propertyType: '',
82
-      user: '',
83 87
       showAdmin: false,
84 88
     };
85 89
   },
86 90
   methods: {
87
-    ...mapActions('propertyList', ['getProperties']),
91
+    ...mapActions('propertyList', ['getProperties', 'deleteProperty']),
88 92
     Edit(item) {
89 93
       const salesType = item.isSale ? 'Sale' : 'Rental';
90 94
       this.$router.push({
91
-        path: `/property/${this.propertyType}/${salesType}`,
95
+        path: '/property/edit',
92 96
         query: { id: item.id },
93 97
       });
94 98
     },
99
+    Delete(item) {
100
+      this.deleteProperty(item.id);
101
+    },
95 102
   },
96 103
   mounted() {
97 104
     if (this.$route.params.by === 'my') {
@@ -102,20 +109,21 @@ export default {
102 109
       this.showAdmin = true;
103 110
     }
104 111
 
105
-    this.user = 28; // user id
112
+    // this.user = 28; // user id
106 113
 
107 114
     this.getProperties(
108 115
       Object.assign(
109 116
         {},
110 117
         {
111 118
           propertyType: this.showAdmin ? 'Admin' : 'My',
112
-          user: this.user,
119
+          user: this.user.id,
113 120
         },
114 121
       ),
115 122
     );
116 123
   },
117 124
   computed: {
118 125
     ...mapState('propertyList', ['properties']),
126
+    ...mapState('authentication', ['user']),
119 127
     UserChanged() {
120 128
       if (this.$route.params.by === 'my') {
121 129
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties

+ 48
- 0
src/components/property/propertyPage.vue Voir le fichier

@@ -197,6 +197,54 @@
197 197
             </div>
198 198
           </div>
199 199
         </div>
200
+        <!-- Tab Control -->
201
+        <div class="row">
202
+          <div class="col-sm-12">
203
+            <div v-if="property.virtualTour" class="row justify-content-between">
204
+              <div class="col-md-7 col-lg-7 section-md-t3">
205
+                <div class="row">
206
+                  <div class="col-sm-12">
207
+                    <div class="title-box-d">
208
+                      <h3 class="title-d" style="text-align:left">Virtual Tour</h3>
209
+                    </div>
210
+                  </div>
211
+                </div>
212
+                <iframe
213
+                  :src="property.virtualTour"
214
+                  width="100%"
215
+                  height="500"
216
+                  frameborder="0"
217
+                  webkitallowfullscreen
218
+                  mozallowfullscreen
219
+                  allowfullscreen
220
+                ></iframe>
221
+              </div>
222
+            </div>
223
+            <div class="row">
224
+              <br />
225
+            </div>
226
+            <div v-if="property.video" class="row justify-content-between">
227
+              <div class="col-md-7 col-lg-7 section-md-t3">
228
+                <div class="row">
229
+                  <div class="col-sm-12">
230
+                    <div class="title-box-d">
231
+                      <h3 class="title-d" style="text-align:left">Video</h3>
232
+                    </div>
233
+                  </div>
234
+                </div>
235
+                <iframe
236
+                  :src="`https://www.youtube.com/embed/${property.video}`"
237
+                  width="100%"
238
+                  height="500"
239
+                  frameborder="0"
240
+                  style="border:0"
241
+                  allowfullscreen
242
+                ></iframe>
243
+              </div>
244
+            </div>
245
+          </div>
246
+          <!-- End Tab Control -->
247
+        </div>
200 248
       </div>
201 249
     </section>
202 250
   </div>

+ 9
- 1
src/components/property/propertySearchPage.vue Voir le fichier

@@ -180,6 +180,7 @@ export default {
180 180
   },
181 181
   computed: {
182 182
     ...mapState('propertySearch', ['properties']),
183
+    ...mapState('authentication', ['username']),
183 184
     ParamsChanged() {
184 185
       if (Object.keys(this.$route.query).length === 0) {
185 186
         if (this.propertySearch.propertyUsageType === 'All') {
@@ -210,13 +211,20 @@ export default {
210 211
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
211 212
         this.propertySearch.keyword = 'All';
212 213
       }
214
+      if (this.username) {
215
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
216
+        this.propertySearch.userName = this.username;
217
+      } else {
218
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
219
+        this.propertySearch.userName = 'Unknown';
220
+      }
213 221
       this.searchProperties(this.propertySearch);
214 222
       return null;
215 223
     },
216 224
   },
217 225
   watch: {
218 226
     ParamsChanged() {
219
-      console.log(JSON.stringify(this.$route.query));
227
+      return null;
220 228
     },
221 229
   },
222 230
 };

+ 111
- 228
src/components/property/propertyeditPage.vue Voir le fichier

@@ -21,7 +21,7 @@
21 21
           />
22 22
         </div>
23 23
         <div class="sinse-box" style="opacity:0.7; border: white solid 3px; border-radius: 15px">
24
-          <h3 class="sinse-title">List {{ propertyType }} {{ salesType }} Property</h3>
24
+          <h3 class="sinse-title">Edit Property: {{ property.shortDescription }}</h3>
25 25
         </div>
26 26
       </div>
27 27
       <br />
@@ -39,185 +39,63 @@
39 39
               <div class="col-md-4">
40 40
                 <label>Usage Type</label>
41 41
                 <div class="input-group-prepend">
42
-                  <span class="input-group-text" style="color: #60CBEB">
42
+                  <!-- <span class="input-group-text" style="color: #60CBEB">
43 43
                     <b>U</b>
44
-                  </span>
45
-                  <select
44
+                  </span>-->
45
+                  <input
46 46
                     class="form-control"
47
-                    name="propertyUsageType"
48
-                    id="propertyUsageType"
49
-                    v-model="propertyType"
50
-                    @change="TypeChanged"
51
-                  >
52
-                    <option value="Residential">Residential</option>
53
-                    <option value="Commercial">Commercial</option>
54
-                  </select>
47
+                    type="text"
48
+                    name="unit"
49
+                    id="unit"
50
+                    v-model="property.propertyUsageType"
51
+                    disabled
52
+                  />
55 53
                 </div>
56 54
               </div>
57 55
             </div>
58 56
             <div class="form-group row">
59 57
               <div class="col-md-4">
60 58
                 <label>Property Type</label>
61
-                <div class="input-group-prepend">
62
-                  <span class="input-group-text" style="color: #60CBEB">
63
-                    <b>T</b>
64
-                  </span>
65
-                  <select
66
-                    class="form-control"
67
-                    name="propertyType"
68
-                    id="propertyType"
69
-                    v-model="property.propertyTypeId"
70
-                  >
71
-                    <option value="0">Please select type</option>
72
-                    <option
73
-                      v-for="item in propertyTypes"
74
-                      :value="item.id"
75
-                      :key="item.id"
76
-                    >{{ item.description }}</option>
77
-                  </select>
78
-                </div>
59
+                <propField
60
+                  :display="property.propertyType.description"
61
+                  :editType="'Selector'"
62
+                  :arrayObject="propertyTypes"
63
+                />
79 64
               </div>
80 65
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
81 66
                 <label>Property Name</label>
82
-                <div class="input-group-prepend">
83
-                  <span class="input-group-text" style="color: #60CBEB">
84
-                    <b>N</b>
85
-                  </span>
86
-                  <input
87
-                    class="form-control"
88
-                    type="text"
89
-                    name="propertyName"
90
-                    id="propertyName"
91
-                    v-model="property.propertyName"
92
-                  />
93
-                </div>
67
+                <propField :display="property.proeprtyName" :editType="'text'" />
94 68
               </div>
95 69
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
96 70
                 <label>Unit</label>
97
-                <div class="input-group-prepend">
98
-                  <span class="input-group-text" style="color: #60CBEB">
99
-                    <b>U#</b>
100
-                  </span>
101
-                  <input
102
-                    class="form-control"
103
-                    type="text"
104
-                    name="unit"
105
-                    id="unit"
106
-                    v-model="property.unit"
107
-                  />
108
-                </div>
71
+                <propField :label="'Property Type'" :display="property.unit" :editType="'text'" />
109 72
               </div>
110 73
             </div>
111 74
             <div class="form-group row">
112 75
               <div class="col-md-6" style="margin-bottom: 1em">
113 76
                 <label>Street Number</label>
114
-                <div class="input-group-prepend">
115
-                  <span class="input-group-text">
116
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
117
-                  </span>
118
-                  <input
119
-                    class="form-control"
120
-                    type="text"
121
-                    name="streetnumber"
122
-                    v-model="property.addressLine1"
123
-                  />
124
-                </div>
77
+                <propField :display="property.addressLine1" :editType="'text'" />
125 78
               </div>
126 79
               <div class="col-md-6" style="margin-bottom: 1em">
127 80
                 <label>Street Name</label>
128
-                <div class="input-group-prepend">
129
-                  <span class="input-group-text">
130
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
131
-                  </span>
132
-                  <input
133
-                    class="form-control"
134
-                    type="text"
135
-                    name="streetname"
136
-                    id="streetname"
137
-                    v-model="property.addressLine2"
138
-                  />
139
-                </div>
81
+                <propField :display="property.addressLine2" :editType="'text'" />
140 82
               </div>
141 83
               <div class="col-md-6" style="margin-bottom: 1em">
142 84
                 <label>Province</label>
143
-                <div class="input-group-prepend">
144
-                  <span class="input-group-text">
145
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
146
-                  </span>
147
-                  <select
148
-                    class="form-control"
149
-                    name="propertyType"
150
-                    id="propertyType"
151
-                    @change="ProvinceSelected"
152
-                    v-model="property.provinceId"
153
-                  >
154
-                    <option value="0">Please select province</option>
155
-                    <option
156
-                      v-for="province in provinces"
157
-                      :value="province.id"
158
-                      :key="province.id"
159
-                    >{{ province.description }}</option>
160
-                  </select>
161
-                </div>
85
+                <propField :display="property.province.description" :editType="'selector'" />
162 86
               </div>
163 87
 
164 88
               <div class="col-md-6" style="margin-bottom: 1em">
165 89
                 <label>City</label>
166
-                <div class="input-group-prepend">
167
-                  <span class="input-group-text">
168
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
169
-                  </span>
170
-                  <select
171
-                    class="form-control"
172
-                    name="propertyType"
173
-                    id="propertyType"
174
-                    @change="CitySelected"
175
-                    v-model="property.cityId"
176
-                  >
177
-                    <option value="0">Please select city</option>
178
-                    <option
179
-                      v-for="city in cities"
180
-                      :value="city.id"
181
-                      :key="city.id"
182
-                    >{{ city.description }}</option>
183
-                  </select>
184
-                </div>
90
+                <propField :display="property.city.description" :editType="'selector'" />
185 91
               </div>
186 92
               <div class="col-md-6" style="margin-bottom: 1em">
187 93
                 <label>Suburb</label>
188
-                <div class="input-group-prepend">
189
-                  <span class="input-group-text">
190
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
191
-                  </span>
192
-                  <select
193
-                    class="form-control"
194
-                    name="propertyType"
195
-                    id="suburbselector"
196
-                    v-model="property.suburbId"
197
-                    @change="getPostalCode"
198
-                  >
199
-                    <option value="0">Please select suburb</option>
200
-                    <option
201
-                      v-for="suburb in suburbs"
202
-                      :value="suburb.id"
203
-                      :key="suburb.id"
204
-                    >{{ suburb.description }}</option>
205
-                  </select>
206
-                </div>
94
+                <propField :display="property.suburb.description" :editType="'selector'" />
207 95
               </div>
208 96
               <div class="col-md-6" style="margin-bottom: 1em">
209 97
                 <label>Postal Code</label>
210
-                <div class="input-group-prepend">
211
-                  <span class="input-group-text">
212
-                    <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
213
-                  </span>
214
-                  <input
215
-                    class="form-control"
216
-                    type="text"
217
-                    name="postalcode"
218
-                    v-model="property.addressLine3"
219
-                  />
220
-                </div>
98
+                <propField :display="property.addressLine3" :editType="'text'" />
221 99
               </div>
222 100
             </div>
223 101
 
@@ -225,37 +103,11 @@
225 103
               <div class="col-md-6">
226 104
                 <label v-if="salesType === 'Rental'">Rental Price</label>
227 105
                 <label v-if="salesType !== 'Rental'">Sales Price</label>
228
-                <div class="input-group-prepend">
229
-                  <span class="input-group-text" style="color: #60CBEB">
230
-                    <b>R</b>
231
-                  </span>
232
-                  <input
233
-                    class="form-control"
234
-                    type="number"
235
-                    name="price"
236
-                    id="price"
237
-                    placeholder="R"
238
-                    v-model="property.price"
239
-                  />
240
-                </div>
106
+                <propField :display="property.price" :editType="'number'" />
241 107
               </div>
242 108
               <div class="col-md-6" v-if="salesType === 'Rental'">
243 109
                 <label>Per</label>
244
-                <div class="input-group-prepend">
245
-                  <span class="input-group-text" style="color: #60CBEB">
246
-                    <b>D/M</b>
247
-                  </span>
248
-                  <select
249
-                    class="form-control"
250
-                    name="propertyType"
251
-                    id="propertyType"
252
-                    v-model="property.pricePer"
253
-                  >
254
-                    <option value>Please select</option>
255
-                    <option value="Month">Month</option>
256
-                    <option value="Day">Day</option>
257
-                  </select>
258
-                </div>
110
+                <propField :display="property.pricePer" :editType="'text'" />
259 111
               </div>
260 112
             </div>
261 113
             <div class="form-group row">
@@ -267,40 +119,68 @@
267 119
               </div>
268 120
             </div>
269 121
             <div class="form-group row" />
270
-            <UserField
122
+            <div
123
+              class="col-md-6"
271 124
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
272
-              :fields="propertyOverviewFields[0].fields"
273
-              @UpdateUserDefinedFields="UpdateUserDefinedFields"
274
-              :id="1"
275
-            ></UserField>
125
+            >
126
+              <div v-for="item in propertyOverviewFields[0].fields" :key="item.id">
127
+                <label>{{ item.name }}</label>
128
+                <propField :display="item.value" :editType="item.type" />
129
+              </div>
130
+            </div>
131
+
276 132
             <div class="form-group row" />
277
-            <div v-for="item in propertyFields" :key="item.id">
133
+            <div v-for="group in propertyFields" :key="group.id">
278 134
               <div class="row">
279 135
                 <div class="col-sm-12">
280 136
                   <div class="title-box-d">
281
-                    <h5 class="title-d">{{ item.name }}</h5>
137
+                    <h5 class="title-d">{{ group.name }}</h5>
282 138
                   </div>
283 139
                 </div>
284 140
               </div>
285
-              <UserField
141
+              <div v-for="field in group.fields" :key="field.id">
142
+                <label>{{ field.name }}</label>
143
+                <propField :display="field.value" :editType="field.type" />
144
+              </div>
145
+              <!-- <UserField
286 146
                 :fields="item.fields"
287 147
                 :id="item.name"
288 148
                 @UpdateUserDefinedFields="UpdateUserDefinedFields"
289
-              />
149
+                :fieldValues="item.fields"
150
+              />-->
290 151
             </div>
291 152
             <div class="form-group row" />
292 153
             <div class="row">
293 154
               <div class="col-sm-12">
294 155
                 <div class="title-box-d">
295
-                  <h5 class="title-d">Images</h5>
156
+                  <h5 class="title-d">Media</h5>
296 157
                 </div>
297 158
               </div>
298 159
             </div>
299
-            <ImageLoad
300
-              :loadedImages="loadedImages"
301
-              :savedImages="propertyImages"
302
-              @DefaultImage="UpdateDefaultImage"
303
-            />
160
+            <div class="form-group row">
161
+              <div class="col-md-12">
162
+                <label>Virtual Tour (URL)</label>
163
+                <propField :display="property.virtualTour" :editType="'text'" />
164
+              </div>
165
+            </div>
166
+            <div class="form-group row">
167
+              <div class="col-md-12">
168
+                <label>Video (URL)</label>
169
+                <propField :display="property.video" :editType="'text'" />
170
+              </div>
171
+            </div>
172
+            <div class="form-group row">
173
+              <div class="col-md-6">
174
+                <label>Images</label>
175
+                <div class="input-group-prepend"></div>
176
+              </div>
177
+            </div>
178
+            <div class="form-group row">
179
+              <div class="col-md-6" v-for="(img, i) in propertyImages" :key="i">
180
+                <img :src="img" style="height:200px; width:150px; object-fit: cover;" />
181
+              </div>
182
+            </div>
183
+            <ImageLoad :loadedImages="loadedImages" @DefaultImage="UpdateDefaultImage" />
304 184
             <button
305 185
               v-if="!wait"
306 186
               type="button"
@@ -308,6 +188,13 @@
308 188
               class="btn btn-b-n"
309 189
               style="width: 85px; height:40px;"
310 190
             >Save</button>
191
+            <button
192
+              v-if="isEdit"
193
+              type="button"
194
+              @click="Close()"
195
+              class="btn btn-b-n"
196
+              style="width: 85px; height:40px;"
197
+            >Close</button>
311 198
             <div v-if="wait" id="preloader"></div>
312 199
           </form>
313 200
         </div>
@@ -320,15 +207,15 @@
320 207
 import { mapState, mapActions } from 'vuex';
321 208
 import { VueEditor } from 'vue2-editor';
322 209
 import { setTimeout } from 'timers';
323
-import UserField from './propertyUserField.vue';
324 210
 import ImageLoad from './propertyImage.vue';
211
+import propField from './propertyFieldEditor.vue';
325 212
 
326 213
 export default {
327 214
   name: 'PropertyEdit',
328 215
   components: {
329
-    UserField,
330 216
     ImageLoad,
331 217
     VueEditor,
218
+    propField,
332 219
   },
333 220
   data() {
334 221
     return {
@@ -353,6 +240,7 @@ export default {
353 240
         [{ script: 'sub' }, { script: 'super' }],
354 241
         [{ indent: '-1' }, { indent: '+1' }],
355 242
       ],
243
+      isEdit: false,
356 244
     };
357 245
   },
358 246
   methods: {
@@ -371,12 +259,15 @@ export default {
371 259
       'getPropertySavedFields',
372 260
       'getSavedPropertyData',
373 261
     ]),
374
-    TypeChanged() {},
262
+    TypeChanged() {
263
+      this.propertyType = this.property.propertyUsageType;
264
+    },
375 265
     SubmitData() {
376 266
       this.wait = true;
377 267
       if (this.salesType === 'Sale') {
378 268
         this.property.isSale = true;
379 269
       }
270
+      // eslint-disable-next-line no-plusplus
380 271
       for (let i = 0; i < this.images.length; i++) {
381 272
         let setAsDefault = false;
382 273
         if (i === this.defaultImage) {
@@ -389,18 +280,25 @@ export default {
389 280
       }
390 281
       this.property.propertyUserFields = this.propertyFieldValues;
391 282
 
392
-      this.saveProperty(this.property);
393
-
394
-      setTimeout(
395
-        () => this.$router.push({
396
-            path: '/property/Search',
397
-            query: {
398
-              salesType: this.salesType,
399
-              propertyUsageType: this.propertyType,
400
-            },
401
-          }),
402
-        3000,
403
-      );
283
+      if (this.property.id === 0) {
284
+        this.property.userId = this.user.id;
285
+        this.saveProperty(this.property);
286
+        setTimeout(
287
+          () => this.$router.push({
288
+              path: '/property/Search',
289
+              query: {
290
+                salesType: this.salesType,
291
+                propertyUsageType: this.propertyType,
292
+              },
293
+            }),
294
+          3000,
295
+        );
296
+      } else {
297
+        setTimeout(() => this.$router.push('/property/admin/list/my'), 3000);
298
+      }
299
+    },
300
+    Close() {
301
+      this.$router.push('/property/admin/list/my');
404 302
     },
405 303
     ProvinceSelected(item) {
406 304
       if (item.target.options.selectedIndex > 0) {
@@ -473,36 +371,14 @@ export default {
473 371
 
474 372
     this.getProvince();
475 373
     if (this.$route.query.id) {
476
-      // this.getCities(Object.assign({}, { province: this.selectedProvince }));
477 374
       this.getSavedPropertyData(
478 375
         Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
479 376
       );
377
+      this.isEdit = true;
480 378
     } else {
481 379
       this.getPropertyOverviewFields();
482 380
       this.getPropertyFields(this.propertyType);
483 381
     }
484
-    // if (this.$route.params.id) {
485
-    //   this.getPropertyEditDisplay(4); // (this.$route.params.id);
486
-    //   this.propertyType = 'Residential'; // this.propertyEditDisplay.propertyType;
487
-    //   this.salesType = 'Rental'; // this.propertyEditDisplay.saleType;
488
-
489
-    //   this.getProvince();
490
-    //   this.getPropertyTypes('Residential');
491
-    //   this.getPropertySavedOverviewFields(4);
492
-    //   this.getPropertySavedFields(
493
-    //     Object.assign(
494
-    //       {},
495
-    //       {
496
-    //         type: 'Residential',
497
-    //         id: 4,
498
-    //       },
499
-    //     ),
500
-    //   );
501
-
502
-    //   this.getProperty(this.$route.params.id);
503
-    // } else {
504
-
505
-    // }
506 382
   },
507 383
   computed: {
508 384
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
@@ -513,22 +389,29 @@ export default {
513 389
       'property',
514 390
       'propertyImages',
515 391
     ]),
392
+    ...mapState('authentication', ['user']),
516 393
     SalesTypeChanged() {
517 394
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
518 395
       // this.propertyType = this.$route.params.propType;
519 396
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
520 397
       this.salesType = this.$route.params.saleType;
398
+      if (this.property && this.property.propertyUsageType) {
399
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
400
+        this.propertyType = this.property.propertyUsageType;
401
+      }
402
+
521 403
       if (!this.$route.query.id) {
522
-        this.getPropertyTypes(this.propertyType);
523 404
         this.getPropertyFields(this.propertyType);
524 405
       }
525 406
 
407
+      this.getPropertyTypes(this.propertyType);
408
+
526 409
       return this.propertyType;
527 410
     },
528 411
   },
529 412
   watch: {
530 413
     SalesTypeChanged() {
531
-      console.log(this.salesType);
414
+      return null;
532 415
     },
533 416
   },
534 417
 };

+ 11
- 11
src/components/shared/alert.vue Voir le fichier

@@ -1,21 +1,21 @@
1 1
 <template>
2 2
   <div class="container">
3 3
     <!-- eslint-disable max-len -->
4
-    <div class="alert alert-success" v-if="type === 'SUCCESS'">
5
-      <eva-icon name="checkmark-outline"></eva-icon>
6
-      <strong>{{ text }}</strong>
4
+    <div class="alert mySuccess" v-if="type === 'SUCCESS'">
5
+      <eva-icon name="checkmark-outline" style="margin: 0px 20px"></eva-icon>
6
+      <strong class="color-black">{{ text }}</strong>
7 7
     </div>
8
-    <div class="alert alert-info" v-if="type === 'INFO'">
9
-      <eva-icon name="info-outline"></eva-icon>
10
-      <strong>{{ text }}</strong>
8
+    <div class="alert myInfo" v-if="type === 'INFO'">
9
+      <eva-icon name="info-outline" style="margin: 0px 20px"></eva-icon>
10
+      <strong class="color-black">{{ text }}</strong>
11 11
     </div>
12
-    <div class="alert alert-warning" v-if="type === 'WARNING'">
13
-      <eva-icon name="alert-circle-outline"></eva-icon>
12
+    <div class="alert myWarning" v-if="type === 'WARNING'">
13
+      <eva-icon name="alert-circle-outline" style="margin: 0px 20px"></eva-icon>
14 14
       <strong class="color-black">{{ text }}</strong>
15 15
     </div>
16
-    <div class="alert alert-danger" v-if="type === 'ERROR'">
17
-      <eva-icon name="slash-outline"></eva-icon>
18
-      <strong>{{ text }}</strong>
16
+    <div class="alert myError" v-if="type === 'ERROR'">
17
+      <eva-icon name="slash-outline" style="margin: 0px 20px"></eva-icon>
18
+      <strong class="color-black">{{ text }}</strong>
19 19
     </div>
20 20
   </div>
21 21
 </template>

+ 9
- 0
src/components/user/loginPage.vue Voir le fichier

@@ -129,9 +129,18 @@ export default {
129 129
       } else this.troubleToggle = true;
130 130
     },
131 131
     Login() {
132
+      console.log(this.$store.state.authentication);
133
+
132 134
       this.login().then(() => {
135
+        console.log('this');
136
+        console.log(this);
137
+        console.log(this.$store.state.authentication.status);
138
+
133 139
         if (this.$store.state.authentication.status === 'error') {
134 140
           this.$router.push('/user/login');
141
+        } else {
142
+          console.log('yippy tequila');
143
+          this.$router.push('/about/us');
135 144
         }
136 145
       });
137 146
     },

+ 21
- 3
src/components/user/updateProfileInfo.vue Voir le fichier

@@ -36,10 +36,23 @@
36 36
             <td>
37 37
               <button
38 38
                 type="button"
39
-                @click="Edit(item)"
39
+                data-toggle="modal"
40
+                :data-target="'#myModal' + i"
40 41
                 class="btn"
41 42
                 style="margin:2px; color: #60CBEB"
42 43
               >Edit</button>
44
+              <div :id="'myModal' + i" class="modal fade" role="dialog">
45
+                <div class="modal-dialog modal-lg">
46
+                  <div class="modal-content">
47
+                    <div class="modal-header">
48
+                      <button type="button" class="close" data-dismiss="modal">&times;</button>
49
+                    </div>
50
+                    <div padding-left="20px">
51
+                      <Individual name="PrivateIndividual" :isAddIndividual="false" :item="item" />
52
+                    </div>
53
+                  </div>
54
+                </div>
55
+              </div>
43 56
             </td>
44 57
           </tr>
45 58
         </tbody>
@@ -51,12 +64,17 @@
51 64
 
52 65
 <script>
53 66
 import { mapState, mapActions } from 'vuex';
54
-// import axios from 'axios';
67
+import Individual from './registerPage.vue';
55 68
 
56 69
 export default {
57 70
   name: 'UpdateInfo',
71
+  components: {
72
+    Individual,
73
+  },
58 74
   data() {
59
-    return {};
75
+    return {
76
+      item: {},
77
+    };
60 78
   },
61 79
   methods: {
62 80
     ...mapActions('register', ['getIndividuals']),

+ 204
- 202
src/router/index.js Voir le fichier

@@ -18,6 +18,7 @@ import UpdateInfo from '../components/user/updateProfileInfo.vue';
18 18
 import PropertySearch from '../components/property/propertySearchPage.vue';
19 19
 import PropertyPage from '../components/property/propertyPage.vue';
20 20
 import PropertyEdit from '../components/property/propertyeditPage.vue';
21
+import PropertyCreate from '../components/property/propertyCreate.vue';
21 22
 import PropertyList from '../components/property/propertyList.vue';
22 23
 import PropertyTypeList from '../components/admin/property/propertyTypeList.vue';
23 24
 import PropertyType from '../components/admin/property/propertyTypeEdit.vue';
@@ -58,207 +59,208 @@ export default new Router({
58 59
       y: 0,
59 60
     };
60 61
   },
61
-  routes: [{
62
-    path: '/',
63
-    name: 'Home',
64
-    component: HomePage,
65
-  },
66
-  {
67
-    path: '/about/us',
68
-    name: 'aboutus',
69
-    component: AboutUs,
70
-  },
71
-  {
72
-    path: '/about/timeshare',
73
-    name: 'abouttimeshare',
74
-    component: AboutTimeshare,
75
-  },
76
-  {
77
-    path: '/communication/template',
78
-    name: 'template',
79
-    component: TemplatePage,
80
-  },
81
-  {
82
-    path: '/timeshare/sell',
83
-    name: 'TimeshareSell',
84
-    component: TimeshareSell,
85
-  },
86
-  {
87
-    path: '/timeshare/buy',
88
-    name: 'TimeshareBuy',
89
-    component: TimeshareBuy,
90
-  },
91
-  {
92
-    path: '/timeshare/faq',
93
-    name: 'TimeshareFAQ',
94
-    component: TimeshareFAQ,
95
-  },
96
-  {
97
-    path: '/timeshare/myWeeks',
98
-    name: 'MyWeeks',
99
-    component: MyWeeksPage,
100
-  },
101
-  {
102
-    path: ' ',
103
-    name: 'Login',
104
-    component: Login,
105
-  },
106
-  {
107
-    path: '/user/updateProfileInfo',
108
-    name: 'UpdateInfo',
109
-    component: UpdateInfo,
110
-  },
111
-  {
112
-    path: '/user/register',
113
-    name: 'PrivateIndividual',
114
-    component: PrivateIndividual,
115
-  },
116
-  {
117
-    path: '/user/registeragency',
118
-    name: 'Agency',
119
-    component: Agency,
120
-  },
121
-  {
122
-    path: '/property/property/:id',
123
-    name: 'PropertyPage',
124
-    component: PropertyPage,
125
-  },
126
-  {
127
-    path: '/property/:propertyUsageType/search',
128
-    name: 'PropertySearch',
129
-    component: PropertySearch,
130
-  },
131
-  {
132
-    path: '/property/search',
133
-    name: 'PropertySearchTab',
134
-    component: PropertySearch,
135
-  },
136
-  {
137
-    path: '/property/new/:saleType',
138
-    name: 'PropertyNew',
139
-    component: PropertyEdit,
140
-  },
141
-  {
142
-    path: '/property/new/:propertyUsageType/:saleType',
143
-    name: 'PropertyNewFromSearch',
144
-    component: PropertyEdit,
145
-  },
146
-  {
147
-    path: '/property/edit/:id/:propType/:saleType',
148
-    name: 'PropertyEdit',
149
-    component: PropertyEdit,
150
-  },
151
-  {
152
-    path: '/property/admin/list/:by',
153
-    name: 'PropertyListAdmin',
154
-    component: PropertyList,
155
-  },
156
-  {
157
-    path: '/propertyTypes/list',
158
-    name: 'PropertyTypeList',
159
-    component: PropertyTypeList,
160
-  },
161
-  {
162
-    path: '/propertyType/new',
163
-    name: 'PropertyTypeNew',
164
-    component: PropertyType,
165
-  },
166
-  {
167
-    path: '/propertyType/:id',
168
-    name: 'PropertyTypeEdit',
169
-    component: PropertyType,
170
-  },
171
-  {
172
-    path: '/userDefinedGroups/list',
173
-    name: 'UserDefinedGroupsList',
174
-    component: UserDefinedGroups,
175
-  },
176
-  {
177
-    path: '/userDefinedGroups/userDefinedGroup/:id',
178
-    name: 'UserDefinedGroupEdit',
179
-    component: UserDefinedGroup,
180
-  },
181
-  {
182
-    path: '/userDefinedGroups/userDefinedGroup',
183
-    name: 'UserDefinedGroupNew',
184
-    component: UserDefinedGroup,
185
-  },
186
-  {
187
-    path: '/status/list',
188
-    name: 'StatusList',
189
-    component: Status,
190
-  },
191
-  {
192
-    path: '/status/timeshareAdmin',
193
-    name: 'TimeshareAdmin',
194
-    component: timeshareAdminPage,
195
-  },
196
-  {
197
-    path: '/status/tenderWeekAdmin',
198
-    name: 'TenderWeekAdmin',
199
-    component: tenderWeekAdminPage,
200
-  },
201
-  {
202
-    path: '/status/userManagementPage',
203
-    name: 'userManagementPage',
204
-    component: userManagementPage,
205
-  },
206
-  {
207
-    path: '/status/agentUserManagementPage',
208
-    name: 'agentManagementPage',
209
-    component: agentManagementPage,
210
-  },
211
-  {
212
-    path: '/status/changeLogPage',
213
-    name: 'changeLogPage',
214
-    component: changeLogPage,
215
-  },
216
-  {
217
-    path: '/unitConfiguration/list',
218
-    name: 'UnitConfiguration',
219
-    component: UnitConfiguration,
220
-  },
221
-  {
222
-    path: '/contactus',
223
-    name: 'ContactUs',
224
-    component: ContactUs,
225
-  },
226
-  {
227
-    path: '/privacypolicy',
228
-    name: 'PrivacyPolicy',
229
-    component: PrivacyPolicy,
230
-  },
231
-  {
232
-    path: '/resort/:resortCode',
233
-    name: 'ResortPage',
234
-    component: ResortPage,
235
-    props: true,
236
-  },
237
-  {
238
-    path: '/resort/:resortCode/:weekId',
239
-    name: 'UnitPage',
240
-    component: UnitPage,
241
-    props: true,
242
-  },
243
-  {
244
-    path: '/MakeOffer',
245
-    name: 'MakeOffer',
246
-    component: MakeOffer,
247
-  },
248
-  {
249
-    path: '/Offers',
250
-    name: 'Offers',
251
-    component: Offer,
252
-  },
253
-  {
254
-    path: '/timeshare/search',
255
-    name: 'TimeshareSearch',
256
-    component: TimeshareSearch,
257
-  },
258
-  {
259
-    path: '/searchLog',
260
-    name: 'SearchLog',
261
-    component: searchLog,
262
-  },
62
+  routes: [
63
+    {
64
+      path: '/',
65
+      name: 'Home',
66
+      component: HomePage,
67
+    },
68
+    {
69
+      path: '/about/us',
70
+      name: 'aboutus',
71
+      component: AboutUs,
72
+    },
73
+    {
74
+      path: '/about/timeshare',
75
+      name: 'abouttimeshare',
76
+      component: AboutTimeshare,
77
+    },
78
+    {
79
+      path: '/communication/template',
80
+      name: 'template',
81
+      component: TemplatePage,
82
+    },
83
+    {
84
+      path: '/timeshare/sell',
85
+      name: 'TimeshareSell',
86
+      component: TimeshareSell,
87
+    },
88
+    {
89
+      path: '/timeshare/buy',
90
+      name: 'TimeshareBuy',
91
+      component: TimeshareBuy,
92
+    },
93
+    {
94
+      path: '/timeshare/faq',
95
+      name: 'TimeshareFAQ',
96
+      component: TimeshareFAQ,
97
+    },
98
+    {
99
+      path: '/timeshare/myWeeks',
100
+      name: 'MyWeeks',
101
+      component: MyWeeksPage,
102
+    },
103
+    {
104
+      path: '/user/login',
105
+      name: 'Login',
106
+      component: Login,
107
+    },
108
+    {
109
+      path: '/user/updateProfileInfo',
110
+      name: 'UpdateInfo',
111
+      component: UpdateInfo,
112
+    },
113
+    {
114
+      path: '/user/register',
115
+      name: 'PrivateIndividual',
116
+      component: PrivateIndividual,
117
+    },
118
+    {
119
+      path: '/user/registeragency',
120
+      name: 'Agency',
121
+      component: Agency,
122
+    },
123
+    {
124
+      path: '/property/property/:id',
125
+      name: 'PropertyPage',
126
+      component: PropertyPage,
127
+    },
128
+    {
129
+      path: '/property/:propertyUsageType/search',
130
+      name: 'PropertySearch',
131
+      component: PropertySearch,
132
+    },
133
+    {
134
+      path: '/property/search',
135
+      name: 'PropertySearchTab',
136
+      component: PropertySearch,
137
+    },
138
+    {
139
+      path: '/property/new/:saleType',
140
+      name: 'PropertyNew',
141
+      component: PropertyCreate,
142
+    },
143
+    {
144
+      path: '/property/new/:propertyUsageType/:saleType',
145
+      name: 'PropertyNewFromSearch',
146
+      component: PropertyCreate,
147
+    },
148
+    {
149
+      path: '/property/edit',
150
+      name: 'PropertyEdit',
151
+      component: PropertyEdit,
152
+    },
153
+    {
154
+      path: '/property/admin/list/:by',
155
+      name: 'PropertyListAdmin',
156
+      component: PropertyList,
157
+    },
158
+    {
159
+      path: '/propertyTypes/list',
160
+      name: 'PropertyTypeList',
161
+      component: PropertyTypeList,
162
+    },
163
+    {
164
+      path: '/propertyType/new',
165
+      name: 'PropertyTypeNew',
166
+      component: PropertyType,
167
+    },
168
+    {
169
+      path: '/propertyType/:id',
170
+      name: 'PropertyTypeEdit',
171
+      component: PropertyType,
172
+    },
173
+    {
174
+      path: '/userDefinedGroups/list',
175
+      name: 'UserDefinedGroupsList',
176
+      component: UserDefinedGroups,
177
+    },
178
+    {
179
+      path: '/userDefinedGroups/userDefinedGroup/:id',
180
+      name: 'UserDefinedGroupEdit',
181
+      component: UserDefinedGroup,
182
+    },
183
+    {
184
+      path: '/userDefinedGroups/userDefinedGroup',
185
+      name: 'UserDefinedGroupNew',
186
+      component: UserDefinedGroup,
187
+    },
188
+    {
189
+      path: '/status/list',
190
+      name: 'StatusList',
191
+      component: Status,
192
+    },
193
+    {
194
+      path: '/status/timeshareAdmin',
195
+      name: 'TimeshareAdmin',
196
+      component: timeshareAdminPage,
197
+    },
198
+    {
199
+      path: '/status/tenderWeekAdmin',
200
+      name: 'TenderWeekAdmin',
201
+      component: tenderWeekAdminPage,
202
+    },
203
+    {
204
+      path: '/status/userManagementPage',
205
+      name: 'userManagementPage',
206
+      component: userManagementPage,
207
+    },
208
+    {
209
+      path: '/status/agentUserManagementPage',
210
+      name: 'agentManagementPage',
211
+      component: agentManagementPage,
212
+    },
213
+    {
214
+      path: '/status/changeLogPage',
215
+      name: 'changeLogPage',
216
+      component: changeLogPage,
217
+    },
218
+    {
219
+      path: '/unitConfiguration/list',
220
+      name: 'UnitConfiguration',
221
+      component: UnitConfiguration,
222
+    },
223
+    {
224
+      path: '/contactus',
225
+      name: 'ContactUs',
226
+      component: ContactUs,
227
+    },
228
+    {
229
+      path: '/privacypolicy',
230
+      name: 'PrivacyPolicy',
231
+      component: PrivacyPolicy,
232
+    },
233
+    {
234
+      path: '/resort/:resortCode',
235
+      name: 'ResortPage',
236
+      component: ResortPage,
237
+      props: true,
238
+    },
239
+    {
240
+      path: '/resort/:resortCode/:weekId',
241
+      name: 'UnitPage',
242
+      component: UnitPage,
243
+      props: true,
244
+    },
245
+    {
246
+      path: '/MakeOffer',
247
+      name: 'MakeOffer',
248
+      component: MakeOffer,
249
+    },
250
+    {
251
+      path: '/Offers',
252
+      name: 'Offers',
253
+      component: Offer,
254
+    },
255
+    {
256
+      path: '/timeshare/search',
257
+      name: 'TimeshareSearch',
258
+      component: TimeshareSearch,
259
+    },
260
+    {
261
+      path: '/searchLog',
262
+      name: 'SearchLog',
263
+      component: searchLog,
264
+    },
263 265
   ],
264 266
 });

+ 8
- 2
src/store/modules/property/property.js Voir le fichier

@@ -24,6 +24,9 @@ export default {
24 24
       propertyUserFields: [],
25 25
       propertyImages: [],
26 26
       id: 0,
27
+      virtualTour: '',
28
+      video: '',
29
+      userId: 0,
27 30
     },
28 31
     propertyImages: [],
29 32
     propertyTypes: [],
@@ -81,6 +84,9 @@ export default {
81 84
         propertyUserFields: [],
82 85
         propertyImages: [],
83 86
         id: 0,
87
+        virtualTour: '',
88
+        video: '',
89
+        userId: 0,
84 90
       };
85 91
     },
86 92
     clearPropertyImages(state) {
@@ -91,7 +97,7 @@ export default {
91 97
   actions: {
92 98
     getProperty({ commit }, id) {
93 99
       axios
94
-        .get(`/api/Property/${id}`)
100
+        .get(`/api/Property/getDetailed/${id}`)
95 101
         .then(result => commit('setProperty', result.data))
96 102
         .catch(console.error);
97 103
     },
@@ -158,7 +164,7 @@ export default {
158 164
       commit('clearPropertyImages');
159 165
 
160 166
       axios
161
-        .get(`/api/Property/${item.id}`)
167
+        .get(`/api/Property/getproperty/${item.id}`)
162 168
         .then(result => commit('setProperty', result.data))
163 169
         .catch(console.error);
164 170
 

+ 9
- 0
src/store/modules/property/propertyLists.js Voir le fichier

@@ -9,6 +9,9 @@ export default {
9 9
     setProperties(state, properties) {
10 10
       state.properties = properties;
11 11
     },
12
+    removeProperties(state, id) {
13
+      state.properties.pop(state.properties.find(item => item.id === id));
14
+    },
12 15
   },
13 16
   getters: {},
14 17
   actions: {
@@ -19,5 +22,11 @@ export default {
19 22
         .then(result => commit('setProperties', result.data))
20 23
         .catch(console.error);
21 24
     },
25
+    deleteProperty({ commit }, id) {
26
+      axios
27
+        .delete(`/api/property/${id}`)
28
+        .then(commit('removeProperties', id))
29
+        .catch(console.error);
30
+    },
22 31
   },
23 32
 };

+ 22
- 30
src/store/modules/user/authentication.js Voir le fichier

@@ -53,9 +53,7 @@ export default {
53 53
     authStatus: state => state.status,
54 54
   },
55 55
   actions: {
56
-    init({
57
-      commit,
58
-    }) {
56
+    init({ commit }) {
59 57
       if (!log.isLoggedIn() && log.tokenExpired) {
60 58
         log.clearValues();
61 59
       } else log.updateTokenExpiry();
@@ -66,37 +64,31 @@ export default {
66 64
         agency: log.getJSONObject('agency'),
67 65
       });
68 66
     },
69
-    login({
70
-      commit,
71
-      state,
72
-    }) {
73
-      return new Promise((reject) => {
74
-        commit('auth_request');
75
-        const user = {
67
+    login({ commit, state }) {
68
+      axios({
69
+        url: '/api/register/authenticate',
70
+        data: {
76 71
           username: state.username,
77 72
           password: state.password,
78
-        };
79
-        axios({
80
-          url: '/api/register/authenticate',
81
-          data: user,
82
-          method: 'POST',
73
+        },
74
+        method: 'POST',
75
+      })
76
+        .then((resp) => {
77
+          log.clearValues();
78
+          log.setValues(resp.data);
79
+          console.log(resp.data);
80
+
81
+          commit('auth_success', resp.data);
83 82
         })
84
-          .then((resp) => {
85
-            log.clearValues();
86
-            log.setValues(resp.data);
87
-            commit('auth_success', resp.data);
88
-          })
89
-          .catch((err) => {
90
-            commit('auth_error');
91
-            log.clearValues();
92
-            reject(err);
93
-            commit('auth_error', err.data);
94
-          });
95
-      });
83
+        .catch((err) => {
84
+          commit('auth_error');
85
+          log.clearValues();
86
+          // reject(err);
87
+          commit('auth_error', err.data);
88
+        });
89
+      /* }); */
96 90
     },
97
-    logout({
98
-      commit,
99
-    }) {
91
+    logout({ commit }) {
100 92
       return new Promise(() => {
101 93
         commit('logout');
102 94
         log.clearValues();

Chargement…
Annuler
Enregistrer