1'use strict' 2 3new Vue({ 4 el: '#wlac-objectlist', 5 mixins: [translationsMixin], 6 props: { 7 siteUrl: String, 8 templateName: String, 9 templateUrl: String, 10 objectlistTitle: String, 11 currency: String, 12 options: { 13 type: Object, 14 default: function () { 15 return { 16 showMap: true, 17 showSearchFilter: true, 18 referenceClickable: Boolean, 19 } 20 }, 21 }, 22 unitPerPage: { 23 type: Number, 24 default: function () { 25 let unitsPerPage = 12 26 if (showFirstCtaTile === '1') { 27 unitsPerPage-- 28 } 29 if (showSecondCtaTile === '1') { 30 unitsPerPage-- 31 } 32 return unitsPerPage 33 }, 34 }, 35 activePage: { 36 type: Number, 37 default: 1, 38 }, 39 countTotalUnits: Number, 40 suchauftragUrl: String, 41 }, 42 data: function () { 43 return { 44 paginatedUnits: [], 45 showPrice: false, 46 } 47 }, 48 created: function () { 49 // Set options. 50 this.options.showMap = wlacPublic.showMap === 'true' 51 this.options.showCtaBanner = showCtaBanner 52 this.options.showFirstCtaTile = showFirstCtaTile 53 this.options.showSecondCtaTile = showSecondCtaTile 54 55 const ctaOptions = JSON.parse(wlacCtaOptions) 56 57 this.options.ctaBanner = ctaOptions['CTA-Banner in Objektliste zeigen'] 58 this.options.ctaBannerLink = ctaOptions['Banner Link in Objektliste'] 59 this.options.firstCtaTile = ctaOptions['Erste CTA-Kachel in Objektliste zeigen'] 60 this.options.firstTileLink = ctaOptions['Erster Kachel-Link in Objektliste'] 61 this.options.secondCtaTile = ctaOptions['Zweite CTA-Kachel in Objektliste zeigen'] 62 this.options.secondTileLink = ctaOptions['Zweiter Kachel-Link in Objektliste'] 63 64 this.options.logo = brokerLogo 65 this.showPrice = showPrice === 'true' 66 this.options.showSearchFilter = wlacPublic.showSearchFilter === 'true' 67 this.options.referenceClickable = wlacReferenceClickable === 1 68 69 // Set other properties. 70 this.siteUrl = wlacSiteUrl 71 this.templateName = wlacPublic.template 72 this.templateUrl = wlacTemplateUrl 73 this.objectlistTitle = wlacObjectlistTitle 74 this.suchauftragUrl = suchauftragUrl 75 76 switch (wlacPublic.currency) { 77 case 'CHF': 78 this.currency = 'CHF' 79 break 80 case 'EUR': 81 default: 82 this.currency = 'â¬' 83 break 84 } 85 86 this.countTotalUnits = wlacUnits.length 87 this.paginatedUnits = this.paginateResults(wlacUnits) 88 }, 89 updated: function () { 90 const scrollTop = document.getElementById('objectlist') 91 scrollTop.scrollIntoView({ 92 behavior: 'smooth', 93 block: 'center', 94 inline: 'center', 95 }) 96 }, 97 methods: { 98 paginateResults: function (units) { 99 var paginatedUnits = {} 100 var paginationIndex = 1 101 paginatedUnits[1] = [] 102 for (let i = 1; i <= units.length; i++) { 103 paginatedUnits[paginationIndex].push(units[i - 1]) 104 if (i % this.unitPerPage === 0 && i !== units.length) { 105 paginationIndex++ 106 paginatedUnits[paginationIndex] = [] 107 } 108 } 109 return paginatedUnits 110 }, 111 getClientWidth: function () { 112 var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth 113 return width 114 }, 115 isMapEnabled: function () { 116 if (this.options.showMap === false) { 117 return false 118 } 119 120 if (!['newoffers', 'localoffers', 'project'].includes(this.templateName) && this.getClientWidth() > 767) { 121 return true 122 } 123 else { 124 return false 125 } 126 }, 127 isSearchFilterEnabled: function () { 128 if (this.options.showSearchFilter === false) { 129 return false 130 } 131 132 if (!['newoffers', 'localoffers', 'project'].includes(this.templateName)) { 133 return true 134 } 135 else { 136 return false 137 } 138 }, 139 }, 140 template: ` 141 <div> 142 <objectlistMap v-if="isMapEnabled()"></objectlistMap> 143 <searchFilter v-if="isSearchFilterEnabled()"></searchFilter> 144 <div v-if="templateName !== 'show_highlights'" id="objectlist-title" class="block-title"> 145 <h1 class="objectlist-editable-title" v-if="objectlistTitle !== ''">{{ objectlistTitle }}</h1> 146 <div v-if="countTotalUnits === 0"> 147 <h2><span>{{ t('Keine Immobilien zu sehen?') }}</span></h2> 148 <div class="block-title-sub apply-padding-bottom"> 149 {{ t('Legen Sie doch gleich kostenfrei und unverbindlich einen Suchauftrag an und wir kontaktieren Sie als Erstes, sobald wir ein passendes Angebot haben!') }} 150 </div> 151 <a class="wlac-button wlac-btn-suchauftrag-keine-objkt" :href="suchauftragUrl">{{ t('Suchauftrag anlegen') }}</a> 152 </div> 153 <h1 class="hide-at-standort" v-else-if="templateName === 'reference' && countTotalUnits > 0">
154 <span>{{ t('Alle Referenzimmobilien') }}</span></h1> 155 <h1 class="hide-at-standort" 156 v-else-if="!['newoffers', 'localoffers', 'project'].includes(templateName) && countTotalUnits > 0"> 157 <span>{{ t('Alle Angebote') }}</span></h1> 158 <div v-if="!['newoffers', 'project'].includes(templateName) && countTotalUnits > 0" 159 class="block-title-sub hide-at-standort">{{ countTotalUnits }} {{ t('Immobilien gefunden') }} 160 </div> 161 </div> 162 <page v-bind:units="paginatedUnits[activePage]"></page> 163 <pagination v-if="!['newoffers'].includes(templateName)"></pagination> 164 </div> 165 `, 166})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.