Browse Source

Opened Address Fields on Property pages

master
George Williams 4 years ago
parent
commit
6bbfd86e08

+ 36
- 38
src/components/property/commercial/createProperty/commercialCreateNew.vue View File

@@ -51,9 +51,11 @@
51 51
               @change="PropertyTypeSelected"
52 52
             >
53 53
               <option value="0">Please select type *</option>
54
-              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">{{
54
+              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
55
+                {{
55 56
                 item.description
56
-              }}</option>
57
+                }}
58
+              </option>
57 59
             </select>
58 60
           </div>
59 61
           <div v-if="propertyType === 'Commercial'" class="col-md-2">
@@ -89,12 +91,11 @@
89 91
                     for="price"
90 92
                     class="uniSelectLabel"
91 93
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
92
-                    >{{ salesType }} Price</label
93
-                  >
94
+                  >{{ salesType }} Price</label>
94 95
                 </div>
95 96
                 <float-label label="price">
96 97
                   <currency-input
97
-                    onClick="this.setSelectionRange(0, this.value.length)"
98
+                    onclick="this.setSelectionRange(0, this.value.length)"
98 99
                     name="price"
99 100
                     :value="value"
100 101
                     @input="value = $event"
@@ -141,7 +142,6 @@
141 142
                   name="streetNumber"
142 143
                   id="unit"
143 144
                   v-model="property.streetNumber"
144
-                  disabled
145 145
                 />
146 146
               </div>
147 147
             </div>
@@ -156,7 +156,6 @@
156 156
                   name="streetName"
157 157
                   id="unit"
158 158
                   v-model="property.streetName"
159
-                  disabled
160 159
                 />
161 160
               </div>
162 161
             </div>
@@ -171,7 +170,6 @@
171 170
                   name="suburb"
172 171
                   id="unit"
173 172
                   v-model="property.suburb"
174
-                  disabled
175 173
                 />
176 174
               </div>
177 175
             </div>
@@ -186,7 +184,6 @@
186 184
                   name="city"
187 185
                   id="unit"
188 186
                   v-model="property.city"
189
-                  disabled
190 187
                 />
191 188
               </div>
192 189
             </div>
@@ -201,7 +198,6 @@
201 198
                   name="province"
202 199
                   id="unit"
203 200
                   v-model="property.province"
204
-                  disabled
205 201
                 />
206 202
               </div>
207 203
             </div>
@@ -216,7 +212,6 @@
216 212
                   name="postalCode"
217 213
                   id="unit"
218 214
                   v-model="property.postalCode"
219
-                  disabled
220 215
                 />
221 216
               </div>
222 217
             </div>
@@ -231,15 +226,12 @@
231 226
                   name="country"
232 227
                   id="unit"
233 228
                   v-model="property.country"
234
-                  disabled
235 229
                 />
236 230
               </div>
237 231
             </div>
238 232
             <div class="row my-3">
239 233
               <div class="col-md-12">
240
-                <button type="button" @click="clearAddress()" class="btn-solid-blue">
241
-                  Clear Address
242
-                </button>
234
+                <button type="button" @click="clearAddress()" class="btn-solid-blue">Clear Address</button>
243 235
               </div>
244 236
             </div>
245 237
           </div>
@@ -321,13 +313,9 @@
321 313
           :savedImages="propertyImages"
322 314
           @DefaultImage="UpdateDefaultImage"
323 315
         />
324
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
325
-          Save
326
-        </button>
316
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
327 317
         <div v-if="showPropertyTypeError">
328
-          <p class="alert myError">
329
-            Missing fields. Please fill in all required fields. Marked with *
330
-          </p>
318
+          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
331 319
         </div>
332 320
         <div v-if="wait" id="preloader"></div>
333 321
       </div>
@@ -352,7 +340,7 @@ export default {
352 340
     ImageLoad,
353 341
     VueEditor,
354 342
     carouselSection,
355
-    mapSection
343
+    mapSection,
356 344
   },
357 345
   data() {
358 346
     return {
@@ -365,17 +353,22 @@ export default {
365 353
       customToolbar: [
366 354
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
367 355
         ["bold", "italic", "underline", "strike"],
368
-        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
356
+        [
357
+          { align: "" },
358
+          { align: "center" },
359
+          { align: "right" },
360
+          { align: "justify" },
361
+        ],
369 362
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
370 363
         [{ script: "sub" }, { script: "super" }],
371
-        [{ indent: "-1" }, { indent: "+1" }]
364
+        [{ indent: "-1" }, { indent: "+1" }],
372 365
       ],
373 366
       error: "",
374 367
       addressSet: false,
375 368
       showPropertyTypeError: false,
376 369
       showDateError: false,
377 370
       user: Log.getUser(),
378
-      mayEdit: Log.isLoggedIn()
371
+      mayEdit: Log.isLoggedIn(),
379 372
     };
380 373
   },
381 374
   methods: {
@@ -390,7 +383,7 @@ export default {
390 383
       "getPropertyEditDisplay",
391 384
       "getPropertySavedOverviewFields",
392 385
       "getPropertySavedFields",
393
-      "getSavedPropertyData"
386
+      "getSavedPropertyData",
394 387
     ]),
395 388
     updateLocation(place) {
396 389
       this.addressSet = true;
@@ -412,7 +405,10 @@ export default {
412 405
         this.showPropertyTypeError = true;
413 406
       }
414 407
 
415
-      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
408
+      if (
409
+        this.salesType === "Rental" &&
410
+        this.property.dateAvailable === "undef"
411
+      ) {
416 412
         this.showDateError = true;
417 413
       }
418 414
 
@@ -436,7 +432,7 @@ export default {
436 432
         }
437 433
         this.property.propertyImages.push({
438 434
           image: this.images[i],
439
-          isDefault: setAsDefault
435
+          isDefault: setAsDefault,
440 436
         });
441 437
       }
442 438
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -445,7 +441,7 @@ export default {
445 441
         this.property.userId = this.user.id;
446 442
       }
447 443
 
448
-      this.property.propertyUserFields.forEach(item => {
444
+      this.property.propertyUserFields.forEach((item) => {
449 445
         if (item.value === true) {
450 446
           item.value = "yes";
451 447
         } else if (item.value === false) {
@@ -456,10 +452,12 @@ export default {
456 452
       console.log(this.property);
457 453
 
458 454
       this.saveProperty(this.property)
459
-        .then(fulfilled => {
460
-          this.$router.push(`/property/commercial/property/${fulfilled.data.id}`);
455
+        .then((fulfilled) => {
456
+          this.$router.push(
457
+            `/property/commercial/property/${fulfilled.data.id}`
458
+          );
461 459
         })
462
-        .catch(error => {
460
+        .catch((error) => {
463 461
           console.log(error.message);
464 462
         });
465 463
     },
@@ -481,7 +479,7 @@ export default {
481 479
     },
482 480
     UpdateUserDefinedFields(item) {
483 481
       let update = false;
484
-      this.propertyFieldValues.forEach(element => {
482
+      this.propertyFieldValues.forEach((element) => {
485 483
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
486 484
           element.value = item.value;
487 485
           update = true;
@@ -505,7 +503,7 @@ export default {
505 503
       this.property.postalCode = undefined;
506 504
       this.property.addressUrl = undefined;
507 505
       this.property.propertCoords = undefined;
508
-    }
506
+    },
509 507
   },
510 508
   mounted() {
511 509
     this.wait = false;
@@ -538,7 +536,7 @@ export default {
538 536
       "propertyOverviewFields",
539 537
       "propertyFields",
540 538
       "property",
541
-      "propertyImages"
539
+      "propertyImages",
542 540
     ]),
543 541
     ...mapState("authentication", ["user"]),
544 542
     ...mapGetters("fees", ["getListingFee"]),
@@ -559,13 +557,13 @@ export default {
559 557
       this.getPropertyTypes(this.propertyType);
560 558
 
561 559
       return this.propertyType;
562
-    }
560
+    },
563 561
   },
564 562
   watch: {
565 563
     SalesTypeChanged() {
566 564
       return null;
567
-    }
568
-  }
565
+    },
566
+  },
569 567
 };
570 568
 </script>
571 569
 

+ 7
- 7
src/components/property/editProperty/editProperty.vue View File

@@ -160,7 +160,7 @@
160 160
                         name="streetNumber"
161 161
                         id="unit"
162 162
                         v-model="property.streetNumber"
163
-                        disabled
163
+                        :disabled="!canEdit"
164 164
                       />
165 165
                     </div>
166 166
                   </div>
@@ -175,7 +175,7 @@
175 175
                         name="streetName"
176 176
                         id="unit"
177 177
                         v-model="property.streetName"
178
-                        disabled
178
+                        :disabled="!canEdit"
179 179
                       />
180 180
                     </div>
181 181
                   </div>
@@ -190,7 +190,7 @@
190 190
                         name="suburb"
191 191
                         id="unit"
192 192
                         v-model="property.suburb"
193
-                        disabled
193
+                        :disabled="!canEdit"
194 194
                       />
195 195
                     </div>
196 196
                   </div>
@@ -205,7 +205,7 @@
205 205
                         name="city"
206 206
                         id="unit"
207 207
                         v-model="property.city"
208
-                        disabled
208
+                        :disabled="!canEdit"
209 209
                       />
210 210
                     </div>
211 211
                   </div>
@@ -220,7 +220,7 @@
220 220
                         name="province"
221 221
                         id="unit"
222 222
                         v-model="property.province"
223
-                        disabled
223
+                        :disabled="!canEdit"
224 224
                       />
225 225
                     </div>
226 226
                   </div>
@@ -235,7 +235,7 @@
235 235
                         name="postalCode"
236 236
                         id="unit"
237 237
                         v-model="property.postalCode"
238
-                        disabled
238
+                        :disabled="!canEdit"
239 239
                       />
240 240
                     </div>
241 241
                   </div>
@@ -250,7 +250,7 @@
250 250
                         name="country"
251 251
                         id="unit"
252 252
                         v-model="property.country"
253
-                        disabled
253
+                        :disabled="!canEdit"
254 254
                       />
255 255
                     </div>
256 256
                   </div>

+ 37
- 39
src/components/property/residential/createProperty/residentialCreateNew.vue View File

@@ -51,9 +51,11 @@
51 51
               @change="PropertyTypeSelected"
52 52
             >
53 53
               <option value="0">Please select type *</option>
54
-              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">{{
54
+              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
55
+                {{
55 56
                 item.description
56
-              }}</option>
57
+                }}
58
+              </option>
57 59
             </select>
58 60
           </div>
59 61
         </div>
@@ -75,12 +77,11 @@
75 77
                     for="price"
76 78
                     class="uniSelectLabel"
77 79
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
78
-                    >{{ salesType }} Price</label
79
-                  >
80
+                  >{{ salesType }} Price</label>
80 81
                 </div>
81 82
                 <float-label label="Price">
82 83
                   <currency-input
83
-                    onClick="this.setSelectionRange(0, this.value.length)"
84
+                    onclick="this.setSelectionRange(0, this.value.length)"
84 85
                     name="price"
85 86
                     :value="value"
86 87
                     @input="value = $event"
@@ -127,7 +128,6 @@
127 128
                   name="streetNumber"
128 129
                   id="unit"
129 130
                   v-model="property.streetNumber"
130
-                  disabled
131 131
                 />
132 132
               </div>
133 133
             </div>
@@ -142,7 +142,6 @@
142 142
                   name="streetName"
143 143
                   id="unit"
144 144
                   v-model="property.streetName"
145
-                  disabled
146 145
                 />
147 146
               </div>
148 147
             </div>
@@ -157,7 +156,6 @@
157 156
                   name="suburb"
158 157
                   id="unit"
159 158
                   v-model="property.suburb"
160
-                  disabled
161 159
                 />
162 160
               </div>
163 161
             </div>
@@ -172,7 +170,6 @@
172 170
                   name="city"
173 171
                   id="unit"
174 172
                   v-model="property.city"
175
-                  disabled
176 173
                 />
177 174
               </div>
178 175
             </div>
@@ -187,7 +184,6 @@
187 184
                   name="province"
188 185
                   id="unit"
189 186
                   v-model="property.province"
190
-                  disabled
191 187
                 />
192 188
               </div>
193 189
             </div>
@@ -202,7 +198,6 @@
202 198
                   name="postalCode"
203 199
                   id="unit"
204 200
                   v-model="property.postalCode"
205
-                  disabled
206 201
                 />
207 202
               </div>
208 203
             </div>
@@ -217,15 +212,12 @@
217 212
                   name="country"
218 213
                   id="unit"
219 214
                   v-model="property.country"
220
-                  disabled
221 215
                 />
222 216
               </div>
223 217
             </div>
224 218
             <div class="row my-3">
225 219
               <div class="col-md-12">
226
-                <button type="button" @click="clearAddress()" class="btn-solid-blue">
227
-                  Clear Address
228
-                </button>
220
+                <button type="button" @click="clearAddress()" class="btn-solid-blue">Clear Address</button>
229 221
               </div>
230 222
             </div>
231 223
           </div>
@@ -280,7 +272,7 @@
280 272
               />
281 273
             </div>
282 274
           </div>
283
-        </div> -->
275
+        </div>-->
284 276
         <div class="row">
285 277
           <div class="col-sm-12">
286 278
             <div class="section-header">
@@ -334,13 +326,9 @@
334 326
           :savedImages="propertyImages"
335 327
           @DefaultImage="UpdateDefaultImage"
336 328
         />
337
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
338
-          Save
339
-        </button>
329
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
340 330
         <div v-if="showPropertyTypeError">
341
-          <p class="alert myError">
342
-            Missing fields. Please fill in all required fields. Marked with *
343
-          </p>
331
+          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
344 332
         </div>
345 333
         <div v-if="wait" id="preloader"></div>
346 334
       </div>
@@ -365,7 +353,7 @@ export default {
365 353
     ImageLoad,
366 354
     VueEditor,
367 355
     carouselSection,
368
-    mapSection
356
+    mapSection,
369 357
   },
370 358
   data() {
371 359
     return {
@@ -378,17 +366,22 @@ export default {
378 366
       customToolbar: [
379 367
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
380 368
         ["bold", "italic", "underline", "strike"],
381
-        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
369
+        [
370
+          { align: "" },
371
+          { align: "center" },
372
+          { align: "right" },
373
+          { align: "justify" },
374
+        ],
382 375
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
383 376
         [{ script: "sub" }, { script: "super" }],
384
-        [{ indent: "-1" }, { indent: "+1" }]
377
+        [{ indent: "-1" }, { indent: "+1" }],
385 378
       ],
386 379
       error: "",
387 380
       addressSet: false,
388 381
       showPropertyTypeError: false,
389 382
       showDateError: false,
390 383
       user: Log.getUser(),
391
-      mayEdit: Log.isLoggedIn()
384
+      mayEdit: Log.isLoggedIn(),
392 385
     };
393 386
   },
394 387
   methods: {
@@ -403,7 +396,7 @@ export default {
403 396
       "getPropertyEditDisplay",
404 397
       "getPropertySavedOverviewFields",
405 398
       "getPropertySavedFields",
406
-      "getSavedPropertyData"
399
+      "getSavedPropertyData",
407 400
     ]),
408 401
     updateLocation(place) {
409 402
       this.addressSet = true;
@@ -425,7 +418,10 @@ export default {
425 418
         this.showPropertyTypeError = true;
426 419
       }
427 420
 
428
-      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
421
+      if (
422
+        this.salesType === "Rental" &&
423
+        this.property.dateAvailable === "undef"
424
+      ) {
429 425
         this.showDateError = true;
430 426
       }
431 427
 
@@ -449,7 +445,7 @@ export default {
449 445
         }
450 446
         this.property.propertyImages.push({
451 447
           image: this.images[i],
452
-          isDefault: setAsDefault
448
+          isDefault: setAsDefault,
453 449
         });
454 450
       }
455 451
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -457,7 +453,7 @@ export default {
457 453
       if (this.user) {
458 454
         this.property.userId = this.user.id;
459 455
       }
460
-      this.property.propertyUserFields.forEach(item => {
456
+      this.property.propertyUserFields.forEach((item) => {
461 457
         if (item.value === true) {
462 458
           item.value = "yes";
463 459
         } else if (item.value === false) {
@@ -466,10 +462,12 @@ export default {
466 462
       });
467 463
 
468 464
       this.saveProperty(this.property)
469
-        .then(fulfilled => {
470
-          this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
465
+        .then((fulfilled) => {
466
+          this.$router.push(
467
+            `/property/residential/property/${fulfilled.data.id}`
468
+          );
471 469
         })
472
-        .catch(error => {
470
+        .catch((error) => {
473 471
           console.log(error.message);
474 472
         });
475 473
     },
@@ -491,7 +489,7 @@ export default {
491 489
     },
492 490
     UpdateUserDefinedFields(item) {
493 491
       let update = false;
494
-      this.propertyFieldValues.forEach(element => {
492
+      this.propertyFieldValues.forEach((element) => {
495 493
         console.log(element);
496 494
 
497 495
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
@@ -527,7 +525,7 @@ export default {
527 525
         fields.push(arr.slice(i, (i += len)));
528 526
       }
529 527
       return fields;
530
-    }
528
+    },
531 529
   },
532 530
   mounted() {
533 531
     console.log(this.propertyFields);
@@ -564,7 +562,7 @@ export default {
564 562
       "propertyOverviewFields",
565 563
       "propertyFields",
566 564
       "property",
567
-      "propertyImages"
565
+      "propertyImages",
568 566
     ]),
569 567
     ...mapState("authentication", ["user"]),
570 568
     ...mapGetters("fees", ["getListingFee"]),
@@ -586,13 +584,13 @@ export default {
586 584
     },
587 585
     userFieldsArr() {
588 586
       return this.userFieldsArrFunc(this.propertyFields, 4);
589
-    }
587
+    },
590 588
   },
591 589
   watch: {
592 590
     SalesTypeChanged() {
593 591
       return null;
594
-    }
595
-  }
592
+    },
593
+  },
596 594
 };
597 595
 </script>
598 596
 

Loading…
Cancel
Save