Procházet zdrojové kódy

Property Search & save fix

master
George Williams před 5 roky
rodič
revize
8e3c40f0b3

+ 29
- 56
src/components/property/propertySearchPage.vue Zobrazit soubor

@@ -47,7 +47,12 @@
47 47
         </div>
48 48
         <div class="col-md-4">
49 49
           <p>
50
-            <img class="img-fluid" src="./../../../public/img/residential.jpg" alt="About Resale" style="border-radius:10px"/>
50
+            <img
51
+              class="img-fluid"
52
+              src="./../../../public/img/residential.jpg"
53
+              alt="About Resale"
54
+              style="border-radius:10px"
55
+            />
51 56
           </p>
52 57
         </div>
53 58
       </div>
@@ -130,7 +135,6 @@
130 135
   </div>
131 136
 </template>
132 137
 <script>
133
-import { mkdir } from 'fs';
134 138
 import { mapState, mapActions } from 'vuex';
135 139
 import propertyCard from './propertyCard.vue';
136 140
 
@@ -179,64 +183,33 @@ export default {
179 183
         suburb: 'All',
180 184
       };
181 185
 
182
-      if (typeof this.$route.params.propertyType === 'undefined') {
183
-        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
184
-        this.propertySearch = this.$route.query;
185
-      } else {
186
+      if (Object.keys(this.$route.params).length > 0) {
187
+        if (this.$route.params.propertyUsageType) {
188
+          // eslint-disable-next-line vue/no-side-effects-in-computed-properties
189
+          this.propertySearch.propertyUsageType = this.$route.params.propertyUsageType;
190
+        }
191
+      }
192
+      if (Object.keys(this.$route.query).length > 0) {
193
+        if (Object.keys(this.$route.query).length > 2) {
194
+          // eslint-disable-next-line vue/no-side-effects-in-computed-properties
195
+          this.propertySearch = this.$route.query;
196
+        } else {
197
+          if (this.$route.query.salesType) {
198
+            // eslint-disable-next-line vue/no-side-effects-in-computed-properties
199
+            this.propertySearch.salesType = this.$route.query.salesType;
200
+          }
201
+          if (this.$route.query.propertyUsageType) {
202
+            // eslint-disable-next-line vue/no-side-effects-in-computed-properties
203
+            this.propertySearch.propertyUsageType = this.$route.query.propertyUsageType;
204
+          }
205
+        }
206
+      }
207
+      if (this.propertySearch.keyword === '') {
186 208
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
187
-        this.propertySearch.propertyUsageType = this.$route.params.propertyType;
209
+        this.propertySearch.keyword = 'All';
188 210
       }
189 211
 
190
-      console.log('PropertySearch = ' + JSON.stringify(this.propertySearch));
191
-
192 212
       this.searchProperties(this.propertySearch);
193
-      // this.type = this.$route.query.type;
194
-      // this.propertyType = this.$route.query.propertyType;
195
-      // this.province = this.$route.query.province;
196
-      // this.city = this.$route.query.city;
197
-      // this.suburb = this.$route.query.suburb;
198
-      // this.proptype = this.$route.query.propType;
199
-      // this.keyword = this.$route.query.keyword;
200
-      // if (typeof this.propertyType === 'undefined') {
201
-      //   this.propertyType = this.propertyTypeparam;
202
-      // }
203
-      // if (this.type === '') {
204
-      //   this.type = 'undefined';
205
-      // }
206
-      // if (this.propertyType === '') {
207
-      //   this.propertyType = 'undefined';
208
-      // }
209
-      // if (this.province === '') {
210
-      //   this.province = 'undefined';
211
-      // }
212
-      // if (this.city === '') {
213
-      //   this.city = 'undefined';
214
-      // }
215
-      // if (this.suburb === '') {
216
-      //   this.suburb = 'undefined';
217
-      // }
218
-      // if (this.proptype === '') {
219
-      //   this.propType = 'undefined';
220
-      // }
221
-      // if (typeof this.keyword === 'undefined' || this.keyword === '') {
222
-      //   this.searchPropertiesParams(
223
-      //     Object.assign(
224
-      //       {},
225
-      //       {
226
-      //         type: this.type,
227
-      //         propertyType: this.propertyType,
228
-      //         province: this.province,
229
-      //         city: this.city,
230
-      //         suburb: this.suburb,
231
-      //         propType: this.proptype,
232
-      //       },
233
-      //     ),
234
-      //   );
235
-      // } else {
236
-      //   this.searchPropertiesKeyword(
237
-      //     Object.assign({}, { keyword: this.keyword }),
238
-      //   );
239
-      // }
240 213
       return null;
241 214
     },
242 215
   },

+ 176
- 175
src/router/index.js Zobrazit soubor

@@ -45,180 +45,181 @@ import Offer from '../components/processFlow/offers.vue';
45 45
 Vue.use(Router);
46 46
 
47 47
 export default new Router({
48
-  scrollBehavior (to, from, savedPosition) {
49
-    return { x: 0, y: 0 }
50
-  },
51
-  routes: [{
52
-    path: '/',
53
-    name: 'Home',
54
-    component: HomePage,
55
-  },
56
-  {
57
-    path: '/about/us',
58
-    name: 'aboutus',
59
-    component: AboutUs,
60
-  },
61
-  {
62
-    path: '/about/timeshare',
63
-    name: 'abouttimeshare',
64
-    component: AboutTimeshare,
65
-  },
66
-  {
67
-    path: '/timeshare/sell',
68
-    name: 'TimeshareSell',
69
-    component: TimeshareSell,
70
-  },
71
-  {
72
-    path: '/timeshare/buy',
73
-    name: 'TimeshareBuy',
74
-    component: TimeshareBuy,
75
-  },
76
-  {
77
-    path: '/timeshare/faq',
78
-    name: 'TimeshareFAQ',
79
-    component: TimeshareFAQ,
80
-  },
81
-  {
82
-    path: '/user/login',
83
-    name: 'Login',
84
-    component: Login,
85
-  },
86
-  {
87
-    path: '/user/register',
88
-    name: 'PrivateIndividual',
89
-    component: PrivateIndividual,
90
-  },
91
-  {
92
-    path: '/user/registeragency',
93
-    name: 'Agency',
94
-    component: Agency,
95
-  },
96
-  {
97
-    path: '/property/property/:id',
98
-    name: 'PropertyPage',
99
-    component: PropertyPage,
100
-  },
101
-  {
102
-    path: '/property/:propertyType/search',
103
-    name: 'PropertySearch',
104
-    component: PropertySearch,
105
-  },
106
-  {
107
-    path: '/property/search',
108
-    name: 'PropertySearchTab',
109
-    component: PropertySearch,
110
-  },
111
-  {
112
-    path: '/property/:propType/:saleType',
113
-    name: 'PropertyNew',
114
-    component: PropertyEdit,
115
-  },
116
-  {
117
-    path: '/property/edit/:id/:propType/:saleType',
118
-    name: 'PropertyEdit',
119
-    component: PropertyEdit,
120
-  },
121
-  {
122
-    path: '/property/list/:propertyType/:user',
123
-    name: 'PropertyList',
124
-    component: PropertyList,
125
-  },
126
-  {
127
-    path: '/propertyTypes/list',
128
-    name: 'PropertyTypeList',
129
-    component: PropertyTypeList,
130
-  },
131
-  {
132
-    path: '/propertyType/new',
133
-    name: 'PropertyTypeNew',
134
-    component: PropertyType,
135
-  },
136
-  {
137
-    path: '/propertyType/:id',
138
-    name: 'PropertyTypeEdit',
139
-    component: PropertyType,
140
-  },
141
-  {
142
-    path: '/userDefinedGroups/list',
143
-    name: 'UserDefinedGroupsList',
144
-    component: UserDefinedGroups,
145
-  },
146
-  {
147
-    path: '/userDefinedGroups/userDefinedGroup/:id',
148
-    name: 'UserDefinedGroupEdit',
149
-    component: UserDefinedGroup,
150
-  },
151
-  {
152
-    path: '/userDefinedGroups/userDefinedGroup',
153
-    name: 'UserDefinedGroupNew',
154
-    component: UserDefinedGroup,
155
-  },
156
-  {
157
-    path: '/status/list',
158
-    name: 'StatusList',
159
-    component: Status,
160
-  },
161
-  {
162
-    path: '/status/timeshareAdmin',
163
-    name: 'TimeshareAdmin',
164
-    component: timeshareAdminPage,
165
-  },
166
-  {
167
-    path: '/status/tenderWeekAdmin',
168
-    name: 'TenderWeekAdmin',
169
-    component: tenderWeekAdminPage,
170
-  },
171
-  {
172
-    path: '/status/userManagementPage',
173
-    name: 'userManagementPage',
174
-    component: userManagementPage,
175
-  },
176
-  {
177
-    path: '/status/changeLogPage',
178
-    name: 'changeLogPage',
179
-    component: changeLogPage,
180
-  },
181
-  {
182
-    path: '/unitConfiguration/list',
183
-    name: 'UnitConfiguration',
184
-    component: UnitConfiguration,
185
-  },
186
-  {
187
-    path: '/contactus',
188
-    name: 'ContactUs',
189
-    component: ContactUs,
190
-  },
191
-  {
192
-    path: '/privacypolicy',
193
-    name: 'PrivacyPolicy',
194
-    component: PrivacyPolicy,
195
-  },
196
-  {
197
-    path: '/resort/:resortCode',
198
-    name: 'ResortPage',
199
-    component: ResortPage,
200
-    props: true,
201
-  },
202
-  {
203
-    path: '/resort/:resortCode/:weekId',
204
-    name: 'UnitPage',
205
-    component: UnitPage,
206
-    props: true,
207
-  },
208
-  {
209
-    path: '/MakeOffer',
210
-    name: 'MakeOffer',
211
-    component: MakeOffer,
212
-  },
213
-  {
214
-    path: '/Offers',
215
-    name: 'Offers',
216
-    component: Offer,
217
-  },
218
-  {
219
-    path: '/timeshare/search',
220
-    name: 'TimeshareSearch',
221
-    component: TimeshareSearch,
222
-  },
48
+  scrollBehavior(to, from, savedPosition) {
49
+    return { x: 0, y: 0 };
50
+  },
51
+  routes: [
52
+    {
53
+      path: '/',
54
+      name: 'Home',
55
+      component: HomePage,
56
+    },
57
+    {
58
+      path: '/about/us',
59
+      name: 'aboutus',
60
+      component: AboutUs,
61
+    },
62
+    {
63
+      path: '/about/timeshare',
64
+      name: 'abouttimeshare',
65
+      component: AboutTimeshare,
66
+    },
67
+    {
68
+      path: '/timeshare/sell',
69
+      name: 'TimeshareSell',
70
+      component: TimeshareSell,
71
+    },
72
+    {
73
+      path: '/timeshare/buy',
74
+      name: 'TimeshareBuy',
75
+      component: TimeshareBuy,
76
+    },
77
+    {
78
+      path: '/timeshare/faq',
79
+      name: 'TimeshareFAQ',
80
+      component: TimeshareFAQ,
81
+    },
82
+    {
83
+      path: '/user/login',
84
+      name: 'Login',
85
+      component: Login,
86
+    },
87
+    {
88
+      path: '/user/register',
89
+      name: 'PrivateIndividual',
90
+      component: PrivateIndividual,
91
+    },
92
+    {
93
+      path: '/user/registeragency',
94
+      name: 'Agency',
95
+      component: Agency,
96
+    },
97
+    {
98
+      path: '/property/property/:id',
99
+      name: 'PropertyPage',
100
+      component: PropertyPage,
101
+    },
102
+    {
103
+      path: '/property/:propertyUsageType/search',
104
+      name: 'PropertySearch',
105
+      component: PropertySearch,
106
+    },
107
+    {
108
+      path: '/property/search',
109
+      name: 'PropertySearchTab',
110
+      component: PropertySearch,
111
+    },
112
+    {
113
+      path: '/property/:propType/:saleType',
114
+      name: 'PropertyNew',
115
+      component: PropertyEdit,
116
+    },
117
+    {
118
+      path: '/property/edit/:id/:propType/:saleType',
119
+      name: 'PropertyEdit',
120
+      component: PropertyEdit,
121
+    },
122
+    {
123
+      path: '/property/list/:propertyType/:user',
124
+      name: 'PropertyList',
125
+      component: PropertyList,
126
+    },
127
+    {
128
+      path: '/propertyTypes/list',
129
+      name: 'PropertyTypeList',
130
+      component: PropertyTypeList,
131
+    },
132
+    {
133
+      path: '/propertyType/new',
134
+      name: 'PropertyTypeNew',
135
+      component: PropertyType,
136
+    },
137
+    {
138
+      path: '/propertyType/:id',
139
+      name: 'PropertyTypeEdit',
140
+      component: PropertyType,
141
+    },
142
+    {
143
+      path: '/userDefinedGroups/list',
144
+      name: 'UserDefinedGroupsList',
145
+      component: UserDefinedGroups,
146
+    },
147
+    {
148
+      path: '/userDefinedGroups/userDefinedGroup/:id',
149
+      name: 'UserDefinedGroupEdit',
150
+      component: UserDefinedGroup,
151
+    },
152
+    {
153
+      path: '/userDefinedGroups/userDefinedGroup',
154
+      name: 'UserDefinedGroupNew',
155
+      component: UserDefinedGroup,
156
+    },
157
+    {
158
+      path: '/status/list',
159
+      name: 'StatusList',
160
+      component: Status,
161
+    },
162
+    {
163
+      path: '/status/timeshareAdmin',
164
+      name: 'TimeshareAdmin',
165
+      component: timeshareAdminPage,
166
+    },
167
+    {
168
+      path: '/status/tenderWeekAdmin',
169
+      name: 'TenderWeekAdmin',
170
+      component: tenderWeekAdminPage,
171
+    },
172
+    {
173
+      path: '/status/userManagementPage',
174
+      name: 'userManagementPage',
175
+      component: userManagementPage,
176
+    },
177
+    {
178
+      path: '/status/changeLogPage',
179
+      name: 'changeLogPage',
180
+      component: changeLogPage,
181
+    },
182
+    {
183
+      path: '/unitConfiguration/list',
184
+      name: 'UnitConfiguration',
185
+      component: UnitConfiguration,
186
+    },
187
+    {
188
+      path: '/contactus',
189
+      name: 'ContactUs',
190
+      component: ContactUs,
191
+    },
192
+    {
193
+      path: '/privacypolicy',
194
+      name: 'PrivacyPolicy',
195
+      component: PrivacyPolicy,
196
+    },
197
+    {
198
+      path: '/resort/:resortCode',
199
+      name: 'ResortPage',
200
+      component: ResortPage,
201
+      props: true,
202
+    },
203
+    {
204
+      path: '/resort/:resortCode/:weekId',
205
+      name: 'UnitPage',
206
+      component: UnitPage,
207
+      props: true,
208
+    },
209
+    {
210
+      path: '/MakeOffer',
211
+      name: 'MakeOffer',
212
+      component: MakeOffer,
213
+    },
214
+    {
215
+      path: '/Offers',
216
+      name: 'Offers',
217
+      component: Offer,
218
+    },
219
+    {
220
+      path: '/timeshare/search',
221
+      name: 'TimeshareSearch',
222
+      component: TimeshareSearch,
223
+    },
223 224
   ],
224 225
 });

+ 3
- 1
src/store/modules/property/property.js Zobrazit soubor

@@ -55,7 +55,9 @@ export default {
55 55
       state.propertyFields = fields;
56 56
     },
57 57
     updateCurrentProperty(state, property) {
58
-      state.properties.push(property);
58
+      if (state.properties) {
59
+        state.properties.push(property);
60
+      }
59 61
     },
60 62
     clearProperty(state) {
61 63
       state.property = {

+ 7
- 2
src/store/modules/property/propertySearch.js Zobrazit soubor

@@ -39,7 +39,7 @@ export default {
39 39
     getPropertySearchObject({ commit }) {
40 40
       const search = {
41 41
         userID: 0,
42
-        keyword: '',
42
+        keyword: 'All',
43 43
         salesType: 'Sale',
44 44
         propertyUsageType: 'All',
45 45
         propertyType: 'All',
@@ -50,8 +50,13 @@ export default {
50 50
       commit('setPropertySearch', search);
51 51
     },
52 52
     searchProperties({ commit }, item) {
53
+      if (item.keyword === '') {
54
+        item.keyword = 'All';
55
+      }
53 56
       axios
54
-        .post('/api/Property/Search', item)
57
+        .get(
58
+          `/api/Property/Search/${item.userID}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}`,
59
+        )
55 60
         .then(result => commit('updateSearch', result.data))
56 61
         .catch(console.error);
57 62
     },

Načítá se…
Zrušit
Uložit