Browse Source

Univate.2 Admin pages for Commercial & Residential

master
George Williams 4 years ago
parent
commit
c33e91f388

BIN
public/img/icons/Download-grey.png View File


BIN
public/img/icons/Download.png View File


BIN
public/img/icons/Edit.png View File


BIN
public/img/icons/Upload.png View File


BIN
public/img/icons/delete.png View File


+ 19
- 0
src/components/admin/property/propertyAdmin.vue View File

@@ -0,0 +1,19 @@
1
+<template>
2
+  <div>
3
+    <main id="main">
4
+      <propertyList />
5
+    </main>
6
+  </div>
7
+</template>
8
+
9
+<script>
10
+/* eslint-disable */
11
+import propertyList from "./propertyList";
12
+export default {
13
+  components: {
14
+    propertyList
15
+  }
16
+};
17
+</script>
18
+
19
+<style lang="scss" scoped></style>

+ 177
- 0
src/components/admin/property/propertyList.vue View File

@@ -0,0 +1,177 @@
1
+<template>
2
+  <section id="contact2">
3
+    <div class="container">
4
+      <div class="section-header">
5
+        <h1>Property Admin</h1>
6
+      </div>
7
+      <div class="row">
8
+        <div class="col-lg-6 offset-3">
9
+          <input class="form-control uniSelect" type="text" placeholder="SEARCH" v-model="filter" />
10
+        </div>
11
+      </div>
12
+      <div class="row">
13
+        <br />
14
+      </div>
15
+      <div class="row">
16
+        <div class="col-lg-12">
17
+          <table class="table table-striped table-responsive">
18
+            <thead>
19
+              <tr>
20
+                <th scope="col">Owner</th>
21
+                <th scope="col">Reference</th>
22
+                <th scope="col">Property</th>
23
+                <th scope="col">Unit</th>
24
+                <th scope="col">Size</th>
25
+                <th scope="col">Price Ex VAT</th>
26
+                <th scope="col">Region</th>
27
+                <th scope="col">Town</th>
28
+                <th scope="col">Suburb</th>
29
+                <th scope="col">Status</th>
30
+                <th scope="col">Type</th>
31
+                <th scope="col">Publish</th>
32
+                <th scope="col">Edit</th>
33
+                <th scope="col">Delete</th>
34
+              </tr>
35
+            </thead>
36
+            <tbody>
37
+              <tr v-for="(item, i) in FilteredProperties" :key="i">
38
+                <td>{{ item.owner }}</td>
39
+                <td>{{ item.reference }}</td>
40
+                <td>{{ item.property }}</td>
41
+                <td>{{ item.unit }}</td>
42
+                <td>{{ item.size }}</td>
43
+                <td>{{ item.price | toCurrency }}</td>
44
+                <td>{{ item.region }}</td>
45
+                <td>{{ item.town }}</td>
46
+                <td>{{ item.suburb }}</td>
47
+                <td>{{ item.status }}</td>
48
+                <td>{{ item.type }}</td>
49
+                <td v-if="!item.isPublished">
50
+                  <a v-on:click="Publish(item)">
51
+                    <img src="../../../../public/img/icons/Upload.png" height="25" width="25" />
52
+                  </a>
53
+                </td>
54
+                <td v-else>
55
+                  <a v-on:click="Unpublish(item)">
56
+                    <img
57
+                      src="../../../../public/img/icons/Download-grey.png"
58
+                      height="25"
59
+                      width="25"
60
+                    />
61
+                  </a>
62
+                </td>
63
+                <td>
64
+                  <a v-on:click="Edit(item)">
65
+                    <img src="../../../../public/img/icons/Edit.png" height="25" width="25" />
66
+                  </a>
67
+                </td>
68
+                <td>
69
+                  <a v-on:click="Delete(item)">
70
+                    <img src="../../../../public/img/icons/delete.png" height="25" width="25" />
71
+                  </a>
72
+                </td>
73
+              </tr>
74
+            </tbody>
75
+          </table>
76
+        </div>
77
+      </div>
78
+      <div v-if="wait" id="preloader"></div>
79
+    </div>
80
+  </section>
81
+</template>
82
+
83
+<script>
84
+import { mapState, mapActions } from "vuex";
85
+import Log from "../../../assets/Log";
86
+import _ from "lodash";
87
+
88
+export default {
89
+  data() {
90
+    return {
91
+      filter: undefined,
92
+      userId: Log.getUser().id,
93
+      wait: true,
94
+    };
95
+  },
96
+  methods: {
97
+    ...mapActions("propertyList", [
98
+      "getAdminProperties",
99
+      "deleteProperty",
100
+      "publishProperty",
101
+      "unpublishProperty",
102
+    ]),
103
+    Publish(item) {
104
+      this.publishProperty(item);
105
+    },
106
+    Unpublish(item) {
107
+      this.unpublishProperty(item);
108
+    },
109
+    Edit(item) {
110
+      this.$router.push(`/property/edit/${item.id}`);
111
+    },
112
+    Delete(item) {
113
+      this.deleteProperty(item.id);
114
+    },
115
+  },
116
+  computed: {
117
+    ...mapState("propertyList", ["properties"]),
118
+    FilteredProperties() {
119
+      if (this.filter) {
120
+        const list = _.filter(this.properties, (item) =>
121
+          Object.values(item).some(
122
+            (i) =>
123
+              JSON.stringify(i)
124
+                .toLowerCase()
125
+                .indexOf(this.filter.toLowerCase()) > -1
126
+          )
127
+        );
128
+        return list;
129
+      } else {
130
+        return this.properties;
131
+      }
132
+    },
133
+  },
134
+  mounted() {
135
+    this.wait = true;
136
+    this.getAdminProperties(this.userId).then((fulfuilled) => {
137
+      this.wait = false;
138
+    });
139
+  },
140
+};
141
+</script>
142
+
143
+<style lang="scss" scoped>
144
+.refbyAgent {
145
+  will-change: transform;
146
+  transition: height 500ms;
147
+  height: 0px;
148
+}
149
+
150
+.refbyAgent--clicked {
151
+  height: 150px;
152
+}
153
+
154
+.spacebanked1 {
155
+  will-change: transform;
156
+  transition: height 500ms;
157
+  height: 0px;
158
+}
159
+
160
+.spacebanked1--clicked {
161
+  height: 150px;
162
+}
163
+
164
+.custom-file-label {
165
+  border-width: 2px;
166
+  border-color: rgb(27, 117, 187);
167
+  margin-bottom: 20px;
168
+}
169
+
170
+.custom-file-label::after {
171
+  border-left: none;
172
+  border-bottom: solid;
173
+  border-width: 2px;
174
+  border-color: rgb(27, 117, 187);
175
+  font-family: "Muli";
176
+}
177
+</style>

+ 459
- 0
src/components/property/editProperty/editProperty.vue View File

@@ -0,0 +1,459 @@
1
+<template>
2
+  <div>
3
+    <main id="main">
4
+      <section id="services">
5
+        <div class="container">
6
+          <div class="col-12">
7
+            <h1>Property Details</h1>
8
+          </div>
9
+          <main id="main" style="margin-top:-20px">
10
+            <div class="container pt-5 pb-5">
11
+              <div class="row my-3">
12
+                <div class="col-md-6">
13
+                  <select
14
+                    class="form-control uniSelect"
15
+                    v-model="property.propertyUsageType"
16
+                    @change="UpdateUsageType"
17
+                  >
18
+                    <option>Commercial</option>
19
+                    <option>Residential</option>
20
+                  </select>
21
+                </div>
22
+                <div class="col-md-6">
23
+                  <select class="form-control uniSelect" v-model="property.statusString">
24
+                    <option v-for="(item, i) in statuses" :key="i">{{ item }}</option>
25
+                  </select>
26
+                </div>
27
+              </div>
28
+              <div class="row my-3">
29
+                <div class="col-md-6">
30
+                  <div v-if="!property.propertyName">
31
+                    <label for="propertyName" class="uniSelectLabel">PROPERTY NAME</label>
32
+                  </div>
33
+                  <input
34
+                    class="form-control uniInput"
35
+                    type="text"
36
+                    name="propertyName"
37
+                    v-model="property.propertyName"
38
+                  />
39
+                </div>
40
+                <div class="col-md-6">
41
+                  <div v-if="!property.propertyRef">
42
+                    <label for="propertyName" class="uniSelectLabel">PROPERTY REFERENCE</label>
43
+                  </div>
44
+                  <input
45
+                    class="form-control uniInput"
46
+                    type="text"
47
+                    name="propertyRef"
48
+                    v-model="property.propertyRef"
49
+                  />
50
+                </div>
51
+              </div>
52
+              <div class="row my-3">
53
+                <div class="col-md-6">
54
+                  <select
55
+                    class="form-control uniSelect"
56
+                    name="propertyType"
57
+                    id="propertyType"
58
+                    v-model="property.propertyTypeId"
59
+                  >
60
+                    <option value="0">Please select type *</option>
61
+                    <option
62
+                      v-for="item in propertyTypes"
63
+                      :value="item.id"
64
+                      :key="item.id"
65
+                    >{{ item.description }}</option>
66
+                  </select>
67
+                </div>
68
+                <div v-if="property.propertyUsageType === 'Commercial'" class="col-md-2">
69
+                  <div v-if="!property.unit">
70
+                    <label for="unit" class="uniSelectLabel">UNIT</label>
71
+                  </div>
72
+                  <input
73
+                    class="form-control uniInput"
74
+                    type="text"
75
+                    name="unit"
76
+                    id="unit"
77
+                    v-model="property.unit"
78
+                  />
79
+                </div>
80
+              </div>
81
+              <div class="row my-3">
82
+                <div class="col-md-6">
83
+                  <mapSection
84
+                    v-on:map-location="updateLocation"
85
+                    :savedCoords="property.propertCoords"
86
+                  />
87
+                  <input
88
+                    type="checkbox"
89
+                    v-model="property.showAddress"
90
+                    style="margin-right: 10px; margin-top: 10px;"
91
+                  />
92
+                  <label>Show address on listing</label>
93
+                </div>
94
+                <div class="col-md-6">
95
+                  <div class="row">
96
+                    <div class="col-md-6">
97
+                      <div v-if="property.price < 1">
98
+                        <label
99
+                          for="price"
100
+                          class="uniSelectLabel"
101
+                          style="text-transform:uppercase; margin-left:17px; background-color:white"
102
+                        >{{ property.salesTypeString }} Price</label>
103
+                      </div>
104
+                      <input
105
+                        class="form-control uniInput"
106
+                        type="number"
107
+                        name="price"
108
+                        id="price"
109
+                        v-model="property.price"
110
+                      />
111
+                    </div>
112
+                    <div v-if="property.salesTypeString === 'Rental'" class="col-md-6">
113
+                      <select
114
+                        class="form-control uniSelect"
115
+                        name="propertyType"
116
+                        id="propertyType"
117
+                        v-model="property.pricePer"
118
+                      >
119
+                        <option value>Please select</option>
120
+                        <option value="Month">Month</option>
121
+                        <option value="Day">Day</option>
122
+                      </select>
123
+                    </div>
124
+                  </div>
125
+                  <div class="row my-3">
126
+                    <div class="col-md-12">
127
+                      <input
128
+                        type="date"
129
+                        class="form-control uniInput"
130
+                        name="date"
131
+                        v-model="property.dateAvailable"
132
+                      />
133
+                    </div>
134
+                  </div>
135
+                  <div class="row my-3">
136
+                    <br />
137
+                  </div>
138
+                  <div class="row my-3">
139
+                    <div class="col-md-12">
140
+                      <div v-if="!property.streetNumber">
141
+                        <label for="streetNumber" class="uniSelectLabel">STREET NUMBER</label>
142
+                      </div>
143
+                      <input
144
+                        class="form-control uniInput"
145
+                        type="text"
146
+                        name="streetNumber"
147
+                        id="unit"
148
+                        v-model="property.streetNumber"
149
+                        disabled
150
+                      />
151
+                    </div>
152
+                  </div>
153
+                  <div class="row my-3">
154
+                    <div class="col-md-12">
155
+                      <div v-if="!property.streetName">
156
+                        <label for="streetName" class="uniSelectLabel">STREET NAME</label>
157
+                      </div>
158
+                      <input
159
+                        class="form-control uniInput"
160
+                        type="text"
161
+                        name="streetName"
162
+                        id="unit"
163
+                        v-model="property.streetName"
164
+                        disabled
165
+                      />
166
+                    </div>
167
+                  </div>
168
+                  <div class="row my-3">
169
+                    <div class="col-md-12">
170
+                      <div v-if="!property.suburb">
171
+                        <label for="suburb" class="uniSelectLabel">SUBURB</label>
172
+                      </div>
173
+                      <input
174
+                        class="form-control uniInput"
175
+                        type="text"
176
+                        name="suburb"
177
+                        id="unit"
178
+                        v-model="property.suburb"
179
+                        disabled
180
+                      />
181
+                    </div>
182
+                  </div>
183
+                  <div class="row my-3">
184
+                    <div class="col-md-12">
185
+                      <div v-if="!property.city">
186
+                        <label for="city" class="uniSelectLabel">CITY</label>
187
+                      </div>
188
+                      <input
189
+                        class="form-control uniInput"
190
+                        type="text"
191
+                        name="city"
192
+                        id="unit"
193
+                        v-model="property.city"
194
+                        disabled
195
+                      />
196
+                    </div>
197
+                  </div>
198
+                  <div class="row my-3">
199
+                    <div class="col-md-12">
200
+                      <div v-if="!property.province">
201
+                        <label for="province" class="uniSelectLabel">PROVINCE</label>
202
+                      </div>
203
+                      <input
204
+                        class="form-control uniInput"
205
+                        type="text"
206
+                        name="province"
207
+                        id="unit"
208
+                        v-model="property.province"
209
+                        disabled
210
+                      />
211
+                    </div>
212
+                  </div>
213
+                  <div class="row my-3">
214
+                    <div class="col-md-12">
215
+                      <div v-if="!property.postalCode">
216
+                        <label for="postalCode" class="uniSelectLabel">POSTAL CODE</label>
217
+                      </div>
218
+                      <input
219
+                        class="form-control uniInput"
220
+                        type="text"
221
+                        name="postalCode"
222
+                        id="unit"
223
+                        v-model="property.postalCode"
224
+                        disabled
225
+                      />
226
+                    </div>
227
+                  </div>
228
+                  <div class="row my-3">
229
+                    <div class="col-md-12">
230
+                      <div v-if="!property.country">
231
+                        <label for="country" class="uniSelectLabel">COUNTRY</label>
232
+                      </div>
233
+                      <input
234
+                        class="form-control uniInput"
235
+                        type="text"
236
+                        name="country"
237
+                        id="unit"
238
+                        v-model="property.country"
239
+                        disabled
240
+                      />
241
+                    </div>
242
+                  </div>
243
+                  <div class="row my-3">
244
+                    <div class="col-md-12">
245
+                      <button
246
+                        type="button"
247
+                        @click="clearAddress()"
248
+                        class="btn-solid-blue"
249
+                      >Clear Address</button>
250
+                    </div>
251
+                  </div>
252
+                </div>
253
+              </div>
254
+              <div class="row">
255
+                <div class="col-md-12">
256
+                  <label for="Property Description" style="font-family:'muli'">Description:</label>
257
+                  <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
258
+                  <br />
259
+                  <p>
260
+                    * A listing fee of R380 including VAT is payable to list your Property on the
261
+                    Uni-Vate website
262
+                  </p>
263
+                </div>
264
+              </div>
265
+              <div class="row">
266
+                <div class="section-header">
267
+                  <h2>Property Information</h2>
268
+                </div>
269
+                <div class="row mb-3" v-for="item in propertyFields" :key="item.id">
270
+                  <div class="col-md-6" v-for="field in item.fields" :key="field.id">
271
+                    <div v-if="field.type === 'number'">
272
+                      {{ field.name }}
273
+                      <input
274
+                        type="number"
275
+                        class="form-control uniInput"
276
+                        v-model="field.value"
277
+                      />
278
+                    </div>
279
+                    <div v-else class="display:none"></div>
280
+                    <div v-if="field.type === 'yesno'">
281
+                      {{ field.name }}
282
+                      <input type="checkbox" v-model="field.value" />
283
+                    </div>
284
+                  </div>
285
+                </div>
286
+              </div>
287
+              <div class="row">
288
+                <div class="col-sm-12">
289
+                  <div class="section-header">
290
+                    <h2>Media</h2>
291
+                  </div>
292
+                </div>
293
+              </div>
294
+              <div class="form-group row">
295
+                <div class="col-md-12">
296
+                  <label class="uniSelectLabel">Virtual Tour (URL)</label>
297
+                  <div class="input-group-prepend">
298
+                    <input
299
+                      class="form-control uniInput"
300
+                      type="link"
301
+                      name="vtlink"
302
+                      id="vtlink"
303
+                      v-model="property.virtualTour"
304
+                    />
305
+                  </div>
306
+                </div>
307
+              </div>
308
+              <div class="row">
309
+                <div class="col-md-12">
310
+                  <label class="uniSelectLabel">Video (URL)</label>
311
+                  <div class="input-group-prepend">
312
+                    <input
313
+                      class="form-control uniInput"
314
+                      type="link"
315
+                      name="vlink"
316
+                      id="vlink"
317
+                      v-model="property.video"
318
+                    />
319
+                  </div>
320
+                </div>
321
+              </div>
322
+              <div class="row mt-3">
323
+                <div class="col-md-6">
324
+                  <div class="content-header">
325
+                    <h2>Images</h2>
326
+                  </div>
327
+
328
+                  <div class="input-group-prepend"></div>
329
+                </div>
330
+              </div>
331
+              <ImageLoad
332
+                :savedImaged="propertyImages"
333
+                :loadedImages="loadedImages"
334
+                @DefaultImage="UpdateDefaultImage"
335
+              />
336
+              <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
337
+              <button v-if="!wait" type="button" @click="Close()" class="btn-solid-blue">Close</button>
338
+              <div v-if="showPropertyTypeError">
339
+                <p
340
+                  class="alert myError"
341
+                >Missing fields. Please fill in all required fields. Marked with *</p>
342
+              </div>
343
+              <div v-if="!addressSet">
344
+                <p class="alert myError">Please enter an address.</p>
345
+              </div>
346
+              <div v-if="wait" id="preloader"></div>
347
+            </div>
348
+          </main>
349
+        </div>
350
+      </section>
351
+    </main>
352
+  </div>
353
+</template>
354
+
355
+<script>
356
+/* eslint-disable */
357
+import { mapState, mapActions } from "vuex";
358
+import mapSection from "../mapSection";
359
+import ImageLoad from "../propertyImage";
360
+import _ from "lodash";
361
+
362
+export default {
363
+  components: {
364
+    mapSection,
365
+    ImageLoad,
366
+  },
367
+  data() {
368
+    return {
369
+      addressSet: true,
370
+      defaultImage: 0,
371
+      images: [],
372
+      wait: false,
373
+    };
374
+  },
375
+  methods: {
376
+    ...mapActions("property", [
377
+      "getProperty",
378
+      "getPropertyTypes",
379
+      "getPropertyFields",
380
+      "updateProperty",
381
+    ]),
382
+    clearAddress() {
383
+      this.addressSet = false;
384
+      this.property.streetNumber = undefined;
385
+      this.property.streetName = undefined;
386
+      this.property.suburb = undefined;
387
+      this.property.city = undefined;
388
+      this.property.province = undefined;
389
+      this.property.country = undefined;
390
+      this.property.postalCode = undefined;
391
+      this.property.addressUrl = undefined;
392
+      this.property.propertCoords = undefined;
393
+    },
394
+    UpdateUsageType() {
395
+      this.getPropertyTypes(this.property.propertyUsageType);
396
+      this.getPropertyFields(this.property.propertyUsageType);
397
+    },
398
+    UpdateDefaultImage(item) {
399
+      this.defaultImage = item;
400
+    },
401
+    loadedImages(values) {
402
+      this.images = values;
403
+    },
404
+    SubmitData() {
405
+      this.wait = true;
406
+      this.property.propertyFields = this.propertyFields;
407
+
408
+      if (this.images.length > 0) {
409
+        this.property.newImages = [];
410
+      }
411
+      // eslint-disable-next-line no-plusplus
412
+      for (let i = 0; i < this.images.length; i++) {
413
+        let setAsDefault = false;
414
+        if (i === this.defaultImage) {
415
+          setAsDefault = true;
416
+        }
417
+        this.property.newImages.push({
418
+          image: this.images[i],
419
+          isDefault: setAsDefault,
420
+        });
421
+      }
422
+
423
+      this.updateProperty(this.property).then((fulfilled) => {
424
+        this.$router.push("/PropertyAdmin");
425
+      });
426
+    },
427
+    Close() {
428
+      this.$router.push("/PropertyAdmin");
429
+    },
430
+    updateLocation(place) {
431
+      this.addressSet = true;
432
+      this.property.streetNumber = place.streetNumber;
433
+      this.property.streetName = place.streetName;
434
+      this.property.suburb = place.suburb;
435
+      this.property.city = place.city;
436
+      this.property.province = place.province;
437
+      this.property.country = place.country;
438
+      this.property.postalCode = place.postalCode;
439
+      this.property.addressUrl = place.url;
440
+      this.property.propertCoords = place.coords;
441
+    },
442
+  },
443
+  mounted() {
444
+    this.wait = false;
445
+    this.getProperty(this.$route.params.id);
446
+  },
447
+  computed: {
448
+    ...mapState("property", [
449
+      "property",
450
+      "propertyTypes",
451
+      "propertyImages",
452
+      "propertyFields",
453
+      "statuses",
454
+    ]),
455
+  },
456
+};
457
+</script>
458
+
459
+<style lang="scss" scoped></style>

+ 18
- 0
src/components/property/mapSection.vue View File

@@ -20,6 +20,9 @@ export default {
20 20
   computed: {
21 21
     google: gmapApi,
22 22
   },
23
+  props: {
24
+    savedCoords: { default: "" },
25
+  },
23 26
   data() {
24 27
     return {
25 28
       place: null,
@@ -96,6 +99,21 @@ export default {
96 99
       });
97 100
     },
98 101
   },
102
+  watch: {
103
+    savedCoords: {
104
+      immediate: true,
105
+      handler(val, oldVal) {
106
+        if (val) {
107
+          var array = val.split(",");
108
+          this.mapCenter = {
109
+            lat: Number(array[0]),
110
+            lng: Number(array[1]),
111
+          };
112
+          this.mapZoom = 17;
113
+        }
114
+      },
115
+    },
116
+  },
99 117
 };
100 118
 </script>
101 119
 

+ 18
- 7
src/components/property/propertyImage.vue View File

@@ -30,8 +30,8 @@
30 30
         <br />
31 31
         <!-- <span class="input-group-text" align="center" style="width:150px" @click="removeImage(key)">
32 32
           <eva-icon name="trash-2-outline" fill="#60CBEB"></eva-icon>Delete
33
-        </span> -->
34
-        <button align="center" class="imageDeleteButton" @click="removeImage(key)">
33
+        </span>-->
34
+        <button align="center" class="imageDeleteButton" @click="removeImage(i)">
35 35
           <i class="fa fa-trash"></i>
36 36
         </button>
37 37
       </div>
@@ -45,13 +45,14 @@ export default {
45 45
   props: {
46 46
     loadedImages: Function,
47 47
     mayEdit: { type: Boolean, default: () => true },
48
-    allowMultiple: { type: Boolean, default: () => true }
48
+    allowMultiple: { type: Boolean, default: () => true },
49
+    savedImaged: { type: Array, default: () => [] },
49 50
   },
50 51
   data() {
51 52
     return {
52 53
       images: {},
53 54
       image: [],
54
-      imagesDefault: []
55
+      imagesDefault: [],
55 56
     };
56 57
   },
57 58
   // Commented out for now.
@@ -84,7 +85,7 @@ export default {
84 85
         const reader = new FileReader();
85 86
         var vm = this;
86 87
 
87
-        reader.onload = e => {
88
+        reader.onload = (e) => {
88 89
           vm.image.push(e.target.result);
89 90
         };
90 91
         reader.readAsDataURL(file[i]);
@@ -109,8 +110,18 @@ export default {
109 110
         }
110 111
         this.$emit("DefaultImage", index);
111 112
       }
112
-    }
113
-  }
113
+    },
114
+  },
115
+  watch: {
116
+    savedImaged: {
117
+      immediate: true,
118
+      handler(val, oldVal) {
119
+        if (val) {
120
+          this.image = val;
121
+        }
122
+      },
123
+    },
124
+  },
114 125
 };
115 126
 </script>
116 127
 

+ 3
- 0
src/components/shared/navBar.vue View File

@@ -215,6 +215,9 @@
215 215
                       <li>
216 216
                         <router-link to="/status/changeLogPage">Changes Logs</router-link>
217 217
                       </li>
218
+                      <li>
219
+                        <router-link to="/PropertyAdmin">Property Admin</router-link>
220
+                      </li>
218 221
                       <li>
219 222
                         <router-link to="/userDefinedGroups/list"
220 223
                           >Property User Defined Groups</router-link

+ 4
- 3
src/components/timeshare/resort/unit/summarySection.vue View File

@@ -35,11 +35,12 @@
35 35
             <tr>
36 36
               <td>{{ week ? week.unitNumber : "" }}</td>
37 37
               <td>{{ week ? week.weekNumber : "" }}</td>
38
-              <td>{{ week ? week.arrivalDate : "" }}</td>
38
+              <td v-if="week.arrivalDate === '0001-01-01T00:00:00'"></td>
39
+              <td v-else>{{ week.arrivalDate | toDate }}</td>
39 40
               <td>{{ week ? week.bedrooms : "" }}</td>
40 41
               <td>{{ week ? week.season : "" }}</td>
41
-              <td>R{{ week ? week.levyAmount : "" }}</td>
42
-              <td>R{{ week ? week.sellPrice : "" }}</td>
42
+              <td>{{ week ? week.levyAmount : "" | toCurrency }}</td>
43
+              <td>{{ week ? week.sellPrice : "" | toCurrency }}</td>
43 44
             </tr>
44 45
           </tbody>
45 46
         </table>

+ 6
- 6
src/router/index.js View File

@@ -17,14 +17,14 @@ import UpdateInfo from "../components/user/updateProfileInfo.vue";
17 17
 
18 18
 import PropertySearch from "../components/property/propertySearchPage.vue";
19 19
 import PropertyPage from "../components/property/propertyPage.vue";
20
-import PropertyEdit from "../components/property/propertyeditPage.vue";
20
+import PropertyEdit from "../components/property/editProperty/editProperty.vue";
21 21
 
22 22
 import PropertyCreate from "../components/property/propertyCreate.vue";
23 23
 import CommercialCreate from "../components/property/commercial/createProperty/commercialCreate.vue";
24 24
 import ResidentialCreate from "../components/property/residential/createProperty/residentialCreate.vue";
25 25
 import ListProperty from "../components/property/ListProperty/listPropertyPage.vue";
26 26
 
27
-import PropertyList from "../components/property/propertyList.vue";
27
+import PropertyAdminList from "../components/admin/property/propertyAdmin.vue";
28 28
 import PropertyTypeList from "../components/admin/property/propertyTypeList.vue";
29 29
 import PropertyType from "../components/admin/property/propertyTypeEdit.vue";
30 30
 import UserDefinedGroups from "../components/admin/property/userDefinedGroupsPage.vue";
@@ -194,14 +194,14 @@ export default new Router({
194 194
       component: PropertyCreate
195 195
     },
196 196
     {
197
-      path: "/property/edit",
197
+      path: "/property/edit/:id",
198 198
       name: "PropertyEdit",
199 199
       component: PropertyEdit
200 200
     },
201 201
     {
202
-      path: "/properties",
203
-      name: "PropertyListAdmin",
204
-      component: PropertyList
202
+      path: "/PropertyAdmin",
203
+      name: "PropertyAdminList",
204
+      component: PropertyAdminList
205 205
     },
206 206
     {
207 207
       path: "/propertyTypes/list",

+ 41
- 4
src/store/modules/property/property.js View File

@@ -1,9 +1,12 @@
1 1
 import axios from "axios";
2 2
 import { Date } from "core-js";
3
+import { result } from "lodash";
4
+import { resolve } from "core-js/fn/promise";
3 5
 
4 6
 export default {
5 7
   namespaced: true,
6 8
   state: {
9
+    statuses: [],
7 10
     property: {},
8 11
     propertyImages: [],
9 12
     propertyTypes: [],
@@ -41,15 +44,32 @@ export default {
41 44
     },
42 45
     clearPropertyImages(state) {
43 46
       state.propertyImages = [];
47
+    },
48
+    setStatuses(state, stats) {
49
+      state.statuses = stats;
44 50
     }
45 51
   },
46 52
   getters: {},
47 53
   actions: {
48
-    getProperty({ commit }, id) {
54
+    getStatuses({ commit }) {
49 55
       axios
50
-        .get(`/api/Property/getDetailed/${id}`)
51
-        .then(result => commit("setProperty", result.data))
52
-        .catch(console.error);
56
+        .get("/api/property/GetPropertyStatuses")
57
+        .then(result => commit("setStatuses", result.data));
58
+    },
59
+    getProperty({ commit, dispatch }, id) {
60
+      return new Promise((resolve, reject) => {
61
+        axios
62
+          .get(`/api/Property/getDetailed/${id}`)
63
+          .then(result => {
64
+            commit("setProperty", result.data);
65
+            dispatch("getPropertyTypes", result.data.propertyUsageType);
66
+            dispatch("getPropertyImages", result.data.id);
67
+            dispatch("getSavedPropertyFields", result.data.id);
68
+            dispatch("getStatuses");
69
+            resolve();
70
+          })
71
+          .catch(error => reject(new Error(error.message)));
72
+      });
53 73
     },
54 74
     getPropertyImages({ commit }, id) {
55 75
       axios
@@ -85,6 +105,11 @@ export default {
85 105
         .get(`/api/propertyFields/PropertyType/${propertyType}`)
86 106
         .then(response => commit("setPropertyFields", response.data));
87 107
     },
108
+    getSavedPropertyFields({ commit }, id) {
109
+      axios
110
+        .get(`/api/PropertyFields/GetSavedPropertyUserFields/${id}`)
111
+        .then(result => commit("setPropertyFields", result.data));
112
+    },
88 113
     getPropertySavedOverviewFields({ commit }, id) {
89 114
       axios
90 115
         .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${id}`)
@@ -151,6 +176,18 @@ export default {
151 176
         .get(`/api/PropertyImage/GetProperySavedImages/${id}`)
152 177
         .then(result => commit("setPropertyImages", result.data))
153 178
         .catch(console.error);
179
+    },
180
+    updateProperty({ commit }, property) {
181
+      return new Promise((resolve, reject) => {
182
+        axios
183
+          .put("/api/property", property)
184
+          .then(response => {
185
+            resolve();
186
+          })
187
+          .catch(() => {
188
+            reject(console.error);
189
+          });
190
+      });
154 191
     }
155 192
   }
156 193
 };

+ 33
- 33
src/store/modules/property/propertyAdmin.js View File

@@ -1,4 +1,4 @@
1
-import axios from 'axios';
1
+import axios from "axios";
2 2
 
3 3
 export default {
4 4
   namespaced: true,
@@ -6,19 +6,19 @@ export default {
6 6
     userDefinedGroups: [],
7 7
     userDefinedGroup: {
8 8
       id: 0,
9
-      description: '',
9
+      description: "",
10 10
       usageType: 0,
11 11
       rank: 0,
12
-      fields: [],
12
+      fields: []
13 13
     },
14 14
     userFields: [],
15 15
     userField: {
16 16
       id: 0,
17 17
       groupId: 0,
18
-      fieldName: '',
19
-      fieldType: '',
20
-      rank: 0,
21
-    },
18
+      fieldName: "",
19
+      fieldType: "",
20
+      rank: 0
21
+    }
22 22
   },
23 23
   mutations: {
24 24
     setUserDefinedGroups(state, groups) {
@@ -58,93 +58,93 @@ export default {
58 58
     clearUserGroup(state) {
59 59
       state.userDefinedGroup = {
60 60
         id: 0,
61
-        description: '',
61
+        description: "",
62 62
         usageType: 0,
63
-        rank: 0,
63
+        rank: 0
64 64
       };
65 65
     },
66 66
     clearUserField(state) {
67 67
       state.userField = {
68 68
         id: 0,
69
-        fieldName: '',
70
-        fieldType: '',
71
-        rank: 0,
69
+        fieldName: "",
70
+        fieldType: "",
71
+        rank: 0
72 72
       };
73 73
     },
74 74
     clearUserFields(state) {
75 75
       state.userFields = [];
76
-    },
76
+    }
77 77
   },
78 78
   getters: {},
79 79
   actions: {
80 80
     getUserDefinedGroups({ commit }) {
81 81
       axios
82
-        .get('/api/UserDefinedGroup')
83
-        .then(result => commit('setUserDefinedGroups', result.data))
82
+        .get("/api/UserDefinedGroup")
83
+        .then(result => commit("setUserDefinedGroups", result.data))
84 84
         .catch(console.error);
85 85
     },
86 86
     getUserDefinedGroup({ commit }, id) {
87 87
       axios
88 88
         .get(`/api/UserDefinedGroup/${id}`)
89
-        .then(result => commit('setUserDefinedGroup', result.data))
89
+        .then(result => commit("setUserDefinedGroup", result.data))
90 90
         .catch(console.error);
91 91
     },
92 92
     getUserFields({ commit }, groupId) {
93 93
       axios
94 94
         .get(`/api/UserDefinedField/group/${groupId}`)
95
-        .then(result => commit('setUserFields', result.data))
95
+        .then(result => commit("setUserFields", result.data))
96 96
         .catch(console.error);
97 97
     },
98 98
     getUserField({ commit }, id) {
99 99
       axios
100 100
         .get(`/api/UserDefinedField/${id}`)
101
-        .then(result => commit('setUserField', result.data))
101
+        .then(result => commit("setUserField", result.data))
102 102
         .catch(console.error);
103 103
     },
104 104
     saveUserDefinedGroup({ commit }, item) {
105 105
       axios
106
-        .post('/api/UserDefinedGroup', item)
107
-        .then(response => commit('addUserDefinedGroups', response.data))
106
+        .post("/api/UserDefinedGroup", item)
107
+        .then(response => commit("addUserDefinedGroups", response.data))
108 108
         .catch(console.error);
109 109
     },
110 110
     updateUserDefinedGroup({ commit }, item) {
111 111
       axios
112
-        .put('/api/UserDefinedGroup', item)
113
-        .then(response => commit('updateUserDefinedGroups', response.data))
112
+        .put("/api/UserDefinedGroup", item)
113
+        .then(response => commit("updateUserDefinedGroups", response.data))
114 114
         .catch(console.error);
115 115
     },
116 116
     saveUserField({ commit }, item) {
117 117
       axios
118
-        .post('/api/UserDefinedField', item)
119
-        .then(response => commit('addUserField', response.data))
118
+        .post("/api/UserDefinedField", item)
119
+        .then(response => commit("addUserField", response.data))
120 120
         .catch(console.error);
121 121
     },
122 122
     updateUserField({ commit }, item) {
123 123
       axios
124
-        .put('/api/UserDefinedField', item)
125
-        .then(response => commit('updateUserFields', response.data))
124
+        .put("/api/UserDefinedField", item)
125
+        .then(response => commit("updateUserFields", response.data))
126 126
         .catch(console.error);
127 127
     },
128 128
     deleteUserDefinedGroup({ commit }, id) {
129 129
       axios
130 130
         .delete(`/api/UserDefinedGroup/${id}`)
131
-        .then(result => commit('removeUserDefinedGroup', id))
131
+        .then(result => commit("removeUserDefinedGroup", id))
132 132
         .catch(console.error);
133 133
     },
134 134
     deleteUserField({ commit }, id) {
135 135
       axios
136 136
         .delete(`/api/UserDefinedField/${id}`)
137
-        .then(result => commit('removeUserField', id))
137
+        .then(result => commit("removeUserField", id))
138 138
         .catch(console.error);
139 139
     },
140 140
     clearUserGroup({ commit }) {
141
-      commit('clearUserGroup');
141
+      commit("clearUserGroup");
142 142
     },
143 143
     clearUserField({ commit }) {
144
-      commit('clearUserField');
144
+      commit("clearUserField");
145 145
     },
146 146
     clearUserFields({ commit }) {
147
-      commit('clearUserFields');
148
-    },
149
-  },
147
+      commit("clearUserFields");
148
+    }
149
+  }
150 150
 };

+ 35
- 16
src/store/modules/property/propertyLists.js View File

@@ -1,60 +1,79 @@
1
-import axios from 'axios';
1
+import axios from "axios";
2 2
 
3 3
 export default {
4 4
   namespaced: true,
5 5
   state: {
6 6
     properties: [],
7
-    propertiesLive: [],
7
+    propertiesLive: []
8 8
   },
9 9
   mutations: {
10 10
     setProperties(state, properties) {
11 11
       state.properties = properties;
12 12
     },
13 13
     removeProperties(state, id) {
14
-      state.properties.pop(state.properties.find(item => item.id === id));
14
+      let index = 0;
15
+      for (let i = 0; i < state.properties.length; i++) {
16
+        if (state.properties[i].id == id) {
17
+          index = i;
18
+        }
19
+      }
20
+      state.properties.splice(index, 1);
15 21
     },
16 22
     updatePropertyPublish(state, curItem) {
17
-      state.properties.find(item => item.id === curItem.id).publish = 'Yes';
23
+      state.properties.find(item => item.id === curItem.id).isPublished = true;
18 24
     },
19 25
     updatePropertyUnpublish(state, curItem) {
20
-      state.properties.find(item => item.id === curItem.id).publish = 'No';
26
+      state.properties.find(item => item.id === curItem.id).isPublished = false;
21 27
     },
22 28
     setLiveProperties(state, items) {
23 29
       state.propertiesLive = items;
24
-    },
30
+    }
25 31
   },
26 32
   getters: {},
27 33
   actions: {
34
+    getAdminProperties({ commit }, userId) {
35
+      return new Promise((resolve, reject) => {
36
+        axios
37
+          .get(`/api/property/GetAdminProperties/${userId}`)
38
+          .then(result => {
39
+            commit("setProperties", result.data);
40
+            resolve();
41
+          })
42
+          .catch(() => {
43
+            reject(console.error);
44
+          });
45
+      });
46
+    },
28 47
     getProperties({ commit }, item) {
29 48
       console.log(`/api/property/GetPropertyList/${item}`);
30 49
       axios
31 50
         .get(`/api/property/GetPropertyList/${item}`) // .get(`/api/property/${item.propertyType}/${item.user}`)
32
-        .then(result => commit('setProperties', result.data))
51
+        .then(result => commit("setProperties", result.data))
33 52
         .catch(console.error);
34 53
     },
35 54
     getLiveProperties({ commit }) {
36 55
       axios
37
-        .get('/api/property/GetLivePropertyList') // .get(`/api/property/${item.propertyType}/${item.user}`)
38
-        .then(result => commit('setLiveProperties', result.data))
56
+        .get("/api/property/GetLivePropertyList") // .get(`/api/property/${item.propertyType}/${item.user}`)
57
+        .then(result => commit("setLiveProperties", result.data))
39 58
         .catch(console.error);
40 59
     },
41 60
     deleteProperty({ commit }, id) {
42 61
       axios
43 62
         .delete(`/api/property/${id}`)
44
-        .then(commit('removeProperties', id))
63
+        .then(commit("removeProperties", id))
45 64
         .catch(console.error);
46 65
     },
47 66
     publishProperty({ commit }, item) {
48 67
       axios
49
-        .put('/api/property/publishproperty', item)
50
-        .then(result => commit('updatePropertyPublish', item))
68
+        .put("/api/property/publishproperty", item)
69
+        .then(result => commit("updatePropertyPublish", item))
51 70
         .catch(console.error);
52 71
     },
53 72
     unpublishProperty({ commit }, item) {
54 73
       axios
55
-        .put('/api/property/unpublishproperty', item)
56
-        .then(result => commit('updatePropertyUnpublish', item))
74
+        .put("/api/property/unpublishproperty", item)
75
+        .then(result => commit("updatePropertyUnpublish", item))
57 76
         .catch(console.error);
58
-    },
59
-  },
77
+    }
78
+  }
60 79
 };

Loading…
Cancel
Save