|
@@ -53,6 +53,7 @@
|
53
|
53
|
</div>
|
54
|
54
|
</div>
|
55
|
55
|
</div>
|
|
56
|
+ <br />
|
56
|
57
|
<div class="form-group row">
|
57
|
58
|
<div class="col-md-4">
|
58
|
59
|
<label>Sale Type</label>
|
|
@@ -64,11 +65,14 @@
|
64
|
65
|
:mayEdit="mayEdit"
|
65
|
66
|
@UpdateValue="UpdateValue"
|
66
|
67
|
/>
|
|
68
|
+ <div v-if="showPropertyTypeError">
|
|
69
|
+ <p class="alert myError">Please select a Sales Type</p>
|
|
70
|
+ </div>
|
67
|
71
|
</div>
|
68
|
72
|
</div>
|
69
|
73
|
<div class="form-group row">
|
70
|
74
|
<div class="col-md-4">
|
71
|
|
- <label>Property Type</label>
|
|
75
|
+ <label>Property Type *</label>
|
72
|
76
|
<propField
|
73
|
77
|
:display="property.propertyType ? property.propertyType.description : ''"
|
74
|
78
|
:editType="'selector'"
|
|
@@ -122,7 +126,7 @@
|
122
|
126
|
/>
|
123
|
127
|
</div>
|
124
|
128
|
<div class="col-md-6" style="margin-bottom: 1em">
|
125
|
|
- <label>Province</label>
|
|
129
|
+ <label>Province *</label>
|
126
|
130
|
<propField
|
127
|
131
|
:display="property.province ? property.province.description : ''"
|
128
|
132
|
:editType="'selector'"
|
|
@@ -131,10 +135,12 @@
|
131
|
135
|
:mayEdit="mayEdit"
|
132
|
136
|
@UpdateValue="UpdateValue"
|
133
|
137
|
/>
|
|
138
|
+ <div v-if="showProvinceError">
|
|
139
|
+ <p class="alert myError">Please select a Province</p>
|
|
140
|
+ </div>
|
134
|
141
|
</div>
|
135
|
|
-
|
136
|
142
|
<div class="col-md-6" style="margin-bottom: 1em">
|
137
|
|
- <label>City</label>
|
|
143
|
+ <label>City *</label>
|
138
|
144
|
<propField
|
139
|
145
|
:display="property.city ? property.city.description : ''"
|
140
|
146
|
:editType="'selector'"
|
|
@@ -143,9 +149,12 @@
|
143
|
149
|
:mayEdit="mayEdit"
|
144
|
150
|
@UpdateValue="UpdateValue"
|
145
|
151
|
/>
|
|
152
|
+ <div v-if="showCityError">
|
|
153
|
+ <p class="alert myError">Please select a City</p>
|
|
154
|
+ </div>
|
146
|
155
|
</div>
|
147
|
156
|
<div class="col-md-6" style="margin-bottom: 1em">
|
148
|
|
- <label>Suburb</label>
|
|
157
|
+ <label>Suburb * </label>
|
149
|
158
|
<propField
|
150
|
159
|
:display="property.suburb ? property.suburb.description : ''"
|
151
|
160
|
:editType="'selector'"
|
|
@@ -154,6 +163,9 @@
|
154
|
163
|
:mayEdit="mayEdit"
|
155
|
164
|
@UpdateValue="UpdateValue"
|
156
|
165
|
/>
|
|
166
|
+ <div v-if="showSuburbError">
|
|
167
|
+ <p class="alert myError">Please select a suburb</p>
|
|
168
|
+ </div>
|
157
|
169
|
</div>
|
158
|
170
|
<div class="col-md-6" style="margin-bottom: 1em">
|
159
|
171
|
<label>Postal Code</label>
|
|
@@ -196,13 +208,16 @@
|
196
|
208
|
<label for="Property Description">Description</label>
|
197
|
209
|
<vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
|
198
|
210
|
<br />
|
199
|
|
- <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
|
|
211
|
+ <p>
|
|
212
|
+ * A listing fee of R380 including VAT is payable to list your Property on the
|
|
213
|
+ Uni-Vate website
|
|
214
|
+ </p>
|
200
|
215
|
</div>
|
201
|
216
|
</div>
|
202
|
217
|
<div class="form-group row" />
|
203
|
218
|
<div
|
204
|
219
|
class="col-md-6"
|
205
|
|
- v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
|
|
220
|
+ v-if="(propertyType === 'Residential') & (propertyOverviewFields.length > 0)"
|
206
|
221
|
>
|
207
|
222
|
<div v-for="(item, i) in propertyOverviewFields[0].fields" :key="item.id">
|
208
|
223
|
<label>{{ item.name }}</label>
|
|
@@ -243,6 +258,7 @@
|
243
|
258
|
@UpdateValue="UpdateValue"
|
244
|
259
|
/>
|
245
|
260
|
</div>
|
|
261
|
+ <br />
|
246
|
262
|
</div>
|
247
|
263
|
<div class="form-group row" />
|
248
|
264
|
<div class="row">
|
|
@@ -321,13 +337,27 @@
|
321
|
337
|
class="btn btn-b-n"
|
322
|
338
|
style="width: 85px; height:40px;"
|
323
|
339
|
:disabled="!mayEdit"
|
324
|
|
- >Save</button>
|
|
340
|
+ >
|
|
341
|
+ Save
|
|
342
|
+ </button>
|
325
|
343
|
<button
|
326
|
344
|
type="button"
|
327
|
345
|
@click="Close()"
|
328
|
346
|
class="btn btn-b-n"
|
329
|
347
|
style="width: 85px; height:40px;"
|
330
|
|
- >Close</button>
|
|
348
|
+ :disabled="
|
|
349
|
+ showPropertyTypeError || showProvinceError || showCityError || showSuburbError
|
|
350
|
+ "
|
|
351
|
+ >
|
|
352
|
+ Close
|
|
353
|
+ </button>
|
|
354
|
+ <div
|
|
355
|
+ v-if="showPropertyTypeError || showProvinceError || showCityError || showSuburbError"
|
|
356
|
+ >
|
|
357
|
+ <p class="alert myError">
|
|
358
|
+ Missing fields. Please fill in all required fields. Marked with *
|
|
359
|
+ </p>
|
|
360
|
+ </div>
|
331
|
361
|
<div v-if="wait" id="preloader"></div>
|
332
|
362
|
</form>
|
333
|
363
|
</div>
|
|
@@ -339,7 +369,6 @@
|
339
|
369
|
<script>
|
340
|
370
|
import { mapState, mapActions } from 'vuex';
|
341
|
371
|
import { VueEditor } from 'vue2-editor';
|
342
|
|
-import { setTimeout } from 'timers';
|
343
|
372
|
import ImageLoad from './propertyImage.vue';
|
344
|
373
|
import propField from './propertyFieldEditor.vue';
|
345
|
374
|
|
|
@@ -361,12 +390,7 @@ export default {
|
361
|
390
|
customToolbar: [
|
362
|
391
|
[{ header: [false, 1, 2, 3, 4, 5, 6] }],
|
363
|
392
|
['bold', 'italic', 'underline', 'strike'],
|
364
|
|
- [
|
365
|
|
- { align: '' },
|
366
|
|
- { align: 'center' },
|
367
|
|
- { align: 'right' },
|
368
|
|
- { align: 'justify' },
|
369
|
|
- ],
|
|
393
|
+ [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
|
370
|
394
|
[{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
|
371
|
395
|
[{ script: 'sub' }, { script: 'super' }],
|
372
|
396
|
[{ indent: '-1' }, { indent: '+1' }],
|
|
@@ -379,6 +403,10 @@ export default {
|
379
|
403
|
{ id: 'Month', description: 'Month' },
|
380
|
404
|
{ id: 'Day', description: 'Day' },
|
381
|
405
|
],
|
|
406
|
+ showPropertyTypeError: false,
|
|
407
|
+ showProvinceError: false,
|
|
408
|
+ showCityError: false,
|
|
409
|
+ showSuburbError: false,
|
382
|
410
|
};
|
383
|
411
|
},
|
384
|
412
|
methods: {
|
|
@@ -389,19 +417,13 @@ export default {
|
389
|
417
|
'getListsForPropertyEdit',
|
390
|
418
|
]),
|
391
|
419
|
...mapActions('property', ['getPropertyTypes']),
|
392
|
|
- ...mapActions('propertyEdit', [
|
393
|
|
- 'getSavedPropertyData',
|
394
|
|
- 'updateProperty',
|
395
|
|
- 'mayEditProperty',
|
396
|
|
- ]),
|
|
420
|
+ ...mapActions('propertyEdit', ['getSavedPropertyData', 'updateProperty', 'mayEditProperty']),
|
397
|
421
|
UpdateValue(item) {
|
398
|
422
|
if (item.isUDF) {
|
399
|
423
|
if (item.isPropOverview) {
|
400
|
|
- this.propertyOverviewFields[0].fields[item.arrayIndex].value = item.value;
|
|
424
|
+ this.propertyOverviewFields[0].fields[item.arrayIndex].value = item.value;
|
401
|
425
|
} else if (item.isPropOverview === false) {
|
402
|
|
- this.propertyFields[item.arrayIndex].fields[
|
403
|
|
- item.arrayItemIndex
|
404
|
|
- ].value = item.value;
|
|
426
|
+ this.propertyFields[item.arrayIndex].fields[item.arrayItemIndex].value = item.value;
|
405
|
427
|
}
|
406
|
428
|
} else if (!item.isUDF) {
|
407
|
429
|
if (item.fieldName) {
|
|
@@ -413,10 +435,15 @@ export default {
|
413
|
435
|
this.property.isSale = isSaleValue;
|
414
|
436
|
}
|
415
|
437
|
if (item.fieldName === 'propertyType') {
|
416
|
|
- this.property.propertyType = this.propertyTypes.find(
|
417
|
|
- pt => pt.description === item.value,
|
418
|
|
- );
|
419
|
|
- this.property.propertyTypeId = this.property.propertyType.id;
|
|
438
|
+ if (item.value !== '') {
|
|
439
|
+ this.property.propertyType = this.propertyTypes.find(
|
|
440
|
+ pt => pt.description === item.value,
|
|
441
|
+ );
|
|
442
|
+ this.property.propertyTypeId = this.property.propertyType.id;
|
|
443
|
+ this.showPropertyTypeError = false;
|
|
444
|
+ } else {
|
|
445
|
+ this.showPropertyTypeError = true;
|
|
446
|
+ }
|
420
|
447
|
}
|
421
|
448
|
if (item.fieldName === 'propertyName') {
|
422
|
449
|
this.property.propertyName = item.value;
|
|
@@ -435,14 +462,15 @@ export default {
|
435
|
462
|
}
|
436
|
463
|
if (item.fieldName === 'province') {
|
437
|
464
|
if (item.value !== '') {
|
438
|
|
- this.property.province = this.provinces.find(
|
439
|
|
- p => p.description === item.value,
|
440
|
|
- );
|
|
465
|
+ this.property.province = this.provinces.find(p => p.description === item.value);
|
441
|
466
|
this.property.provinceId = this.property.province.id;
|
442
|
467
|
this.getCities(Object.assign({}, { province: item.value }));
|
443
|
468
|
this.property.city = null;
|
444
|
469
|
this.property.suburb = null;
|
445
|
470
|
this.property.addressLine3 = '';
|
|
471
|
+ this.showProvinceError = false;
|
|
472
|
+ this.showCityError = true;
|
|
473
|
+ this.showSuburbError = true;
|
446
|
474
|
} else {
|
447
|
475
|
this.property.province = null;
|
448
|
476
|
this.property.city = null;
|
|
@@ -450,13 +478,12 @@ export default {
|
450
|
478
|
this.property.addressLine3 = '';
|
451
|
479
|
this.cities = [];
|
452
|
480
|
this.suburbs = [];
|
|
481
|
+ this.showProvinceError = true;
|
453
|
482
|
}
|
454
|
483
|
}
|
455
|
484
|
if (item.fieldName === 'city') {
|
456
|
485
|
if (item.value !== '') {
|
457
|
|
- const newCity = this.cities.find(
|
458
|
|
- p => p.description === item.value,
|
459
|
|
- );
|
|
486
|
+ const newCity = this.cities.find(p => p.description === item.value);
|
460
|
487
|
this.property.city = newCity;
|
461
|
488
|
this.property.cityId = newCity.id;
|
462
|
489
|
this.getSuburbs(
|
|
@@ -470,24 +497,27 @@ export default {
|
470
|
497
|
);
|
471
|
498
|
this.property.suburb = null;
|
472
|
499
|
this.property.addressLine3 = '';
|
|
500
|
+ this.showCityError = false;
|
|
501
|
+ this.showSuburbError = true;
|
473
|
502
|
} else {
|
474
|
503
|
this.property.city = null;
|
475
|
504
|
this.property.suburb = null;
|
476
|
505
|
this.property.addressLine3 = '';
|
477
|
506
|
this.suburbs = [];
|
|
507
|
+ this.showCityError = true;
|
478
|
508
|
}
|
479
|
509
|
}
|
480
|
510
|
if (item.fieldName === 'suburb') {
|
481
|
511
|
if (item.value !== '') {
|
482
|
|
- const newSuburb = this.suburbs.find(
|
483
|
|
- p => p.description === item.value,
|
484
|
|
- );
|
|
512
|
+ const newSuburb = this.suburbs.find(p => p.description === item.value);
|
485
|
513
|
this.property.suburb = newSuburb;
|
486
|
514
|
this.property.suburbId = newSuburb.id;
|
487
|
515
|
this.property.addressLine3 = this.property.suburb.postalCode;
|
|
516
|
+ this.showSuburbError = false;
|
488
|
517
|
} else {
|
489
|
518
|
this.property.suburb = null;
|
490
|
519
|
this.property.addressLine3 = '';
|
|
520
|
+ this.showSuburbError = true;
|
491
|
521
|
}
|
492
|
522
|
}
|
493
|
523
|
if (item.fieldName === 'price') {
|
|
@@ -509,8 +539,28 @@ export default {
|
509
|
539
|
this.propertyType = this.property.propertyUsageType;
|
510
|
540
|
},
|
511
|
541
|
SubmitData() {
|
512
|
|
- this.wait = true;
|
|
542
|
+ if (this.property.propertyTypeId === 0) {
|
|
543
|
+ this.showPropertyTypeError = true;
|
|
544
|
+ }
|
|
545
|
+ if (this.property.province === null) {
|
|
546
|
+ this.showProvinceError = true;
|
|
547
|
+ }
|
|
548
|
+ if (this.property.city === null) {
|
|
549
|
+ this.showCityError = true;
|
|
550
|
+ }
|
|
551
|
+ if (this.property.suburb === null) {
|
|
552
|
+ this.showSuburbError = true;
|
|
553
|
+ }
|
513
|
554
|
|
|
555
|
+ if (
|
|
556
|
+ this.showPropertyTypeError
|
|
557
|
+ || this.showProvinceError
|
|
558
|
+ || this.showCityError
|
|
559
|
+ || this.showSuburbError
|
|
560
|
+ ) {
|
|
561
|
+ return;
|
|
562
|
+ }
|
|
563
|
+ this.wait = true;
|
514
|
564
|
this.newPropertyImages.propertyId = this.property.id;
|
515
|
565
|
this.newPropertyImages.Images = [];
|
516
|
566
|
// eslint-disable-next-line no-plusplus
|
|
@@ -524,7 +574,6 @@ export default {
|
524
|
574
|
isDefault: setAsDefault,
|
525
|
575
|
});
|
526
|
576
|
}
|
527
|
|
-
|
528
|
577
|
this.property.propertyImages = this.propertyImages;
|
529
|
578
|
// eslint-disable-next-line no-plusplus
|
530
|
579
|
for (let i = 0; i < this.property.propertyImages.length; i++) {
|