瀏覽代碼

Timeshare Admin page

master
Lene 4 年之前
父節點
當前提交
9a8481739b

+ 754
- 0
src/components/admin/status/editTimeShareAdminPage.vue 查看文件

@@ -0,0 +1,754 @@
1
+<template>
2
+<main id="main">
3
+  <section id="contact2">
4
+    <div class="container">
5
+      <div class="row">
6
+        <div class="col-lg-12">
7
+          <div class="section-header">
8
+            <h2>Week Information</h2>
9
+          </div>
10
+
11
+          <div align="left" class="custom-control custom-switch mb-2">
12
+            <div class="row">
13
+              <div align="center" class="col">
14
+                <!-- <label class="mr-5">Were you referred by an agent?</label> -->
15
+                <!-- <input
16
+                  type="checkbox"
17
+                  class="custom-control-input"
18
+                  id="customSwitch1"
19
+                  :checked="refAgent"
20
+                  @change="changeRef"
21
+                /> -->
22
+                <!-- <label class="custom-control-label" for="customSwitch1">{{
23
+                  refAgent ? "Yes" : "No"
24
+                }}</label> -->
25
+                <!-- <div class="refbyAgent" :class="{ 'refbyAgent--clicked': refAgent }">
26
+                  <div class="col-md-6" v-if="refAgent">
27
+                    <label for="Name of Agency">Agency</label>
28
+                    <select
29
+                      class="form-control uniSelect"
30
+                      id="Agency"
31
+                      name="agency"
32
+                      v-model="sellItem.agencyId"
33
+                    >
34
+                      <option v-for="(item, i) in agencies" :key="i" :value="item.id">
35
+                        {{ item.agencyName }}
36
+                      </option>
37
+                    </select>
38
+                  </div>
39
+                  <div class="col-md-6" v-if="refAgent">
40
+                    <label for="Name of Agent">Agent</label>
41
+                    <select
42
+                      class="form-control uniSelect"
43
+                      id="agent"
44
+                      name="agent"
45
+                      v-model="sellItem.agentId"
46
+                      :disabled="!sellItem.agencyId"
47
+                    >
48
+                      <option
49
+                        v-for="(item, i) in displayNotDeletedAgents"
50
+                        :key="i"
51
+                        :value="item.id"
52
+                      >
53
+                        <div>{{ item.name + " " + item.surname }}</div>
54
+                      </option>
55
+                    </select>
56
+                  </div>
57
+                </div> -->
58
+              </div>
59
+            </div>
60
+          </div>
61
+
62
+          <div class="form">
63
+            <div id="sendmessage">Your details has been sent. Thank you!</div>
64
+            <div id="errormessage"></div>
65
+            <div class="form-row">
66
+              <div class="form-group col-md-6">
67
+                <div class="input-group">
68
+                  <label v-if="!sellItem.region" class="uniSelectLabel" for="weekInfoRegionSelect"
69
+                    >REGION</label
70
+                  >
71
+
72
+                  <select
73
+                    id="weekInfoRegionSelect"
74
+                    class="form-control uniSelect"
75
+                    v-model="sellItem.region"
76
+                    @change="regionChange()"
77
+                    style="font-size: 15px"
78
+                  >
79
+                    <option v-for="(region, r) in regions" :key="r" :value="region">{{
80
+                      region.regionName
81
+                    }}</option>
82
+                  </select>
83
+                </div>
84
+                <div class="validation"></div>
85
+              </div>
86
+              <div class="form-group col-md-6">
87
+                <div class="input-group">
88
+                  <label v-if="!sellItem.resort" class="uniSelectLabel" for="weekInfoResortSelect"
89
+                    >RESORT NAME</label
90
+                  >
91
+
92
+                  <select
93
+                    id="weekInfoResortSelect"
94
+                    class="form-control uniSelect"
95
+                    v-model="sellItem.resort"
96
+                    @change="resortChange()"
97
+                  >
98
+                    <option value="Other">Other</option>
99
+                    <option v-for="(resort, r) in filteredResort" :key="r" :value="resort">{{
100
+                      resort.resortName
101
+                    }}</option>
102
+                  </select>
103
+                </div>
104
+                <div class="validation"></div>
105
+              </div>
106
+              <div class="form-group col-md-6">
107
+                <input
108
+                  class="form-control"
109
+                  v-if="sellItem.otherResort"
110
+                  placeholder="NAME OF RESORT (* IF OTHER)"
111
+                  type="text"
112
+                  name="other"
113
+                  v-model="sellItem.otherResortName"
114
+                />
115
+              </div>
116
+              <div class="form-group col-md-6">
117
+                <div v-if="sellItem.otherResort">
118
+                  <label v-if="!sellItem.region" class="uniSelectLabel" for="region">REGION</label>
119
+                </div>
120
+
121
+                <select
122
+                  class="form-control uniSelect"
123
+                  v-if="sellItem.otherResort"
124
+                  name="region"
125
+                  id="region"
126
+                  v-model="sellItem.region"
127
+                >
128
+                  <option v-for="(region, r) in regions" :key="r">{{ region.regionName }}</option>
129
+                </select>
130
+              </div>
131
+              <div class="form-group col-md-6">
132
+                <input
133
+                  type="number"
134
+                  class="form-control"
135
+                  name="unitNumber"
136
+                  id="unitNumber"
137
+                  placeholder="UNIT NUMBER"
138
+                  v-model="sellItem.unitNumber"
139
+                  data-msg="Please enter unit number"
140
+                />
141
+                <div class="validation"></div>
142
+              </div>
143
+              <div class="form-group col-md-6">
144
+                <input
145
+                  type="number"
146
+                  class="form-control"
147
+                  name="week"
148
+                  id="week"
149
+                  placeholder="UNIT / WEEK NUMBER"
150
+                  v-model="sellItem.module"
151
+                  data-msg="Please enter week number"
152
+                />
153
+                <div class="validation"></div>
154
+              </div>
155
+              <div class="form-group col-md-6">
156
+                <label v-if="!sellItem.season" class="uniSelectLabel" for="region">SEASON</label>
157
+
158
+                <select
159
+                  class="form-control uniSelect"
160
+                  name="region"
161
+                  id="region"
162
+                  v-model="sellItem.season"
163
+                >
164
+                  <option v-for="(season, r) in seasons" :key="r">{{ season.name }}</option>
165
+                </select>
166
+                <div class="validation"></div>
167
+              </div>
168
+              <div class="form-group col-md-6">
169
+                <label v-if="!sellItem.bedrooms" class="uniSelectLabel" for="region"
170
+                  >BEDROOM/S</label
171
+                >
172
+
173
+                <select
174
+                  class="form-control uniSelect"
175
+                  name="region"
176
+                  id="region"
177
+                  v-model="sellItem.bedrooms"
178
+                >
179
+                  <option v-for="(item, i) in resortBedrooms" :key="i">{{ item }}</option>
180
+                </select>
181
+                <div class="validation"></div>
182
+              </div>
183
+              <div class="form-group col-md-6">
184
+                <label v-if="!sellItem.maxSleep" class="uniSelectLabel" for="region"
185
+                  >SLEEP MAX</label
186
+                >
187
+
188
+                <select
189
+                  class="form-control uniSelect"
190
+                  name="region"
191
+                  id="region"
192
+                  v-model="sellItem.maxSleep"
193
+                >
194
+                  <option v-for="(item, i) in maxSleep" :key="i">{{ item }}</option>
195
+                </select>
196
+                <div class="validation"></div>
197
+              </div>
198
+              <div class="form-group col-md-6">
199
+                <input
200
+                  type="number"
201
+                  class="form-control"
202
+                  name="levy"
203
+                  id="levy"
204
+                  placeholder="Levy Amount"
205
+                  v-model="sellItem.levyAmount"
206
+                  data-msg="Please enter levy amount"
207
+                />
208
+                <div class="validation"></div>
209
+              </div>
210
+              <div class="form-group col-md-6">
211
+                <label v-if="!sellItem.weekType" class="uniSelectLabel" for="region"
212
+                  >WEEK TYPE</label
213
+                >
214
+                <select
215
+                  class="form-control uniSelect"
216
+                  name="region"
217
+                  id="region"
218
+                  v-model="sellItem.weekType"
219
+                >
220
+                  <option :key="0">Flexi</option>
221
+                  <option :key="1">Fixed</option>
222
+                  <option :key="2">Module</option>
223
+                  <option :key="3">Syndicate</option>
224
+                </select>
225
+              </div>
226
+                          <div class="form-row">
227
+              <div class="form-group col-md-6">
228
+                Arrival Date :
229
+                <input
230
+                  type="date"
231
+                  class="form-control"
232
+                  name="occupationDate1"
233
+                  v-model="sellItem.arrivalDate"
234
+                />
235
+                <div class="validation"></div>
236
+              </div>
237
+              <div class="form-group col-md-6">
238
+                Departure Date :
239
+                <input
240
+                  type="date"
241
+                  class="form-control"
242
+                  name="occupationDate2"
243
+                  v-model="sellItem.departureDate"
244
+                />
245
+                <div class="validation"></div>
246
+              </div>
247
+              <div class="form-group col-md-6">
248
+                  Purchase Price:
249
+                <input
250
+                  class="form-control"
251
+                  placeholder="R"
252
+                  type="number"
253
+                  step="any"
254
+                  name="purchasePrice"
255
+                  v-model="sellItem.originalPurchasePrice"
256
+                />
257
+                <div class="validation"></div>
258
+              </div>
259
+
260
+            </div>
261
+            </div>
262
+          </div>
263
+          <div align="left" class="custom-control custom-switch mb-2">
264
+            <div class="row">
265
+              <div align="center" class="col">
266
+                <label class="mr-5">Has your week been spacebanked for the current year?</label>
267
+                <input
268
+                  type="checkbox"
269
+                  class="custom-control-input"
270
+                  id="customSwitch2"
271
+                  :checked="sellItem.currentYearBanked"
272
+                  @change="changeCurrentBanked"
273
+                />
274
+                <label class="custom-control-label" for="customSwitch2">{{
275
+                  sellItem.currentYearBanked ? "Yes" : "No"
276
+                }}</label>
277
+                <div
278
+                  class="spacebanked1"
279
+                  :class="{ 'spacebanked1--clicked': sellItem.currentYearBanked }"
280
+                >
281
+                  <div class="col-md-6">
282
+                    <label for="If yes, please confirm with whom" v-if="sellItem.currentYearBanked"
283
+                      >Please confirm with whom</label
284
+                    >
285
+                    <select
286
+                      class="form-control uniSelect"
287
+                      name="spacebankOwner"
288
+                      v-if="sellItem.currentYearBanked"
289
+                      v-model="sellItem.bankedWith"
290
+                    >
291
+                      <option v-for="(item, i) in bankedEntities" :key="i">{{ item }}</option>
292
+                    </select>
293
+                  </div>
294
+                </div>
295
+              </div>
296
+            </div>
297
+          </div>
298
+
299
+          <div class="section-header">
300
+            <h2>Detailed Individual Information</h2>
301
+          </div>
302
+          <div class="form">
303
+            <div class="row">
304
+              <div class="form-group col-md-6">
305
+                <input
306
+                  type="text"
307
+                  name="name"
308
+                  class="form-control"
309
+                  id="name"
310
+                  placeholder="Name"
311
+                  data-rule="minlen:4"
312
+                  data-msg="Please enter your name"
313
+                  v-model="indiv.name"
314
+                />
315
+                <div class="validation"></div>
316
+              </div>
317
+              <div class="form-group col-md-6">
318
+                <input
319
+                  type="text"
320
+                  class="form-control"
321
+                  name="surname"
322
+                  id="surname"
323
+                  placeholder="Surname"
324
+                  data-msg="Please enter your surname"
325
+                  v-model="indiv.surname"
326
+                />
327
+                <div class="validation"></div>
328
+              </div>
329
+            </div>
330
+            <div class="row">
331
+              <div class="form-group col-md-6">
332
+                <input
333
+                  type="text"
334
+                  name="idnum"
335
+                  class="form-control"
336
+                  id="idnum"
337
+                  placeholder="ID Number"
338
+                  data-rule="minlen:4"
339
+                  data-msg="Please enter your ID number"
340
+                  v-model="indiv.idNumber"
341
+                />
342
+                <div class="validation"></div>
343
+              </div>
344
+              <div class="form-group col-md-6">
345
+                <input
346
+                  type="text"
347
+                  class="form-control"
348
+                  name="company"
349
+                  id="company"
350
+                  placeholder="Company Reg Number"
351
+                  data-rule="minlen:4"
352
+                  data-msg="Please enter your company reg number"
353
+                  v-model="indiv.companyRegNumber"
354
+                />
355
+                <div class="validation"></div>
356
+              </div>
357
+            </div>
358
+            <div class="row">
359
+              <div class="form-group col-md-6">
360
+                <div class="input-group">
361
+                  <label
362
+                    v-if="!indiv.howMarried || indiv.howMarried === 'N/A'"
363
+                    for="howMarried"
364
+                    class="uniSelectLabel"
365
+                    >Marital Status</label
366
+                  >
367
+                  <select class="form-control uniSelect" id="howMarried" v-model="indiv.howMarried">
368
+                    <option value="N/A">N/A</option>
369
+                    <option value="In Community Of Property">In Community Of Property</option>
370
+                    <option value="Out of Community Of Property"
371
+                      >Out of Community Of Property</option
372
+                    >
373
+                    <option value="Other">Other</option>
374
+                    <option value="Traditional Wedding">Traditional Wedding</option>
375
+                    <option value="Single">Single</option>
376
+                    <option value="Divorced">Divorced</option>
377
+                    <option value="Widow">Widow</option>
378
+                    <option value="Committed Relationship">Committed Relationship</option>
379
+                    <option value="Partner">Partner</option>
380
+                  </select>
381
+                </div>
382
+                <div class="validation"></div>
383
+              </div>
384
+              <div class="form-group col-md-6">
385
+                <input
386
+                  type="text"
387
+                  class="form-control"
388
+                  name="email"
389
+                  id="email"
390
+                  placeholder="Email Address"
391
+                  data-msg="Please enter your email address"
392
+                  v-model="indiv.emailAddress"
393
+                />
394
+                <div class="validation"></div>
395
+              </div>
396
+            </div>
397
+            <div class="row">
398
+              <div class="form-group col-md-6">
399
+                <input
400
+                  type="text"
401
+                  name="cell"
402
+                  class="form-control"
403
+                  id="cell"
404
+                  placeholder="Cell Number"
405
+                  data-rule="minlen:4"
406
+                  data-msg="Please enter your cell number"
407
+                  v-model="indiv.cellNumner"
408
+                />
409
+                <div class="validation"></div>
410
+              </div>
411
+              <div class="form-group col-md-6">
412
+                <input
413
+                  type="text"
414
+                  class="form-control"
415
+                  name="landline"
416
+                  id="landline"
417
+                  placeholder="Landline Number"
418
+                  data-msg="Please enter your landline number"
419
+                  v-model="indiv.landlineNumber"
420
+                />
421
+                <div class="validation"></div>
422
+              </div>
423
+            </div>
424
+          </div>
425
+          <div v-if="indiv.howMarried === 'In Community Of Property'" class="section-header">
426
+            <h2>Spouse Details</h2>
427
+          </div>
428
+          <div v-if="indiv.howMarried === 'In Community Of Property'" class="form">
429
+            <div class="form-row">
430
+              <div class="form-group col-md-6">
431
+                <input
432
+                  type="text"
433
+                  class="form-control"
434
+                  placeholder="SPOUSE NAME"
435
+                  data-msg="Please enter your spouse's name"
436
+                  v-model="indiv.spouseName"
437
+                />
438
+                <div class="validation"></div>
439
+              </div>
440
+              <div class="form-group col-md-6">
441
+                <input
442
+                  type="text"
443
+                  class="form-control"
444
+                  placeholder="SPOUSE SURNAME"
445
+                  data-msg="Please enter your spouse's surname"
446
+                  v-model="indiv.spouseSurname"
447
+                />
448
+                <div class="validation"></div>
449
+              </div>
450
+              <div class="form-group col-md-6">
451
+                <input
452
+                  type="text"
453
+                  class="form-control"
454
+                  placeholder="SPOUSE EMAIL"
455
+                  data-rule="minlen:4"
456
+                  data-msg="Please enter your spouse's email"
457
+                  v-model="indiv.spouseEmail"
458
+                />
459
+                <div class="validation"></div>
460
+              </div>
461
+              <div class="form-group col-md-6">
462
+                <input
463
+                  type="text"
464
+                  class="form-control"
465
+                  placeholder="SPOUSE TELEPHONE"
466
+                  data-rule="minlen:4"
467
+                  data-msg="Please enter your spouse's telephone number"
468
+                  v-model="indiv.spouseTelephone"
469
+                />
470
+                <div class="validation"></div>
471
+              </div>
472
+              <div class="form-group col-md-6">
473
+                <input
474
+                  type="text"
475
+                  class="form-control"
476
+                  placeholder="SPOUSE CELL NUMBER"
477
+                  data-rule="minlen:4"
478
+                  data-msg="Please enter your spouse's cellphone number"
479
+                  v-model="indiv.spouseCellnumber"
480
+                />
481
+                <div class="validation"></div>
482
+              </div>
483
+            </div>
484
+                          <div class="form-group col-md-6">
485
+                <input
486
+                  type="text"
487
+                  class="form-control"
488
+                  placeholder="SPOUSE CELL NUMBER"
489
+                  data-rule="minlen:4"
490
+                  data-msg="Please enter your spouse's cellphone number"
491
+                  v-model="indiv.spouseCellnumber"
492
+                />
493
+                <div class="validation"></div>
494
+              </div>
495
+          </div>
496
+
497
+          <div class="form">
498
+            <div id="sendmessage">Your details has been sent. Thank you!</div>
499
+            <div id="errormessage"></div>
500
+
501
+            <div class="form-row" v-if="!CanSave">
502
+              <div class="col-md-12">
503
+                <p class="alert myError">Please ensure that you add spouse details.</p>
504
+              </div>
505
+            </div>
506
+            <div class="text-center col-12" v-if="CanSave">
507
+              <button class="btn-solid-blue" v-if="!sellItem.id" @click="submitSale()">
508
+                Save
509
+              </button>
510
+            </div>
511
+            <div class="text-center col-12">
512
+              <button class="btn-solid-blue" @click="paygateRedirect()">Back</button>
513
+            </div>
514
+            <br />
515
+            <br />
516
+          </div>
517
+        </div>
518
+
519
+        <br />
520
+        <br />
521
+      </div>
522
+      <div v-if="wait" id="preloader"></div>
523
+    </div>
524
+  </section>
525
+</main>
526
+</template>
527
+
528
+<script>
529
+/* eslint-disable */
530
+import { mapState, mapActions, mapGetters } from "vuex";
531
+import addressAutoComplete from "../../shared/addressAutoComplete";
532
+import Alert from "../../shared/alert.vue";
533
+import Log from "../../../assets/Log";
534
+import _ from "lodash";
535
+
536
+export default {
537
+  name: "EditTimeshare",
538
+  props: {
539
+    weekId: {
540
+      default: 0
541
+    }
542
+  },
543
+  data() {
544
+    return {
545
+      wait: false,
546
+      userLoggedIn: Log.isLoggedIn(),
547
+      listedWeekId: this.$route.params.id
548
+    };
549
+  },
550
+  components: {
551
+    addressAutoComplete,
552
+    Alert
553
+  },
554
+  mounted() {
555
+    if (this.sellItem.id) {
556
+      this.newSale();
557
+    }
558
+    this.initTimeshare(0);
559
+    this.getIndividual(Log.getUser().id);
560
+    this.getBanks();
561
+  },
562
+  created() {
563
+    this.initTimeshare(this.weekId);
564
+  },
565
+  computed: {
566
+    ...mapState("timeshare", [
567
+      "resorts",
568
+      "regions",
569
+      "detailedRegion",
570
+      "seasons",
571
+      "result",
572
+      "resortBedrooms",
573
+      "maxSleep",
574
+      "bankedEntities",
575
+      "sellItem",
576
+      "agencies",
577
+      "agents",
578
+      "getTemplate"
579
+    ]),
580
+    ...mapState("individual", ["indiv"]),
581
+    ...mapState("authentication", ["isLoggedIn"]),
582
+    ...mapGetters({
583
+      user: "authentication/getUser",
584
+      person: "authentication/getPerson"
585
+    }),
586
+    ...mapState("bank", ["banks"]),
587
+    refAgent() {
588
+      return this.sellItem && this.sellItem.referedByAgent;
589
+    },
590
+    filteredResort() {
591
+      let list = [];
592
+      if (this.sellItem && this.sellItem.region && this.sellItem.region.regionCode) {
593
+        const item = this.detailedRegion.find(
594
+          region => region.region.regionCode === this.sellItem.region.regionCode
595
+        );
596
+        if (item) {
597
+          list = item.children;
598
+        }
599
+      } else {
600
+        list = this.resorts;
601
+      }
602
+      return _.sortBy(list, x => x.resortName);
603
+    },
604
+    isLoggedIn() {
605
+      return this.user && this.person;
606
+    },
607
+    displayNotDeletedAgents() {
608
+      var notDeletedArr = [];
609
+      this.agents.forEach(agent => {
610
+        if (!agent.isDeleted) {
611
+          if (agent.agencyId === this.sellItem.agencyId) {
612
+            notDeletedArr.push(agent);
613
+          }
614
+        }
615
+      });
616
+      return notDeletedArr;
617
+    },
618
+    CanSave() {
619
+      if (this.indiv.howMarried === "In Community Of Property") {
620
+        if (this.indiv.spouseName || this.indiv.spouseSurname || this.spouseEmail) {
621
+          return true;
622
+        }
623
+        return false;
624
+      }
625
+      return true;
626
+    }
627
+  },
628
+  methods: {
629
+    ...mapActions("individual", ["getIndividual"]),
630
+    ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek", "getBlankWeek"]),
631
+    ...mapActions("payment", ["addPayment"]),
632
+    ...mapActions("bank", ["getBanks"]),
633
+    newSale() {
634
+      this.weekId = 0;
635
+      this.getBlankWeek();
636
+    },
637
+    submitSale() {
638
+      if (this.userLoggedIn) {
639
+        this.sellItem.ownerObject = this.indiv;
640
+        this.sellItem.status = undefined;
641
+        this.saveWeek(this.sellItem).then(fulfilled => {
642
+          this.paygateRedirect();
643
+        });
644
+      } else this.$router.push("/user/login");
645
+    },
646
+    paygateRedirect() {
647
+      var paymentObj = {
648
+        timeshareWeekId: this.sellItem.id, // this.sellItem.Id,
649
+        propertyId: 0,
650
+        creatydById: Log.getUser().id, //Log.getUser().id,
651
+        amount: 380.0,
652
+        paymentStatus: "",
653
+        paymentToken: ""
654
+      };
655
+
656
+      this.addPayment(paymentObj).then(res => {
657
+        this.$router.push({
658
+          name: "PaymentGateway",
659
+          params: {
660
+            paymentReqId: res.PAY_REQUEST_ID,
661
+            checksum: res.CHECKSUM
662
+          }
663
+        });
664
+      });
665
+    },
666
+    previewFiles(event) {
667
+      console.log(event.target.files);
668
+    },
669
+    changeRef() {
670
+      this.sellItem.agent = undefined;
671
+      this.sellItem.agency = undefined;
672
+      this.sellItem.referedByAgent = !this.sellItem.referedByAgent;
673
+    },
674
+    changeLeviesPaidInFull() {
675
+      this.sellItem.leviesPaidInFull = !this.sellItem.leviesPaidInFull;
676
+    },
677
+    changeWeekPlacedForRental() {
678
+      this.sellItem.weekPlacedForRental = !this.sellItem.weekPlacedForRental;
679
+    },
680
+    changeCurrentBanked() {
681
+      this.sellItem.bankedWith = undefined;
682
+      this.sellItem.currentYearBanked = !this.sellItem.currentYearBanked;
683
+    },
684
+    resortChange() {
685
+      this.onResortChange({
686
+        resortName: this.sellItem.resort.resortName,
687
+        resortCode: this.sellItem.resort.resortCode
688
+      });
689
+
690
+      if (this.sellItem && this.sellItem.resort === "Other") {
691
+        this.sellItem.otherResortName = undefined;
692
+        this.sellItem.otherResort = true;
693
+      } else {
694
+        this.sellItem.otherResortName = undefined;
695
+        this.sellItem.otherResort = false;
696
+      }
697
+    },
698
+    regionChange() {
699
+      this.sellItem.regionId = this.sellItem.region ? this.sellItem.region.id : 1;
700
+    },
701
+    UpdateAddress(address) {
702
+      this.indiv.address.streetNumber = address.streetNumber;
703
+      this.indiv.address.street = address.streetName;
704
+      this.indiv.address.province = address.province;
705
+      this.indiv.address.city = address.city;
706
+      this.indiv.address.suburb = address.suburb;
707
+      this.indiv.address.postalCode = address.postalCode;
708
+    },
709
+    SetMandateDate() {
710
+      if (this.sellItem.mandate) {
711
+        this.sellItem.mandateDate = new Date();
712
+      } else {
713
+        this.sellItem.mandateDate = undefined;
714
+      }
715
+    }
716
+  }
717
+};
718
+</script>
719
+
720
+<style lang="scss" scoped>
721
+.refbyAgent {
722
+  will-change: transform;
723
+  transition: height 500ms;
724
+  height: 0px;
725
+}
726
+
727
+.refbyAgent--clicked {
728
+  height: 150px;
729
+}
730
+
731
+.spacebanked1 {
732
+  will-change: transform;
733
+  transition: height 500ms;
734
+  height: 0px;
735
+}
736
+
737
+.spacebanked1--clicked {
738
+  height: 150px;
739
+}
740
+
741
+.custom-file-label {
742
+  border-width: 2px;
743
+  border-color: rgb(27, 117, 187);
744
+  margin-bottom: 20px;
745
+}
746
+
747
+.custom-file-label::after {
748
+  border-left: none;
749
+  border-bottom: solid;
750
+  border-width: 2px;
751
+  border-color: rgb(27, 117, 187);
752
+  font-family: "Muli";
753
+}
754
+</style>

+ 112
- 8
src/components/admin/status/timeshareAdminPage.vue 查看文件

@@ -1,20 +1,84 @@
1 1
 /* eslint-disable no-restricted-syntax */ /* eslint-disable guard-for-in */
2 2
 <!-- eslint-disable max-len -->
3 3
 <template>
4
-  <main id="main" style="margin-top:-20px; padding-bottom:50px">
4
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
5 5
     <div class="container">
6 6
       <div class="row">
7 7
         <div class="col">
8 8
           <div class="section-header">
9
-            <h2>Pending Weeks</h2>
9
+            <h2>All Timeshare Weeks</h2>
10 10
           </div>
11 11
         </div>
12 12
       </div>
13 13
     </div>
14 14
 
15 15
     <div class="row">
16
-      <div class="offset-1 col-md-3">
17
-        <button
16
+      <div class="offset-1 col-md-6">
17
+        <div class="form-group col-md-3">
18
+                <div class="input-group">
19
+                  <label
20
+                    class="uniSelectLabel"
21
+                    for="weekInfoRegionSelect"
22
+                  >REGION</label>
23
+
24
+                  <select
25
+                    id="weekInfoRegionSelect"
26
+                    class="form-control uniSelect"
27
+                    @change="regionChange()"
28
+                    style="font-size: 15px"
29
+                  >
30
+                    <option
31
+                      v-for="(region, r) in regions"
32
+                      :key="r"
33
+                      :value="region"
34
+                    >{{ region.regionName }}</option>
35
+                  </select>
36
+                </div>
37
+                <div class="validation"></div>
38
+              </div>
39
+
40
+                  <div class="form-group col-md-3">
41
+                <div class="input-group">
42
+                  <label
43
+                    class="uniSelectLabel"
44
+                    for="weekInfoResortSelect"
45
+                  >RESORT NAME</label>
46
+
47
+                  <select
48
+                    id="weekInfoResortSelect"
49
+                    class="form-control uniSelect"
50
+                    @change="resortChange()"
51
+                  >
52
+                    <option value="Other">Other</option>
53
+                    <option
54
+                      v-for="(resort, r) in resorts"
55
+                      :key="r"
56
+                      :value="resort"
57
+                    >{{ resort.resortName }}</option>
58
+                  </select>
59
+                </div>
60
+                  </div>
61
+
62
+                  <div class="form-group col-md-3">
63
+                <label class="uniSelectLabel" for="region">SEASON</label>
64
+
65
+                <select
66
+                  class="form-control uniSelect"
67
+                  name="region"
68
+                  id="region">
69
+                  <option v-for="(season, r) in seasons" :key="r">{{ season.name }}</option>
70
+                </select>
71
+                <div class="validation"></div>
72
+              </div>
73
+
74
+              <div class="form-group col-md-3">
75
+                <label class="uniSlectLabel">STATUS</label>
76
+                <select class="form-control uniSelect"
77
+                        name="status">
78
+                </select>
79
+              </div>
80
+              <button type="button"> Filter</button>
81
+        <!-- <button
18 82
           type="button"
19 83
           :class="{
20 84
             'form-control btn btn-primary ': 1 === 1,
@@ -25,14 +89,19 @@
25 89
           @click="onVerify()"
26 90
         >
27 91
           {{ ButtonMessage }}
28
-        </button>
29
-        <div>{{ Message }}</div>
92
+        </button> -->
93
+        <!-- <div>{{ Message }}</div> -->
30 94
       </div>
31 95
       <div class="offset-1 col-md-10">
32 96
         <ListView
33 97
           :items="getNeedsVerify"
98
+          :editable="true"
99
+          :deleteable="true"
100
+          :showCustomAction="true"
101
+          :CustomActionHeading="'Publish'"
34 102
           @onRowClick="onRowClick"
35 103
           @onClearSelected="onClearSelected"
104
+          @onEdit="onEdit"
36 105
           :showNew="false"
37 106
         />
38 107
       </div>
@@ -58,8 +127,34 @@ export default {
58 127
   },
59 128
   mounted() {
60 129
     this.getItems(this.user.id);
130
+    this.initTimeshare(0);
61 131
   },
62 132
   computed: {
133
+        ...mapState("timeshare", [
134
+      "resorts",
135
+      "regions",
136
+      "seasons",
137
+    ]),
138
+    ...mapState("individual", ["indiv"]),
139
+    filteredResort() {
140
+      let list = [];
141
+      if (
142
+        this.sellItem &&
143
+        this.sellItem.region &&
144
+        this.sellItem.region.regionCode
145
+      ) {
146
+        const item = this.detailedRegion.find(
147
+          (region) =>
148
+            region.region.regionCode === this.sellItem.region.regionCode
149
+        );
150
+        if (item) {
151
+          list = item.children;
152
+        }
153
+      } else {
154
+        list = this.resorts;
155
+      }
156
+      return _.sortBy(list, (x) => x.resortName);
157
+    },
63 158
     SelectedItems() {
64 159
       const selectedArray = [];
65 160
       this.selectedItems.forEach(x => selectedArray.push(this.items[x]));
@@ -96,6 +191,12 @@ export default {
96 191
   methods: {
97 192
     ...mapActions("myWeeks", ["getItems", "verifyWeek"]),
98 193
     ...mapActions("alert", ["success"]),
194
+     ...mapActions("timeshare", [
195
+      "initTimeshare",
196
+      "onResortChange",
197
+      "saveWeek",
198
+      "getBlankWeek",
199
+    ]),
99 200
     onVerify() {
100 201
       if (this.selectedItems.length > 0) {
101 202
         for (const i in this.selectedItems) {
@@ -113,11 +214,14 @@ export default {
113 214
       this.selectedItems = items;
114 215
     },
115 216
     onEdit(item) {
116
-      this.$router.push(`/timeshare/${item.id}`);
217
+      this.$router.push(`/editTimeShare/${item.id}`);
117 218
     },
118 219
     onClearSelected() {
119 220
       this.selectedItems = [];
120
-    }
221
+    },
222
+    //   onDelete(item) {
223
+    //   this.deleteListing(item.id);
224
+    // },
121 225
   }
122 226
 };
123 227
 </script>

+ 20
- 16
src/components/shared/navBar.vue 查看文件

@@ -186,60 +186,60 @@
186 186
                       {{ NAME }}
187 187
                     </a>
188 188
                     <ul style="margin-top:-10px;text-align:left" :class="userClass">
189
-                      <li>
189
+                      <li v-if="ROLE === 'Super Admin'">
190 190
                         <router-link to="/property/list">List Property</router-link>
191 191
                       </li>
192
-                      <li>
192
+                      <li v-if="ROLE === 'Super Admin'">
193 193
                         <router-link to="/status/list">Status</router-link>
194 194
                       </li>
195
-                      <li>
195
+                      <li v-if="ROLE === 'Super Admin'">
196 196
                         <router-link to="/status/timeshareAdmin">Timeshare Week Admin</router-link>
197 197
                       </li>
198
-                      <li>
198
+                      <li v-if="ROLE === 'Super Admin'">
199 199
                         <router-link to="/status/tenderWeekAdmin"
200 200
                           >Tender Week Management</router-link
201 201
                         >
202 202
                       </li>
203
-                      <li>
203
+                      <li v-if="ROLE === 'Super Admin'">
204 204
                         <router-link to="/unitConfiguration/list">Unit Configuration</router-link>
205 205
                       </li>
206
-                      <li>
206
+                      <li v-if="ROLE === 'Super Admin'">
207 207
                         <router-link to="/communication/template">Templates</router-link>
208 208
                       </li>
209 209
                       <hr />
210
-                      <li>
210
+                      <li v-if="ROLE === 'Super Admin'">
211 211
                         <router-link to="/status/userManagementPage"
212 212
                           >User Management & Access</router-link
213 213
                         >
214 214
                       </li>
215
-                      <li>
215
+                      <li v-if="ROLE === 'Super Admin'">
216 216
                         <router-link to="/status/changeLogPage">Changes Logs</router-link>
217 217
                       </li>
218
-                      <li>
218
+                      <li v-if="ROLE === 'Super Admin'">
219 219
                         <router-link to="/userDefinedGroups/list"
220 220
                           >Property User Defined Groups</router-link
221 221
                         >
222 222
                       </li>
223
-                      <li>
223
+                      <li v-if="ROLE === 'Super Admin'">
224 224
                         <router-link to="/propertyTypes/list">Property Types</router-link>
225 225
                       </li>
226 226
                       <hr />
227
-                      <li>
227
+                      <li v-if="ROLE === 'Super Admin'">
228 228
                         <router-link to="/searchLog">Search Logs</router-link>
229 229
                       </li>
230
-                      <li>
230
+                      <li v-if="ROLE === 'Super Admin'">
231 231
                         <router-link to="/Offers">Offers</router-link>
232 232
                       </li>
233
-                      <li>
233
+                      <li v-if="ROLE === 'Super Admin'">
234 234
                         <router-link to="/Carousel">Carousel</router-link>
235 235
                       </li>
236
-                      <li>
236
+                      <li v-if="ROLE === 'Super Admin'">
237 237
                         <router-link to="/user/updateProfileInfo">Update Info</router-link>
238 238
                       </li>
239
-                      <li>
239
+                      <li v-if="ROLE === 'Super Admin'">
240 240
                         <router-link to="/payments">Payments</router-link>
241 241
                       </li>
242
-                      <li>
242
+                      <li v-if="ROLE === 'Super Admin'">
243 243
                         <router-link to="/landingPages">Landing Pages / Campaignes</router-link>
244 244
                       </li>
245 245
                       <li>
@@ -357,6 +357,10 @@ export default {
357 357
     NAME() {
358 358
       return Log.getPerson().name;
359 359
     },
360
+    ROLE() {
361
+      var userObj = JSON.parse(localStorage.getItem("user"));
362
+      return userObj.role
363
+    },
360 364
     // eslint-disable-next-line vue/return-in-computed-property
361 365
     Logout() {
362 366
       this.logout().then(res => {

+ 6
- 0
src/router/index.js 查看文件

@@ -81,6 +81,7 @@ import LandingPageWeek from "../components/marketing/landingPageWeek.vue";
81 81
 import MarketingPage from "../components/marketing/clientView.vue";
82 82
 import MarketingPageExp from "../components/marketing/landingPageExpired.vue";
83 83
 import EnquireNow from "../components/property/commercial/enquireNow/enquirenow.vue";
84
+import MyWeeksEdit from "../components/admin/status/editTimeShareAdminPage.vue";
84 85
 
85 86
 Vue.use(Router);
86 87
 
@@ -438,6 +439,11 @@ export default new Router({
438 439
       path: "/timeshareToByResults",
439 440
       name: "ToBuySearch",
440 441
       component: ToBuySearch
442
+    },
443
+    {
444
+      path: "/editTimeShare/:id",
445
+      name: "EditTimeshare",
446
+      component: MyWeeksEdit,
441 447
     }
442 448
   ]
443 449
 });

+ 9
- 1
src/store/modules/timeshare/myWeeks.js 查看文件

@@ -16,6 +16,9 @@ export default {
16 16
     getNeedsVerify(state) {
17 17
       return _.filter(state.items, x => x.status && x.status.code === 'A1');
18 18
     },
19
+    // removeListing(state, id) {
20
+    //   state.myWeeks.pop(state.myWeeks.find(w => w.id === id));
21
+    // },
19 22
   },
20 23
   actions: {
21 24
     getItems({
@@ -38,6 +41,11 @@ export default {
38 41
     publishWeek(id) {
39 42
       axios.post(`/api/timeshareweek/publishweek/${id}`).catch(console.error);
40 43
     },
41
-
44
+    // deleteListing({ commit }, id) {
45
+    //   axios
46
+    //   .delete(`/api/myweeks/${id}`)
47
+    //   .then(result => commit('removeListing', id))
48
+    //   .catch(console.error);
49
+    // }
42 50
   },
43 51
 };

Loading…
取消
儲存