Lene Scholtz 5 gadus atpakaļ
vecāks
revīzija
f00cb03884

+ 567
- 0
src/components/property/propertyCreate.vue Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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
 };

+ 4
- 3
src/router/index.js Parādīt failu

@@ -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';
@@ -137,15 +138,15 @@ export default new Router({
137 138
     {
138 139
       path: '/property/new/:saleType',
139 140
       name: 'PropertyNew',
140
-      component: PropertyEdit,
141
+      component: PropertyCreate,
141 142
     },
142 143
     {
143 144
       path: '/property/new/:propertyUsageType/:saleType',
144 145
       name: 'PropertyNewFromSearch',
145
-      component: PropertyEdit,
146
+      component: PropertyCreate,
146 147
     },
147 148
     {
148
-      path: '/property/edit/:id/:propType/:saleType',
149
+      path: '/property/edit',
149 150
       name: 'PropertyEdit',
150 151
       component: PropertyEdit,
151 152
     },

+ 8
- 2
src/store/modules/property/property.js Parādīt failu

@@ -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 Parādīt failu

@@ -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
 };

Notiek ielāde…
Atcelt
Saglabāt