30117125 hace 4 años
padre
commit
4295ff3762

+ 0
- 3
src/App.vue Ver fichero

@@ -4,7 +4,6 @@
4 4
       <i class="fa fa-chevron-up"></i>
5 5
     </a>
6 6
     <div v-if="!isLandingPage" class="click-closed"></div>
7
-    <SearchTab v-if="!isLandingPage" />
8 7
     <NavBar v-if="!isLandingPage" @routerGoTo="routerGoTo" />
9 8
     <div v-if="!isLandingPage"></div>
10 9
     <router-view @setLandingPage="setLandingPage" style="margin-top:140px" />
@@ -14,7 +13,6 @@
14 13
 
15 14
 <script>
16 15
 /* eslint-disable */
17
-import SearchTab from "./components/shared/searchTab.vue";
18 16
 import NavBar from "./components/shared/navBar.vue";
19 17
 import FooterSection from "./components/shared/footerSection.vue";
20 18
 
@@ -26,7 +24,6 @@ export default {
26 24
     };
27 25
   },
28 26
   components: {
29
-    SearchTab,
30 27
     NavBar,
31 28
     FooterSection
32 29
   },

+ 57
- 101
src/components/home/carouselSection.vue Ver fichero

@@ -15,8 +15,7 @@
15 15
                   role="tab"
16 16
                   aria-controls="timeshare"
17 17
                   aria-selected="true"
18
-                  >Timeshare</a
19
-                >
18
+                >Timeshare</a>
20 19
               </li>
21 20
               <li class="nav-item">
22 21
                 <a
@@ -27,8 +26,7 @@
27 26
                   role="tab"
28 27
                   aria-controls="commercial"
29 28
                   aria-selected="false"
30
-                  >Commercial</a
31
-                >
29
+                >Commercial</a>
32 30
               </li>
33 31
               <li class="nav-item">
34 32
                 <a
@@ -39,8 +37,7 @@
39 37
                   role="tab"
40 38
                   aria-controls="residential"
41 39
                   aria-selected="false"
42
-                  >Residential</a
43
-                >
40
+                >Residential</a>
44 41
               </li>
45 42
             </ul>
46 43
             <!--========    header tabs      ==========-->
@@ -61,36 +58,14 @@
61 58
                 aria-labelledby="timeshare-tab"
62 59
               >
63 60
                 <H4>TIMESHARE SALES</H4>
64
-                <p>
65
-                  Start exploring your posibilities
66
-                </p>
61
+                <p>Start exploring your posibilities</p>
67 62
                 <div id="row">
68
-                  <!-- <div class="form-group">
69
-                    <input
70
-                      data-toggle="dropdown"
71
-                      name="region"
72
-                      class="form-control my-2"
73
-                      id="name"
74
-                      placeholder="Region"
75
-                      aria-haspopup="true"
76
-                      aria-expanded="false"
77
-                    />
78
-                    <input
79
-                      data-toggle="dropdown"
80
-                      name="resort"
81
-                      class="form-control my-2"
82
-                      id="name"
83
-                      placeholder="Resort"
84
-                      aria-haspopup="true"
85
-                      aria-expanded="false"
86
-                    />
87
-                  </div> -->
88
-                  <router-link to="/timeshare/buy" class="btn-solid-blue"
89
-                    ><i class="fa fa-search"></i> BUY</router-link
90
-                  >
91
-                  <router-link to="/timeshare/sell" class="btn-solid-blue"
92
-                    ><i class="fa chevron-circle-right"></i> SELL</router-link
93
-                  >
63
+                  <router-link to="/timeshare/buy" class="btn-solid-blue">
64
+                    <i class="fa fa-search"></i> BUY
65
+                  </router-link>
66
+                  <router-link to="/timeshare/sell" class="btn-solid-blue">
67
+                    <i class="fa chevron-circle-right"></i> SELL
68
+                  </router-link>
94 69
                 </div>
95 70
               </div>
96 71
 
@@ -104,20 +79,14 @@
104 79
                 <p>Select the region you are looking for to start your search</p>
105 80
                 <div id="row">
106 81
                   <div class="form-group">
107
-                    <autoComplete
108
-                      align="left"
109
-                      class="col-md-11 offset-1"
110
-                      :items="suburbList"
111
-                      @selection="SelectedFilter"
112
-                      style="width:100%; margin-left:-15px"
113
-                    />
82
+                    <autoComplete @GoogleAddress="UpdateAddress" />
114 83
                   </div>
115
-                  <a v-on:click="SearchClickRentComm()" class="btn-solid-blue scrollto"
116
-                    ><i class="fa fa-search"></i> RENT</a
117
-                  >
118
-                  <a v-on:click="SearchClickBuyComm()" class="btn-solid-blue scrollto"
119
-                    ><i class="fa fa-search"></i> BUY</a
120
-                  >
84
+                  <a v-on:click="SearchClickRentComm()" class="btn-solid-blue scrollto">
85
+                    <i class="fa fa-search"></i> RENT
86
+                  </a>
87
+                  <a v-on:click="SearchClickBuyComm()" class="btn-solid-blue scrollto">
88
+                    <i class="fa fa-search"></i> BUY
89
+                  </a>
121 90
                 </div>
122 91
               </div>
123 92
 
@@ -131,29 +100,14 @@
131 100
                 <p>Select the region you are looking for to start your search</p>
132 101
                 <div id="row">
133 102
                   <div class="form-group">
134
-                    <autoComplete
135
-                      align="left"
136
-                      class="col-md-11 offset-1"
137
-                      :items="suburbList"
138
-                      @selection="SelectedFilter"
139
-                      style="width:100%; margin-left:-15px"
140
-                    />
141
-                    <!-- <input
142
-                      data-toggle="dropdown"
143
-                      name="type"
144
-                      class="form-control my-2"
145
-                      id="type"
146
-                      placeholder="Type"
147
-                      aria-haspopup="true"
148
-                      aria-expanded="false"
149
-                    /> -->
103
+                    <autoComplete @GoogleAddress="UpdateAddress" />
150 104
                   </div>
151
-                  <a v-on:click="SearchClickRentRes()" class="btn-solid-blue scrollto"
152
-                    ><i class="fa fa-search"></i> RENT</a
153
-                  >
154
-                  <a v-on:click="SearchClickBuyRes()" class="btn-solid-blue scrollto"
155
-                    ><i class="fa fa-search"></i> BUY</a
156
-                  >
105
+                  <a v-on:click="SearchClickRentRes()" class="btn-solid-blue scrollto">
106
+                    <i class="fa fa-search"></i> RENT
107
+                  </a>
108
+                  <a v-on:click="SearchClickBuyRes()" class="btn-solid-blue scrollto">
109
+                    <i class="fa fa-search"></i> BUY
110
+                  </a>
157 111
                 </div>
158 112
               </div>
159 113
             </div>
@@ -174,12 +128,12 @@
174 128
       style="margin-top:-50px"
175 129
       :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
176 130
     >
177
-      <img class="item" src="/img/intro-carousel/home-1.jpg" style="object-fit: cover" alt="" />
178
-      <img class="item" src="/img/intro-carousel/home-2.jpg" style="object-fit: cover" alt="" />
179
-      <img class="item" src="/img/intro-carousel/home-3.jpg" style="object-fit: cover" alt="" />
180
-      <img class="item" src="/img/intro-carousel/home-4.jpg" style="object-fit: cover" alt="" />
181
-      <img class="item" src="/img/intro-carousel/home-5.jpg" style="object-fit: cover" alt="" />
182
-      <img class="item" src="/img/intro-carousel/home-6.jpg" style="object-fit: cover" alt="" />
131
+      <img class="item" src="/img/intro-carousel/home-1.jpg" style="object-fit: cover" alt />
132
+      <img class="item" src="/img/intro-carousel/home-2.jpg" style="object-fit: cover" alt />
133
+      <img class="item" src="/img/intro-carousel/home-3.jpg" style="object-fit: cover" alt />
134
+      <img class="item" src="/img/intro-carousel/home-4.jpg" style="object-fit: cover" alt />
135
+      <img class="item" src="/img/intro-carousel/home-5.jpg" style="object-fit: cover" alt />
136
+      <img class="item" src="/img/intro-carousel/home-6.jpg" style="object-fit: cover" alt />
183 137
     </carousel>
184 138
 
185 139
     <div id="intro-carousel" class="owl-carousel"></div>
@@ -191,63 +145,63 @@
191 145
 /* eslint-disable */
192 146
 import { mapState, mapActions } from "vuex";
193 147
 import carousel from "vue-owl-carousel";
194
-import autoComplete from "../shared/autoComplete";
148
+import autoComplete from "../shared/addressAutoComplete";
195 149
 export default {
196 150
   components: {
197 151
     carousel,
198
-    autoComplete
152
+    autoComplete,
199 153
   },
200 154
   computed: {
201
-    ...mapState("propertySearch", ["suburbs", "suburbList", "propertySearch"])
155
+    ...mapState("propertySearch", ["suburbs", "suburbList", "propertySearch"]),
202 156
   },
203 157
   data() {
204 158
     return {
205 159
       propertyUsageType: "Commercial",
206 160
       salesType: "Sale",
207 161
       searchText: "",
208
-      clicked: false
162
+      clicked: false,
209 163
     };
210 164
   },
211 165
   methods: {
212
-    ...mapActions("propertySearch", ["getSuburbs", "applyFilter"]),
166
+    ...mapActions("propertySearch", ["applyFilter"]),
213 167
     SetSalesType(value) {
214 168
       this.salesType = value;
215 169
     },
216 170
     SearchClickBuyRes() {
217
-      const item = this.suburbs.find(s => s.display === this.searchText);
218
-      this.propertySearch.province = item.province;
219
-      this.propertySearch.city = item.city;
220
-      this.propertySearch.suburb = item.suburb;
171
+      // const item = this.suburbs.find((s) => s.display === this.searchText);
172
+      // this.propertySearch.province = item.province;
173
+      // this.propertySearch.city = item.city;
174
+      // this.propertySearch.suburb = item.suburb;
221 175
       this.propertySearch.propertyUsageType = "Residential";
222 176
       this.propertySearch.salesType = "Sale";
223 177
 
224 178
       this.$router.push("/property/residential/searchResult");
225 179
     },
226 180
     SearchClickRentRes() {
227
-      const item = this.suburbs.find(s => s.display === this.searchText);
228
-      this.propertySearch.province = item.province;
229
-      this.propertySearch.city = item.city;
230
-      this.propertySearch.suburb = item.suburb;
181
+      // const item = this.suburbs.find((s) => s.display === this.searchText);
182
+      // this.propertySearch.province = item.province;
183
+      // this.propertySearch.city = item.city;
184
+      // this.propertySearch.suburb = item.suburb;
231 185
       this.propertySearch.propertyUsageType = "Residential";
232 186
       this.propertySearch.salesType = "Rent";
233 187
 
234 188
       this.$router.push("/property/residential/searchResult");
235 189
     },
236 190
     SearchClickBuyComm() {
237
-      const item = this.suburbs.find(s => s.display === this.searchText);
238
-      this.propertySearch.province = item.province;
239
-      this.propertySearch.city = item.city;
240
-      this.propertySearch.suburb = item.suburb;
191
+      // const item = this.suburbs.find((s) => s.display === this.searchText);
192
+      // this.propertySearch.province = item.province;
193
+      // this.propertySearch.city = item.city;
194
+      // this.propertySearch.suburb = item.suburb;
241 195
       this.propertySearch.propertyUsageType = "Commercial";
242 196
       this.propertySearch.salesType = "Sale";
243 197
 
244 198
       this.$router.push("/property/commercial/searchResult");
245 199
     },
246 200
     SearchClickRentComm() {
247
-      const item = this.suburbs.find(s => s.display === this.searchText);
248
-      this.propertySearch.province = item.province;
249
-      this.propertySearch.city = item.city;
250
-      this.propertySearch.suburb = item.suburb;
201
+      // const item = this.suburbs.find((s) => s.display === this.searchText);
202
+      // this.propertySearch.province = item.province;
203
+      // this.propertySearch.city = item.city;
204
+      // this.propertySearch.suburb = item.suburb;
251 205
       this.propertySearch.propertyUsageType = "Commercial";
252 206
       this.propertySearch.salesType = "Rent";
253 207
 
@@ -255,11 +209,13 @@ export default {
255 209
     },
256 210
     SelectedFilter(item) {
257 211
       this.searchText = item;
258
-    }
212
+    },
213
+    UpdateAddress(place) {
214
+      this.propertySearch.province = place.province;
215
+      this.propertySearch.city = place.city;
216
+      this.propertySearch.suburb = place.suburb;
217
+    },
259 218
   },
260
-  mounted() {
261
-    this.getSuburbs();
262
-  }
263 219
 };
264 220
 </script>
265 221
 

+ 21
- 91
src/components/misc/address.vue Ver fichero

@@ -4,6 +4,9 @@
4 4
     <div id="errormessage"></div>
5 5
     <form method="post" role="form" class="contactForm">
6 6
       <div class="form-row">
7
+        <div class="form-group col-md-12">
8
+          <AutoComplete @GoogleAddress="UpdateAddress" />
9
+        </div>
7 10
         <div class="form-group col-md-6">
8 11
           <input
9 12
             type="text"
@@ -14,6 +17,7 @@
14 17
             data-rule="minlen:4"
15 18
             data-msg="Please enter your street number"
16 19
             v-model="address.streetNumber"
20
+            disabled
17 21
           />
18 22
           <div class="validation"></div>
19 23
         </div>
@@ -26,6 +30,7 @@
26 30
             placeholder="Street Name"
27 31
             data-msg="Please enter your street name"
28 32
             v-model="address.street"
33
+            disabled
29 34
           />
30 35
           <div class="validation"></div>
31 36
         </div>
@@ -39,6 +44,7 @@
39 44
             data-rule="minlen:4"
40 45
             data-msg="Please enter your province"
41 46
             v-model="address.province"
47
+            disabled
42 48
           />
43 49
           <div class="validation"></div>
44 50
         </div>
@@ -52,6 +58,7 @@
52 58
             data-rule="minlen:4"
53 59
             data-msg="Please enter your city"
54 60
             v-model="address.city"
61
+            disabled
55 62
           />
56 63
           <div class="validation"></div>
57 64
         </div>
@@ -65,6 +72,7 @@
65 72
             data-rule="minlen:4"
66 73
             data-msg="Please enter your suburb"
67 74
             v-model="address.suburb"
75
+            disabled
68 76
           />
69 77
           <div class="validation"></div>
70 78
         </div>
@@ -77,6 +85,7 @@
77 85
             placeholder="Postal Code"
78 86
             data-msg="Please enter your postal code"
79 87
             v-model="address.postalCode"
88
+            disabled
80 89
           />
81 90
           <div class="validation"></div>
82 91
         </div>
@@ -87,111 +96,32 @@
87 96
 
88 97
 <script>
89 98
 /* eslint-disable */
90
-import { mapState, mapActions } from "vuex";
91 99
 import propField from "../property/propertyFieldEditor.vue";
100
+import AutoComplete from "../shared/addressAutoComplete.vue";
92 101
 
93 102
 export default {
94 103
   components: {
95
-    propField
104
+    propField,
105
+    AutoComplete,
96 106
   },
97 107
   data() {
98 108
     return {
99
-      propertyType: "Residential"
109
+      propertyType: "Residential",
100 110
     };
101 111
   },
102 112
   props: {
103
-    address: {}
104
-  },
105
-  computed: {
106
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"])
113
+    address: {},
107 114
   },
108 115
   methods: {
109
-    ...mapActions("searchTab", ["getProvince", "getCities", "getSuburbs"]),
110
-    ProvinceSelected(item) {
111
-      if (item.target.options.selectedIndex > 0) {
112
-        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
113
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
114
-      }
115
-    },
116
-    CitySelected(item) {
117
-      if (item.target.options.selectedIndex > 0) {
118
-        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
119
-        this.getSuburbs(
120
-          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity })
121
-        );
122
-      }
123
-    },
124
-    getPostalCode(item) {
125
-      this.address.postalCode = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
116
+    UpdateAddress(place) {
117
+      this.address.streetNumber = place.streetNumber;
118
+      this.address.street = place.streeName;
119
+      this.address.province = place.province;
120
+      this.address.city = place.city;
121
+      this.address.suburb = place.suburb;
122
+      this.address.postalCode = place.postalCode;
126 123
     },
127
-    UpdateValue(item) {
128
-      if (item.fieldName) {
129
-        if (item.fieldName === "streetNumber") {
130
-          this.address.streetNumber = item.value;
131
-        }
132
-        if (item.fieldName === "street") {
133
-          this.address.street = item.value;
134
-        }
135
-        if (item.fieldName === "province") {
136
-          if (item.value !== "") {
137
-            this.address.province = item.value;
138
-            this.getCities(Object.assign({}, { province: item.value }));
139
-            this.address.city = null;
140
-            this.address.suburb = null;
141
-            this.address.postalCode = "";
142
-          } else {
143
-            this.address.province = null;
144
-            this.address.city = null;
145
-            this.address.suburb = null;
146
-            this.address.postalCode = "";
147
-            this.cities = [];
148
-            this.suburbs = [];
149
-          }
150
-        }
151
-        if (item.fieldName === "city") {
152
-          if (item.value !== "") {
153
-            this.address.city = item.value;
154
-            // this.address.city = newCity;
155
-            // this.address.cityId = newCity.id;
156
-            this.getSuburbs(
157
-              Object.assign(
158
-                {},
159
-                {
160
-                  province: item.value,
161
-                  city: item.value
162
-                }
163
-              )
164
-            );
165
-            this.address.suburb = null;
166
-            this.address.postalCode = "";
167
-          } else {
168
-            this.address.city = null;
169
-            this.address.suburb = null;
170
-            this.address.postalCode = "";
171
-            this.suburbs = [];
172
-          }
173
-        }
174
-        if (item.fieldName === "suburb") {
175
-          if (item.value !== "") {
176
-            // const newSuburb = this.suburbs.find(
177
-            //   p => p.description === item.value,
178
-            // );
179
-            // this.address.suburb = newSuburb;
180
-            // this.address.suburbId = newSuburb.id;
181
-            console.log(item.value);
182
-            this.address.suburb = item.value;
183
-            this.address.postalCode = this.address.suburb.postalCode;
184
-          } else {
185
-            this.address.suburb = null;
186
-            this.address.postalCode = "";
187
-          }
188
-        }
189
-      }
190
-    }
191 124
   },
192
-  mounted() {
193
-    this.getProvince();
194
-  }
195 125
 };
196 126
 </script>
197 127
 

+ 26
- 45
src/components/property/commercial/commercialCarouselSection.vue Ver fichero

@@ -17,8 +17,7 @@
17 17
                   aria-controls="buy"
18 18
                   aria-selected="true"
19 19
                   @click="SetSalesType('Sale')"
20
-                  >Buy office space</a
21
-                >
20
+                >Buy office space</a>
22 21
               </li>
23 22
               <li class="nav-item">
24 23
                 <a
@@ -30,8 +29,7 @@
30 29
                   aria-controls="rent"
31 30
                   aria-selected="false"
32 31
                   @click="SetSalesType('Rent')"
33
-                  >Rent an office</a
34
-                >
32
+                >Rent an office</a>
35 33
               </li>
36 34
             </ul>
37 35
             <div class="tab-content" id="pills-tabContent">
@@ -48,36 +46,24 @@
48 46
                 <h4>PROPERTIES FOR SALE</h4>
49 47
                 <div class="row">
50 48
                   <div class="form-group col-md-12">
51
-                    <autoComplete
52
-                      align="left"
53
-                      class="col-md-11 offset-1"
54
-                      :items="suburbList"
55
-                      @selection="SelectedFilter"
56
-                      style="width:100%; margin-left:-15px"
57
-                    />
49
+                    <autoComplete @GoogleAddress="SetAddress" />
58 50
                   </div>
59 51
                 </div>
60
-                <a v-on:click="SearchClick" class="btn-solid-blue"
61
-                  ><i class="fa fa-search"></i> SEARCH</a
62
-                >
52
+                <a v-on:click="SearchClick" class="btn-solid-blue">
53
+                  <i class="fa fa-search"></i> SEARCH
54
+                </a>
63 55
               </div>
64 56
 
65 57
               <div class="tab-pane fade" id="rent" role="tabpanel" aria-labelledby="rent-tab">
66 58
                 <h4>RENTAL PROPERTIES</h4>
67 59
                 <div class="row">
68 60
                   <div class="form-group col-md-12">
69
-                    <autoComplete
70
-                      align="left"
71
-                      class="col-md-11 offset-1"
72
-                      :items="suburbList"
73
-                      @selection="SelectedFilter"
74
-                      style="width:100%; margin-left:-15px"
75
-                    />
61
+                    <autoComplete @GoogleAddress="SetAddress" />
76 62
                   </div>
77 63
                 </div>
78
-                <a v-on:click="SearchClick" class="btn-solid-blue"
79
-                  ><i class="fa fa-search"></i> FIND</a
80
-                >
64
+                <a v-on:click="SearchClick" class="btn-solid-blue">
65
+                  <i class="fa fa-search"></i> FIND
66
+                </a>
81 67
               </div>
82 68
             </div>
83 69
           </div>
@@ -95,12 +81,12 @@
95 81
       style="margin-top:-50px"
96 82
       :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
97 83
     >
98
-      <img class="item" src="img/intro-carousel/comm-1.jpg" alt="" />
99
-      <img class="item" src="img/intro-carousel/comm-2.jpg" alt="" />
100
-      <img class="item" src="img/intro-carousel/comm-3.jpg" alt="" />
101
-      <img class="item" src="img/intro-carousel/comm-4.jpg" alt="" />
102
-      <img class="item" src="img/intro-carousel/comm-5.jpg" alt="" />
103
-      <img class="item" src="img/intro-carousel/comm-6.jpg" alt="" />
84
+      <img class="item" src="img/intro-carousel/comm-1.jpg" alt />
85
+      <img class="item" src="img/intro-carousel/comm-2.jpg" alt />
86
+      <img class="item" src="img/intro-carousel/comm-3.jpg" alt />
87
+      <img class="item" src="img/intro-carousel/comm-4.jpg" alt />
88
+      <img class="item" src="img/intro-carousel/comm-5.jpg" alt />
89
+      <img class="item" src="img/intro-carousel/comm-6.jpg" alt />
104 90
     </carousel>
105 91
 
106 92
     <div id="intro-carousel" class="owl-carousel"></div>
@@ -110,48 +96,43 @@
110 96
 <script>
111 97
 /* eslint-disable */
112 98
 import { mapState, mapActions } from "vuex";
113
-import autoComplete from "../../shared/autoComplete";
99
+import autoComplete from "../../shared/addressAutoComplete";
114 100
 import carousel from "vue-owl-carousel";
115 101
 import searchResult from "./commercialSearchResults";
116 102
 export default {
117 103
   components: {
118 104
     carousel,
119 105
     autoComplete,
120
-    searchResult
106
+    searchResult,
121 107
   },
122 108
   data() {
123 109
     return {
124 110
       propertyUsageType: "Commercial",
125 111
       salesType: "Sale",
126 112
       searchText: "",
127
-      clicked: false
113
+      clicked: false,
128 114
     };
129 115
   },
130 116
   computed: {
131
-    ...mapState("propertySearch", ["suburbs", "suburbList", "propertySearch"])
117
+    ...mapState("propertySearch", ["propertySearch"]),
132 118
   },
133 119
   methods: {
134
-    ...mapActions("propertySearch", ["getSuburbs", "applyFilter"]),
120
+    ...mapActions("propertySearch", ["applyFilter"]),
135 121
     SetSalesType(value) {
136 122
       this.salesType = value;
137 123
     },
138 124
     SearchClick() {
139
-      const item = this.suburbs.find(s => s.display === this.searchText);
140
-      this.propertySearch.province = item.province;
141
-      this.propertySearch.city = item.city;
142
-      this.propertySearch.suburb = item.suburb;
143 125
       this.propertySearch.propertyUsageType = this.propertyUsageType;
144 126
       this.propertySearch.salesType = this.salesType;
145 127
 
146 128
       this.$router.push("/property/commercial/searchResult");
147 129
     },
148
-    SelectedFilter(item) {
149
-      this.searchText = item;
150
-    }
130
+    SetAddress(place) {
131
+      this.propertySearch.province = place.province;
132
+      this.propertySearch.city = place.city;
133
+      this.propertySearch.suburb = place.suburb;
134
+    },
151 135
   },
152
-  mounted() {
153
-    this.getSuburbs();
154
-  }
155 136
 };
156 137
 </script>
157 138
 

+ 26
- 18
src/components/property/commercial/commercialSearchResults.vue Ver fichero

@@ -2,7 +2,7 @@
2 2
   <main id="main" style="margin-top:-20px; padding-bottom:50px">
3 3
     <section>
4 4
       <div class="container">
5
-        <div class="row pt-5  justify-content-md-center">
5
+        <div class="row pt-5 justify-content-md-center">
6 6
           <h3 v-if="propertySearch.salesType === 'Sale'">COMMERCIAL PROPERTIES FOR SALE</h3>
7 7
           <h3 v-else-if="propertySearch.salesType === 'Rent'">COMMERCIAL PROPERTIES FOR RENT</h3>
8 8
         </div>
@@ -14,21 +14,17 @@
14 14
           >
15 15
             <div>
16 16
               <div class="portfolio-item">
17
-                <img style="width:255px; height:255px" :src="currentProperty.displayImage" alt="" />
17
+                <img style="width:255px; height:255px" :src="currentProperty.displayImage" alt />
18 18
 
19 19
                 <h4 class="mt-3">{{ currentProperty.suburb }}</h4>
20
-                <p>
21
-                  Opposite Monument Park Spar, Pretoria! Secure Parking. A stand-alone building,
22
-                  situated in the best location. Incredible bargain!
23
-                </p>
20
+                <p>{{currentProperty.shortDescription }}</p>
24 21
                 <br />
25 22
 
26 23
                 <!-- <a href="commercialproperty-page.php" class="btn-white-border">VIEW</a> -->
27 24
                 <router-link
28 25
                   class="btn-white-border"
29 26
                   :to="`/property/commercial/property/${currentProperty.id}`"
30
-                  >VIEW</router-link
31
-                >
27
+                >VIEW</router-link>
32 28
               </div>
33 29
             </div>
34 30
           </div>
@@ -41,6 +37,7 @@
41 37
             <p>Sorry no listings where found matching your search</p>
42 38
           </div>
43 39
         </div>
40
+        <div v-if="wait" id="preloader"></div>
44 41
       </div>
45 42
     </section>
46 43
   </main>
@@ -54,12 +51,15 @@ import propertyCard from "../propertyCard";
54 51
 export default {
55 52
   name: "propertysearch",
56 53
   components: {
57
-    propertyCard
54
+    propertyCard,
58 55
   },
59 56
   data() {
60
-    return {};
57
+    return {
58
+      wait: true,
59
+    };
61 60
   },
62 61
   mounted() {
62
+    this.wait = true;
63 63
     console.log(this.propertySearch.salesType);
64 64
 
65 65
     if (typeof this.propertySearch.propertyUsageType === "undefined") {
@@ -69,13 +69,15 @@ export default {
69 69
       this.propertySearch.userName = this.user.username;
70 70
     }
71 71
 
72
-    this.searchProperties(this.propertySearch);
72
+    this.searchProperties(this.propertySearch).then((fulfilled) => {
73
+      this.wait = false;
74
+    });
73 75
   },
74 76
   methods: {
75 77
     ...mapActions("propertySearch", [
76 78
       "searchProperties",
77 79
       "clearProperties",
78
-      "updateResultsShowing"
80
+      "updateResultsShowing",
79 81
     ]),
80 82
     SetType(item) {
81 83
       this.propertySearch.propertyUsageType = item;
@@ -83,10 +85,14 @@ export default {
83 85
     SearchPage() {
84 86
       this.clearProperties();
85 87
       this.$router.push("/property/search");
86
-    }
88
+    },
87 89
   },
88 90
   computed: {
89
-    ...mapState("propertySearch", ["properties", "propertySearch", "resultsShowing"]),
91
+    ...mapState("propertySearch", [
92
+      "properties",
93
+      "propertySearch",
94
+      "resultsShowing",
95
+    ]),
90 96
     ...mapState("authentication", ["user"]),
91 97
     ParamsChanged() {
92 98
       console.log(JSON.stringify(this.propertySearch));
@@ -94,15 +100,17 @@ export default {
94 100
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
95 101
         this.propertySearch.propertyUsageType = "Residential";
96 102
       }
97
-      this.searchProperties(this.propertySearch);
103
+      this.searchProperties(this.propertySearch).then((fulfilled) => {
104
+        this.wait = false;
105
+      });
98 106
       return null;
99
-    }
107
+    },
100 108
   },
101 109
   watch: {
102 110
     ParamsChanged() {
103 111
       return null;
104
-    }
105
-  }
112
+    },
113
+  },
106 114
 };
107 115
 </script>
108 116
 

+ 59
- 167
src/components/property/commercial/createProperty/commercialCreate.vue Ver fichero

@@ -37,9 +37,11 @@
37 37
               @change="PropertyTypeSelected"
38 38
             >
39 39
               <option value="0">Please select type *</option>
40
-              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
41
-                {{ item.description }}
42
-              </option>
40
+              <option
41
+                v-for="item in propertyTypes"
42
+                :value="item.id"
43
+                :key="item.id"
44
+              >{{ item.description }}</option>
43 45
             </select>
44 46
           </div>
45 47
           <div v-if="propertyType === 'Commercial'" class="col-md-2">
@@ -58,6 +60,12 @@
58 60
         <div class="row my-5">
59 61
           <div class="col-md-6">
60 62
             <mapSection v-on:map-location="updateLocation" />
63
+            <input
64
+              type="checkbox"
65
+              v-model="property.showAddress"
66
+              style="margin-right: 10px; margin-top: 10px;"
67
+            />
68
+            <label>Show address on listing</label>
61 69
           </div>
62 70
           <div class="col-md-6">
63 71
             <div class="row">
@@ -67,8 +75,7 @@
67 75
                     for="price"
68 76
                     class="uniSelectLabel"
69 77
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
70
-                    >{{ salesType }} Price</label
71
-                  >
78
+                  >{{ salesType }} Price</label>
72 79
                 </div>
73 80
                 <input
74 81
                   class="form-control uniInput"
@@ -182,90 +189,14 @@
182 189
           :savedImages="propertyImages"
183 190
           @DefaultImage="UpdateDefaultImage"
184 191
         />
185
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
186
-          Save
187
-        </button>
188
-        <div v-if="showPropertyTypeError || showProvinceError || showCityError || showSuburbError">
189
-          <p class="alert myError">
190
-            Missing fields. Please fill in all required fields. Marked with *
191
-          </p>
192
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
193
+        <div v-if="showPropertyTypeError">
194
+          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
192 195
         </div>
193
-        <div v-if="wait" id="preloader"></div>
194
-        <!-- <div class="row">
195
-          <div class="col-md-6">
196
-            <div v-if="!property.addressLine1">
197
-              <label for="unit" class="uniSelectLabel">STREET NUMBER</label>
198
-            </div>
199
-            <input
200
-              class="form-control uniInput"
201
-              type="text"
202
-              name="streetnumber"
203
-              v-model="property.addressLine1"
204
-            />
205
-          </div>
206
-          <div class="col-md-6">
207
-            <div v-if="!property.addressLine2">
208
-              <label for="streetname" class="uniSelectLabel">STREET NAME</label>
209
-            </div>
210
-            <input
211
-              class="form-control uniInput"
212
-              type="text"
213
-              name="streetname"
214
-              id="streetname"
215
-              v-model="property.addressLine2"
216
-            />
217
-          </div>
218
-        </div>
219
-        <div class="row my-3">
220
-          <div class="col-md-6">
221
-            <div v-if="!property.provinceId">
222
-              <label for="province" class="uniSelectLabel">PROVINCE</label>
223
-            </div>
224
-            <input
225
-              class="form-control uniInput"
226
-              type="text"
227
-              name="province"
228
-              v-model="selectedProvince"
229
-            />
230
-          </div>
231
-          <div class="col-md-6">
232
-            <div v-if="!property.cityId">
233
-              <label for="city" class="uniSelectLabel">CITY</label>
234
-            </div>
235
-            <input
236
-              class="form-control uniInput"
237
-              type="text"
238
-              name="city"
239
-              id="city"
240
-              v-model="selectedCity"
241
-            />
242
-          </div>
196
+        <div v-if="!addressSet">
197
+          <p class="alert myError">Please enter an address.</p>
243 198
         </div>
244
-        <div class="row my-3">
245
-          <div class="col-md-6">
246
-            <div v-if="!property.suburbId">
247
-              <label for="suburb" class="uniSelectLabel">SUBURB</label>
248
-            </div>
249
-            <input
250
-              class="form-control uniInput"
251
-              type="text"
252
-              name="suburb"
253
-              v-model="selectedSuburb"
254
-            />
255
-          </div>
256
-          <div class="col-md-6">
257
-            <div v-if="!property.addressLine3">
258
-              <label for="code" class="uniSelectLabel">POSTAL CODE</label>
259
-            </div>
260
-            <input
261
-              class="form-control uniInput"
262
-              type="text"
263
-              name="code"
264
-              id="code"
265
-              v-model="property.addressLine3"
266
-            />
267
-          </div>
268
-        </div> -->
199
+        <div v-if="wait" id="preloader"></div>
269 200
       </div>
270 201
     </main>
271 202
   </div>
@@ -288,15 +219,12 @@ export default {
288 219
     ImageLoad,
289 220
     VueEditor,
290 221
     carouselSection,
291
-    mapSection
222
+    mapSection,
292 223
   },
293 224
   data() {
294 225
     return {
295 226
       propertyType: "Commercial",
296 227
       salesType: "Rental",
297
-      selectedProvince: "",
298
-      selectedCity: "",
299
-      selectedSuburb: "",
300 228
       images: [],
301 229
       propertyFieldValues: [],
302 230
       defaultImage: 0,
@@ -304,23 +232,25 @@ export default {
304 232
       customToolbar: [
305 233
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
306 234
         ["bold", "italic", "underline", "strike"],
307
-        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
235
+        [
236
+          { align: "" },
237
+          { align: "center" },
238
+          { align: "right" },
239
+          { align: "justify" },
240
+        ],
308 241
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
309 242
         [{ script: "sub" }, { script: "super" }],
310
-        [{ indent: "-1" }, { indent: "+1" }]
243
+        [{ indent: "-1" }, { indent: "+1" }],
311 244
       ],
312 245
       error: "",
246
+      addressSet: false,
313 247
       showPropertyTypeError: false,
314
-      showProvinceError: false,
315
-      showCityError: false,
316
-      showSuburbError: false,
317 248
       showDateError: false,
318 249
       user: Log.getUser(),
319
-      mayEdit: Log.isLoggedIn()
250
+      mayEdit: Log.isLoggedIn(),
320 251
     };
321 252
   },
322 253
   methods: {
323
-    ...mapActions("searchTab", ["getProvince", "getCities", "getSuburbs"]),
324 254
     ...mapActions("property", [
325 255
       "getPropertyTypes",
326 256
       "getPropertyOverviewFields",
@@ -328,20 +258,22 @@ export default {
328 258
       "saveProperty",
329 259
       "getProperty",
330 260
       "getPropertyImages",
331
-      "clearProperty",
332 261
       "clearPropertyImages",
333 262
       "getPropertyEditDisplay",
334 263
       "getPropertySavedOverviewFields",
335 264
       "getPropertySavedFields",
336
-      "getSavedPropertyData"
265
+      "getSavedPropertyData",
337 266
     ]),
338 267
     updateLocation(place) {
339
-      this.property.addressLine1 = place.mapComponents[0].short_name;
340
-      this.property.addressLine2 = place.mapComponents[1].short_name;
341
-      this.property.addressLine3 = place.mapComponents[7].short_name;
342
-      this.property.provinceId = place.provinceId;
343
-      this.property.cityId = place.cityId;
344
-      this.property.suburbId = place.suburbId;
268
+      this.addressSet = true;
269
+      this.property.streetNumber = place.streetNumber;
270
+      this.property.streetName = place.streetName;
271
+      this.property.suburb = place.suburb;
272
+      this.property.city = place.city;
273
+      this.property.province = place.province;
274
+      this.property.country = place.country;
275
+      this.property.postalCode = place.postalCode;
276
+      this.property.addressUrl = place.url;
345 277
       this.property.propertCoords = place.coords;
346 278
     },
347 279
     TypeChanged() {
@@ -351,27 +283,15 @@ export default {
351 283
       if (this.property.propertyTypeId === 0) {
352 284
         this.showPropertyTypeError = true;
353 285
       }
354
-      if (this.property.provinceId === 0) {
355
-        this.showProvinceError = true;
356
-      }
357
-      if (this.property.cityId === 0) {
358
-        this.showCityError = true;
359
-      }
360
-      if (this.property.suburbId === 0) {
361
-        this.showSuburbError = true;
362
-      }
363 286
 
364
-      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
287
+      if (
288
+        this.salesType === "Rental" &&
289
+        this.property.dateAvailable === "undef"
290
+      ) {
365 291
         this.showDateError = true;
366 292
       }
367 293
 
368
-      if (
369
-        this.showPropertyTypeError ||
370
-        this.showProvinceError ||
371
-        this.showCityError ||
372
-        this.showSuburbError ||
373
-        this.showDateError
374
-      ) {
294
+      if (this.showPropertyTypeError || this.showDateError) {
375 295
         return;
376 296
       }
377 297
 
@@ -380,6 +300,9 @@ export default {
380 300
         this.property.isSale = true;
381 301
         this.property.dateAvailable = new Date();
382 302
       }
303
+      if (this.images.length > 0) {
304
+        this.property.propertyImages = [];
305
+      }
383 306
       // eslint-disable-next-line no-plusplus
384 307
       for (let i = 0; i < this.images.length; i++) {
385 308
         let setAsDefault = false;
@@ -388,7 +311,7 @@ export default {
388 311
         }
389 312
         this.property.propertyImages.push({
390 313
           image: this.images[i],
391
-          isDefault: setAsDefault
314
+          isDefault: setAsDefault,
392 315
         });
393 316
       }
394 317
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -397,13 +320,13 @@ export default {
397 320
         this.property.userId = this.user.id;
398 321
       }
399 322
 
400
-      console.log(this.property);
401
-
402 323
       this.saveProperty(this.property)
403
-        .then(fulfilled => {
404
-          this.$router.push(`/property/commercial/property/${fulfilled.data.id}`);
324
+        .then((fulfilled) => {
325
+          this.$router.push(
326
+            `/property/commercial/property/${fulfilled.data.id}`
327
+          );
405 328
         })
406
-        .catch(error => {
329
+        .catch((error) => {
407 330
           console.log(error.message);
408 331
         });
409 332
     },
@@ -420,40 +343,12 @@ export default {
420 343
         this.showPropertyTypeError = true;
421 344
       }
422 345
     },
423
-    ProvinceSelected(item) {
424
-      if (item.target.options.selectedIndex > 0) {
425
-        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
426
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
427
-        this.showProvinceError = false;
428
-      } else {
429
-        this.showProvinceError = true;
430
-      }
431
-    },
432
-    CitySelected(item) {
433
-      if (item.target.options.selectedIndex > 0) {
434
-        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
435
-        this.getSuburbs(
436
-          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity })
437
-        );
438
-        this.showCityError = false;
439
-      } else {
440
-        this.showCityError = true;
441
-      }
442
-    },
443
-    getPostalCode(item) {
444
-      this.property.addressLine3 = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
445
-      if (item.target.options.selectedIndex > 0) {
446
-        this.showSuburbError = false;
447
-      } else {
448
-        this.showSuburbError = true;
449
-      }
450
-    },
451 346
     loadedImages(values) {
452 347
       this.images = values;
453 348
     },
454 349
     UpdateUserDefinedFields(item) {
455 350
       let update = false;
456
-      this.propertyFieldValues.forEach(element => {
351
+      this.propertyFieldValues.forEach((element) => {
457 352
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
458 353
           element.value = item.value;
459 354
           update = true;
@@ -465,11 +360,11 @@ export default {
465 360
     },
466 361
     UpdateDefaultImage(item) {
467 362
       this.defaultImage = item;
468
-    }
363
+    },
469 364
   },
470 365
   mounted() {
471 366
     this.wait = false;
472
-    this.clearProperty();
367
+    this.getProperty(0);
473 368
     this.clearPropertyImages();
474 369
     this.images = [];
475 370
     this.defaultImage = 0;
@@ -491,20 +386,17 @@ export default {
491 386
 
492 387
     this.getPropertyTypes(this.propertyType);
493 388
 
494
-    this.getProvince();
495 389
     this.getPropertyOverviewFields();
496 390
     this.getPropertyFields(this.propertyType);
497 391
   },
498 392
   computed: {
499
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"]),
500 393
     ...mapState("property", [
501 394
       "propertyTypes",
502 395
       "propertyOverviewFields",
503 396
       "propertyFields",
504 397
       "property",
505
-      "propertyImages"
398
+      "propertyImages",
506 399
     ]),
507
-    ...mapState("authentication", ["user"]),
508 400
     SalesTypeChanged() {
509 401
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
510 402
       // this.propertyType = this.$route.params.propType;
@@ -522,13 +414,13 @@ export default {
522 414
       this.getPropertyTypes(this.propertyType);
523 415
 
524 416
       return this.propertyType;
525
-    }
417
+    },
526 418
   },
527 419
   watch: {
528 420
     SalesTypeChanged() {
529 421
       return null;
530
-    }
531
-  }
422
+    },
423
+  },
532 424
 };
533 425
 </script>
534 426
 

+ 16
- 17
src/components/property/commercial/singleView/contentSection.vue Ver fichero

@@ -6,11 +6,7 @@
6 6
           <div class="resPortfolioSection" style="margin-top:-5px">
7 7
             <div v-for="(image, i) in propertyImages" @click="index = i" :key="i">
8 8
               <div v-if="i < 3">
9
-                <img
10
-                  v-if="i === 0"
11
-                  style="width:100%; height:201px;object-fit: cover"
12
-                  :src="image"
13
-                />
9
+                <img v-if="i === 0" style="width:100%; height:201px;object-fit: cover" :src="image" />
14 10
                 <div v-else-if="i !== 0">
15 11
                   <img
16 12
                     v-if="i % 2 === 0"
@@ -27,17 +23,20 @@
27 23
 
28 24
           <div class="panel-left p-5" style="margin-top:140px; margin-bottom:50px">
29 25
             <h2>Property Detial</h2>
30
-            <p>{{ property.addressLine1 }} {{ property.addressLine2 }}</p>
31
-            <p>{{ property.city.description }}, {{ property.suburb.description }}</p>
26
+            <p v-if="property.showAddress">{{ property.streetNumber }} {{ property.streetName }}</p>
27
+            <p>{{ property.suburb }}, {{ property.city }}</p>
32 28
             <p>{{ property.shortDescription }}</p>
33 29
             <p>{{ property.price | toCurrency }}</p>
34
-            <div class="btn-white-border"><i class="fa fa-search"></i>BOOK A VIEWING</div>
30
+            <div class="btn-white-border">
31
+              <i class="fa fa-search"></i>BOOK A VIEWING
32
+            </div>
35 33
           </div>
36 34
         </div>
37 35
         <div class="col-md-8 p-5 resort-profile">
38
-          <h2>
39
-            {{ property.propertyName }} / {{ property.addressLine1 }} {{ property.addressLine2 }}
40
-          </h2>
36
+          <h2
37
+            v-if="property.showAddress"
38
+          >{{ property.propertyName }} / {{ property.streetNumber }} {{ property.streetName }}</h2>
39
+          <h2>{{ property.propertyName }}</h2>
41 40
           <div>
42 41
             <table class="table table-striped">
43 42
               <thead>
@@ -56,7 +55,7 @@
56 55
                   <td>#{{ property.unit }}</td>
57 56
                   <td>Second Floor</td>
58 57
                   <td>yes</td>
59
-                  <td>
58
+                  <td v-if="property.displayData && property.displayData.length > 0">
60 59
                     <div class="row" v-for="(feat, i) in property.displayData[0].values" :key="i">
61 60
                       <div class="col" v-if="feat.value.toUpperCase() !== 'NO'">
62 61
                         <div></div>
@@ -83,7 +82,7 @@
83 82
               marginheight="0"
84 83
               marginwidth="0"
85 84
             ></iframe>
86
-          </div> -->
85
+          </div>-->
87 86
         </div>
88 87
       </div>
89 88
     </div>
@@ -95,11 +94,11 @@
95 94
 import gallery from "../../../shared/gallerySlideShow";
96 95
 export default {
97 96
   components: {
98
-    gallery
97
+    gallery,
99 98
   },
100 99
   props: {
101 100
     property: {},
102
-    propertyImages: {}
101
+    propertyImages: {},
103 102
   },
104 103
   mounted() {
105 104
     console.log(this.property);
@@ -107,9 +106,9 @@ export default {
107 106
   data() {
108 107
     return {
109 108
       index: null,
110
-      date: new Date()
109
+      date: new Date(),
111 110
     };
112
-  }
111
+  },
113 112
 };
114 113
 </script>
115 114
 

+ 62
- 66
src/components/property/mapSection.vue Ver fichero

@@ -1,9 +1,6 @@
1 1
 <template>
2 2
   <div>
3
-    <gmap-autocomplete
4
-      class="form-control mb-3 uniInput"
5
-      @place_changed="setPlace"
6
-    ></gmap-autocomplete>
3
+    <gmap-autocomplete class="form-control mb-3 uniInput" @place_changed="setPlace">*</gmap-autocomplete>
7 4
     <GmapMap
8 5
       :center="mapCenter"
9 6
       :zoom="mapZoom"
@@ -18,88 +15,87 @@
18 15
 
19 16
 <script>
20 17
 /* eslint-disable */
21
-import { mapState, mapActions } from "vuex";
22 18
 import { gmapApi } from "vue2-google-maps";
23 19
 export default {
24 20
   computed: {
25 21
     google: gmapApi,
26
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"])
27 22
   },
28 23
   data() {
29 24
     return {
30 25
       place: null,
31 26
       mapCenter: { lat: -26.195246, lng: 28.034088 },
32 27
       mapZoom: 11,
33
-      selectedProvince: "",
34
-      selectedCity: "",
35
-      selectedSuburb: "",
36
-      mapObj: {
37
-        provinceId: "",
38
-        cityId: "",
39
-        suburbId: "",
40
-        mapComponents: null
41
-      }
28
+      streetNumber: "",
29
+      streetName: "",
30
+      suburb: "",
31
+      city: "",
32
+      province: "",
33
+      country: "",
34
+      postalCode: "",
35
+      url: "",
36
+      coords: {},
42 37
     };
43 38
   },
44 39
 
45 40
   methods: {
46
-    ...mapActions("searchTab", ["getProvince", "getCities", "getSuburbs"]),
47
-    async pullProvince(provinceParam) {
48
-      await this.provinces.forEach(province => {
49
-        if (province.code === provinceParam) {
50
-          this.mapObj.provinceId = province.id;
51
-          this.selectedProvince = province.description;
52
-        }
53
-      });
54
-      await this.getCities(Object.assign({}, { province: this.selectedProvince }));
55
-      return Promise.resolve();
56
-    },
57
-    async pullCities(cityParam) {
58
-      await this.cities.forEach(city => {
59
-        if (city.description === cityParam) {
60
-          this.mapObj.cityId = city.id;
61
-          this.selectedCity = city.description;
62
-        }
63
-      });
64
-      await this.getSuburbs(
65
-        Object.assign({}, { province: this.selectedProvince, city: this.selectedCity })
66
-      );
67
-      return Promise.resolve();
68
-    },
69
-    async pullSuburbs(suburbParam) {
70
-      await this.suburbs.forEach(suburb => {
71
-        if (suburb.description === suburbParam) {
72
-          this.mapObj.suburbId = suburb.id;
73
-          this.selectedSuburb = suburb.description;
74
-        }
75
-      });
76
-      return Promise.resolve();
77
-    },
78 41
     setPlace(place) {
79 42
       this.place = place;
80 43
       this.mapCenter = place.geometry.location;
81 44
       this.mapZoom = 17;
82
-      this.mapObj.mapComponents = place.address_components;
83 45
 
84
-      this.pullProvince(place.address_components[5].short_name).then(() => {
85
-        setTimeout(
86
-          () =>
87
-            this.pullCities(place.address_components[3].short_name).then(() => {
88
-              setTimeout(
89
-                () =>
90
-                  this.pullSuburbs(place.address_components[2].short_name).then(() => {
91
-                    var coords = place.geometry.viewport.Za.j + "," + place.geometry.viewport.Va.j;
92
-                    this.mapObj.coords = coords;
93
-                    this.$emit("map-location", this.mapObj);
94
-                  }),
95
-                1000
96
-              );
97
-            }),
98
-          1000
99
-        );
46
+      this.streetNumber = "";
47
+      this.streetName = "";
48
+      this.suburb = "";
49
+      this.city = "";
50
+      this.province = "";
51
+      this.country = "";
52
+      this.postalCode = "";
53
+      this.url = "";
54
+      this.coords = {};
55
+      for (let i = 0; i < place.address_components.length; i++) {
56
+        if (place.address_components[i].types[0] === "street_number") {
57
+          this.streetNumber = place.address_components[i].long_name;
58
+        }
59
+        if (place.address_components[i].types[0] === "route") {
60
+          this.streetName = place.address_components[i].long_name;
61
+        }
62
+        if (place.address_components[i].types[0] === "sublocality_level_1") {
63
+          this.suburb = place.address_components[i].long_name;
64
+        }
65
+        if (place.address_components[i].types[0] === "locality") {
66
+          this.city = place.address_components[i].long_name;
67
+        }
68
+        if (
69
+          place.address_components[i].types[0] === "administrative_area_level_1"
70
+        ) {
71
+          this.province = place.address_components[i].long_name;
72
+        }
73
+        if (place.address_components[i].types[0] === "country") {
74
+          this.country = place.address_components[i].long_name;
75
+        }
76
+        if (place.address_components[i].types[0] === "postal_code") {
77
+          this.postalCode = place.address_components[i].long_name;
78
+        }
79
+        this.url = place.url;
80
+      }
81
+
82
+      var coords =
83
+        place.geometry.viewport.Za.j + "," + place.geometry.viewport.Va.j;
84
+      this.coords = coords;
85
+
86
+      this.$emit("map-location", {
87
+        streetNumber: this.streetNumber,
88
+        streetName: this.streetName,
89
+        suburb: this.suburb,
90
+        city: this.city,
91
+        province: this.province,
92
+        country: this.country,
93
+        postalCode: this.postalCode,
94
+        url: this.url,
95
+        coords: this.coords,
100 96
       });
101
-    }
102
-  }
97
+    },
98
+  },
103 99
 };
104 100
 </script>
105 101
 

+ 81
- 99
src/components/property/propertyCreate.vue Ver fichero

@@ -35,9 +35,7 @@
35 35
             class="btn btn-b-n"
36 36
             style="width: 150px; height:40px;"
37 37
             @click="Login"
38
-          >
39
-            Login
40
-          </button>
38
+          >Login</button>
41 39
         </div>
42 40
       </div>
43 41
       <div class="row" v-if="mayEdit">
@@ -86,9 +84,11 @@
86 84
                     @change="PropertyTypeSelected"
87 85
                   >
88 86
                     <option value="0">Please select type</option>
89
-                    <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
90
-                      {{ item.description }}
91
-                    </option>
87
+                    <option
88
+                      v-for="item in propertyTypes"
89
+                      :value="item.id"
90
+                      :key="item.id"
91
+                    >{{ item.description }}</option>
92 92
                   </select>
93 93
                 </div>
94 94
                 <div v-if="showPropertyTypeError">
@@ -170,9 +170,11 @@
170 170
                     v-model="property.provinceId"
171 171
                   >
172 172
                     <option value="0">Please select province</option>
173
-                    <option v-for="province in provinces" :value="province.id" :key="province.id">
174
-                      {{ province.description }}
175
-                    </option>
173
+                    <option
174
+                      v-for="province in provinces"
175
+                      :value="province.id"
176
+                      :key="province.id"
177
+                    >{{ province.description }}</option>
176 178
                   </select>
177 179
                 </div>
178 180
                 <div v-if="showProvinceError">
@@ -194,9 +196,11 @@
194 196
                     v-model="property.cityId"
195 197
                   >
196 198
                     <option value="0">Please select city</option>
197
-                    <option v-for="city in cities" :value="city.id" :key="city.id">
198
-                      {{ city.description }}
199
-                    </option>
199
+                    <option
200
+                      v-for="city in cities"
201
+                      :value="city.id"
202
+                      :key="city.id"
203
+                    >{{ city.description }}</option>
200 204
                   </select>
201 205
                 </div>
202 206
                 <div v-if="showCityError">
@@ -217,9 +221,11 @@
217 221
                     @change="getPostalCode"
218 222
                   >
219 223
                     <option value="0">Please select suburb</option>
220
-                    <option v-for="suburb in suburbs" :value="suburb.id" :key="suburb.id">
221
-                      {{ suburb.description }}
222
-                    </option>
224
+                    <option
225
+                      v-for="suburb in suburbs"
226
+                      :value="suburb.id"
227
+                      :key="suburb.id"
228
+                    >{{ suburb.description }}</option>
223 229
                   </select>
224 230
                 </div>
225 231
                 <div v-if="showSuburbError">
@@ -382,15 +388,13 @@
382 388
               @click="SubmitData()"
383 389
               class="btn btn-b-n"
384 390
               style="width: 85px; height:40px;"
385
-            >
386
-              Save
387
-            </button>
391
+            >Save</button>
388 392
             <div
389 393
               v-if="showPropertyTypeError || showProvinceError || showCityError || showSuburbError"
390 394
             >
391
-              <p class="alert myError">
392
-                Missing fields. Please fill in all required fields. Marked with *
393
-              </p>
395
+              <p
396
+                class="alert myError"
397
+              >Missing fields. Please fill in all required fields. Marked with *</p>
394 398
             </div>
395 399
             <div v-if="wait" id="preloader"></div>
396 400
           </form>
@@ -401,14 +405,14 @@
401 405
 </template>
402 406
 
403 407
 <script>
404
-import { mapState, mapActions } from 'vuex';
405
-import { VueEditor } from 'vue2-editor';
406
-import UserField from './propertyUserField.vue';
407
-import ImageLoad from './propertyImage.vue';
408
-import Log from '../../assets/Log';
408
+import { mapState, mapActions } from "vuex";
409
+import { VueEditor } from "vue2-editor";
410
+import UserField from "./propertyUserField.vue";
411
+import ImageLoad from "./propertyImage.vue";
412
+import Log from "../../assets/Log";
409 413
 
410 414
 export default {
411
-  name: 'PropertyCreate',
415
+  name: "PropertyCreate",
412 416
   components: {
413 417
     UserField,
414 418
     ImageLoad,
@@ -416,23 +420,28 @@ export default {
416 420
   },
417 421
   data() {
418 422
     return {
419
-      propertyType: 'Residential',
420
-      salesType: 'Rental',
421
-      selectedProvince: '',
422
-      selectedCity: '',
423
+      propertyType: "Residential",
424
+      salesType: "Rental",
425
+      selectedProvince: "",
426
+      selectedCity: "",
423 427
       images: [],
424 428
       propertyFieldValues: [],
425 429
       defaultImage: 0,
426 430
       wait: false,
427 431
       customToolbar: [
428 432
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
429
-        ['bold', 'italic', 'underline', 'strike'],
430
-        [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
431
-        [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
432
-        [{ script: 'sub' }, { script: 'super' }],
433
-        [{ indent: '-1' }, { indent: '+1' }],
433
+        ["bold", "italic", "underline", "strike"],
434
+        [
435
+          { align: "" },
436
+          { align: "center" },
437
+          { align: "right" },
438
+          { align: "justify" },
439
+        ],
440
+        [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
441
+        [{ script: "sub" }, { script: "super" }],
442
+        [{ indent: "-1" }, { indent: "+1" }],
434 443
       ],
435
-      error: '',
444
+      error: "",
436 445
       showPropertyTypeError: false,
437 446
       showProvinceError: false,
438 447
       showCityError: false,
@@ -443,20 +452,19 @@ export default {
443 452
     };
444 453
   },
445 454
   methods: {
446
-    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
447
-    ...mapActions('property', [
448
-      'getPropertyTypes',
449
-      'getPropertyOverviewFields',
450
-      'getPropertyFields',
451
-      'saveProperty',
452
-      'getProperty',
453
-      'getPropertyImages',
454
-      'clearProperty',
455
-      'clearPropertyImages',
456
-      'getPropertyEditDisplay',
457
-      'getPropertySavedOverviewFields',
458
-      'getPropertySavedFields',
459
-      'getSavedPropertyData',
455
+    ...mapActions("property", [
456
+      "getPropertyTypes",
457
+      "getPropertyOverviewFields",
458
+      "getPropertyFields",
459
+      "saveProperty",
460
+      "getProperty",
461
+      "getPropertyImages",
462
+      "clearProperty",
463
+      "clearPropertyImages",
464
+      "getPropertyEditDisplay",
465
+      "getPropertySavedOverviewFields",
466
+      "getPropertySavedFields",
467
+      "getSavedPropertyData",
460 468
     ]),
461 469
     TypeChanged() {
462 470
       this.property.propertyUsageType = this.propertyType;
@@ -475,22 +483,25 @@ export default {
475 483
         this.showSuburbError = true;
476 484
       }
477 485
 
478
-      if (this.salesType === 'Rental' && this.property.dateAvailable === 'undef') {
486
+      if (
487
+        this.salesType === "Rental" &&
488
+        this.property.dateAvailable === "undef"
489
+      ) {
479 490
         this.showDateError = true;
480 491
       }
481 492
 
482 493
       if (
483
-        this.showPropertyTypeError
484
-        || this.showProvinceError
485
-        || this.showCityError
486
-        || this.showSuburbError
487
-        || this.showDateError
494
+        this.showPropertyTypeError ||
495
+        this.showProvinceError ||
496
+        this.showCityError ||
497
+        this.showSuburbError ||
498
+        this.showDateError
488 499
       ) {
489 500
         return;
490 501
       }
491 502
 
492 503
       this.wait = true;
493
-      if (this.salesType === 'Sale') {
504
+      if (this.salesType === "Sale") {
494 505
         this.property.isSale = true;
495 506
         this.property.dateAvailable = new Date();
496 507
       }
@@ -520,10 +531,10 @@ export default {
520 531
         });
521 532
     },
522 533
     Close() {
523
-      this.$router.push('/property/admin/list/my');
534
+      this.$router.push("/property/admin/list/my");
524 535
     },
525 536
     Login() {
526
-      this.$router.push('/user/login');
537
+      this.$router.push("/user/login");
527 538
     },
528 539
     PropertyTypeSelected(item) {
529 540
       if (item.target.options.selectedIndex > 0) {
@@ -532,34 +543,7 @@ export default {
532 543
         this.showPropertyTypeError = true;
533 544
       }
534 545
     },
535
-    ProvinceSelected(item) {
536
-      if (item.target.options.selectedIndex > 0) {
537
-        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
538
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
539
-        this.showProvinceError = false;
540
-      } else {
541
-        this.showProvinceError = true;
542
-      }
543
-    },
544
-    CitySelected(item) {
545
-      if (item.target.options.selectedIndex > 0) {
546
-        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
547
-        this.getSuburbs(
548
-          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity }),
549
-        );
550
-        this.showCityError = false;
551
-      } else {
552
-        this.showCityError = true;
553
-      }
554
-    },
555
-    getPostalCode(item) {
556
-      this.property.addressLine3 = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
557
-      if (item.target.options.selectedIndex > 0) {
558
-        this.showSuburbError = false;
559
-      } else {
560
-        this.showSuburbError = true;
561
-      }
562
-    },
546
+
563 547
     loadedImages(values) {
564 548
       this.images = values;
565 549
     },
@@ -592,8 +576,8 @@ export default {
592 576
     if (this.propertyFields.length > 0) {
593 577
       this.propertyFields = [];
594 578
     }
595
-    if (this.property.description !== '') {
596
-      this.property.description = '';
579
+    if (this.property.description !== "") {
580
+      this.property.description = "";
597 581
     }
598 582
 
599 583
     if (this.$route.params.propertyUsageType) {
@@ -603,20 +587,18 @@ export default {
603 587
 
604 588
     this.getPropertyTypes(this.propertyType);
605 589
 
606
-    this.getProvince();
607 590
     this.getPropertyOverviewFields();
608 591
     this.getPropertyFields(this.propertyType);
609 592
   },
610 593
   computed: {
611
-    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
612
-    ...mapState('property', [
613
-      'propertyTypes',
614
-      'propertyOverviewFields',
615
-      'propertyFields',
616
-      'property',
617
-      'propertyImages',
594
+    ...mapState("property", [
595
+      "propertyTypes",
596
+      "propertyOverviewFields",
597
+      "propertyFields",
598
+      "property",
599
+      "propertyImages",
618 600
     ]),
619
-    ...mapState('authentication', ['user']),
601
+    ...mapState("authentication", ["user"]),
620 602
     SalesTypeChanged() {
621 603
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
622 604
       // this.propertyType = this.$route.params.propType;

+ 16
- 39
src/components/property/propertySearchFields.vue Ver fichero

@@ -210,7 +210,7 @@
210 210
 </template>
211 211
 
212 212
 <script>
213
-import { mapState, mapActions } from 'vuex';
213
+import { mapState, mapActions } from "vuex";
214 214
 
215 215
 export default {
216 216
   props: {
@@ -218,67 +218,44 @@ export default {
218 218
   },
219 219
   data() {
220 220
     return {
221
-      resType: 'All',
222
-      comType: 'All',
221
+      resType: "All",
222
+      comType: "All",
223 223
     };
224 224
   },
225 225
   mounted() {
226
-    this.getProvince();
227 226
     this.getPropertyTypesRes();
228 227
     this.getPropertyTypesCom();
229 228
     this.propertySearch.propertyUsageType = this.propertyType;
230 229
   },
231 230
   computed: {
232
-    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
233
-    ...mapState('property', ['propertyTypesRes', 'propertyTypesCom']),
234
-    ...mapState('propertySearch', ['propertySearch']),
231
+    ...mapState("property", ["propertyTypesRes", "propertyTypesCom"]),
232
+    ...mapState("propertySearch", ["propertySearch"]),
235 233
   },
236 234
   methods: {
237
-    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
238
-    ...mapActions('property', ['getPropertyTypesRes', 'getPropertyTypesCom']),
239
-    ...mapActions('propertySearch', ['clearFilter']),
235
+    ...mapActions("property", ["getPropertyTypesRes", "getPropertyTypesCom"]),
236
+    ...mapActions("propertySearch", ["clearFilter"]),
240 237
     clearResType() {
241
-      this.clearFilter('propertyType');
242
-      this.resType = 'All';
238
+      this.clearFilter("propertyType");
239
+      this.resType = "All";
243 240
     },
244 241
     clearComType() {
245
-      this.clearFilter('propertyType');
246
-      this.comType = 'All';
242
+      this.clearFilter("propertyType");
243
+      this.comType = "All";
247 244
     },
248 245
     PropertyTypeSelected(item) {
249 246
       this.propertySearch.propertyType = item.target.value;
250 247
       let typeitem = this.propertyTypesCom.find(
251
-        t => t.description === item.target.value,
248
+        (t) => t.description === item.target.value
252 249
       );
253
-      if (typeof typeitem === 'undefined') {
250
+      if (typeof typeitem === "undefined") {
254 251
         typeitem = this.propertyTypesRes.find(
255
-          t => t.description === item.target.value,
252
+          (t) => t.description === item.target.value
256 253
         );
257 254
       }
258 255
       if (typeitem.usageType === 1) {
259
-        this.propertySearch.propertyUsageType = 'Commercial';
256
+        this.propertySearch.propertyUsageType = "Commercial";
260 257
       } else {
261
-        this.propertySearch.propertyUsageType = 'Residential';
262
-      }
263
-    },
264
-    ProvinceSelected(item) {
265
-      if (item.target.value !== 'All') {
266
-        this.getCities(
267
-          Object.assign({}, { province: this.propertySearch.province }),
268
-        );
269
-      }
270
-    },
271
-    CitySelected(item) {
272
-      if (item.target.value !== 'All') {
273
-        this.getSuburbs(
274
-          Object.assign(
275
-            {},
276
-            {
277
-              province: this.propertySearch.province,
278
-              city: this.propertySearch.city,
279
-            },
280
-          ),
281
-        );
258
+        this.propertySearch.propertyUsageType = "Residential";
282 259
       }
283 260
     },
284 261
   },

+ 11
- 12
src/components/property/propertySearchPage.vue Ver fichero

@@ -150,39 +150,39 @@
150 150
   </div>
151 151
 </template>
152 152
 <script>
153
-import { mapState, mapActions } from 'vuex';
154
-import autoComplete from '../shared/autoComplete.vue';
153
+import { mapState, mapActions } from "vuex";
154
+import autoComplete from "../shared/autoComplete.vue";
155 155
 
156 156
 export default {
157
-  name: 'propertysearch',
157
+  name: "propertysearch",
158 158
   components: {
159 159
     autoComplete,
160 160
   },
161 161
   data() {
162 162
     return {
163
-      propertyUsageType: 'Residential',
164
-      salesType: 'Sale',
165
-      searchText: '',
163
+      propertyUsageType: "Residential",
164
+      salesType: "Sale",
165
+      searchText: "",
166 166
     };
167 167
   },
168 168
   computed: {
169
-    ...mapState('propertySearch', ['suburbs', 'suburbList', 'propertySearch']),
169
+    ...mapState("propertySearch", ["suburbs", "suburbList", "propertySearch"]),
170 170
   },
171 171
   methods: {
172
-    ...mapActions('propertySearch', ['getSuburbs', 'applyFilter']),
172
+    ...mapActions("propertySearch", ["applyFilter"]),
173 173
     SetType(item) {
174 174
       this.propertyUsageType = item;
175 175
       localStorage.propertySearchUsageType = item;
176 176
     },
177 177
     SearchClick() {
178
-      const item = this.suburbs.find(s => s.display === this.searchText);
178
+      const item = this.suburbs.find((s) => s.display === this.searchText);
179 179
       this.propertySearch.province = item.province;
180 180
       this.propertySearch.city = item.city;
181 181
       this.propertySearch.suburb = item.suburb;
182 182
       this.propertySearch.propertyUsageType = this.propertyUsageType;
183 183
       this.propertySearch.salesType = this.salesType;
184 184
 
185
-      this.$router.push('/property/propertySearch/results');
185
+      this.$router.push("/property/propertySearch/results");
186 186
     },
187 187
     Filter() {
188 188
       this.applyFilter(this.searchText);
@@ -195,13 +195,12 @@ export default {
195 195
     },
196 196
   },
197 197
   mounted() {
198
-    this.getSuburbs();
199 198
     if (this.$route.params.propertyUsageType) {
200 199
       this.propertyUsageType = this.$route.params.propertyUsageType;
201 200
     } else if (localStorage.propertySearchUsageType) {
202 201
       this.propertyUsageType = localStorage.propertySearchUsageType;
203 202
     } else {
204
-      this.propertyUsageType = 'Residential';
203
+      this.propertyUsageType = "Residential";
205 204
     }
206 205
   },
207 206
 };

+ 50
- 87
src/components/property/propertyeditPage.vue Ver fichero

@@ -324,14 +324,14 @@
324 324
 </template>
325 325
 
326 326
 <script>
327
-import { mapState, mapActions } from 'vuex';
328
-import { VueEditor } from 'vue2-editor';
329
-import ImageLoad from './propertyImage.vue';
330
-import propField from './propertyFieldEditor.vue';
331
-import field from '../shared/fieldEditor.vue';
327
+import { mapState, mapActions } from "vuex";
328
+import { VueEditor } from "vue2-editor";
329
+import ImageLoad from "./propertyImage.vue";
330
+import propField from "./propertyFieldEditor.vue";
331
+import field from "../shared/fieldEditor.vue";
332 332
 
333 333
 export default {
334
-  name: 'PropertyEdit',
334
+  name: "PropertyEdit",
335 335
   components: {
336 336
     ImageLoad,
337 337
     VueEditor,
@@ -340,31 +340,31 @@ export default {
340 340
   },
341 341
   data() {
342 342
     return {
343
-      propertyType: 'Residential',
344
-      salesType: 'Rental',
343
+      propertyType: "Residential",
344
+      salesType: "Rental",
345 345
       images: [],
346 346
       propertyFieldValues: [],
347 347
       defaultImage: 0,
348 348
       wait: false,
349 349
       customToolbar: [
350 350
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
351
-        ['bold', 'italic', 'underline', 'strike'],
351
+        ["bold", "italic", "underline", "strike"],
352 352
         [
353
-          { align: '' },
354
-          { align: 'center' },
355
-          { align: 'right' },
356
-          { align: 'justify' },
353
+          { align: "" },
354
+          { align: "center" },
355
+          { align: "right" },
356
+          { align: "justify" },
357 357
         ],
358
-        [{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }],
359
-        [{ script: 'sub' }, { script: 'super' }],
360
-        [{ indent: '-1' }, { indent: '+1' }],
358
+        [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
359
+        [{ script: "sub" }, { script: "super" }],
360
+        [{ indent: "-1" }, { indent: "+1" }],
361 361
       ],
362 362
       salesTypeArr: [
363
-        { id: 1, description: 'Sale' },
364
-        { id: 2, description: 'Rental' },
363
+        { id: 1, description: "Sale" },
364
+        { id: 2, description: "Rental" },
365 365
       ],
366
-      pricePerArr: ['Month', 'Day'],
367
-      yesno: ['Yes', 'No'],
366
+      pricePerArr: ["Month", "Day"],
367
+      yesno: ["Yes", "No"],
368 368
       showPropertyTypeError: false,
369 369
       showProvinceError: false,
370 370
       showCityError: false,
@@ -372,56 +372,20 @@ export default {
372 372
     };
373 373
   },
374 374
   methods: {
375
-    ...mapActions('searchTab', [
376
-      'getProvince',
377
-      'getCities',
378
-      'getSuburbs',
379
-      'getListsForPropertyEdit',
375
+    ...mapActions("property", ["getPropertyTypes"]),
376
+    ...mapActions("propertyEdit", [
377
+      "getSavedPropertyData",
378
+      "updateProperty",
379
+      "mayEditProperty",
380 380
     ]),
381
-    ...mapActions('property', ['getPropertyTypes']),
382
-    ...mapActions('propertyEdit', [
383
-      'getSavedPropertyData',
384
-      'updateProperty',
385
-      'mayEditProperty',
386
-    ]),
387
-    provChanged(item) {
388
-      this.getCities(Object.assign({}, { province: item.description }));
389
-      this.property.city = null;
390
-      this.property.suburb = null;
391
-      this.property.addressLine3 = '';
392
-      this.showProvinceError = false;
393
-      this.showCityError = true;
394
-      this.showSuburbError = true;
395
-    },
396
-    cityChanged(item) {
397
-      this.getSuburbs(
398
-        Object.assign(
399
-          {},
400
-          {
401
-            province: this.property.province.description,
402
-            city: item.description,
403
-          },
404
-        ),
405
-      );
406
-      this.property.suburb = null;
407
-      this.property.addressLine3 = '';
408
-      this.showCityError = false;
409
-      this.showSuburbError = true;
410
-    },
411
-    suburbChanged(item) {
412
-      const newSuburb = this.suburbs.find(
413
-        p => p.description === item.description,
414
-      );
415
-      this.property.addressLine3 = newSuburb.postalCode;
416
-      this.showSuburbError = false;
417
-    },
418 381
     salesTypeChanged(item) {
419 382
       console.log(item);
420 383
     },
421 384
     UpdateValue(item) {
422 385
       if (item.isUDF) {
423 386
         if (item.isPropOverview) {
424
-          this.propertyOverviewFields[0].fields[item.arrayIndex].value = item.value;
387
+          this.propertyOverviewFields[0].fields[item.arrayIndex].value =
388
+            item.value;
425 389
         } else if (item.isPropOverview === false) {
426 390
           this.propertyFields[item.arrayIndex].fields[
427 391
             item.arrayItemIndex
@@ -429,9 +393,9 @@ export default {
429 393
         }
430 394
       } else if (!item.isUDF) {
431 395
         if (item.fieldName) {
432
-          if (item.fieldName === 'isSale') {
396
+          if (item.fieldName === "isSale") {
433 397
             let isSaleValue = false;
434
-            if (item.value === 'Sale') {
398
+            if (item.value === "Sale") {
435 399
               isSaleValue = true;
436 400
             } else isSaleValue = false;
437 401
             this.property.isSale = isSaleValue;
@@ -457,10 +421,10 @@ export default {
457 421
       }
458 422
 
459 423
       if (
460
-        this.showPropertyTypeError
461
-        || this.showProvinceError
462
-        || this.showCityError
463
-        || this.showSuburbError
424
+        this.showPropertyTypeError ||
425
+        this.showProvinceError ||
426
+        this.showCityError ||
427
+        this.showSuburbError
464 428
       ) {
465 429
         return;
466 430
       }
@@ -481,7 +445,7 @@ export default {
481 445
       this.property.propertyImages = this.propertyImages;
482 446
       // eslint-disable-next-line no-plusplus
483 447
       for (let i = 0; i < this.property.propertyImages.length; i++) {
484
-        this.property.propertyImages[i].image = '';
448
+        this.property.propertyImages[i].image = "";
485 449
       }
486 450
       this.property.propertyOverviewFields = this.propertyOverviewFields;
487 451
       this.property.propertyFields = this.propertyFields;
@@ -489,11 +453,11 @@ export default {
489 453
         property: this.property,
490 454
         images: this.newPropertyImages,
491 455
       }).then(() => {
492
-        this.$router.push('/properties');
456
+        this.$router.push("/properties");
493 457
       });
494 458
     },
495 459
     Close() {
496
-      this.$router.push('/properties');
460
+      this.$router.push("/properties");
497 461
     },
498 462
     loadedImages(values) {
499 463
       this.images = values;
@@ -502,7 +466,7 @@ export default {
502 466
       this.defaultImage = item;
503 467
     },
504 468
     DeleteImage(image) {
505
-      this.propertyImages.find(item => item.id === image.id).isDeleted = true;
469
+      this.propertyImages.find((item) => item.id === image.id).isDeleted = true;
506 470
     },
507 471
   },
508 472
   mounted() {
@@ -517,8 +481,8 @@ export default {
517 481
     if (this.propertyFields.length > 0) {
518 482
       this.propertyFields = [];
519 483
     }
520
-    if (this.property.description !== '') {
521
-      this.property.description = '';
484
+    if (this.property.description !== "") {
485
+      this.property.description = "";
522 486
     }
523 487
 
524 488
     if (this.$route.params.propertyUsageType) {
@@ -531,29 +495,28 @@ export default {
531 495
     this.getListsForPropertyEdit(this.$route.query.id);
532 496
 
533 497
     this.getSavedPropertyData(
534
-      Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
498
+      Object.assign({}, { id: this.$route.query.id, type: this.propertyType })
535 499
     );
536 500
 
537 501
     this.mayEditProperty(this.$route.query.id);
538 502
   },
539 503
   computed: {
540
-    ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
541
-    ...mapState('property', ['propertyTypes']),
542
-    ...mapState('propertyEdit', [
543
-      'propertyOverviewFields',
544
-      'propertyFields',
545
-      'property',
546
-      'propertyImages',
547
-      'mayEdit',
548
-      'newPropertyImages',
504
+    ...mapState("property", ["propertyTypes"]),
505
+    ...mapState("propertyEdit", [
506
+      "propertyOverviewFields",
507
+      "propertyFields",
508
+      "property",
509
+      "propertyImages",
510
+      "mayEdit",
511
+      "newPropertyImages",
549 512
     ]),
550
-    ...mapState('authentication', ['user']),
513
+    ...mapState("authentication", ["user"]),
551 514
     SalesTypeChanged() {
552 515
       if (this.property && this.property.propertyUsageType) {
553 516
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
554 517
         this.propertyType = this.property.propertyUsageType;
555 518
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
556
-        this.salesType = this.property.isSale ? 'Sale' : 'Rental';
519
+        this.salesType = this.property.isSale ? "Sale" : "Rental";
557 520
       }
558 521
 
559 522
       this.getPropertyTypes(this.propertyType);

+ 57
- 165
src/components/property/residential/createProperty/residentialCreate.vue Ver fichero

@@ -38,9 +38,11 @@
38 38
               @change="PropertyTypeSelected"
39 39
             >
40 40
               <option value="0">Please select type *</option>
41
-              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">
42
-                {{ item.description }}
43
-              </option>
41
+              <option
42
+                v-for="item in propertyTypes"
43
+                :value="item.id"
44
+                :key="item.id"
45
+              >{{ item.description }}</option>
44 46
             </select>
45 47
           </div>
46 48
           <div v-if="propertyType === 'Commercial'" class="col-md-2">
@@ -59,6 +61,12 @@
59 61
         <div class="row my-5">
60 62
           <div class="col-md-6">
61 63
             <mapSection v-on:map-location="updateLocation" />
64
+            <input
65
+              type="checkbox"
66
+              v-model="property.showAddress"
67
+              style="margin-right: 10px; margin-top: 10px;"
68
+            />
69
+            <label>Show address on listing</label>
62 70
           </div>
63 71
           <div class="col-md-6">
64 72
             <div class="row">
@@ -68,8 +76,7 @@
68 76
                     for="price"
69 77
                     class="uniSelectLabel"
70 78
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
71
-                    >{{ salesType }} Price</label
72
-                  >
79
+                  >{{ salesType }} Price</label>
73 80
                 </div>
74 81
                 <input
75 82
                   class="form-control uniInput"
@@ -115,7 +122,7 @@
115 122
             </div>
116 123
           </div>
117 124
         </div>
118
-        <div class=" row" />
125
+        <div class="row" />
119 126
 
120 127
         <div class="section-header">
121 128
           <h2>Extra Information</h2>
@@ -195,90 +202,11 @@
195 202
           :savedImages="propertyImages"
196 203
           @DefaultImage="UpdateDefaultImage"
197 204
         />
198
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
199
-          Save
200
-        </button>
201
-        <div v-if="showPropertyTypeError || showProvinceError || showCityError || showSuburbError">
202
-          <p class="alert myError">
203
-            Missing fields. Please fill in all required fields. Marked with *
204
-          </p>
205
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
206
+        <div v-if="showPropertyTypeError">
207
+          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
205 208
         </div>
206 209
         <div v-if="wait" id="preloader"></div>
207
-        <!-- <div class="row">
208
-          <div class="col-md-6">
209
-            <div v-if="!property.addressLine1">
210
-              <label for="unit" class="uniSelectLabel">STREET NUMBER</label>
211
-            </div>
212
-            <input
213
-              class="form-control uniInput"
214
-              type="text"
215
-              name="streetnumber"
216
-              v-model="property.addressLine1"
217
-            />
218
-          </div>
219
-          <div class="col-md-6">
220
-            <div v-if="!property.addressLine2">
221
-              <label for="streetname" class="uniSelectLabel">STREET NAME</label>
222
-            </div>
223
-            <input
224
-              class="form-control uniInput"
225
-              type="text"
226
-              name="streetname"
227
-              id="streetname"
228
-              v-model="property.addressLine2"
229
-            />
230
-          </div>
231
-        </div>
232
-        <div class="row my-3">
233
-          <div class="col-md-6">
234
-            <div v-if="!property.provinceId">
235
-              <label for="province" class="uniSelectLabel">PROVINCE</label>
236
-            </div>
237
-            <input
238
-              class="form-control uniInput"
239
-              type="text"
240
-              name="province"
241
-              v-model="selectedProvince"
242
-            />
243
-          </div>
244
-          <div class="col-md-6">
245
-            <div v-if="!property.cityId">
246
-              <label for="city" class="uniSelectLabel">CITY</label>
247
-            </div>
248
-            <input
249
-              class="form-control uniInput"
250
-              type="text"
251
-              name="city"
252
-              id="city"
253
-              v-model="selectedCity"
254
-            />
255
-          </div>
256
-        </div>
257
-        <div class="row my-3">
258
-          <div class="col-md-6">
259
-            <div v-if="!property.suburbId">
260
-              <label for="suburb" class="uniSelectLabel">SUBURB</label>
261
-            </div>
262
-            <input
263
-              class="form-control uniInput"
264
-              type="text"
265
-              name="suburb"
266
-              v-model="selectedSuburb"
267
-            />
268
-          </div>
269
-          <div class="col-md-6">
270
-            <div v-if="!property.addressLine3">
271
-              <label for="code" class="uniSelectLabel">POSTAL CODE</label>
272
-            </div>
273
-            <input
274
-              class="form-control uniInput"
275
-              type="text"
276
-              name="code"
277
-              id="code"
278
-              v-model="property.addressLine3"
279
-            />
280
-          </div>
281
-        </div> -->
282 210
       </div>
283 211
     </main>
284 212
   </div>
@@ -301,15 +229,12 @@ export default {
301 229
     ImageLoad,
302 230
     VueEditor,
303 231
     carouselSection,
304
-    mapSection
232
+    mapSection,
305 233
   },
306 234
   data() {
307 235
     return {
308 236
       propertyType: "Residential",
309 237
       salesType: "Rental",
310
-      selectedProvince: "",
311
-      selectedCity: "",
312
-      selectedSuburb: "",
313 238
       images: [],
314 239
       propertyFieldValues: [],
315 240
       defaultImage: 0,
@@ -317,23 +242,25 @@ export default {
317 242
       customToolbar: [
318 243
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
319 244
         ["bold", "italic", "underline", "strike"],
320
-        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
245
+        [
246
+          { align: "" },
247
+          { align: "center" },
248
+          { align: "right" },
249
+          { align: "justify" },
250
+        ],
321 251
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
322 252
         [{ script: "sub" }, { script: "super" }],
323
-        [{ indent: "-1" }, { indent: "+1" }]
253
+        [{ indent: "-1" }, { indent: "+1" }],
324 254
       ],
325 255
       error: "",
256
+      addressSet: false,
326 257
       showPropertyTypeError: false,
327
-      showProvinceError: false,
328
-      showCityError: false,
329
-      showSuburbError: false,
330 258
       showDateError: false,
331 259
       user: Log.getUser(),
332
-      mayEdit: Log.isLoggedIn()
260
+      mayEdit: Log.isLoggedIn(),
333 261
     };
334 262
   },
335 263
   methods: {
336
-    ...mapActions("searchTab", ["getProvince", "getCities", "getSuburbs"]),
337 264
     ...mapActions("property", [
338 265
       "getPropertyTypes",
339 266
       "getPropertyOverviewFields",
@@ -341,20 +268,22 @@ export default {
341 268
       "saveProperty",
342 269
       "getProperty",
343 270
       "getPropertyImages",
344
-      "clearProperty",
345 271
       "clearPropertyImages",
346 272
       "getPropertyEditDisplay",
347 273
       "getPropertySavedOverviewFields",
348 274
       "getPropertySavedFields",
349
-      "getSavedPropertyData"
275
+      "getSavedPropertyData",
350 276
     ]),
351 277
     updateLocation(place) {
352
-      this.property.addressLine1 = place.mapComponents[0].short_name;
353
-      this.property.addressLine2 = place.mapComponents[1].short_name;
354
-      this.property.addressLine3 = place.mapComponents[7].short_name;
355
-      this.property.provinceId = place.provinceId;
356
-      this.property.cityId = place.cityId;
357
-      this.property.suburbId = place.suburbId;
278
+      this.addressSet = true;
279
+      this.property.streetNumber = place.streetNumber;
280
+      this.property.streetName = place.streetName;
281
+      this.property.suburb = place.suburb;
282
+      this.property.city = place.city;
283
+      this.property.province = place.province;
284
+      this.property.country = place.country;
285
+      this.property.postalCode = place.postalCode;
286
+      this.property.addressUrl = place.url;
358 287
       this.property.propertCoords = place.coords;
359 288
     },
360 289
     TypeChanged() {
@@ -364,27 +293,15 @@ export default {
364 293
       if (this.property.propertyTypeId === 0) {
365 294
         this.showPropertyTypeError = true;
366 295
       }
367
-      if (this.property.provinceId === 0) {
368
-        this.showProvinceError = true;
369
-      }
370
-      if (this.property.cityId === 0) {
371
-        this.showCityError = true;
372
-      }
373
-      if (this.property.suburbId === 0) {
374
-        this.showSuburbError = true;
375
-      }
376 296
 
377
-      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
297
+      if (
298
+        this.salesType === "Rental" &&
299
+        this.property.dateAvailable === "undef"
300
+      ) {
378 301
         this.showDateError = true;
379 302
       }
380 303
 
381
-      if (
382
-        this.showPropertyTypeError ||
383
-        this.showProvinceError ||
384
-        this.showCityError ||
385
-        this.showSuburbError ||
386
-        this.showDateError
387
-      ) {
304
+      if (this.showPropertyTypeError || this.showDateError) {
388 305
         return;
389 306
       }
390 307
 
@@ -393,6 +310,9 @@ export default {
393 310
         this.property.isSale = true;
394 311
         this.property.dateAvailable = new Date();
395 312
       }
313
+      if (this.images.length > 0) {
314
+        this.property.propertyImages = [];
315
+      }
396 316
       // eslint-disable-next-line no-plusplus
397 317
       for (let i = 0; i < this.images.length; i++) {
398 318
         let setAsDefault = false;
@@ -401,7 +321,7 @@ export default {
401 321
         }
402 322
         this.property.propertyImages.push({
403 323
           image: this.images[i],
404
-          isDefault: setAsDefault
324
+          isDefault: setAsDefault,
405 325
         });
406 326
       }
407 327
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -411,10 +331,12 @@ export default {
411 331
       }
412 332
 
413 333
       this.saveProperty(this.property)
414
-        .then(fulfilled => {
415
-          this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
334
+        .then((fulfilled) => {
335
+          this.$router.push(
336
+            `/property/residential/property/${fulfilled.data.id}`
337
+          );
416 338
         })
417
-        .catch(error => {
339
+        .catch((error) => {
418 340
           console.log(error.message);
419 341
         });
420 342
     },
@@ -431,40 +353,12 @@ export default {
431 353
         this.showPropertyTypeError = true;
432 354
       }
433 355
     },
434
-    ProvinceSelected(item) {
435
-      if (item.target.options.selectedIndex > 0) {
436
-        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
437
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
438
-        this.showProvinceError = false;
439
-      } else {
440
-        this.showProvinceError = true;
441
-      }
442
-    },
443
-    CitySelected(item) {
444
-      if (item.target.options.selectedIndex > 0) {
445
-        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
446
-        this.getSuburbs(
447
-          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity })
448
-        );
449
-        this.showCityError = false;
450
-      } else {
451
-        this.showCityError = true;
452
-      }
453
-    },
454
-    getPostalCode(item) {
455
-      this.property.addressLine3 = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
456
-      if (item.target.options.selectedIndex > 0) {
457
-        this.showSuburbError = false;
458
-      } else {
459
-        this.showSuburbError = true;
460
-      }
461
-    },
462 356
     loadedImages(values) {
463 357
       this.images = values;
464 358
     },
465 359
     UpdateUserDefinedFields(item) {
466 360
       let update = false;
467
-      this.propertyFieldValues.forEach(element => {
361
+      this.propertyFieldValues.forEach((element) => {
468 362
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
469 363
           element.value = item.value;
470 364
           update = true;
@@ -476,11 +370,11 @@ export default {
476 370
     },
477 371
     UpdateDefaultImage(item) {
478 372
       this.defaultImage = item;
479
-    }
373
+    },
480 374
   },
481 375
   mounted() {
482 376
     this.wait = false;
483
-    this.clearProperty();
377
+    this.getProperty(0);
484 378
     this.clearPropertyImages();
485 379
     this.images = [];
486 380
     this.defaultImage = 0;
@@ -502,18 +396,16 @@ export default {
502 396
 
503 397
     this.getPropertyTypes(this.propertyType);
504 398
 
505
-    this.getProvince();
506 399
     this.getPropertyOverviewFields();
507 400
     this.getPropertyFields(this.propertyType);
508 401
   },
509 402
   computed: {
510
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"]),
511 403
     ...mapState("property", [
512 404
       "propertyTypes",
513 405
       "propertyOverviewFields",
514 406
       "propertyFields",
515 407
       "property",
516
-      "propertyImages"
408
+      "propertyImages",
517 409
     ]),
518 410
     ...mapState("authentication", ["user"]),
519 411
     SalesTypeChanged() {
@@ -533,13 +425,13 @@ export default {
533 425
       this.getPropertyTypes(this.propertyType);
534 426
 
535 427
       return this.propertyType;
536
-    }
428
+    },
537 429
   },
538 430
   watch: {
539 431
     SalesTypeChanged() {
540 432
       return null;
541
-    }
542
-  }
433
+    },
434
+  },
543 435
 };
544 436
 </script>
545 437
 

+ 27
- 154
src/components/property/residential/residentialCarouselSection.vue Ver fichero

@@ -18,8 +18,7 @@
18 18
                     aria-controls="buy"
19 19
                     aria-selected="true"
20 20
                     @click="SetSalesType('Sale')"
21
-                    >Buy</a
22
-                  >
21
+                  >Buy</a>
23 22
                 </li>
24 23
                 <li class="nav-item">
25 24
                   <a
@@ -31,8 +30,7 @@
31 30
                     aria-controls="rent"
32 31
                     aria-selected="false"
33 32
                     @click="SetSalesType('Rent')"
34
-                    >Rent</a
35
-                  >
33
+                  >Rent</a>
36 34
                 </li>
37 35
               </ul>
38 36
               <div class="tab-content" id="pills-tabContent">
@@ -49,117 +47,24 @@
49 47
                   <h4>PROPERTIES FOR SALE</h4>
50 48
                   <div class="row">
51 49
                     <div align="left" class="form-group col-md-12">
52
-                      <autoComplete
53
-                        align="left"
54
-                        class="col-md-11 offset-1"
55
-                        :items="suburbList"
56
-                        @selection="SelectedFilter"
57
-                        style="width:100%; margin-left:-15px"
58
-                      />
50
+                      <autoComplete @GoogleAddress="UpdateAddress" />
59 51
                     </div>
60
-                    <!-- <div class="form-group col-md-6">
61
-                    <input
62
-                      data-toggle="dropdown"
63
-                      name="region"
64
-                      class="form-control my-2"
65
-                      id="name"
66
-                      placeholder="Region"
67
-                      aria-haspopup="true"
68
-                      aria-expanded="false"
69
-                    />
70
-                    
71
-                    <input
72
-                      data-toggle="dropdown"
73
-                      name="town"
74
-                      class="form-control my-2"
75
-                      id="name"
76
-                      placeholder="Town"
77
-                      aria-haspopup="true"
78
-                      aria-expanded="false"
79
-                    />
80 52
                   </div>
81
-                  <div class="form-group col-md-6">
82
-                    <input
83
-                      data-toggle="dropdown"
84
-                      name="suburb"
85
-                      class="form-control my-2"
86
-                      id="name"
87
-                      placeholder="Suburb"
88
-                      aria-haspopup="true"
89
-                      aria-expanded="false"
90
-                    />
91
-                    <input
92
-                      data-toggle="dropdown"
93
-                      name="type"
94
-                      class="form-control my-2"
95
-                      id="name"
96
-                      placeholder="Property Type"
97
-                      aria-haspopup="true"
98
-                      aria-expanded="false"
99
-                    /> -->
100
-                    <!-- </div> -->
101
-                  </div>
102
-                  <a v-on:click="SearchClick" class="btn-solid-blue"
103
-                    ><i class="fa fa-search"></i> SEARCH</a
104
-                  >
53
+                  <a v-on:click="SearchClick" class="btn-solid-blue">
54
+                    <i class="fa fa-search"></i> SEARCH
55
+                  </a>
105 56
                 </div>
106 57
 
107 58
                 <div class="tab-pane fade" id="rent" role="tabpanel" aria-labelledby="rent-tab">
108 59
                   <h4>RENTAL PROPERTIES</h4>
109 60
                   <div class="row">
110 61
                     <div align="left" class="form-group col">
111
-                      <autoComplete
112
-                        align="left"
113
-                        class="col-md-11 offset-1"
114
-                        :items="suburbList"
115
-                        @selection="SelectedFilter"
116
-                        style="width:100%; margin-left:-15px"
117
-                      />
62
+                      <autoComplete @GoogleAddress="UpdateAddress" />
118 63
                     </div>
119
-                    <!-- <div class="form-group col-md-6">
120
-                    <input
121
-                      data-toggle="dropdown"
122
-                      name="region"
123
-                      class="form-control my-2"
124
-                      id="name"
125
-                      placeholder="Region"
126
-                      aria-haspopup="true"
127
-                      aria-expanded="false"
128
-                    />
129
-                    <input
130
-                      data-toggle="dropdown"
131
-                      name="town"
132
-                      class="form-control my-2"
133
-                      id="name"
134
-                      placeholder="Town"
135
-                      aria-haspopup="true"
136
-                      aria-expanded="false"
137
-                    />
138
-                  </div>
139
-                  <div class="form-group col-md-6">
140
-                    <input
141
-                      data-toggle="dropdown"
142
-                      name="suburb"
143
-                      class="form-control my-2"
144
-                      id="name"
145
-                      placeholder="Suburb"
146
-                      aria-haspopup="true"
147
-                      aria-expanded="false"
148
-                    />
149
-                    <input
150
-                      data-toggle="dropdown"
151
-                      name="type"
152
-                      class="form-control my-2"
153
-                      id="name"
154
-                      placeholder="Property Type"
155
-                      aria-haspopup="true"
156
-                      aria-expanded="false"
157
-                    />
158
-                  </div> -->
159 64
                   </div>
160
-                  <a v-on:click="SearchClick" class="btn-solid-blue"
161
-                    ><i class="fa fa-search"></i> FIND</a
162
-                  >
65
+                  <a v-on:click="SearchClick" class="btn-solid-blue">
66
+                    <i class="fa fa-search"></i> FIND
67
+                  </a>
163 68
                 </div>
164 69
               </div>
165 70
             </div>
@@ -177,42 +82,12 @@
177 82
         style="margin-top:-50px"
178 83
         :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
179 84
       >
180
-        <img
181
-          class="item"
182
-          src="img/intro-carousel/residential-1.jpg"
183
-          style="object-fit: cover"
184
-          alt=""
185
-        />
186
-        <img
187
-          class="item"
188
-          src="img/intro-carousel/residential-2.jpg"
189
-          style="object-fit: cover"
190
-          alt=""
191
-        />
192
-        <img
193
-          class="item"
194
-          src="img/intro-carousel/residential-3.jpg"
195
-          style="object-fit: cover"
196
-          alt=""
197
-        />
198
-        <img
199
-          class="item"
200
-          src="img/intro-carousel/residential-4.jpg"
201
-          style="object-fit: cover"
202
-          alt=""
203
-        />
204
-        <img
205
-          class="item"
206
-          src="img/intro-carousel/residential-5.jpg"
207
-          style="object-fit: cover"
208
-          alt=""
209
-        />
210
-        <img
211
-          class="item"
212
-          src="img/intro-carousel/residential-6.jpg"
213
-          style="object-fit: cover"
214
-          alt=""
215
-        />
85
+        <img class="item" src="img/intro-carousel/residential-1.jpg" style="object-fit: cover" alt />
86
+        <img class="item" src="img/intro-carousel/residential-2.jpg" style="object-fit: cover" alt />
87
+        <img class="item" src="img/intro-carousel/residential-3.jpg" style="object-fit: cover" alt />
88
+        <img class="item" src="img/intro-carousel/residential-4.jpg" style="object-fit: cover" alt />
89
+        <img class="item" src="img/intro-carousel/residential-5.jpg" style="object-fit: cover" alt />
90
+        <img class="item" src="img/intro-carousel/residential-6.jpg" style="object-fit: cover" alt />
216 91
       </carousel>
217 92
     </section>
218 93
     <main id="main" style="margin-top:-20px">
@@ -237,36 +112,32 @@
237 112
 <script>
238 113
 /* eslint-disable */
239 114
 import { mapState, mapActions } from "vuex";
240
-import autoComplete from "../../shared/autoComplete";
115
+import autoComplete from "../../shared/addressAutoComplete";
241 116
 import carousel from "vue-owl-carousel";
242 117
 import searchResult from "../propertySearchResults";
243 118
 export default {
244 119
   components: {
245 120
     carousel,
246 121
     autoComplete,
247
-    searchResult
122
+    searchResult,
248 123
   },
249 124
   data() {
250 125
     return {
251 126
       propertyUsageType: "Residential",
252 127
       salesType: "Sale",
253 128
       searchText: "",
254
-      clicked: false
129
+      clicked: false,
255 130
     };
256 131
   },
257 132
   computed: {
258
-    ...mapState("propertySearch", ["suburbs", "suburbList", "propertySearch"])
133
+    ...mapState("propertySearch", ["propertySearch"]),
259 134
   },
260 135
   methods: {
261
-    ...mapActions("propertySearch", ["getSuburbs", "applyFilter"]),
136
+    ...mapActions("propertySearch", ["applyFilter"]),
262 137
     SetSalesType(value) {
263 138
       this.salesType = value;
264 139
     },
265 140
     SearchClick() {
266
-      const item = this.suburbs.find(s => s.display === this.searchText);
267
-      this.propertySearch.province = item.province;
268
-      this.propertySearch.city = item.city;
269
-      this.propertySearch.suburb = item.suburb;
270 141
       this.propertySearch.propertyUsageType = this.propertyUsageType;
271 142
       this.propertySearch.salesType = this.salesType;
272 143
 
@@ -275,11 +146,13 @@ export default {
275 146
     },
276 147
     SelectedFilter(item) {
277 148
       this.searchText = item;
278
-    }
149
+    },
150
+    UpdateAddress(place) {
151
+      this.propertySearch.province = place.province;
152
+      this.propertySearch.city = place.city;
153
+      this.propertySearch.suburb = place.suburb;
154
+    },
279 155
   },
280
-  mounted() {
281
-    this.getSuburbs();
282
-  }
283 156
 };
284 157
 </script>
285 158
 

+ 26
- 18
src/components/property/residential/residentialSearchResults.vue Ver fichero

@@ -2,7 +2,7 @@
2 2
   <main id="main" style="margin-top:-20px; padding-bottom:50px">
3 3
     <section>
4 4
       <div class="container">
5
-        <div class="row pt-5  justify-content-md-center">
5
+        <div class="row pt-5 justify-content-md-center">
6 6
           <h3 v-if="propertySearch.salesType === 'Sale'">RESIDENTIAL PROPERTIES FOR SALE</h3>
7 7
           <h3 v-else-if="propertySearch.salesType === 'Rent'">RESIDENTIAL PROPERTIES FOR RENT</h3>
8 8
         </div>
@@ -14,21 +14,17 @@
14 14
           >
15 15
             <div>
16 16
               <div class="portfolio-item">
17
-                <img style="width:255px; height:255px" :src="currentProperty.displayImage" alt="" />
17
+                <img style="width:255px; height:255px" :src="currentProperty.displayImage" alt />
18 18
 
19 19
                 <h4 class="mt-3">{{ currentProperty.suburb }}</h4>
20
-                <p>
21
-                  Opposite Monument Park Spar, Pretoria! Secure Parking. A stand-alone building,
22
-                  situated in the best location. Incredible bargain!
23
-                </p>
20
+                <p>{{currentProperty.shortDescription }}</p>
24 21
                 <br />
25 22
 
26 23
                 <!-- <a href="commercialproperty-page.php" class="btn-white-border">VIEW</a> -->
27 24
                 <router-link
28 25
                   class="btn-white-border"
29 26
                   :to="`/property/residential/property/${currentProperty.id}`"
30
-                  >VIEW</router-link
31
-                >
27
+                >VIEW</router-link>
32 28
               </div>
33 29
             </div>
34 30
           </div>
@@ -41,6 +37,7 @@
41 37
             <p>Sorry no listings where found matching your search</p>
42 38
           </div>
43 39
         </div>
40
+        <div v-if="wait" id="preloader"></div>
44 41
       </div>
45 42
     </section>
46 43
   </main>
@@ -54,12 +51,15 @@ import propertyCard from "../propertyCard";
54 51
 export default {
55 52
   name: "propertysearch",
56 53
   components: {
57
-    propertyCard
54
+    propertyCard,
58 55
   },
59 56
   data() {
60
-    return {};
57
+    return {
58
+      wait: true,
59
+    };
61 60
   },
62 61
   mounted() {
62
+    this.wait = true;
63 63
     console.log(this.propertySearch.salesType);
64 64
 
65 65
     if (typeof this.propertySearch.propertyUsageType === "undefined") {
@@ -69,13 +69,15 @@ export default {
69 69
       this.propertySearch.userName = this.user.username;
70 70
     }
71 71
 
72
-    this.searchProperties(this.propertySearch);
72
+    this.searchProperties(this.propertySearch).then((fulfilled) => {
73
+      this.wait = false;
74
+    });
73 75
   },
74 76
   methods: {
75 77
     ...mapActions("propertySearch", [
76 78
       "searchProperties",
77 79
       "clearProperties",
78
-      "updateResultsShowing"
80
+      "updateResultsShowing",
79 81
     ]),
80 82
     SetType(item) {
81 83
       this.propertySearch.propertyUsageType = item;
@@ -83,10 +85,14 @@ export default {
83 85
     SearchPage() {
84 86
       this.clearProperties();
85 87
       this.$router.push("/property/search");
86
-    }
88
+    },
87 89
   },
88 90
   computed: {
89
-    ...mapState("propertySearch", ["properties", "propertySearch", "resultsShowing"]),
91
+    ...mapState("propertySearch", [
92
+      "properties",
93
+      "propertySearch",
94
+      "resultsShowing",
95
+    ]),
90 96
     ...mapState("authentication", ["user"]),
91 97
     ParamsChanged() {
92 98
       console.log(JSON.stringify(this.propertySearch));
@@ -94,15 +100,17 @@ export default {
94 100
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
95 101
         this.propertySearch.propertyUsageType = "Residential";
96 102
       }
97
-      this.searchProperties(this.propertySearch);
103
+      this.searchProperties(this.propertySearch).then((fulfilled) => {
104
+        this.wait = false;
105
+      });
98 106
       return null;
99
-    }
107
+    },
100 108
   },
101 109
   watch: {
102 110
     ParamsChanged() {
103 111
       return null;
104
-    }
105
-  }
112
+    },
113
+  },
106 114
 };
107 115
 </script>
108 116
 

+ 42
- 32
src/components/property/residential/singleView/contentSection.vue Ver fichero

@@ -22,18 +22,21 @@
22 22
           </div>
23 23
           <div class="panel-left p-5" style="margin-top:130px">
24 24
             <h2>Property Detial</h2>
25
-            <p>{{ property.addressLine1 }} {{ property.addressLine2 }}</p>
26
-
27
-            <p>{{ property.city.description }}, {{ property.suburb.description }}</p>
25
+            <p v-if="property.showAddress">{{ property.addressOther }}</p>
26
+            <p v-if="property.showAddress">{{ property.streetNumber }} {{ property.streetName }}</p>
27
+            <p>{{ property.suburb }}, {{ property.city }}</p>
28 28
             <p>{{ property.shortDescription }}</p>
29 29
             <p>{{ property.price | toCurrency }}</p>
30
-            <div class="btn-white-border"><i class="fa fa-search"></i>BOOK A VIEWING</div>
30
+            <div class="btn-white-border">
31
+              <i class="fa fa-search"></i>BOOK A VIEWING
32
+            </div>
31 33
           </div>
32 34
         </div>
33 35
         <div class="col-md-8 p-5 resort-profile">
34
-          <h2>
35
-            {{ property.propertyName }} / {{ property.addressLine1 }} {{ property.addressLine2 }}
36
-          </h2>
36
+          <h2
37
+            v-if="property.showAddress"
38
+          >{{ property.propertyName }} / {{ property.streetNumber }} {{ property.streetName }}</h2>
39
+          <h2 v-else>{{ property.propertyName }}</h2>
37 40
           <div class="container">
38 41
             <div class="row">
39 42
               <div class="col">
@@ -64,7 +67,7 @@
64 67
                   <td><a href="#" class="btn-solid-blue">BOOK A VIEWING</a></td>
65 68
                 </tr>
66 69
               </tbody>
67
-            </table> -->
70
+            </table>-->
68 71
             <div v-for="(data, i) in property.displayData" :key="i">
69 72
               <div class="content-header">
70 73
                 <h2>{{ data.groupName }}</h2>
@@ -72,16 +75,20 @@
72 75
               <table class="table table-striped">
73 76
                 <thead>
74 77
                   <tr>
75
-                    <th v-for="(tableHead, j) in data.values" :key="j" scope="col">
76
-                      {{ tableHead.name }}
77
-                    </th>
78
+                    <th
79
+                      v-for="(tableHead, j) in data.values"
80
+                      :key="j"
81
+                      scope="col"
82
+                    >{{ tableHead.name }}</th>
78 83
                   </tr>
79 84
                 </thead>
80 85
                 <tbody>
81 86
                   <tr>
82
-                    <td v-for="(tableVal, k) in data.values" :key="k" scope="col">
83
-                      {{ tableVal.value }}
84
-                    </td>
87
+                    <td
88
+                      v-for="(tableVal, k) in data.values"
89
+                      :key="k"
90
+                      scope="col"
91
+                    >{{ tableVal.value }}</td>
85 92
                   </tr>
86 93
                 </tbody>
87 94
               </table>
@@ -112,40 +119,43 @@ import { mapState, mapActions } from "vuex";
112 119
 import gallery from "../../../shared/gallerySlideShow";
113 120
 export default {
114 121
   components: {
115
-    gallery
122
+    gallery,
116 123
   },
117 124
   props: {
118 125
     property: {},
119
-    propertyImages: {}
126
+    propertyImages: {},
120 127
   },
121 128
   created() {
122
-    this.getListsForPropertyEdit(this.property.id);
129
+    //this.getListsForPropertyEdit(this.property.id);
123 130
     console.log(this.property.displayData);
124 131
   },
125 132
   data() {
126 133
     return {
127 134
       index: null,
128
-      date: new Date()
135
+      date: new Date(),
129 136
     };
130 137
   },
131 138
   methods: {
132
-    ...mapActions("searchTab", ["getListsForPropertyEdit"])
139
+    //...mapActions("searchTab", ["getListsForPropertyEdit"])
133 140
   },
134 141
   computed: {
135
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"]),
142
+    //...mapState("searchTab", ["provinces", "cities", "suburbs"]),
136 143
     propertyMap() {
137
-      var lat = this.property.propertCoords.split(",")[0];
138
-      var lng = this.property.propertCoords.split(",")[1];
139
-      // var url =
140
-      //   "https://maps.google.com/maps?q=" +
141
-      //   lat.replace(".", ",") +
142
-      //   "," +
143
-      //   lng.replace(".", ",") +
144
-      //   "&hl=es&z=14&amp;output=embed";
145
-      var url = "";
146
-      return url;
147
-    }
148
-  }
144
+      if (this.property.propertCoords) {
145
+        var lat = this.property.propertCoords.split(",")[0];
146
+        var lng = this.property.propertCoords.split(",")[1];
147
+        // var url =
148
+        //   "https://maps.google.com/maps?q=" +
149
+        //   lat.replace(".", ",") +
150
+        //   "," +
151
+        //   lng.replace(".", ",") +
152
+        //   "&hl=es&z=14&amp;output=embed";
153
+        var url = "";
154
+        return url;
155
+      }
156
+      return "";
157
+    },
158
+  },
149 159
 };
150 160
 </script>
151 161
 

+ 24
- 20
src/components/shared/addressAutoComplete.vue Ver fichero

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div>
3
-    <gmap-autocomplete class="form-control" @place_changed="setPlace"></gmap-autocomplete>
3
+    <gmap-autocomplete class="form-control mb-3 uniInput" @place_changed="setPlace"></gmap-autocomplete>
4 4
   </div>
5 5
 </template>
6 6
 
@@ -9,8 +9,8 @@ export default {
9 9
   name: "AddressAutoComplete",
10 10
   props: {
11 11
     placeholder: {
12
-      default: "ENTER LOCATION"
13
-    }
12
+      default: "ENTER LOCATION",
13
+    },
14 14
   },
15 15
   data() {
16 16
     return {
@@ -21,7 +21,8 @@ export default {
21 21
       province: "",
22 22
       country: "",
23 23
       postalCode: "",
24
-      url: ""
24
+      url: "",
25
+      coords: {},
25 26
     };
26 27
   },
27 28
   methods: {
@@ -34,7 +35,7 @@ export default {
34 35
       this.country = "";
35 36
       this.postalCode = "";
36 37
       this.url = "";
37
-
38
+      this.coords = {};
38 39
       for (let i = 0; i < place.address_components.length; i++) {
39 40
         if (place.address_components[i].types[0] === "street_number") {
40 41
           this.streetNumber = place.address_components[i].long_name;
@@ -48,7 +49,9 @@ export default {
48 49
         if (place.address_components[i].types[0] === "locality") {
49 50
           this.city = place.address_components[i].long_name;
50 51
         }
51
-        if (place.address_components[i].types[0] === "administrative_area_level_1") {
52
+        if (
53
+          place.address_components[i].types[0] === "administrative_area_level_1"
54
+        ) {
52 55
           this.province = place.address_components[i].long_name;
53 56
         }
54 57
         if (place.address_components[i].types[0] === "country") {
@@ -57,20 +60,21 @@ export default {
57 60
         if (place.address_components[i].types[0] === "postal_code") {
58 61
           this.postalCode = place.address_components[i].long_name;
59 62
         }
60
-        this.url = place.url;
61
-
62
-        this.$emit("GoogleAddress", {
63
-          streetNumber: this.streetNumber,
64
-          streetName: this.streetName,
65
-          suburb: this.suburb,
66
-          city: this.city,
67
-          province: this.province,
68
-          country: this.country,
69
-          postalCode: this.postalCode,
70
-          url: this.url
71
-        });
72 63
       }
73
-    }
74
-  }
64
+      this.url = place.url;
65
+      this.coords = place.geometry.location;
66
+      this.$emit("GoogleAddress", {
67
+        streetNumber: this.streetNumber,
68
+        streetName: this.streetName,
69
+        suburb: this.suburb,
70
+        city: this.city,
71
+        province: this.province,
72
+        country: this.country,
73
+        postalCode: this.postalCode,
74
+        url: this.url,
75
+        coords: this.coords,
76
+      });
77
+    },
78
+  },
75 79
 };
76 80
 </script>

+ 20
- 45
src/components/user/timeshareIndividual.vue Ver fichero

@@ -2,7 +2,7 @@
2 2
   <div class="form">
3 3
     <div id="sendmessage">Your details has been sent. Thank you!</div>
4 4
     <div id="errormessage"></div>
5
-    <form action="" method="post" role="form" class="contactForm">
5
+    <form action method="post" role="form" class="contactForm">
6 6
       <div class="form-row">
7 7
         <div class="form-group col-md-10">
8 8
           <div class="section-header">
@@ -146,7 +146,7 @@ export default {
146 146
     BankAccount,
147 147
     Address,
148 148
     SelectIndividual,
149
-    propField
149
+    propField,
150 150
   },
151 151
   data() {
152 152
     return {
@@ -159,52 +159,33 @@ export default {
159 159
         cellNumber: undefined,
160 160
         landlineNumber: undefined,
161 161
         bankingDetails: {},
162
-        address: {}
163
-      }
162
+        address: {},
163
+      },
164 164
     };
165 165
   },
166 166
   props: {
167 167
     showChangeCurrentUser: {
168
-      default: false
168
+      default: false,
169 169
     },
170 170
     showBank: {
171
-      default: false
171
+      default: false,
172 172
     },
173 173
     showAddress: {
174
-      default: false
175
-    }
174
+      default: false,
175
+    },
176 176
   },
177 177
   computed: {
178 178
     ...mapState("timeshare", ["maritalStatus"]),
179 179
     ...mapState("individual", ["indiv"]),
180
-    ...mapState("searchTab", ["provinces", "cities", "suburbs"]),
181 180
     ...mapGetters({
182
-      user: "authentication/getUser"
183
-    })
181
+      user: "authentication/getUser",
182
+    }),
184 183
   },
185 184
   methods: {
186 185
     ...mapActions("individual", ["getIndividual", "updateIndividual"]),
187
-    ...mapActions("searchTab", ["getProvince", "getCities", "getSuburbs"]),
188 186
     onSelectedItemItemChange(item) {
189 187
       this.currentUser = item;
190 188
     },
191
-    ProvinceSelected(item) {
192
-      if (item.target.options.selectedIndex > 0) {
193
-        this.selectedProvince = this.provinces[item.target.options.selectedIndex - 1].description;
194
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
195
-      }
196
-    },
197
-    CitySelected(item) {
198
-      if (item.target.options.selectedIndex > 0) {
199
-        this.selectedCity = this.cities[item.target.options.selectedIndex - 1].description;
200
-        this.getSuburbs(
201
-          Object.assign({}, { province: this.selectedProvince, city: this.selectedCity })
202
-        );
203
-      }
204
-    },
205
-    getPostalCode(item) {
206
-      this.address.postalCode = this.suburbs[item.target.options.selectedIndex - 1].postalCode;
207
-    },
208 189
     UpdateValue(item) {
209 190
       if (item.fieldName) {
210 191
         if (item.fieldName === "name") {
@@ -239,7 +220,9 @@ export default {
239 220
         }
240 221
         if (item.fieldName === "province") {
241 222
           if (item.value !== "") {
242
-            this.address.province = this.provinces.find(p => p.description === item.value);
223
+            this.address.province = this.provinces.find(
224
+              (p) => p.description === item.value
225
+            );
243 226
             this.address.provinceId = this.address.province.id;
244 227
             this.getCities(Object.assign({}, { province: item.value }));
245 228
             this.address.city = null;
@@ -256,18 +239,11 @@ export default {
256 239
         }
257 240
         if (item.fieldName === "city") {
258 241
           if (item.value !== "") {
259
-            const newCity = this.cities.find(p => p.description === item.value);
242
+            const newCity = this.cities.find(
243
+              (p) => p.description === item.value
244
+            );
260 245
             this.address.city = newCity;
261 246
             this.address.cityId = newCity.id;
262
-            this.getSuburbs(
263
-              Object.assign(
264
-                {},
265
-                {
266
-                  province: this.address.province.description,
267
-                  city: item.value
268
-                }
269
-              )
270
-            );
271 247
             this.address.suburb = null;
272 248
             this.address.postalCode = "";
273 249
           } else {
@@ -279,7 +255,9 @@ export default {
279 255
         }
280 256
         if (item.fieldName === "suburb") {
281 257
           if (item.value !== "") {
282
-            const newSuburb = this.suburbs.find(p => p.description === item.value);
258
+            const newSuburb = this.suburbs.find(
259
+              (p) => p.description === item.value
260
+            );
283 261
             this.address.suburb = newSuburb;
284 262
             this.address.suburbId = newSuburb.id;
285 263
             this.address.postalCode = this.address.suburb.postalCode;
@@ -297,11 +275,8 @@ export default {
297 275
     },
298 276
     Close() {
299 277
       this.$router.push("/status/userManagementPage");
300
-    }
278
+    },
301 279
   },
302
-  mounted() {
303
-    this.getProvince();
304
-  }
305 280
 };
306 281
 </script>
307 282
 

+ 2
- 2
src/main.js Ver fichero

@@ -25,8 +25,8 @@ Vue.use(VueGoogleMaps, {
25 25
 });
26 26
 Vue.config.productionTip = false;
27 27
 //axios.defaults.baseURL = "http://localhost:57260";
28
-//axios.defaults.baseURL = "http://training.provision-sa.com:82";
29
-axios.defaults.baseURL = "http://localhost:8080/";
28
+axios.defaults.baseURL = "http://training.provision-sa.com:82";
29
+//axios.defaults.baseURL = "http://localhost:8080/";
30 30
 
31 31
 Vue.prototype.$axios = axios;
32 32
 

+ 37
- 84
src/store/modules/property/property.js Ver fichero

@@ -1,41 +1,16 @@
1
-import axios from 'axios';
2
-import { Date } from 'core-js';
1
+import axios from "axios";
2
+import { Date } from "core-js";
3 3
 
4 4
 export default {
5 5
   namespaced: true,
6 6
   state: {
7
-    property: {
8
-      createdBy: '',
9
-      propertyTypeId: 0,
10
-      propertyName: '',
11
-      unit: '',
12
-      operationalCosts: 0.0,
13
-      price: 0,
14
-      pricePer: '',
15
-      isSale: false,
16
-      description: '',
17
-      shortDescription: '',
18
-      addressLine1: '',
19
-      addressLine2: '',
20
-      addressLine3: '',
21
-      suburbId: 0,
22
-      cityId: 0,
23
-      provinceId: 0,
24
-      published: false,
25
-      propertyUserFields: [],
26
-      propertyImages: [],
27
-      id: 0,
28
-      virtualTour: '',
29
-      video: '',
30
-      userId: 0,
31
-      dateAvailable: Date,
32
-    },
7
+    property: {},
33 8
     propertyImages: [],
34 9
     propertyTypes: [],
35 10
     propertyTypesRes: [],
36 11
     propertyTypesCom: [],
37 12
     propertyOverviewFields: [],
38
-    propertyFields: [],
13
+    propertyFields: []
39 14
   },
40 15
   mutations: {
41 16
     setProperty(state, property) {
@@ -64,98 +39,70 @@ export default {
64 39
         state.properties.push(property);
65 40
       }
66 41
     },
67
-    clearProperty(state) {
68
-      state.property = {
69
-        createdBy: '',
70
-        propertyTypeId: 0,
71
-        propertyName: '',
72
-        unit: '',
73
-        operationalCosts: 0.0,
74
-        price: 0,
75
-        pricePer: '',
76
-        isSale: false,
77
-        description: '',
78
-        shortDescription: '',
79
-        addressLine1: '',
80
-        addressLine2: '',
81
-        addressLine3: '',
82
-        suburbId: 0,
83
-        cityId: 0,
84
-        provinceId: 0,
85
-        published: false,
86
-        propertyUserFields: [],
87
-        propertyImages: [],
88
-        id: 0,
89
-        virtualTour: '',
90
-        video: '',
91
-        userId: 0,
92
-        dateAvailable: Date,
93
-      };
94
-    },
95 42
     clearPropertyImages(state) {
96 43
       state.propertyImages = [];
97
-    },
44
+    }
98 45
   },
99 46
   getters: {},
100 47
   actions: {
101 48
     getProperty({ commit }, id) {
102 49
       axios
103 50
         .get(`/api/Property/getDetailed/${id}`)
104
-        .then(result => commit('setProperty', result.data))
51
+        .then(result => commit("setProperty", result.data))
105 52
         .catch(console.error);
106 53
     },
107 54
     getPropertyImages({ commit }, id) {
108 55
       axios
109 56
         .get(`/api/PropertyImage/GetImagesByProperty/${id}`)
110
-        .then(result => commit('setPropertyImages', result.data))
57
+        .then(result => commit("setPropertyImages", result.data))
111 58
         .catch(console.error);
112 59
     },
113 60
     getPropertyTypes({ commit }, propertyType) {
114 61
       axios
115 62
         .get(`/api/PropertyType/type/${propertyType}`)
116
-        .then(result => commit('setPropertyTypes', result.data))
63
+        .then(result => commit("setPropertyTypes", result.data))
117 64
         .catch(console.error);
118 65
     },
119 66
     getPropertyTypesRes({ commit }) {
120 67
       axios
121
-        .get('/api/PropertyType/type/Residential')
122
-        .then(result => commit('setPropertyTypesRes', result.data))
68
+        .get("/api/PropertyType/type/Residential")
69
+        .then(result => commit("setPropertyTypesRes", result.data))
123 70
         .catch(console.error);
124 71
     },
125 72
     getPropertyTypesCom({ commit }) {
126 73
       axios
127
-        .get('/api/PropertyType/type/Commercial')
128
-        .then(result => commit('setPropertyTypesCom', result.data))
74
+        .get("/api/PropertyType/type/Commercial")
75
+        .then(result => commit("setPropertyTypesCom", result.data))
129 76
         .catch(console.error);
130 77
     },
131 78
     getPropertyOverviewFields({ commit }) {
132 79
       axios
133
-        .get('/api/PropertyFields/Property Overview')
134
-        .then(response => commit('setPropertyOverviewFields', response.data));
80
+        .get("/api/PropertyFields/Property Overview")
81
+        .then(response => commit("setPropertyOverviewFields", response.data));
135 82
     },
136 83
     getPropertyFields({ commit }, propertyType) {
137 84
       axios
138 85
         .get(`/api/propertyFields/PropertyType/${propertyType}`)
139
-        .then(response => commit('setPropertyFields', response.data));
86
+        .then(response => commit("setPropertyFields", response.data));
140 87
     },
141 88
     getPropertySavedOverviewFields({ commit }, id) {
142 89
       axios
143 90
         .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${id}`)
144
-        .then(response => commit('setPropertyOverviewFields', response.data))
91
+        .then(response => commit("setPropertyOverviewFields", response.data))
145 92
         .catch(console.error);
146 93
     },
147 94
     getPropertySavedFields({ commit }, item) {
148 95
       axios
149 96
         .get(`/api/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`)
150
-        .then(response => commit('setPropertyFields', response.data))
97
+        .then(response => commit("setPropertyFields", response.data))
151 98
         .catch(console.error);
152 99
     },
153 100
     saveProperty({ commit }, item) {
154 101
       return new Promise((resolve, reject) => {
155 102
         axios
156
-          .post('/api/Property', item)
157
-          .then((resp) => {
158
-            commit('updateCurrentProperty', resp);
103
+          .post("/api/Property", item)
104
+          .then(resp => {
105
+            commit("updateCurrentProperty", resp);
159 106
             resolve(resp);
160 107
           })
161 108
           .catch(() => {
@@ -164,40 +111,46 @@ export default {
164 111
       });
165 112
     },
166 113
     clearProperty({ commit }) {
167
-      commit('clearProperty');
114
+      axios
115
+        .get("/api/Property/getDetailed/0")
116
+        .then(result => {
117
+          alert(JSON.stringify(result.data));
118
+          commit("setProperty", result.data);
119
+        })
120
+        .catch(console.error);
168 121
     },
169 122
     clearPropertyImages({ commit }) {
170
-      commit('clearPropertyImages');
123
+      commit("clearPropertyImages");
171 124
     },
172 125
     getSavedPropertyData({ commit }, item) {
173
-      commit('clearProperty');
174
-      commit('clearPropertyImages');
126
+      commit("clearProperty");
127
+      commit("clearPropertyImages");
175 128
 
176 129
       axios
177 130
         .get(`/api/Property/getProperty/${item.id}`)
178
-        .then(result => commit('setProperty', result.data))
131
+        .then(result => commit("setProperty", result.data))
179 132
         .catch(console.error);
180 133
 
181 134
       axios
182 135
         .get(`/api/PropertyImage/GetProperySavedImages/${item.id}`)
183
-        .then(result => commit('setPropertyImages', result.data))
136
+        .then(result => commit("setPropertyImages", result.data))
184 137
         .catch(console.error);
185 138
 
186 139
       axios
187 140
         .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${item.id}`)
188
-        .then(response => commit('setPropertyOverviewFields', response.data))
141
+        .then(response => commit("setPropertyOverviewFields", response.data))
189 142
         .catch(console.error);
190 143
 
191 144
       axios
192 145
         .get(`/api/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`)
193
-        .then(response => commit('setPropertyFields', response.data))
146
+        .then(response => commit("setPropertyFields", response.data))
194 147
         .catch(console.error);
195 148
     },
196 149
     getSavedPropertyImages({ commit }, id) {
197 150
       axios
198 151
         .get(`/api/PropertyImage/GetProperySavedImages/${id}`)
199
-        .then(result => commit('setPropertyImages', result.data))
152
+        .then(result => commit("setPropertyImages", result.data))
200 153
         .catch(console.error);
201
-    },
202
-  },
154
+    }
155
+  }
203 156
 };

+ 57
- 54
src/store/modules/property/propertySearch.js Ver fichero

@@ -1,32 +1,32 @@
1 1
 /* eslint-disable valid-typeof */
2 2
 /* eslint-disable max-len */
3 3
 /* eslint-disable indent */
4
-import axios from 'axios';
5
-import _ from 'lodash';
6
-import log from '../../../assets/Log';
4
+import axios from "axios";
5
+import _ from "lodash";
6
+import log from "../../../assets/Log";
7 7
 
8 8
 export default {
9 9
   namespaced: true,
10 10
   state: {
11 11
     propertySearch: {
12
-      userName: '',
13
-      salesType: 'Sale',
14
-      propertyUsageType: 'All',
15
-      propertyType: 'All',
16
-      province: 'All',
17
-      city: 'All',
18
-      suburb: 'All',
12
+      userName: "",
13
+      salesType: "Sale",
14
+      propertyUsageType: "All",
15
+      propertyType: "All",
16
+      province: "All",
17
+      city: "All",
18
+      suburb: "All",
19 19
       minPrice: 0,
20 20
       maxPrice: 0,
21 21
       availableFrom: undefined,
22
-      propertyId: 0,
22
+      propertyId: 0
23 23
     },
24 24
     properties: [],
25 25
     latestProperties: [],
26 26
     suburbs: [],
27
-    searchText: '',
27
+    searchText: "",
28 28
     suburbList: [],
29
-    resultsShowing: false,
29
+    resultsShowing: false
30 30
   },
31 31
   mutations: {
32 32
     updateSearch(state, propertySearch) {
@@ -40,10 +40,10 @@ export default {
40 40
       state.propertySearch = search;
41 41
     },
42 42
     onClearFilter(state, filter) {
43
-      if (filter === 'availableFrom') {
43
+      if (filter === "availableFrom") {
44 44
         state.propertySearch[filter] = undefined;
45 45
       } else {
46
-        state.propertySearch[filter] = 'All';
46
+        state.propertySearch[filter] = "All";
47 47
       }
48 48
     },
49 49
     setSuburbs(state, items) {
@@ -59,63 +59,66 @@ export default {
59 59
     },
60 60
     setResultsShowing(state, value) {
61 61
       state.resultsShowing = value;
62
-    },
62
+    }
63 63
   },
64 64
   getters: {
65
-    filterSuburbs: (state) => {
65
+    filterSuburbs: state => {
66 66
       let subs = state.suburbs;
67 67
       if (state.searchText) {
68 68
         subs = _.filter(subs, s => s.display.contains(state.searchText));
69 69
       }
70 70
       return subs;
71
-    },
71
+    }
72 72
   },
73 73
   actions: {
74 74
     clearFilter({ commit }, filter) {
75
-      commit('onClearFilter', filter);
75
+      commit("onClearFilter", filter);
76 76
     },
77 77
     searchProperties({ commit }, item) {
78
-      if (item.keyword === '') {
79
-        item.keyword = 'All';
80
-      }
81
-      if (log.isLoggedIn()) {
82
-        item.userName = log.getUser().username;
83
-      } else if (item.userName === '') {
84
-        item.userName = 'Unknown';
85
-      }
86
-      if (item.suburb === '') {
87
-        item.suburb = 'All';
88
-      }
89
-      if (item.city === '') {
90
-        item.city = 'All';
91
-      }
92
-      if (item.province === '') {
93
-        item.province = 'All';
94
-      }
95
-      axios
96
-        .get(
97
-          `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`,
98
-        )
99
-        .then(result => commit('updateSearch', result.data))
100
-        .catch(console.error);
78
+      return new Promise((resolve, reject) => {
79
+        if (item.keyword === "") {
80
+          item.keyword = "All";
81
+        }
82
+        if (log.isLoggedIn()) {
83
+          item.userName = log.getUser().username;
84
+        } else if (item.userName === "") {
85
+          item.userName = "Unknown";
86
+        }
87
+        if (item.suburb === "") {
88
+          item.suburb = "All";
89
+        }
90
+        if (item.city === "") {
91
+          item.city = "All";
92
+        }
93
+        if (item.province === "") {
94
+          item.province = "All";
95
+        }
96
+        console.log(
97
+          `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`
98
+        );
99
+
100
+        axios
101
+          .get(
102
+            `/api/Property/Search/${item.userName}/${item.keyword}/${item.salesType}/${item.propertyUsageType}/${item.propertyType}/${item.province}/${item.city}/${item.suburb}/${item.minPrice}/${item.maxPrice}/${item.availableFrom}/${item.propertyId}`
103
+          )
104
+          .then(result => {
105
+            commit("updateSearch", result.data);
106
+            resolve();
107
+          })
108
+          .catch(errro => reject(new Error(error.message)));
109
+      });
101 110
     },
102 111
     searchLatestProperties({ commit }) {
103 112
       axios
104
-        .get('/api/property/latestProperties')
105
-        .then(response => commit('setLatestProperties', response.data))
106
-        .catch(console.error);
107
-    },
108
-    getSuburbs({ commit }) {
109
-      axios
110
-        .get('/api/suburb/GetSearchList')
111
-        .then(response => commit('setSuburbs', response.data))
113
+        .get("/api/property/latestProperties")
114
+        .then(response => commit("setLatestProperties", response.data))
112 115
         .catch(console.error);
113 116
     },
114 117
     applyFilter({ commit }, value) {
115
-      commit('setFilter', { value });
118
+      commit("setFilter", { value });
116 119
     },
117 120
     updateResultsShowing({ commit }, value) {
118
-      commit('setResultsShowing', value);
119
-    },
120
-  },
121
+      commit("setResultsShowing", value);
122
+    }
123
+  }
121 124
 };

+ 7
- 41
src/store/modules/searchTab.js Ver fichero

@@ -1,56 +1,22 @@
1
-import axios from 'axios';
1
+import axios from "axios";
2 2
 
3 3
 export default {
4 4
   namespaced: true,
5 5
   state: {
6
-    provinces: [],
7
-    cities: [],
8
-    suburbs: [],
6
+    provinces: []
9 7
   },
10 8
   mutations: {
11 9
     setProvince(state, provinces) {
12 10
       state.provinces = provinces;
13
-    },
14
-    setCities(state, cities) {
15
-      state.cities = cities;
16
-    },
17
-    setSuburbs(state, suburbs) {
18
-      state.suburbs = suburbs;
19
-    },
11
+    }
20 12
   },
21 13
   getters: {},
22 14
   actions: {
23 15
     getProvince({ commit }) {
24 16
       axios
25
-        .get('/api/province')
26
-        .then(result => commit('setProvince', result.data))
17
+        .get("/api/province")
18
+        .then(result => commit("setProvince", result.data))
27 19
         .catch(console.error);
28
-    },
29
-    getCities({ commit }, item) {
30
-      axios
31
-        .get(`/api/city/getBy/${item.province}`)
32
-        .then(result => commit('setCities', result.data));
33
-    },
34
-    getSuburbs({ commit }, item) {
35
-      axios
36
-        .get(`/api/Suburb/${item.province}/${item.city}`)
37
-        .then(result => commit('setSuburbs', result.data));
38
-    },
39
-    getListsForPropertyEdit({ commit }, propertyId) {
40
-      axios
41
-        .get('/api/province')
42
-        .then(result => commit('setProvince', result.data))
43
-        .catch(console.error);
44
-
45
-      axios
46
-        .get(`/api/City/GetByProperty/${propertyId}`)
47
-        .then(result => commit('setCities', result.data))
48
-        .catch(console.error);
49
-
50
-      axios
51
-        .get(`/api/Suburb/GetByProperty/${propertyId}`)
52
-        .then(result => commit('setSuburbs', result.data))
53
-        .catch(console.error);
54
-    },
55
-  },
20
+    }
21
+  }
56 22
 };

+ 2
- 2
vue.config.js Ver fichero

@@ -2,8 +2,8 @@ module.exports = {
2 2
   devServer: {
3 3
     proxy: {
4 4
       "/api": {
5
-        target: "http://localhost:57260/",
6
-        //target: "http://training.provision-sa.com:82",
5
+        //target: "http://localhost:57260/",
6
+        target: "http://training.provision-sa.com:82",
7 7
         changeOrigin: true
8 8
       },
9 9
       "/nph-srep": {

Loading…
Cancelar
Guardar