Selaa lähdekoodia

changes to proxy & editing + other

master
George Williams 5 vuotta sitten
vanhempi
commit
e276b9552b

+ 1
- 0
src/components/home/propertySection.vue Näytä tiedosto

15
           v-if="latestProperties.length > 0"
15
           v-if="latestProperties.length > 0"
16
           name="propertyholder"
16
           name="propertyholder"
17
           :properties="latestProperties"
17
           :properties="latestProperties"
18
+          :showSort="false"
18
         />
19
         />
19
       </div>
20
       </div>
20
     </section>
21
     </section>

+ 116
- 63
src/components/property/propertyCard.vue Näytä tiedosto

1
 <template>
1
 <template>
2
-  <div class="form-group row">
3
-    <div class="col-md-4" v-for="currentProperty in properties" :key="currentProperty.id">
4
-      <div class="card-box-a card-shadow">
5
-        <div class="img-box-a">
6
-          <img
7
-            :src="currentProperty.displayImage"
8
-            alt
9
-            class="img-a img-fluid"
10
-            style="height:466px; width:350px; object-fit: cover;"
11
-          />
12
-        </div>
13
-        <div class="card-overlay">
14
-          <div class="card-overlay-a-content">
15
-            <div class="card-header-a">
16
-              <h4 class="card-title-a">
17
-                <router-link
18
-                  :to="`/property/property/${currentProperty.id}`"
19
-                  class="link-a"
20
-                >{{ currentProperty.shortDescription }}</router-link>
21
-              </h4>
22
-              <h4 class="card-title-c">
2
+  <div>
3
+    <div class="form-group row" v-if="showSort">
4
+      <button
5
+        type="button"
6
+        class="btn btn-link font-weight-bold color-b"
7
+        style="width: 150px; height:40px;"
8
+        @click="sortNewest()"
9
+      >Newest</button>
10
+      <button
11
+        type="button"
12
+        class="btn btn-link font-weight-bold color-b"
13
+        style="width: 150px; height:40px;"
14
+        @click="sortLowPrice()"
15
+      >Lowest Price</button>
16
+      <button
17
+        type="button"
18
+        class="btn btn-link font-weight-bold color-b"
19
+        style="width: 150px; height:40px;"
20
+        @click="sortHighPrice()"
21
+      >Highest Price</button>
22
+      <hr />
23
+    </div>
24
+    <div class="form-group row">
25
+      <div class="col-md-4" v-for="currentProperty in properties" :key="currentProperty.id">
26
+        <div class="card-box-a card-shadow">
27
+          <div class="img-box-a">
28
+            <img
29
+              :src="currentProperty.displayImage"
30
+              alt
31
+              class="img-a img-fluid"
32
+              style="height:466px; width:350px; object-fit: cover;"
33
+            />
34
+          </div>
35
+          <div class="card-overlay">
36
+            <div class="card-overlay-a-content">
37
+              <div class="card-header-a">
38
+                <h4 class="card-title-a">
39
+                  <router-link
40
+                    :to="`/property/property/${currentProperty.id}`"
41
+                    class="link-a"
42
+                  >{{ currentProperty.shortDescription }}</router-link>
43
+                </h4>
44
+                <h4 class="card-title-c">
45
+                  <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
46
+                    {{ currentProperty.province }}
47
+                    <br />
48
+                    {{ currentProperty.city }}
49
+                    <br />
50
+                    {{ currentProperty.suburb }}
51
+                  </router-link>
52
+                </h4>
53
+              </div>
54
+              <div class="card-body-a">
55
+                <div class="price-box d-flex">
56
+                  <span
57
+                    v-if="currentProperty.isSale"
58
+                    class="price-a"
59
+                  >sale | {{ currentProperty.displayPrice }}</span>
60
+                  <span
61
+                    v-if="!currentProperty.isSale"
62
+                    class="price-a"
63
+                  >rent | {{ currentProperty.displayPrice }}</span>
64
+                </div>
23
                 <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
65
                 <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
24
-                  {{ currentProperty.province }}
25
-                  <br />
26
-                  {{ currentProperty.city }}
27
-                  <br />
28
-                  {{ currentProperty.suburb }}
66
+                  Click here to view
67
+                  <span class="ion-ios-arrow-forward"></span>
29
                 </router-link>
68
                 </router-link>
30
-              </h4>
31
-            </div>
32
-            <div class="card-body-a">
33
-              <div class="price-box d-flex">
34
-                <span
35
-                  v-if="currentProperty.isSale"
36
-                  class="price-a"
37
-                >sale | {{ currentProperty.displayPrice }}</span>
38
-                <span
39
-                  v-if="!currentProperty.isSale"
40
-                  class="price-a"
41
-                >rent | {{ currentProperty.displayPrice }}</span>
42
               </div>
69
               </div>
43
-              <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
44
-                Click here to view
45
-                <span class="ion-ios-arrow-forward"></span>
46
-              </router-link>
47
-            </div>
48
-            <div class="card-footer-a" v-if="currentProperty.showFooter">
49
-              <ul class="card-info d-flex justify-content-around">
50
-                <li v-if="currentProperty.area !== null">
51
-                  <h4 class="card-info-title">Area</h4>
52
-                  <span v-html="currentProperty.area"></span>
53
-                </li>
54
-                <li v-if="currentProperty.beds !== null">
55
-                  <h4 class="card-info-title">Beds</h4>
56
-                  <span>{{ currentProperty.beds }}</span>
57
-                </li>
58
-                <li v-if="currentProperty.baths !== null">
59
-                  <h4 class="card-info-title">Baths</h4>
60
-                  <span>{{ currentProperty.baths }}</span>
61
-                </li>
62
-                <li v-if="currentProperty.garages !== null">
63
-                  <h4 class="card-info-title">Garages</h4>
64
-                  <span>{{ currentProperty.garages }}</span>
65
-                </li>
66
-              </ul>
70
+              <div class="card-footer-a" v-if="currentProperty.showFooter">
71
+                <ul class="card-info d-flex justify-content-around">
72
+                  <li v-if="currentProperty.area !== null">
73
+                    <h4 class="card-info-title">Area</h4>
74
+                    <span v-html="currentProperty.area"></span>
75
+                  </li>
76
+                  <li v-if="currentProperty.beds !== null">
77
+                    <h4 class="card-info-title">Beds</h4>
78
+                    <span>{{ currentProperty.beds }}</span>
79
+                  </li>
80
+                  <li v-if="currentProperty.baths !== null">
81
+                    <h4 class="card-info-title">Baths</h4>
82
+                    <span>{{ currentProperty.baths }}</span>
83
+                  </li>
84
+                  <li v-if="currentProperty.garages !== null">
85
+                    <h4 class="card-info-title">Garages</h4>
86
+                    <span>{{ currentProperty.garages }}</span>
87
+                  </li>
88
+                </ul>
89
+              </div>
67
             </div>
90
             </div>
68
           </div>
91
           </div>
69
         </div>
92
         </div>
93
+        <br />
70
       </div>
94
       </div>
71
-      <br />
72
     </div>
95
     </div>
73
   </div>
96
   </div>
74
 </template>
97
 </template>
77
 export default {
100
 export default {
78
   props: {
101
   props: {
79
     properties: { type: Array, default: () => [] },
102
     properties: { type: Array, default: () => [] },
103
+    showSort: { type: Boolean, default: true },
104
+  },
105
+  methods: {
106
+    sortHighPrice() {
107
+      function compare(a, b) {
108
+        if (a.price < b.price) return 1;
109
+        if (a.price > b.price) return -1;
110
+        return 0;
111
+      }
112
+
113
+      return this.properties.sort(compare);
114
+    },
115
+    sortLowPrice() {
116
+      function compare(a, b) {
117
+        if (a.price < b.price) return -1;
118
+        if (a.price > b.price) return 1;
119
+        return 0;
120
+      }
121
+
122
+      return this.properties.sort(compare);
123
+    },
124
+    sortNewest() {
125
+      function compare(a, b) {
126
+        if (a.dateCreated < b.dateCreated) return 1;
127
+        if (a.dateCreated > b.dateCreated) return -1;
128
+        return 0;
129
+      }
130
+
131
+      return this.properties.sort(compare);
132
+    },
80
   },
133
   },
81
 };
134
 };
82
 </script>
135
 </script>

+ 14
- 10
src/components/property/propertyImage.vue Näytä tiedosto

31
 export default {
31
 export default {
32
   props: {
32
   props: {
33
     loadedImages: Function,
33
     loadedImages: Function,
34
-    savedImages: { type: Array, default: () => [] },
35
   },
34
   },
36
   data() {
35
   data() {
37
     return {
36
     return {
40
       imagesDefault: [],
39
       imagesDefault: [],
41
     };
40
     };
42
   },
41
   },
43
-  mounted() {
44
-    if (this.savedImages.length > 0) {
45
-      this.image = this.savedImages;
46
-    }
47
-  },
42
+  // Commented out for now.
43
+  // created() {
44
+  //   if (this.savedImages && this.savedImages.length > 0) {
45
+  //     this.savedImages.forEach((element) => {
46
+  //       this.images.push(element);
47
+  //     });
48
+  //   }
49
+  // },
48
   methods: {
50
   methods: {
49
     imagesAdd(e) {
51
     imagesAdd(e) {
50
       const files = e.target.files || e.dataTransfer.files;
52
       const files = e.target.files || e.dataTransfer.files;
79
     },
81
     },
80
 
82
 
81
     updateList(index) {
83
     updateList(index) {
82
-      for (let i = 0; i < this.imagesDefault.length; i++) {
83
-        if (i !== index) {
84
-          this.imagesDefault[i] = false;
84
+      if (this.imagesDefault) {
85
+        for (let i = 0; i < this.imagesDefault.length; i++) {
86
+          if (i !== index) {
87
+            this.imagesDefault[i] = false;
88
+          }
85
         }
89
         }
90
+        this.$emit('DefaultImage', index);
86
       }
91
       }
87
-      this.$emit('DefaultImage', index);
88
     },
92
     },
89
   },
93
   },
90
 };
94
 };

+ 29
- 12
src/components/property/propertyList.vue Näytä tiedosto

26
             <th>Type</th>
26
             <th>Type</th>
27
             <th>Publish</th>
27
             <th>Publish</th>
28
             <th>Status</th>
28
             <th>Status</th>
29
-            <th>Edit</th>
30
-            <th>Delete</th>
29
+            <th></th>
30
+            <th></th>
31
           </tr>
31
           </tr>
32
         </thead>
32
         </thead>
33
         <tbody>
33
         <tbody>
34
           <tr v-for="(item, i) in properties" :key="i">
34
           <tr v-for="(item, i) in properties" :key="i">
35
-            <td v-if="item.propertyType.usageType === 1">{{item.propertyName}}</td>
36
-            <td v-else>{{ item.shortDescription }}</td>
37
-            <td>{{item.id}}</td>
38
-            <td></td>
35
+            <td>{{ item.name }}</td>
36
+            <td>{{ item.id }}</td>
37
+            <td v-html="item.size" />
39
             <td>{{ item.price }}</td>
38
             <td>{{ item.price }}</td>
40
-            <td>{{ item.propertyType.description }}</td>
39
+            <td>{{ item.type }}</td>
41
             <td>{{ item.publish }}</td>
40
             <td>{{ item.publish }}</td>
42
-            <td>Publish</td>
41
+            <td>{{ item.status }}</td>
43
             <td>
42
             <td>
44
-              <router-link :to="`/property/${item.id}`">Edit</router-link>
43
+              <button
44
+                type="button"
45
+                @click="Edit(item)"
46
+                class="btn btn-b-n"
47
+                style="width: 85px; height:40px;"
48
+              >Edit</button>
49
+            </td>
50
+            <td>
51
+              <button type="button" class="btn btn-b-n" style="width: 85px; height:40px;">Delete</button>
45
             </td>
52
             </td>
46
-            <td>Delete</td>
47
           </tr>
53
           </tr>
48
         </tbody>
54
         </tbody>
49
       </table>
55
       </table>
64
   },
70
   },
65
   methods: {
71
   methods: {
66
     ...mapActions('propertyList', ['getProperties']),
72
     ...mapActions('propertyList', ['getProperties']),
73
+    Edit(item) {
74
+      const salesType = item.isSale ? 'Sale' : 'Rental';
75
+      this.$router.push({
76
+        path: `/property/${this.propertyType}/${salesType}`,
77
+        query: { id: item.id },
78
+      });
79
+    },
67
   },
80
   },
68
   mounted() {
81
   mounted() {
69
     this.propertyType = this.$route.params.propertyType;
82
     this.propertyType = this.$route.params.propertyType;
70
     this.user = this.$route.params.user;
83
     this.user = this.$route.params.user;
71
 
84
 
85
+    if (this.user === 'MyListings') {
86
+      this.user = 'GeorgeW';
87
+    }
88
+
72
     this.getProperties(
89
     this.getProperties(
73
       Object.assign(
90
       Object.assign(
74
         {},
91
         {},
75
         {
92
         {
76
-          propertyType: this.$route.params.propertyType,
77
-          user: this.$route.params.user,
93
+          propertyType: this.propertyType,
94
+          user: this.user,
78
         },
95
         },
79
       ),
96
       ),
80
     );
97
     );

+ 2
- 1
src/components/property/propertyPage.vue Näytä tiedosto

36
                     </div>
36
                     </div>
37
                   </div>
37
                   </div>
38
                 </div>
38
                 </div>
39
-                <div class="property-description" v-html="property ? property.description : ''" />
39
+                <div class="property-description" v-html="property.description" />
40
                 <div v-for="display in property.displayData" :key="display.id">
40
                 <div v-for="display in property.displayData" :key="display.id">
41
                   <div class="row section-t3">
41
                   <div class="row section-t3">
42
                     <div class="col-sm-12">
42
                     <div class="col-sm-12">
63
                     </div>
63
                     </div>
64
                     <div class="card-title-c align-self-center">
64
                     <div class="card-title-c align-self-center">
65
                       <h5 class="title-c">{{ formatPrice(property.price) }}</h5>
65
                       <h5 class="title-c">{{ formatPrice(property.price) }}</h5>
66
+                      <h6 v-if="property.pricePer">Per {{property.pricePer}}</h6>
66
                     </div>
67
                     </div>
67
                   </div>
68
                   </div>
68
                 </div>
69
                 </div>

+ 0
- 6
src/components/property/propertyUserField.vue Näytä tiedosto

40
   name: 'UserDefinedField',
40
   name: 'UserDefinedField',
41
   props: {
41
   props: {
42
     fields: { type: Array, default: () => [] },
42
     fields: { type: Array, default: () => [] },
43
-    SetFieldValue: Function,
44
   },
43
   },
45
   data() {
44
   data() {
46
     return {
45
     return {
56
       this.$emit('UpdateUserDefinedFields', item);
55
       this.$emit('UpdateUserDefinedFields', item);
57
     },
56
     },
58
   },
57
   },
59
-  // mounted() {
60
-  //   for (let i = 0; i < this.fields.length; i++) {
61
-  //     console.log(`${this.fields[i].name  } ${  this.fields[i].value}`);
62
-  //   }
63
-  // },
64
 };
58
 };
65
 </script>
59
 </script>

+ 53
- 26
src/components/property/propertyeditPage.vue Näytä tiedosto

170
                   class="form-control"
170
                   class="form-control"
171
                   name="propertyType"
171
                   name="propertyType"
172
                   id="propertyType"
172
                   id="propertyType"
173
-                  v-model="property.per"
173
+                  v-model="property.pricePer"
174
                 >
174
                 >
175
                   <option value>Please select</option>
175
                   <option value>Please select</option>
176
-                  <option value="month">Month</option>
177
-                  <option value="day">Day</option>
176
+                  <option value="Month">Month</option>
177
+                  <option value="Day">Day</option>
178
                 </select>
178
                 </select>
179
               </div>
179
               </div>
180
             </div>
180
             </div>
196
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
196
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
197
               :fields="propertyOverviewFields[0].fields"
197
               :fields="propertyOverviewFields[0].fields"
198
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
198
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
199
+              :id="1"
199
             ></UserField>
200
             ></UserField>
200
             <div class="form-group row" />
201
             <div class="form-group row" />
201
-            <div v-for="item in propertyFields" :key="item.id">
202
+            <div v-for="(item, i) in propertyFields" :key="item.id">
202
               <div class="row">
203
               <div class="row">
203
                 <div class="col-sm-12">
204
                 <div class="col-sm-12">
204
                   <div class="title-box-d">
205
                   <div class="title-box-d">
208
               </div>
209
               </div>
209
               <UserField
210
               <UserField
210
                 :fields="item.fields"
211
                 :fields="item.fields"
211
-                :id="item.id"
212
+                :id="item.name"
212
                 @UpdateUserDefinedFields="UpdateUserDefinedFields"
213
                 @UpdateUserDefinedFields="UpdateUserDefinedFields"
213
               />
214
               />
214
             </div>
215
             </div>
220
                 </div>
221
                 </div>
221
               </div>
222
               </div>
222
             </div>
223
             </div>
223
-            <ImageLoad
224
-              :loadedImages="loadedImages"
225
-              :savedImages="propertyImages"
226
-              @DefaultImage="UpdateDefaultImage"
227
-            />
224
+            <ImageLoad :loadedImages="loadedImages" :savedImages="propertyImages" />
228
             <button
225
             <button
226
+              v-if="!wait"
229
               type="button"
227
               type="button"
230
               @click="SubmitData()"
228
               @click="SubmitData()"
231
               class="btn btn-b-n"
229
               class="btn btn-b-n"
232
               style="width: 85px; height:40px;"
230
               style="width: 85px; height:40px;"
233
-            >Save</button>
231
+            >
232
+              <!-- <span class="spinner-border" role="status" aria-hidden="true"></span>
233
+              <span class="sr-only">Loading...</span>-->
234
+              Save
235
+            </button>
236
+            <label v-if="wait">Please wait...</label>
234
           </form>
237
           </form>
235
         </div>
238
         </div>
236
       </div>
239
       </div>
260
       images: [],
263
       images: [],
261
       propertyFieldValues: [],
264
       propertyFieldValues: [],
262
       defaultImage: 0,
265
       defaultImage: 0,
266
+      wait: false,
263
     };
267
     };
264
   },
268
   },
265
   methods: {
269
   methods: {
276
       'getPropertyEditDisplay',
280
       'getPropertyEditDisplay',
277
       'getPropertySavedOverviewFields',
281
       'getPropertySavedOverviewFields',
278
       'getPropertySavedFields',
282
       'getPropertySavedFields',
283
+      'getSavedPropertyData',
279
     ]),
284
     ]),
280
     SubmitData() {
285
     SubmitData() {
286
+      this.wait = true;
281
       for (let i = 0; i < this.images.length; i++) {
287
       for (let i = 0; i < this.images.length; i++) {
282
         let setAsDefault = false;
288
         let setAsDefault = false;
283
         if (i === this.defaultImage) {
289
         if (i === this.defaultImage) {
288
           isDefault: setAsDefault,
294
           isDefault: setAsDefault,
289
         });
295
         });
290
       }
296
       }
297
+      this.property.createdBy = 'GeorgeW';
291
 
298
 
292
       this.saveProperty(this.property);
299
       this.saveProperty(this.property);
293
 
300
 
294
-      this.$router.push({
295
-        path: '/property/search',
296
-        query: { type: this.salesType, propertyType: this.propertyType },
297
-      });
301
+      setTimeout(
302
+        () => this.$router.push({
303
+            path: '/property/search',
304
+            query: { type: this.salesType, propertyType: this.propertyType },
305
+          }),
306
+        3000,
307
+      );
298
     },
308
     },
299
     ProvinceSelected(item) {
309
     ProvinceSelected(item) {
300
       if (item.target.options.selectedIndex > 0) {
310
       if (item.target.options.selectedIndex > 0) {
337
     },
347
     },
338
   },
348
   },
339
   mounted() {
349
   mounted() {
350
+    this.wait = false;
340
     this.clearProperty();
351
     this.clearProperty();
341
     this.clearPropertyImages();
352
     this.clearPropertyImages();
342
     this.images = [];
353
     this.images = [];
343
     this.defaultImage = 0;
354
     this.defaultImage = 0;
355
+
356
+    if (this.propertyOverviewFields.length > 0) {
357
+      this.propertyOverviewFields = [];
358
+    }
359
+    if (this.propertyFields.length > 0) {
360
+      this.propertyFields = [];
361
+    }
362
+
363
+    this.propertyType = this.$route.params.propType;
364
+    this.salesType = this.$route.params.saleType;
365
+
366
+    this.getPropertyTypes(this.$route.params.propType);
367
+
368
+    this.getProvince();
369
+    if (this.$route.query.id) {
370
+      // this.getCities(Object.assign({}, { province: this.selectedProvince }));
371
+      this.getSavedPropertyData(
372
+        Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
373
+      );
374
+    } else {
375
+      this.getPropertyOverviewFields();
376
+      this.getPropertyFields(this.$route.params.propType);
377
+    }
344
     // if (this.$route.params.id) {
378
     // if (this.$route.params.id) {
345
     //   this.getPropertyEditDisplay(4); // (this.$route.params.id);
379
     //   this.getPropertyEditDisplay(4); // (this.$route.params.id);
346
     //   this.propertyType = 'Residential'; // this.propertyEditDisplay.propertyType;
380
     //   this.propertyType = 'Residential'; // this.propertyEditDisplay.propertyType;
361
 
395
 
362
     //   this.getProperty(this.$route.params.id);
396
     //   this.getProperty(this.$route.params.id);
363
     // } else {
397
     // } else {
364
-    this.propertyType = this.$route.params.propType;
365
-    this.salesType = this.$route.params.saleType;
366
 
398
 
367
-    this.getProvince();
368
-    this.getPropertyTypes(this.$route.params.propType);
369
-    this.getPropertyOverviewFields();
370
-    this.getPropertyFields(this.$route.params.propType);
371
     // }
399
     // }
372
   },
400
   },
373
   computed: {
401
   computed: {
378
       'propertyFields',
406
       'propertyFields',
379
       'property',
407
       'property',
380
       'propertyImages',
408
       'propertyImages',
381
-      'propertyEditDisplay',
382
     ]),
409
     ]),
383
     SalesTypeChanged() {
410
     SalesTypeChanged() {
384
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
411
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
385
       this.propertyType = this.$route.params.propType;
412
       this.propertyType = this.$route.params.propType;
386
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
413
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
387
       this.salesType = this.$route.params.saleType;
414
       this.salesType = this.$route.params.saleType;
388
-
389
-      this.getPropertyTypes(this.$route.params.propType);
390
-
391
-      this.getPropertyFields(this.$route.params.propType);
415
+      if (!this.$route.query.id) {
416
+        this.getPropertyTypes(this.$route.params.propType);
417
+        this.getPropertyFields(this.$route.params.propType);
418
+      }
392
 
419
 
393
       return this.propertyType;
420
       return this.propertyType;
394
     },
421
     },

+ 2
- 2
src/components/shared/navBar.vue Näytä tiedosto

96
               >To Sell</div>
96
               >To Sell</div>
97
               <div
97
               <div
98
                 class="dropdown-item cursor-pointer"
98
                 class="dropdown-item cursor-pointer"
99
-                @click="routerGoTo('/property/list/Residential/GeorgeW')"
99
+                @click="routerGoTo('/property/list/Residential/MyListings')"
100
               >My Residential Properties</div>
100
               >My Residential Properties</div>
101
               <div
101
               <div
102
                 class="dropdown-item cursor-pointer"
102
                 class="dropdown-item cursor-pointer"
129
               >To Sell</a>
129
               >To Sell</a>
130
               <a
130
               <a
131
                 class="dropdown-item cursor-pointer"
131
                 class="dropdown-item cursor-pointer"
132
-                @click="routerGoTo('/property/list/Commercial/GeorgeW')"
132
+                @click="routerGoTo('/property/list/Commercial/MyListings')"
133
               >My Commercial Properties</a>
133
               >My Commercial Properties</a>
134
               <a
134
               <a
135
                 class="dropdown-item cursor-pointer"
135
                 class="dropdown-item cursor-pointer"

+ 1
- 1
src/router/index.js Näytä tiedosto

106
       component: PropertyEdit,
106
       component: PropertyEdit,
107
     },
107
     },
108
     {
108
     {
109
-      path: '/property/:id',
109
+      path: '/property/edit/:id/:propType/:saleType',
110
       name: 'PropertyEdit',
110
       name: 'PropertyEdit',
111
       component: PropertyEdit,
111
       component: PropertyEdit,
112
     },
112
     },

+ 36
- 64
src/store/modules/property/property.js Näytä tiedosto

21
       cityId: 0,
21
       cityId: 0,
22
       provinceId: 0,
22
       provinceId: 0,
23
       published: false,
23
       published: false,
24
-      propertyType: {
25
-        description: '',
26
-        usageType: 0,
27
-        id: 2,
28
-      },
29
-      province: {
30
-        description: '',
31
-        code: '',
32
-        id: 0,
33
-      },
34
-      city: {
35
-        provinceId: 0,
36
-        description: '',
37
-        code: '',
38
-      },
39
-      suburb: {
40
-        cityId: 0,
41
-        description: '',
42
-      },
43
       propertyUserFields: [],
24
       propertyUserFields: [],
44
       propertyImages: [],
25
       propertyImages: [],
45
       id: 0,
26
       id: 0,
52
     propertyFields: [],
33
     propertyFields: [],
53
     properties: [],
34
     properties: [],
54
     latestProperties: [],
35
     latestProperties: [],
55
-    propertyEditDisplay: {
56
-      propertyType: '',
57
-      saleType: '',
58
-    },
59
   },
36
   },
60
   mutations: {
37
   mutations: {
61
     setProperty(state, property) {
38
     setProperty(state, property) {
107
         cityId: 0,
84
         cityId: 0,
108
         provinceId: 0,
85
         provinceId: 0,
109
         published: false,
86
         published: false,
110
-        propertyType: {
111
-          description: '',
112
-          usageType: 0,
113
-          id: 2,
114
-        },
115
-        province: {
116
-          description: '',
117
-          code: '',
118
-          id: 0,
119
-        },
120
-        city: {
121
-          provinceId: 0,
122
-          description: '',
123
-          code: '',
124
-        },
125
-        suburb: {
126
-          cityId: 0,
127
-          description: '',
128
-        },
129
         propertyUserFields: [],
87
         propertyUserFields: [],
130
         propertyImages: [],
88
         propertyImages: [],
131
         id: 0,
89
         id: 0,
134
     clearPropertyImages(state) {
92
     clearPropertyImages(state) {
135
       state.propertyImages = [];
93
       state.propertyImages = [];
136
     },
94
     },
137
-    setPropertyEditDisplay(state, item) {
138
-      state.propertyEditDisplay = item;
95
+    setProperties(state, properties) {
96
+      state.properties = properties;
139
     },
97
     },
140
   },
98
   },
141
   getters: {},
99
   getters: {},
142
   actions: {
100
   actions: {
143
     getProperty({ commit }, id) {
101
     getProperty({ commit }, id) {
144
       axios
102
       axios
145
-        .get(`http://192.168.6.188:5000/Property/Property/${id}`)
103
+        .get(`/api/Property/${id}`)
146
         .then(result => commit('setProperty', result.data))
104
         .then(result => commit('setProperty', result.data))
147
         .catch(console.error);
105
         .catch(console.error);
148
     },
106
     },
149
     getPropertyImages({ commit }, id) {
107
     getPropertyImages({ commit }, id) {
150
       axios
108
       axios
151
-        .get(`http://192.168.6.188:5000/property/PropertyImage/getpropertyimages/${id}`)
109
+        .get(`/api/PropertyImage/getPropertyImages/${id}`)
152
         .then(result => commit('setPropertyImages', result.data))
110
         .then(result => commit('setPropertyImages', result.data))
153
         .catch(console.error);
111
         .catch(console.error);
154
     },
112
     },
155
     getPropertyTypes({ commit }, propertyType) {
113
     getPropertyTypes({ commit }, propertyType) {
156
       axios
114
       axios
157
-        .get(`http://192.168.6.188:5000/Property/PropertyType/type/${propertyType}`)
115
+        .get(`/api/PropertyType/type/${propertyType}`)
158
         .then(result => commit('setPropertyTypes', result.data))
116
         .then(result => commit('setPropertyTypes', result.data))
159
         .catch(console.error);
117
         .catch(console.error);
160
     },
118
     },
161
     getPropertyTypesRes({ commit }) {
119
     getPropertyTypesRes({ commit }) {
162
       axios
120
       axios
163
-        .get('http://192.168.6.188:5000/Property/PropertyType/type/Residential')
121
+        .get('/api/PropertyType/type/Residential')
164
         .then(result => commit('setPropertyTypesRes', result.data))
122
         .then(result => commit('setPropertyTypesRes', result.data))
165
         .catch(console.error);
123
         .catch(console.error);
166
     },
124
     },
167
     getPropertyTypesCom({ commit }) {
125
     getPropertyTypesCom({ commit }) {
168
       axios
126
       axios
169
-        .get('http://192.168.6.188:5000/Property/PropertyType/type/Commercial')
127
+        .get('/api/PropertyType/type/Commercial')
170
         .then(result => commit('setPropertyTypesCom', result.data))
128
         .then(result => commit('setPropertyTypesCom', result.data))
171
         .catch(console.error);
129
         .catch(console.error);
172
     },
130
     },
173
     getPropertyOverviewFields({ commit }) {
131
     getPropertyOverviewFields({ commit }) {
174
       axios
132
       axios
175
-        .get('http://192.168.6.188:5000/Property/PropertyFields/Property Overview')
133
+        .get('/api/PropertyFields/Property Overview')
176
         .then(response => commit('setPropertyOverviewFields', response.data));
134
         .then(response => commit('setPropertyOverviewFields', response.data));
177
     },
135
     },
178
     getPropertyFields({ commit }, propertyType) {
136
     getPropertyFields({ commit }, propertyType) {
179
       axios
137
       axios
180
-        .get(`http://192.168.6.188:5000/property/propertyfields/Propertytype/${propertyType}`)
138
+        .get(`/api/propertyFields/PropertyType/${propertyType}`)
181
         .then(response => commit('setPropertyFields', response.data));
139
         .then(response => commit('setPropertyFields', response.data));
182
     },
140
     },
183
     getPropertySavedOverviewFields({ commit }, id) {
141
     getPropertySavedOverviewFields({ commit }, id) {
184
       axios
142
       axios
185
-        .get(
186
-          `http://192.168.6.188:5000/Property/PropertyFields/GetSavedValues/Residential/Property Overview/${id}`,
187
-        )
143
+        .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${id}`)
188
         .then(response => commit('setPropertyOverviewFields', response.data))
144
         .then(response => commit('setPropertyOverviewFields', response.data))
189
         .catch(console.error);
145
         .catch(console.error);
190
     },
146
     },
191
     getPropertySavedFields({ commit }, item) {
147
     getPropertySavedFields({ commit }, item) {
192
       axios
148
       axios
193
-        .get(
194
-          `http://192.168.6.188:5000/Property/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`,
195
-        )
149
+        .get(`/api/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`)
196
         .then(response => commit('setPropertyFields', response.data))
150
         .then(response => commit('setPropertyFields', response.data))
197
         .catch(console.error);
151
         .catch(console.error);
198
     },
152
     },
199
     saveProperty({ commit }, item) {
153
     saveProperty({ commit }, item) {
200
       axios
154
       axios
201
-        .post('http://192.168.6.188:5000/Property/Property', item)
155
+        .post('/api/Property', item)
202
         .then(result => commit('updateCurrentProperty', result.data))
156
         .then(result => commit('updateCurrentProperty', result.data))
203
         .catch(console.error);
157
         .catch(console.error);
204
     },
158
     },
205
     searchPropertiesParams({ commit }, item) {
159
     searchPropertiesParams({ commit }, item) {
206
       axios
160
       axios
207
         .get(
161
         .get(
208
-          `http://192.168.6.188:5000/Property/Property/Search/${item.type}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.propType}`,
162
+          `/api/property/search/${item.type}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.propType}`,
209
         )
163
         )
210
         .then(response => commit('updateSearch', response.data))
164
         .then(response => commit('updateSearch', response.data))
211
         .catch(console.error);
165
         .catch(console.error);
212
     },
166
     },
213
     searchPropertiesKeyword({ commit }, item) {
167
     searchPropertiesKeyword({ commit }, item) {
214
       axios
168
       axios
215
-        .get(`http://192.168.6.188:5000/Property/Property/Search/${item.keyword}`)
169
+        .get(`/api/Property/Search/${item.keyword}`)
216
         .then(response => commit('updateSearch', response.data))
170
         .then(response => commit('updateSearch', response.data))
217
         .catch(console.error);
171
         .catch(console.error);
218
     },
172
     },
219
     searchLatestProperties({ commit }) {
173
     searchLatestProperties({ commit }) {
220
       axios
174
       axios
221
-        .get('http://192.168.6.188:5000/property/property/latestProperties')
175
+        .get('/api/property/latestProperties')
222
         .then(response => commit('setLatestProperties', response.data))
176
         .then(response => commit('setLatestProperties', response.data))
223
         .catch(console.error);
177
         .catch(console.error);
224
     },
178
     },
228
     clearPropertyImages({ commit }) {
182
     clearPropertyImages({ commit }) {
229
       commit('clearPropertyImages');
183
       commit('clearPropertyImages');
230
     },
184
     },
231
-    getPropertyEditDisplay({ commit }, id) {
185
+    getSavedPropertyData({ commit }, item) {
186
+      commit('clearProperty');
187
+      commit('clearPropertyImages');
188
+
189
+      axios
190
+        .get(`/api/Property/${item.id}`)
191
+        .then(result => commit('setProperty', result.data))
192
+        .catch(console.error);
193
+
194
+      axios
195
+        .get(`/api/PropertyImage/getPropertyImages/${item.id}`)
196
+        .then(result => commit('setPropertyImages', result.data))
197
+        .catch(console.error);
198
+
232
       axios
199
       axios
233
-        .get(`http://192.168.6.188:5000/Property/Property/GetEditDisplay/${id}`)
234
-        .then(response => commit('setPropertyEditDisplay', response.data))
200
+        .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${item.id}`)
201
+        .then(response => commit('setPropertyOverviewFields', response.data))
202
+        .catch(console.error);
203
+
204
+      axios
205
+        .get(`/api/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`)
206
+        .then(response => commit('setPropertyFields', response.data))
235
         .catch(console.error);
207
         .catch(console.error);
236
     },
208
     },
237
   },
209
   },

+ 10
- 10
src/store/modules/property/propertyAdmin.js Näytä tiedosto

79
   actions: {
79
   actions: {
80
     getUserDefinedGroups({ commit }) {
80
     getUserDefinedGroups({ commit }) {
81
       axios
81
       axios
82
-        .get('http://192.168.6.188:5000/Property/UserDefinedGroup')
82
+        .get('/api/UserDefinedGroup')
83
         .then(result => commit('setUserDefinedGroups', result.data))
83
         .then(result => commit('setUserDefinedGroups', result.data))
84
         .catch(console.error);
84
         .catch(console.error);
85
     },
85
     },
86
     getUserDefinedGroup({ commit }, id) {
86
     getUserDefinedGroup({ commit }, id) {
87
       axios
87
       axios
88
-        .get(`http://192.168.6.188:5000/Property/UserDefinedGroup/${id}`)
88
+        .get(`/api/UserDefinedGroup/${id}`)
89
         .then(result => commit('setUserDefinedGroup', result.data))
89
         .then(result => commit('setUserDefinedGroup', result.data))
90
         .catch(console.error);
90
         .catch(console.error);
91
     },
91
     },
92
     getUserFields({ commit }, groupId) {
92
     getUserFields({ commit }, groupId) {
93
       axios
93
       axios
94
-        .get(`http://192.168.6.188:5000/Property/UserDefinedField/group/${groupId}`)
94
+        .get(`/api/UserDefinedField/group/${groupId}`)
95
         .then(result => commit('setUserFields', result.data))
95
         .then(result => commit('setUserFields', result.data))
96
         .catch(console.error);
96
         .catch(console.error);
97
     },
97
     },
98
     getUserField({ commit }, id) {
98
     getUserField({ commit }, id) {
99
       axios
99
       axios
100
-        .get(`http://192.168.6.188:5000/Property/UserDefinedField/${id}`)
100
+        .get(`/api/UserDefinedField/${id}`)
101
         .then(result => commit('setUserField', result.data))
101
         .then(result => commit('setUserField', result.data))
102
         .catch(console.error);
102
         .catch(console.error);
103
     },
103
     },
104
     saveUserDefinedGroup({ commit }, item) {
104
     saveUserDefinedGroup({ commit }, item) {
105
       axios
105
       axios
106
-        .post('http://192.168.6.188:5000/Property/UserDefinedGroup', item)
106
+        .post('/api/UserDefinedGroup', item)
107
         .then(response => commit('addUserDefinedGroups', response.data))
107
         .then(response => commit('addUserDefinedGroups', response.data))
108
         .catch(console.error);
108
         .catch(console.error);
109
     },
109
     },
110
     updateUserDefinedGroup({ commit }, item) {
110
     updateUserDefinedGroup({ commit }, item) {
111
       axios
111
       axios
112
-        .put('http://192.168.6.188:5000/Property/UserDefinedGroup', item)
112
+        .put('/api/UserDefinedGroup', item)
113
         .then(response => commit('updateUserDefinedGroups', response.data))
113
         .then(response => commit('updateUserDefinedGroups', response.data))
114
         .catch(console.error);
114
         .catch(console.error);
115
     },
115
     },
116
     saveUserField({ commit }, item) {
116
     saveUserField({ commit }, item) {
117
       axios
117
       axios
118
-        .post('http://192.168.6.188:5000/Property/UserDefinedField', item)
118
+        .post('/api/UserDefinedField', item)
119
         .then(response => commit('addUserField', response.data))
119
         .then(response => commit('addUserField', response.data))
120
         .catch(console.error);
120
         .catch(console.error);
121
     },
121
     },
122
     updateUserField({ commit }, item) {
122
     updateUserField({ commit }, item) {
123
       axios
123
       axios
124
-        .put('http://192.168.6.188:5000/Property/UserDefinedField', item)
124
+        .put('/api/UserDefinedField', item)
125
         .then(response => commit('updateUserFields', response.data))
125
         .then(response => commit('updateUserFields', response.data))
126
         .catch(console.error);
126
         .catch(console.error);
127
     },
127
     },
128
     deleteUserDefinedGroup({ commit }, id) {
128
     deleteUserDefinedGroup({ commit }, id) {
129
       axios
129
       axios
130
-        .delete(`http://192.168.6.188:5000/Property/UserDefinedGroup/${id}`)
130
+        .delete(`/api/UserDefinedGroup/${id}`)
131
         .then(result => commit('removeUserDefinedGroup', id))
131
         .then(result => commit('removeUserDefinedGroup', id))
132
         .catch(console.error);
132
         .catch(console.error);
133
     },
133
     },
134
     deleteUserField({ commit }, id) {
134
     deleteUserField({ commit }, id) {
135
       axios
135
       axios
136
-        .delete(`http://192.168.6.188:5000/Property/UserDefinedField/${id}`)
136
+        .delete(`/api/UserDefinedField/${id}`)
137
         .then(result => commit('removeUserField', id))
137
         .then(result => commit('removeUserField', id))
138
         .catch(console.error);
138
         .catch(console.error);
139
     },
139
     },

+ 1
- 1
src/store/modules/property/propertyLists.js Näytä tiedosto

14
   actions: {
14
   actions: {
15
     getProperties({ commit }, item) {
15
     getProperties({ commit }, item) {
16
       axios
16
       axios
17
-        .get(`http://192.168.6.188:5000/Property/property/${item.propertyType}/${item.user}`)
17
+        .get(`/api/property/${item.propertyType}/${item.user}`)
18
         .then(result => commit('setProperties', result.data))
18
         .then(result => commit('setProperties', result.data))
19
         .catch(console.error);
19
         .catch(console.error);
20
     },
20
     },

+ 5
- 5
src/store/modules/property/propertyTypes.js Näytä tiedosto

37
   actions: {
37
   actions: {
38
     getPropertyTypes({ commit }) {
38
     getPropertyTypes({ commit }) {
39
       axios
39
       axios
40
-        .get('http://192.168.6.188:5000/Property/PropertyType')
40
+        .get('/api/PropertyType')
41
         .then(result => commit('setPropertyTypes', result.data))
41
         .then(result => commit('setPropertyTypes', result.data))
42
         .catch(console.error);
42
         .catch(console.error);
43
     },
43
     },
44
     getPropertyType({ commit }, id) {
44
     getPropertyType({ commit }, id) {
45
       axios
45
       axios
46
-        .get(`http://192.168.6.188:5000/Property/PropertyType/${id}`)
46
+        .get(`/api/PropertyType/${id}`)
47
         .then(result => commit('setPropertyType', result.data))
47
         .then(result => commit('setPropertyType', result.data))
48
         .catch(console.error);
48
         .catch(console.error);
49
     },
49
     },
50
     savePropertyType({ commit }, item) {
50
     savePropertyType({ commit }, item) {
51
       axios
51
       axios
52
-        .post('http://192.168.6.188:5000/Property/PropertyType', item)
52
+        .post('/api/PropertyType', item)
53
         .then(result => commit('addToPropertyTypes', result.data))
53
         .then(result => commit('addToPropertyTypes', result.data))
54
         .catch(console.error);
54
         .catch(console.error);
55
     },
55
     },
56
     updatePropertyType({ commit }, item) {
56
     updatePropertyType({ commit }, item) {
57
       axios
57
       axios
58
-        .put('http://192.168.6.188:5000/Property/PropertyType', item)
58
+        .put('/api/PropertyType', item)
59
         .then(result => commit('updatePropertyTypes', item))
59
         .then(result => commit('updatePropertyTypes', item))
60
         .catch(console.error);
60
         .catch(console.error);
61
     },
61
     },
64
     },
64
     },
65
     deletePropertyType({ commit }, id) {
65
     deletePropertyType({ commit }, id) {
66
       axios
66
       axios
67
-        .delete(`http://192.168.6.188:5000/Property/PropertyType/${id}`)
67
+        .delete(`/api/PropertyType/${id}`)
68
         .then(result => commit('removePropertyType', id))
68
         .then(result => commit('removePropertyType', id))
69
         .catch(console.error);
69
         .catch(console.error);
70
     },
70
     },

+ 3
- 3
src/store/modules/searchTab.js Näytä tiedosto

22
   actions: {
22
   actions: {
23
     getProvince({ commit }) {
23
     getProvince({ commit }) {
24
       axios
24
       axios
25
-        .get('http://192.168.6.188:5000/region/province')
25
+        .get('/api/province')
26
         .then(result => commit('setProvince', result.data))
26
         .then(result => commit('setProvince', result.data))
27
         .catch(console.error);
27
         .catch(console.error);
28
     },
28
     },
29
     getCities({ commit }, item) {
29
     getCities({ commit }, item) {
30
       axios
30
       axios
31
-        .get(`http://192.168.6.188:5000/region/city/getby/${item.province}`)
31
+        .get(`/api/city/getBy/${item.province}`)
32
         .then(result => commit('setCities', result.data));
32
         .then(result => commit('setCities', result.data));
33
     },
33
     },
34
     getSuburbs({ commit }, item) {
34
     getSuburbs({ commit }, item) {
35
       axios
35
       axios
36
-        .get(`http://192.168.6.188:5000/region/Suburb/${item.province}/${item.city}`)
36
+        .get(`/api/Suburb/${item.province}/${item.city}`)
37
         .then(result => commit('setSuburbs', result.data));
37
         .then(result => commit('setSuburbs', result.data));
38
     },
38
     },
39
   },
39
   },

Loading…
Peruuta
Tallenna