Sfoglia il codice sorgente

Fixes on the ToSell Page

master
George Williams 4 anni fa
parent
commit
bc0a0692b9

+ 658
- 339
src/components/timeshare/sell/contentSection.vue
File diff soppresso perché troppo grande
Vedi File


+ 34
- 31
src/store/index.js Vedi File

@@ -1,36 +1,38 @@
1
-import Vue from 'vue';
2
-import Vuex from 'vuex';
1
+import Vue from "vue";
2
+import Vuex from "vuex";
3 3
 
4
-import TimeshareModule from './modules/timeshare/timeshare';
5
-import UsersModule from './modules/users';
6
-import StatusModule from './modules/timeshare/status';
7
-import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
8
-import RegionModule from './modules/timeshare/region';
9
-import SearchTabModule from './modules/searchTab';
10
-import ResortModule from './modules/timeshare/resort';
11
-import PropertyModule from './modules/property/property';
12
-import WeekModule from './modules/timeshare/week';
13
-import PropertyAdminModule from './modules/property/propertyAdmin';
14
-import PropertyList from './modules/property/propertyLists';
15
-import PropertyTypes from './modules/property/propertyTypes';
16
-import Register from './modules/user/register';
17
-import WeekList from './modules/timeshare/weekList';
18
-import MyWeeks from './modules/timeshare/myWeeks';
19
-import Bid from './modules/processFlow/bid';
20
-import Authentication from './modules/user/authentication';
21
-import PropertySearch from './modules/property/propertySearch';
22
-import SearchLog from './modules/logs/searchLog';
23
-import Template from './modules/communication/template';
24
-import Info from './modules/communication/info';
25
-import PropertyEdit from './modules/property/propertyEdit';
26
-import Carousel from './modules/misc/carousel';
27
-import Individual from './modules/user/individual';
28
-import Alert from './modules/misc/alert';
29
-import TenderWeek from './modules/timeshare/tenderWeeks';
30
-import PaymentModule from './modules/financial/payment';
4
+import TimeshareModule from "./modules/timeshare/timeshare";
5
+import UsersModule from "./modules/users";
6
+import StatusModule from "./modules/timeshare/status";
7
+import UnitConfigurationModule from "./modules/timeshare/unitConfiguration";
8
+import RegionModule from "./modules/timeshare/region";
9
+import SearchTabModule from "./modules/searchTab";
10
+import ResortModule from "./modules/timeshare/resort";
11
+import PropertyModule from "./modules/property/property";
12
+import WeekModule from "./modules/timeshare/week";
13
+import PropertyAdminModule from "./modules/property/propertyAdmin";
14
+import PropertyList from "./modules/property/propertyLists";
15
+import PropertyTypes from "./modules/property/propertyTypes";
16
+import Register from "./modules/user/register";
17
+import WeekList from "./modules/timeshare/weekList";
18
+import MyWeeks from "./modules/timeshare/myWeeks";
19
+import Bid from "./modules/processFlow/bid";
20
+import Authentication from "./modules/user/authentication";
21
+import PropertySearch from "./modules/property/propertySearch";
22
+import SearchLog from "./modules/logs/searchLog";
23
+import Template from "./modules/communication/template";
24
+import Info from "./modules/communication/info";
25
+import PropertyEdit from "./modules/property/propertyEdit";
26
+import Carousel from "./modules/misc/carousel";
27
+import Individual from "./modules/user/individual";
28
+import Alert from "./modules/misc/alert";
29
+import TenderWeek from "./modules/timeshare/tenderWeeks";
30
+import PaymentModule from "./modules/financial/payment";
31 31
 import CampaignModule from "./modules/marketing/campaigns";
32 32
 import CampaignItemModule from "./modules/marketing/campaignItems";
33 33
 import PlaceHolderFormat from "./modules/misc/placeHolderFormat";
34
+import Bank from "./modules/user/bank";
35
+import bank from "./modules/user/bank";
34 36
 
35 37
 Vue.use(Vuex);
36 38
 /* eslint no-param-reassign: ["error", { "props": false }] */
@@ -65,6 +67,7 @@ export default new Vuex.Store({
65 67
     payment: PaymentModule,
66 68
     campaign: CampaignModule,
67 69
     campaignItem: CampaignItemModule,
68
-    placeHolderFormat: PlaceHolderFormat
69
-  },
70
+    placeHolderFormat: PlaceHolderFormat,
71
+    bank: bank
72
+  }
70 73
 });

+ 77
- 82
src/store/modules/timeshare/timeshare.js Vedi File

@@ -1,9 +1,9 @@
1 1
 /* eslint-disable guard-for-in */
2 2
 /* eslint-disable no-restricted-syntax */
3
-import axios from 'axios';
4
-import _ from 'lodash';
5
-import MyData from '../../../assets/myData';
6
-import MaritalStatus from '../../../assets/staticData/maritalStatus';
3
+import axios from "axios";
4
+import _ from "lodash";
5
+import MyData from "../../../assets/myData";
6
+import MaritalStatus from "../../../assets/staticData/maritalStatus";
7 7
 
8 8
 export default {
9 9
   namespaced: true,
@@ -50,9 +50,9 @@ export default {
50 50
       status: undefined,
51 51
       owner: {
52 52
         address: {},
53
-        bankingDetails: {},
54
-      },
55
-    },
53
+        bankingDetails: {}
54
+      }
55
+    }
56 56
   },
57 57
   mutations: {
58 58
     setUnitConfigurationList(state, list) {
@@ -97,138 +97,133 @@ export default {
97 97
       state.sellItem.resortName = resort.resortName;
98 98
     },
99 99
     displayResult(state) {
100
-      state.result = 'Week has been added ^-^';
100
+      state.result = "Week has been added ^-^";
101 101
     },
102 102
     setWeekDetail(state, week) {
103 103
       state.sellItem = week;
104
-    },
104
+    }
105 105
   },
106 106
   getters: {
107 107
     getRegionCode(state) {
108
-      return (value) => {
109
-        const reg = state.detailedRegion.find(region => region.children.some(resort => resort
110
-          .resortCode === value));
108
+      return value => {
109
+        const reg = state.detailedRegion.find(region =>
110
+          region.children.some(resort => resort.resortCode === value)
111
+        );
111 112
         if (reg && reg.region) {
112 113
           return reg.region.regionCode;
113 114
         }
114
-        return '';
115
+        return "";
115 116
       };
116 117
     },
117 118
     getResortName(state) {
118
-      return (value) => {
119
+      return value => {
119 120
         const res = state.resorts.find(resort => resort.resortCode === value);
120 121
         if (res) {
121 122
           return res.resortName;
122 123
         }
123 124
       };
124
-    },
125
+    }
125 126
   },
126 127
   actions: {
127
-    initTimeshare({
128
-      commit,
129
-      dispatch,
130
-    }, timeshareId) {
131
-      commit('setResortBedrooms', MyData.resortBedrooms);
132
-      commit('setMaxSleep', MyData.maxBedrooms);
133
-      commit('setBankedEntities', MyData.bankedEntities);
134
-      dispatch('getSeasons');
135
-      dispatch('getAgents');
136
-      dispatch('getAgencies');
137
-      dispatch('getResorts');
138
-      dispatch('getRegions');
128
+    initTimeshare({ commit, dispatch }, timeshareId) {
129
+      commit("setResortBedrooms", MyData.resortBedrooms);
130
+      commit("setMaxSleep", MyData.maxBedrooms);
131
+      commit("setBankedEntities", MyData.bankedEntities);
132
+      dispatch("getSeasons");
133
+      dispatch("getAgents");
134
+      dispatch("getAgencies");
135
+      dispatch("getResorts");
136
+      dispatch("getRegions");
139 137
       if (timeshareId && timeshareId !== 0) {
140
-        dispatch('getWeekDetail', timeshareId);
138
+        dispatch("getWeekDetail", timeshareId);
141 139
       }
142 140
     },
143
-    getWeekDetail({
144
-      commit,
145
-    }, timeshareId) {
141
+    getWeekDetail({ commit }, timeshareId) {
146 142
       axios
147 143
         .get(`api/timeshareweek/${timeshareId}`)
148
-        .then((result) => {
144
+        .then(result => {
149 145
           console.log(result.data);
150
-          commit('setWeekDetail', result.data);
146
+          commit("setWeekDetail", result.data);
151 147
         })
152 148
         .catch(console.error);
153 149
     },
154
-    getSeasons({
155
-      commit,
156
-    }) {
150
+    getSeasons({ commit }) {
157 151
       axios
158
-        .get('/api/season')
159
-        .then(result => commit('setSeason', result.data))
152
+        .get("/api/season")
153
+        .then(result => commit("setSeason", result.data))
160 154
         .catch(console.error);
161 155
     },
162
-    getAgencies({
163
-      commit,
164
-    }) {
156
+    getAgencies({ commit }) {
165 157
       axios
166
-        .get('/api/agency')
167
-        .then(result => commit('setAgency', result.data))
158
+        .get("/api/agency")
159
+        .then(result => commit("setAgency", result.data))
168 160
         .catch(console.error);
169 161
     },
170
-    getAgents({
171
-      commit,
172
-    }) {
162
+    getAgents({ commit }) {
173 163
       axios
174
-        .get('/api/agent')
175
-        .then(result => commit('setAgent', result.data))
164
+        .get("/api/agent")
165
+        .then(result => commit("setAgent", result.data))
176 166
         .catch(console.error);
177 167
     },
178
-    getResorts({
179
-      commit,
180
-    }) {
168
+    getResorts({ commit }) {
181 169
       axios
182
-        .get('https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/list/')
183
-        .then(result => commit('addResort', result.data))
170
+        .get("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/list/")
171
+        .then(result => commit("addResort", result.data))
184 172
         .catch(console.error);
185 173
     },
186
-    getRegions({
187
-      dispatch,
188
-      commit,
189
-    }) {
174
+    getRegions({ dispatch, commit }) {
190 175
       axios
191
-        .get('https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA')
192
-        .then((result) => {
193
-          commit('addRegion', result.data);
194
-          dispatch('getDetailedRegion', result.data);
176
+        .get("https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA")
177
+        .then(result => {
178
+          commit("addRegion", result.data);
179
+          dispatch("getDetailedRegion", result.data);
195 180
         })
196 181
         .catch(console.error);
197 182
     },
198
-    getDetailedRegion({
199
-      commit,
200
-    }, data) {
183
+    getDetailedRegion({ commit }, data) {
201 184
       if (data) {
202 185
         for (const r in Object.keys(data)) {
203 186
           const region = data[r];
204 187
           if (region !== undefined) {
205 188
             axios
206 189
               .get(
207
-                `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
208
-                  region.regionCode
209
-                }/`,
190
+                `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${region.regionCode}/`
191
+              )
192
+              .then(result =>
193
+                commit("addDetailedRegion", {
194
+                  region,
195
+                  children: result.data
196
+                })
210 197
               )
211
-              .then(result => commit('addDetailedRegion', {
212
-                region,
213
-                children: result.data,
214
-              }))
215 198
               .catch(console.error);
216 199
           }
217 200
         }
218 201
       }
219 202
     },
220
-    onResortChange({
221
-      commit,
222
-    }, resort) {
223
-      commit('changeResort', resort);
203
+    onResortChange({ commit }, resort) {
204
+      commit("changeResort", resort);
205
+    },
206
+    saveWeek({ commit }, week) {
207
+      return new Promise((resolve, reject) => {
208
+        axios
209
+          .post("/api/timeshareweek", week)
210
+          .then(result => {
211
+            commit("setWeekDetail", result.data);
212
+            resolve();
213
+          })
214
+          .catch(error => reject(new Error(error.message)));
215
+      });
216
+
217
+      // axios
218
+      //   .post('/api/timeshareweek', week)
219
+      //   .then(result => commit('displayResult'))
220
+      //   .catch(console.error);
224 221
     },
225
-    saveWeek({
226
-      commit,
227
-    }, week) {
222
+    getBlankWeek({ commit }) {
228 223
       axios
229
-        .post('/api/timeshareweek', week)
230
-        .then(result => commit('displayResult'))
224
+        .get("/api/timeshareweek/gettemplate")
225
+        .then(result => commit("setWeekDetail", result.data))
231 226
         .catch(console.error);
232
-    },
233
-  },
227
+    }
228
+  }
234 229
 };

+ 24
- 0
src/store/modules/user/bank.js Vedi File

@@ -0,0 +1,24 @@
1
+/* eslint-disable no-restricted-syntax */
2
+/* eslint-disable guard-for-in */
3
+import axios from "axios";
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    banks: []
9
+  },
10
+  mutations: {
11
+    setBanks(state, items) {
12
+      state.banks = items;
13
+    }
14
+  },
15
+  getters: {},
16
+  actions: {
17
+    getBanks({ commit }) {
18
+      axios
19
+        .get("/api/banks")
20
+        .then(result => commit("setBanks", result.data))
21
+        .catch(error => alert(error.message));
22
+    }
23
+  }
24
+};

+ 22
- 17
src/store/modules/user/individual.js Vedi File

@@ -1,12 +1,12 @@
1 1
 /* eslint-disable no-restricted-syntax */
2 2
 /* eslint-disable guard-for-in */
3
-import axios from 'axios';
3
+import axios from "axios";
4 4
 
5 5
 export default {
6 6
   namespaced: true,
7 7
   state: {
8 8
     items: [],
9
-    indiv: undefined,
9
+    indiv: undefined
10 10
   },
11 11
   mutations: {
12 12
     addItem(state, item) {
@@ -14,43 +14,48 @@ export default {
14 14
     },
15 15
     setItem(state, item) {
16 16
       state[item.name] = item.value;
17
-    },
17
+    }
18 18
   },
19 19
   getters: {},
20 20
   actions: {
21 21
     getIndividual({ commit, rootGetters }, userId) {
22 22
       let id = 0;
23 23
       if (!userId || userId === 0) {
24
-        const rootItem = rootGetters['authentication/getUser'];
24
+        const rootItem = rootGetters["authentication/getUser"];
25 25
         id = rootItem ? rootItem.id : 0;
26 26
       } else id = userId;
27
+
28
+      if (!id) {
29
+        id = 0;
30
+      }
31
+
27 32
       axios
28 33
         .get(`/api/individual/getIndividual/${id}`)
29
-        .then((r) => {
34
+        .then(r => {
30 35
           console.log(JSON.stringify(r));
31
-          commit('setItem', {
32
-            name: 'indiv',
33
-            value: r.data,
36
+          commit("setItem", {
37
+            name: "indiv",
38
+            value: r.data
34 39
           });
35 40
         })
36 41
         .catch(console.error);
37 42
     },
38 43
     getAllIndividuals({ commit }) {
39 44
       axios
40
-        .get('/api/individual/getAllIndividuals')
41
-        .then((x) => {
42
-          commit('setItem', {
43
-            name: 'items',
44
-            value: x.data,
45
+        .get("/api/individual/getAllIndividuals")
46
+        .then(x => {
47
+          commit("setItem", {
48
+            name: "items",
49
+            value: x.data
45 50
           });
46 51
         })
47 52
         .catch(console.error);
48 53
     },
49 54
     updateIndividual({ commit }, item) {
50 55
       axios
51
-        .put('/api/individual', item)
52
-        .then(result => commit('setItem', item))
56
+        .put("/api/individual", item)
57
+        .then(result => commit("setItem", item))
53 58
         .catch(console.error);
54
-    },
55
-  },
59
+    }
60
+  }
56 61
 };

Loading…
Annulla
Salva