浏览代码

Univate.2 > Timeshare To Sell Changes

master
George Williams 4 年前
父节点
当前提交
cfe8cb94d5
共有 1 个文件被更改,包括 176 次插入155 次删除
  1. 176
    155
      src/components/timeshare/sell/contentSection.vue

+ 176
- 155
src/components/timeshare/sell/contentSection.vue 查看文件

@@ -18,10 +18,9 @@
18 18
                   :checked="refAgent"
19 19
                   @change="changeRef"
20 20
                 />
21
-                <label
22
-                  class="custom-control-label"
23
-                  for="customSwitch1"
24
-                >{{ refAgent ? "Yes" : "No" }}</label>
21
+                <label class="custom-control-label" for="customSwitch1">{{
22
+                  refAgent ? "Yes" : "No"
23
+                }}</label>
25 24
                 <div class="refbyAgent" :class="{ 'refbyAgent--clicked': refAgent }">
26 25
                   <div class="col-md-6" v-if="refAgent">
27 26
                     <label for="Name of Agency">Agency</label>
@@ -32,9 +31,7 @@
32 31
                       v-model="sellItem.agencyId"
33 32
                     >
34 33
                       <option v-for="(item, i) in agencies" :key="i" :value="item.id">
35
-                        {{
36
-                        item.agencyName
37
-                        }}
34
+                        {{ item.agencyName }}
38 35
                       </option>
39 36
                     </select>
40 37
                   </div>
@@ -67,11 +64,9 @@
67 64
             <div class="form-row">
68 65
               <div class="form-group col-md-6">
69 66
                 <div class="input-group">
70
-                  <label
71
-                    v-if="!sellItem.region"
72
-                    class="uniSelectLabel"
73
-                    for="weekInfoRegionSelect"
74
-                  >REGION</label>
67
+                  <label v-if="!sellItem.region" class="uniSelectLabel" for="weekInfoRegionSelect"
68
+                    >REGION</label
69
+                  >
75 70
 
76 71
                   <select
77 72
                     id="weekInfoRegionSelect"
@@ -80,11 +75,9 @@
80 75
                     @change="regionChange()"
81 76
                     style="font-size: 15px"
82 77
                   >
83
-                    <option
84
-                      v-for="(region, r) in regions"
85
-                      :key="r"
86
-                      :value="region"
87
-                    >{{ region.regionName }}</option>
78
+                    <option v-for="(region, r) in regions" :key="r" :value="region">{{
79
+                      region.regionName
80
+                    }}</option>
88 81
                   </select>
89 82
                 </div>
90 83
 
@@ -101,11 +94,9 @@
101 94
               </div>
102 95
               <div class="form-group col-md-6">
103 96
                 <div class="input-group">
104
-                  <label
105
-                    v-if="!sellItem.resort"
106
-                    class="uniSelectLabel"
107
-                    for="weekInfoResortSelect"
108
-                  >RESORT NAME</label>
97
+                  <label v-if="!sellItem.resort" class="uniSelectLabel" for="weekInfoResortSelect"
98
+                    >RESORT NAME</label
99
+                  >
109 100
 
110 101
                   <select
111 102
                     id="weekInfoResortSelect"
@@ -114,11 +105,9 @@
114 105
                     @change="resortChange()"
115 106
                   >
116 107
                     <option value="Other">Other</option>
117
-                    <option
118
-                      v-for="(resort, r) in filteredResort"
119
-                      :key="r"
120
-                      :value="resort"
121
-                    >{{ resort.resortName }}</option>
108
+                    <option v-for="(resort, r) in filteredResort" :key="r" :value="resort">{{
109
+                      resort.resortName
110
+                    }}</option>
122 111
                   </select>
123 112
                 </div>
124 113
                 <!-- <input
@@ -195,7 +184,9 @@
195 184
                 <div class="validation"></div>
196 185
               </div>
197 186
               <div class="form-group col-md-6">
198
-                <label v-if="!sellItem.bedrooms" class="uniSelectLabel" for="region">BEDROOM/S</label>
187
+                <label v-if="!sellItem.bedrooms" class="uniSelectLabel" for="region"
188
+                  >BEDROOM/S</label
189
+                >
199 190
 
200 191
                 <select
201 192
                   class="form-control uniSelect"
@@ -208,7 +199,9 @@
208 199
                 <div class="validation"></div>
209 200
               </div>
210 201
               <div class="form-group col-md-6">
211
-                <label v-if="!sellItem.maxSleep" class="uniSelectLabel" for="region">SLEEP MAX</label>
202
+                <label v-if="!sellItem.maxSleep" class="uniSelectLabel" for="region"
203
+                  >SLEEP MAX</label
204
+                >
212 205
 
213 206
                 <select
214 207
                   class="form-control uniSelect"
@@ -233,7 +226,9 @@
233 226
                 <div class="validation"></div>
234 227
               </div>
235 228
               <div class="form-group col-md-6">
236
-                <label v-if="!sellItem.weekType" class="uniSelectLabel" for="region">WEEK TYPE</label>
229
+                <label v-if="!sellItem.weekType" class="uniSelectLabel" for="region"
230
+                  >WEEK TYPE</label
231
+                >
237 232
                 <select
238 233
                   class="form-control uniSelect"
239 234
                   name="region"
@@ -259,19 +254,17 @@
259 254
                   :checked="sellItem.currentYearBanked"
260 255
                   @change="changeCurrentBanked"
261 256
                 />
262
-                <label
263
-                  class="custom-control-label"
264
-                  for="customSwitch2"
265
-                >{{ sellItem.currentYearBanked ? "Yes" : "No" }}</label>
257
+                <label class="custom-control-label" for="customSwitch2">{{
258
+                  sellItem.currentYearBanked ? "Yes" : "No"
259
+                }}</label>
266 260
                 <div
267 261
                   class="spacebanked1"
268 262
                   :class="{ 'spacebanked1--clicked': sellItem.currentYearBanked }"
269 263
                 >
270 264
                   <div class="col-md-6">
271
-                    <label
272
-                      for="If yes, please confirm with whom"
273
-                      v-if="sellItem.currentYearBanked"
274
-                    >Please confirm with whom</label>
265
+                    <label for="If yes, please confirm with whom" v-if="sellItem.currentYearBanked"
266
+                      >Please confirm with whom</label
267
+                    >
275 268
                     <select
276 269
                       class="form-control uniSelect"
277 270
                       name="spacebankOwner"
@@ -347,16 +340,28 @@
347 340
             </div>
348 341
             <div class="row">
349 342
               <div class="form-group col-md-6">
350
-                <input
351
-                  type="text"
352
-                  name="marital"
353
-                  class="form-control"
354
-                  id="marital"
355
-                  placeholder="Marital Status"
356
-                  data-rule="minlen:4"
357
-                  data-msg="Please enter your marital status"
358
-                  v-model="indiv.maritalStatus"
359
-                />
343
+                <div class="input-group">
344
+                  <label
345
+                    v-if="!indiv.howMarried || indiv.howMarried === 'NotApplicable'"
346
+                    for="howMarried"
347
+                    class="uniSelectLabel"
348
+                    >Marital Status</label
349
+                  >
350
+                  <select class="form-control uniSelect" id="howMarried" v-model="indiv.howMarried">
351
+                    <option value="N/A">N/A</option>
352
+                    <option value="In Community Of Property">In Community Of Property</option>
353
+                    <option value="Out of Community Of Property"
354
+                      >Out of Community Of Property</option
355
+                    >
356
+                    <option value="Other">Other</option>
357
+                    <option value="Traditional Wedding">Traditional Wedding</option>
358
+                    <option value="Single">Single</option>
359
+                    <option value="Divorced">Divorced</option>
360
+                    <option value="Widow">Widow</option>
361
+                    <option value="Committed Relationship">Committed Relationship</option>
362
+                    <option value="Partner">Partner</option>
363
+                  </select>
364
+                </div>
360 365
                 <div class="validation"></div>
361 366
               </div>
362 367
               <div class="form-group col-md-6">
@@ -400,6 +405,67 @@
400 405
               </div>
401 406
             </div>
402 407
           </div>
408
+          <div v-if="indiv.howMarried === 'In Community Of Property'" class="section-header">
409
+            <h2>Spouse Details</h2>
410
+          </div>
411
+          <div v-if="indiv.howMarried === 'In Community Of Property'" class="form">
412
+            <div class="form-row">
413
+              <div class="form-group col-md-6">
414
+                <input
415
+                  type="text"
416
+                  class="form-control"
417
+                  placeholder="SPOUSE NAME"
418
+                  data-msg="Please enter your spouse's name"
419
+                  v-model="indiv.spouseName"
420
+                />
421
+                <div class="validation"></div>
422
+              </div>
423
+              <div class="form-group col-md-6">
424
+                <input
425
+                  type="text"
426
+                  class="form-control"
427
+                  placeholder="SPOUSE SURNAME"
428
+                  data-msg="Please enter your spouse's surname"
429
+                  v-model="indiv.spouseSurname"
430
+                />
431
+                <div class="validation"></div>
432
+              </div>
433
+              <div class="form-group col-md-6">
434
+                <input
435
+                  type="text"
436
+                  class="form-control"
437
+                  placeholder="SPOUSE EMAIL"
438
+                  data-rule="minlen:4"
439
+                  data-msg="Please enter your spouse's email"
440
+                  v-model="indiv.spouseEmail"
441
+                />
442
+                <div class="validation"></div>
443
+              </div>
444
+              <div class="form-group col-md-6">
445
+                <input
446
+                  type="text"
447
+                  class="form-control"
448
+                  placeholder="SPOUSE TELEPHONE"
449
+                  data-rule="minlen:4"
450
+                  data-msg="Please enter your spouse's telephone number"
451
+                  v-model="indiv.spouseTelephone"
452
+                />
453
+                <div class="validation"></div>
454
+              </div>
455
+              <div class="form-group col-md-6">
456
+                <input
457
+                  type="text"
458
+                  class="form-control"
459
+                  placeholder="SPOUSE CELL NUMBER"
460
+                  data-rule="minlen:4"
461
+                  data-msg="Please enter your spouse's cellphone number"
462
+                  v-model="indiv.spouseCellnumber"
463
+                />
464
+                <div class="validation"></div>
465
+              </div>
466
+            </div>
467
+          </div>
468
+
403 469
           <div class="section-header">
404 470
             <h2>Address</h2>
405 471
           </div>
@@ -494,58 +560,6 @@
494 560
               </div>
495 561
             </div>
496 562
           </div>
497
-          <div class="section-header">
498
-            <h2>Banking Details</h2>
499
-          </div>
500
-          <div class="form">
501
-            <div class="form-row">
502
-              <div class="form-group col-md-6">
503
-                <div class="input-group">
504
-                  <label
505
-                    v-if="!indiv.bankingDetails.bank"
506
-                    class="uniSelectLabel"
507
-                    for="weekInfoRegionSelect"
508
-                  >BANK</label>
509
-
510
-                  <select
511
-                    id="weekInfoRegionSelect"
512
-                    class="form-control uniSelect"
513
-                    @change="regionChange()"
514
-                    style="font-size: 15px"
515
-                    v-model="indiv.bankingDetails.bank"
516
-                  >
517
-                    <option v-for="bank in banks" :key="bank.id" :value="bank">{{ bank.name }}</option>
518
-                  </select>
519
-                </div>
520
-                <div class="validation"></div>
521
-              </div>
522
-              <div class="form-group col-md-6">
523
-                <input
524
-                  type="text"
525
-                  class="form-control"
526
-                  name="acc-nr"
527
-                  id="acc-nr"
528
-                  placeholder="Account Number"
529
-                  data-msg="Please enter account number"
530
-                  v-model="indiv.bankingDetails.accountNumber"
531
-                />
532
-                <div class="validation"></div>
533
-              </div>
534
-              <div class="form-group col-md-6">
535
-                <input
536
-                  type="text"
537
-                  name="holder"
538
-                  class="form-control"
539
-                  id="holder"
540
-                  placeholder="Account Holder"
541
-                  data-rule="minlen:4"
542
-                  data-msg="Please enter account holder"
543
-                  v-model="indiv.bankingDetails.accountHolder"
544
-                />
545
-                <div class="validation"></div>
546
-              </div>
547
-            </div>
548
-          </div>
549 563
 
550 564
           <div class="section-header">
551 565
             <h2>Share Transfer Information</h2>
@@ -559,9 +573,9 @@
559 573
                 class="form-group col-md-12"
560 574
                 style="border:solid;border-width:2px; border-color:rgb(27, 117, 187); border-radius: 3px"
561 575
               >
562
-                <p
563
-                  style="text-align: left; margin:auto; padding:10px"
564
-                >1. With respect to my timeshare module/week, I confirm that:</p>
576
+                <p style="text-align: left; margin:auto; padding:10px">
577
+                  1. With respect to my timeshare module/week, I confirm that:
578
+                </p>
565 579
                 <div class="validation"></div>
566 580
               </div>
567 581
             </div>
@@ -579,10 +593,9 @@
579 593
                     :checked="sellItem.leviesPaidInFull"
580 594
                     @change="changeLeviesPaidInFull"
581 595
                   />
582
-                  <label
583
-                    class="custom-control-label"
584
-                    for="customSwitch3"
585
-                  >{{ sellItem.leviesPaidInFull ? "Yes" : "No" }}</label>
596
+                  <label class="custom-control-label" for="customSwitch3">{{
597
+                    sellItem.leviesPaidInFull ? "Yes" : "No"
598
+                  }}</label>
586 599
                 </div>
587 600
                 <div class="validation"></div>
588 601
               </div>
@@ -590,7 +603,7 @@
590 603
 
591 604
             <div class="form-row">
592 605
               <div class="col-md-8">
593
-                <p>1.2. My week is placed for rental this year</p>
606
+                <p>1.2. My week is placed on rental or exchange this year</p>
594 607
               </div>
595 608
               <div class="form-group col-md-2">
596 609
                 <div class="custom-control custom-switch">
@@ -601,10 +614,9 @@
601 614
                     :checked="sellItem.weekPlacedForRental"
602 615
                     @change="changeWeekPlacedForRental"
603 616
                   />
604
-                  <label
605
-                    class="custom-control-label"
606
-                    for="customSwitch4"
607
-                  >{{ sellItem.weekPlacedForRental ? "Yes" : "No" }}</label>
617
+                  <label class="custom-control-label" for="customSwitch4">{{
618
+                    sellItem.weekPlacedForRental ? "Yes" : "No"
619
+                  }}</label>
608 620
                 </div>
609 621
                 <div class="validation"></div>
610 622
               </div>
@@ -710,19 +722,24 @@
710 722
 
711 723
             <div class="form-row">
712 724
               <div class="col-md-8">
713
-                <p>1.8. Mandate to sell timeshare</p>
725
+                <p>
726
+                  1.8. I hereby Mandate Uni-Vate properties to sell the timeshare listed above on my
727
+                  behalf
728
+                </p>
714 729
               </div>
715 730
               <div class="form-group col-md-4">
716
-                <div class="custom-file">
717
-                  <input class="custom-file-input mb-2" type="file" name="mandate" />
718
-                  <label class="custom-file-label" for="customFile">Choose file</label>
719
-                </div>
720
-
721
-                <div class="validation"></div>
731
+                <input type="checkbox" @change="SetMandateDate" v-model="sellItem.mandate" />
722 732
               </div>
723 733
             </div>
724
-            <div class="text-center col-12">
725
-              <button class="btn-solid-blue" v-if="!sellItem.id" @click="submitSale()">SUBMIT</button>
734
+            <div class="form-row" v-if="!CanSave">
735
+              <div class="col-md-12">
736
+                <p class="alert myError">Please ensure that you add spouse details.</p>
737
+              </div>
738
+            </div>
739
+            <div class="text-center col-12" v-if="CanSave">
740
+              <button class="btn-solid-blue" v-if="!sellItem.id" @click="submitSale()">
741
+                SUBMIT
742
+              </button>
726 743
               <button class="btn-solid-blue" v-else @click="newSale()">NEW WEEK</button>
727 744
             </div>
728 745
             <div class="text-center col-12">
@@ -747,23 +764,24 @@ import { mapState, mapActions, mapGetters } from "vuex";
747 764
 import addressAutoComplete from "../../shared/addressAutoComplete";
748 765
 import Alert from "../../shared/alert.vue";
749 766
 import Log from "../../../assets/Log";
767
+import _ from "lodash";
750 768
 
751 769
 export default {
752 770
   name: "TimeshareToSell",
753 771
   props: {
754 772
     weekId: {
755
-      default: 0,
756
-    },
773
+      default: 0
774
+    }
757 775
   },
758 776
   data() {
759 777
     return {
760 778
       wait: false,
761
-      userLoggedIn: Log.isLoggedIn(),
779
+      userLoggedIn: Log.isLoggedIn()
762 780
     };
763 781
   },
764 782
   components: {
765 783
     addressAutoComplete,
766
-    Alert,
784
+    Alert
767 785
   },
768 786
   mounted() {
769 787
     if (this.sellItem.id) {
@@ -789,13 +807,13 @@ export default {
789 807
       "sellItem",
790 808
       "agencies",
791 809
       "agents",
792
-      "getTemplate",
810
+      "getTemplate"
793 811
     ]),
794 812
     ...mapState("individual", ["indiv"]),
795 813
     ...mapState("authentication", ["isLoggedIn"]),
796 814
     ...mapGetters({
797 815
       user: "authentication/getUser",
798
-      person: "authentication/getPerson",
816
+      person: "authentication/getPerson"
799 817
     }),
800 818
     ...mapState("bank", ["banks"]),
801 819
     refAgent() {
@@ -803,14 +821,9 @@ export default {
803 821
     },
804 822
     filteredResort() {
805 823
       let list = [];
806
-      if (
807
-        this.sellItem &&
808
-        this.sellItem.region &&
809
-        this.sellItem.region.regionCode
810
-      ) {
824
+      if (this.sellItem && this.sellItem.region && this.sellItem.region.regionCode) {
811 825
         const item = this.detailedRegion.find(
812
-          (region) =>
813
-            region.region.regionCode === this.sellItem.region.regionCode
826
+          region => region.region.regionCode === this.sellItem.region.regionCode
814 827
         );
815 828
         if (item) {
816 829
           list = item.children;
@@ -818,14 +831,14 @@ export default {
818 831
       } else {
819 832
         list = this.resorts;
820 833
       }
821
-      return _.sortBy(list, (x) => x.resortName);
834
+      return _.sortBy(list, x => x.resortName);
822 835
     },
823 836
     isLoggedIn() {
824 837
       return this.user && this.person;
825 838
     },
826 839
     displayNotDeletedAgents() {
827 840
       var notDeletedArr = [];
828
-      this.agents.forEach((agent) => {
841
+      this.agents.forEach(agent => {
829 842
         if (!agent.isDeleted) {
830 843
           if (agent.agencyId === this.sellItem.agencyId) {
831 844
             notDeletedArr.push(agent);
@@ -834,15 +847,19 @@ export default {
834 847
       });
835 848
       return notDeletedArr;
836 849
     },
850
+    CanSave() {
851
+      if (this.indiv.howMarried === "In Community Of Property") {
852
+        if (this.indiv.spouseName || this.indiv.spouseSurname || this.spouseEmail) {
853
+          return true;
854
+        }
855
+        return false;
856
+      }
857
+      return true;
858
+    }
837 859
   },
838 860
   methods: {
839 861
     ...mapActions("individual", ["getIndividual"]),
840
-    ...mapActions("timeshare", [
841
-      "initTimeshare",
842
-      "onResortChange",
843
-      "saveWeek",
844
-      "getBlankWeek",
845
-    ]),
862
+    ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek", "getBlankWeek"]),
846 863
     ...mapActions("payment", ["addPayment"]),
847 864
     ...mapActions("bank", ["getBanks"]),
848 865
     newSale() {
@@ -853,10 +870,9 @@ export default {
853 870
       if (this.userLoggedIn) {
854 871
         this.sellItem.ownerObject = this.indiv;
855 872
         this.sellItem.status = undefined;
856
-        console.log(JSON.stringify(this.sellItem));
857
-        //   this.saveWeek(this.sellItem).then((fulfilled) => {
858
-        //     this.paygateRedirect();
859
-        //   });
873
+        this.saveWeek(this.sellItem).then(fulfilled => {
874
+          this.paygateRedirect();
875
+        });
860 876
       } else this.$router.push("/user/login");
861 877
     },
862 878
     paygateRedirect() {
@@ -866,16 +882,16 @@ export default {
866 882
         creatydById: Log.getUser().id, //Log.getUser().id,
867 883
         amount: 380.0,
868 884
         paymentStatus: "",
869
-        paymentToken: "",
885
+        paymentToken: ""
870 886
       };
871 887
 
872
-      this.addPayment(paymentObj).then((res) => {
888
+      this.addPayment(paymentObj).then(res => {
873 889
         this.$router.push({
874 890
           name: "PaymentGateway",
875 891
           params: {
876 892
             paymentReqId: res.PAY_REQUEST_ID,
877
-            checksum: res.CHECKSUM,
878
-          },
893
+            checksum: res.CHECKSUM
894
+          }
879 895
         });
880 896
       });
881 897
     },
@@ -900,7 +916,7 @@ export default {
900 916
     resortChange() {
901 917
       this.onResortChange({
902 918
         resortName: this.sellItem.resort.resortName,
903
-        resortCode: this.sellItem.resort.resortCode,
919
+        resortCode: this.sellItem.resort.resortCode
904 920
       });
905 921
 
906 922
       if (this.sellItem && this.sellItem.resort === "Other") {
@@ -912,9 +928,7 @@ export default {
912 928
       }
913 929
     },
914 930
     regionChange() {
915
-      this.sellItem.regionId = this.sellItem.region
916
-        ? this.sellItem.region.id
917
-        : 1;
931
+      this.sellItem.regionId = this.sellItem.region ? this.sellItem.region.id : 1;
918 932
     },
919 933
     UpdateAddress(address) {
920 934
       this.indiv.address.streetNumber = address.streetNumber;
@@ -924,7 +938,14 @@ export default {
924 938
       this.indiv.address.suburb = address.suburb;
925 939
       this.indiv.address.postalCode = address.postalCode;
926 940
     },
927
-  },
941
+    SetMandateDate() {
942
+      if (this.sellItem.mandate) {
943
+        this.sellItem.mandateDate = new Date();
944
+      } else {
945
+        this.sellItem.mandateDate = undefined;
946
+      }
947
+    }
948
+  }
928 949
 };
929 950
 </script>
930 951
 

正在加载...
取消
保存