Kobus 5 jaren geleden
bovenliggende
commit
a5679431c0

BIN
public/img/commercial.jpg Bestand weergeven


BIN
public/img/no-homes.gif Bestand weergeven


BIN
public/img/residential.jpg Bestand weergeven


+ 60
- 53
src/components/property/propertyCard.vue Bestand weergeven

@@ -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>

+ 27
- 9
src/components/property/propertyPage.vue Bestand weergeven

@@ -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 Bestand weergeven

@@ -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>

+ 120
- 36
src/components/property/propertyeditPage.vue Bestand weergeven

@@ -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,13 +22,7 @@
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 28
                 <label for="Property Type"></label>
@@ -37,10 +32,34 @@
37 32
                   id="propertyType"
38 33
                   v-model="property.propertyTypeId"
39 34
                 >
40
-                  <option value="0">Please select Property Type</option>
41
-                  <option v-for="item in propertyTypes" :value="item.id">{{ item.description }}</option>
35
+                  <option value="0">Please Select</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">
@@ -91,6 +110,7 @@
91 110
                   <option
92 111
                     v-for="province in provinces"
93 112
                     :value="province.id"
113
+                    :key="province.id"
94 114
                   >{{ province.description }}</option>
95 115
                 </select>
96 116
               </div>
@@ -103,8 +123,12 @@
103 123
                   @change="CitySelected"
104 124
                   v-model="property.cityId"
105 125
                 >
106
-                  <option value="0">Please select City</option>
107
-                  <option v-for="city in cities" :value="city.id">{{ city.description }}</option>
126
+                  <option value="0">Please Select</option>
127
+                  <option
128
+                    v-for="city in cities"
129
+                    :value="city.id"
130
+                    :key="city.id"
131
+                  >{{ city.description }}</option>
108 132
                 </select>
109 133
               </div>
110 134
               <div class="col-md-4">
@@ -115,8 +139,12 @@
115 139
                   id="suburbselector"
116 140
                   v-model="property.suburbId"
117 141
                 >
118
-                  <option value="0">Please select Suburb</option>
119
-                  <option v-for="suburb in suburbs" :value="suburb.id">{{ suburb.description }}</option>
142
+                  <option value="0">Please Select</option>
143
+                  <option
144
+                    v-for="suburb in suburbs"
145
+                    :value="suburb.id"
146
+                    :key="suburb.id"
147
+                  >{{ suburb.description }}</option>
120 148
                 </select>
121 149
               </div>
122 150
             </div>
@@ -155,15 +183,21 @@
155 183
                   placeholder="Property Description"
156 184
                   name="description"
157 185
                   v-model="property.description"
186
+                  id="description"
158 187
                 ></textarea>
159 188
                 <br />
160 189
                 <p>* A listing fee of R380 including VAT is payable to list your Property on the Uni-Vate website</p>
161 190
               </div>
162 191
             </div>
163 192
             <div class="form-group row" />
164
-            <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>
165 199
             <div class="form-group row" />
166
-            <div v-for="item in propertyValues">
200
+            <div v-for="item in propertyValues" :key="item.id">
167 201
               <div class="row">
168 202
                 <div class="col-sm-12">
169 203
                   <div class="title-box-d">
@@ -171,7 +205,11 @@
171 205
                   </div>
172 206
                 </div>
173 207
               </div>
174
-              <UserField :fields="item.fields" :id="item.id" />
208
+              <UserField
209
+                :fields="item.fields"
210
+                :id="item.id"
211
+                @UpdateUserDefinedFields="UpdateUserDefinedFields"
212
+              />
175 213
             </div>
176 214
             <div class="form-group row" />
177 215
             <div class="row">
@@ -181,8 +219,14 @@
181 219
                 </div>
182 220
               </div>
183 221
             </div>
184
-            <ImageLoad />
185
-            <button type="submit" class="btn btn-b-n" style="width: 85px; height:40px;">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>-->
186 230
           </form>
187 231
         </div>
188 232
       </div>
@@ -193,7 +237,7 @@
193 237
 <script>
194 238
 import UserField from "./propertyUserField.vue";
195 239
 import ImageLoad from "./propertyImage.vue";
196
-
240
+// https://vuejsexamples.com/a-vue-wrapper-around-the-trix-rich-text-editor/
197 241
 export default {
198 242
   name: "PropertyEdit",
199 243
   components: {
@@ -202,7 +246,7 @@ export default {
202 246
   },
203 247
   data() {
204 248
     return {
205
-      ApiRunning: false,
249
+      ApiRunning: true,
206 250
       propertyType: "Residential",
207 251
       salesType: "Rental",
208 252
       imageFile: "",
@@ -216,6 +260,8 @@ export default {
216 260
       selectedCity: "",
217 261
       property: {
218 262
         propertyTypeId: 0,
263
+        propertyName: "",
264
+        unit: "",
219 265
         addressLine1: "",
220 266
         addressLine2: "",
221 267
         addressLine3: "",
@@ -225,25 +271,40 @@ export default {
225 271
         price: "",
226 272
         per: "",
227 273
         description: "",
228
-        isSale: false
229
-      }
274
+        isSale: false,
275
+        propertyUserFields: [],
276
+        propertyImages: []
277
+      },
278
+      images: [],
279
+      propertyFieldValues: []
230 280
     };
231 281
   },
232 282
   methods: {
233 283
     SubmitData() {
234
-      const axios = require("axios");
235
-      axios
236
-        .post("http://localhost:57260/Property/Property", this.property, {
237
-          headers: {
238
-            "Content-type": "application/json"
239
-          }
240
-        })
241
-        .then(response => {})
242
-        .catch(e => {
243
-          alert(e);
244
-        });
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
+      //   });
245 302
 
246
-      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
+      });
247 308
     },
248 309
     ProvinceSelected(item) {
249 310
       if (item.target.options.selectedIndex > 0) {
@@ -270,6 +331,21 @@ export default {
270 331
           )
271 332
           .then(response => (this.suburbs = response.data));
272 333
       }
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
+      }
273 349
     }
274 350
   },
275 351
   mounted() {
@@ -282,7 +358,9 @@ export default {
282 358
       .then(response => (this.propValuesProp = response.data));
283 359
 
284 360
     axios
285
-      .get("http://localhost:57260/Property/PropertyFields")
361
+      .get(
362
+        `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`
363
+      )
286 364
       .then(response => (this.propertyValues = response.data));
287 365
 
288 366
     axios
@@ -306,6 +384,12 @@ export default {
306 384
           `http://localhost:57260/Property/PropertyType/type/${this.propertyType}`
307 385
         )
308 386
         .then(response => (this.propertyTypes = response.data));
387
+
388
+      axios
389
+        .get(
390
+          `http://localhost:57260/property/propertyfields/Propertytype/${this.propertyType}`
391
+        )
392
+        .then(response => (this.propertyValues = response.data));
309 393
     }
310 394
   },
311 395
   watch: {

Laden…
Annuleren
Opslaan