Bruce Lywood 5年前
コミット
01b37c3da2

バイナリ
public/img/commercial.jpg ファイルの表示


バイナリ
public/img/no-homes.gif ファイルの表示


バイナリ
public/img/residential.jpg ファイルの表示


+ 60
- 53
src/components/property/propertyCard.vue ファイルの表示

@@ -1,66 +1,73 @@
1 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 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 59
           </div>
53 60
         </div>
54 61
       </div>
62
+      <br />
55 63
     </div>
56
-    <br />
57 64
   </div>
58 65
 </template>
59 66
 
60 67
 <script>
61 68
 export default {
62 69
   props: {
63
-    currentProperty: Object,
64
-  },
70
+    properties: Object
71
+  }
65 72
 };
66
-</script>
73
+</script>

+ 7
- 7
src/components/property/propertyImage.vue ファイルの表示

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div>
3 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 5
         Upload
6 6
         <input
7 7
           type="file"
@@ -30,7 +30,7 @@ export default {
30 30
   data() {
31 31
     return {
32 32
       images: {},
33
-      image: [],
33
+      image: []
34 34
     };
35 35
   },
36 36
 
@@ -50,7 +50,7 @@ export default {
50 50
         const reader = new FileReader();
51 51
         var vm = this;
52 52
 
53
-        reader.onload = (e) => {
53
+        reader.onload = e => {
54 54
           vm.image.push(e.target.result);
55 55
           console.log(vm.image);
56 56
         };
@@ -63,9 +63,9 @@ export default {
63 63
       this.images.splice(key, 1);
64 64
 
65 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 ファイルの表示

@@ -34,10 +34,28 @@
34 34
           <div class="col-sm-12">
35 35
             <div id="property-single-carousel" class="owl-carousel owl-arrow gallery-property">
36 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 41
               </div>
39 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 59
               </div>
42 60
             </div>
43 61
             <div class="row justify-content-between">
@@ -62,7 +80,7 @@
62 80
                     <ul class="list" v-for="item in display.values">
63 81
                       <li class="d-flex justify-content-between">
64 82
                         <strong>{{ item.name }}:</strong>
65
-                        <span>{{ item.value }}</span>
83
+                        <span v-html="item.value"></span>
66 84
                       </li>
67 85
                     </ul>
68 86
                   </div>
@@ -333,24 +351,24 @@
333 351
 
334 352
 <script>
335 353
 export default {
336
-  name: 'Property',
354
+  name: "Property",
337 355
   data() {
338 356
     return {
339 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 363
     axios
346 364
       .get(`http://localhost:57260/Property/Property/${this.$route.params.id}`)
347 365
       .then(response => (this.Property = response.data));
348 366
 
349 367
     axios
350 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 371
       .then(response => (this.propertyImages = response.data));
354
-  },
372
+  }
355 373
 };
356 374
 </script>

+ 105
- 16
src/components/property/propertySearchPage.vue ファイルの表示

@@ -3,17 +3,25 @@
3 3
     <div class="col-md-12">
4 4
       <h3 class="my-4">Property Listing</h3>
5 5
     </div>
6
-
6
+    <br />
7
+    <br />
8
+    <br />
7 9
     <div>
8 10
       <propertyCard
11
+        v-if="Properties.length > 0"
9 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 22
     </div>
15 23
     <br />
16
-    <div class="container">
24
+    <div class="container" v-if="propertyType === 'Residential'">
17 25
       <div class="row">
18 26
         <div class="col-md-12">
19 27
           <h1 class="my-4">About Residential Properties</h1>
@@ -36,16 +44,51 @@
36 44
           </p>
37 45
           <p>
38 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 83
           </p>
41 84
           <p>
42 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 87
           </p>
45 88
         </div>
46 89
         <div class="col-md-4 text-center">
47 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 92
           </p>
50 93
         </div>
51 94
       </div>
@@ -53,23 +96,69 @@
53 96
   </div>
54 97
 </template>
55 98
 <script>
56
-import propertyCard from '../property/propertyCard.vue';
99
+import propertyCard from "../property/propertyCard.vue";
100
+import { isNull } from "util";
57 101
 
58 102
 export default {
59
-  name: 'ResidentialSearch',
103
+  name: "propertysearch",
60 104
   components: {
61
-    propertyCard,
105
+    propertyCard
62 106
   },
63 107
   data() {
64 108
     return {
65 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 164
 </script>

+ 172
- 82
src/components/property/propertyeditPage.vue ファイルの表示

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

+ 12
- 6
src/components/timeshare/buy/buyPage.vue ファイルの表示

@@ -59,7 +59,10 @@
59 59
                   >
60 60
                     <div class="card-body">
61 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 66
                         <br />
64 67
                       </p>
65 68
                     </div>
@@ -74,18 +77,21 @@
74 77
   </section>
75 78
 </template>
76 79
 <script>
77
-import { mapState, mapActions } from "vuex";
80
+import { mapState, mapActions } from 'vuex';
78 81
 
79 82
 export default {
80
-  name: "TimeshareToBuy",
83
+  name: 'TimeshareToBuy',
81 84
   mounted() {
82 85
     this.getRegions();
83 86
   },
84 87
   computed: {
85
-    ...mapState("timeshareBuy", ["detailedRegion"])
88
+    ...mapState('timeshareBuy', ['detailedRegion']),
86 89
   },
87 90
   methods: {
88
-    ...mapActions("timeshareBuy", ["getRegions"])
89
-  }
91
+    ...mapActions('timeshareBuy', ['getRegions']),
92
+    routerGoTo(goTo) {
93
+      this.$router.push(goTo);
94
+    },
95
+  },
90 96
 };
91 97
 </script>

+ 246
- 2
src/components/timeshare/resort/resortPage.vue ファイルの表示

@@ -1,8 +1,252 @@
1 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 216
 </template>
4 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 246
 </script>
7 247
 <style>
248
+.myMargin {
249
+  margin-left: 2%;
250
+  margin-right: 2%;
251
+}
8 252
 </style>

+ 1
- 1
src/router/index.js ファイルの表示

@@ -109,7 +109,7 @@ export default new Router({
109 109
     component: ContactUs,
110 110
   },
111 111
   {
112
-    path: 'resort/:resortCode',
112
+    path: '/resort/:resortCode',
113 113
     name: 'ResortPage',
114 114
     component: ResortPage,
115 115
     props: true,

+ 2
- 0
src/store/index.js ファイルの表示

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

+ 2
- 1
src/store/modules/timeshare/buyPage.js ファイルの表示

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

+ 96
- 0
src/store/modules/timeshare/resort.js ファイルの表示

@@ -0,0 +1,96 @@
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
+};

読み込み中…
キャンセル
保存