Bruce Lywood 5 years ago
parent
commit
01b37c3da2

BIN
public/img/commercial.jpg View File


BIN
public/img/no-homes.gif View File


BIN
public/img/residential.jpg View File


+ 60
- 53
src/components/property/propertyCard.vue View File

1
 <template>
1
 <template>
2
-  <div class="col-md-4">
3
-    <div class="card-box-a card-shadow">
4
-      <div class="img-box-a">
5
-        <img :src="currentProperty.displayImage" alt class="img-a img-fluid" />
6
-      </div>
7
-      <div class="card-overlay">
8
-        <div class="card-overlay-a-content">
9
-          <div class="card-header-a">
10
-            <h3 class="card-title-a">
11
-              <router-link
12
-                :to="`/property/property/${currentProperty.id}`"
13
-                class="link-a"
14
-              >{{ currentProperty.shortDescription }}</router-link>
15
-            </h3>
16
-          </div>
17
-          <div class="card-body-a">
18
-            <div class="price-box d-flex">
19
-              <span
20
-                v-if="currentProperty.isSale"
21
-                class="price-a"
22
-              >sale | {{ currentProperty.displayPrice }}</span>
23
-              <span
24
-                v-if="!currentProperty.isSale"
25
-                class="price-a"
26
-              >rent | {{ currentProperty.displayPrice }}</span>
2
+  <div class="form-group row">
3
+    <div class="col-md-4" v-for="currentProperty in properties" :key="currentProperty.id">
4
+      <div class="card-box-a card-shadow">
5
+        <div class="img-box-a">
6
+          <img
7
+            :src="currentProperty.displayImage"
8
+            alt
9
+            class="img-a img-fluid"
10
+            style="height:466px; width:350px; object-fit: cover;"
11
+          />
12
+        </div>
13
+        <div class="card-overlay">
14
+          <div class="card-overlay-a-content">
15
+            <div class="card-header-a">
16
+              <h4 class="card-title-a">
17
+                <router-link
18
+                  :to="`/property/property/${currentProperty.id}`"
19
+                  class="link-a"
20
+                >{{ currentProperty.shortDescription }}</router-link>
21
+              </h4>
22
+            </div>
23
+            <div class="card-body-a">
24
+              <div class="price-box d-flex">
25
+                <span
26
+                  v-if="currentProperty.isSale"
27
+                  class="price-a"
28
+                >sale | {{ currentProperty.displayPrice }}</span>
29
+                <span
30
+                  v-if="!currentProperty.isSale"
31
+                  class="price-a"
32
+                >rent | {{ currentProperty.displayPrice }}</span>
33
+              </div>
34
+              <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
35
+                Click here to view
36
+                <span class="ion-ios-arrow-forward"></span>
37
+              </router-link>
38
+            </div>
39
+            <div class="card-footer-a" v-if="currentProperty.showFooter">
40
+              <ul class="card-info d-flex justify-content-around">
41
+                <li v-if="currentProperty.area !== null">
42
+                  <h4 class="card-info-title">Area</h4>
43
+                  <span v-html="currentProperty.area"></span>
44
+                </li>
45
+                <li v-if="currentProperty.beds !== null">
46
+                  <h4 class="card-info-title">Beds</h4>
47
+                  <span>{{ currentProperty.beds }}</span>
48
+                </li>
49
+                <li v-if="currentProperty.baths !== null">
50
+                  <h4 class="card-info-title">Baths</h4>
51
+                  <span>{{ currentProperty.baths }}</span>
52
+                </li>
53
+                <li v-if="currentProperty.garages !== null">
54
+                  <h4 class="card-info-title">Garages</h4>
55
+                  <span>{{ currentProperty.garages }}</span>
56
+                </li>
57
+              </ul>
27
             </div>
58
             </div>
28
-            <router-link :to="`/property/property/${currentProperty.id}`" class="link-a">
29
-              Click here to view
30
-              <span class="ion-ios-arrow-forward"></span>
31
-            </router-link>
32
-          </div>
33
-          <div class="card-footer-a" v-if="currentProperty.showFooter">
34
-            <ul class="card-info d-flex justify-content-around">
35
-              <li v-if="currentProperty.area !== null">
36
-                <h4 class="card-info-title">Area</h4>
37
-                <span>{{ currentProperty.area }}</span>
38
-              </li>
39
-              <li v-if="currentProperty.beds !== null">
40
-                <h4 class="card-info-title">Beds</h4>
41
-                <span>{{ currentProperty.beds }}</span>
42
-              </li>
43
-              <li v-if="currentProperty.baths !== null">
44
-                <h4 class="card-info-title">Baths</h4>
45
-                <span>{{ currentProperty.baths }}</span>
46
-              </li>
47
-              <li v-if="currentProperty.garages !== null">
48
-                <h4 class="card-info-title">Garages</h4>
49
-                <span>{{ currentProperty.garages }}</span>
50
-              </li>
51
-            </ul>
52
           </div>
59
           </div>
53
         </div>
60
         </div>
54
       </div>
61
       </div>
62
+      <br />
55
     </div>
63
     </div>
56
-    <br />
57
   </div>
64
   </div>
58
 </template>
65
 </template>
59
 
66
 
60
 <script>
67
 <script>
61
 export default {
68
 export default {
62
   props: {
69
   props: {
63
-    currentProperty: Object,
64
-  },
70
+    properties: Object
71
+  }
65
 };
72
 };
66
-</script>
73
+</script>

+ 7
- 7
src/components/property/propertyImage.vue View File

1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
     <div>
3
     <div>
4
-      <label class="btn btn-a" style="width: 137px; height:58px;">
4
+      <label class="btn btn-b-n" style="width: 85px; height:40px;">
5
         Upload
5
         Upload
6
         <input
6
         <input
7
           type="file"
7
           type="file"
30
   data() {
30
   data() {
31
     return {
31
     return {
32
       images: {},
32
       images: {},
33
-      image: [],
33
+      image: []
34
     };
34
     };
35
   },
35
   },
36
 
36
 
50
         const reader = new FileReader();
50
         const reader = new FileReader();
51
         var vm = this;
51
         var vm = this;
52
 
52
 
53
-        reader.onload = (e) => {
53
+        reader.onload = e => {
54
           vm.image.push(e.target.result);
54
           vm.image.push(e.target.result);
55
           console.log(vm.image);
55
           console.log(vm.image);
56
         };
56
         };
63
       this.images.splice(key, 1);
63
       this.images.splice(key, 1);
64
 
64
 
65
       if (!this.image.length) {
65
       if (!this.image.length) {
66
-        this.$refs.im.value = '';
66
+        this.$refs.im.value = "";
67
       }
67
       }
68
-    },
69
-  },
68
+    }
69
+  }
70
 };
70
 };
71
-</script>
71
+</script>

+ 27
- 9
src/components/property/propertyPage.vue View File

34
           <div class="col-sm-12">
34
           <div class="col-sm-12">
35
             <div id="property-single-carousel" class="owl-carousel owl-arrow gallery-property">
35
             <div id="property-single-carousel" class="owl-carousel owl-arrow gallery-property">
36
               <div class="carousel-item-b">
36
               <div class="carousel-item-b">
37
-                <img :src="propertyImages[0]" />
37
+                <img
38
+                  :src="propertyImages[0]"
39
+                  style="height:800px; width:1200px; object-fit: cover;"
40
+                />
38
               </div>
41
               </div>
39
               <div class="carousel-item-b">
42
               <div class="carousel-item-b">
40
-                <img :src="propertyImages[1]" height="500" />
43
+                <img
44
+                  :src="propertyImages[1]"
45
+                  style="height:800px; width:1200px; object-fit: cover;"
46
+                />
47
+              </div>
48
+              <div class="carousel-item-b">
49
+                <img
50
+                  :src="propertyImages[2]"
51
+                  style="height:800px; width:1200px; object-fit: cover;"
52
+                />
53
+              </div>
54
+              <div class="carousel-item-b">
55
+                <img
56
+                  :src="propertyImages[3]"
57
+                  style="height:800px; width:1200px; object-fit: cover;"
58
+                />
41
               </div>
59
               </div>
42
             </div>
60
             </div>
43
             <div class="row justify-content-between">
61
             <div class="row justify-content-between">
62
                     <ul class="list" v-for="item in display.values">
80
                     <ul class="list" v-for="item in display.values">
63
                       <li class="d-flex justify-content-between">
81
                       <li class="d-flex justify-content-between">
64
                         <strong>{{ item.name }}:</strong>
82
                         <strong>{{ item.name }}:</strong>
65
-                        <span>{{ item.value }}</span>
83
+                        <span v-html="item.value"></span>
66
                       </li>
84
                       </li>
67
                     </ul>
85
                     </ul>
68
                   </div>
86
                   </div>
333
 
351
 
334
 <script>
352
 <script>
335
 export default {
353
 export default {
336
-  name: 'Property',
354
+  name: "Property",
337
   data() {
355
   data() {
338
     return {
356
     return {
339
       Property: {},
357
       Property: {},
340
-      propertyImages: [],
358
+      propertyImages: []
341
     };
359
     };
342
   },
360
   },
343
-  mounted() {
344
-    const axios = require('axios');
361
+  created() {
362
+    const axios = require("axios");
345
     axios
363
     axios
346
       .get(`http://localhost:57260/Property/Property/${this.$route.params.id}`)
364
       .get(`http://localhost:57260/Property/Property/${this.$route.params.id}`)
347
       .then(response => (this.Property = response.data));
365
       .then(response => (this.Property = response.data));
348
 
366
 
349
     axios
367
     axios
350
       .get(
368
       .get(
351
-        `http://localhost:57260/property/PropertyImage/getpropertyimages/${this.$route.params.id}`,
369
+        `http://localhost:57260/property/PropertyImage/getpropertyimages/${this.$route.params.id}`
352
       )
370
       )
353
       .then(response => (this.propertyImages = response.data));
371
       .then(response => (this.propertyImages = response.data));
354
-  },
372
+  }
355
 };
373
 };
356
 </script>
374
 </script>

+ 105
- 16
src/components/property/propertySearchPage.vue View File

3
     <div class="col-md-12">
3
     <div class="col-md-12">
4
       <h3 class="my-4">Property Listing</h3>
4
       <h3 class="my-4">Property Listing</h3>
5
     </div>
5
     </div>
6
-
6
+    <br />
7
+    <br />
8
+    <br />
7
     <div>
9
     <div>
8
       <propertyCard
10
       <propertyCard
11
+        v-if="Properties.length > 0"
9
         name="propertyholder"
12
         name="propertyholder"
10
-        v-for="property in Properties"
11
-        :currentProperty="property"
12
-        :key="property.id"
13
+        :properties="Properties"
14
+        :key="propertysearch"
13
       />
15
       />
16
+      <div v-if="Properties.length === 0">
17
+        <img src="../../../public/img/no-homes.gif" />
18
+        <br />
19
+        <br />
20
+        <p>Sorry no listing where found matching your search</p>
21
+      </div>
14
     </div>
22
     </div>
15
     <br />
23
     <br />
16
-    <div class="container">
24
+    <div class="container" v-if="propertyType === 'Residential'">
17
       <div class="row">
25
       <div class="row">
18
         <div class="col-md-12">
26
         <div class="col-md-12">
19
           <h1 class="my-4">About Residential Properties</h1>
27
           <h1 class="my-4">About Residential Properties</h1>
36
           </p>
44
           </p>
37
           <p>
45
           <p>
38
             Wish to RENT your property?
46
             Wish to RENT your property?
39
-            <a href="./ToRent.vue#residential/torent">Click Here</a>
47
+            <router-link to="/property/Residential/Rental">Click Here</router-link>
48
+          </p>
49
+          <p>
50
+            Wish to SELL your property?
51
+            <router-link to="/property/Residential/Sale">Click Here</router-link>
52
+          </p>
53
+        </div>
54
+        <div class="col-md-4 text-center">
55
+          <p>
56
+            <img class="img-fluid" src="./../../../public/img/residential.jpg" alt="About Resale" />
57
+          </p>
58
+        </div>
59
+      </div>
60
+    </div>
61
+    <div class="container" v-if="propertyType === 'Commercial'">
62
+      <div class="row">
63
+        <div class="col-md-12">
64
+          <h1 class="my-4">About Commercial Properties</h1>
65
+        </div>
66
+        <div class="col-md-6">
67
+          <p>
68
+            Commercial properties are characteristically any larger properties that
69
+            generate profit through leasing or rental activities. These properties
70
+            are typically used to conduct business and provide companies with cut-and-dry
71
+            leasing agreements, which keep their involvement in the maintenance of the property
72
+            to a minimum, so they may focus on the growth of their company.
73
+          </p>
74
+          <p>
75
+            Uni-Vate Properties seeks out professional, clean spaces for such companies and acts as
76
+            mediator between the landlord/-lady and the tenants. Uni-Vate Properties provides
77
+            value-adding service to clients and conducts business with a high standard
78
+            and integrity.
79
+          </p>
80
+          <p>
81
+            Wish to RENT your property?
82
+            <router-link to="/property/Commercial/Rental">Click Here</router-link>
40
           </p>
83
           </p>
41
           <p>
84
           <p>
42
             Wish to SELL your property?
85
             Wish to SELL your property?
43
-            <a href="./ToSell.vue#residential/tosell">Click Here</a>
86
+            <router-link to="/property/Commercial/Sale">Click Here</router-link>
44
           </p>
87
           </p>
45
         </div>
88
         </div>
46
         <div class="col-md-4 text-center">
89
         <div class="col-md-4 text-center">
47
           <p>
90
           <p>
48
-            <img class="img-fluid" src alt="About Resale" />
91
+            <img class="img-fluid" src="./../../../public/img/commercial.jpg" alt="About Resale" />
49
           </p>
92
           </p>
50
         </div>
93
         </div>
51
       </div>
94
       </div>
53
   </div>
96
   </div>
54
 </template>
97
 </template>
55
 <script>
98
 <script>
56
-import propertyCard from '../property/propertyCard.vue';
99
+import propertyCard from "../property/propertyCard.vue";
100
+import { isNull } from "util";
57
 
101
 
58
 export default {
102
 export default {
59
-  name: 'ResidentialSearch',
103
+  name: "propertysearch",
60
   components: {
104
   components: {
61
-    propertyCard,
105
+    propertyCard
62
   },
106
   },
63
   data() {
107
   data() {
64
     return {
108
     return {
65
       Properties: [],
109
       Properties: [],
110
+      type: "",
111
+      propertyType: "",
112
+      propertyTypeparam: "",
113
+      province: "",
114
+      city: "",
115
+      suburb: ""
66
     };
116
     };
67
   },
117
   },
68
-  mounted() {
69
-    const axios = require('axios');
70
-    axios
71
-      .get('http://localhost:57260/Property/Property')
72
-      .then(response => (this.Properties = response.data));
118
+  computed: {
119
+    ParamsChanged() {
120
+      this.propertyTypeparam = this.$route.params.propertyType;
121
+      this.type = this.$route.query.type;
122
+      this.propertyType = this.$route.query.propertyType;
123
+      this.province = this.$route.query.province;
124
+      this.city = this.$route.query.city;
125
+      this.suburb = this.$route.query.suburb;
126
+
127
+      if (typeof this.propertyType === "undefined") {
128
+        this.propertyType = this.propertyTypeparam;
129
+      }
130
+
131
+      let search = "";
132
+      if (this.type !== "") {
133
+        search = search + "type:" + this.type;
134
+      }
135
+      if (this.propertyType !== "") {
136
+        search = search + "|propertyType:" + this.propertyType;
137
+      }
138
+      if (this.province !== "") {
139
+        search = search + "|province:" + this.province;
140
+      }
141
+      if (this.city !== "") {
142
+        search = search + "|city:" + this.city;
143
+      }
144
+      if (this.suburb !== "") {
145
+        search = search + "|suburb:" + this.suburb;
146
+      }
147
+
148
+      console.log(search);
149
+
150
+      const axios = require("axios");
151
+      axios
152
+        .get(
153
+          `http://localhost:57260/Property/Property/Search/${this.type}/${this.propertyType}/${this.province}/${this.city}/${this.suburb}`
154
+        )
155
+        .then(response => (this.Properties = response.data));
156
+    }
73
   },
157
   },
158
+  watch: {
159
+    ParamsChanged() {
160
+      console.log(JSON.stringify(this.$route.query));
161
+    }
162
+  }
74
 };
163
 };
75
 </script>
164
 </script>

+ 172
- 82
src/components/property/propertyeditPage.vue View File

1
 <template>
1
 <template>
2
-  <div @submit.prevent="SubmitData">
2
+  <!-- eslint-disable max-len -->
3
+  <div>
3
     <div class="container">
4
     <div class="container">
4
       <section class="intro-single">
5
       <section class="intro-single">
5
         <div class="container">
6
         <div class="container">
21
       </div>
22
       </div>
22
       <div class="row mb-3">
23
       <div class="row mb-3">
23
         <div class="col-md-12">
24
         <div class="col-md-12">
24
-          <form
25
-            id="mainForm"
26
-            method="POST"
27
-            action="/to-sell"
28
-            accept-charset="UTF-8"
29
-            enctype="multipart/form-data"
30
-          >
25
+          <form id="mainForm">
31
             <div class="form-group row">
26
             <div class="form-group row">
32
               <div class="col-md-4">
27
               <div class="col-md-4">
33
-                <label>Property Type</label>
28
+                <label for="Property Type"></label>
34
                 <select
29
                 <select
35
-                  class="form-control form-control-lg form-control-a"
30
+                  class="form-control"
36
                   name="propertyType"
31
                   name="propertyType"
37
                   id="propertyType"
32
                   id="propertyType"
38
                   v-model="property.propertyTypeId"
33
                   v-model="property.propertyTypeId"
39
                 >
34
                 >
40
                   <option value="0">Please Select</option>
35
                   <option value="0">Please Select</option>
41
-                  <option v-for="item in propertyTypes" :value="item.id">{{ item.description }}</option>
36
+                  <option
37
+                    v-for="item in propertyTypes"
38
+                    :value="item.id"
39
+                    :key="item.id"
40
+                  >{{ item.description }}</option>
42
                 </select>
41
                 </select>
43
               </div>
42
               </div>
43
+              <div v-if="propertyType === 'Commercial'" class="col-md-4">
44
+                <label>Property Name</label>
45
+                <input
46
+                  class="form-control form-control-lg form-control-a"
47
+                  type="text"
48
+                  name="propertyName"
49
+                  id="propertyName"
50
+                  v-model="property.propertyName"
51
+                />
52
+              </div>
53
+              <div v-if="propertyType === 'Commercial'" class="col-md-4">
54
+                <label>Unit</label>
55
+                <input
56
+                  class="form-control form-control-lg form-control-a"
57
+                  type="text"
58
+                  name="unit"
59
+                  id="unit"
60
+                  v-model="property.unit"
61
+                />
62
+              </div>
44
             </div>
63
             </div>
45
             <div class="form-group row">
64
             <div class="form-group row">
46
               <div class="col-md-4">
65
               <div class="col-md-4">
47
-                <label>Address Line 1</label>
66
+                <label for="Address Line 1"></label>
48
                 <input
67
                 <input
49
-                  class="form-control form-control-lg form-control-a"
68
+                  class="form-control"
50
                   type="text"
69
                   type="text"
70
+                  placeholder="Address Line 1"
51
                   name="address1"
71
                   name="address1"
52
                   id="address1"
72
                   id="address1"
53
                   v-model="property.addressLine1"
73
                   v-model="property.addressLine1"
54
                 />
74
                 />
55
               </div>
75
               </div>
56
               <div class="col-md-4">
76
               <div class="col-md-4">
57
-                <label>Address Line 2</label>
77
+                <label for="Address Line 2"></label>
58
                 <input
78
                 <input
59
-                  class="form-control form-control-lg form-control-a"
79
+                  class="form-control"
60
                   type="text"
80
                   type="text"
81
+                  placeholder="Address Line 2"
61
                   name="address2"
82
                   name="address2"
62
                   id="address2"
83
                   id="address2"
63
                   v-model="property.addressLine2"
84
                   v-model="property.addressLine2"
64
                 />
85
                 />
65
               </div>
86
               </div>
66
               <div class="col-md-4">
87
               <div class="col-md-4">
67
-                <label>Address Line 3</label>
88
+                <label for="Address Line 3"></label>
68
                 <input
89
                 <input
69
-                  class="form-control form-control-lg form-control-a"
90
+                  class="form-control"
70
                   type="text"
91
                   type="text"
92
+                  placeholder="Address Line 3"
71
                   name="address3"
93
                   name="address3"
72
                   id="address3"
94
                   id="address3"
73
                   v-model="property.addressLine3"
95
                   v-model="property.addressLine3"
76
             </div>
98
             </div>
77
             <div class="form-group row">
99
             <div class="form-group row">
78
               <div class="col-md-4">
100
               <div class="col-md-4">
79
-                <label>Province</label>
101
+                <label for="Province"></label>
80
                 <select
102
                 <select
81
-                  class="form-control form-control-lg form-control-a"
103
+                  class="form-control"
82
                   name="propertyType"
104
                   name="propertyType"
83
                   id="propertyType"
105
                   id="propertyType"
84
                   @change="ProvinceSelected"
106
                   @change="ProvinceSelected"
85
                   v-model="property.provinceId"
107
                   v-model="property.provinceId"
86
                 >
108
                 >
87
-                  <option value="0">Please Select</option>
109
+                  <option value="0">Please select Province</option>
88
                   <option
110
                   <option
89
                     v-for="province in provinces"
111
                     v-for="province in provinces"
90
                     :value="province.id"
112
                     :value="province.id"
113
+                    :key="province.id"
91
                   >{{ province.description }}</option>
114
                   >{{ province.description }}</option>
92
                 </select>
115
                 </select>
93
               </div>
116
               </div>
94
               <div class="col-md-4">
117
               <div class="col-md-4">
95
-                <label>City</label>
118
+                <label for="City"></label>
96
                 <select
119
                 <select
97
-                  class="form-control form-control-lg form-control-a"
120
+                  class="form-control"
98
                   name="propertyType"
121
                   name="propertyType"
99
                   id="propertyType"
122
                   id="propertyType"
100
                   @change="CitySelected"
123
                   @change="CitySelected"
101
                   v-model="property.cityId"
124
                   v-model="property.cityId"
102
                 >
125
                 >
103
                   <option value="0">Please Select</option>
126
                   <option value="0">Please Select</option>
104
-                  <option v-for="city in cities" :value="city.id">{{ city.description }}</option>
127
+                  <option
128
+                    v-for="city in cities"
129
+                    :value="city.id"
130
+                    :key="city.id"
131
+                  >{{ city.description }}</option>
105
                 </select>
132
                 </select>
106
               </div>
133
               </div>
107
               <div class="col-md-4">
134
               <div class="col-md-4">
108
-                <label>Suburb</label>
135
+                <label for="Suburb"></label>
109
                 <select
136
                 <select
110
-                  class="form-control form-control-lg form-control-a"
137
+                  class="form-control"
111
                   name="propertyType"
138
                   name="propertyType"
112
                   id="suburbselector"
139
                   id="suburbselector"
113
                   v-model="property.suburbId"
140
                   v-model="property.suburbId"
114
                 >
141
                 >
115
                   <option value="0">Please Select</option>
142
                   <option value="0">Please Select</option>
116
-                  <option v-for="suburb in suburbs" :value="suburb.id">{{ suburb.description }}</option>
143
+                  <option
144
+                    v-for="suburb in suburbs"
145
+                    :value="suburb.id"
146
+                    :key="suburb.id"
147
+                  >{{ suburb.description }}</option>
117
                 </select>
148
                 </select>
118
               </div>
149
               </div>
119
             </div>
150
             </div>
120
             <div class="form-group row">
151
             <div class="form-group row">
121
               <div class="col-md-4">
152
               <div class="col-md-4">
122
-                <label v-if="salesType === 'Rental'">Rental</label>
123
-                <label v-if="salesType !== 'Rental'">Sale Price</label>
153
+                <label v-if="salesType === 'Rental'">Rental Price</label>
154
+                <label v-if="salesType !== 'Rental'">Sales Price</label>
124
                 <input
155
                 <input
125
-                  class="form-control form-control-lg form-control-a"
156
+                  class="form-control"
126
                   type="number"
157
                   type="number"
127
                   name="price"
158
                   name="price"
128
                   id="price"
159
                   id="price"
160
+                  placeholder="R"
129
                   v-model="property.price"
161
                   v-model="property.price"
130
                 />
162
                 />
131
               </div>
163
               </div>
132
               <div class="col-md-4" v-if="salesType === 'Rental'">
164
               <div class="col-md-4" v-if="salesType === 'Rental'">
133
                 <label>Per</label>
165
                 <label>Per</label>
134
                 <select
166
                 <select
135
-                  class="form-control form-control-lg form-control-a"
167
+                  class="form-control"
136
                   name="propertyType"
168
                   name="propertyType"
137
                   id="propertyType"
169
                   id="propertyType"
138
                   v-model="property.per"
170
                   v-model="property.per"
139
                 >
171
                 >
140
-                  <option value>Please Select</option>
172
+                  <option value>Please select</option>
141
                   <option value="month">Month</option>
173
                   <option value="month">Month</option>
142
                   <option value="day">Day</option>
174
                   <option value="day">Day</option>
143
                 </select>
175
                 </select>
145
             </div>
177
             </div>
146
             <div class="form-group row">
178
             <div class="form-group row">
147
               <div class="col-md-12">
179
               <div class="col-md-12">
148
-                <label>Property Description</label>
180
+                <label for="Property Description"></label>
149
                 <textarea
181
                 <textarea
150
-                  class="form-control editor form-control-lg form-control-a"
182
+                  class="form-control editor"
183
+                  placeholder="Property Description"
151
                   name="description"
184
                   name="description"
152
                   v-model="property.description"
185
                   v-model="property.description"
186
+                  id="description"
153
                 ></textarea>
187
                 ></textarea>
188
+                <br />
154
                 <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
189
                 <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
155
               </div>
190
               </div>
156
             </div>
191
             </div>
157
             <div class="form-group row" />
192
             <div class="form-group row" />
158
-            <UserField v-if="ApiRunning" :fields="propValuesProp[0].fields"></UserField>
193
+            <UserField
194
+              v-if="ApiRunning & propertyType === 'Residential'"
195
+              :fields="propValuesProp[0].fields"
196
+              :id="overviewProps"
197
+              @UpdateUserDefinedFields="UpdateUserDefinedFields"
198
+            ></UserField>
159
             <div class="form-group row" />
199
             <div class="form-group row" />
160
-            <div v-for="item in propertyValues">
200
+            <div v-for="item in propertyValues" :key="item.id">
161
               <div class="row">
201
               <div class="row">
162
                 <div class="col-sm-12">
202
                 <div class="col-sm-12">
163
                   <div class="title-box-d">
203
                   <div class="title-box-d">
165
                   </div>
205
                   </div>
166
                 </div>
206
                 </div>
167
               </div>
207
               </div>
168
-              <UserField :fields="item.fields" :id="item.id" />
208
+              <UserField
209
+                :fields="item.fields"
210
+                :id="item.id"
211
+                @UpdateUserDefinedFields="UpdateUserDefinedFields"
212
+              />
169
             </div>
213
             </div>
170
             <div class="form-group row" />
214
             <div class="form-group row" />
171
             <div class="row">
215
             <div class="row">
175
                 </div>
219
                 </div>
176
               </div>
220
               </div>
177
             </div>
221
             </div>
178
-            <ImageLoad />
179
-            <button type="submit" class="btn btn-a">Save</button>
222
+            <ImageLoad :loadedImages="loadedImages" />
223
+            <button type="button" @click="SubmitData()" class="btn btn-a">Save</button>
224
+            <!-- <router-link
225
+              to="/property/search"
226
+              @click.stop.prevent="SubmitData()"
227
+              class="btn btn-b"
228
+              tag="button"
229
+            >Save</router-link>-->
180
           </form>
230
           </form>
181
         </div>
231
         </div>
182
       </div>
232
       </div>
185
 </template>
235
 </template>
186
 
236
 
187
 <script>
237
 <script>
188
-import UserField from './propertyUserField.vue';
189
-import ImageLoad from './propertyImage.vue';
190
-
238
+import UserField from "./propertyUserField.vue";
239
+import ImageLoad from "./propertyImage.vue";
240
+// https://vuejsexamples.com/a-vue-wrapper-around-the-trix-rich-text-editor/
191
 export default {
241
 export default {
192
-  name: 'PropertyEdit',
242
+  name: "PropertyEdit",
193
   components: {
243
   components: {
194
     UserField,
244
     UserField,
195
-    ImageLoad,
245
+    ImageLoad
196
   },
246
   },
197
   data() {
247
   data() {
198
     return {
248
     return {
199
-      ApiRunning: false,
200
-      propertyType: 'Residential',
201
-      salesType: 'Rental',
202
-      imageFile: '',
249
+      ApiRunning: true,
250
+      propertyType: "Residential",
251
+      salesType: "Rental",
252
+      imageFile: "",
203
       provinces: [],
253
       provinces: [],
204
       cities: [],
254
       cities: [],
205
       suburbs: [],
255
       suburbs: [],
206
       propertyValues: [],
256
       propertyValues: [],
207
       propValuesProp: [],
257
       propValuesProp: [],
208
       propertyTypes: [],
258
       propertyTypes: [],
209
-      selectedProvince: '',
210
-      selectedCity: '',
259
+      selectedProvince: "",
260
+      selectedCity: "",
211
       property: {
261
       property: {
212
         propertyTypeId: 0,
262
         propertyTypeId: 0,
213
-        addressLine1: '',
214
-        addressLine2: '',
215
-        addressLine3: '',
263
+        propertyName: "",
264
+        unit: "",
265
+        addressLine1: "",
266
+        addressLine2: "",
267
+        addressLine3: "",
216
         suburbId: 0,
268
         suburbId: 0,
217
         cityId: 0,
269
         cityId: 0,
218
         provinceId: 0,
270
         provinceId: 0,
219
-        price: '',
220
-        per: '',
221
-        description: '',
271
+        price: "",
272
+        per: "",
273
+        description: "",
222
         isSale: false,
274
         isSale: false,
275
+        propertyUserFields: [],
276
+        propertyImages: []
223
       },
277
       },
278
+      images: [],
279
+      propertyFieldValues: []
224
     };
280
     };
225
   },
281
   },
226
   methods: {
282
   methods: {
227
     SubmitData() {
283
     SubmitData() {
228
-      const axios = require('axios');
229
-      axios
230
-        .post('http://localhost:57260/Property/Property', this.property, {
231
-          headers: {
232
-            'Content-type': 'application/json',
233
-          },
234
-        })
235
-        .then((response) => {})
236
-        .catch((e) => {
237
-          alert(e);
238
-        });
284
+      // let isDefault = true;
285
+      // this.images.forEach((imagedata) => {
286
+      //   this.property.propertyImages.push({
287
+      //     image: imagedata,
288
+      //     isDefault,
289
+      //   });
290
+      //   isDefault = false;
291
+      // });
292
+
293
+      // this.property.propertyUserFields = this.propertyFieldValues;
294
+
295
+      // const axios = require('axios');
296
+      // axios
297
+      //   .post('http://localhost:57260/Property/Property', this.property)
298
+      //   .then((response) => {})
299
+      //   .catch((e) => {
300
+      //     alert(e);
301
+      //   });
239
 
302
 
240
-      console.log(JSON.stringify(this.property));
303
+      // this.$router.push("/property/search");
304
+      this.$router.push({
305
+        path: "/property/search",
306
+        query: { type: this.salesType, propertyType: this.propertyType }
307
+      });
241
     },
308
     },
242
     ProvinceSelected(item) {
309
     ProvinceSelected(item) {
243
       if (item.target.options.selectedIndex > 0) {
310
       if (item.target.options.selectedIndex > 0) {
244
         this.selectedProvince = this.provinces[
311
         this.selectedProvince = this.provinces[
245
           item.target.options.selectedIndex - 1
312
           item.target.options.selectedIndex - 1
246
         ].description;
313
         ].description;
247
-        const axios = require('axios');
314
+        const axios = require("axios");
248
         axios
315
         axios
249
           .get(
316
           .get(
250
-            `http://localhost:57260/region/city/getby/${this.selectedProvince}`,
317
+            `http://localhost:57260/region/city/getby/${this.selectedProvince}`
251
           )
318
           )
252
           .then(response => (this.cities = response.data));
319
           .then(response => (this.cities = response.data));
253
       }
320
       }
257
         this.selectedCity = this.cities[
324
         this.selectedCity = this.cities[
258
           item.target.options.selectedIndex - 1
325
           item.target.options.selectedIndex - 1
259
         ].description;
326
         ].description;
260
-        const axios = require('axios');
327
+        const axios = require("axios");
261
         axios
328
         axios
262
           .get(
329
           .get(
263
-            `http://localhost:57260/region/Suburb/${this.selectedProvince}/${this.selectedCity}`,
330
+            `http://localhost:57260/region/Suburb/${this.selectedProvince}/${this.selectedCity}`
264
           )
331
           )
265
           .then(response => (this.suburbs = response.data));
332
           .then(response => (this.suburbs = response.data));
266
       }
333
       }
267
     },
334
     },
335
+    loadedImages(values) {
336
+      this.images = values;
337
+    },
338
+    UpdateUserDefinedFields(item) {
339
+      let update = false;
340
+      this.propertyFieldValues.forEach(element => {
341
+        if (element.userDefinedFieldId === item.userDefinedFieldId) {
342
+          element.value = item.value;
343
+          update = true;
344
+        }
345
+      });
346
+      if (!update) {
347
+        this.propertyFieldValues.push(item);
348
+      }
349
+    }
268
   },
350
   },
269
   mounted() {
351
   mounted() {
270
     this.propertyType = this.$route.params.propType;
352
     this.propertyType = this.$route.params.propType;
271
     this.salesType = this.$route.params.saleType;
353
     this.salesType = this.$route.params.saleType;
272
 
354
 
273
-    const axios = require('axios');
355
+    const axios = require("axios");
274
     axios
356
     axios
275
-      .get('http://localhost:57260/Property/PropertyFields/Property Overview')
357
+      .get("http://localhost:57260/Property/PropertyFields/Property Overview")
276
       .then(response => (this.propValuesProp = response.data));
358
       .then(response => (this.propValuesProp = response.data));
277
 
359
 
278
     axios
360
     axios
279
-      .get('http://localhost:57260/Property/PropertyFields')
361
+      .get(
362
+        `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`
363
+      )
280
       .then(response => (this.propertyValues = response.data));
364
       .then(response => (this.propertyValues = response.data));
281
 
365
 
282
     axios
366
     axios
283
       .get(
367
       .get(
284
-        `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`,
368
+        `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`
285
       )
369
       )
286
       .then(response => (this.propertyTypes = response.data));
370
       .then(response => (this.propertyTypes = response.data));
287
 
371
 
288
     axios
372
     axios
289
-      .get('http://localhost:57260/region/province')
373
+      .get("http://localhost:57260/region/province")
290
       .then(response => (this.provinces = response.data));
374
       .then(response => (this.provinces = response.data));
291
   },
375
   },
292
   computed: {
376
   computed: {
294
       this.propertyType = this.$route.params.propType;
378
       this.propertyType = this.$route.params.propType;
295
       this.salesType = this.$route.params.saleType;
379
       this.salesType = this.$route.params.saleType;
296
 
380
 
297
-      const axios = require('axios');
381
+      const axios = require("axios");
298
       axios
382
       axios
299
         .get(
383
         .get(
300
-          `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`,
384
+          `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`
301
         )
385
         )
302
         .then(response => (this.propertyTypes = response.data));
386
         .then(response => (this.propertyTypes = response.data));
303
-    },
387
+
388
+      axios
389
+        .get(
390
+          `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`
391
+        )
392
+        .then(response => (this.propertyValues = response.data));
393
+    }
304
   },
394
   },
305
   watch: {
395
   watch: {
306
     SalesTypeChanged() {
396
     SalesTypeChanged() {
307
       console.log(this.salesType);
397
       console.log(this.salesType);
308
-    },
309
-  },
398
+    }
399
+  }
310
 };
400
 };
311
-</script>
401
+</script>

+ 12
- 6
src/components/timeshare/buy/buyPage.vue View File

59
                   >
59
                   >
60
                     <div class="card-body">
60
                     <div class="card-body">
61
                       <p class="mb-0" v-for="(resort, i) in region.resorts" :key="i">
61
                       <p class="mb-0" v-for="(resort, i) in region.resorts" :key="i">
62
-                        <a class="text-capitalize" href="/resort/">{{resort.resortName}}</a>
62
+                        <a
63
+                          class="text-capitalize"
64
+                          @click="routerGoTo('/resort/' + resort.resortCode)"
65
+                        >{{resort.resortName}}</a>
63
                         <br />
66
                         <br />
64
                       </p>
67
                       </p>
65
                     </div>
68
                     </div>
74
   </section>
77
   </section>
75
 </template>
78
 </template>
76
 <script>
79
 <script>
77
-import { mapState, mapActions } from "vuex";
80
+import { mapState, mapActions } from 'vuex';
78
 
81
 
79
 export default {
82
 export default {
80
-  name: "TimeshareToBuy",
83
+  name: 'TimeshareToBuy',
81
   mounted() {
84
   mounted() {
82
     this.getRegions();
85
     this.getRegions();
83
   },
86
   },
84
   computed: {
87
   computed: {
85
-    ...mapState("timeshareBuy", ["detailedRegion"])
88
+    ...mapState('timeshareBuy', ['detailedRegion']),
86
   },
89
   },
87
   methods: {
90
   methods: {
88
-    ...mapActions("timeshareBuy", ["getRegions"])
89
-  }
91
+    ...mapActions('timeshareBuy', ['getRegions']),
92
+    routerGoTo(goTo) {
93
+      this.$router.push(goTo);
94
+    },
95
+  },
90
 };
96
 };
91
 </script>
97
 </script>

+ 246
- 2
src/components/timeshare/resort/resortPage.vue View File

1
 <template>
1
 <template>
2
-  <div></div>
2
+  <div>
3
+    <section>
4
+      <section class="intro-single">
5
+        <div class="container">
6
+          <div class="row">
7
+            <div class="col-md-12 col-lg-8">
8
+              <div class="title-single-box">
9
+                <h1 class="title-single" style="text-align:left;">{{resort.prName}}</h1>
10
+              </div>
11
+            </div>
12
+          </div>
13
+        </div>
14
+      </section>
15
+      <div class="myMargin">
16
+        <div class="row">
17
+          <div class="col-md-3">
18
+            <h2>Filter Resorts</h2>
19
+            <form
20
+              id="mainForm"
21
+              method="POST"
22
+              action="/filter"
23
+              accept-charset="UTF-8"
24
+              enctype="multipart/form-data"
25
+            >
26
+              <div class="form-group">
27
+                <select class="form-control" name="region" id="region">
28
+                  <option value>Region</option>
29
+                </select>
30
+              </div>
31
+              <div class="form-group">
32
+                <select class="form-control" id="resort" name="resort">
33
+                  <option value>Resort</option>
34
+                </select>
35
+              </div>
36
+              <div class="form-group">
37
+                <select class="form-control" name="season">
38
+                  <option value>
39
+                    <span style="color:white;">Season</span>
40
+                  </option>
41
+                </select>
42
+              </div>
43
+              <div class="form-group">
44
+                <select class="form-control" name="bedrooms">
45
+                  <option value>Bedrooms</option>
46
+                </select>
47
+              </div>
48
+
49
+              <div class="form-group">
50
+                <input
51
+                  class="form-control"
52
+                  type="number"
53
+                  step="any"
54
+                  id="minPrice"
55
+                  name="minPrice"
56
+                  placeholder="Minimum Price"
57
+                />
58
+              </div>
59
+              <div class="form-group">
60
+                <input
61
+                  class="form-control"
62
+                  type="number"
63
+                  step="any"
64
+                  id="maxPrice"
65
+                  name="maxPrice"
66
+                  placeholder="Maximum Price"
67
+                />
68
+              </div>
69
+              <div class="form-group">
70
+                <label>Filter Arrival Date From</label>
71
+                <input
72
+                  style="color: white;"
73
+                  class="form-control"
74
+                  type="date"
75
+                  id="fromDate"
76
+                  name="fromDate"
77
+                  placeholder="Arrival Date"
78
+                />
79
+              </div>
80
+              <div class="form-group">
81
+                <label>Filter Arrival Date To</label>
82
+                <input
83
+                  style="color: white;"
84
+                  class="form-control"
85
+                  type="date"
86
+                  id="toDate"
87
+                  name="toDate"
88
+                  placeholder="Departure Date"
89
+                />
90
+              </div>
91
+
92
+              <br />
93
+
94
+              <button class="btn btn-blue" type="submit">SEARCH</button>
95
+            </form>
96
+            <div class="col-md-12 blue-bg p-2 p-md-4">
97
+              <h2>Facilities</h2>
98
+              <ul>
99
+                <li v-for="(item, i) in resort.prUnitFacilities.split('\n')" :key="i">{{item}}</li>
100
+              </ul>
101
+            </div>
102
+          </div>
103
+          <div class="col-md-9">
104
+            <table class="table table-bordered">
105
+              <thead>
106
+                <tr>
107
+                  <th>Resort</th>
108
+                  <th>Unit Number</th>
109
+                  <th>Week Number</th>
110
+                  <th>Module</th>
111
+                  <th>Bedrooms</th>
112
+                  <th>Season</th>
113
+                  <th>Price</th>
114
+                  <th>Status</th>
115
+                  <th>Interested</th>
116
+                </tr>
117
+              </thead>
118
+              <tbody>
119
+                <tr v-for="(item, i) in week" :key="i">
120
+                  <td>{{item.id}}</td>
121
+                  <td>{{item.code}}</td>
122
+                  <td>{{item.description}}</td>
123
+                  <td>{{item.id}}</td>
124
+                  <td>{{item.code}}</td>
125
+                  <td>{{item.description}}</td>
126
+                  <td>{{item.id}}</td>
127
+                  <td>{{item.code}}</td>
128
+                  <td>{{item.description}}</td>
129
+                </tr>
130
+              </tbody>
131
+            </table>
132
+            <div>
133
+              <div class="btn btn-primary" @click="routerGoTo('/timeshare/buy')">Back to Region</div>
134
+              <hr />
135
+            </div>
136
+            {{resort.prNotes}}
137
+            <hr />
138
+            <div class="row mb-4">
139
+              <div class="col-md-4">
140
+                <img class="img-fluid" :src="image1" alt="Resort Image" />
141
+              </div>
142
+              <div class="col-md-4">
143
+                <img class="img-fluid" :src="image2" alt="Resort Image" />
144
+              </div>
145
+              <div class="col-md-4">
146
+                <img class="img-fluid" :src="image3" alt="Resort Image" />
147
+              </div>
148
+            </div>
149
+            <div class="row">
150
+              <div class="col-md-12 mb-4">
151
+                <ul class="nav nav-tabs" id="myTab" role="tablist">
152
+                  <li class="nav-item">
153
+                    <a
154
+                      class="nav-link active"
155
+                      id="directions-tab"
156
+                      data-toggle="tab"
157
+                      href="#directions"
158
+                      role="tab"
159
+                      aria-controls="directions"
160
+                      aria-selected="false"
161
+                    >Directions</a>
162
+                  </li>
163
+                  <li class="nav-item">
164
+                    <a
165
+                      class="nav-link"
166
+                      id="resort-layout-tab"
167
+                      data-toggle="tab"
168
+                      href="#resort-layout"
169
+                      role="tab"
170
+                      aria-controls="resort-layout"
171
+                      aria-selected="true"
172
+                    >Resort Layout</a>
173
+                  </li>
174
+                </ul>
175
+                <div class="tab-content" id="myTabContent">
176
+                  <div
177
+                    class="tab-pane fade show active"
178
+                    id="directions"
179
+                    role="tabpanel"
180
+                    aria-labelledby="directions-tab"
181
+                  >
182
+                    <iframe
183
+                      :src="mapUrl"
184
+                      width="100%"
185
+                      height="450"
186
+                      frameborder="0"
187
+                      style="border:0"
188
+                      allowfullscreen
189
+                    ></iframe>
190
+                    <br />
191
+
192
+                    <small>
193
+                      <a
194
+                        :href="mapUrl"
195
+                        style="color:#0000FF;text-align:left"
196
+                        target="_blank"
197
+                      >See map bigger</a>
198
+                    </small>
199
+                  </div>
200
+                  <div
201
+                    class="tab-pane fade"
202
+                    id="resort-layout"
203
+                    role="tabpanel"
204
+                    aria-labelledby="resort-layout-tab"
205
+                  >
206
+                    <img class="img-fluid" :src="layout" alt="Resort Layout" />
207
+                  </div>
208
+                </div>
209
+              </div>
210
+            </div>
211
+          </div>
212
+        </div>
213
+      </div>
214
+    </section>
215
+  </div>
3
 </template>
216
 </template>
4
 <script>
217
 <script>
5
-export default {};
218
+import { mapState, mapActions } from 'vuex';
219
+
220
+export default {
221
+  props: {
222
+    resortCode: {},
223
+  },
224
+  mounted() {
225
+    this.initResort(this.resortCode);
226
+  },
227
+  computed: {
228
+    ...mapState('resort', ['resort', 'image1', 'image2', 'image3', 'layout']),
229
+    mapUrl() {
230
+      return this.resort
231
+        ? 'http://maps.google.com/maps?q='
232
+            + this.resort.prLatitude
233
+            + ', '
234
+            + this.resort.prLongitude
235
+            + '&z=15&output=embed'
236
+        : '';
237
+    },
238
+  },
239
+  methods: {
240
+    ...mapActions('resort', ['initResort']),
241
+    routerGoTo(goto) {
242
+      this.$router.push(goto);
243
+    },
244
+  },
245
+};
6
 </script>
246
 </script>
7
 <style>
247
 <style>
248
+.myMargin {
249
+  margin-left: 2%;
250
+  margin-right: 2%;
251
+}
8
 </style>
252
 </style>

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

109
     component: ContactUs,
109
     component: ContactUs,
110
   },
110
   },
111
   {
111
   {
112
-    path: 'resort/:resortCode',
112
+    path: '/resort/:resortCode',
113
     name: 'ResortPage',
113
     name: 'ResortPage',
114
     component: ResortPage,
114
     component: ResortPage,
115
     props: true,
115
     props: true,

+ 2
- 0
src/store/index.js View File

7
 import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
7
 import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
8
 import TimeshareBuyModule from './modules/timeshare/buyPage';
8
 import TimeshareBuyModule from './modules/timeshare/buyPage';
9
 import SearchTabModule from './modules/searchTab';
9
 import SearchTabModule from './modules/searchTab';
10
+import ResortModule from './modules/timeshare/resort';
10
 
11
 
11
 Vue.use(Vuex);
12
 Vue.use(Vuex);
12
 /* eslint no-param-reassign: ["error", { "props": false }] */
13
 /* eslint no-param-reassign: ["error", { "props": false }] */
18
     unitConfiguration: UnitConfigurationModule,
19
     unitConfiguration: UnitConfigurationModule,
19
     timeshareBuy: TimeshareBuyModule,
20
     timeshareBuy: TimeshareBuyModule,
20
     searchTab: SearchTabModule,
21
     searchTab: SearchTabModule,
22
+    resort: ResortModule,
21
   },
23
   },
22
 });
24
 });

+ 2
- 1
src/store/modules/timeshare/buyPage.js View File

25
       commit,
25
       commit,
26
       dispatch,
26
       dispatch,
27
     }) {
27
     }) {
28
+      commit('clearDetailed');
28
       axios.get(
29
       axios.get(
29
         'https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA/',
30
         'https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA/',
30
       )
31
       )
45
       if (region) {
46
       if (region) {
46
         axios
47
         axios
47
           .get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
48
           .get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
48
-            region.regionCode }/`)
49
+            region.regionCode}/`)
49
           .then(result => commit('addDetailed', {
50
           .then(result => commit('addDetailed', {
50
             id: region.id,
51
             id: region.id,
51
             regionCode: region.regionCode,
52
             regionCode: region.regionCode,

+ 96
- 0
src/store/modules/timeshare/resort.js View File

1
+/* eslint-disable no-restricted-syntax */
2
+/* eslint-disable guard-for-in */
3
+import axios from 'axios';
4
+
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    resort: {},
9
+    image1: '',
10
+    image2: '',
11
+    image3: '',
12
+    layout: '',
13
+  },
14
+  mutations: {
15
+    setResort(state, resort) {
16
+      state.resort = resort;
17
+    },
18
+    clear(state) {
19
+      state.resort = {};
20
+      state.image1 = '';
21
+      state.image2 = '';
22
+      state.image3 = '';
23
+      state.layout = '';
24
+    },
25
+    setImage1(state, image) {
26
+      state.image1 = `data:image/jpeg;base64,${image}`;
27
+    },
28
+    setImage2(state, image) {
29
+      state.image2 = `data:image/jpeg;base64,${image}`;
30
+    },
31
+    setImage3(state, image) {
32
+      state.image3 = `data:image/jpeg;base64,${image}`;
33
+    },
34
+    setLayout(state, image) {
35
+      state.layout = `data:image/jpeg;base64,${image}`;
36
+    },
37
+  },
38
+  getters: {},
39
+  actions: {
40
+    initResort({
41
+      commit,
42
+      dispatch,
43
+    }, resortCode) {
44
+      commit('clear');
45
+      dispatch('getResort', resortCode);
46
+      dispatch('getImage1', resortCode);
47
+      dispatch('getImage2', resortCode);
48
+      dispatch('getImage3', resortCode);
49
+      dispatch('getLayout', resortCode);
50
+    },
51
+    getResort({
52
+      commit,
53
+    }, resortCode) {
54
+      axios.get(
55
+        `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/TRESORT/${
56
+          resortCode}`,
57
+      )
58
+        .then((result) => {
59
+          commit('setResort', result.data);
60
+        })
61
+        .catch(console.error);
62
+    },
63
+    getImage1({
64
+      commit,
65
+    }, resortCode) {
66
+      axios.get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/${
67
+        resortCode}/image/1`)
68
+        .then(result => commit('setImage1', result.data))
69
+        .catch(console.error);
70
+    },
71
+    getImage2({
72
+      commit,
73
+    }, resortCode) {
74
+      axios.get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/${
75
+        resortCode}/image/2`)
76
+        .then(result => commit('setImage2', result.data))
77
+        .catch(console.error);
78
+    },
79
+    getImage3({
80
+      commit,
81
+    }, resortCode) {
82
+      axios.get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/${
83
+        resortCode}/image/3`)
84
+        .then(result => commit('setImage3', result.data))
85
+        .catch(console.error);
86
+    },
87
+    getLayout({
88
+      commit,
89
+    }, resortCode) {
90
+      axios.get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/${
91
+        resortCode}/layout`)
92
+        .then(result => commit('setLayout', result.data))
93
+        .catch(console.error);
94
+    },
95
+  },
96
+};

Loading…
Cancel
Save