Sfoglia il codice sorgente

Feedback Updates

master
30117125 4 anni fa
parent
commit
26c6604882

+ 98
- 50
src/components/admin/status/editTimeShareAdminPage.vue Vedi File

@@ -217,7 +217,7 @@
217 217
                   <div class="validation"></div>
218 218
                 </div>
219 219
                 <div class="form-group col-md-6 mt-2">
220
-                  <label v-if="!week.askingPrice" for="tsaPrice" class="uniSelectLabel"
220
+                  <label v-if="week.askingPrice > 0" for="tsaPrice" class="uniSelectLabel"
221 221
                     >ASKING PRICE</label
222 222
                   >
223 223
                   <float-label label="ASKING PRICE">
@@ -411,60 +411,72 @@
411 411
                 </div>
412 412
               </div>
413 413
             </div>
414
-            <div class="section-header">
415
-              <h2>Publish Timeshare Week</h2>
416
-            </div>
417
-            <div class="form">
418
-              <div class="row">
419
-                <div class="form-group col-md-6">
420
-                  <label v-if="!weekParam.weekStatus" class="uniSelectLabel" for="status"
421
-                    >STATUS</label
422
-                  >
423
-                  <float-label label="STATUS" fixed>
424
-                    <select
425
-                      class="form-control uniSelect"
426
-                      name="status"
427
-                      id="status"
428
-                      v-model="weekParam.weekStatus"
414
+            <div v-if="!boolAwaitingPayment">
415
+              <div class="section-header">
416
+                <h2>Publish Timeshare Week</h2>
417
+              </div>
418
+              <div class="form">
419
+                <div class="row">
420
+                  <div class="form-group col-md-6">
421
+                    <label v-if="!weekParam.weekStatus" class="uniSelectLabel" for="status"
422
+                      >STATUS</label
429 423
                     >
430
-                      <option :key="0">For Sale</option>
431
-                      <option :key="1">Sold</option>
432
-                    </select>
433
-                  </float-label>
424
+                    <float-label label="STATUS" fixed>
425
+                      <select
426
+                        class="form-control uniSelect"
427
+                        name="status"
428
+                        id="status"
429
+                        v-model="weekParam.status.id"
430
+                      >
431
+                        <option :key="status.id" :value="status.id" v-for="status in statusList">{{
432
+                          status.description
433
+                        }}</option>
434
+                      </select>
435
+                    </float-label>
436
+                  </div>
437
+                  <div class="form-group col-md-6">
438
+                    <float-label label="Publish" fixed>
439
+                      <select
440
+                        class="form-control uniSelect"
441
+                        name="publish"
442
+                        id="publish"
443
+                        v-model="weekParam.publish"
444
+                      >
445
+                        <option :key="0" :value="false">No</option>
446
+                        <option :key="1" :value="true">Yes</option>
447
+                      </select>
448
+                    </float-label>
449
+                  </div>
450
+                  <div class="form-group col-md-6 mt-2">
451
+                    <float-label label="DATE PUBLISHED" fixed>
452
+                      <input
453
+                        type="date"
454
+                        class="form-control"
455
+                        name="publishDate"
456
+                        v-model="pubDateParam"
457
+                      />
458
+                    </float-label>
459
+
460
+                    <div class="validation"></div>
461
+                  </div>
434 462
                 </div>
435
-                <div class="form-group col-md-6">
436
-                  <float-label label="Publish" fixed>
437
-                    <select
438
-                      class="form-control uniSelect"
439
-                      name="publish"
440
-                      id="publish"
441
-                      v-model="weekParam.publish"
442
-                    >
443
-                      <option :key="0" :value="false">No</option>
444
-                      <option :key="1" :value="true">Yes</option>
445
-                    </select>
446
-                  </float-label>
463
+              </div>
464
+              <div class="row">
465
+                <div class="text-center col-6">
466
+                  <button class="btn-solid-blue" v-on:click="saveEdit()">Save</button>
447 467
                 </div>
448
-                <div class="form-group col-md-6 mt-2">
449
-                  <float-label label="DATE PUBLISHED" fixed>
450
-                    <input
451
-                      type="date"
452
-                      class="form-control"
453
-                      name="publishDate"
454
-                      v-model="pubDateParam"
455
-                    />
456
-                  </float-label>
457
-
458
-                  <div class="validation"></div>
468
+                <div class="text-center col-6">
469
+                  <button class="btn-solid-blue" v-on:click="backToListView()">Back</button>
459 470
                 </div>
460 471
               </div>
461 472
             </div>
462
-            <div class="row">
463
-              <div class="text-center col-6">
464
-                <button class="btn-solid-blue" v-on:click="saveEdit()">Save</button>
465
-              </div>
466
-              <div class="text-center col-6">
467
-                <button class="btn-solid-blue" v-on:click="backToListView()">Back</button>
473
+            <div v-else>
474
+              <div class="row">
475
+                <div class="text-center col-6">
476
+                  <button class="btn-solid-blue" v-on:click="paygateRedirect()">
477
+                    MAKE PAYMENT
478
+                  </button>
479
+                </div>
468 480
               </div>
469 481
             </div>
470 482
           </div>
@@ -506,7 +518,8 @@ export default {
506 518
       selectedPublish: {},
507 519
       dateParam: {},
508 520
       depDateParam: {},
509
-      pubDateParam: {}
521
+      pubDateParam: {},
522
+      boolAwaitingPayment: false
510 523
     };
511 524
   },
512 525
   components: {
@@ -514,6 +527,7 @@ export default {
514 527
     Alert
515 528
   },
516 529
   async mounted() {
530
+    this.getStatusList();
517 531
     this.getWeek(this.weekParam.id).then(() => {
518 532
       this.wait = false;
519 533
     });
@@ -544,6 +558,11 @@ export default {
544 558
     this.depDateParam = depDate;
545 559
     var datePub = new Date(this.weekParam.pulbishedDate).toISOString().substring(0, 10);
546 560
     this.pubDateParam = datePub;
561
+    if (this.weekParam.status.description === "Awaiting Payment") {
562
+      if (this.ROLE !== "Super Admin") {
563
+        this.boolAwaitingPayment = true;
564
+      }
565
+    }
547 566
   },
548 567
   created() {
549 568
     this.initTimeshare(this.weekId);
@@ -566,14 +585,20 @@ export default {
566 585
     ...mapState("individual", ["indiv"]),
567 586
     ...mapState("authentication", ["isLoggedIn"]),
568 587
     ...mapState("myWeeks", ["items", "week"]),
588
+    ...mapState("status", ["statusList"]),
569 589
     ...mapGetters({
570 590
       user: "authentication/getUser",
571 591
       person: "authentication/getPerson"
572 592
     }),
573 593
     ...mapState("bank", ["banks"]),
594
+    ...mapGetters("fees", ["getListingFee"]),
574 595
     refAgent() {
575 596
       return this.sellItem && this.sellItem.referedByAgent;
576 597
     },
598
+    ROLE() {
599
+      var userObj = JSON.parse(localStorage.getItem("user"));
600
+      return userObj.role;
601
+    },
577 602
     filteredResort() {
578 603
       let list = [];
579 604
       if (this.week && this.week.region && this.selectedRegion) {
@@ -598,6 +623,7 @@ export default {
598 623
     ...mapActions("payment", ["addPayment"]),
599 624
     ...mapActions("bank", ["getBanks"]),
600 625
     ...mapActions("myWeeks", ["getItems", "getWeek", "editSave"]),
626
+    ...mapActions("status", ["getStatusList"]),
601 627
     newSale() {
602 628
       this.weekId = 0;
603 629
       this.getBlankWeek();
@@ -655,6 +681,7 @@ export default {
655 681
       delete this.weekParam.owner.howMarried;
656 682
       delete this.weekParam.cellNumber;
657 683
       //console.log(JSON.stringify(this.weekParam));
684
+      //console.log(this.weekParam);
658 685
       this.editSave(this.weekParam).then(() => {
659 686
         this.backToListView();
660 687
       });
@@ -679,6 +706,27 @@ export default {
679 706
     },
680 707
     backToListView() {
681 708
       this.$router.push("/status/timeshareAdmin");
709
+    },
710
+    paygateRedirect() {
711
+      var amount = this.getListingFee.amount;
712
+      var paymentObj = {
713
+        timeshareWeekId: this.weekParam.id, // this.sellItem.Id,
714
+        propertyId: 0,
715
+        creatydById: Log.getUser().id, //Log.getUser().id,
716
+        amount: amount,
717
+        paymentStatus: "",
718
+        paymentToken: ""
719
+      };
720
+
721
+      this.addPayment(paymentObj).then(res => {
722
+        this.$router.push({
723
+          name: "PaymentGateway",
724
+          params: {
725
+            paymentReqId: res.PAY_REQUEST_ID,
726
+            checksum: res.CHECKSUM
727
+          }
728
+        });
729
+      });
682 730
     }
683 731
   }
684 732
 };

+ 70
- 0
src/components/admin/status/statusEdit.vue Vedi File

@@ -0,0 +1,70 @@
1
+<template>
2
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col">
6
+          <div class="section-header">
7
+            <h2>New Status</h2>
8
+          </div>
9
+        </div>
10
+      </div>
11
+      <div class="row">
12
+        <div class="col">
13
+          <float-label>
14
+            <input
15
+              type="text"
16
+              placeholder="CODE"
17
+              v-model="singleStatus.code"
18
+              class="form-control uniInput"
19
+            />
20
+          </float-label>
21
+        </div>
22
+        <div class="col">
23
+          <float-label>
24
+            <input
25
+              type="text"
26
+              placeholder="DESCRIPTION"
27
+              v-model="singleStatus.description"
28
+              class="form-control uniInput"
29
+            />
30
+          </float-label>
31
+        </div>
32
+      </div>
33
+      <div class="row mt-4">
34
+        <div class="col">
35
+          <button class="btn-solid-blue" @click="pushToApi()">EDIT</button>
36
+        </div>
37
+        <div class="col">
38
+          <router-link class="btn-solid-blue" to="/status/list">BACK</router-link>
39
+        </div>
40
+      </div>
41
+    </div>
42
+  </main>
43
+</template>
44
+
45
+<script>
46
+/* eslint-disable */
47
+import { mapActions, mapState } from "vuex";
48
+
49
+export default {
50
+  data() {
51
+    return {
52
+      status: {}
53
+    };
54
+  },
55
+  created() {
56
+    this.getSingleStatus(this.$route.params.id);
57
+  },
58
+  computed: {
59
+    ...mapState("status", ["singleStatus"])
60
+  },
61
+  methods: {
62
+    ...mapActions("status", ["updateStatus", "getSingleStatus"]),
63
+    pushToApi() {
64
+      this.updateStatus(this.singleStatus).then(this.$router.push("/status/list"));
65
+    }
66
+  }
67
+};
68
+</script>
69
+
70
+<style lang="scss" scoped></style>

+ 63
- 0
src/components/admin/status/statusNew.vue Vedi File

@@ -0,0 +1,63 @@
1
+<template>
2
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col">
6
+          <div class="section-header">
7
+            <h2>New Status</h2>
8
+          </div>
9
+        </div>
10
+      </div>
11
+      <div class="row">
12
+        <div class="col">
13
+          <float-label>
14
+            <input
15
+              type="text"
16
+              placeholder="CODE"
17
+              v-model="status.code"
18
+              class="form-control uniInput"
19
+            />
20
+          </float-label>
21
+        </div>
22
+        <div class="col">
23
+          <float-label>
24
+            <input
25
+              type="text"
26
+              placeholder="DESCRIPTION"
27
+              v-model="status.description"
28
+              class="form-control uniInput"
29
+            />
30
+          </float-label>
31
+        </div>
32
+      </div>
33
+      <div class="row mt-4">
34
+        <div class="col">
35
+          <button class="btn-solid-blue" @click="pushToApi()">SAVE</button>
36
+        </div>
37
+        <div class="col">
38
+          <router-link class="btn-solid-blue" to="/status/list">BACK</router-link>
39
+        </div>
40
+      </div>
41
+    </div>
42
+  </main>
43
+</template>
44
+
45
+<script>
46
+import { mapActions } from "vuex";
47
+/* eslint-disable */
48
+export default {
49
+  data() {
50
+    return {
51
+      status: {}
52
+    };
53
+  },
54
+  methods: {
55
+    ...mapActions("status", ["createNewStatus"]),
56
+    pushToApi() {
57
+      this.createNewStatus(this.status).then(this.$router.push("/status/list"));
58
+    }
59
+  }
60
+};
61
+</script>
62
+
63
+<style lang="scss" scoped></style>

+ 25
- 2
src/components/admin/status/statusPage.vue Vedi File

@@ -11,7 +11,19 @@
11 11
       </div>
12 12
     </div>
13 13
     <div v-if="checkAccess" class="container">
14
-      <ListView :items="statusList" :columnCount="4" :compact="false" :showNew="false" />
14
+      <ListView
15
+        :items="statusList"
16
+        :showColumnChooser="false"
17
+        :columnCount="4"
18
+        :hideSearch="true"
19
+        :compact="false"
20
+        :showNew="true"
21
+        :editable="true"
22
+        :deleteable="true"
23
+        @onEdit="Edit"
24
+        @onDelete="Delete"
25
+        @onNew="New"
26
+      />
15 27
     </div>
16 28
     <div v-else>
17 29
       <alert :text="'You don\'t have permission to view this page'" :type="'ERROR'" />
@@ -47,7 +59,18 @@ export default {
47 59
     }
48 60
   },
49 61
   methods: {
50
-    ...mapActions("status", ["getStatusList"])
62
+    ...mapActions("status", ["getStatusList", "deleteStatus"]),
63
+    New() {
64
+      this.$router.push("/status/new");
65
+    },
66
+    Edit(item) {
67
+      this.$router.push({
68
+        path: `/status/Edit/${item.id}`
69
+      });
70
+    },
71
+    Delete(item) {
72
+      this.deleteStatus(item.id);
73
+    }
51 74
   }
52 75
 };
53 76
 </script>

+ 9
- 16
src/components/admin/status/timeshareAdminList.vue Vedi File

@@ -62,7 +62,7 @@
62 62
                 <td>{{ item.region.regionName }}</td>
63 63
                 <td>{{ item.sellPrice | toCurrency }}</td>
64 64
                 <td>{{ item.pulbishedDate | toDate }}</td>
65
-                <td>{{ item.weekStatus }}</td>
65
+                <td>{{ item.status.description }}</td>
66 66
                 <td v-if="!item.publish">
67 67
                   <a v-on:click="Publish(item)">
68 68
                     <img src="../../../../public/img/icons/Upload.png" height="25" width="25" />
@@ -186,7 +186,7 @@ export default {
186 186
   },
187 187
   methods: {
188 188
     ...mapActions("myWeeks", ["getAllItems"]),
189
-    ...mapActions("myWeeks", ["getItems", "verifyWeek", "editSave"]),
189
+    ...mapActions("myWeeks", ["getItems", "verifyWeek", "editSave", "publishOnly"]),
190 190
     Publish(item) {
191 191
       var today = new Date();
192 192
       var dd = String(today.getDate()).padStart(2, "0");
@@ -194,25 +194,18 @@ export default {
194 194
       var yyyy = today.getFullYear();
195 195
       item.pulbishedDate = today.toISOString().substring(0, 19);
196 196
       item.publish = true;
197
-      item.owner = {
198
-        name: item.owner
199
-      };
200
-      item.agent = {
201
-        name: item.agent
202
-      };
197
+      item.status.id = 26;
198
+      item.status.code = "FS";
199
+      item.status.description = "For Sale";
200
+      item.status.statusType = true;
203 201
       console.log(JSON.stringify(item));
204
-      this.editSave(item);
202
+      this.publishOnly(item);
205 203
     },
206 204
     Unpublish(item) {
207 205
       item.publish = false;
208
-      item.owner = {
209
-        name: item.owner
210
-      };
211
-      item.agent = {
212
-        name: item.agent
213
-      };
206
+
214 207
       console.log(item);
215
-      this.editSave(item);
208
+      this.publishOnly(item);
216 209
     },
217 210
     Edit(item) {
218 211
       this.$router.push({ name: "EditTimeshare", params: { weekParam: item } });

+ 1
- 1
src/components/financial/OrderThankYou.vue Vedi File

@@ -5,7 +5,7 @@
5 5
         <div class="col-md-6">
6 6
           <div class="intro-content box text-center">
7 7
             <h2>Thank you!</h2>
8
-            <p>Your payment has been received and your propery will be listed</p>
8
+            <p>Your payment has been received and your property will be listed</p>
9 9
           </div>
10 10
         </div>
11 11
       </div>

+ 65
- 0
src/components/financial/paymentError.vue Vedi File

@@ -0,0 +1,65 @@
1
+<template>
2
+  <section id="intro">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col-md-6">
6
+          <div class="intro-content box text-center">
7
+            <h2 style="color:black">Error!</h2>
8
+            <p style="color:black">An error has occcured with your payment.</p>
9
+            <p style="color:black">Error: {{ payment[0].paymentStatus }}</p>
10
+          </div>
11
+        </div>
12
+      </div>
13
+    </div>
14
+
15
+    <carousel
16
+      :nav="false"
17
+      :dots="false"
18
+      :items="1"
19
+      :autoplay="true"
20
+      :loop="true"
21
+      :autoHeight="true"
22
+      id="intro-carousel"
23
+      style="margin-top:-50px;"
24
+      :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
25
+    >
26
+      <img class="item" src="/img/intro-carousel/home-1.jpg" alt="" />
27
+      <img class="item" src="/img/intro-carousel/16.jpg" alt="" />
28
+      <img class="item" src="/img/intro-carousel/comm-1.jpg" alt="" />
29
+      <img class="item" src="/img/intro-carousel/comm-4.jpg" alt="" />
30
+      <img class="item" src="/img/intro-carousel/3.jpg" alt="" />
31
+      <img class="item" src="/img/intro-carousel/home-5.jpg" alt="" />
32
+    </carousel>
33
+  </section>
34
+</template>
35
+
36
+<script>
37
+/* eslint-disable */
38
+import carousel from "vue-owl-carousel";
39
+import { mapActions, mapState } from "vuex";
40
+export default {
41
+  components: {
42
+    carousel
43
+  },
44
+  data() {
45
+    return {
46
+      boolLoaded: false
47
+    };
48
+  },
49
+  created() {
50
+    this.getPayment(this.$route.params.id);
51
+  },
52
+  computed: {
53
+    ...mapState("payment", ["payment"])
54
+  },
55
+  methods: {
56
+    ...mapActions("payment", ["getPayment"])
57
+  }
58
+};
59
+</script>
60
+
61
+<style lang="scss" scoped>
62
+.box {
63
+  background-color: rgba(255, 67, 67, 0.6) !important;
64
+}
65
+</style>

+ 4
- 11
src/components/financial/payments.vue Vedi File

@@ -10,14 +10,7 @@
10 10
       </div>
11 11
       <div v-if="checkAccess" class="row">
12 12
         <div class="col">
13
-          <listView
14
-            :items="payments"
15
-            :showNew="false"
16
-            :editable="true"
17
-            :deleteable="true"
18
-            @onEdit="Edit"
19
-            @onDelete="Delete"
20
-          />
13
+          <listView :items="payments" :showNew="false" @onEdit="Edit" @onDelete="Delete" />
21 14
         </div>
22 15
       </div>
23 16
       <div v-else class="row">
@@ -49,13 +42,13 @@ export default {
49 42
     };
50 43
   },
51 44
   methods: {
52
-    ...mapActions("Payment", ["getPayments"])
45
+    ...mapActions("payment", ["getPayments"])
53 46
   },
54 47
   mounted() {
55
-    this.getProperties(Object.assign(this.user.id));
48
+    this.getPayments();
56 49
   },
57 50
   computed: {
58
-    ...mapState("Payment", ["payments"]),
51
+    ...mapState("payment", ["payments"]),
59 52
     UserChanged() {
60 53
       this.getProperties(Object.assign(this.user.id));
61 54
       return this.user;

+ 2
- 2
src/components/shared/navBar.vue Vedi File

@@ -29,9 +29,9 @@
29 29
                   <a href="#">
30 30
                     <i class="fa fa-youtube"></i>
31 31
                   </a>
32
-                  <a href="tel:0123456789">
32
+                  <a href="tel:012 941 8497">
33 33
                     <i class="fa fa-phone"></i>
34
-                    <span class="phoneIconDetail">+27 (0) 12 492 1238</span>
34
+                    <span class="phoneIconDetail">+27 (0)12 941 8497</span>
35 35
                   </a>
36 36
                   <a href="#" data-toggle="modal" data-target="#bondcal">
37 37
                     <i class="fa fa-calculator" aria-hidden="true"></i>

+ 8
- 3
src/components/timeshare/buy/weekListComponent.vue Vedi File

@@ -30,8 +30,7 @@
30 30
             <td>{{ item.season }}</td>
31 31
             <td>{{ item.weekType }}</td>
32 32
             <td>{{ item.sellPrice | toCurrency }}</td>
33
-            <td v-if="item.status">{{ item.status.display }}</td>
34
-            <td v-else></td>
33
+            <td v-if="item.status">{{ item.status.description }}</td>
35 34
             <!-- <td>{{ item.region ? item.region.regionName : "" }}</td>
36 35
             <td>{{ item.resort ? item.resort.resortName : "" }}</td>
37 36
 
@@ -123,7 +122,13 @@ export default {
123 122
       getRegions: "weekList/getRegions"
124 123
     }),
125 124
     DisplayItems() {
126
-      const list = this.filteredWeeks;
125
+      const list = [];
126
+      this.filteredWeeks.forEach(week => {
127
+        if (week.publish) {
128
+          list.push(week);
129
+        }
130
+      });
131
+
127 132
       const startSlice = (this.currentPage - 1) * this.visibleItemsPerPageCount;
128 133
       let endSlice = this.currentPage * this.visibleItemsPerPageCount;
129 134
       if (endSlice > list.length) {

+ 19
- 0
src/router/index.js Vedi File

@@ -44,6 +44,9 @@ import AboutTimeshare from "../components/about/aboutTimeshare.vue";
44 44
 import Contact from "../components/shared/contact.vue";
45 45
 
46 46
 import Status from "../components/admin/status/statusPage.vue";
47
+import StatusNew from '../components/admin/status/statusNew.vue'
48
+import StatusEdit from '../components/admin/status/statusEdit.vue'
49
+
47 50
 import timeshareAdminPage from "../components/admin/status/timeshareAdminPage.vue";
48 51
 import tenderWeekAdminPage from "../components/admin/status/tenderWeekAdminPage.vue";
49 52
 import userManagementPage from "../components/admin/status/userManagementPage.vue";
@@ -83,6 +86,7 @@ import ResidentialSearchResults from "../components/property/residential/residen
83 86
 import PaymentGateway from "../components/financial/paygate/paygateProcess.vue";
84 87
 import Payments from "../components/financial/payments.vue";
85 88
 import PaymentSuccess from "../components/financial/OrderThankYou.vue";
89
+import PaymentError from '../components/financial/paymentError.vue'
86 90
 
87 91
 import LandingPages from "../components/marketing/landingPages.vue";
88 92
 import LandingPage from "../components/marketing/landingPage.vue";
@@ -437,6 +441,11 @@ export default new Router({
437 441
       name: "PaymentSuccess",
438 442
       component: PaymentSuccess
439 443
     },
444
+    {
445
+      path: "/payments/error/:id",
446
+      name: "PaymentError",
447
+      component: PaymentError
448
+    },
440 449
     {
441 450
       path: "/payments",
442 451
       name: "Payments",
@@ -515,5 +524,15 @@ export default new Router({
515 524
       name: "emailRecipientEdit",
516 525
       component: EmailRecipientEdit,
517 526
     },
527
+    {
528
+      path: "/status/new",
529
+      name: "statusNew",
530
+      component: StatusNew,
531
+    },
532
+    {
533
+      path: "/status/Edit/:id",
534
+      name: "statusEdit",
535
+      component: StatusEdit,
536
+    },
518 537
   ]
519 538
 });

+ 9
- 1
src/store/modules/timeshare/myWeeks.js Vedi File

@@ -29,7 +29,7 @@ export default {
29 29
   },
30 30
   getters: {
31 31
     getNeedsVerify(state) {
32
-      return _.filter(state.items, x => x.status && x.status.code === "A1");
32
+      return state.items
33 33
     }
34 34
     // removeListing(state, id) {
35 35
     //   state.myWeeks.pop(state.myWeeks.find(w => w.id === id));
@@ -76,6 +76,14 @@ export default {
76 76
         })
77 77
         .catch(console.error);
78 78
     },
79
+    async publishOnly({ commit }, week) {
80
+      await axios
81
+        .put(`/api/timeshareweek/publishOnly`, week)
82
+        .then(r => {
83
+          commit("setItem", week);
84
+        })
85
+        .catch(console.error);
86
+    },
79 87
     async editSave({ commit }, week) {
80 88
       await axios
81 89
         .put(`/api/timeshareweek`, week)

+ 45
- 0
src/store/modules/timeshare/status.js Vedi File

@@ -1,14 +1,26 @@
1
+/* eslint-disable */
1 2
 import axios from 'axios';
2 3
 
3 4
 export default {
4 5
   namespaced: true,
5 6
   state: {
6 7
     statusList: [],
8
+    singleStatus: {}
7 9
   },
8 10
   mutations: {
9 11
     setStatusList(state, list) {
10 12
       state.statusList = list;
11 13
     },
14
+    addNewStatus(state, status){
15
+      state.statusList.push(status)
16
+    },
17
+    setSingleStatus(state, status){
18
+      state.singleStatus = status
19
+    },
20
+    deleteStatus(state, id){
21
+      var index = state.statusList.findIndex((stat) => stat.id == id)
22
+      state.statusList.splice(index, 1)
23
+    }
12 24
   },
13 25
   getters: {},
14 26
   actions: {
@@ -18,5 +30,38 @@ export default {
18 30
         .then(result => commit('setStatusList', result.data))
19 31
         .catch(console.error);
20 32
     },
33
+    async getSingleStatus({commit}, id){
34
+      await axios.get('/api/status/'+ id)
35
+      .then((result) => {
36
+        commit("setSingleStatus", result.data[0])
37
+      })
38
+      .catch((e) => {
39
+        console.log(e);
40
+      })
41
+    },
42
+    async createNewStatus({commit}, status){
43
+      await axios.post("/api/status", status)
44
+      .then((result) => {
45
+        commit("addNewStatus", result.data)
46
+      })
47
+      .catch((e) => {
48
+        console.log(e);
49
+      })
50
+    },
51
+    async updateStatus({commit}, status){
52
+      await axios.put("/api/status", status)
53
+      .then((result) => {
54
+        
55
+      })
56
+      .catch((e) => {
57
+        console.log(e);
58
+      })
59
+    },
60
+    async deleteStatus({commit}, id){
61
+      await axios.delete('/api/status/'+id)
62
+      .then(() => {
63
+        commit("deleteStatus", id)
64
+      })
65
+    }
21 66
   },
22 67
 };

Loading…
Annulla
Salva