|
@@ -193,13 +193,13 @@
|
193
|
193
|
</div>
|
194
|
194
|
<div class="form-group row" />
|
195
|
195
|
<UserField
|
196
|
|
- v-if="ApiRunning & propertyType === 'Residential'"
|
197
|
|
- :fields="propValuesProp[0].fields"
|
|
196
|
+ v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
|
|
197
|
+ :fields="propertyOverviewFields[0].fields"
|
198
|
198
|
:id="overviewProps"
|
199
|
199
|
@UpdateUserDefinedFields="UpdateUserDefinedFields"
|
200
|
200
|
></UserField>
|
201
|
201
|
<div class="form-group row" />
|
202
|
|
- <div v-for="item in propertyValues" :key="item.id">
|
|
202
|
+ <div v-for="item in propertyFields" :key="item.id">
|
203
|
203
|
<div class="row">
|
204
|
204
|
<div class="col-sm-12">
|
205
|
205
|
<div class="title-box-d">
|
|
@@ -228,12 +228,6 @@
|
228
|
228
|
class="btn btn-b-n"
|
229
|
229
|
style="width: 85px; height:40px;"
|
230
|
230
|
>Save</button>
|
231
|
|
- <!-- <router-link
|
232
|
|
- to="/property/search"
|
233
|
|
- @click.stop.prevent="SubmitData()"
|
234
|
|
- class="btn btn-b"
|
235
|
|
- tag="button"
|
236
|
|
- >Save</router-link>-->
|
237
|
231
|
</form>
|
238
|
232
|
</div>
|
239
|
233
|
</div>
|
|
@@ -242,8 +236,10 @@
|
242
|
236
|
</template>
|
243
|
237
|
|
244
|
238
|
<script>
|
|
239
|
+import { mapState, mapActions } from 'vuex';
|
245
|
240
|
import UserField from './propertyUserField.vue';
|
246
|
241
|
import ImageLoad from './propertyImage.vue';
|
|
242
|
+
|
247
|
243
|
// https://vuejsexamples.com/a-vue-wrapper-around-the-trix-rich-text-editor/
|
248
|
244
|
export default {
|
249
|
245
|
name: 'PropertyEdit',
|
|
@@ -253,16 +249,8 @@ export default {
|
253
|
249
|
},
|
254
|
250
|
data() {
|
255
|
251
|
return {
|
256
|
|
- ApiRunning: true,
|
257
|
252
|
propertyType: 'Residential',
|
258
|
253
|
salesType: 'Rental',
|
259
|
|
- imageFile: '',
|
260
|
|
- provinces: [],
|
261
|
|
- cities: [],
|
262
|
|
- suburbs: [],
|
263
|
|
- propertyValues: [],
|
264
|
|
- propValuesProp: [],
|
265
|
|
- propertyTypes: [],
|
266
|
254
|
selectedProvince: '',
|
267
|
255
|
selectedCity: '',
|
268
|
256
|
property: {
|
|
@@ -287,6 +275,13 @@ export default {
|
287
|
275
|
};
|
288
|
276
|
},
|
289
|
277
|
methods: {
|
|
278
|
+ ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
|
|
279
|
+ ...mapActions('property', [
|
|
280
|
+ 'getPropertyTypes',
|
|
281
|
+ 'getPropertyOverviewFields',
|
|
282
|
+ 'getPropertyFields',
|
|
283
|
+ 'saveProperty',
|
|
284
|
+ ]),
|
290
|
285
|
SubmitData() {
|
291
|
286
|
let isDefault = true;
|
292
|
287
|
this.images.forEach((imagedata) => {
|
|
@@ -298,13 +293,7 @@ export default {
|
298
|
293
|
});
|
299
|
294
|
this.property.propertyUserFields = this.propertyFieldValues;
|
300
|
295
|
|
301
|
|
- const axios = require('axios');
|
302
|
|
- axios
|
303
|
|
- .post('http://localhost:57260/Property/Property', this.property)
|
304
|
|
- .then((response) => {})
|
305
|
|
- .catch((e) => {
|
306
|
|
- alert(e);
|
307
|
|
- });
|
|
296
|
+ this.saveProperty(Object.assign({}, { newProperty: this.property }));
|
308
|
297
|
|
309
|
298
|
this.$router.push({
|
310
|
299
|
path: '/property/search',
|
|
@@ -316,12 +305,7 @@ export default {
|
316
|
305
|
this.selectedProvince = this.provinces[
|
317
|
306
|
item.target.options.selectedIndex - 1
|
318
|
307
|
].description;
|
319
|
|
- const axios = require('axios');
|
320
|
|
- axios
|
321
|
|
- .get(
|
322
|
|
- `http://localhost:57260/region/city/getby/${this.selectedProvince}`,
|
323
|
|
- )
|
324
|
|
- .then(response => (this.cities = response.data));
|
|
308
|
+ this.getCities(Object.assign({}, { province: this.selectedProvince }));
|
325
|
309
|
}
|
326
|
310
|
},
|
327
|
311
|
CitySelected(item) {
|
|
@@ -329,12 +313,12 @@ export default {
|
329
|
313
|
this.selectedCity = this.cities[
|
330
|
314
|
item.target.options.selectedIndex - 1
|
331
|
315
|
].description;
|
332
|
|
- const axios = require('axios');
|
333
|
|
- axios
|
334
|
|
- .get(
|
335
|
|
- `http://localhost:57260/region/Suburb/${this.selectedProvince}/${this.selectedCity}`,
|
336
|
|
- )
|
337
|
|
- .then(response => (this.suburbs = response.data));
|
|
316
|
+ this.getSuburbs(
|
|
317
|
+ Object.assign(
|
|
318
|
+ {},
|
|
319
|
+ { province: this.selectedProvince, city: this.selectedCity },
|
|
320
|
+ ),
|
|
321
|
+ );
|
338
|
322
|
}
|
339
|
323
|
},
|
340
|
324
|
loadedImages(values) {
|
|
@@ -357,44 +341,35 @@ export default {
|
357
|
341
|
this.propertyType = this.$route.params.propType;
|
358
|
342
|
this.salesType = this.$route.params.saleType;
|
359
|
343
|
|
360
|
|
- const axios = require('axios');
|
361
|
|
- axios
|
362
|
|
- .get('http://localhost:57260/Property/PropertyFields/Property Overview')
|
363
|
|
- .then(response => (this.propValuesProp = response.data));
|
364
|
|
-
|
365
|
|
- axios
|
366
|
|
- .get(
|
367
|
|
- `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`,
|
368
|
|
- )
|
369
|
|
- .then(response => (this.propertyValues = response.data));
|
370
|
|
-
|
371
|
|
- axios
|
372
|
|
- .get(
|
373
|
|
- `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`,
|
374
|
|
- )
|
375
|
|
- .then(response => (this.propertyTypes = response.data));
|
376
|
|
-
|
377
|
|
- axios
|
378
|
|
- .get('http://localhost:57260/region/province')
|
379
|
|
- .then(response => (this.provinces = response.data));
|
|
344
|
+ this.getProvince();
|
|
345
|
+ this.getPropertyTypes(
|
|
346
|
+ Object.assign({}, { propertyType: this.$route.params.propType }),
|
|
347
|
+ );
|
|
348
|
+ this.getPropertyOverviewFields();
|
|
349
|
+ this.getPropertyFields(
|
|
350
|
+ Object.assign({}, { propertyType: this.$route.params.propType }),
|
|
351
|
+ );
|
380
|
352
|
},
|
381
|
353
|
computed: {
|
|
354
|
+ ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
|
|
355
|
+ ...mapState('property', [
|
|
356
|
+ 'propertyTypes',
|
|
357
|
+ 'propertyOverviewFields',
|
|
358
|
+ 'propertyFields',
|
|
359
|
+ ]),
|
382
|
360
|
SalesTypeChanged() {
|
|
361
|
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
383
|
362
|
this.propertyType = this.$route.params.propType;
|
|
363
|
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
384
|
364
|
this.salesType = this.$route.params.saleType;
|
385
|
365
|
|
386
|
|
- const axios = require('axios');
|
387
|
|
- axios
|
388
|
|
- .get(
|
389
|
|
- `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`,
|
390
|
|
- )
|
391
|
|
- .then(response => (this.propertyTypes = response.data));
|
|
366
|
+ this.getPropertyTypes(
|
|
367
|
+ Object.assign({}, { propertyType: this.$route.params.propType }),
|
|
368
|
+ );
|
392
|
369
|
|
393
|
|
- axios
|
394
|
|
- .get(
|
395
|
|
- `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`,
|
396
|
|
- )
|
397
|
|
- .then(response => (this.propertyValues = response.data));
|
|
370
|
+ this.getPropertyFields(
|
|
371
|
+ Object.assign({}, { propertyType: this.$route.params.propType }),
|
|
372
|
+ );
|
398
|
373
|
|
399
|
374
|
return this.propertyType;
|
400
|
375
|
},
|