Parcourir la source

Fixes to properties when saving.

master
George Williams il y a 5 ans
Parent
révision
3eb30bce43

+ 25
- 3
src/components/property/propertyeditPage.vue Voir le fichier

@@ -168,6 +168,7 @@
168 168
                     name="propertyType"
169 169
                     id="suburbselector"
170 170
                     v-model="property.suburbId"
171
+                    @change="getPostalCode"
171 172
                   >
172 173
                     <option value="0">Please select suburb</option>
173 174
                     <option
@@ -184,7 +185,12 @@
184 185
                   <span class="input-group-text">
185 186
                     <eva-icon name="home-outline" fill="#60CBEB"></eva-icon>
186 187
                   </span>
187
-                  <input class="form-control" type="text" name="postalcode" />
188
+                  <input
189
+                    class="form-control"
190
+                    type="text"
191
+                    name="postalcode"
192
+                    v-model="property.addressLine3"
193
+                  />
188 194
                 </div>
189 195
               </div>
190 196
             </div>
@@ -269,7 +275,11 @@
269 275
                 </div>
270 276
               </div>
271 277
             </div>
272
-            <ImageLoad :loadedImages="loadedImages" :savedImages="propertyImages" />
278
+            <ImageLoad
279
+              :loadedImages="loadedImages"
280
+              :savedImages="propertyImages"
281
+              @DefaultImage="UpdateDefaultImage"
282
+            />
273 283
             <button
274 284
               v-if="!wait"
275 285
               type="button"
@@ -288,6 +298,7 @@
288 298
 <script>
289 299
 import { mapState, mapActions } from 'vuex';
290 300
 import TextEditor from 'vue-trix';
301
+import { setTimeout } from 'timers';
291 302
 import UserField from './propertyUserField.vue';
292 303
 import ImageLoad from './propertyImage.vue';
293 304
 
@@ -328,6 +339,9 @@ export default {
328 339
     ]),
329 340
     SubmitData() {
330 341
       this.wait = true;
342
+      if (this.salesType === 'Sale') {
343
+        this.property.isSale = true;
344
+      }
331 345
       for (let i = 0; i < this.images.length; i++) {
332 346
         let setAsDefault = false;
333 347
         if (i === this.defaultImage) {
@@ -338,7 +352,7 @@ export default {
338 352
           isDefault: setAsDefault,
339 353
         });
340 354
       }
341
-      this.property.createdBy = 'GeorgeW';
355
+      this.property.propertyUserFields = this.propertyFieldValues;
342 356
 
343 357
       this.saveProperty(this.property);
344 358
 
@@ -371,6 +385,11 @@ export default {
371 385
         );
372 386
       }
373 387
     },
388
+    getPostalCode(item) {
389
+      this.property.addressLine3 = this.suburbs[
390
+        item.target.options.selectedIndex - 1
391
+      ].postalCode;
392
+    },
374 393
     loadedImages(values) {
375 394
       this.images = values;
376 395
     },
@@ -403,6 +422,9 @@ export default {
403 422
     if (this.propertyFields.length > 0) {
404 423
       this.propertyFields = [];
405 424
     }
425
+    if (this.property.description !== '') {
426
+      this.property.description = '';
427
+    }
406 428
 
407 429
     this.propertyType = this.$route.params.propType;
408 430
     this.salesType = this.$route.params.saleType;

+ 1
- 1
src/store/modules/property/property.js Voir le fichier

@@ -36,7 +36,7 @@ export default {
36 36
   },
37 37
   mutations: {
38 38
     setProperty(state, property) {
39
-      state.properties.push(property);
39
+      state.property = property;
40 40
     },
41 41
     setPropertyImages(state, images) {
42 42
       state.propertyImages = images;

Chargement…
Annuler
Enregistrer