Browse Source

Merge issues

master
Kobus 5 years ago
parent
commit
8ceb70efe7

+ 13
- 0
package-lock.json View File

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 View File

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 View File


+ 62
- 23
src/components/admin/logs/SearchLogs.vue View File

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
 
89
 
62
 export default {
90
 export default {
63
   name: 'searchLog',
91
   name: 'searchLog',
64
   data() {
92
   data() {
65
-    return {};
93
+    return {
94
+      exportFields: {
95
+        Date: 'date',
96
+        User: 'userName',
97
+        Type: 'type',
98
+        Field: 'property',
99
+        Value: 'value',
100
+      },
101
+    };
66
   },
102
   },
67
   methods: {
103
   methods: {
68
-    ...mapActions('searchLog', ['getPropertySearchLogs']),
104
+    ...mapActions('searchLog', ['getPropertySearchLogs', 'clearFilter']),
69
     formatDate(value) {
105
     formatDate(value) {
70
       return moment(String(value)).format('YYYY/MM/DD');
106
       return moment(String(value)).format('YYYY/MM/DD');
71
     },
107
     },
77
     this.getPropertySearchLogs();
113
     this.getPropertySearchLogs();
78
   },
114
   },
79
   computed: {
115
   computed: {
80
-    ...mapState('searchLog', ['propertySearch']),
116
+    ...mapState('searchLog', ['list', 'fields', 'filter']),
117
+    ...mapGetters({
118
+      list: 'searchLog/filterList',
119
+    }),
81
   },
120
   },
82
 };
121
 };
83
 </script>
122
 </script>

+ 59
- 8
src/components/property/propertySearchFields.vue View File

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 View File

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 View File

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
     },

+ 16
- 8
src/components/shared/navBar.vue View File

185
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
185
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
186
               </div>
186
               </div>
187
             </li>
187
             </li>
188
-            <li class="nav-item dropdown">
188
+            <li class="nav-item dropdown" v-if="hideLogin">
189
               <a
189
               <a
190
                 class="nav-link"
190
                 class="nav-link"
191
-                v-if="hideLogin"
192
                 @click="routerGoTo('/user/login')"
191
                 @click="routerGoTo('/user/login')"
193
                 id="navbarDropdown"
192
                 id="navbarDropdown"
194
                 role="button"
193
                 role="button"
197
                 aria-expanded="false"
196
                 aria-expanded="false"
198
               >Login</a>
197
               >Login</a>
199
             </li>
198
             </li>
200
-            <li class="nav-item dropdown">
201
-              <span v-if="showLogout">
202
-                <a class="nav-link" @click="logout()">Logout</a>
199
+            <li class="nav-item dropdown" v-if="showLogout">
200
+              <span>
201
+                <a class="nav-link" @click="logout(routerGoTo('/user/login'))">Logout</a>
203
               </span>
202
               </span>
204
-              <span v-else></span>
203
+              <!-- <span v-else></span> -->
205
             </li>
204
             </li>
206
             <li>
205
             <li>
207
               <span v-if="showLogout">
206
               <span v-if="showLogout">
208
-                <a>Welcome! {{ }}</a>
207
+                <a>
208
+                  Welcome!
209
+                  <br />
210
+                  {{ username }}
211
+                </a>
209
               </span>
212
               </span>
210
               <span v-else></span>
213
               <span v-else></span>
211
             </li>
214
             </li>
232
 
235
 
233
 export default {
236
 export default {
234
   data() {
237
   data() {
235
-    return {};
238
+    return {
239
+      username: sessionStorage.getItem('name'),
240
+    };
236
   },
241
   },
237
   computed: {
242
   computed: {
238
     showLogout() {
243
     showLogout() {
244
+      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
245
+      this.username = sessionStorage.getItem('name');
239
       return this.$store.state.authentication.status === 'success';
246
       return this.$store.state.authentication.status === 'success';
240
     },
247
     },
241
     hideLogin() {
248
     hideLogin() {
242
       return this.$store.state.authentication.status !== 'success';
249
       return this.$store.state.authentication.status !== 'success';
243
     },
250
     },
251
+    // eslint-disable-next-line vue/return-in-computed-property
244
     Logout() {
252
     Logout() {
245
       return this.$store.state.authentication.methods.logout;
253
       return this.$store.state.authentication.methods.logout;
246
     },
254
     },

+ 9
- 6
src/components/shared/searchTab.vue View File

13
               <label for="Type">Keyword</label>
13
               <label for="Type">Keyword</label>
14
               <input
14
               <input
15
                 type="text"
15
                 type="text"
16
-                class="form-control form-control-a"
16
+                class="form-control"
17
                 placeholder="Keyword"
17
                 placeholder="Keyword"
18
-                v-model="filter.keyword"
18
+                v-model="propertySearch.keyword"
19
               />
19
               />
20
             </div>
20
             </div>
21
           </div>
21
           </div>
81
                 role="tabpanel"
81
                 role="tabpanel"
82
                 aria-labelledby="pills-map-tab"
82
                 aria-labelledby="pills-map-tab"
83
               >
83
               >
84
-                <propertySearch propertyType="Commercial" />
84
+                <propertySearch propertyType="Commercial" @updateSearch="updateSearch" />
85
               </div>
85
               </div>
86
             </div>
86
             </div>
87
           </div>
87
           </div>
95
 </template>
95
 </template>
96
 
96
 
97
 <script>
97
 <script>
98
-import { mapState, mapActions } from 'vuex';
98
+import { mapState } from 'vuex';
99
 import propertySearch from '../property/propertySearchFields.vue';
99
 import propertySearch from '../property/propertySearchFields.vue';
100
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
100
 import timeshareSearch from '../timeshare/searchTimeshare.vue';
101
 
101
 
108
     return {
108
     return {
109
       selectedPropertyType: 'timeshare',
109
       selectedPropertyType: 'timeshare',
110
       propertySearch: {
110
       propertySearch: {
111
-        userID: 0,
111
+        keyword: '',
112
+        userName: '',
112
         salesType: 'Sale',
113
         salesType: 'Sale',
113
         propertyUsageType: 'All',
114
         propertyUsageType: 'All',
114
         propertyType: 'All',
115
         propertyType: 'All',
115
         province: 'All',
116
         province: 'All',
116
         city: 'All',
117
         city: 'All',
117
         suburb: 'All',
118
         suburb: 'All',
119
+        minPrice: 0,
120
+        maxPrice: 0,
118
       },
121
       },
119
     };
122
     };
120
   },
123
   },
134
       if (this.selectedPropertyType === 'timeshare') {
137
       if (this.selectedPropertyType === 'timeshare') {
135
         this.$router.push('/timeshare/search/');
138
         this.$router.push('/timeshare/search/');
136
       } else {
139
       } else {
140
+        // this.$router.push('/property/search');
137
         this.$router.push({
141
         this.$router.push({
138
           path: '/property/search',
142
           path: '/property/search',
139
           query: this.propertySearch,
143
           query: this.propertySearch,
140
         });
144
         });
141
-        // this.$router.push('/property/search');
142
       }
145
       }
143
     },
146
     },
144
   },
147
   },

+ 0
- 1
src/components/timeshare/sell/sellPage.vue View File

314
             <BankDetails :bankingDetails="sellItem.owner.bankingDetails" />
314
             <BankDetails :bankingDetails="sellItem.owner.bankingDetails" />
315
             <hr />
315
             <hr />
316
           </div>
316
           </div>
317
-          <hr />
318
           <br />
317
           <br />
319
           <div class="myWell">
318
           <div class="myWell">
320
             <h4>Share transfer information</h4>
319
             <h4>Share transfer information</h4>

+ 1
- 1
src/components/user/logOut.vue View File

11
     ...mapActions('authentication', ['logout']),
11
     ...mapActions('authentication', ['logout']),
12
     Logout() {
12
     Logout() {
13
       this.logout('logout').then(() => {
13
       this.logout('logout').then(() => {
14
-        this.$router.push('/users/login');
14
+        this.$router.push('/user/login');
15
       });
15
       });
16
     },
16
     },
17
   },
17
   },

+ 2
- 2
src/components/user/loginPage.vue View File

8
             <h4>Login</h4>
8
             <h4>Login</h4>
9
             <br />
9
             <br />
10
           </div>
10
           </div>
11
-          <!-- <alert :text="'Login successful'" :type="'SUCCESS'" />
11
+          <!--<alert :text="'Login successful'" :type="'SUCCESS'" />
12
           <alert :text="'User does not exist, please register'" :type="'ERROR'" />
12
           <alert :text="'User does not exist, please register'" :type="'ERROR'" />
13
           <alert :text="'Username is incorrect'" :type="'WARNING'" />
13
           <alert :text="'Username is incorrect'" :type="'WARNING'" />
14
           <alert :text="'Password is incorrect'" :type="'WARNING'" />
14
           <alert :text="'Password is incorrect'" :type="'WARNING'" />
81
         <div class="form">
81
         <div class="form">
82
           <h5>Trouble signing in?</h5>
82
           <h5>Trouble signing in?</h5>
83
           <div>
83
           <div>
84
-            <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
84
+            <!--<alert :text="'Username & password request email sent'" :type="'SUCCESS'" />-->
85
             <div class="row">
85
             <div class="row">
86
               <div class="input-group-prepend">
86
               <div class="input-group-prepend">
87
                 <span class="input-group-text">
87
                 <span class="input-group-text">

+ 10
- 2
src/components/user/registerAgencySection.vue View File

200
               <button @click="SubmitData()" class="btn btn-b-n" type="button">Submit</button>
200
               <button @click="SubmitData()" class="btn btn-b-n" type="button">Submit</button>
201
             </div>
201
             </div>
202
             <div class="col-md-2 offset-md-1">
202
             <div class="col-md-2 offset-md-1">
203
-              <button @click="Cancel()" class="btn btn-b-n" type="button">Cancel</button>
203
+              <button
204
+                @click="Close(routerGoTo('/user/login'))"
205
+                class="btn btn-b-n"
206
+                type="button"
207
+              >Cancel</button>
204
             </div>
208
             </div>
205
           </div>
209
           </div>
206
         </div>
210
         </div>
244
       'clearAgency',
248
       'clearAgency',
245
     ]),
249
     ]),
246
 
250
 
251
+    routerGoTo(goTo) {
252
+      this.$emit('routerGoTo', goTo);
253
+    },
254
+
247
     togglePassword() {
255
     togglePassword() {
248
       this.showPassword = true;
256
       this.showPassword = true;
249
       this.isPasswordShown = 'text';
257
       this.isPasswordShown = 'text';
257
       this.$router.push('/user/login');
265
       this.$router.push('/user/login');
258
     },
266
     },
259
     Close() {
267
     Close() {
260
-      this.$router.push('/registerAgency/');
268
+      this.$router.push('/user/login');
261
     },
269
     },
262
   },
270
   },
263
 };
271
 };

+ 10
- 2
src/components/user/registerPage.vue View File

146
               <button @click="SubmitData()" class="btn btn-b-n" type="submit">Submit</button>
146
               <button @click="SubmitData()" class="btn btn-b-n" type="submit">Submit</button>
147
             </div>
147
             </div>
148
             <div class="col-md-2 offset-md-1">
148
             <div class="col-md-2 offset-md-1">
149
-              <button @click="Cancel()" class="btn btn-b-n" type="submit">Cancel</button>
149
+              <button
150
+                @click="Close(routerGoTo('/user/login'))"
151
+                class="btn btn-b-n"
152
+                type="submit"
153
+              >Cancel</button>
150
             </div>
154
             </div>
151
           </div>
155
           </div>
152
         </div>
156
         </div>
192
       'clearIndividual',
196
       'clearIndividual',
193
     ]),
197
     ]),
194
 
198
 
199
+    routerGoTo(goTo) {
200
+      this.$emit('routerGoTo', goTo);
201
+    },
202
+
195
     togglePassword() {
203
     togglePassword() {
196
       this.showPassword = true;
204
       this.showPassword = true;
197
       this.isPasswordShown = 'text';
205
       this.isPasswordShown = 'text';
206
       this.$router.push('/user/login');
214
       this.$router.push('/user/login');
207
     },
215
     },
208
     Close() {
216
     Close() {
209
-      this.$router.push('/registerIndividual/');
217
+      this.$router.push('/user/login');
210
     },
218
     },
211
   },
219
   },
212
 };
220
 };

+ 2
- 1
src/router/index.js View File

52
       y: 0,
52
       y: 0,
53
     };
53
     };
54
   },
54
   },
55
-  routes: [{
55
+  routes: [
56
+    {
56
       path: '/',
57
       path: '/',
57
       name: 'Home',
58
       name: 'Home',
58
       component: HomePage,
59
       component: HomePage,

+ 46
- 6
src/store/modules/logs/searchLog.js View File

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 View File

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);

+ 13
- 10
src/store/modules/user/authentication.js View File

7
   namespaced: true,
7
   namespaced: true,
8
   state: {
8
   state: {
9
     status: '',
9
     status: '',
10
-    token: localStorage.getItem('token') || '',
10
+    token: sessionStorage.getItem('token') || '',
11
     user: {},
11
     user: {},
12
+    individual: {},
12
   },
13
   },
13
   mutations: {
14
   mutations: {
14
     auth_request(state) {
15
     auth_request(state) {
32
     authStatus: state => state.status,
33
     authStatus: state => state.status,
33
   },
34
   },
34
   actions: {
35
   actions: {
35
-    login({
36
-      commit,
37
-    }, user) {
36
+    login({ commit }, user) {
38
       return new Promise((reject) => {
37
       return new Promise((reject) => {
39
         commit('auth_request');
38
         commit('auth_request');
40
         axios({
39
         axios({
44
         })
43
         })
45
           .then((resp) => {
44
           .then((resp) => {
46
             console.log(resp.data);
45
             console.log(resp.data);
47
-            localStorage.setItem('token', resp.data.token);
46
+            sessionStorage.setItem('token', resp.data.token);
47
+            sessionStorage.setItem('username', resp.data.username);
48
+            sessionStorage.setItem('name', resp.data.name);
48
             commit('auth_success', resp.data.token, resp.data);
49
             commit('auth_success', resp.data.token, resp.data);
49
           })
50
           })
50
           .catch((err) => {
51
           .catch((err) => {
51
             commit('auth_error');
52
             commit('auth_error');
52
-            localStorage.removeItem('token');
53
+            sessionStorage.removeItem('token');
54
+            sessionStorage.removeItem('username');
55
+            sessionStorage.removeItem('name');
53
             reject(err);
56
             reject(err);
54
           });
57
           });
55
       });
58
       });
56
     },
59
     },
57
-    logout({
58
-      commit,
59
-    }) {
60
+    logout({ commit }) {
60
       return new Promise(() => {
61
       return new Promise(() => {
61
         commit('logout');
62
         commit('logout');
62
-        localStorage.removeItem('token');
63
+        sessionStorage.removeItem('token');
64
+        sessionStorage.removeItem('username');
65
+        sessionStorage.removeItem('name');
63
         delete axios.defaults.headers.common.Authorization;
66
         delete axios.defaults.headers.common.Authorization;
64
       });
67
       });
65
     },
68
     },

+ 1
- 1
vue.config.js View File

2
   devServer: {
2
   devServer: {
3
     proxy: {
3
     proxy: {
4
       '/api': {
4
       '/api': {
5
-        target: 'http://192.168.6.188:5000',
5
+        target: 'http://localhost:57260',
6
         changeOrigin: true,
6
         changeOrigin: true,
7
       },
7
       },
8
     },
8
     },

Loading…
Cancel
Save