George Williams 4 лет назад
Родитель
Сommit
6f21f49cb0

+ 49
- 44
src/components/property/commercial/createProperty/commercialCreateNew.vue Просмотреть файл

@@ -52,9 +52,7 @@
52 52
             >
53 53
               <option value="0">Please select type *</option>
54 54
               <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
55
-                {{
56
-                item.description
57
-                }}
55
+                {{ item.description }}
58 56
               </option>
59 57
             </select>
60 58
           </div>
@@ -91,14 +89,15 @@
91 89
                     for="price"
92 90
                     class="uniSelectLabel"
93 91
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
94
-                  >{{ salesType }} Price</label>
92
+                    >{{ salesType }} Price</label
93
+                  >
95 94
                 </div>
96 95
                 <float-label label="price">
97 96
                   <currency-input
98 97
                     onclick="this.setSelectionRange(0, this.value.length)"
99 98
                     name="price"
100
-                    :value="value"
101
-                    @input="value = $event"
99
+                    :value="property.price"
100
+                    @input="property.price = $event"
102 101
                     v-model="property.price"
103 102
                     id="price"
104 103
                     class="form-control uniInput"
@@ -140,7 +139,7 @@
140 139
                   class="form-control uniInput"
141 140
                   type="text"
142 141
                   name="streetNumber"
143
-                  id="unit"
142
+                  id="streetNumber"
144 143
                   v-model="property.streetNumber"
145 144
                 />
146 145
               </div>
@@ -154,7 +153,7 @@
154 153
                   class="form-control uniInput"
155 154
                   type="text"
156 155
                   name="streetName"
157
-                  id="unit"
156
+                  id="streetName"
158 157
                   v-model="property.streetName"
159 158
                 />
160 159
               </div>
@@ -168,7 +167,7 @@
168 167
                   class="form-control uniInput"
169 168
                   type="text"
170 169
                   name="suburb"
171
-                  id="unit"
170
+                  id="suburb"
172 171
                   v-model="property.suburb"
173 172
                 />
174 173
               </div>
@@ -182,7 +181,7 @@
182 181
                   class="form-control uniInput"
183 182
                   type="text"
184 183
                   name="city"
185
-                  id="unit"
184
+                  id="city"
186 185
                   v-model="property.city"
187 186
                 />
188 187
               </div>
@@ -196,7 +195,7 @@
196 195
                   class="form-control uniInput"
197 196
                   type="text"
198 197
                   name="province"
199
-                  id="unit"
198
+                  id="province"
200 199
                   v-model="property.province"
201 200
                 />
202 201
               </div>
@@ -210,7 +209,7 @@
210 209
                   class="form-control uniInput"
211 210
                   type="text"
212 211
                   name="postalCode"
213
-                  id="unit"
212
+                  id="postalCode"
214 213
                   v-model="property.postalCode"
215 214
                 />
216 215
               </div>
@@ -224,14 +223,16 @@
224 223
                   class="form-control uniInput"
225 224
                   type="text"
226 225
                   name="country"
227
-                  id="unit"
226
+                  id="country"
228 227
                   v-model="property.country"
229 228
                 />
230 229
               </div>
231 230
             </div>
232 231
             <div class="row my-3">
233 232
               <div class="col-md-12">
234
-                <button type="button" @click="clearAddress()" class="btn-solid-blue">Clear Address</button>
233
+                <button type="button" @click="clearAddress()" class="btn-solid-blue">
234
+                  Clear Address
235
+                </button>
235 236
               </div>
236 237
             </div>
237 238
           </div>
@@ -253,13 +254,14 @@
253 254
         <div v-for="item in propertyFields" :key="item.id">
254 255
           <div v-if="item.name === 'Commercial Fields'">
255 256
             <UserField
256
-              :fields="item.fields"
257
+              :fields="sortFields"
257 258
               :id="item.name"
258 259
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
259 260
               :fieldValues="item.fields"
260 261
             />
261 262
           </div>
262 263
         </div>
264
+
263 265
         <div class="row">
264 266
           <div class="col-sm-12">
265 267
             <div class="section-header">
@@ -313,9 +315,13 @@
313 315
           :savedImages="propertyImages"
314 316
           @DefaultImage="UpdateDefaultImage"
315 317
         />
316
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
318
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
319
+          Save
320
+        </button>
317 321
         <div v-if="showPropertyTypeError">
318
-          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
322
+          <p class="alert myError">
323
+            Missing fields. Please fill in all required fields. Marked with *
324
+          </p>
319 325
         </div>
320 326
         <div v-if="wait" id="preloader"></div>
321 327
       </div>
@@ -340,7 +346,7 @@ export default {
340 346
     ImageLoad,
341 347
     VueEditor,
342 348
     carouselSection,
343
-    mapSection,
349
+    mapSection
344 350
   },
345 351
   data() {
346 352
     return {
@@ -353,22 +359,17 @@ export default {
353 359
       customToolbar: [
354 360
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
355 361
         ["bold", "italic", "underline", "strike"],
356
-        [
357
-          { align: "" },
358
-          { align: "center" },
359
-          { align: "right" },
360
-          { align: "justify" },
361
-        ],
362
+        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
362 363
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
363 364
         [{ script: "sub" }, { script: "super" }],
364
-        [{ indent: "-1" }, { indent: "+1" }],
365
+        [{ indent: "-1" }, { indent: "+1" }]
365 366
       ],
366 367
       error: "",
367 368
       addressSet: false,
368 369
       showPropertyTypeError: false,
369 370
       showDateError: false,
370 371
       user: Log.getUser(),
371
-      mayEdit: Log.isLoggedIn(),
372
+      mayEdit: Log.isLoggedIn()
372 373
     };
373 374
   },
374 375
   methods: {
@@ -383,7 +384,7 @@ export default {
383 384
       "getPropertyEditDisplay",
384 385
       "getPropertySavedOverviewFields",
385 386
       "getPropertySavedFields",
386
-      "getSavedPropertyData",
387
+      "getSavedPropertyData"
387 388
     ]),
388 389
     updateLocation(place) {
389 390
       this.addressSet = true;
@@ -400,15 +401,13 @@ export default {
400 401
     TypeChanged() {
401 402
       this.property.propertyUsageType = this.propertyType;
402 403
     },
404
+
403 405
     SubmitData() {
404 406
       if (this.property.propertyTypeId === 0) {
405 407
         this.showPropertyTypeError = true;
406 408
       }
407 409
 
408
-      if (
409
-        this.salesType === "Rental" &&
410
-        this.property.dateAvailable === "undef"
411
-      ) {
410
+      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
412 411
         this.showDateError = true;
413 412
       }
414 413
 
@@ -432,7 +431,7 @@ export default {
432 431
         }
433 432
         this.property.propertyImages.push({
434 433
           image: this.images[i],
435
-          isDefault: setAsDefault,
434
+          isDefault: setAsDefault
436 435
         });
437 436
       }
438 437
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -441,7 +440,7 @@ export default {
441 440
         this.property.userId = this.user.id;
442 441
       }
443 442
 
444
-      this.property.propertyUserFields.forEach((item) => {
443
+      this.property.propertyUserFields.forEach(item => {
445 444
         if (item.value === true) {
446 445
           item.value = "yes";
447 446
         } else if (item.value === false) {
@@ -452,12 +451,10 @@ export default {
452 451
       console.log(this.property);
453 452
 
454 453
       this.saveProperty(this.property)
455
-        .then((fulfilled) => {
456
-          this.$router.push(
457
-            `/property/commercial/property/${fulfilled.data.id}`
458
-          );
454
+        .then(fulfilled => {
455
+          this.$router.push(`/property/commercial/property/${fulfilled.data.id}`);
459 456
         })
460
-        .catch((error) => {
457
+        .catch(error => {
461 458
           console.log(error.message);
462 459
         });
463 460
     },
@@ -479,7 +476,7 @@ export default {
479 476
     },
480 477
     UpdateUserDefinedFields(item) {
481 478
       let update = false;
482
-      this.propertyFieldValues.forEach((element) => {
479
+      this.propertyFieldValues.forEach(element => {
483 480
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
484 481
           element.value = item.value;
485 482
           update = true;
@@ -503,7 +500,7 @@ export default {
503 500
       this.property.postalCode = undefined;
504 501
       this.property.addressUrl = undefined;
505 502
       this.property.propertCoords = undefined;
506
-    },
503
+    }
507 504
   },
508 505
   mounted() {
509 506
     this.wait = false;
@@ -536,10 +533,18 @@ export default {
536 533
       "propertyOverviewFields",
537 534
       "propertyFields",
538 535
       "property",
539
-      "propertyImages",
536
+      "propertyImages"
540 537
     ]),
541 538
     ...mapState("authentication", ["user"]),
542 539
     ...mapGetters("fees", ["getListingFee"]),
540
+    sortFields() {
541
+      var display = [];
542
+
543
+      display = this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
544
+      console.log(display);
545
+
546
+      return display;
547
+    },
543 548
     SalesTypeChanged() {
544 549
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
545 550
       // this.propertyType = this.$route.params.propType;
@@ -557,13 +562,13 @@ export default {
557 562
       this.getPropertyTypes(this.propertyType);
558 563
 
559 564
       return this.propertyType;
560
-    },
565
+    }
561 566
   },
562 567
   watch: {
563 568
     SalesTypeChanged() {
564 569
       return null;
565
-    },
566
-  },
570
+    }
571
+  }
567 572
 };
568 573
 </script>
569 574
 

+ 45
- 52
src/components/property/residential/createProperty/residentialCreateNew.vue Просмотреть файл

@@ -52,9 +52,7 @@
52 52
             >
53 53
               <option value="0">Please select type *</option>
54 54
               <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
55
-                {{
56
-                item.description
57
-                }}
55
+                {{ item.description }}
58 56
               </option>
59 57
             </select>
60 58
           </div>
@@ -77,18 +75,14 @@
77 75
                     for="price"
78 76
                     class="uniSelectLabel"
79 77
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
80
-                  >{{ salesType }} Price</label>
78
+                    >{{ salesType }} Price</label
79
+                  >
81 80
                 </div>
82 81
                 <float-label label="Price">
83
-                  <currency-input
84
-                    onclick="this.setSelectionRange(0, this.value.length)"
85
-                    name="price"
86
-                    :value="value"
87
-                    @input="value = $event"
88
-                    v-model="property.price"
89
-                    id="price"
90
-                    class="form-control uniInput"
91
-                  />
82
+                  <currency-input <<<<<<< HEAD ======= onclick="this.setSelectionRange(0,
83
+                  this.value.length)" >>>>>>> 6bbfd86e089da859d019dcbda5cc0fe053af8db2 name="price"
84
+                  :value="property.price" @input="property.price = $event" v-model="property.price"
85
+                  id="price" class="form-control uniInput" />
92 86
                 </float-label>
93 87
               </div>
94 88
               <div v-if="salesType === 'Rental'" class="col-md-6">
@@ -126,7 +120,7 @@
126 120
                   class="form-control uniInput"
127 121
                   type="text"
128 122
                   name="streetNumber"
129
-                  id="unit"
123
+                  id="streetNumber"
130 124
                   v-model="property.streetNumber"
131 125
                 />
132 126
               </div>
@@ -140,7 +134,7 @@
140 134
                   class="form-control uniInput"
141 135
                   type="text"
142 136
                   name="streetName"
143
-                  id="unit"
137
+                  id="streetName"
144 138
                   v-model="property.streetName"
145 139
                 />
146 140
               </div>
@@ -154,7 +148,7 @@
154 148
                   class="form-control uniInput"
155 149
                   type="text"
156 150
                   name="suburb"
157
-                  id="unit"
151
+                  id="suburb"
158 152
                   v-model="property.suburb"
159 153
                 />
160 154
               </div>
@@ -168,7 +162,7 @@
168 162
                   class="form-control uniInput"
169 163
                   type="text"
170 164
                   name="city"
171
-                  id="unit"
165
+                  id="city"
172 166
                   v-model="property.city"
173 167
                 />
174 168
               </div>
@@ -182,7 +176,7 @@
182 176
                   class="form-control uniInput"
183 177
                   type="text"
184 178
                   name="province"
185
-                  id="unit"
179
+                  id="province"
186 180
                   v-model="property.province"
187 181
                 />
188 182
               </div>
@@ -196,7 +190,7 @@
196 190
                   class="form-control uniInput"
197 191
                   type="text"
198 192
                   name="postalCode"
199
-                  id="unit"
193
+                  id="postalCode"
200 194
                   v-model="property.postalCode"
201 195
                 />
202 196
               </div>
@@ -210,14 +204,16 @@
210 204
                   class="form-control uniInput"
211 205
                   type="text"
212 206
                   name="country"
213
-                  id="unit"
207
+                  id="country"
214 208
                   v-model="property.country"
215 209
                 />
216 210
               </div>
217 211
             </div>
218 212
             <div class="row my-3">
219 213
               <div class="col-md-12">
220
-                <button type="button" @click="clearAddress()" class="btn-solid-blue">Clear Address</button>
214
+                <button type="button" @click="clearAddress()" class="btn-solid-blue">
215
+                  Clear Address
216
+                </button>
221 217
               </div>
222 218
             </div>
223 219
           </div>
@@ -253,8 +249,8 @@
253 249
           :fields="propertyOverviewFields[0].fields"
254 250
           @UpdateUserDefinedFields="UpdateUserDefinedFields"
255 251
           :id="1"
256
-        ></UserField>
257
-        <div class="row">
252
+        ></UserField> -->
253
+        <!-- <div class="row">
258 254
           <div class="col-md-12">
259 255
             <div v-for="item in propertyFields" :key="item.id">
260 256
               <div class="row">
@@ -326,9 +322,13 @@
326 322
           :savedImages="propertyImages"
327 323
           @DefaultImage="UpdateDefaultImage"
328 324
         />
329
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
325
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
326
+          Save
327
+        </button>
330 328
         <div v-if="showPropertyTypeError">
331
-          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
329
+          <p class="alert myError">
330
+            Missing fields. Please fill in all required fields. Marked with *
331
+          </p>
332 332
         </div>
333 333
         <div v-if="wait" id="preloader"></div>
334 334
       </div>
@@ -353,7 +353,7 @@ export default {
353 353
     ImageLoad,
354 354
     VueEditor,
355 355
     carouselSection,
356
-    mapSection,
356
+    mapSection
357 357
   },
358 358
   data() {
359 359
     return {
@@ -366,22 +366,17 @@ export default {
366 366
       customToolbar: [
367 367
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
368 368
         ["bold", "italic", "underline", "strike"],
369
-        [
370
-          { align: "" },
371
-          { align: "center" },
372
-          { align: "right" },
373
-          { align: "justify" },
374
-        ],
369
+        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
375 370
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
376 371
         [{ script: "sub" }, { script: "super" }],
377
-        [{ indent: "-1" }, { indent: "+1" }],
372
+        [{ indent: "-1" }, { indent: "+1" }]
378 373
       ],
379 374
       error: "",
380 375
       addressSet: false,
381 376
       showPropertyTypeError: false,
382 377
       showDateError: false,
383 378
       user: Log.getUser(),
384
-      mayEdit: Log.isLoggedIn(),
379
+      mayEdit: Log.isLoggedIn()
385 380
     };
386 381
   },
387 382
   methods: {
@@ -396,7 +391,7 @@ export default {
396 391
       "getPropertyEditDisplay",
397 392
       "getPropertySavedOverviewFields",
398 393
       "getPropertySavedFields",
399
-      "getSavedPropertyData",
394
+      "getSavedPropertyData"
400 395
     ]),
401 396
     updateLocation(place) {
402 397
       this.addressSet = true;
@@ -418,10 +413,7 @@ export default {
418 413
         this.showPropertyTypeError = true;
419 414
       }
420 415
 
421
-      if (
422
-        this.salesType === "Rental" &&
423
-        this.property.dateAvailable === "undef"
424
-      ) {
416
+      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
425 417
         this.showDateError = true;
426 418
       }
427 419
 
@@ -445,7 +437,7 @@ export default {
445 437
         }
446 438
         this.property.propertyImages.push({
447 439
           image: this.images[i],
448
-          isDefault: setAsDefault,
440
+          isDefault: setAsDefault
449 441
         });
450 442
       }
451 443
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -453,7 +445,7 @@ export default {
453 445
       if (this.user) {
454 446
         this.property.userId = this.user.id;
455 447
       }
456
-      this.property.propertyUserFields.forEach((item) => {
448
+      this.property.propertyUserFields.forEach(item => {
457 449
         if (item.value === true) {
458 450
           item.value = "yes";
459 451
         } else if (item.value === false) {
@@ -462,12 +454,10 @@ export default {
462 454
       });
463 455
 
464 456
       this.saveProperty(this.property)
465
-        .then((fulfilled) => {
466
-          this.$router.push(
467
-            `/property/residential/property/${fulfilled.data.id}`
468
-          );
457
+        .then(fulfilled => {
458
+          this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
469 459
         })
470
-        .catch((error) => {
460
+        .catch(error => {
471 461
           console.log(error.message);
472 462
         });
473 463
     },
@@ -489,7 +479,7 @@ export default {
489 479
     },
490 480
     UpdateUserDefinedFields(item) {
491 481
       let update = false;
492
-      this.propertyFieldValues.forEach((element) => {
482
+      this.propertyFieldValues.forEach(element => {
493 483
         console.log(element);
494 484
 
495 485
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
@@ -525,7 +515,7 @@ export default {
525 515
         fields.push(arr.slice(i, (i += len)));
526 516
       }
527 517
       return fields;
528
-    },
518
+    }
529 519
   },
530 520
   mounted() {
531 521
     console.log(this.propertyFields);
@@ -562,10 +552,13 @@ export default {
562 552
       "propertyOverviewFields",
563 553
       "propertyFields",
564 554
       "property",
565
-      "propertyImages",
555
+      "propertyImages"
566 556
     ]),
567 557
     ...mapState("authentication", ["user"]),
568 558
     ...mapGetters("fees", ["getListingFee"]),
559
+    sortFields() {
560
+      return this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
561
+    },
569 562
     SalesTypeChanged() {
570 563
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
571 564
       // this.propertyType = this.$route.params.propType;
@@ -584,13 +577,13 @@ export default {
584 577
     },
585 578
     userFieldsArr() {
586 579
       return this.userFieldsArrFunc(this.propertyFields, 4);
587
-    },
580
+    }
588 581
   },
589 582
   watch: {
590 583
     SalesTypeChanged() {
591 584
       return null;
592
-    },
593
-  },
585
+    }
586
+  }
594 587
 };
595 588
 </script>
596 589
 

+ 1
- 1
vue.config.js Просмотреть файл

@@ -2,7 +2,7 @@ module.exports = {
2 2
   devServer: {
3 3
     proxy: {
4 4
       "/api": {
5
-        // target: "http://localhost:57260/",
5
+        //target: "http://localhost:57260/",
6 6
         target: "http://training.provision-sa.com:82",
7 7
         changeOrigin: true
8 8
       },

Загрузка…
Отмена
Сохранить