You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commercialSearchResults.vue 3.3KB

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