Bläddra i källkod

Timeshare to buy search fix

master
George Williams 4 år sedan
förälder
incheckning
03d6cc69c3

+ 76
- 0
src/components/shared/addressAutoComplete.vue Visa fil

1
+<template>
2
+  <div>
3
+    <gmap-autocomplete class="form-control" @place_changed="setPlace"></gmap-autocomplete>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: "AddressAutoComplete",
10
+  props: {
11
+    placeholder: {
12
+      default: "ENTER LOCATION"
13
+    }
14
+  },
15
+  data() {
16
+    return {
17
+      streetNumber: "",
18
+      streetName: "",
19
+      suburb: "",
20
+      city: "",
21
+      province: "",
22
+      country: "",
23
+      postalCode: "",
24
+      url: ""
25
+    };
26
+  },
27
+  methods: {
28
+    setPlace(place) {
29
+      this.streetNumber = "";
30
+      this.streetName = "";
31
+      this.suburb = "";
32
+      this.city = "";
33
+      this.province = "";
34
+      this.country = "";
35
+      this.postalCode = "";
36
+      this.url = "";
37
+
38
+      for (let i = 0; i < place.address_components.length; i++) {
39
+        if (place.address_components[i].types[0] === "street_number") {
40
+          this.streetNumber = place.address_components[i].long_name;
41
+        }
42
+        if (place.address_components[i].types[0] === "route") {
43
+          this.streetName = place.address_components[i].long_name;
44
+        }
45
+        if (place.address_components[i].types[0] === "sublocality_level_1") {
46
+          this.suburb = place.address_components[i].long_name;
47
+        }
48
+        if (place.address_components[i].types[0] === "locality") {
49
+          this.city = place.address_components[i].long_name;
50
+        }
51
+        if (place.address_components[i].types[0] === "administrative_area_level_1") {
52
+          this.province = place.address_components[i].long_name;
53
+        }
54
+        if (place.address_components[i].types[0] === "country") {
55
+          this.country = place.address_components[i].long_name;
56
+        }
57
+        if (place.address_components[i].types[0] === "postal_code") {
58
+          this.postalCode = place.address_components[i].long_name;
59
+        }
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
+      }
73
+    }
74
+  }
75
+};
76
+</script>

+ 125
- 41
src/components/timeshare/buy/carouselSection.vue Visa fil

11
             </p>
11
             </p>
12
             <div class="row">
12
             <div class="row">
13
               <div class="form-group col-md-6">
13
               <div class="form-group col-md-6">
14
+                <div class="input-group">
15
+                  <label v-if="!searchParams.region" class="uniSelectLabel" for="region">REGION</label>
16
+                  <select
17
+                    class="form-control uniSelect"
18
+                    name="region"
19
+                    id="region"
20
+                    v-model="searchParams.region"
21
+                    @change="regionChange"
22
+                  >
23
+                    <option v-for="(region, r) in regions" :key="r">{{ region.regionName }}</option>
24
+                  </select>
25
+                </div>
26
+                <br />
27
+                <label>DATE FROM</label>
14
                 <input
28
                 <input
15
-                  data-toggle="dropdown"
16
-                  name="region"
17
-                  class="form-control my-2"
18
-                  id="name"
19
-                  placeholder="Resort"
20
-                  aria-haspopup="true"
21
-                  aria-expanded="false"
22
-                />
23
-                <input
24
-                  data-toggle="dropdown"
25
-                  name="resort"
26
-                  class="form-control my-2"
27
-                  id="name"
28
-                  placeholder="Region"
29
-                  aria-haspopup="true"
30
-                  aria-expanded="false"
29
+                  type="date"
30
+                  name="arrival-to"
31
+                  class="form-control my-1 uniSelect"
32
+                  id="arrival-to"
33
+                  placeholder="Date From"
34
+                  v-model="filter.date"
31
                 />
35
                 />
32
               </div>
36
               </div>
33
               <div class="form-group col-md-6">
37
               <div class="form-group col-md-6">
38
+                <div class="input-group">
39
+                  <label
40
+                    v-if="!searchParams.resort"
41
+                    class="uniSelectLabel"
42
+                    for="weekInfoResortSelect"
43
+                  >RESORT</label>
44
+                  <select
45
+                    id="weekInfoResortSelect"
46
+                    class="form-control uniSelect"
47
+                    v-model="searchParams.resort"
48
+                  >
49
+                    <option
50
+                      v-for="(resort, r) in filteredResort"
51
+                      :key="r"
52
+                      :value="resort"
53
+                      @change="resortChange"
54
+                    >
55
+                      {{
56
+                      resort.resortName
57
+                      }}
58
+                    </option>
59
+                  </select>
60
+                </div>
61
+                <br />
62
+                <label>DATE TO</label>
34
                 <input
63
                 <input
35
-                  data-toggle="dropdown"
36
-                  name="region"
37
-                  class="form-control my-2"
38
-                  id="name"
39
-                  placeholder="Week"
40
-                  aria-haspopup="true"
41
-                  aria-expanded="false"
42
-                />
43
-                <input
44
-                  data-toggle="dropdown"
45
-                  name="resort"
46
-                  class="form-control my-2"
47
-                  id="name"
48
-                  placeholder="Price Range"
49
-                  aria-haspopup="true"
50
-                  aria-expanded="false"
64
+                  type="date"
65
+                  name="arrival-to"
66
+                  class="form-control my-1 uniSelect"
67
+                  id="arrival-to"
68
+                  placeholder="Date To"
69
+                  v-model="filter.ddate"
51
                 />
70
                 />
52
               </div>
71
               </div>
53
             </div>
72
             </div>
54
-            <a href="resort-page.php" class="btn-solid-blue"><i class="fa fa-search"></i> SEARCH</a>
73
+            <button class="btn-solid-blue" @click="Search()">
74
+              <i class="fa fa-search"></i> SEARCH
75
+            </button>
55
           </div>
76
           </div>
56
         </div>
77
         </div>
57
       </div>
78
       </div>
67
       style="margin-top:-50px"
88
       style="margin-top:-50px"
68
       :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
89
       :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
69
     >
90
     >
70
-      <img class="item" src="/img/intro-carousel/timeshare-1.jpg" alt="" />
71
-      <img class="item" src="/img/intro-carousel/timeshare-2.jpg" alt="" />
72
-      <img class="item" src="/img/intro-carousel/timeshare-3.jpg" alt="" />
73
-      <img class="item" src="/img/intro-carousel/timeshare-4.jpg" alt="" />
74
-      <img class="item" src="/img/intro-carousel/timeshare-5.jpg" alt="" />
75
-      <img class="item" src="/img/intro-carousel/timeshare-6.jpg" alt="" />
91
+      <img class="item" src="/img/intro-carousel/timeshare-1.jpg" alt />
92
+      <img class="item" src="/img/intro-carousel/timeshare-2.jpg" alt />
93
+      <img class="item" src="/img/intro-carousel/timeshare-3.jpg" alt />
94
+      <img class="item" src="/img/intro-carousel/timeshare-4.jpg" alt />
95
+      <img class="item" src="/img/intro-carousel/timeshare-5.jpg" alt />
96
+      <img class="item" src="/img/intro-carousel/timeshare-6.jpg" alt />
76
     </carousel>
97
     </carousel>
77
 
98
 
78
     <div id="intro-carousel" class="owl-carousel"></div>
99
     <div id="intro-carousel" class="owl-carousel"></div>
83
 /* eslint-disable */
104
 /* eslint-disable */
84
 
105
 
85
 import carousel from "vue-owl-carousel";
106
 import carousel from "vue-owl-carousel";
107
+import { mapState, mapActions, mapGetters } from "vuex";
86
 export default {
108
 export default {
87
   components: {
109
   components: {
88
-    carousel
89
-  }
110
+    carousel,
111
+  },
112
+  data() {
113
+    return {
114
+      regionObj: {},
115
+      resortObj: {},
116
+      region: "",
117
+      resort: "",
118
+      priceMin: undefined,
119
+      priceMax: undefined,
120
+    };
121
+  },
122
+  methods: {
123
+    ...mapActions("timeshare", ["initTimeshare", "onResortChange", "saveWeek"]),
124
+    regionChange(item) {
125
+      let reg = this.regions.find((r) => r.regionName === item.target.value);
126
+      this.regionObj = reg;
127
+    },
128
+    resortChange(item) {
129
+      let res = this.resorts.find((r) => r.resortName === item.target.value);
130
+      this.resortObj = res;
131
+    },
132
+    Search() {
133
+      if (this.searchParams.price) {
134
+        this.filter.minPrice = this.searchParams.price;
135
+      }
136
+      if (this.searchParams.week) {
137
+        this.filter.keyword = this.week;
138
+      }
139
+
140
+      if (!this.searchParams.resort) {
141
+        return;
142
+      }
143
+
144
+      this.$router.push(`/resort/${this.searchParams.resort.resortCode}`);
145
+    },
146
+  },
147
+  computed: {
148
+    ...mapState("timeshare", ["resorts", "regions", "detailedRegion"]),
149
+    ...mapState("weekList", ["searchParams", "filter"]),
150
+    filteredResort() {
151
+      let list = [];
152
+      if (this.searchParams.region && this.searchParams.region !== "") {
153
+        const item = this.detailedRegion.find(
154
+          (region) => region.region.regionCode === this.regionObj.regionCode
155
+        );
156
+        if (item) {
157
+          list = item.children;
158
+        }
159
+      } else {
160
+        list = this.resorts;
161
+      }
162
+      return _.sortBy(list, (x) => x.resortName);
163
+    },
164
+  },
165
+  created() {
166
+    this.initTimeshare(this.weekId);
167
+  },
168
+  mounted() {
169
+    this.searchParams.region = null;
170
+    this.searchParams.resort = null;
171
+    this.filter.date = null;
172
+    this.filter.ddate = null;
173
+  },
90
 };
174
 };
91
 </script>
175
 </script>
92
 
176
 

+ 23
- 18
src/components/timeshare/buy/searchSection.vue Visa fil

29
               v-model="selectedResort"
29
               v-model="selectedResort"
30
               @change="resortEvent()"
30
               @change="resortEvent()"
31
             >
31
             >
32
-              <option v-for="(resort, i) in selectedRegion.resorts" :key="i" :value="resort">
33
-                {{ resort.resortName }}
34
-              </option>
32
+              <option
33
+                v-for="(resort, i) in selectedRegion.resorts"
34
+                :key="i"
35
+                :value="resort"
36
+              >{{ resort.resortName }}</option>
35
             </select>
37
             </select>
36
           </div>
38
           </div>
37
           <div v-else class="input-group my-1">
39
           <div v-else class="input-group my-1">
38
             <label v-if="selectedResort === null" class="uniSelectLabel" for="resort">Resort</label>
40
             <label v-if="selectedResort === null" class="uniSelectLabel" for="resort">Resort</label>
39
             <select class="form-control uniSelect" name="resort" id="resort">
41
             <select class="form-control uniSelect" name="resort" id="resort">
40
-              <option disabled>
41
-                Please Select a Region First
42
-              </option>
42
+              <option disabled>Please Select a Region First</option>
43
             </select>
43
             </select>
44
           </div>
44
           </div>
45
-          <div class="input-group my-1">
45
+          <!-- <div class="input-group my-1">
46
             <label v-if="selectedSeason === null" class="uniSelectLabel" for="season">Season</label>
46
             <label v-if="selectedSeason === null" class="uniSelectLabel" for="season">Season</label>
47
             <select
47
             <select
48
               class="form-control uniSelect"
48
               class="form-control uniSelect"
50
               id="season"
50
               id="season"
51
               v-model="selectedSeason"
51
               v-model="selectedSeason"
52
             >
52
             >
53
-              <option v-for="season in seasons" :key="season.id" :value="season">
54
-                {{ season.name }}
55
-              </option>
53
+              <option v-for="season in seasons" :key="season.id" :value="season">{{ season.name }}</option>
56
             </select>
54
             </select>
57
           </div>
55
           </div>
58
 
56
 
97
               placeholder="mm/dd/yy"
95
               placeholder="mm/dd/yy"
98
               v-model="dateTo"
96
               v-model="dateTo"
99
             />
97
             />
100
-          </p>
101
-          <div class="btn-white-border"><i class="fa fa-search"></i> SEARCH</div>
98
+          </p>-->
99
+          <button class="btn-white-border" @click="ShowResort()">
100
+            <i class="fa fa-search"></i> SEARCH
101
+          </button>
102
         </div>
102
         </div>
103
         <div class="col-md-8 p-5">
103
         <div class="col-md-8 p-5">
104
           <h2>Search by Province</h2>
104
           <h2>Search by Province</h2>
137
 export default {
137
 export default {
138
   name: "TimeshareToBuy",
138
   name: "TimeshareToBuy",
139
   components: {
139
   components: {
140
-    Alert
140
+    Alert,
141
   },
141
   },
142
   data() {
142
   data() {
143
     return {
143
     return {
149
       bedrooms: null,
149
       bedrooms: null,
150
       maxPrice: null,
150
       maxPrice: null,
151
       dateFrom: "",
151
       dateFrom: "",
152
-      dateTo: ""
152
+      dateTo: "",
153
     };
153
     };
154
   },
154
   },
155
   mounted() {
155
   mounted() {
163
       return `http://maps.google.com/maps?q=${this.myMap}&z=${this.myZoom}&output=embed`;
163
       return `http://maps.google.com/maps?q=${this.myMap}&z=${this.myZoom}&output=embed`;
164
     },
164
     },
165
     regions() {
165
     regions() {
166
-      return _.sortBy(this.detailedRegion, r => r.regionName);
167
-    }
166
+      return _.sortBy(this.detailedRegion, (r) => r.regionName);
167
+    },
168
   },
168
   },
169
   methods: {
169
   methods: {
170
     ...mapActions("region", ["init", "getAvail", "getRegions", "getResort"]),
170
     ...mapActions("region", ["init", "getAvail", "getRegions", "getResort"]),
196
       if (this.maxPrice === "0") {
196
       if (this.maxPrice === "0") {
197
         this.maxPrice = null;
197
         this.maxPrice = null;
198
       }
198
       }
199
-    }
200
-  }
199
+    },
200
+    ShowResort() {
201
+      if (this.selectedResort) {
202
+        this.$router.push(`/resort/${this.selectedResort.resortCode}`);
203
+      }
204
+    },
205
+  },
201
 };
206
 };
202
 </script>
207
 </script>
203
 
208
 

+ 51
- 0
src/components/timeshare/buy/toBuySearchResults.vue Visa fil

1
+<template>
2
+  <main id="main" style="margin-top:-20px; padding-bottom:50px">
3
+    <section>
4
+      <div class="container">
5
+        <div class="row pt-5 justify-content-md-center">
6
+          <h3>TIMESHARE TO BUY</h3>
7
+        </div>
8
+        <br />
9
+        <br />
10
+        <br />
11
+        <br />
12
+        <h1>bla</h1>
13
+        <!--<div v-if="properties.length > 0" class="row justify-content-md-center">
14
+          <div
15
+            class="col-lg-3 col-md-6 col-sm-6"
16
+            v-for="currentProperty in properties"
17
+            :key="currentProperty.id"
18
+          >
19
+            <div>
20
+              <div class="portfolio-item">
21
+                <img style="width:255px; height:255px" :src="currentProperty.displayImage" alt />
22
+
23
+                <h4 class="mt-3">{{ currentProperty.suburb }}</h4>
24
+                <p>
25
+                  Opposite Monument Park Spar, Pretoria! Secure Parking. A stand-alone building,
26
+                  situated in the best location. Incredible bargain!
27
+                </p>
28
+                <br />
29
+
30
+                <router-link
31
+                  class="btn-white-border"
32
+                  :to="`/property/commercial/property/${currentProperty.id}`"
33
+                >VIEW</router-link>
34
+              </div>
35
+            </div>
36
+          </div>
37
+        </div>
38
+        <div v-else class="row">
39
+          <div align="center" class="col-md-12">
40
+            <img src="img/no-homes.png" />
41
+            <br />
42
+            <br />
43
+            <p>Sorry no listing where found matching your search</p>
44
+          </div>
45
+        </div>-->
46
+      </div>
47
+    </section>
48
+  </main>
49
+</template>
50
+
51
+

+ 8
- 10
src/components/timeshare/buy/weekListComponent.vue Visa fil

5
         <thead>
5
         <thead>
6
           <tr>
6
           <tr>
7
             <th scope="col">Unit</th>
7
             <th scope="col">Unit</th>
8
-            <th scope="col">Week</th>
9
             <th scope="col">Module</th>
8
             <th scope="col">Module</th>
10
             <th scope="col">Bedrooms</th>
9
             <th scope="col">Bedrooms</th>
11
             <th scope="col">Season</th>
10
             <th scope="col">Season</th>
17
           <tr v-for="(item, i) in filteredWeeks" :key="i">
16
           <tr v-for="(item, i) in filteredWeeks" :key="i">
18
             <td>{{ item.unitNumber }}</td>
17
             <td>{{ item.unitNumber }}</td>
19
             <td>{{ item.weekNumber }}</td>
18
             <td>{{ item.weekNumber }}</td>
20
-            <td>#module</td>
21
             <td>{{ item.bedrooms }}</td>
19
             <td>{{ item.bedrooms }}</td>
22
-            <td>#season</td>
20
+            <td>{{ item.season }}</td>
23
             <td>{{ item.sellPrice | toCurrency }}</td>
21
             <td>{{ item.sellPrice | toCurrency }}</td>
24
             <!-- <td>{{ item.region ? item.region.regionName : "" }}</td>
22
             <!-- <td>{{ item.region ? item.region.regionName : "" }}</td>
25
             <td>{{ item.resort ? item.resort.resortName : "" }}</td>
23
             <td>{{ item.resort ? item.resort.resortName : "" }}</td>
26
 
24
 
27
             <td>{{ item.arrivalDate | toDate }}</td>
25
             <td>{{ item.arrivalDate | toDate }}</td>
28
-            <td>{{ item.departureDate | toDate }}</td> -->
26
+            <td>{{ item.departureDate | toDate }}</td>-->
29
 
27
 
30
             <!-- <td>{{item.status ? item.status.description : ''}}</td> -->
28
             <!-- <td>{{item.status ? item.status.description : ''}}</td> -->
31
 
29
 
34
             </td>
32
             </td>
35
             <!-- <div class="col-md-12">
33
             <!-- <div class="col-md-12">
36
                 <button type="button" class="btn btn-b-n" >View</button>
34
                 <button type="button" class="btn btn-b-n" >View</button>
37
-              </div> -->
35
+            </div>-->
38
           </tr>
36
           </tr>
39
         </tbody>
37
         </tbody>
40
       </table>
38
       </table>
68
 export default {
66
 export default {
69
   props: {
67
   props: {
70
     resortCode: undefined,
68
     resortCode: undefined,
71
-    userId: undefined
69
+    userId: undefined,
72
   },
70
   },
73
   components: {},
71
   components: {},
74
   computed: {
72
   computed: {
75
     ...mapState("weekList", ["weeks", "status"]),
73
     ...mapState("weekList", ["weeks", "status"]),
76
     ...mapGetters({
74
     ...mapGetters({
77
       filteredWeeks: "weekList/filteredWeeks",
75
       filteredWeeks: "weekList/filteredWeeks",
78
-      getRegions: "weekList/getRegions"
79
-    })
76
+      getRegions: "weekList/getRegions",
77
+    }),
80
   },
78
   },
81
   mounted() {
79
   mounted() {
82
     if (this.resortCode) {
80
     if (this.resortCode) {
88
     View(item) {
86
     View(item) {
89
       this.$router.push(`/resort/${item.resort.resortCode}/${item.unitNumber}`);
87
       this.$router.push(`/resort/${item.resort.resortCode}/${item.unitNumber}`);
90
     },
88
     },
91
-    ...mapActions("weekList", ["getWeeks", "applyResortFilter"])
92
-  }
89
+    ...mapActions("weekList", ["getWeeks", "applyResortFilter"]),
90
+  },
93
 };
91
 };
94
 </script>
92
 </script>
95
 
93
 

+ 7
- 11
src/components/timeshare/resort/carouselSection.vue Visa fil

4
       <carousel
4
       <carousel
5
         :nav="false"
5
         :nav="false"
6
         :dots="false"
6
         :dots="false"
7
-        :items="1"
7
+        :items="10"
8
         :autoplay="true"
8
         :autoplay="true"
9
         :loop="true"
9
         :loop="true"
10
         :autoHeight="true"
10
         :autoHeight="true"
12
         style="margin-top:-50px;"
12
         style="margin-top:-50px;"
13
         :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
13
         :responsive="{ 0: { items: 1, nav: false }, 600: { items: 1, nav: false } }"
14
       >
14
       >
15
-        <img
16
-          class="item"
17
-          style="object-fit:cover"
18
-          v-for="(image, i) in resortImages"
19
-          :src="image"
20
-          :key="i"
21
-        />
15
+        <div v-for="(image, i) in resortImages" :key="i">
16
+          <img class="item" style="object-fit:cover" :src="image" :key="i" />
17
+        </div>
22
       </carousel>
18
       </carousel>
23
     </div>
19
     </div>
24
   </section>
20
   </section>
29
 import carousel from "vue-owl-carousel";
25
 import carousel from "vue-owl-carousel";
30
 export default {
26
 export default {
31
   components: {
27
   components: {
32
-    carousel
28
+    carousel,
33
   },
29
   },
34
   props: {
30
   props: {
35
-    resortImages: {}
36
-  }
31
+    resortImages: {},
32
+  },
37
 };
33
 };
38
 </script>
34
 </script>
39
 
35
 

+ 6
- 6
src/components/timeshare/resort/resortPage.vue Visa fil

15
 export default {
15
 export default {
16
   components: {
16
   components: {
17
     carouselSection,
17
     carouselSection,
18
-    contentSection
18
+    contentSection,
19
   },
19
   },
20
   data() {
20
   data() {
21
     return {
21
     return {
22
-      boolLoaded: false
22
+      boolLoaded: false,
23
     };
23
     };
24
   },
24
   },
25
   props: {
25
   props: {
26
-    resortCode: {}
26
+    resortCode: {},
27
   },
27
   },
28
   async created() {
28
   async created() {
29
     this.initResort(this.resortCode).then(() => {
29
     this.initResort(this.resortCode).then(() => {
36
       return this.resort
36
       return this.resort
37
         ? `http://maps.google.com/maps?q=${this.resort.prLatitude},${this.resort.prLongitude}&z=15&output=embed`
37
         ? `http://maps.google.com/maps?q=${this.resort.prLatitude},${this.resort.prLongitude}&z=15&output=embed`
38
         : "";
38
         : "";
39
-    }
39
+    },
40
   },
40
   },
41
   methods: {
41
   methods: {
42
     ...mapActions("resort", ["initResort"]),
42
     ...mapActions("resort", ["initResort"]),
43
     routerGoTo(goto) {
43
     routerGoTo(goto) {
44
       this.$router.push(goto);
44
       this.$router.push(goto);
45
-    }
46
-  }
45
+    },
46
+  },
47
 };
47
 };
48
 </script>
48
 </script>
49
 
49
 

+ 32
- 21
src/components/timeshare/searchTimeshare.vue Visa fil

3
     <h2>Filter Weeks</h2>
3
     <h2>Filter Weeks</h2>
4
     <p>*Select at least 1 filter field</p>
4
     <p>*Select at least 1 filter field</p>
5
     <div class="input-group mt-2">
5
     <div class="input-group mt-2">
6
-      <label v-if="selectedSeason === null" class="uniSelectLabel" for="season">Season</label>
7
-      <select class="form-control" name="season" id="season" v-model="selectedSeason">
8
-        <option v-for="season in seasons" :key="season.id" :value="season">
9
-          {{ season.name }}
10
-        </option>
6
+      <label v-if="!filter.season" class="uniSelectLabel" for="season">Season</label>
7
+      <select class="form-control" name="season" id="season" v-model="filter.season">
8
+        <option v-for="season in seasons" :key="season.id" :value="season">{{ season.name }}</option>
11
       </select>
9
       </select>
12
     </div>
10
     </div>
13
     <div class="input-group mt-2">
11
     <div class="input-group mt-2">
14
-      <label v-if="!filter.bedrooms" class="uniSelectLabel" for="weekInfoRegionSelect"
15
-        >Bedrooms</label
16
-      >
12
+      <label v-if="!filter.bedrooms" class="uniSelectLabel" for="weekInfoRegionSelect">Bedrooms</label>
17
       <select class="form-control" name="bedrooms" v-model="filter.bedrooms">
13
       <select class="form-control" name="bedrooms" v-model="filter.bedrooms">
18
         <option v-for="(item, i) in resortBedrooms" :key="i">{{ item }}</option>
14
         <option v-for="(item, i) in resortBedrooms" :key="i">{{ item }}</option>
19
       </select>
15
       </select>
27
       v-model="filter.maxPrice"
23
       v-model="filter.maxPrice"
28
     />
24
     />
29
     <p class="mt-2">
25
     <p class="mt-2">
30
-      Filter Arrival Date from
26
+      Date from
31
       <input
27
       <input
32
         type="date"
28
         type="date"
33
         name="arrival-from"
29
         name="arrival-from"
38
       />
34
       />
39
     </p>
35
     </p>
40
     <p>
36
     <p>
41
-      Filter Arrival Date to
37
+      Date to
42
       <input
38
       <input
43
         type="date"
39
         type="date"
44
         name="arrival-to"
40
         name="arrival-to"
45
         class="form-control my-1"
41
         class="form-control my-1"
46
         id="arrival-to"
42
         id="arrival-to"
47
         placeholder="mm/dd/yy"
43
         placeholder="mm/dd/yy"
44
+        v-model="filter.ddate"
48
       />
45
       />
49
     </p>
46
     </p>
50
-    <div class="btn-white-border"><i class="fa fa-search"></i> FILTER</div>
47
+    <button class="btn-white-border" @click="ClearFilter()">
48
+      <i class="fa fa-eraser"></i> CLEAR
49
+    </button>
50
+    <!-- <div class="btn-white-border">
51
+      <i class="fa fa-search"></i> FILTER
52
+    </div>-->
51
   </div>
53
   </div>
52
 </template>
54
 </template>
53
 
55
 
59
 export default {
61
 export default {
60
   props: {
62
   props: {
61
     hideTop: undefined,
63
     hideTop: undefined,
62
-    keyword: undefined
64
+    keyword: undefined,
63
   },
65
   },
64
   data() {
66
   data() {
65
     return {
67
     return {
66
-      selectedSeason: null
68
+      selectedSeason: null,
67
     };
69
     };
68
   },
70
   },
69
   created() {
71
   created() {
75
       "regions",
77
       "regions",
76
       "detailedRegion",
78
       "detailedRegion",
77
       "resortBedrooms",
79
       "resortBedrooms",
78
-      "maxSleep"
80
+      "maxSleep",
79
     ]),
81
     ]),
80
-    ...mapState("weekList", ["filter"]),
82
+    ...mapState("weekList", ["filter", "searchParams"]),
81
     ...mapState("timeshare", ["seasons"]),
83
     ...mapState("timeshare", ["seasons"]),
82
     filteredResorts() {
84
     filteredResorts() {
83
       if (this.selectedRegion) {
85
       if (this.selectedRegion) {
84
-        const list = _.find(this.detailedRegion, i => i.region.regionName === this.selectedRegion)
85
-          .children;
86
-        return _.sortBy(list, r => r.resortName);
86
+        const list = _.find(
87
+          this.detailedRegion,
88
+          (i) => i.region.regionName === this.selectedRegion
89
+        ).children;
90
+        return _.sortBy(list, (r) => r.resortName);
87
       }
91
       }
88
       return this.resorts;
92
       return this.resorts;
89
-    }
93
+    },
90
   },
94
   },
91
   methods: {
95
   methods: {
92
     ...mapActions("timeshare", ["initTimeshare"]),
96
     ...mapActions("timeshare", ["initTimeshare"]),
93
     ...mapActions("weekList", ["clearFilter"]),
97
     ...mapActions("weekList", ["clearFilter"]),
94
-    ...mapActions("timeshare", ["getSeasons"])
95
-  }
98
+    ...mapActions("timeshare", ["getSeasons"]),
99
+    ClearFilter() {
100
+      this.filter.season = null;
101
+      this.filter.bedrooms = null;
102
+      this.filter.maxPrice = null;
103
+      this.filter.date = null;
104
+      this.filter.ddate = null;
105
+    },
106
+  },
96
 };
107
 };
97
 </script>
108
 </script>
98
 
109
 

+ 6
- 0
src/router/index.js Visa fil

45
 
45
 
46
 import ResortPage from "../components/timeshare/resort/resortPage.vue";
46
 import ResortPage from "../components/timeshare/resort/resortPage.vue";
47
 import UnitPage from "../components/timeshare/resort/unit/unitPage.vue";
47
 import UnitPage from "../components/timeshare/resort/unit/unitPage.vue";
48
+import ToBuySearch from "../components/timeshare/buy/toBuySearchResults.vue";
48
 
49
 
49
 import ContactUs from "../components/misc/contactUs.vue";
50
 import ContactUs from "../components/misc/contactUs.vue";
50
 import PrivacyPolicy from "../components/misc//privacyPolicy/privacyPolicyPage.vue";
51
 import PrivacyPolicy from "../components/misc//privacyPolicy/privacyPolicyPage.vue";
393
       path: "/CampaignExpired",
394
       path: "/CampaignExpired",
394
       name: "CampaignExpired",
395
       name: "CampaignExpired",
395
       component: MarketingPageExp
396
       component: MarketingPageExp
397
+    },
398
+    {
399
+      path: "/toBuyResults",
400
+      name: "ToBuySearch",
401
+      component: ToBuySearch
396
     }
402
     }
397
   ]
403
   ]
398
 });
404
 });

+ 32
- 15
src/store/modules/timeshare/weekList.js Visa fil

3
 /* eslint-disable no-restricted-syntax */
3
 /* eslint-disable no-restricted-syntax */
4
 /* eslint-disable guard-for-in */
4
 /* eslint-disable guard-for-in */
5
 import axios from "axios";
5
 import axios from "axios";
6
-import _ from "lodash";
6
+import _, { min } from "lodash";
7
 
7
 
8
 export default {
8
 export default {
9
   namespaced: true,
9
   namespaced: true,
11
     weeks: [],
11
     weeks: [],
12
     status: undefined,
12
     status: undefined,
13
     filter: {
13
     filter: {
14
+      season: undefined,
14
       status: undefined,
15
       status: undefined,
15
       region: undefined,
16
       region: undefined,
16
       resort: undefined,
17
       resort: undefined,
17
       bedrooms: undefined,
18
       bedrooms: undefined,
18
       date: undefined,
19
       date: undefined,
20
+      ddate: undefined,
19
       minPrice: undefined,
21
       minPrice: undefined,
20
       maxPrice: undefined,
22
       maxPrice: undefined,
21
       keyword: undefined
23
       keyword: undefined
22
     },
24
     },
23
     prevFilter: undefined,
25
     prevFilter: undefined,
24
-    difFilter: undefined
26
+    difFilter: undefined,
27
+    searchParams: {
28
+      region: undefined,
29
+      resort: undefined,
30
+      fromDate: undefined,
31
+      toDate: undefined
32
+    }
25
   },
33
   },
26
   mutations: {
34
   mutations: {
27
     onLoading(state) {
35
     onLoading(state) {
81
           );
89
           );
82
         }
90
         }
83
         if (filter.bedrooms) {
91
         if (filter.bedrooms) {
84
-          weekList = _.filter(weekList, x => x.bedrooms && x.bedrooms == filter.bedrooms);
92
+          if (filter.bedrooms === "Studio") {
93
+            weekList = _.filter(weekList, x => (x.bedrooms && x.bedrooms === "0") || !x.bedrooms);
94
+          } else {
95
+            weekList = _.filter(weekList, x => x.bedrooms && x.bedrooms === filter.bedrooms);
96
+          }
85
         }
97
         }
86
         if (filter.date) {
98
         if (filter.date) {
87
           const minDate = new Date(filter.date);
99
           const minDate = new Date(filter.date);
88
-          minDate.setDate(minDate.getDate() - 7);
89
-          const maxDate = new Date(filter.date);
90
-          maxDate.setDate(maxDate.getDate() + 7);
91
-          weekList = _.filter(
92
-            weekList,
93
-            x =>
94
-              new Date(x.arrivalDate) &&
95
-              new Date(x.departureDate) &&
96
-              new Date(x.arrivalDate) >= minDate &&
97
-              new Date(x.arrivalDate) <= maxDate
98
-          );
100
+          minDate.setDate(minDate.getDate() - 1);
101
+          weekList = _.filter(weekList, x => new Date(x.arrivalDate) >= minDate);
102
+        }
103
+        if (filter.ddate) {
104
+          const maxDate = new Date(filter.ddate);
105
+          weekList = _.filter(weekList, x => new Date(x.departureDate) <= maxDate);
99
         }
106
         }
100
         if (filter.minPrice && filter.minPrice !== 0) {
107
         if (filter.minPrice && filter.minPrice !== 0) {
101
           weekList = _.filter(weekList, x => x.sellPrice && x.sellPrice >= filter.minPrice);
108
           weekList = _.filter(weekList, x => x.sellPrice && x.sellPrice >= filter.minPrice);
103
         if (filter.maxPrice && filter.maxPrice !== 0) {
110
         if (filter.maxPrice && filter.maxPrice !== 0) {
104
           weekList = _.filter(weekList, x => x.sellPrice && x.sellPrice <= filter.maxPrice);
111
           weekList = _.filter(weekList, x => x.sellPrice && x.sellPrice <= filter.maxPrice);
105
         }
112
         }
113
+        if (filter.season) {
114
+          weekList = _.filter(weekList, x => x.season === filter.season.name);
115
+        }
106
       }
116
       }
107
       return _.sortBy(_.sortBy(weekList, "arrivalDate"), "resort.resortName");
117
       return _.sortBy(_.sortBy(weekList, "arrivalDate"), "resort.resortName");
108
     },
118
     },
149
                 resortName: rootGetters["timeshare/getResortName"](code),
159
                 resortName: rootGetters["timeshare/getResortName"](code),
150
                 resortCode: code
160
                 resortCode: code
151
               };
161
               };
152
-              arr2.push(myItem);
153
             }
162
             }
154
           }
163
           }
155
           commit("setWeeks", arr2);
164
           commit("setWeeks", arr2);
157
         })
166
         })
158
         .catch(console.error);
167
         .catch(console.error);
159
     },
168
     },
169
+    // getWeeks({ commit }) {
170
+    //   axios.get("api/timeshareweek").then(result =>
171
+    //     commit(
172
+    //       "setWeeks",
173
+    //       result.data.filter(x => x.region !== null)
174
+    //     )
175
+    //   );
176
+    // },
160
     clearFilter({ commit }, filter) {
177
     clearFilter({ commit }, filter) {
161
       commit("onClearFilter", filter);
178
       commit("onClearFilter", filter);
162
     }
179
     }

Laddar…
Avbryt
Spara