|
@@ -4,9 +4,9 @@
|
4
|
4
|
<div class="container pb-5">
|
5
|
5
|
<div class="row">
|
6
|
6
|
<div class="col">
|
7
|
|
- <label v-if="!salesType" class="uniSelectLabel" for="resSaleType">Sale Type</label>
|
|
7
|
+ <label v-if="!resSalesType" class="uniSelectLabel" for="resSaleType">Sale Type</label>
|
8
|
8
|
<float-label label="Sale Type">
|
9
|
|
- <select class="form-control uniSelect mb-3" name="resSaleType" v-model="salesType">
|
|
9
|
+ <select class="form-control uniSelect mb-3" name="resSaleType" v-model="resSalesType">
|
10
|
10
|
<option value="Sale">To Sell</option>
|
11
|
11
|
<option value="Rental">To Rent</option>
|
12
|
12
|
</select>
|
|
@@ -79,7 +79,7 @@
|
79
|
79
|
margin-left: 17px;
|
80
|
80
|
background-color: white;
|
81
|
81
|
"
|
82
|
|
- >{{ salesType }} Price</label
|
|
82
|
+ >{{ resSalesType }} Price</label
|
83
|
83
|
>
|
84
|
84
|
</div>
|
85
|
85
|
<float-label label="Price">
|
|
@@ -93,7 +93,7 @@
|
93
|
93
|
/>
|
94
|
94
|
</float-label>
|
95
|
95
|
</div>
|
96
|
|
- <div v-if="salesType === 'Rental'" class="col-md-6">
|
|
96
|
+ <div v-if="resSalesType === 'Rental'" class="col-md-6">
|
97
|
97
|
<select
|
98
|
98
|
class="form-control uniSelect"
|
99
|
99
|
name="resPropertyType"
|
|
@@ -229,7 +229,7 @@
|
229
|
229
|
<div class="row">
|
230
|
230
|
<div class="col-md-12">
|
231
|
231
|
<label for="Property Description" style="font-family: 'muli'">Description:</label>
|
232
|
|
- <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
|
|
232
|
+ <vue-editor v-model="property.description" :editor-toolbar="resCustomToolbar" />
|
233
|
233
|
<br />
|
234
|
234
|
<p>
|
235
|
235
|
* A listing fee of R{{ getListingFee.amount }} including VAT is payable to list your
|
|
@@ -298,15 +298,15 @@
|
298
|
298
|
:savedImages="propertyImages"
|
299
|
299
|
@DefaultImage="UpdateDefaultImage"
|
300
|
300
|
/>
|
301
|
|
- <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
|
|
301
|
+ <button v-if="!resWait" type="button" @click="SubmitData()" class="btn-solid-blue">
|
302
|
302
|
Save
|
303
|
303
|
</button>
|
304
|
|
- <div v-if="showPropertyTypeError">
|
|
304
|
+ <div v-if="resShowPropertyTypeError">
|
305
|
305
|
<p class="alert myError">
|
306
|
306
|
Missing fields. Please fill in all required fields. Marked with *
|
307
|
307
|
</p>
|
308
|
308
|
</div>
|
309
|
|
- <div v-if="wait" id="preloader"></div>
|
|
309
|
+ <div v-if="resWait" id="preloader"></div>
|
310
|
310
|
</div>
|
311
|
311
|
</main>
|
312
|
312
|
</div>
|
|
@@ -336,13 +336,13 @@ export default {
|
336
|
336
|
},
|
337
|
337
|
data() {
|
338
|
338
|
return {
|
339
|
|
- propertyType: "Residential",
|
340
|
|
- salesType: "Rental",
|
341
|
|
- images: [],
|
342
|
|
- propertyFieldValues: [],
|
343
|
|
- defaultImage: 0,
|
344
|
|
- wait: false,
|
345
|
|
- customToolbar: [
|
|
339
|
+ resPropertyType: "Residential",
|
|
340
|
+ resSalesType: "Rental",
|
|
341
|
+ resImages: [],
|
|
342
|
+ resPropertyFieldValues: [],
|
|
343
|
+ resDefaultImage: 0,
|
|
344
|
+ resWait: false,
|
|
345
|
+ resCustomToolbar: [
|
346
|
346
|
[{ header: [false, 1, 2, 3, 4, 5, 6] }],
|
347
|
347
|
["bold", "italic", "underline", "strike"],
|
348
|
348
|
[{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
|
|
@@ -350,13 +350,10 @@ export default {
|
350
|
350
|
[{ script: "sub" }, { script: "super" }],
|
351
|
351
|
[{ indent: "-1" }, { indent: "+1" }]
|
352
|
352
|
],
|
353
|
|
- error: "",
|
354
|
|
- addressSet: false,
|
355
|
|
- showPropertyTypeError: false,
|
356
|
|
- showDateError: false,
|
357
|
|
- user: Log.getUser(),
|
358
|
|
- mayEdit: Log.isLoggedIn(),
|
359
|
|
- myprice: "0"
|
|
353
|
+ resAddressSet: false,
|
|
354
|
+ resShowPropertyTypeError: false,
|
|
355
|
+ resShowDateError: false,
|
|
356
|
+ resUser: Log.getUser()
|
360
|
357
|
};
|
361
|
358
|
},
|
362
|
359
|
methods: {
|
|
@@ -375,7 +372,7 @@ export default {
|
375
|
372
|
]),
|
376
|
373
|
...mapActions("register", ["getAgentById"]),
|
377
|
374
|
updateLocation(place) {
|
378
|
|
- this.addressSet = true;
|
|
375
|
+ this.resAddressSet = true;
|
379
|
376
|
this.property.streetNumber = place.streetNumber;
|
380
|
377
|
this.property.streetName = place.streetName;
|
381
|
378
|
this.property.suburb = place.suburb;
|
|
@@ -387,52 +384,52 @@ export default {
|
387
|
384
|
this.property.propertCoords = place.coords;
|
388
|
385
|
},
|
389
|
386
|
TypeChanged() {
|
390
|
|
- this.property.propertyUsageType = this.propertyType;
|
|
387
|
+ this.property.propertyUsageType = this.resPropertyType;
|
391
|
388
|
},
|
392
|
389
|
SubmitData() {
|
393
|
390
|
if (this.property.propertyTypeId === 0) {
|
394
|
|
- this.showPropertyTypeError = true;
|
|
391
|
+ this.resShowPropertyTypeError = true;
|
395
|
392
|
}
|
396
|
393
|
|
397
|
|
- if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
|
398
|
|
- this.showDateError = true;
|
|
394
|
+ if (this.resSalesType === "Rental" && this.property.dateAvailable === "undef") {
|
|
395
|
+ this.resShowDateError = true;
|
399
|
396
|
}
|
400
|
397
|
|
401
|
|
- if (this.showPropertyTypeError || this.showDateError) {
|
|
398
|
+ if (this.resShowPropertyTypeError || this.resShowDateError) {
|
402
|
399
|
return;
|
403
|
400
|
}
|
404
|
401
|
|
405
|
|
- this.wait = true;
|
406
|
|
- if (this.salesType === "Sale") {
|
|
402
|
+ this.resWait = true;
|
|
403
|
+ if (this.resSalesType === "Sale") {
|
407
|
404
|
this.property.isSale = true;
|
408
|
405
|
this.property.dateAvailable = new Date();
|
409
|
406
|
}
|
410
|
|
- if (this.images.length > 0) {
|
|
407
|
+ if (this.resImages.length > 0) {
|
411
|
408
|
this.property.propertyImages = [];
|
412
|
409
|
}
|
413
|
410
|
// eslint-disable-next-line no-plusplus
|
414
|
|
- for (let i = 0; i < this.images.length; i++) {
|
|
411
|
+ for (let i = 0; i < this.resImages.length; i++) {
|
415
|
412
|
let setAsDefault = false;
|
416
|
|
- if (i === this.defaultImage) {
|
|
413
|
+ if (i === this.resDefaultImage) {
|
417
|
414
|
setAsDefault = true;
|
418
|
415
|
}
|
419
|
416
|
this.property.propertyImages.push({
|
420
|
|
- image: this.images[i],
|
|
417
|
+ image: this.resImages[i],
|
421
|
418
|
isDefault: setAsDefault
|
422
|
419
|
});
|
423
|
420
|
}
|
424
|
|
- this.property.propertyUserFields = this.propertyFieldValues;
|
425
|
|
-
|
426
|
|
- if (this.user) {
|
427
|
|
- this.property.userId = this.user.id;
|
|
421
|
+ this.property.propertyUserFields = this.resPropertyFieldValues;
|
|
422
|
+ this.property.propertyUserFields.forEach(field => {
|
|
423
|
+ if (field.type === "yesno") {
|
|
424
|
+ if (field.value) {
|
|
425
|
+ field.value = "true";
|
|
426
|
+ }
|
|
427
|
+ }
|
|
428
|
+ });
|
|
429
|
+ if (this.resUser) {
|
|
430
|
+ this.property.userId = this.resUser.id;
|
428
|
431
|
}
|
429
|
|
- // this.property.propertyUserFields.forEach(item => {
|
430
|
|
- // if (item.value === true) {
|
431
|
|
- // item.value = "yes";
|
432
|
|
- // } else if (item.value === false) {
|
433
|
|
- // item.value = "no";
|
434
|
|
- // }
|
435
|
|
- // });
|
|
432
|
+
|
436
|
433
|
if (Log.getUser().role === "Agency" || Log.getUser().role === "Agent") {
|
437
|
434
|
this.retrieveAgency().then(() => {
|
438
|
435
|
this.property.agentId = this.agent[0].id;
|
|
@@ -440,6 +437,7 @@ export default {
|
440
|
437
|
});
|
441
|
438
|
}
|
442
|
439
|
//console.log(this.property);
|
|
440
|
+ //console.log(JSON.stringify(this.property));
|
443
|
441
|
this.saveProperty(this.property)
|
444
|
442
|
.then(fulfilled => {
|
445
|
443
|
this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
|
|
@@ -459,31 +457,40 @@ export default {
|
459
|
457
|
},
|
460
|
458
|
PropertyTypeSelected(item) {
|
461
|
459
|
if (item.target.options.selectedIndex > 0) {
|
462
|
|
- this.showPropertyTypeError = false;
|
|
460
|
+ this.resShowPropertyTypeError = false;
|
463
|
461
|
} else {
|
464
|
|
- this.showPropertyTypeError = true;
|
|
462
|
+ this.resShowPropertyTypeError = true;
|
465
|
463
|
}
|
466
|
464
|
},
|
467
|
465
|
loadedImages(values) {
|
468
|
|
- this.images = values;
|
|
466
|
+ this.resImages = values;
|
469
|
467
|
},
|
470
|
468
|
UpdateUserResidentialFields(item) {
|
471
|
469
|
let update = false;
|
472
|
|
- this.propertyFieldValues.forEach(element => {
|
|
470
|
+
|
|
471
|
+ this.resPropertyFieldValues.forEach(element => {
|
473
|
472
|
if (element.userDefinedFieldId === item.userDefinedFieldId) {
|
474
|
|
- element.value = item.value;
|
475
|
|
- update = true;
|
|
473
|
+ if (item.type !== "yesno") {
|
|
474
|
+ element.value = item.value;
|
|
475
|
+ update = true;
|
|
476
|
+ } else {
|
|
477
|
+ if (item.value) {
|
|
478
|
+ element.value = "true";
|
|
479
|
+ } else {
|
|
480
|
+ element.value = "false";
|
|
481
|
+ }
|
|
482
|
+ }
|
476
|
483
|
}
|
477
|
484
|
});
|
478
|
485
|
if (!update) {
|
479
|
|
- this.propertyFieldValues.push(item);
|
|
486
|
+ this.resPropertyFieldValues.push(item);
|
480
|
487
|
}
|
481
|
488
|
},
|
482
|
489
|
UpdateDefaultImage(item) {
|
483
|
|
- this.defaultImage = item;
|
|
490
|
+ this.resDefaultImage = item;
|
484
|
491
|
},
|
485
|
492
|
clearAddress() {
|
486
|
|
- this.addressSet = false;
|
|
493
|
+ this.resAddressSet = false;
|
487
|
494
|
this.property.streetNumber = undefined;
|
488
|
495
|
this.property.streetName = undefined;
|
489
|
496
|
this.property.suburb = undefined;
|
|
@@ -506,11 +513,11 @@ export default {
|
506
|
513
|
}
|
507
|
514
|
},
|
508
|
515
|
mounted() {
|
509
|
|
- this.wait = false;
|
|
516
|
+ this.resWait = false;
|
510
|
517
|
this.getProperty(0);
|
511
|
518
|
this.clearPropertyImages();
|
512
|
|
- this.images = [];
|
513
|
|
- this.defaultImage = 0;
|
|
519
|
+ this.resImages = [];
|
|
520
|
+ this.resDefaultImage = 0;
|
514
|
521
|
|
515
|
522
|
if (this.propertyOverviewFields.length > 0) {
|
516
|
523
|
this.propertyOverviewFields = [];
|
|
@@ -523,9 +530,9 @@ export default {
|
523
|
530
|
}
|
524
|
531
|
|
525
|
532
|
if (this.$route.params.propertyUsageType) {
|
526
|
|
- this.propertyType = this.$route.params.propertyUsageType;
|
|
533
|
+ this.resPropertyType = this.$route.params.propertyUsageType;
|
527
|
534
|
}
|
528
|
|
- this.salesType = this.$route.params.saleType;
|
|
535
|
+ this.resSalesType = this.$route.params.saleType;
|
529
|
536
|
|
530
|
537
|
this.getPropertyTypesRes();
|
531
|
538
|
|
|
@@ -543,27 +550,15 @@ export default {
|
543
|
550
|
...mapState("authentication", ["user"]),
|
544
|
551
|
...mapGetters("fees", ["getListingFee"]),
|
545
|
552
|
...mapState("register", ["agent"]),
|
546
|
|
- sortFields() {
|
547
|
|
- return this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
|
548
|
|
- },
|
549
|
553
|
SalesTypeChanged() {
|
550
|
|
- // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
551
|
|
- // this.propertyType = this.$route.params.propType;
|
552
|
|
- // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
553
|
|
- this.salesType = this.$route.params.saleType;
|
|
554
|
+ this.resSalesType = this.$route.params.saleType;
|
554
|
555
|
if (this.property && this.property.propertyUsageType) {
|
555
|
|
- // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
556
|
|
- this.propertyType = this.property.propertyUsageType;
|
|
556
|
+ this.resPropertyType = this.property.propertyUsageType;
|
557
|
557
|
}
|
558
|
|
-
|
559
|
558
|
if (!this.$route.query.id) {
|
560
|
|
- this.getPropertyFields(this.propertyType);
|
|
559
|
+ this.getPropertyFields(this.resPropertyType);
|
561
|
560
|
}
|
562
|
|
-
|
563
|
|
- return this.propertyType;
|
564
|
|
- },
|
565
|
|
- userFieldsArr() {
|
566
|
|
- return this.userFieldsArrFunc(this.propertyFields, 4);
|
|
561
|
+ return this.resPropertyType;
|
567
|
562
|
}
|
568
|
563
|
},
|
569
|
564
|
watch: {
|