|
@@ -53,49 +53,117 @@
|
53
|
53
|
</div>
|
54
|
54
|
</div>
|
55
|
55
|
</div>
|
|
56
|
+ <div class="form-group row">
|
|
57
|
+ <div class="col-md-4">
|
|
58
|
+ <label>Sale Type</label>
|
|
59
|
+ <propField
|
|
60
|
+ :display="property.isSale ? 'Sale' : 'Rental'"
|
|
61
|
+ :editType="'selector'"
|
|
62
|
+ :arrayObject="salesTypeArr"
|
|
63
|
+ :propertyName="'isSale'"
|
|
64
|
+ :mayEdit="mayEdit"
|
|
65
|
+ @UpdateValue="UpdateValue"
|
|
66
|
+ />
|
|
67
|
+ </div>
|
|
68
|
+ </div>
|
56
|
69
|
<div class="form-group row">
|
57
|
70
|
<div class="col-md-4">
|
58
|
71
|
<label>Property Type</label>
|
59
|
72
|
<propField
|
60
|
|
- :display="property.propertyType.description"
|
61
|
|
- :editType="'Selector'"
|
|
73
|
+ :display="property.propertyType ? property.propertyType.description : ''"
|
|
74
|
+ :editType="'selector'"
|
62
|
75
|
:arrayObject="propertyTypes"
|
|
76
|
+ :propertyName="'propertyType'"
|
|
77
|
+ :mayEdit="mayEdit"
|
|
78
|
+ @UpdateValue="UpdateValue"
|
63
|
79
|
/>
|
64
|
80
|
</div>
|
65
|
81
|
<div v-if="propertyType === 'Commercial'" class="col-md-4">
|
66
|
82
|
<label>Property Name</label>
|
67
|
|
- <propField :display="property.proeprtyName" :editType="'text'" />
|
|
83
|
+ <propField
|
|
84
|
+ :display="property.propertyName"
|
|
85
|
+ :editType="'text'"
|
|
86
|
+ :propertyName="'propertyName'"
|
|
87
|
+ :mayEdit="mayEdit"
|
|
88
|
+ @UpdateValue="UpdateValue"
|
|
89
|
+ />
|
68
|
90
|
</div>
|
69
|
91
|
<div v-if="propertyType === 'Commercial'" class="col-md-4">
|
70
|
92
|
<label>Unit</label>
|
71
|
|
- <propField :label="'Property Type'" :display="property.unit" :editType="'text'" />
|
|
93
|
+ <propField
|
|
94
|
+ :label="'Property Type'"
|
|
95
|
+ :display="property.unit"
|
|
96
|
+ :editType="'text'"
|
|
97
|
+ :propertyName="'unit'"
|
|
98
|
+ :mayEdit="mayEdit"
|
|
99
|
+ @UpdateValue="UpdateValue"
|
|
100
|
+ />
|
72
|
101
|
</div>
|
73
|
102
|
</div>
|
74
|
103
|
<div class="form-group row">
|
75
|
104
|
<div class="col-md-6" style="margin-bottom: 1em">
|
76
|
105
|
<label>Street Number</label>
|
77
|
|
- <propField :display="property.addressLine1" :editType="'text'" />
|
|
106
|
+ <propField
|
|
107
|
+ :display="property.addressLine1"
|
|
108
|
+ :editType="'text'"
|
|
109
|
+ :propertyName="'addressLine1'"
|
|
110
|
+ :mayEdit="mayEdit"
|
|
111
|
+ @UpdateValue="UpdateValue"
|
|
112
|
+ />
|
78
|
113
|
</div>
|
79
|
114
|
<div class="col-md-6" style="margin-bottom: 1em">
|
80
|
115
|
<label>Street Name</label>
|
81
|
|
- <propField :display="property.addressLine2" :editType="'text'" />
|
|
116
|
+ <propField
|
|
117
|
+ :display="property.addressLine2"
|
|
118
|
+ :editType="'text'"
|
|
119
|
+ :propertyName="'addressLine2'"
|
|
120
|
+ :mayEdit="mayEdit"
|
|
121
|
+ @UpdateValue="UpdateValue"
|
|
122
|
+ />
|
82
|
123
|
</div>
|
83
|
124
|
<div class="col-md-6" style="margin-bottom: 1em">
|
84
|
125
|
<label>Province</label>
|
85
|
|
- <propField :display="property.province.description" :editType="'selector'" />
|
|
126
|
+ <propField
|
|
127
|
+ :display="property.province ? property.province.description : ''"
|
|
128
|
+ :editType="'selector'"
|
|
129
|
+ :arrayObject="provinces"
|
|
130
|
+ :propertyName="'province'"
|
|
131
|
+ :mayEdit="mayEdit"
|
|
132
|
+ @UpdateValue="UpdateValue"
|
|
133
|
+ />
|
86
|
134
|
</div>
|
87
|
135
|
|
88
|
136
|
<div class="col-md-6" style="margin-bottom: 1em">
|
89
|
137
|
<label>City</label>
|
90
|
|
- <propField :display="property.city.description" :editType="'selector'" />
|
|
138
|
+ <propField
|
|
139
|
+ :display="property.city ? property.city.description : ''"
|
|
140
|
+ :editType="'selector'"
|
|
141
|
+ :arrayObject="cities"
|
|
142
|
+ :propertyName="'city'"
|
|
143
|
+ :mayEdit="mayEdit"
|
|
144
|
+ @UpdateValue="UpdateValue"
|
|
145
|
+ />
|
91
|
146
|
</div>
|
92
|
147
|
<div class="col-md-6" style="margin-bottom: 1em">
|
93
|
148
|
<label>Suburb</label>
|
94
|
|
- <propField :display="property.suburb.description" :editType="'selector'" />
|
|
149
|
+ <propField
|
|
150
|
+ :display="property.suburb ? property.suburb.description : ''"
|
|
151
|
+ :editType="'selector'"
|
|
152
|
+ :arrayObject="suburbs"
|
|
153
|
+ :propertyName="'suburb'"
|
|
154
|
+ :mayEdit="mayEdit"
|
|
155
|
+ @UpdateValue="UpdateValue"
|
|
156
|
+ />
|
95
|
157
|
</div>
|
96
|
158
|
<div class="col-md-6" style="margin-bottom: 1em">
|
97
|
159
|
<label>Postal Code</label>
|
98
|
|
- <propField :display="property.addressLine3" :editType="'text'" />
|
|
160
|
+ <propField
|
|
161
|
+ :display="property.addressLine3"
|
|
162
|
+ :editType="'text'"
|
|
163
|
+ :propertyName="'addressLine3'"
|
|
164
|
+ :mayEdit="mayEdit"
|
|
165
|
+ @UpdateValue="UpdateValue"
|
|
166
|
+ />
|
99
|
167
|
</div>
|
100
|
168
|
</div>
|
101
|
169
|
|
|
@@ -103,11 +171,24 @@
|
103
|
171
|
<div class="col-md-6">
|
104
|
172
|
<label v-if="salesType === 'Rental'">Rental Price</label>
|
105
|
173
|
<label v-if="salesType !== 'Rental'">Sales Price</label>
|
106
|
|
- <propField :display="property.price" :editType="'number'" />
|
|
174
|
+ <propField
|
|
175
|
+ :display="String(property.price)"
|
|
176
|
+ :editType="'number'"
|
|
177
|
+ :propertyName="'price'"
|
|
178
|
+ :mayEdit="mayEdit"
|
|
179
|
+ @UpdateValue="UpdateValue"
|
|
180
|
+ />
|
107
|
181
|
</div>
|
108
|
182
|
<div class="col-md-6" v-if="salesType === 'Rental'">
|
109
|
183
|
<label>Per</label>
|
110
|
|
- <propField :display="property.pricePer" :editType="'text'" />
|
|
184
|
+ <propField
|
|
185
|
+ :display="property.pricePer"
|
|
186
|
+ :editType="'selector'"
|
|
187
|
+ :propertyName="'pricePer'"
|
|
188
|
+ :arrayObject="pricePerArr"
|
|
189
|
+ :mayEdit="mayEdit"
|
|
190
|
+ @UpdateValue="UpdateValue"
|
|
191
|
+ />
|
111
|
192
|
</div>
|
112
|
193
|
</div>
|
113
|
194
|
<div class="form-group row">
|
|
@@ -123,14 +204,24 @@
|
123
|
204
|
class="col-md-6"
|
124
|
205
|
v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
|
125
|
206
|
>
|
126
|
|
- <div v-for="item in propertyOverviewFields[0].fields" :key="item.id">
|
|
207
|
+ <div v-for="(item, i) in propertyOverviewFields[0].fields" :key="item.id">
|
127
|
208
|
<label>{{ item.name }}</label>
|
128
|
|
- <propField :display="item.value" :editType="item.type" />
|
|
209
|
+ <propField
|
|
210
|
+ :display="item.value"
|
|
211
|
+ :editType="item.type"
|
|
212
|
+ :propertyId="item.itemID"
|
|
213
|
+ :userDefinedId="item.id"
|
|
214
|
+ :isUDF="Boolean('true')"
|
|
215
|
+ :isPropOverview="Boolean('true')"
|
|
216
|
+ :mayEdit="mayEdit"
|
|
217
|
+ :arrayIndex="i"
|
|
218
|
+ @UpdateValue="UpdateValue"
|
|
219
|
+ />
|
129
|
220
|
</div>
|
130
|
221
|
</div>
|
131
|
222
|
|
132
|
223
|
<div class="form-group row" />
|
133
|
|
- <div v-for="group in propertyFields" :key="group.id">
|
|
224
|
+ <div v-for="(group, i) in propertyFields" :key="group.id">
|
134
|
225
|
<div class="row">
|
135
|
226
|
<div class="col-sm-12">
|
136
|
227
|
<div class="title-box-d">
|
|
@@ -138,16 +229,20 @@
|
138
|
229
|
</div>
|
139
|
230
|
</div>
|
140
|
231
|
</div>
|
141
|
|
- <div v-for="field in group.fields" :key="field.id">
|
|
232
|
+ <div v-for="(field, ii) in group.fields" :key="field.id">
|
142
|
233
|
<label>{{ field.name }}</label>
|
143
|
|
- <propField :display="field.value" :editType="field.type" />
|
|
234
|
+ <propField
|
|
235
|
+ :display="field.value"
|
|
236
|
+ :editType="field.type"
|
|
237
|
+ :propertyId="field.itemID"
|
|
238
|
+ :userDefinedId="field.id"
|
|
239
|
+ :isUDF="Boolean('true')"
|
|
240
|
+ :arrayIndex="i"
|
|
241
|
+ :arrayItemIndex="ii"
|
|
242
|
+ :mayEdit="mayEdit"
|
|
243
|
+ @UpdateValue="UpdateValue"
|
|
244
|
+ />
|
144
|
245
|
</div>
|
145
|
|
- <!-- <UserField
|
146
|
|
- :fields="item.fields"
|
147
|
|
- :id="item.name"
|
148
|
|
- @UpdateUserDefinedFields="UpdateUserDefinedFields"
|
149
|
|
- :fieldValues="item.fields"
|
150
|
|
- />-->
|
151
|
246
|
</div>
|
152
|
247
|
<div class="form-group row" />
|
153
|
248
|
<div class="row">
|
|
@@ -160,13 +255,25 @@
|
160
|
255
|
<div class="form-group row">
|
161
|
256
|
<div class="col-md-12">
|
162
|
257
|
<label>Virtual Tour (URL)</label>
|
163
|
|
- <propField :display="property.virtualTour" :editType="'text'" />
|
|
258
|
+ <propField
|
|
259
|
+ :display="property.virtualTour"
|
|
260
|
+ :editType="'text'"
|
|
261
|
+ :propertyName="'virtualTour'"
|
|
262
|
+ :mayEdit="mayEdit"
|
|
263
|
+ @UpdateValue="UpdateValue"
|
|
264
|
+ />
|
164
|
265
|
</div>
|
165
|
266
|
</div>
|
166
|
267
|
<div class="form-group row">
|
167
|
268
|
<div class="col-md-12">
|
168
|
269
|
<label>Video (URL)</label>
|
169
|
|
- <propField :display="property.video" :editType="'text'" />
|
|
270
|
+ <propField
|
|
271
|
+ :display="property.video"
|
|
272
|
+ :editType="'text'"
|
|
273
|
+ :propertyName="'video'"
|
|
274
|
+ :mayEdit="mayEdit"
|
|
275
|
+ @UpdateValue="UpdateValue"
|
|
276
|
+ />
|
170
|
277
|
</div>
|
171
|
278
|
</div>
|
172
|
279
|
<div class="form-group row">
|
|
@@ -176,20 +283,46 @@
|
176
|
283
|
</div>
|
177
|
284
|
</div>
|
178
|
285
|
<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;" />
|
|
286
|
+ <div class="col-md-2" v-for="(img, i) in propertyImages" :key="i">
|
|
287
|
+ <input
|
|
288
|
+ v-if="mayEdit"
|
|
289
|
+ type="checkbox"
|
|
290
|
+ id="checkbox"
|
|
291
|
+ v-model="img.isDefault"
|
|
292
|
+ :disabled="img.isDeleted"
|
|
293
|
+ />
|
|
294
|
+ <label v-if="mayEdit" for="checkbox" style="margin: 10px;">Main Image</label>
|
|
295
|
+ <br />
|
|
296
|
+ <img
|
|
297
|
+ :src="img.image"
|
|
298
|
+ style="height:200px; width:150px; object-fit: cover;"
|
|
299
|
+ :class="[img.isDeleted ? 'opacity' : '']"
|
|
300
|
+ />
|
|
301
|
+ <span
|
|
302
|
+ v-if="!img.isDeleted && mayEdit"
|
|
303
|
+ class="input-group-text"
|
|
304
|
+ align="center"
|
|
305
|
+ @click="DeleteImage(img)"
|
|
306
|
+ >
|
|
307
|
+ <eva-icon name="trash-2-outline" fill="#60CBEB"></eva-icon>Delete
|
|
308
|
+ </span>
|
181
|
309
|
</div>
|
182
|
310
|
</div>
|
183
|
|
- <ImageLoad :loadedImages="loadedImages" @DefaultImage="UpdateDefaultImage" />
|
|
311
|
+
|
|
312
|
+ <ImageLoad
|
|
313
|
+ :loadedImages="loadedImages"
|
|
314
|
+ @DefaultImage="UpdateDefaultImage"
|
|
315
|
+ :mayEdit="mayEdit"
|
|
316
|
+ />
|
184
|
317
|
<button
|
185
|
318
|
v-if="!wait"
|
186
|
319
|
type="button"
|
187
|
320
|
@click="SubmitData()"
|
188
|
321
|
class="btn btn-b-n"
|
189
|
322
|
style="width: 85px; height:40px;"
|
|
323
|
+ :disabled="!mayEdit"
|
190
|
324
|
>Save</button>
|
191
|
325
|
<button
|
192
|
|
- v-if="isEdit"
|
193
|
326
|
type="button"
|
194
|
327
|
@click="Close()"
|
195
|
328
|
class="btn btn-b-n"
|
|
@@ -221,8 +354,6 @@ export default {
|
221
|
354
|
return {
|
222
|
355
|
propertyType: 'Residential',
|
223
|
356
|
salesType: 'Rental',
|
224
|
|
- selectedProvince: '',
|
225
|
|
- selectedCity: '',
|
226
|
357
|
images: [],
|
227
|
358
|
propertyFieldValues: [],
|
228
|
359
|
defaultImage: 0,
|
|
@@ -240,115 +371,198 @@ export default {
|
240
|
371
|
[{ script: 'sub' }, { script: 'super' }],
|
241
|
372
|
[{ indent: '-1' }, { indent: '+1' }],
|
242
|
373
|
],
|
243
|
|
- isEdit: false,
|
|
374
|
+ salesTypeArr: [
|
|
375
|
+ { id: 1, description: 'Sale' },
|
|
376
|
+ { id: 2, description: 'Rental' },
|
|
377
|
+ ],
|
|
378
|
+ pricePerArr: [
|
|
379
|
+ { id: 'Month', description: 'Month' },
|
|
380
|
+ { id: 'Day', description: 'Day' },
|
|
381
|
+ ],
|
244
|
382
|
};
|
245
|
383
|
},
|
246
|
384
|
methods: {
|
247
|
|
- ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
|
248
|
|
- ...mapActions('property', [
|
249
|
|
- 'getPropertyTypes',
|
250
|
|
- 'getPropertyOverviewFields',
|
251
|
|
- 'getPropertyFields',
|
252
|
|
- 'saveProperty',
|
253
|
|
- 'getProperty',
|
254
|
|
- 'getPropertyImages',
|
255
|
|
- 'clearProperty',
|
256
|
|
- 'clearPropertyImages',
|
257
|
|
- 'getPropertyEditDisplay',
|
258
|
|
- 'getPropertySavedOverviewFields',
|
259
|
|
- 'getPropertySavedFields',
|
|
385
|
+ ...mapActions('searchTab', [
|
|
386
|
+ 'getProvince',
|
|
387
|
+ 'getCities',
|
|
388
|
+ 'getSuburbs',
|
|
389
|
+ 'getListsForPropertyEdit',
|
|
390
|
+ ]),
|
|
391
|
+ ...mapActions('property', ['getPropertyTypes']),
|
|
392
|
+ ...mapActions('propertyEdit', [
|
260
|
393
|
'getSavedPropertyData',
|
|
394
|
+ 'updateProperty',
|
|
395
|
+ 'mayEditProperty',
|
261
|
396
|
]),
|
|
397
|
+ UpdateValue(item) {
|
|
398
|
+ if (item.isUDF) {
|
|
399
|
+ if (item.isPropOverview) {
|
|
400
|
+ this.propertyOverviewFields[0].fields[item.arrayIndex].value = item.value;
|
|
401
|
+ } else if (item.isPropOverview === false) {
|
|
402
|
+ this.propertyFields[item.arrayIndex].fields[
|
|
403
|
+ item.arrayItemIndex
|
|
404
|
+ ].value = item.value;
|
|
405
|
+ }
|
|
406
|
+ } else if (!item.isUDF) {
|
|
407
|
+ if (item.fieldName) {
|
|
408
|
+ if (item.fieldName === 'isSale') {
|
|
409
|
+ let isSaleValue = false;
|
|
410
|
+ if (item.value === 'Sale') {
|
|
411
|
+ isSaleValue = true;
|
|
412
|
+ } else isSaleValue = false;
|
|
413
|
+ this.property.isSale = isSaleValue;
|
|
414
|
+ }
|
|
415
|
+ 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;
|
|
420
|
+ }
|
|
421
|
+ if (item.fieldName === 'propertyName') {
|
|
422
|
+ this.property.propertyName = item.value;
|
|
423
|
+ }
|
|
424
|
+ if (item.fieldName === 'unit') {
|
|
425
|
+ this.property.unit = item.value;
|
|
426
|
+ }
|
|
427
|
+ if (item.fieldName === 'addressLine1') {
|
|
428
|
+ this.property.addressLine1 = item.value;
|
|
429
|
+ }
|
|
430
|
+ if (item.fieldName === 'addressLine2') {
|
|
431
|
+ this.property.addressLine2 = item.value;
|
|
432
|
+ }
|
|
433
|
+ if (item.fieldName === 'addressLine3') {
|
|
434
|
+ this.property.addressLine3 = item.value;
|
|
435
|
+ }
|
|
436
|
+ if (item.fieldName === 'province') {
|
|
437
|
+ if (item.value !== '') {
|
|
438
|
+ this.property.province = this.provinces.find(
|
|
439
|
+ p => p.description === item.value,
|
|
440
|
+ );
|
|
441
|
+ this.property.provinceId = this.property.province.id;
|
|
442
|
+ this.getCities(Object.assign({}, { province: item.value }));
|
|
443
|
+ this.property.city = null;
|
|
444
|
+ this.property.suburb = null;
|
|
445
|
+ this.property.addressLine3 = '';
|
|
446
|
+ } else {
|
|
447
|
+ this.property.province = null;
|
|
448
|
+ this.property.city = null;
|
|
449
|
+ this.property.suburb = null;
|
|
450
|
+ this.property.addressLine3 = '';
|
|
451
|
+ this.cities = [];
|
|
452
|
+ this.suburbs = [];
|
|
453
|
+ }
|
|
454
|
+ }
|
|
455
|
+ if (item.fieldName === 'city') {
|
|
456
|
+ if (item.value !== '') {
|
|
457
|
+ const newCity = this.cities.find(
|
|
458
|
+ p => p.description === item.value,
|
|
459
|
+ );
|
|
460
|
+ this.property.city = newCity;
|
|
461
|
+ this.property.cityId = newCity.id;
|
|
462
|
+ this.getSuburbs(
|
|
463
|
+ Object.assign(
|
|
464
|
+ {},
|
|
465
|
+ {
|
|
466
|
+ province: this.property.province.description,
|
|
467
|
+ city: item.value,
|
|
468
|
+ },
|
|
469
|
+ ),
|
|
470
|
+ );
|
|
471
|
+ this.property.suburb = null;
|
|
472
|
+ this.property.addressLine3 = '';
|
|
473
|
+ } else {
|
|
474
|
+ this.property.city = null;
|
|
475
|
+ this.property.suburb = null;
|
|
476
|
+ this.property.addressLine3 = '';
|
|
477
|
+ this.suburbs = [];
|
|
478
|
+ }
|
|
479
|
+ }
|
|
480
|
+ if (item.fieldName === 'suburb') {
|
|
481
|
+ if (item.value !== '') {
|
|
482
|
+ const newSuburb = this.suburbs.find(
|
|
483
|
+ p => p.description === item.value,
|
|
484
|
+ );
|
|
485
|
+ this.property.suburb = newSuburb;
|
|
486
|
+ this.property.suburbId = newSuburb.id;
|
|
487
|
+ this.property.addressLine3 = this.property.suburb.postalCode;
|
|
488
|
+ } else {
|
|
489
|
+ this.property.suburb = null;
|
|
490
|
+ this.property.addressLine3 = '';
|
|
491
|
+ }
|
|
492
|
+ }
|
|
493
|
+ if (item.fieldName === 'price') {
|
|
494
|
+ this.property.price = item.value;
|
|
495
|
+ }
|
|
496
|
+ if (item.fieldName === 'pricePer') {
|
|
497
|
+ this.property.pricePer = item.value;
|
|
498
|
+ }
|
|
499
|
+ if (item.fieldName === 'virtualTour') {
|
|
500
|
+ this.property.virtualTour = item.value;
|
|
501
|
+ }
|
|
502
|
+ if (item.fieldName === 'video') {
|
|
503
|
+ this.property.video = item.value;
|
|
504
|
+ }
|
|
505
|
+ }
|
|
506
|
+ }
|
|
507
|
+ },
|
262
|
508
|
TypeChanged() {
|
263
|
509
|
this.propertyType = this.property.propertyUsageType;
|
264
|
510
|
},
|
265
|
511
|
SubmitData() {
|
266
|
512
|
this.wait = true;
|
267
|
|
- if (this.salesType === 'Sale') {
|
268
|
|
- this.property.isSale = true;
|
269
|
|
- }
|
|
513
|
+
|
|
514
|
+ this.newPropertyImages.propertyId = this.property.id;
|
|
515
|
+ this.newPropertyImages.Images = [];
|
270
|
516
|
// eslint-disable-next-line no-plusplus
|
271
|
517
|
for (let i = 0; i < this.images.length; i++) {
|
272
|
518
|
let setAsDefault = false;
|
273
|
519
|
if (i === this.defaultImage) {
|
274
|
520
|
setAsDefault = true;
|
275
|
521
|
}
|
276
|
|
- this.property.propertyImages.push({
|
|
522
|
+ this.newPropertyImages.images.push({
|
277
|
523
|
image: this.images[i],
|
278
|
524
|
isDefault: setAsDefault,
|
279
|
525
|
});
|
280
|
526
|
}
|
281
|
|
- this.property.propertyUserFields = this.propertyFieldValues;
|
282
|
527
|
|
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);
|
|
528
|
+ this.property.propertyImages = this.propertyImages;
|
|
529
|
+ // eslint-disable-next-line no-plusplus
|
|
530
|
+ for (let i = 0; i < this.property.propertyImages.length; i++) {
|
|
531
|
+ this.property.propertyImages[i].image = '';
|
298
|
532
|
}
|
|
533
|
+ this.property.propertyOverviewFields = this.propertyOverviewFields;
|
|
534
|
+ this.property.propertyFields = this.propertyFields;
|
|
535
|
+ this.updateProperty({
|
|
536
|
+ property: this.property,
|
|
537
|
+ images: this.newPropertyImages,
|
|
538
|
+ });
|
|
539
|
+
|
|
540
|
+ // console.log(JSON.stringify(this.newPropertyImages));
|
|
541
|
+
|
|
542
|
+ // Need to change to promis.
|
|
543
|
+ setTimeout(
|
|
544
|
+ () => this.$router.push({
|
|
545
|
+ path: '/property/admin/list/my',
|
|
546
|
+ }),
|
|
547
|
+ 5000,
|
|
548
|
+ );
|
299
|
549
|
},
|
300
|
550
|
Close() {
|
301
|
551
|
this.$router.push('/property/admin/list/my');
|
302
|
552
|
},
|
303
|
|
- ProvinceSelected(item) {
|
304
|
|
- if (item.target.options.selectedIndex > 0) {
|
305
|
|
- this.selectedProvince = this.provinces[
|
306
|
|
- item.target.options.selectedIndex - 1
|
307
|
|
- ].description;
|
308
|
|
- this.getCities(Object.assign({}, { province: this.selectedProvince }));
|
309
|
|
- }
|
310
|
|
- },
|
311
|
|
- CitySelected(item) {
|
312
|
|
- if (item.target.options.selectedIndex > 0) {
|
313
|
|
- this.selectedCity = this.cities[
|
314
|
|
- item.target.options.selectedIndex - 1
|
315
|
|
- ].description;
|
316
|
|
- this.getSuburbs(
|
317
|
|
- Object.assign(
|
318
|
|
- {},
|
319
|
|
- { province: this.selectedProvince, city: this.selectedCity },
|
320
|
|
- ),
|
321
|
|
- );
|
322
|
|
- }
|
323
|
|
- },
|
324
|
|
- getPostalCode(item) {
|
325
|
|
- this.property.addressLine3 = this.suburbs[
|
326
|
|
- item.target.options.selectedIndex - 1
|
327
|
|
- ].postalCode;
|
328
|
|
- },
|
329
|
553
|
loadedImages(values) {
|
330
|
554
|
this.images = values;
|
331
|
555
|
},
|
332
|
|
- UpdateUserDefinedFields(item) {
|
333
|
|
- let update = false;
|
334
|
|
- this.propertyFieldValues.forEach((element) => {
|
335
|
|
- if (element.userDefinedFieldId === item.userDefinedFieldId) {
|
336
|
|
- element.value = item.value;
|
337
|
|
- update = true;
|
338
|
|
- }
|
339
|
|
- });
|
340
|
|
- if (!update) {
|
341
|
|
- this.propertyFieldValues.push(item);
|
342
|
|
- }
|
343
|
|
- },
|
344
|
556
|
UpdateDefaultImage(item) {
|
345
|
557
|
this.defaultImage = item;
|
346
|
558
|
},
|
|
559
|
+ DeleteImage(image) {
|
|
560
|
+ this.propertyImages.find(item => item.id === image.id).isDeleted = true;
|
|
561
|
+ },
|
347
|
562
|
},
|
348
|
563
|
mounted() {
|
|
564
|
+ // Need to check this can remove unused code
|
349
|
565
|
this.wait = false;
|
350
|
|
- this.clearProperty();
|
351
|
|
- this.clearPropertyImages();
|
352
|
566
|
this.images = [];
|
353
|
567
|
this.defaultImage = 0;
|
354
|
568
|
|
|
@@ -369,39 +583,32 @@ export default {
|
369
|
583
|
|
370
|
584
|
this.getPropertyTypes(this.propertyType);
|
371
|
585
|
|
372
|
|
- this.getProvince();
|
373
|
|
- if (this.$route.query.id) {
|
374
|
|
- this.getSavedPropertyData(
|
375
|
|
- Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
|
376
|
|
- );
|
377
|
|
- this.isEdit = true;
|
378
|
|
- } else {
|
379
|
|
- this.getPropertyOverviewFields();
|
380
|
|
- this.getPropertyFields(this.propertyType);
|
381
|
|
- }
|
|
586
|
+ this.getListsForPropertyEdit(this.$route.query.id);
|
|
587
|
+
|
|
588
|
+ this.getSavedPropertyData(
|
|
589
|
+ Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
|
|
590
|
+ );
|
|
591
|
+
|
|
592
|
+ this.mayEditProperty(this.$route.query.id);
|
382
|
593
|
},
|
383
|
594
|
computed: {
|
384
|
595
|
...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
|
385
|
|
- ...mapState('property', [
|
386
|
|
- 'propertyTypes',
|
|
596
|
+ ...mapState('property', ['propertyTypes']),
|
|
597
|
+ ...mapState('propertyEdit', [
|
387
|
598
|
'propertyOverviewFields',
|
388
|
599
|
'propertyFields',
|
389
|
600
|
'property',
|
390
|
601
|
'propertyImages',
|
|
602
|
+ 'mayEdit',
|
|
603
|
+ 'newPropertyImages',
|
391
|
604
|
]),
|
392
|
605
|
...mapState('authentication', ['user']),
|
393
|
606
|
SalesTypeChanged() {
|
394
|
|
- // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
395
|
|
- // this.propertyType = this.$route.params.propType;
|
396
|
|
- // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
397
|
|
- this.salesType = this.$route.params.saleType;
|
398
|
607
|
if (this.property && this.property.propertyUsageType) {
|
399
|
608
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
400
|
609
|
this.propertyType = this.property.propertyUsageType;
|
401
|
|
- }
|
402
|
|
-
|
403
|
|
- if (!this.$route.query.id) {
|
404
|
|
- this.getPropertyFields(this.propertyType);
|
|
610
|
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
611
|
+ this.salesType = this.property.isSale ? 'Sale' : 'Rental';
|
405
|
612
|
}
|
406
|
613
|
|
407
|
614
|
this.getPropertyTypes(this.propertyType);
|
|
@@ -416,3 +623,13 @@ export default {
|
416
|
623
|
},
|
417
|
624
|
};
|
418
|
625
|
</script>
|
|
626
|
+
|
|
627
|
+<style>
|
|
628
|
+span {
|
|
629
|
+ cursor: pointer;
|
|
630
|
+}
|
|
631
|
+.opacity {
|
|
632
|
+ opacity: 0.5;
|
|
633
|
+ filter: alpha(opacity=50);
|
|
634
|
+}
|
|
635
|
+</style>
|