Kaynağa Gözat

PropertySearch + Search logs

master
George Williams 5 yıl önce
ebeveyn
işleme
a52227872b

+ 13
- 0
package-lock.json Dosyayı Görüntüle

2413
       "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=",
2413
       "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=",
2414
       "dev": true
2414
       "dev": true
2415
     },
2415
     },
2416
+    "browser-downloads": {
2417
+      "version": "0.2.0",
2418
+      "resolved": "https://registry.npmjs.org/browser-downloads/-/browser-downloads-0.2.0.tgz",
2419
+      "integrity": "sha512-0tQntpixIPo8ZuOufMjPbZIp2jZMvCUz00rCiaf/T3LzLxcbt6j0r6Ef8Ao3lNP3bYh/ibLoWVoLCJ7SCvxrSA=="
2420
+    },
2416
     "browserify-aes": {
2421
     "browserify-aes": {
2417
       "version": "1.2.0",
2422
       "version": "1.2.0",
2418
       "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
2423
       "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
11821
         "vue": "^2.5.17"
11826
         "vue": "^2.5.17"
11822
       }
11827
       }
11823
     },
11828
     },
11829
+    "vue-excel-export": {
11830
+      "version": "0.1.3",
11831
+      "resolved": "https://registry.npmjs.org/vue-excel-export/-/vue-excel-export-0.1.3.tgz",
11832
+      "integrity": "sha512-vjCKrVocZ9Q4Y1BJsuDiLR9E9x97vHY+ew7oSigxg7WDh6AsTbH5v4TFpCD65WwYy2jt1tQU6fsAIpKjVOXibw==",
11833
+      "requires": {
11834
+        "browser-downloads": "^0.2.0"
11835
+      }
11836
+    },
11824
     "vue-hot-reload-api": {
11837
     "vue-hot-reload-api": {
11825
       "version": "2.3.3",
11838
       "version": "2.3.3",
11826
       "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz",
11839
       "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz",

+ 1
- 0
package.json Dosyayı Görüntüle

25
     "v-file-upload": "^3.1.7",
25
     "v-file-upload": "^3.1.7",
26
     "vue": "^2.6.10",
26
     "vue": "^2.6.10",
27
     "vue-eva-icons": "^1.1.1",
27
     "vue-eva-icons": "^1.1.1",
28
+    "vue-excel-export": "^0.1.3",
28
     "vue-router": "^3.0.7",
29
     "vue-router": "^3.0.7",
29
     "vue-trix": "^1.0.0",
30
     "vue-trix": "^1.0.0",
30
     "vuetify": "^1.5.5",
31
     "vuetify": "^1.5.5",

BIN
public/img/Commercial-Property.jpg Dosyayı Görüntüle


+ 62
- 23
src/components/admin/logs/SearchLogs.vue Dosyayı Görüntüle

2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
   <div>
3
   <div>
4
     <div class="container">
4
     <div class="container">
5
-      <!-- <section class="intro-single"> -->
6
       <div class="container">
5
       <div class="container">
7
         <br />
6
         <br />
8
         <br />
7
         <br />
16
           </div>
15
           </div>
17
         </div>
16
         </div>
18
       </div>
17
       </div>
19
-      <!-- </section> -->
18
+    </div>
19
+    <div class="container">
20
+      <div class="form-group row">
21
+        <div class="col-md-1">
22
+          <label>Filter</label>
23
+        </div>
24
+        <div class="col-md-3">
25
+          <select class="form-control" name="fields" id="fields" v-model="filter.by">
26
+            <option v-for="(item, i) in fields" :key="i">{{item}}</option>
27
+          </select>
28
+        </div>
29
+        <div class="col-md-8 text-left">
30
+          <div class="input-group mb-8">
31
+            <input class="form-control" type="text" @change="filter()" v-model="filter.value" />
32
+            <div class="input-group-append" @click="clearFilter()">
33
+              <span class="input-group-text cursor-pointer" style="color: #60CBEB">
34
+                <b>X</b>
35
+              </span>
36
+            </div>
37
+          </div>
38
+        </div>
39
+      </div>
40
+    </div>
41
+    <div class="container">
42
+      <div class="form-group row">
43
+        <div class="col-md-12" align="right">
44
+          <export-excel
45
+            class="btn btn-b-n"
46
+            :data="list"
47
+            :fields="exportFields"
48
+            type="csv"
49
+            worksheet="My Worksheet"
50
+            name="SearchLog.csv"
51
+          >
52
+            Download
53
+            <eva-icon name="download"></eva-icon>
54
+          </export-excel>
55
+        </div>
56
+      </div>
20
     </div>
57
     </div>
21
     <div class="container">
58
     <div class="container">
22
       <table class="table table-bordered">
59
       <table class="table table-bordered">
25
             <th>Date</th>
62
             <th>Date</th>
26
             <th>Time</th>
63
             <th>Time</th>
27
             <th>User</th>
64
             <th>User</th>
28
-            <th>Keyword</th>
29
-            <th>Sales Type</th>
30
-            <th>Property Usage Type</th>
31
-            <th>Property Type</th>
32
-            <th>Province</th>
33
-            <th>City</th>
34
-            <th>Suburb</th>
65
+            <th>Type</th>
66
+            <th>Field</th>
67
+            <th>Value</th>
35
           </tr>
68
           </tr>
36
         </thead>
69
         </thead>
37
         <tbody>
70
         <tbody>
38
-          <tr v-for="(item, i) in propertySearch" :key="i">
71
+          <tr v-for="(item, i) in list" :key="i">
39
             <td>{{ formatDate(item.date) }}</td>
72
             <td>{{ formatDate(item.date) }}</td>
40
             <td>{{ formatTime(item.date) }}</td>
73
             <td>{{ formatTime(item.date) }}</td>
41
-            <td v-if="item.user">{{ item.user }}</td>
42
-            <td v-else>No User</td>
43
-            <td>{{ item.keyword === 'All' ? '' : item.keyword }}</td>
44
-            <td>{{ item.salesType === 'All' ? '' : item.salesType }}</td>
45
-            <td>{{ item.propertyUsageType === 'All' ? '' : item.propertyUsageType }}</td>
46
-            <td>{{ item.propertyType === 'All' ? '' : item.propertyType }}</td>
47
-            <td>{{ item.province === 'All' ? '' : item.province }}</td>
48
-            <td>{{ item.city === 'All' ? '' : item.city }}</td>
49
-            <td>{{ item.suburb === 'All' ? '' : item.suburb }}</td>
74
+            <td>{{ item.userName }}</td>
75
+            <td>{{ item.type }}</td>
76
+            <td>{{ item.property }}</td>
77
+            <td>{{ item.value }}</td>
50
           </tr>
78
           </tr>
51
         </tbody>
79
         </tbody>
52
       </table>
80
       </table>
56
 </template>
84
 </template>
57
 
85
 
58
 <script>
86
 <script>
59
-import { mapState, mapActions } from 'vuex';
87
+import { mapState, mapActions, mapGetters } from 'vuex';
60
 import moment from 'moment';
88
 import moment from 'moment';
61
 import Vue from 'vue';
89
 import Vue from 'vue';
62
 import excel from 'vue-excel-export';
90
 import excel from 'vue-excel-export';
66
 export default {
94
 export default {
67
   name: 'searchLog',
95
   name: 'searchLog',
68
   data() {
96
   data() {
69
-    return {};
97
+    return {
98
+      exportFields: {
99
+        Date: 'date',
100
+        User: 'userName',
101
+        Type: 'type',
102
+        Field: 'property',
103
+        Value: 'value',
104
+      },
105
+    };
70
   },
106
   },
71
   methods: {
107
   methods: {
72
-    ...mapActions('searchLog', ['getPropertySearchLogs']),
108
+    ...mapActions('searchLog', ['getPropertySearchLogs', 'clearFilter']),
73
     formatDate(value) {
109
     formatDate(value) {
74
       return moment(String(value)).format('YYYY/MM/DD');
110
       return moment(String(value)).format('YYYY/MM/DD');
75
     },
111
     },
81
     this.getPropertySearchLogs();
117
     this.getPropertySearchLogs();
82
   },
118
   },
83
   computed: {
119
   computed: {
84
-    ...mapState('searchLog', ['propertySearch']),
120
+    ...mapState('searchLog', ['list', 'fields', 'filter']),
121
+    ...mapGetters({
122
+      list: 'searchLog/filterList',
123
+    }),
85
   },
124
   },
86
 };
125
 };
87
 </script>
126
 </script>

+ 59
- 8
src/components/property/propertySearchFields.vue Dosyayı Görüntüle

10
             </span>
10
             </span>
11
           </div>
11
           </div>
12
           <select
12
           <select
13
-            class="form-control form-control-lg form-control-a"
13
+            class="form-control"
14
             id="forSelector"
14
             id="forSelector"
15
             v-model="propertySearch.salesType"
15
             v-model="propertySearch.salesType"
16
             @change="salesTypeSelected"
16
             @change="salesTypeSelected"
29
             </span>
29
             </span>
30
           </div>
30
           </div>
31
           <select
31
           <select
32
-            class="form-control form-control-lg form-control-a"
32
+            class="form-control"
33
             id="forSelector"
33
             id="forSelector"
34
             v-model="resType"
34
             v-model="resType"
35
             @change="PropertyTypeSelected"
35
             @change="PropertyTypeSelected"
56
             </span>
56
             </span>
57
           </div>
57
           </div>
58
           <select
58
           <select
59
-            class="form-control form-control-lg form-control-a"
59
+            class="form-control"
60
             id="forSelector"
60
             id="forSelector"
61
             v-model="comType"
61
             v-model="comType"
62
             @change="PropertyTypeSelected"
62
             @change="PropertyTypeSelected"
83
             </span>
83
             </span>
84
           </div>
84
           </div>
85
           <select
85
           <select
86
-            class="form-control form-control-lg form-control-a"
86
+            class="form-control"
87
             id="provinceselector"
87
             id="provinceselector"
88
             @change="ProvinceSelected"
88
             @change="ProvinceSelected"
89
             v-model="propertySearch.province"
89
             v-model="propertySearch.province"
109
             </span>
109
             </span>
110
           </div>
110
           </div>
111
           <select
111
           <select
112
-            class="form-control form-control-lg form-control-a"
112
+            class="form-control"
113
             id="cityselector"
113
             id="cityselector"
114
             @change="CitySelected"
114
             @change="CitySelected"
115
             v-model="propertySearch.city"
115
             v-model="propertySearch.city"
135
             </span>
135
             </span>
136
           </div>
136
           </div>
137
           <select
137
           <select
138
-            class="form-control form-control-lg form-control-a"
138
+            class="form-control"
139
             id="suburbselector"
139
             id="suburbselector"
140
             v-model="propertySearch.suburb"
140
             v-model="propertySearch.suburb"
141
             @change="SuburbSeleted"
141
             @change="SuburbSeleted"
151
         </div>
151
         </div>
152
       </div>
152
       </div>
153
     </div>
153
     </div>
154
+    <div class="container text-left">
155
+      <div class="form-group">
156
+        <div class="row">
157
+          <div class="col-md-6 text-left">
158
+            <label>Minimum Price</label>
159
+            <div class="input-group mb-3">
160
+              <div class="input-group-prepend">
161
+                <span class="input-group-text" style="color: #60CBEB">
162
+                  <b>R</b>
163
+                </span>
164
+              </div>
165
+              <input
166
+                class="form-control"
167
+                type="number"
168
+                step="any"
169
+                id="minPrice"
170
+                name="minPrice"
171
+                v-model="propertySearch.minPrice"
172
+              />
173
+              <div class="input-group-append" @click="clearFilter('minPrice')">
174
+                <span class="input-group-text cursor-pointer" style="color: #60CBEB">
175
+                  <b>X</b>
176
+                </span>
177
+              </div>
178
+            </div>
179
+          </div>
180
+          <div class="col-md-6 text-left">
181
+            <label>Maximum Price</label>
182
+            <div class="input-group mb-3">
183
+              <div class="input-group-prepend">
184
+                <span class="input-group-text" style="color: #60CBEB">
185
+                  <b>R</b>
186
+                </span>
187
+              </div>
188
+              <input
189
+                class="form-control"
190
+                type="number"
191
+                step="any"
192
+                id="maxPrice"
193
+                name="maxPrice"
194
+                v-model="propertySearch.maxPrice"
195
+              />
196
+              <div class="input-group-append" @click="clearFilter('maxPrice')">
197
+                <span class="input-group-text cursor-pointer" style="color: #60CBEB">
198
+                  <b>X</b>
199
+                </span>
200
+              </div>
201
+            </div>
202
+          </div>
203
+        </div>
204
+      </div>
205
+    </div>
154
   </div>
206
   </div>
155
 </template>
207
 </template>
156
 
208
 
171
     this.getProvince();
223
     this.getProvince();
172
     this.getPropertyTypesRes();
224
     this.getPropertyTypesRes();
173
     this.getPropertyTypesCom();
225
     this.getPropertyTypesCom();
174
-    this.getPropertySearchObject();
175
     setTimeout(() => {
226
     setTimeout(() => {
176
       this.propertySearch.propertyUsageType = this.propertyType;
227
       this.propertySearch.propertyUsageType = this.propertyType;
177
     }, 100);
228
     }, 100);
184
   methods: {
235
   methods: {
185
     ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
236
     ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
186
     ...mapActions('property', ['getPropertyTypesRes', 'getPropertyTypesCom']),
237
     ...mapActions('property', ['getPropertyTypesRes', 'getPropertyTypesCom']),
187
-    ...mapActions('propertySearch', ['getPropertySearchObject', 'clearFilter']),
238
+    ...mapActions('propertySearch', ['clearFilter']),
188
     clearResType() {
239
     clearResType() {
189
       this.clearFilter('propertyType');
240
       this.clearFilter('propertyType');
190
       this.resType = 'All';
241
       this.resType = 'All';

+ 7
- 22
src/components/property/propertySearchPage.vue Dosyayı Görüntüle

145
   },
145
   },
146
   data() {
146
   data() {
147
     return {
147
     return {
148
-      type: '',
149
-      propertyType: '',
150
-      propertyTypeparam: '',
151
-      province: '',
152
-      city: '',
153
-      suburb: '',
154
-      proptype: '',
155
-      keyword: '',
156
       propertySearch: {
148
       propertySearch: {
157
-        userID: 0,
158
-        keyword: '',
149
+        userName: '',
159
         salesType: 'All',
150
         salesType: 'All',
160
         propertyUsageType: 'All',
151
         propertyUsageType: 'All',
161
         propertyType: 'All',
152
         propertyType: 'All',
162
         province: 'All',
153
         province: 'All',
163
         city: 'All',
154
         city: 'All',
164
         suburb: 'All',
155
         suburb: 'All',
156
+        minPrice: 0,
157
+        maxPrice: 0,
165
       },
158
       },
166
     };
159
     };
167
   },
160
   },
171
   computed: {
164
   computed: {
172
     ...mapState('propertySearch', ['properties']),
165
     ...mapState('propertySearch', ['properties']),
173
     ParamsChanged() {
166
     ParamsChanged() {
174
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
175
-      this.propertySearch = {
176
-        userID: 0,
177
-        keyword: '',
178
-        salesType: 'All',
179
-        propertyUsageType: 'All',
180
-        propertyType: 'All',
181
-        province: 'All',
182
-        city: 'All',
183
-        suburb: 'All',
184
-      };
185
-
186
       if (Object.keys(this.$route.params).length > 0) {
167
       if (Object.keys(this.$route.params).length > 0) {
187
         if (this.$route.params.propertyUsageType) {
168
         if (this.$route.params.propertyUsageType) {
188
           // eslint-disable-next-line vue/no-side-effects-in-computed-properties
169
           // eslint-disable-next-line vue/no-side-effects-in-computed-properties
189
           this.propertySearch.propertyUsageType = this.$route.params.propertyUsageType;
170
           this.propertySearch.propertyUsageType = this.$route.params.propertyUsageType;
171
+          // eslint-disable-next-line vue/no-side-effects-in-computed-properties
172
+          this.propertySearch.keyword = 'All';
173
+          // eslint-disable-next-line vue/no-side-effects-in-computed-properties
174
+          this.propertySearch.salesType = 'All';
190
         }
175
         }
191
       }
176
       }
192
       if (Object.keys(this.$route.query).length > 0) {
177
       if (Object.keys(this.$route.query).length > 0) {

+ 14
- 6
src/components/property/propertyeditPage.vue Dosyayı Görüntüle

5
       <div class="col-sm-12">
5
       <div class="col-sm-12">
6
         <div class="tobuy-img-box">
6
         <div class="tobuy-img-box">
7
           <img
7
           <img
8
+            v-if="propertyType === 'Commercial'"
9
+            src="img/Commercial-Property.jpg"
10
+            alt="Timeshare To Buy"
11
+            class="img-fluid"
12
+            style="width:800px;height:400px; border-radius:10px"
13
+          />
14
+          <img
15
+            v-else
8
             src="img/Listing3.2.jpg"
16
             src="img/Listing3.2.jpg"
9
             alt="Timeshare To Buy"
17
             alt="Timeshare To Buy"
10
             class="img-fluid"
18
             class="img-fluid"
355
 
363
 
356
       setTimeout(
364
       setTimeout(
357
         () => this.$router.push({
365
         () => this.$router.push({
358
-          path: '/property/search',
359
-          query: {
360
-            salesType: this.salesType,
361
-            propertyUsageType: this.propertyType,
362
-          },
363
-        }),
366
+            path: '/property/search',
367
+            query: {
368
+              salesType: this.salesType,
369
+              propertyUsageType: this.propertyType,
370
+            },
371
+          }),
364
         3000,
372
         3000,
365
       );
373
       );
366
     },
374
     },

+ 6
- 12
src/components/shared/searchTab.vue Dosyayı Görüntüle

11
           <div class="col-md-12">
11
           <div class="col-md-12">
12
             <div class="form-group" style="text-align:left">
12
             <div class="form-group" style="text-align:left">
13
               <label for="Type">Keyword</label>
13
               <label for="Type">Keyword</label>
14
-              <input
15
-                type="text"
16
-                class="form-control form-control-a"
17
-                placeholder="Keyword"
18
-                v-model="keyword"
19
-              />
14
+              <input type="text" class="form-control" placeholder="Keyword" v-model="keyword" />
20
             </div>
15
             </div>
21
           </div>
16
           </div>
22
           <div class="col-md-12">
17
           <div class="col-md-12">
81
                 role="tabpanel"
76
                 role="tabpanel"
82
                 aria-labelledby="pills-map-tab"
77
                 aria-labelledby="pills-map-tab"
83
               >
78
               >
84
-                <propertySearch propertyType="Commercial" />
79
+                <propertySearch propertyType="Commercial" @updateSearch="updateSearch" />
85
               </div>
80
               </div>
86
             </div>
81
             </div>
87
           </div>
82
           </div>
95
 </template>
90
 </template>
96
 
91
 
97
 <script>
92
 <script>
98
-import { mapState, mapActions } from 'vuex';
99
 import propertySearch from '../property/propertySearchFields.vue';
93
 import propertySearch from '../property/propertySearchFields.vue';
100
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
94
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
101
 
95
 
109
       selectedPropertyType: 'timeshare',
103
       selectedPropertyType: 'timeshare',
110
       keyword: '',
104
       keyword: '',
111
       propertySearch: {
105
       propertySearch: {
112
-        userID: 0,
113
-        keyword: '',
106
+        userName: '',
114
         salesType: 'Sale',
107
         salesType: 'Sale',
115
         propertyUsageType: 'All',
108
         propertyUsageType: 'All',
116
         propertyType: 'All',
109
         propertyType: 'All',
117
         province: 'All',
110
         province: 'All',
118
         city: 'All',
111
         city: 'All',
119
         suburb: 'All',
112
         suburb: 'All',
113
+        minPrice: 0,
114
+        maxPrice: 0,
120
       },
115
       },
121
     };
116
     };
122
   },
117
   },
123
-  computed: {},
124
   methods: {
118
   methods: {
125
     updateType(item) {
119
     updateType(item) {
126
       this.selectedPropertyType = item;
120
       this.selectedPropertyType = item;
134
       if (this.selectedPropertyType === 'timeshare') {
128
       if (this.selectedPropertyType === 'timeshare') {
135
         this.$router.push('/timeshare/search/');
129
         this.$router.push('/timeshare/search/');
136
       } else {
130
       } else {
131
+        // this.$router.push('/property/search');
137
         this.$router.push({
132
         this.$router.push({
138
           path: '/property/search',
133
           path: '/property/search',
139
           query: this.propertySearch,
134
           query: this.propertySearch,
140
         });
135
         });
141
-        // this.$router.push('/property/search');
142
       }
136
       }
143
     },
137
     },
144
   },
138
   },

+ 46
- 6
src/store/modules/logs/searchLog.js Dosyayı Görüntüle

1
-// api/searchLog/property
2
 import axios from 'axios';
1
 import axios from 'axios';
2
+import _ from 'lodash';
3
 
3
 
4
 export default {
4
 export default {
5
   namespaced: true,
5
   namespaced: true,
6
   state: {
6
   state: {
7
-    propertySearch: {},
7
+    list: [],
8
+    fields: [],
9
+    filter: {
10
+      by: undefined,
11
+      value: undefined,
12
+    },
8
   },
13
   },
9
   mutations: {
14
   mutations: {
10
     updateSearch(state, data) {
15
     updateSearch(state, data) {
11
-      state.propertySearch = [];
12
-      state.propertySearch = data;
16
+      state.list = [];
17
+      state.fields = [];
18
+      state.list = data;
19
+      data.forEach((item) => {
20
+        state.fields.push(item.property);
21
+      });
22
+      state.fields = state.fields.filter((x, i, a) => a.indexOf(x) === i);
23
+    },
24
+    onClearFilter(state) {
25
+      state.filter = {
26
+        by: undefined,
27
+        value: undefined,
28
+      };
29
+    },
30
+  },
31
+  getters: {
32
+    filterList: (state) => {
33
+      let lst = state.list;
34
+      const { filter } = state;
35
+      if (filter) {
36
+        if (filter.by) {
37
+          lst = _.filter(lst, x => x.property === filter.by);
38
+          if (filter.value) {
39
+            lst = _.filter(lst, x => x.value.toUpperCase().includes(filter.value.toUpperCase()));
40
+          }
41
+        } else if (filter.value) {
42
+          lst = _.filter(
43
+            lst,
44
+            x => x.value.toUpperCase().includes(filter.value.toUpperCase())
45
+              || x.userName.toUpperCase().includes(filter.value.toUpperCase())
46
+              || x.type.toUpperCase().includes(filter.value.toUpperCase()),
47
+          );
48
+        }
49
+      }
50
+      return lst;
13
     },
51
     },
14
   },
52
   },
15
-  getters: {},
16
   actions: {
53
   actions: {
17
     getPropertySearchLogs({ commit }) {
54
     getPropertySearchLogs({ commit }) {
18
       axios
55
       axios
19
-        .get('/api/searchLog/property')
56
+        .get('/api/searchLog')
20
         .then(result => commit('updateSearch', result.data))
57
         .then(result => commit('updateSearch', result.data))
21
         .catch(console.error);
58
         .catch(console.error);
22
     },
59
     },
60
+    clearFilter({ commit }) {
61
+      commit('onClearFilter');
62
+    },
23
   },
63
   },
24
 };
64
 };

+ 69
- 6
src/store/modules/property/propertySearch.js Dosyayı Görüntüle

1
+/* eslint-disable max-len */
2
+/* eslint-disable indent */
1
 import axios from 'axios';
3
 import axios from 'axios';
4
+import _ from 'lodash';
2
 
5
 
3
 export default {
6
 export default {
4
   namespaced: true,
7
   namespaced: true,
5
   state: {
8
   state: {
6
     propertySearch: {
9
     propertySearch: {
7
-      userID: 0,
8
-      keyword: '',
10
+      userName: '',
9
       salesType: 'Sale',
11
       salesType: 'Sale',
10
       propertyUsageType: 'All',
12
       propertyUsageType: 'All',
11
       propertyType: 'All',
13
       propertyType: 'All',
12
       province: 'All',
14
       province: 'All',
13
       city: 'All',
15
       city: 'All',
14
       suburb: 'All',
16
       suburb: 'All',
17
+      minPrice: 0,
18
+      maxPrice: 0,
15
     },
19
     },
16
     properties: [],
20
     properties: [],
17
     latestProperties: [],
21
     latestProperties: [],
31
       state.propertySearch[filter] = 'All';
35
       state.propertySearch[filter] = 'All';
32
     },
36
     },
33
   },
37
   },
34
-  getters: {},
38
+  // getters: {
39
+  //   filterProperties: (state) => {
40
+  //     let list = state.properties;
41
+  //     const { propertySearch } = state;
42
+  //     if (propertySearch) {
43
+  //       if (propertySearch.salesType === 'Sale') {
44
+  //         list = _.filter(list, x => x.isSale);
45
+  //       } else {
46
+  //         list = _.filter(list, x => !x.isSale);
47
+  //       }
48
+  //       if (propertySearch.propertyUsageType && propertySearch.propertyUsageType !== 'All') {
49
+  //         list = _.filter(list, x => x.propertyUsageType
50
+  //             .toUpperCase()
51
+  //             // eslint-disable-next-line comma-dangle
52
+  //             .includes(propertySearch.propertyUsageType.toUpperCase()));
53
+  //       }
54
+  //       if (propertySearch.propertyType && propertySearch.propertyType !== 'All') {
55
+  //         list = _.filter(list, x => x.propertyType
56
+  //             .toUpperCase()
57
+  //             // eslint-disable-next-line comma-dangle
58
+  //             .includes(propertySearch.propertyType.toUpperCase()));
59
+  //       }
60
+  //       if (propertySearch.province && propertySearch.province !== 'All') {
61
+  //         list = _.filter(list, x => x.province
62
+  //             .toUpperCase()
63
+  //             // eslint-disable-next-line comma-dangle
64
+  //             .includes(propertySearch.province.toUpperCase()));
65
+  //       }
66
+  //       if (propertySearch.city && propertySearch.city !== 'All') {
67
+  //         list = _.filter(list, x => x.city
68
+  //             .toUpperCase()
69
+  //             // eslint-disable-next-line comma-dangle
70
+  //             .includes(propertySearch.city.toUpperCase()));
71
+  //       }
72
+  //       if (propertySearch.suburb && propertySearch.suburb !== 'All') {
73
+  //         list = _.filter(list, x => x.suburb
74
+  //             .toUpperCase()
75
+  //             // eslint-disable-next-line comma-dangle
76
+  //             .includes(propertySearch.suburb.toUpperCase()));
77
+  //       }
78
+  //       if (propertySearch.suburb && propertySearch.suburb !== 'All') {
79
+  //         list = _.filter(list, x => x.suburb
80
+  //             .toUpperCase()
81
+  //             // eslint-disable-next-line comma-dangle
82
+  //             .includes(propertySearch.suburb.toUpperCase()));
83
+  //       }
84
+  //       if (propertySearch.minPrice) {
85
+  //         list = _.filter(list, x => x.price >= propertySearch.minPrice);
86
+  //       }
87
+  //       if (propertySearch.maxPrice) {
88
+  //         list = _.filter(list, x => x.price <= propertySearch.maxPrice);
89
+  //       }
90
+  //     }
91
+  //     return list;
92
+  //   },
93
+  // },
35
   actions: {
94
   actions: {
36
     clearFilter({ commit }, filter) {
95
     clearFilter({ commit }, filter) {
37
       commit('onClearFilter', filter);
96
       commit('onClearFilter', filter);
38
     },
97
     },
39
     getPropertySearchObject({ commit }) {
98
     getPropertySearchObject({ commit }) {
40
       const search = {
99
       const search = {
41
-        userID: 0,
42
-        keyword: 'All',
100
+        userName: '',
43
         salesType: 'Sale',
101
         salesType: 'Sale',
44
         propertyUsageType: 'All',
102
         propertyUsageType: 'All',
45
         propertyType: 'All',
103
         propertyType: 'All',
46
         province: 'All',
104
         province: 'All',
47
         city: 'All',
105
         city: 'All',
48
         suburb: 'All',
106
         suburb: 'All',
107
+        minPrice: 0,
108
+        maxPrice: 0,
49
       };
109
       };
50
       commit('setPropertySearch', search);
110
       commit('setPropertySearch', search);
51
     },
111
     },
53
       if (item.keyword === '') {
113
       if (item.keyword === '') {
54
         item.keyword = 'All';
114
         item.keyword = 'All';
55
       }
115
       }
116
+      if (item.userName === '') {
117
+        item.userName = 'Unknown';
118
+      }
56
       axios
119
       axios
57
         .get(
120
         .get(
58
-          `/api/Property/Search/${item.userID}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}`,
121
+          `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}`,
59
         )
122
         )
60
         .then(result => commit('updateSearch', result.data))
123
         .then(result => commit('updateSearch', result.data))
61
         .catch(console.error);
124
         .catch(console.error);

Loading…
İptal
Kaydet