Ver código fonte

Facilities Split

master
30117125 4 anos atrás
pai
commit
79bc34f9b6

+ 30
- 0
package-lock.json Ver arquivo

@@ -2273,6 +2273,22 @@
2273 2273
         "resolve": "^1.4.0"
2274 2274
       }
2275 2275
     },
2276
+    "babel-runtime": {
2277
+      "version": "6.26.0",
2278
+      "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
2279
+      "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
2280
+      "requires": {
2281
+        "core-js": "^2.4.0",
2282
+        "regenerator-runtime": "^0.11.0"
2283
+      },
2284
+      "dependencies": {
2285
+        "regenerator-runtime": {
2286
+          "version": "0.11.1",
2287
+          "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
2288
+          "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
2289
+        }
2290
+      }
2291
+    },
2276 2292
     "balanced-match": {
2277 2293
       "version": "1.0.0",
2278 2294
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@@ -7781,6 +7797,11 @@
7781 7797
         "object-visit": "^1.0.0"
7782 7798
       }
7783 7799
     },
7800
+    "marker-clusterer-plus": {
7801
+      "version": "2.1.4",
7802
+      "resolved": "https://registry.npmjs.org/marker-clusterer-plus/-/marker-clusterer-plus-2.1.4.tgz",
7803
+      "integrity": "sha1-+O/3TVmdqzt9Dj/tUmTqDnBPXWc="
7804
+    },
7784 7805
     "material-design-icons-iconfont": {
7785 7806
       "version": "3.0.3",
7786 7807
       "resolved": "https://registry.npmjs.org/material-design-icons-iconfont/-/material-design-icons-iconfont-3.0.3.tgz",
@@ -12340,6 +12361,15 @@
12340 12361
         "quill": "^1.3.6"
12341 12362
       }
12342 12363
     },
12364
+    "vue2-google-maps": {
12365
+      "version": "0.10.7",
12366
+      "resolved": "https://registry.npmjs.org/vue2-google-maps/-/vue2-google-maps-0.10.7.tgz",
12367
+      "integrity": "sha512-y5aBJTAsfGvpsbfgPaeWU7o7QbOeINZKsP6SB9qrBe8U8EYBFO/bTWo3rcMq/NOtgT/XssV3Nwg/2u3no6jWbw==",
12368
+      "requires": {
12369
+        "babel-runtime": "^6.26.0",
12370
+        "marker-clusterer-plus": "^2.1.4"
12371
+      }
12372
+    },
12343 12373
     "vuetify": {
12344 12374
       "version": "1.5.22",
12345 12375
       "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-1.5.22.tgz",

+ 1
- 0
package.json Ver arquivo

@@ -34,6 +34,7 @@
34 34
     "vue-router": "^3.1.5",
35 35
     "vue-trix": "^1.1.7",
36 36
     "vue2-editor": "^2.10.2",
37
+    "vue2-google-maps": "^0.10.7",
37 38
     "vuetify": "^1.5.22",
38 39
     "vuex": "^3.1.2"
39 40
   },

+ 57
- 0
src/components/financial/paygate/paygateProcess.vue Ver arquivo

@@ -0,0 +1,57 @@
1
+<template>
2
+  <div></div>
3
+</template>
4
+
5
+<script>
6
+/* eslint-disable */
7
+import { mapGetters, mapState, mapActions } from "vuex";
8
+
9
+export default {
10
+  methods: {
11
+    ...mapActions(["payment", ["addPayment"]]),
12
+    sethtmlData(id, check) {
13
+      this.reqId = id;
14
+      this.checksum = check;
15
+    },
16
+    async placeOrder() {
17
+      await this.addOrder(this.price).then(async response => {
18
+        var respObj = {};
19
+
20
+        await response.split("&").forEach(element => {
21
+          var name = "";
22
+          var value = "";
23
+          name = element.split("=")[0];
24
+          value = element.split("=")[1];
25
+          if (name === "PAYGATE_ID") {
26
+            respObj.PAYGATE_ID = value;
27
+          } else if (name === "PAY_REQUEST_ID") {
28
+            respObj.PAY_REQUEST_ID = value;
29
+          } else if (name === "REFERENCE") {
30
+            respObj.REFERENCE = value;
31
+          } else if (name === "CHECKSUM") {
32
+            respObj.CHECKSUM = value;
33
+          }
34
+        });
35
+
36
+        await this.sethtmlData(respObj.PAY_REQUEST_ID, respObj.CHECKSUM);
37
+      });
38
+
39
+      this.$router.push({
40
+        name: "PaymentGateway",
41
+        params: {
42
+          paymentReqId: this.reqId,
43
+          checksum: this.checksum
44
+        }
45
+      });
46
+    }
47
+  }
48
+};
49
+</script>
50
+
51
+<style lang="scss" scoped>
52
+.cardShadow {
53
+  box-shadow: 0 8px 8px 0 rgba(0, 0, 0, 0.281), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
54
+}
55
+</style>
56
+
57
+<style lang="scss" scoped></style>

+ 140
- 0
src/components/timeshare/resort/unit/directions.vue Ver arquivo

@@ -0,0 +1,140 @@
1
+<template>
2
+  <div class="container">
3
+    <div class="row">
4
+      <div class="col">
5
+        <label v-if="startAddress === null" class="uniSelectLabel" for="weekInfoRegionSelect"
6
+          >Select</label
7
+        >
8
+        <select v-model="startAddress" class="form-control mb-3" @change="calcRoute()">
9
+          <optgroup label="Cities">
10
+            <option value="-29.087217,26.154898">Bloemfontein</option>
11
+            <option value="-33.918861, 18.423300">Cape Town</option>
12
+            <option value="-29.883333, 31.049999">Durban</option>
13
+            <option value="-33.0153, 27.9116">East London</option>
14
+            <option value="-33.977074, 22.457581">George</option>
15
+            <option value="-26.195246, 28.034088">Johannesburg</option>
16
+            <option value="-25.4745, 30.9703">Nelspruit</option>
17
+            <option value="-23.9045, 29.4689">Polokwane</option>
18
+            <option value="-33.9180, 25.5701">Port Elizabeth</option>
19
+            <option value="-25.731340, 28.218370">Pretoria</option>
20
+            <option value="-28.44776, 21.25612">Upington</option>
21
+          </optgroup>
22
+
23
+          <optgroup label="Airports">
24
+            <option value="-26.13916667, 28.24611111">OR Tambo</option>
25
+            <option value="-29.61444444, 31.11638889">King Shaka</option>
26
+            <option value="-33.9843, 25.6170">Port Elizabeth</option>
27
+            <option value="-33.96944444, 18.59722222">Cape Town</option>
28
+          </optgroup>
29
+        </select>
30
+        <GmapMap
31
+          :center="{ lat: -26.195246, lng: 28.034088 }"
32
+          :zoom="7"
33
+          map-type-id="terrain"
34
+          style="width: 100%; height: 500px"
35
+          ref="map"
36
+        >
37
+        </GmapMap>
38
+        <div style="max-height:500px; overflow:auto">
39
+          <table class="table table-sm">
40
+            <tr>
41
+              <td colspan="4">{{ overallRoute }}</td>
42
+            </tr>
43
+            <tr v-for="(direction, i) in directionSteps" :key="i">
44
+              <td></td>
45
+              <td>{{ i + 1 + "." }}</td>
46
+              <td style="max-width:200px">
47
+                <p v-html="direction.instructions" style="font-size:12px"></p>
48
+              </td>
49
+              <td>
50
+                <p style="font-size:12px">{{ direction.distance.text }}</p>
51
+              </td>
52
+            </tr>
53
+          </table>
54
+        </div>
55
+      </div>
56
+    </div>
57
+  </div>
58
+</template>
59
+
60
+<script>
61
+/* eslint-disable */
62
+import { gmapApi } from "vue2-google-maps";
63
+export default {
64
+  computed: {
65
+    google: gmapApi,
66
+    directionsRenderer() {
67
+      return new google.maps.DirectionsRenderer();
68
+    }
69
+  },
70
+  props: {
71
+    resortCoords: {}
72
+  },
73
+  data() {
74
+    return {
75
+      directionService: {},
76
+      startAddress: null,
77
+      directionSteps: [],
78
+      overallRoute: ""
79
+    };
80
+  },
81
+  methods: {
82
+    calcRoute() {
83
+      var resortCoords = this.resortCoords.split(",");
84
+      var resortLatLng = new google.maps.LatLng({
85
+        lat: parseFloat(resortCoords[1]),
86
+        lng: parseFloat(resortCoords[0])
87
+      });
88
+
89
+      var startCoords = this.startAddress.split(",");
90
+      var startLatLng = new google.maps.LatLng({
91
+        lat: parseFloat(startCoords[0]),
92
+        lng: parseFloat(startCoords[1])
93
+      });
94
+
95
+      var LatLng = new google.maps.LatLng({
96
+        lat: -29.087217,
97
+        lng: 26.154898
98
+      });
99
+
100
+      this.directionsService = new google.maps.DirectionsService();
101
+      //   var map = this.$refs.map.$mapObject;
102
+      //   this.directionsRenderer.setMap(map);
103
+      //   var start = document.getElementById("start").value;
104
+      var end = "joplin, mo";
105
+      var request = {
106
+        origin: startLatLng,
107
+        destination: resortLatLng,
108
+        travelMode: "DRIVING"
109
+      };
110
+
111
+      this.directionsService.route(request, (result, status) => {
112
+        if (status == "OK") {
113
+          this.directionSteps = result.routes[0].legs[0].steps;
114
+          console.log(result.routes[0].legs[0]);
115
+          this.overallRoute =
116
+            result.routes[0].legs[0].distance.text +
117
+            ". About " +
118
+            result.routes[0].legs[0].duration.text;
119
+
120
+          this.directionsRenderer.setMap(this.$refs.map.$mapObject);
121
+
122
+          this.directionsRenderer.setDirections(result);
123
+        }
124
+      });
125
+    }
126
+  }
127
+};
128
+</script>
129
+
130
+<style lang="scss" scoped>
131
+.uniSelectLabel {
132
+  position: absolute;
133
+  z-index: 2;
134
+  margin-left: 15px;
135
+  margin-top: 7px;
136
+  font-family: "muli";
137
+  font-size: 15px;
138
+  color: rgb(118, 118, 118);
139
+}
140
+</style>

+ 93
- 0
src/components/timeshare/resort/unit/facilities.vue Ver arquivo

@@ -0,0 +1,93 @@
1
+<template>
2
+  <div class="container">
3
+    <div class="row">
4
+      <div class="col">
5
+        <h5>On-Site</h5>
6
+        <table class="table table-sm">
7
+          <tr v-for="(onSiteFacility, i) in onSiteFacilities" :key="i">
8
+            <td>
9
+              {{ onSiteFacility.category + " " + onSiteFacility.description }}
10
+            </td>
11
+          </tr>
12
+        </table>
13
+      </div>
14
+      <div class="col">
15
+        <h5>Off-Site</h5>
16
+        <table class="table table-sm">
17
+          <tr v-for="(offSiteFacility, i) in offSiteFacilities" :key="i">
18
+            <td>
19
+              {{ offSiteFacility.category + " " + offSiteFacility.description }}
20
+            </td>
21
+          </tr>
22
+        </table>
23
+      </div>
24
+    </div>
25
+  </div>
26
+</template>
27
+
28
+<script>
29
+/* eslint-disable */
30
+import axios from "axios";
31
+export default {
32
+  data() {
33
+    return {
34
+      onSiteFacilities: [],
35
+      offSiteFacilities: []
36
+    };
37
+  },
38
+  props: {
39
+    resortCode: ""
40
+  },
41
+  mounted() {
42
+    this.getFacilities();
43
+  },
44
+  methods: {
45
+    getFacilities() {
46
+      this.getOnSite();
47
+      this.getOffSite();
48
+    },
49
+    async getOnSite() {
50
+      var onSiteObj = {
51
+        id: this.resortCode,
52
+        site: "On"
53
+      };
54
+      const response = await axios.post(
55
+        "https://www.gomelo.co.za/api/v1/product/facilities",
56
+        onSiteObj
57
+      );
58
+      if (response.status === 200) {
59
+        response.data.forEach(facility => {
60
+          if (facility.description !== null) {
61
+            facility.description = "(" + facility.description + ")";
62
+          } else {
63
+            facility.description = "";
64
+          }
65
+        });
66
+        this.onSiteFacilities = response.data;
67
+      }
68
+    },
69
+    async getOffSite() {
70
+      var offSiteObj = {
71
+        id: this.resortCode,
72
+        site: "Off"
73
+      };
74
+      const response = await axios.post(
75
+        "https://www.gomelo.co.za/api/v1/product/facilities",
76
+        offSiteObj
77
+      );
78
+      if (response.status === 200) {
79
+        response.data.forEach(facility => {
80
+          if (facility.description !== null) {
81
+            facility.description = "(" + facility.description + ")";
82
+          } else {
83
+            facility.description = "";
84
+          }
85
+        });
86
+        this.offSiteFacilities = response.data;
87
+      }
88
+    }
89
+  }
90
+};
91
+</script>
92
+
93
+<style lang="scss" scoped></style>

+ 85
- 0
src/components/timeshare/resort/unit/summarySection.vue Ver arquivo

@@ -0,0 +1,85 @@
1
+<template>
2
+  <div class="container pb-5">
3
+      <div class="row">
4
+        <div class="col">
5
+          <div class="section-header">
6
+            <h2>{{ week ? week.resort.resortName : "" }}</h2>
7
+          </div>
8
+        </div>
9
+      </div>
10
+      <div class="row mt-5">
11
+        <div class="col-md-6">
12
+          <gallerySection :images="images" />
13
+        </div>
14
+        <div class="col-md-6 summarySection">
15
+          <h3>Summary</h3>
16
+          <div class="row">
17
+            <div align="center" class="col">
18
+              <label for="unit">Unit: </label>
19
+              <h5>{{ week ? week.unitNumber : "" }}</h5>
20
+            </div>
21
+            <div align="center" class="col">
22
+              <label for="week">Module/Week: </label>
23
+              <h5>{{ week ? week.weekNumber : "" }}</h5>
24
+            </div>
25
+          </div>
26
+          <div class="row mt-3">
27
+            <div align="center" class="col">
28
+              <label for="levy">Current Year Levy: </label>
29
+              <h5>R{{ formatPrice(week ? week.levyAmount : 0) }}</h5>
30
+            </div>
31
+          </div>
32
+          <div class="row mt-5">
33
+            <div align="center" class="col">
34
+              <div class="intro-content">
35
+                <h2>Price</h2>
36
+              </div>
37
+              <h4>R {{ formatPrice(week ? week.sellPrice : 0) }}</h4>
38
+            </div>
39
+          </div>
40
+          <div class="row mt-3">
41
+            <div class="col">
42
+              <a href="javascript:history.back()" class="btn-white-border">Back</a>
43
+            </div>
44
+            <div class="col">
45
+              <button
46
+                class="btn-solid-blue"
47
+                style="color:white"
48
+                data-toggle="modal"
49
+                data-target="#myModal"
50
+              >
51
+                Make an Offer
52
+              </button>
53
+              <div class="col-md-12">
54
+                <div id="myModal" class="modal fade" role="dialog">
55
+                  <div class="modal-dialog modal-lg">
56
+                    <!-- Modal content-->
57
+                    <div class="modal-content">
58
+                      <div class="modal-header">
59
+                        <button type="button" class="close" data-dismiss="modal">&times;</button>
60
+                      </div>
61
+                      <div padding-left="20px">
62
+                        <makeOffer
63
+                          name="MakeOffer"
64
+                          :isMakeOffer="true"
65
+                          :isProperty="false"
66
+                          :item="week"
67
+                        />
68
+                      </div>
69
+                    </div>
70
+                  </div>
71
+                </div>
72
+              </div>
73
+            </div>
74
+          </div>
75
+        </div>
76
+      </div>
77
+</template>
78
+
79
+<script>
80
+/* eslint-disable */
81
+import makeOffer from "../../../processFlow/makeOffer.vue";
82
+export default {};
83
+</script>
84
+
85
+<style lang="scss" scoped></style>

+ 123
- 0
src/components/timeshare/resort/unit/tabSection.vue Ver arquivo

@@ -0,0 +1,123 @@
1
+<template>
2
+  <div>
3
+    <ul class="nav nav-tabs" id="myTab" role="tablist">
4
+      <li class="nav-item">
5
+        <a
6
+          class="nav-link active"
7
+          id="home-tab"
8
+          data-toggle="tab"
9
+          href="#facilities"
10
+          role="tab"
11
+          aria-controls="home"
12
+          aria-selected="true"
13
+          ><h2>Facilities</h2>
14
+        </a>
15
+      </li>
16
+      <li class="nav-item">
17
+        <a
18
+          class="nav-link"
19
+          id="profile-tab"
20
+          data-toggle="tab"
21
+          href="#directions"
22
+          role="tab"
23
+          aria-controls="profile"
24
+          aria-selected="false"
25
+          ><h2>Directions</h2>
26
+        </a>
27
+      </li>
28
+      <li class="nav-item">
29
+        <a
30
+          class="nav-link"
31
+          id="contact-tab"
32
+          data-toggle="tab"
33
+          href="#layout"
34
+          role="tab"
35
+          aria-controls="contact"
36
+          aria-selected="false"
37
+          ><h2>Layout</h2>
38
+        </a>
39
+      </li>
40
+      <li class="nav-item">
41
+        <a
42
+          class="nav-link"
43
+          id="contact-tab"
44
+          data-toggle="tab"
45
+          href="#media"
46
+          role="tab"
47
+          aria-controls="contact"
48
+          aria-selected="false"
49
+          ><h2>Media</h2>
50
+        </a>
51
+      </li>
52
+    </ul>
53
+    <div class="tab-content" id="myTabContent">
54
+      <div
55
+        class="tab-pane fade show active"
56
+        id="facilities"
57
+        role="tabpanel"
58
+        aria-labelledby="home-tab"
59
+      >
60
+        <facilities :resortCode="resortCode" />
61
+      </div>
62
+      <div class="tab-pane fade" id="directions" role="tabpanel" aria-labelledby="profile-tab">
63
+        <directions :resortCoords="resortCoords" />
64
+      </div>
65
+      <div class="tab-pane fade" id="layout" role="tabpanel" aria-labelledby="contact-tab">
66
+        <img :src="layoutImages[0]" @click="index = 0" style="width:100%" />
67
+        <gallery :images="layoutImages" :index="index" @close="index = null"></gallery>
68
+      </div>
69
+      <div class="tab-pane fade" id="media" role="tabpanel" aria-labelledby="contact-tab">
70
+        ...
71
+      </div>
72
+    </div>
73
+  </div>
74
+</template>
75
+
76
+<script>
77
+/* eslint-disable */
78
+import facilities from "./facilities";
79
+import directions from "./directions";
80
+import gallery from "../../../shared/gallerySlideShow";
81
+export default {
82
+  components: {
83
+    facilities,
84
+    directions,
85
+    gallery
86
+  },
87
+  data() {
88
+    return {
89
+      index: null
90
+    };
91
+  },
92
+  props: {
93
+    resortCode: {},
94
+    resortCoords: {},
95
+    layoutImages: {}
96
+  }
97
+};
98
+</script>
99
+
100
+<style lang="scss" scoped>
101
+.nav-tabs li a {
102
+  border-top: none;
103
+  border-left: none;
104
+  border-right: none;
105
+  border-bottom-color: rgb(221, 221, 221);
106
+}
107
+
108
+.nav-tabs li :hover {
109
+  background-color: rgb(27, 117, 187);
110
+}
111
+
112
+.nav-tabs li a.active {
113
+  border-top: none;
114
+  border-left: none;
115
+  border-right: none;
116
+  border-bottom-color: rgb(221, 221, 221);
117
+}
118
+
119
+.nav-tabs li a :hover {
120
+  background-color: transparent;
121
+  color: white;
122
+}
123
+</style>

src/components/timeshare/resort/unitPage.vue → src/components/timeshare/resort/unit/unitPage.vue Ver arquivo

@@ -77,20 +77,11 @@
77 77
       </div>
78 78
       <div class="row mt-5">
79 79
         <div class="col">
80
-          <div class="section-header">
81
-            <h2>Facilities</h2>
82
-          </div>
83
-          <div class="row" v-if="resort.prUnitFacilities">
84
-            <div class="col-md-4" v-for="(item, i) in resort.prUnitFacilities.split('\n')" :key="i">
85
-              {{ item }}
86
-            </div>
87
-          </div>
88
-        </div>
89
-        <div class="col">
90
-          <div class="section-header">
91
-            <h2>Description</h2>
92
-          </div>
93
-          <p>{{ description }}</p>
80
+          <tabSection
81
+            :resortCode="resortCode"
82
+            :resortCoords="resort.prPostAdd1"
83
+            :layoutImages="layouts"
84
+          />
94 85
         </div>
95 86
       </div>
96 87
     </div>
@@ -101,14 +92,16 @@
101 92
 /* eslint-disable */
102 93
 
103 94
 import { mapState, mapActions, mapGetters } from "vuex";
104
-import makeOffer from "../../processFlow/makeOffer.vue";
105
-import gallerySection from "./gallerySection";
95
+
96
+import gallerySection from "../gallerySection";
97
+import tabSection from "./tabSection";
106 98
 
107 99
 export default {
108 100
   name: "unit",
109 101
   components: {
110 102
     makeOffer,
111
-    gallerySection
103
+    gallerySection,
104
+    tabSection
112 105
   },
113 106
   props: {
114 107
     resortCode: {},
@@ -119,16 +112,23 @@ export default {
119 112
     if (this.resortCode) {
120 113
       this.applyResortFilter(this.resortCode);
121 114
     }
115
+    this.layouts.push(this.layout);
122 116
     this.getWeeks();
117
+    console.log(this.resort);
123 118
   },
124 119
   computed: {
125
-    ...mapState("resort", ["resort", "description", "images"]),
120
+    ...mapState("resort", ["resort", "description", "images", "layout"]),
126 121
 
127 122
     ...mapGetters({
128 123
       weekById: "weekList/weekById"
129 124
     }),
130 125
     week() {
131 126
       return this.weekById(this.resortCode, this.unitNumber);
127
+    },
128
+    layouts() {
129
+      var layouts = [];
130
+      layouts.push(this.layout);
131
+      return layouts;
132 132
     }
133 133
     // ...mapState('week', ['currentWeek']),
134 134
   },

+ 12
- 0
src/main.js Ver arquivo

@@ -6,9 +6,21 @@ import moment from "moment";
6 6
 import App from "./App.vue";
7 7
 import router from "./router";
8 8
 import store from "./store";
9
+import * as VueGoogleMaps from "vue2-google-maps";
9 10
 
10 11
 Vue.use(EvaIcons);
12
+Vue.use(VueGoogleMaps, {
13
+  load: {
14
+    key: "AIzaSyD8k_Kwml_C8IDfs-gX8JFV8acli3L9cAE",
15
+    libraries: "places,directions" // This is required if you use the Autocomplete plugin
16
+    // OR: libraries: 'places,drawing'
17
+    // OR: libraries: 'places,drawing,visualization'
18
+    // (as you require)
11 19
 
20
+    //// If you want to set the version, you can do so:
21
+    // v: '3.26',
22
+  }
23
+});
12 24
 Vue.config.productionTip = false;
13 25
 //axios.defaults.baseURL = "http://localhost:57260";
14 26
 //axios.defaults.baseURL = "http://training.provision-sa.com:82";

+ 1
- 1
src/router/index.js Ver arquivo

@@ -44,7 +44,7 @@ import UnitConfiguration from "../components/admin/unitConfiguration/unitConfigu
44 44
 import agentManagementPage from "../components/admin/status/agentsUserManagementPage.vue";
45 45
 
46 46
 import ResortPage from "../components/timeshare/resort/resortPage.vue";
47
-import UnitPage from "../components/timeshare/resort/unitPage.vue";
47
+import UnitPage from "../components/timeshare/resort/unit/unitPage.vue";
48 48
 
49 49
 import ContactUs from "../components/misc/contactUs.vue";
50 50
 import PrivacyPolicy from "../components/misc/privacyPolicyPage.vue";

+ 32
- 7
src/store/modules/financial/payment.js Ver arquivo

@@ -1,10 +1,11 @@
1
-import axios from 'axios';
1
+/* eslint-disable */
2
+import axios from "axios";
2 3
 
3 4
 export default {
4 5
   amespaced: true,
5 6
   state: {
6 7
     payments: [],
7
-    payment: {},
8
+    payment: {}
8 9
   },
9 10
   mutations: {
10 11
     setPayment(state, item) {
@@ -12,21 +13,45 @@ export default {
12 13
     },
13 14
     setPayments(state, items) {
14 15
       state.payments = items;
15
-    },
16
+    }
16 17
   },
17 18
   getters: {},
18 19
   actions: {
19 20
     getPayment({ commit }, id) {
20 21
       axios
21 22
         .get(`/api/payment/${id}`)
22
-        .then(result => commit('setPayment', result.data))
23
+        .then(result => commit("setPayment", result.data))
23 24
         .catch(console.error);
24 25
     },
25 26
     getPayments({ commit }) {
26 27
       axios
27
-        .get('/api/payment')
28
-        .then(result => commit('setPayments', result.data))
28
+        .get("/api/payment")
29
+        .then(result => commit("setPayments", result.data))
29 30
         .catch(console.error);
30 31
     },
31
-  },
32
+    async addPayment(payment) {
33
+      const response = await axios.post("/api/payment/", payment);
34
+      if (response.status === 200) {
35
+        var respObj = {};
36
+        response.data.split("&").forEach(element => {
37
+          var name = "";
38
+          var value = "";
39
+          name = element.split("=")[0];
40
+          value = element.split("=")[1];
41
+          if (name === "PAYGATE_ID") {
42
+            respObj.PAYGATE_ID = value;
43
+          } else if (name === "PAY_REQUEST_ID") {
44
+            respObj.PAY_REQUEST_ID = value;
45
+          } else if (name === "REFERENCE") {
46
+            respObj.REFERENCE = value;
47
+          } else if (name === "CHECKSUM") {
48
+            respObj.CHECKSUM = value;
49
+          }
50
+        });
51
+        return Promise.resolve(respObj);
52
+      } else {
53
+        return Promise.reject(response.status);
54
+      }
55
+    }
56
+  }
32 57
 };

+ 1
- 0
src/store/modules/timeshare/resort.js Ver arquivo

@@ -58,6 +58,7 @@ export default {
58 58
         )
59 59
         .then(result => {
60 60
           commit("setResort", result.data);
61
+          console.log(result.data);
61 62
         })
62 63
         .catch(console.error);
63 64
     },

+ 10
- 10
src/store/modules/timeshare/unitConfiguration.js Ver arquivo

@@ -1,23 +1,23 @@
1
-import axios from 'axios';
1
+/* eslint-disable */
2
+import axios from "axios";
2 3
 
3 4
 export default {
4 5
   namespaced: true,
5 6
   state: {
6
-    unitConfigurationList: [],
7
+    unitConfigurationList: []
7 8
   },
8 9
   mutations: {
9 10
     setUnitConfigurationList(state, list) {
10 11
       state.unitConfigurationList = list;
11
-    },
12
+    }
12 13
   },
13 14
   getters: {},
14 15
   actions: {
15
-    getUnitConfigurationList({
16
-      commit,
17
-    }) {
18
-      axios.get('/api/unitConfiguration')
19
-        .then(result => commit('setUnitConfigurationList', result.data))
16
+    getUnitConfigurationList({ commit }) {
17
+      axios
18
+        .get("/api/unitConfiguration")
19
+        .then(result => commit("setUnitConfigurationList", result.data))
20 20
         .catch(console.error);
21
-    },
22
-  },
21
+    }
22
+  }
23 23
 };

Carregando…
Cancelar
Salvar