Przeglądaj źródła

Property fixes & Search

master
George Williams 5 lat temu
rodzic
commit
30a5cf93be

+ 37
- 55
src/components/property/propertyCreate.vue Wyświetl plik

69
                     v-model="property.propertyTypeId"
69
                     v-model="property.propertyTypeId"
70
                   >
70
                   >
71
                     <option value="0">Please select type</option>
71
                     <option value="0">Please select type</option>
72
-                    <option
73
-                      v-for="item in propertyTypes"
74
-                      :value="item.id"
75
-                      :key="item.id"
76
-                    >{{ item.description }}</option>
72
+                    <option v-for="item in propertyTypes" :value="item.id" :key="item.id">{{
73
+                      item.description
74
+                    }}</option>
77
                   </select>
75
                   </select>
78
                 </div>
76
                 </div>
79
               </div>
77
               </div>
152
                     v-model="property.provinceId"
150
                     v-model="property.provinceId"
153
                   >
151
                   >
154
                     <option value="0">Please select province</option>
152
                     <option value="0">Please select province</option>
155
-                    <option
156
-                      v-for="province in provinces"
157
-                      :value="province.id"
158
-                      :key="province.id"
159
-                    >{{ province.description }}</option>
153
+                    <option v-for="province in provinces" :value="province.id" :key="province.id">{{
154
+                      province.description
155
+                    }}</option>
160
                   </select>
156
                   </select>
161
                 </div>
157
                 </div>
162
               </div>
158
               </div>
175
                     v-model="property.cityId"
171
                     v-model="property.cityId"
176
                   >
172
                   >
177
                     <option value="0">Please select city</option>
173
                     <option value="0">Please select city</option>
178
-                    <option
179
-                      v-for="city in cities"
180
-                      :value="city.id"
181
-                      :key="city.id"
182
-                    >{{ city.description }}</option>
174
+                    <option v-for="city in cities" :value="city.id" :key="city.id">{{
175
+                      city.description
176
+                    }}</option>
183
                   </select>
177
                   </select>
184
                 </div>
178
                 </div>
185
               </div>
179
               </div>
197
                     @change="getPostalCode"
191
                     @change="getPostalCode"
198
                   >
192
                   >
199
                     <option value="0">Please select suburb</option>
193
                     <option value="0">Please select suburb</option>
200
-                    <option
201
-                      v-for="suburb in suburbs"
202
-                      :value="suburb.id"
203
-                      :key="suburb.id"
204
-                    >{{ suburb.description }}</option>
194
+                    <option v-for="suburb in suburbs" :value="suburb.id" :key="suburb.id">{{
195
+                      suburb.description
196
+                    }}</option>
205
                   </select>
197
                   </select>
206
                 </div>
198
                 </div>
207
               </div>
199
               </div>
263
                 <label for="Property Description">Description</label>
255
                 <label for="Property Description">Description</label>
264
                 <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
256
                 <vue-editor v-model="property.description" :editor-toolbar="customToolbar" />
265
                 <br />
257
                 <br />
266
-                <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
258
+                <p>
259
+                  * A listing fee of R380 including VAT is payable to list your Property on the
260
+                  Uni-Vate website
261
+                </p>
267
               </div>
262
               </div>
268
             </div>
263
             </div>
269
             <div class="form-group row" />
264
             <div class="form-group row" />
270
             <UserField
265
             <UserField
271
-              v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
266
+              v-if="(propertyType === 'Residential') & (propertyOverviewFields.length > 0)"
272
               :fields="propertyOverviewFields[0].fields"
267
               :fields="propertyOverviewFields[0].fields"
273
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
268
               @UpdateUserDefinedFields="UpdateUserDefinedFields"
274
               :id="1"
269
               :id="1"
348
               @click="SubmitData()"
343
               @click="SubmitData()"
349
               class="btn btn-b-n"
344
               class="btn btn-b-n"
350
               style="width: 85px; height:40px;"
345
               style="width: 85px; height:40px;"
351
-            >Save</button>
346
+            >
347
+              Save
348
+            </button>
352
             <div v-if="wait" id="preloader"></div>
349
             <div v-if="wait" id="preloader"></div>
353
           </form>
350
           </form>
354
         </div>
351
         </div>
360
 <script>
357
 <script>
361
 import { mapState, mapActions } from 'vuex';
358
 import { mapState, mapActions } from 'vuex';
362
 import { VueEditor } from 'vue2-editor';
359
 import { VueEditor } from 'vue2-editor';
363
-import { setTimeout } from 'timers';
364
 import UserField from './propertyUserField.vue';
360
 import UserField from './propertyUserField.vue';
365
 import ImageLoad from './propertyImage.vue';
361
 import ImageLoad from './propertyImage.vue';
366
 
362
 
384
       customToolbar: [
380
       customToolbar: [
385
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
381
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
386
         ['bold', 'italic', 'underline', 'strike'],
382
         ['bold', 'italic', 'underline', 'strike'],
387
-        [
388
-          { align: '' },
389
-          { align: 'center' },
390
-          { align: 'right' },
391
-          { align: 'justify' },
392
-        ],
383
+        [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
393
         [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
384
         [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
394
         [{ script: 'sub' }, { script: 'super' }],
385
         [{ script: 'sub' }, { script: 'super' }],
395
         [{ indent: '-1' }, { indent: '+1' }],
386
         [{ indent: '-1' }, { indent: '+1' }],
396
       ],
387
       ],
388
+      error: '',
397
     };
389
     };
398
   },
390
   },
399
   methods: {
391
   methods: {
433
       }
425
       }
434
       this.property.propertyUserFields = this.propertyFieldValues;
426
       this.property.propertyUserFields = this.propertyFieldValues;
435
 
427
 
436
-      this.property.userId = this.user.id;
437
-      this.saveProperty(this.property);
438
-      setTimeout(
439
-        () => this.$router.push({
440
-            path: '/property/Search',
441
-            query: {
442
-              salesType: this.salesType,
443
-              propertyUsageType: this.propertyType,
444
-            },
445
-          }),
446
-        3000,
447
-      );
428
+      if (this.user) {
429
+        this.property.userId = this.user.id;
430
+      }
431
+
432
+      this.saveProperty(this.property)
433
+        .then((fulfilled) => {
434
+          this.$router.push(`/property/property/${fulfilled.data.id}`);
435
+        })
436
+        .catch((error) => {
437
+          console.log(error.message);
438
+        });
448
     },
439
     },
449
     Close() {
440
     Close() {
450
       this.$router.push('/property/admin/list/my');
441
       this.$router.push('/property/admin/list/my');
451
     },
442
     },
452
     ProvinceSelected(item) {
443
     ProvinceSelected(item) {
453
       if (item.target.options.selectedIndex > 0) {
444
       if (item.target.options.selectedIndex > 0) {
454
-        this.selectedProvince = this.provinces[
455
-          item.target.options.selectedIndex - 1
456
-        ].description;
445
+        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
457
         this.getCities(Object.assign({}, { province: this.selectedProvince }));
446
         this.getCities(Object.assign({}, { province: this.selectedProvince }));
458
       }
447
       }
459
     },
448
     },
460
     CitySelected(item) {
449
     CitySelected(item) {
461
       if (item.target.options.selectedIndex > 0) {
450
       if (item.target.options.selectedIndex > 0) {
462
-        this.selectedCity = this.cities[
463
-          item.target.options.selectedIndex - 1
464
-        ].description;
451
+        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
465
         this.getSuburbs(
452
         this.getSuburbs(
466
-          Object.assign(
467
-            {},
468
-            { province: this.selectedProvince, city: this.selectedCity },
469
-          ),
453
+          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity }),
470
         );
454
         );
471
       }
455
       }
472
     },
456
     },
473
     getPostalCode(item) {
457
     getPostalCode(item) {
474
-      this.property.addressLine3 = this.suburbs[
475
-        item.target.options.selectedIndex - 1
476
-      ].postalCode;
458
+      this.property.addressLine3 = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
477
     },
459
     },
478
     loadedImages(values) {
460
     loadedImages(values) {
479
       this.images = values;
461
       this.images = values;

+ 33
- 84
src/components/property/propertyList.vue Wyświetl plik

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 />
8
-        <br />
9
         <br />
6
         <br />
10
         <br />
7
         <br />
11
         <div class="row">
8
         <div class="row">
12
           <div class="col-md-12 col-lg-8">
9
           <div class="col-md-12 col-lg-8">
13
             <div class="title-box-d">
10
             <div class="title-box-d">
14
-              <h1
15
-                v-if="showAdmin"
16
-                class="title-d"
17
-                style="text-align:left; font-size: 250%"
18
-              >Admin Properties</h1>
19
-              <h1 v-else class="title-d" style="text-align:left; font-size: 250%">My Properties</h1>
11
+              <h1 class="title-d" style="text-align:left; font-size: 250%">Properties</h1>
20
             </div>
12
             </div>
21
           </div>
13
           </div>
22
         </div>
14
         </div>
23
       </div>
15
       </div>
24
-      <!-- </section> -->
25
     </div>
16
     </div>
26
     <div class="container">
17
     <div class="container">
27
-      <table class="table table-bordered">
28
-        <thead>
29
-          <tr>
30
-            <th>Name</th>
31
-            <th>Property ID</th>
32
-            <th>Size</th>
33
-            <th>Price</th>
34
-            <th>Usage Type</th>
35
-            <th>Type</th>
36
-            <th>Sale Type</th>
37
-            <th>Publish</th>
38
-            <th>Status</th>
39
-            <th></th>
40
-            <th></th>
41
-          </tr>
42
-        </thead>
43
-        <tbody>
44
-          <tr v-for="(item, i) in properties" :key="i">
45
-            <td>{{ item.name }}</td>
46
-            <td>{{ item.id }}</td>
47
-            <td v-html="item.size" />
48
-            <td>{{ item.price }}</td>
49
-            <td>{{ item.usageType }}</td>
50
-            <td>{{ item.type }}</td>
51
-            <td>{{ item.saleType }}</td>
52
-            <!-- <td>{{ item.publish }}</td> -->
53
-            <td></td>
54
-            <td>{{ item.status }}</td>
55
-            <td>
56
-              <button
57
-                type="button"
58
-                @click="Edit(item)"
59
-                class="btn"
60
-                style="margin:2px; color: #60CBEB"
61
-              >Edit</button>
62
-            </td>
63
-            <td>
64
-              <button
65
-                type="button"
66
-                @click="Delete(item)"
67
-                class="btn btn-b-n"
68
-                style="width: 85px; height:40px;"
69
-              >Delete</button>
70
-            </td>
71
-          </tr>
72
-        </tbody>
73
-      </table>
18
+      <listView
19
+        :items="properties"
20
+        :showNew="false"
21
+        :editable="true"
22
+        :deleteable="true"
23
+        @onEdit="Edit"
24
+        @onDelete="Delete"
25
+      />
74
     </div>
26
     </div>
75
     <br />
27
     <br />
76
   </div>
28
   </div>
78
 
30
 
79
 <script>
31
 <script>
80
 import { mapState, mapActions } from 'vuex';
32
 import { mapState, mapActions } from 'vuex';
33
+import listView from '../shared/listView.vue';
81
 
34
 
82
 export default {
35
 export default {
83
   name: 'PropertyList',
36
   name: 'PropertyList',
37
+  components: {
38
+    listView,
39
+  },
84
   data() {
40
   data() {
85
     return {
41
     return {
86
       propertyType: '',
42
       propertyType: '',
87
-      showAdmin: false,
43
+      role: 'MY',
88
     };
44
     };
89
   },
45
   },
90
   methods: {
46
   methods: {
101
     },
57
     },
102
   },
58
   },
103
   mounted() {
59
   mounted() {
104
-    if (this.$route.params.by === 'my') {
105
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
106
-      this.showAdmin = false;
107
-    } else {
108
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
109
-      this.showAdmin = true;
60
+    if (this.user.role === 'Super Admin') {
61
+      this.role = 'SUPERADMIN';
62
+    }
63
+    if (this.user.role === 'Agency') {
64
+      this.user.role = 'ADMIN';
110
     }
65
     }
111
-
112
-    // this.user = 28; // user id
113
 
66
 
114
     this.getProperties(
67
     this.getProperties(
115
-      Object.assign(
116
-        {},
117
-        {
118
-          propertyType: this.showAdmin ? 'Admin' : 'My',
119
-          user: this.user.id,
120
-        },
121
-      ),
68
+      Object.assign({
69
+        propertyType: this.role,
70
+        user: this.user.id,
71
+      }),
122
     );
72
     );
123
   },
73
   },
124
   computed: {
74
   computed: {
125
     ...mapState('propertyList', ['properties']),
75
     ...mapState('propertyList', ['properties']),
126
     ...mapState('authentication', ['user']),
76
     ...mapState('authentication', ['user']),
127
     UserChanged() {
77
     UserChanged() {
128
-      if (this.$route.params.by === 'my') {
78
+      if (this.user.role === 'Super Admin') {
129
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
79
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
130
-        this.showAdmin = false;
131
-      } else {
80
+        this.role = 'SUPERADMIN';
81
+      }
82
+      if (this.user.role === 'Agency') {
132
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
83
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
133
-        this.showAdmin = true;
84
+        this.user.role = 'ADMIN';
134
       }
85
       }
86
+
135
       this.getProperties(
87
       this.getProperties(
136
-        Object.assign(
137
-          {},
138
-          {
139
-            propertyType: this.showAdmin ? 'Admin' : 'My',
140
-            user: this.user,
141
-          },
142
-        ),
88
+        Object.assign({
89
+          propertyType: this.role,
90
+          user: this.user.id,
91
+        }),
143
       );
92
       );
144
       return this.user;
93
       return this.user;
145
     },
94
     },

+ 0
- 3
src/components/property/propertyPage.vue Wyświetl plik

2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
   <div v-if="property">
3
   <div v-if="property">
4
     <div class="container">
4
     <div class="container">
5
-      <br />
6
-      <br />
7
-      <br />
8
       <br />
5
       <br />
9
       <div class="row">
6
       <div class="row">
10
         <div class="col-md-12 col-lg-8">
7
         <div class="col-md-12 col-lg-8">

+ 9
- 24
src/components/property/propertySearchFields.vue Wyświetl plik

29
           </div>
29
           </div>
30
           <select class="form-control" v-model="resType" @change="PropertyTypeSelected">
30
           <select class="form-control" v-model="resType" @change="PropertyTypeSelected">
31
             <option>All</option>
31
             <option>All</option>
32
-            <option
33
-              v-for="(propertyType, i) in propertyTypesRes"
34
-              :key="i"
35
-            >{{ propertyType.description }}</option>
32
+            <option v-for="(propertyType, i) in propertyTypesRes" :key="i">{{
33
+              propertyType.description
34
+            }}</option>
36
           </select>
35
           </select>
37
           <div class="input-group-append" @click="clearResType">
36
           <div class="input-group-append" @click="clearResType">
38
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
37
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
51
           </div>
50
           </div>
52
           <select class="form-control" v-model="comType" @change="PropertyTypeSelected">
51
           <select class="form-control" v-model="comType" @change="PropertyTypeSelected">
53
             <option>All</option>
52
             <option>All</option>
54
-            <option
55
-              v-for="(propertyType, i) in propertyTypesCom"
56
-              :key="i"
57
-            >{{ propertyType.description }}</option>
53
+            <option v-for="(propertyType, i) in propertyTypesCom" :key="i">{{
54
+              propertyType.description
55
+            }}</option>
58
           </select>
56
           </select>
59
           <div class="input-group-append" @click="clearComType">
57
           <div class="input-group-append" @click="clearComType">
60
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
58
             <span class="input-group-text cursor-pointer" style="color: #60CBEB">
139
               <input
137
               <input
140
                 class="form-control"
138
                 class="form-control"
141
                 type="number"
139
                 type="number"
142
-                step="any"
143
-                name="minPrice"
140
+                setp="any"
144
                 v-model="propertySearch.minPrice"
141
                 v-model="propertySearch.minPrice"
145
               />
142
               />
146
               <div class="input-group-append" @click="clearFilter('minPrice')">
143
               <div class="input-group-append" @click="clearFilter('minPrice')">
161
               <input
158
               <input
162
                 class="form-control"
159
                 class="form-control"
163
                 type="number"
160
                 type="number"
164
-                step="any"
165
-                name="maxPrice"
161
+                setp="any"
166
                 v-model="propertySearch.maxPrice"
162
                 v-model="propertySearch.maxPrice"
167
               />
163
               />
168
               <div class="input-group-append" @click="clearFilter('maxPrice')">
164
               <div class="input-group-append" @click="clearFilter('maxPrice')">
216
       this.clearFilter('propertyType');
212
       this.clearFilter('propertyType');
217
       this.comType = 'All';
213
       this.comType = 'All';
218
     },
214
     },
219
-    salesTypeSelected() {
220
-      this.$emit('updateSearch', this.propertySearch);
221
-    },
222
     PropertyTypeSelected(item) {
215
     PropertyTypeSelected(item) {
223
       this.propertySearch.propertyType = item.target.value;
216
       this.propertySearch.propertyType = item.target.value;
224
-      this.$emit('updateSearch', this.propertySearch);
225
     },
217
     },
226
     ProvinceSelected(item) {
218
     ProvinceSelected(item) {
227
       if (item.target.value !== 'All') {
219
       if (item.target.value !== 'All') {
228
-        this.getCities(
229
-          Object.assign({}, { province: this.propertySearch.province }),
230
-        );
220
+        this.getCities(Object.assign({}, { province: this.propertySearch.province }));
231
       }
221
       }
232
-      this.$emit('updateSearch', this.propertySearch);
233
     },
222
     },
234
     CitySelected(item) {
223
     CitySelected(item) {
235
       if (item.target.value !== 'All') {
224
       if (item.target.value !== 'All') {
243
           ),
232
           ),
244
         );
233
         );
245
       }
234
       }
246
-      this.$emit('updateSearch', this.propertySearch);
247
-    },
248
-    SuburbSeleted() {
249
-      this.$emit('updateSearch', this.propertySearch);
250
     },
235
     },
251
   },
236
   },
252
 };
237
 };

+ 13
- 45
src/components/property/propertySearchResults.vue Wyświetl plik

65
   computed: {
65
   computed: {
66
     ...mapState('propertySearch', ['properties', 'propertySearch']),
66
     ...mapState('propertySearch', ['properties', 'propertySearch']),
67
     ...mapState('authentication', ['username']),
67
     ...mapState('authentication', ['username']),
68
-    // ParamsChanged() {
69
-    //   if (Object.keys(this.$route.query).length === 0) {
70
-    //     if (this.propertySearch.propertyUsageType === 'All') {
71
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
72
-    //       this.propertySearch.propertyUsageType = 'Residential';
73
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
74
-    //       this.propertySearch.keyword = 'All';
75
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
76
-    //       this.propertySearch.salesType = 'All';
77
-    //     }
78
-    //   }
79
-    //   if (Object.keys(this.$route.query).length > 0) {
80
-    //     if (Object.keys(this.$route.query).length > 2) {
81
-    //       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
82
-    //       this.propertySearch = this.$route.query;
83
-    //     } else {
84
-    //       if (this.$route.query.salesType) {
85
-    //         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
86
-    //         this.propertySearch.salesType = this.$route.query.salesType;
87
-    //       }
88
-    //       if (this.$route.query.propertyUsageType) {
89
-    //         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
90
-    //         this.propertySearch.propertyUsageType = this.$route.query.propertyUsageType;
91
-    //       }
92
-    //     }
93
-    //   }
94
-    //   if (this.propertySearch.keyword === '') {
95
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
96
-    //     this.propertySearch.keyword = 'All';
97
-    //   }
98
-    //   if (this.username) {
99
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
100
-    //     this.propertySearch.userName = this.username;
101
-    //   } else {
102
-    //     // eslint-disable-next-line vue/no-side-effects-in-computed-properties
103
-    //     this.propertySearch.userName = 'Unknown';
104
-    //   }
105
-    //   this.searchProperties(this.propertySearch);
106
-    //   return null;
107
-    // },
68
+    ParamsChanged() {
69
+      if (typeof this.propertySearch.propertyUsageType === 'undefined') {
70
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
71
+        this.propertySearch.propertyUsageType = 'Residential';
72
+      }
73
+      this.searchProperties(this.propertySearch);
74
+      return null;
75
+    },
76
+  },
77
+  watch: {
78
+    ParamsChanged() {
79
+      return null;
80
+    },
108
   },
81
   },
109
-  //   watch: {
110
-  //     ParamsChanged() {
111
-  //       return null;
112
-  //     },
113
-  //   },
114
 };
82
 };
115
 </script>
83
 </script>

+ 3
- 11
src/components/property/propertyeditPage.vue Wyświetl plik

535
       this.updateProperty({
535
       this.updateProperty({
536
         property: this.property,
536
         property: this.property,
537
         images: this.newPropertyImages,
537
         images: this.newPropertyImages,
538
+      }).then(() => {
539
+        this.$router.push('/properties');
538
       });
540
       });
539
-
540
-      // console.log(JSON.stringify(this.newPropertyImages));
541
-
542
-      // Need to change to promis.
543
-      setTimeout(
544
-        () => this.$router.push({
545
-            path: '/property/admin/list/my',
546
-          }),
547
-        5000,
548
-      );
549
     },
541
     },
550
     Close() {
542
     Close() {
551
-      this.$router.push('/property/admin/list/my');
543
+      this.$router.push('/properties');
552
     },
544
     },
553
     loadedImages(values) {
545
     loadedImages(values) {
554
       this.images = values;
546
       this.images = values;

+ 2
- 2
src/components/shared/navBar.vue Wyświetl plik

91
                   class="dropdown-item cursor-pointer"
91
                   class="dropdown-item cursor-pointer"
92
                   @click="routerGoTo('/property/new/Rental')"
92
                   @click="routerGoTo('/property/new/Rental')"
93
                 >To Rent</a>
93
                 >To Rent</a>
94
-                <hr />
94
+                <hr v-if="isLoggedIn" />
95
                 <a
95
                 <a
96
                   v-if="isLoggedIn"
96
                   v-if="isLoggedIn"
97
                   class="dropdown-item cursor-pointer"
97
                   class="dropdown-item cursor-pointer"
98
-                  @click="routerGoTo('/property/admin/list/my')"
98
+                  @click="routerGoTo('/properties')"
99
                 >My Properties</a>
99
                 >My Properties</a>
100
               </div>
100
               </div>
101
             </li>
101
             </li>

+ 9
- 14
src/components/shared/searchTab.vue Wyświetl plik

38
                   aria-controls="pills-video"
38
                   aria-controls="pills-video"
39
                   aria-selected="true"
39
                   aria-selected="true"
40
                   v-on:click="updateType('Timeshare')"
40
                   v-on:click="updateType('Timeshare')"
41
-                >Timeshare</a>
41
+                  >Timeshare</a
42
+                >
42
               </li>
43
               </li>
43
               <li class="nav-item">
44
               <li class="nav-item">
44
                 <a
45
                 <a
50
                   aria-controls="pills-plans"
51
                   aria-controls="pills-plans"
51
                   aria-selected="false"
52
                   aria-selected="false"
52
                   v-on:click="updateType('Residential')"
53
                   v-on:click="updateType('Residential')"
53
-                >Residential</a>
54
+                  >Residential</a
55
+                >
54
               </li>
56
               </li>
55
               <li class="nav-item">
57
               <li class="nav-item">
56
                 <a
58
                 <a
62
                   aria-controls="pills-map"
64
                   aria-controls="pills-map"
63
                   aria-selected="false"
65
                   aria-selected="false"
64
                   v-on:click="updateType('Commercial')"
66
                   v-on:click="updateType('Commercial')"
65
-                >Commercial</a>
67
+                  >Commercial</a
68
+                >
66
               </li>
69
               </li>
67
             </ul>
70
             </ul>
68
             <div class="tab-content" id="pills-tabContent">
71
             <div class="tab-content" id="pills-tabContent">
80
                 role="tabpanel"
83
                 role="tabpanel"
81
                 aria-labelledby="pills-plans-tab"
84
                 aria-labelledby="pills-plans-tab"
82
               >
85
               >
83
-                <propertySearch propertyType="Residential" @updateSearch="updateSearch" />
86
+                <propertySearch propertyType="Residential" />
84
               </div>
87
               </div>
85
               <div
88
               <div
86
                 class="tab-pane fade"
89
                 class="tab-pane fade"
88
                 role="tabpanel"
91
                 role="tabpanel"
89
                 aria-labelledby="pills-map-tab"
92
                 aria-labelledby="pills-map-tab"
90
               >
93
               >
91
-                <propertySearch propertyType="Commercial" @updateSearch="updateSearch" />
94
+                <propertySearch propertyType="Commercial" />
92
               </div>
95
               </div>
93
             </div>
96
             </div>
94
           </div>
97
           </div>
125
     updateType(item) {
128
     updateType(item) {
126
       this.selectedPropertyType = item;
129
       this.selectedPropertyType = item;
127
     },
130
     },
128
-    updateSearch(item) {
129
-      this.propertySearch = item;
130
-      this.propertySearch.propertyUsageType = this.selectedPropertyType;
131
-      this.propertySearch.keyword = this.filter.keyword;
132
-    },
133
     Search() {
131
     Search() {
134
       if (this.selectedPropertyType === 'timeshare') {
132
       if (this.selectedPropertyType === 'timeshare') {
135
         this.$router.push('/timesharesearch');
133
         this.$router.push('/timesharesearch');
136
       } else {
134
       } else {
135
+        this.propertySearch.propertyUsageType = this.selectedPropertyType;
137
         this.$router.push('/property/propertySearch/results');
136
         this.$router.push('/property/propertySearch/results');
138
-        // this.$router.push({
139
-        //   path: '/property/search',
140
-        //   query: this.propertySearch,
141
-        // });
142
       }
137
       }
143
     },
138
     },
144
   },
139
   },

+ 1
- 1
src/router/index.js Wyświetl plik

154
       component: PropertyEdit,
154
       component: PropertyEdit,
155
     },
155
     },
156
     {
156
     {
157
-      path: '/property/admin/list/:by',
157
+      path: '/properties',
158
       name: 'PropertyListAdmin',
158
       name: 'PropertyListAdmin',
159
       component: PropertyList,
159
       component: PropertyList,
160
     },
160
     },

+ 11
- 4
src/store/modules/property/property.js Wyświetl plik

148
         .catch(console.error);
148
         .catch(console.error);
149
     },
149
     },
150
     saveProperty({ commit }, item) {
150
     saveProperty({ commit }, item) {
151
-      axios
152
-        .post('/api/Property', item)
153
-        .then(result => commit('updateCurrentProperty', result.data))
154
-        .catch(console.error);
151
+      return new Promise((resolve, reject) => {
152
+        axios
153
+          .post('/api/Property', item)
154
+          .then((resp) => {
155
+            commit('updateCurrentProperty', resp);
156
+            resolve(resp);
157
+          })
158
+          .catch(() => {
159
+            reject(console.error);
160
+          });
161
+      });
155
     },
162
     },
156
     clearProperty({ commit }) {
163
     clearProperty({ commit }) {
157
       commit('clearProperty');
164
       commit('clearProperty');

+ 11
- 8
src/store/modules/property/propertyEdit.js Wyświetl plik

123
         .catch(console.error);
123
         .catch(console.error);
124
     },
124
     },
125
     updateProperty({ commit }, item) {
125
     updateProperty({ commit }, item) {
126
-      axios
127
-        .post('/api/PropertyImage', item.images)
128
-        .then(commit('ClearNewImages'))
129
-        .catch(console.error);
126
+      return new Promise((resolve) => {
127
+        axios
128
+          .post('/api/PropertyImage', item.images)
129
+          .then(commit('ClearNewImages'))
130
+          .catch(console.error);
130
 
131
 
131
-      axios
132
-        .put('/api/Property', item.property)
133
-        .then(commit('setProperty', item.property))
134
-        .catch(console.error);
132
+        axios
133
+          .put('/api/Property', item.property)
134
+          .then(commit('setProperty', item.property))
135
+          .catch(console.error);
136
+        resolve(true);
137
+      });
135
     },
138
     },
136
     mayEditProperty({ commit }, id) {
139
     mayEditProperty({ commit }, id) {
137
       axios
140
       axios

Ładowanie…
Anuluj
Zapisz