1//LA DATA DEBE RECIBIR UN ARRAY DE ARRAY CON SIETE PARAMETROS, TITLE, ADDRESS, ROOMS, BATHROOMS, DESC, PRICE, PHOTO, AGENCY 2//data_property['title']; 3//data_property['address']; 4//data_property['town']; 5//data_property['rooms']; 6//data_property['bathrooms']; 7//data_property['desc']; 8//data_property['price_sale']; 9//data_property['price_rent']; 10//data_property['photo_url']; 11//data_property['agency']; 12 13/** 14 * CHANGELOG: 15 * SE IMPLEMENTA PROPERTY VISIBILITY PERO RECORDAR QUE SOLO SIRVE PARA VENTA Y ALQUILER, LO QUE SEA TEMPORAL LO OCULTARA SIEMPREE!!!! 16 * SI SE DESEA IMPLEMENTAR ALQUILERES TEMPORALES ENTONCES HABRA QUE RECREAR PARTE DEL CODIGO PORQUE ESTE NO ESTA HECHO PARA MOSTRARLOS 17 */ 18 19function get_chromeless_property_url(text_seo, property_code) { 20 let property_url = '/' + get_lang() + '/' + get_name_controller_by_lang('property') + (text_seo !== null && text_seo !== undefined && text_seo != "" ? (text_seo + '-') : "/") + property_code; 21 let property_url_params = []; 22 23 ["noheader", "nofooter"].forEach(function (property_url_param) { 24 let property_url_param_value = findGetParameter(property_url_param); 25 if (property_url_param_value !== null && property_url_param_value !== undefined) { 26 property_url_params.push(encodeURIComponent(property_url_param) + '=' + encodeURIComponent(property_url_param_value)); 27 } 28 }); 29 30 if (property_url_params.length > 0) { 31 property_url += '?' + property_url_params.join('&'); 32 } 33 34 return property_url; 35} 36 37function inmotek_pagination(data, page_actual, max_by_page, s_map, params_search, text_search) { 38 let type_pagination = 0; 39 let type_content = 0; 40 let page_act = page_actual || 1; 41 max_by_page = max_by_page || 12; 42 let r_data = data; 43 let max_propertys = get_max_propertys(params_search); 44 max_page = Math.ceil(max_propertys / max_by_page); 45 view_mode = "photo"; 46 photo_view_mode_content = ""; 47 list_view_mode_content = ""; 48 locale = get_locale(); 49 var await_search; 50 51 //Insertamos el numero de inmuebles disponibles y generamos un titulo acorde a los parametros de busqueda 52 $(".searchtitle-count").html(formatNumber(max_propertys)); 53 54 let text_title = T("INMUEBLES"); 55 if (params_search['operation'] != "") { 56 text_title += params_search['operation'] == "a" ? " " + T("EN_ALQUILER") : " " + T("EN_VENTA"); 57 } 58 if (text_search['location_zones'] != "" && text_search['location_zones'] != undefined) { 59 text_title += ", " + text_search['location_zones']; 60 } 61 62 $(".searchtitle-title").html(text_title); 63 64 //------------------------------------------------------------------------------------------------------- 65 66 if (max_page <= 1) { 67 $(".inmotek-pagination-bar .pagination").hide(); 68 } else { 69 $(".inmotek-pagination-bar .pagination").show(); 70 } 71 72 let type_view = findGetParameter("view"); 73 74 //Se calcula si debe mostrarse el list o grid 75 if (type_view == null || type_view == undefined || type_view == "" || type_view == '0') { 76 type_content = 0; 77 view_mode = "photo"; 78 } else { 79 type_content = 1; 80 view_mode = "list"; 81 } 82 83 //Si es mobile, siempre sera list 84 if (window.innerWidth <= 767) { 85 type_content = 1; 86 view_mode = "list"; 87 } 88 89 90 switch (type_pagination) { 91 case 0: 92 create_pagination(max_page, page_act); 93 break; 94 default: 95 create_pagination(max_page, page_act); 96 break; 97 } 98 99 if (max_page >= 7) { 100 $(".page-end").removeClass("d-none"); 101 } 102 103 switch (type_content) { 104 case 0: 105 photo_view_mode_content = create_pagination_content_0(r_data) 106 list_view_mode_content = create_pagination_content_list(r_data) 107 set_disable_spinner() 108 $('#page-content').html(photo_view_mode_content) 109 create_events(r_data.length) 110 show_hide_page_panel(true) 111 break 112 case 1: 113 photo_view_mode_content = create_pagination_content_0(r_data) 114 list_view_mode_content = create_pagination_content_list(r_data) 115 set_disable_spinner() 116 $('#page-content').html(list_view_mode_content) 117 create_events(r_data.length) 118 show_hide_page_panel(true) 119 break; 120 default: 121 photo_view_mode_content = create_pagination_content_0(r_data) 122 list_view_mode_content = create_pagination_content_list(r_data) 123 set_disable_spinner() 124 $('#page-content').html(photo_view_mode_content) 125 create_events(r_data - length) 126 show_hide_page_panel(true) 127 break 128 } 129 130 $(".page").click(function () { 131 132 page_act = $(this).data("page"); 133 134 show_hide_pagination("click", page_act); 135 136 let n_url = replaceUrlParameter(location.search, "page", page_act); 137 history.pushState(null, null, n_url);
138 setCookie("last_search", n_url, 1); 139 140 $('.page').each(function (index, obj) { 141 if ($(obj).data("page") != page_act) { 142 $(obj).removeClass("active"); 143 } 144 if ($(obj).data("page") == page_act) { 145 $(obj).addClass("active"); 146 } 147 }) 148 149 if (get_codename() == "vericorral" || get_codename() == "etxelan") { 150 window.scrollTo(0, 0); 151 } 152 get_data_property(params_search, page_act, max_by_page, s_map); 153 }) 154 155 $(".page-prev").click(function () { 156 if (page_act > 1) { 157 if (await_search) { 158 clearTimeout(await_search); 159 } 160 161 page_act = page_act - 1; 162 163 show_hide_pagination("prev", page_act); 164 165 let n_url = replaceUrlParameter(location.search, "page", page_act); 166 history.pushState(null, null, n_url); 167 setCookie("last_search", n_url, 1); 168 169 $('.page').each(function (index, obj) { 170 if ($(obj).data("page") != page_act) { 171 $(obj).removeClass("active"); 172 } 173 if ($(obj).data("page") == page_act) { 174 $(obj).addClass("active"); 175 } 176 }) 177 178 await_search = setTimeout(function () { 179 if (get_codename() == "vericorral" || get_codename() == "etxelan") { 180 window.scrollTo(0, 0); 181 } 182 get_data_property(params_search, page_act, max_by_page, s_map); 183 }, 310); 184 } 185 }) 186 187 $(".page-next").click(function () { 188 189 if (page_act < max_page) { 190 if (await_search) { 191 clearTimeout(await_search); 192 } 193 194 page_act = (page_act * 1) + 1; 195 196 show_hide_pagination("next", page_act); 197 198 let n_url = replaceUrlParameter(location.search, "page", page_act); 199 history.pushState(null, null, n_url); 200 setCookie("last_search", n_url, 1); 201 202 $('.page').each(function (index, obj) { 203 if ($(obj).data("page") != page_act) { 204 $(obj).removeClass("active"); 205 } 206 if ($(obj).data("page") == page_act) { 207 $(obj).addClass("active"); 208 } 209 }) 210 211 await_search = setTimeout(function () { 212 if (get_codename() == "vericorral" || get_codename() == "etxelan") { 213 window.scrollTo(0, 0); 214 } 215 get_data_property(params_search, page_act, max_by_page, s_map); 216 }, 310); 217 } 218 }) 219 220 $('#viewListMode').click(function () { 221 view_mode = "list"; 222 let n_url = replaceUrlParameter(location.search, "view", "1"); 223 history.pushState(null, null, n_url); 224 setCookie("last_search", n_url, 1); 225 $('#page-content').html(list_view_mode_content); 226 227 $('#viewGridMode i').removeClass("text-primary-color"); 228 $('#viewListMode i').addClass("text-primary-color"); 229 create_events(); 230 }); 231 232 $('#viewGridMode').click(function () { 233 view_mode = "photo"; 234 let n_url = replaceUrlParameter(location.search, "view", "0"); 235 history.pushState(null, null, n_url); 236 setCookie("last_search", n_url, 1); 237 $('#page-content').html(photo_view_mode_content); 238 239 $('#viewListMode i').removeClass("text-primary-color"); 240 $('#viewGridMode i').addClass("text-primary-color"); 241 create_events(); 242 }); 243 244} 245 246function get_data_property(params_search, page_act, max_by_page, s_map) { 247 let temp_page = page_act - 1; 248 if (temp_page < 0) { 249 temp_page = 1; 250 } 251 let num_init = (temp_page * max_by_page); 252 let num_end = max_by_page; 253 let array_property = []; 254 params_search['limit'] = num_init + "," + num_end; 255 256 set_enable_spinner() 257 258 fetch_data_post(get_base_url() + '/' + get_lang() + '/action/get_data_property_search', params_search, function (response) { 259 let obj = JSON.parse(response);
260 obj.property_search.forEach(function (property) { 261 let data_property = []; 262 let address_raw = property.propertyAddress.addressSubZone + "," + property.propertyAddress.addressZone + "," + property.propertyAddress.addressTown + "," + property.propertyAddress.addressProvince; 263 let line_address = $.grep(address_raw.split(','), function (value) { 264 if (value != "null" && value != "") { return value } 265 }); 266 data_property['status'] = property.propertyStatus; 267 data_property['title'] = property.propertyTitle; 268 data_property['address'] = line_address.join(); 269 data_property['town'] = property.propertyAddress.addressTown; 270 data_property['rooms'] = property.propertyFeatures.featuresRooms; 271 data_property['bathrooms'] = property.propertyFeatures.featuresBathroomNumber; 272 data_property['desc'] = stripHtml(property.propertyDescription); 273 data_property['operation'] = property.propertyOperation.operationType; 274 data_property['price_sale'] = property.propertyOperation.operationPriceSale; 275 data_property['price_rent'] = property.propertyOperation.operationPriceRent; 276 data_property['operation_search'] = params_search['operation']; 277 data_property['price_sale_visibility'] = (property.propertyOperation.operationVisibilitySale == true && property.propertyOperation.operationType.includes("v")) ? true : false; 278 data_property['price_rent_visibility'] = (property.propertyOperation.operationVisibilityRent == true && property.propertyOperation.operationType.includes("a")) ? true : false; 279 data_property['price_sale_before'] = property.propertyOperation.operationPricePreviousSale; 280 data_property['price_rent_before'] = property.propertyOperation.operationPricePreviousRent; 281 data_property['photo'] = property.propertyMedia.photo; 282 data_property['photo_url'] = property.propertyMedia.url_large; 283 data_property['images'] = property.propertyImages; 284 data_property['reference'] = property.propertyReference; 285 data_property['code'] = property.propertyCode; 286 data_property['agency'] = property.propertyAgency; 287 data_property['type'] = property.propertyFeatures.featuresType; 288 data_property['meters_b'] = property.propertyFeatures.featuresAreaConstructed; 289 data_property['meters_a'] = property.propertyFeatures.featuresAreaConstructed; 290 data_property['latitud'] = property.propertyAddress.addressCoordinatesLatitude; 291 data_property['longitud'] = property.propertyAddress.addressCoordinatesLongitude; 292 data_property['elevator'] = property.propertyFeatures.featuresLift; 293 data_property['garage'] = property.propertyFeatures.featuresGarage; 294 data_property['storage'] = property.propertyFeatures.featuresStorage; 295 data_property['exterior'] = property.propertyFeatures.featuresExterior; 296 data_property['terrace'] = property.propertyFeatures.featuresTerrace; 297 data_property['balcony'] = property.propertyFeatures.featuresBalcony; 298 data_property['garden'] = property.propertyFeatures.featuresGarden; 299 data_property['pool'] = property.propertyFeatures.featuresPool; 300 data_property['3d'] = property.propertyFeatures.propertyVirtualTours3D; 301 302 array_property.push(data_property); 303 }); 304 305 show_hide_page_panel(false); 306 307 photo_view_mode_content = create_pagination_content_0(array_property); 308 list_view_mode_content = create_pagination_content_list(array_property); 309 310 let browser = getBrowserInfo(); 311 312 if (array_property.length >= 1 && !browser.includes("IE")) { 313 s_map.setMark(array_property, true); 314 } 315 316 if (view_mode == "photo") { 317 set_disable_spinner() 318 $('#page-content').html(photo_view_mode_content); 319 } 320 321 if (view_mode == "list") { 322 set_disable_spinner() 323 $('#page-content').html(list_view_mode_content); 324 } 325 326 create_events(array_property.length); 327 }) 328} 329 330function show_hide_pagination(direction, page_act) { 331 var num_add, num_del, num_right, num_left; 332 333 if (direction === 'next') { 334 num_add = page_act; 335 num_del = page_act - 6; 336 } 337 338 if (direction === 'prev') { 339 num_del = page_act + 1; 340 num_add = num_del - 6; 341 } 342 343 if (direction === 'click') { 344 num_right = page_act; 345 num_left = page_act - 6; 346 } 347 348 if (page_act < max_page) { 349 if (max_page >= 7) { 350 $('.page-end').removeClass("d-none"); 351 } 352 } else { 353 $('.page-end').addClass("d-none"); 354 } 355 356 if (page_act <= 6) { 357 $('.page-start').addClass("d-none"); 358 } else { 359 $('.page-start').removeClass("d-none"); 360 } 361 362 if (page_act > 6) { 363 if (direction === 'click') { 364 $('.page-item').each(function (index, obj) { 365 if ($(obj).data("page") > num_right || $(obj).data("page") < num_left) { 366 $(obj).addClass("d-none"); 367 } else { 368 $(obj).removeClass("d-none"); 369 } 370 }) 371 } else { 372 $('.page-item').each(function (index, obj) { 373 if ($(obj).data("page") == num_add) { 374 $(obj).removeClass("d-none"); 375 } 376 if ($(obj).data("page") == num_del) { 377 $(obj).addClass("d-none"); 378 } 379 }) 380 } 381 } else { 382 if (direction === 'click') { 383 $('.page-item').each(function (index, obj) { 384 if ($(obj).data("page") > 6) { 385 $(obj).addClass("d-none"); 386 } else { 387 $(obj).removeClass("d-none"); 388 } 389 }) 390 } 391 } 392 393 $(".num-list-pagination").text(T("PAGINA_X_DE_X", { param1: page_act, param2: max_page })); 394 395} 396 397function show_hide_page_panel(first_print) { 398 $('.page-panel').each(function (index, obj) { 399 if ($(obj).data("panel") != page_act) { 400 $(obj).removeClass("panel-active"); 401 $(obj).hide(); 402 } 403 if ($(obj).data("panel") == page_act) { 404 $(obj).addClass("panel-active"); 405 $(obj).show(); 406 } 407 }) 408 409 //Si entro por redireccion y no por cambio de pagina cambio el scroll 410 if (first_print) { 411 var pos = window.name || 0; 412 window.scrollTo(0, pos); 413 } 414} 415 416function create_pagination(max_page, page_act) { 417 let is_bigger_than_six = false;
418 let page_class_active = ''; 419 var hide_nav = ""; 420 421 if (page_act == 1) { 422 page_class_active = 'active' 423 } 424 425 if (page_act > 6) { 426 is_bigger_than_six = true; 427 } 428 429 let html_page = 430 '<li class="page-item">' + 431 '<a class="page-link page-prev">' + 432 '<span aria-hidden="true">«</span>' + 433 '<span class="sr-only">' + T("ANTERIOR") + '</span>' + 434 '</a>' + 435 '</li>'; 436 html_page += '<li class=" page-start ' + (is_bigger_than_six ? '' : 'd-none') + '" ><a class="page-link">...</a></li>'; 437 438 html_page += '<li class="page-item page ' + (is_bigger_than_six ? 'd-none' : '') + ' ' + page_class_active + '" data-page="1"><a class="page-link">1</a></li>'; 439 440 //Se le resta 1 porque el data-page-1 se dibuja fuera del for 441 var count_hide_left = ((page_act - 6) - 1) <= 0 ? 0 : (page_act - 6) - 1; 442 var count_show_right = (6 - page_act) <= 0 ? 0 : (6 - page_act); 443 444 for (let index = 2; index < (max_page + 1); index++) { 445 page_class_active = ''; 446 hide_nav = ""; 447 448 if (count_hide_left > 0) { 449 hide_nav = "d-none"; 450 count_hide_left--; 451 } 452 453 if (count_show_right <= 0 && index > page_act) { 454 hide_nav = "d-none"; 455 } 456 457 if (count_show_right > 0 && index > page_act) { 458 count_show_right--; 459 } 460 461 if (page_act == index) { 462 page_class_active = 'active'; 463 } 464 html_page += '<li class="page-item page ' + hide_nav + ' ' + page_class_active + ' " data-page="' + index + '"><a class="page-link">' + index + '</a></li>'; 465 } 466 html_page += '<li class=" page-end d-none" ><a class="page-link">...</a></li>'; 467 html_page += 468 '<li class="page-item">' + 469 '<a class="page-link page-next">' + 470 '<span aria-hidden="true">»</span>' + 471 '<span class="sr-only">' + T("SIGUIENTE") + '</span>' + 472 '</a>' + 473 '</li>'; 474 html_page += '<span class="text-primary-color num-list-pagination">' + T("PAGINA_X_DE_X", { param1: page_act, param2: max_page }) + '</span>'; 475 $('.pagination').html(html_page); 476} 477 478function create_pagination_content_0(property_data) { 479 let browser = getBrowserInfo(); 480 481 search_map_on = $('#results_str').attr('data-map'); 482 search_map_pc = $('#results_str').attr('data-map-pc'); 483 search_list_cols = $('#results_str').attr('data-list-cols'); 484 485 //Fix al bug 486 if (search_list_cols == "1") { 487 search_list_cols = "6"; 488 } 489 490 if (search_map_on == '1' && !browser.includes("IE")) { 491 $('#results_list').addClass('col-lg-' + (12 - search_map_pc)); 492 $('#results_map').addClass('col-lg-' + search_map_pc); 493 } else { 494 $('#results_list').addClass('col-lg-10 offset-lg-1'); 495 $('#results_map').removeClass('d-lg-block'); 496 } 497 498 let html_page_content = ""; 499 500 if (property_data.length == 0) { 501 html_page_content = html_page_content + 502 '<div class="mt-1 mb-1 col-12 col-md-12 col-lg-12" style="text-align: center;margin-top: 10em !important;padding-bottom: 10em;background-color:unset;">' + 503 '<span>' + T('NO_HAY_INMUEBLES') + '</span>' + 504 '</div>'; 505 506 return html_page_content; 507 } 508 509 property_data.forEach(function (data) { 510 511 let habs = ""; 512 if (data['type'] == "Local" || data['type'] == "Oficina" || data['type'] == "Nave") { 513 habs = (data['rooms'] * 1) >= 1 ? data['rooms'] + " <i class='google-symbols-meeting-room' title='" + T("HABITACIONES") + "'></i> " : ""; 514 } else { 515 habs = (data['rooms'] * 1) >= 1 ? data['rooms'] + " <i class='google-symbols-bed' title='" + T("HABITACIONES") + "'></i> " : ""; 516 } 517 518 let banos = ""; 519 if (data['type'] == "Local" || data['type'] == "Oficina" || data['type'] == "Nave") { 520 banos = (data['bathrooms'] * 1) >= 1 ? data['bathrooms'] + " <i class='google-symbols-wc' title='" + T("BANOS") + "'></i> " : ""; 521 } else { 522 banos = (data['bathrooms'] * 1) >= 1 ? data['bathrooms'] + " <i class='google-symbols-bathtub' title='" + T("BANOS") + "'></i> " : ""; 523 } 524 525 let price_sale = (data['operation'].includes("v") && (data['operation_search'].includes("v") || data['operation_search'] == "")) ? data['price_sale'] : ""; 526 527 if (price_sale != "") { 528 price_sale = ((price_sale * 1) > 1 && data['price_sale_visibility']) ? (formatNumber(data['price_sale']) + "â¬") : T("PRECIO_A_CONSULTAR"); 529 } 530 531 let price_rent = (data['operation'].includes("a") && (data['operation_search'].includes("a") || data['operation_search'] == "")) ? data['price_rent'] : ""; 532 533 if (price_rent != "") { 534 price_rent = ((price_rent * 1) > 1 && data['price_rent_visibility']) ? (formatNumber(data['price_rent']) + "â¬") : T("PRECIO_A_CONSULTAR"); 535 } 536 537 let price_sale_before = ((data['price_sale_before'] * 1) >= 1 && data['price_sale_visibility'] && (data['operation_search'].includes("v") || data['operation_search'] == "")) ? (numberWithCommas(data['price_sale_before'], locale.separador_miles)) : ""; 538 let price_rent_before = ((data['price_rent_before'] * 1) >= 1 && data['price_rent_visibility'] && (data['operation_search'].includes("a") || data['operation_search'] == "")) ? (numberWithCommas(data['price_rent_before'], locale.separador_miles)) : ""; 539 let title = data['title'] == "" ? T("X_EN_X", { param1: data['type'], param2: ((data['town'] == "" || data['town'] == null) ? (data['operation'] == "a" ? T("ALQUILER") : T("VENTA")) : data['town']) }) : data['title']; 540 let elevator = data['elevator'] === true ? " <i class='google-symbols-elevator' title='" + T("ASCENSOR") + "'></i> " : ""; 541 let garage = data['garage'] === true ? " <i class='google-symbols-directions-car' title='" + T("GARAJE") + "'></i> " : "";
542 let trastero = data['storage'] === true ? " <i class='google-symbols-garage-home' title='" + T("TRASTERO") + "'></i> " : ""; 543 let exterior = data['exterior'] == "1" ? " <i class='google-symbols-vertical-shades' title='" + T("EXTERIOR") + "'></i> " : ""; 544 let terraza = data['terrace'] === true ? " <i class='google-symbols-deck' title='" + T("TERRAZA") + "'></i> " : ""; 545 let balcon = data['balcony'] === true ? " <i class='google-symbols-curtains-closed' title='" + T("BALCON") + "'></i> " : ""; 546 let jardin = data['garden'] === true ? " <i class='google-symbols-potted-plant' title='" + T("JARDIN") + "'></i> " : ""; 547 let piscina = data['pool'] === true ? " <i class='google-symbols-pool' title='" + T("PISCINA") + "'></i> " : ""; 548 let virtual_tour_3d = data['3d'] === true ? " <i class='google-symbols-3d-rotation' title='" + T("TOUR_VIRTUAL") + "'></i> " : ""; 549 let text_seo = ""; 550 551 //Obtenemos el dato de las metaetiquetas 552 if (document.documentElement.dataset.cmsprm1 == "1") { 553 text_seo = url_text_seo_generate(data['type'], data['operation'], data['town'], title) 554 } else if (document.documentElement.dataset.cmsprm1 == "2") { 555 text_seo = url_text_seo_generate(data['type'], data['operation'], data['town']) 556 } 557 558 559 html_page_content += 560 `<div class="mt-1 mb-1 col-12 col-md-6 col-lg-${search_list_cols}"> 561 <div class="card-search card-data pt-2" data-name="${data['code']}"> 562 <div class="img-card-search"> 563 <div class="labels-wrap labels-right" style="position: absolute; z-index: 1;
563 top: 17px; right: 20px;"> 564 <span class="label-operation label background-primary-color" style="font-size: 13px;line-height: 11px;font-weight: 500;margin: 0;text-transform: uppercase;padding: 3px 5px;color: #fff;border-radius: 2px;"> 565 Ref: ${(data['reference'] == '' ? data['code'] : data['reference'])} 566 </span> 567 </div> 568 <a href="${get_chromeless_property_url(text_seo, data['code'])}"> 569 <div class="img-card-layer" style="background-image: url('${clean_image_path(data['photo_url'])}');"></div> 570 <div class="text-card-search pt-3 pb-3 pl-2 pr-2"> 571 <div class="row"> 572 <div class="col-12"> 573 <div class="title-text-card-search text-primary-color">${capitalizeFirstLetter(title)}</div> 574 <div class="address-text-card-search"><i class="google-symbols-location-on sm"></i> ${data['address']}</div> 575 </div> 576 </div> 577 <div class="row justify-content-beetween"> 578 <div class="px-3 mr-auto"> 579 <div class="features1-text-card-search">${habs}${banos}${elevator}${garage}${trastero}${exterior}${terraza}${balcon}${jardin}${piscina}${virtual_tour_3d}</div> 580 </div> 581 <div class="px-3 ml-auto">`; 582 if (((price_sale_before * 1) > 1 && data['price_sale_visibility']) || ((price_rent_before * 1) > 1 && data['price_rent_visibility'])) { 583 html_page_content += 584 `<div class="text-right" style="font-size:0.9rem;line-height:0.9rem;color:red;">`; 585 if ((price_sale_before * 1) > 1) { 586 html_page_content += 587 `<span>${T("ANTES_VENTA")}: </span> 588 <span style="text-decoration: line-through;">${price_sale_before}â¬</span>`; 589 } 590 if ((price_sale_before * 1) > 1 && (price_rent_before * 1) > 1) { 591 html_page_content += " - "; 592 } 593 if ((price_rent_before * 1) > 1) { 594 html_page_content += 595 `<span>${T("ANTES_ALQUILER")}: </span> 596 <span style="text-decoration: line-through;">${price_rent_before}â¬</span>`; 597 } 598 html_page_content += 599 `</div>`; 600 } 601 html_page_content += 602 `<div class="text-right"> 603 <div class="price-text-card-search text-primary-color">${price_sale != "" ? (T("VENTA") + " " + price_sale) : ""}${(price_sale != "" && price_rent != "") ? " - " : ""}${price_rent != "" ? (T("ALQUILER") + " " + price_rent) : ""}${(price_sale == "" && price_rent == "") ? T("PRECIO_A_CONSULTAR") : ""}</div> 604 </div> 605 </div> 606 </div> 607 </div> 608 </a> 609 </div> 610 </div> 611 </div>`; 612 }); 613 614 //Agregamos padding dependiendo de si mostramos 1 columna o mas de una 615 if (search_list_cols == "12") { 616 $(".card-search").removeClass("pt-2"); 617 $(".card-search").addClass("pb-4"); 618 } 619 620 return html_page_content; 621} 622 623function create_pagination_content_list(property_data) { 624 let browser = getBrowserInfo(); 625 626 search_map_on = $('#results_str').attr('data-map'); 627 search_map_pc = $('#results_str').attr('data-map-pc'); 628 629 if (search_map_on == '1' && !browser.includes("IE")) { 630 $('#results_list').addClass('col-lg-' + (12 - search_map_pc)); 631 $('#results_map').addClass('col-lg-' + search_map_pc); 632 } else { 633 $('#results_list').addClass('col-lg-10 offset-lg-1'); 634 $('#results_map').removeClass('d-lg-block'); 635 } 636 637 638 let html_page_content = ""; 639 640 if (property_data.length == 0) { 641 html_page_content += 642 `<div class="mt-1 mb-1 col-12 col-md-12 col-lg-12" style="text-align: center;margin-top: 10em !important;padding-bottom: 10em;background-color:unset;">
643 <span>' + T('NO_HAY_INMUEBLES') + '</span> 644 </div>`; 645 646 return html_page_content; 647 } 648 649 cont_image = 1; 650 651 property_data.forEach(function (data) { 652 let title = data['title'] == "" ? T("X_EN_X", { param1: data['type'], param2: ((data['town'] == "" || data['town'] == null) ? (data['operation'] == "a" ? T("ALQUILER") : T("VENTA")) : data['town']) }) : data['title']; 653 let habs = (data['rooms'] * 1) >= 1 ? data['rooms'] + " <i class='google-symbols-bed' title='" + T("HABITACIONES") + "'></i> " : ""; 654 let banos = ""; 655 if (data['type'] == "Local" || data['type'] == "Oficina" || data['type'] == "Office") { 656 banos = (data['bathrooms'] * 1) >= 1 ? data['bathrooms'] + " <i class='google-symbols-wc' title='" + T("BANOS") + "'></i> " : ""; 657 } else { 658 banos = (data['bathrooms'] * 1) >= 1 ? data['bathrooms'] + " <i class='google-symbols-bathtub' title='" + T("BANOS") + "'></i> " : ""; 659 } 660 661 let price_sale = (data['operation'].includes("v") && (data['operation_search'].includes("v") || data['operation_search'] == "")) ? data['price_sale'] : ""; 662 663 if (price_sale != "") { 664 price_sale = ((price_sale * 1) > 1 && data['price_sale_visibility']) ? (formatNumber(data['price_sale']) + "â¬") : T("PRECIO_A_CONSULTAR"); 665 } 666 667 let price_rent = (data['operation'].includes("a") && (data['operation_search'].includes("a") || data['operation_search'] == "")) ? data['price_rent'] : ""; 668 669 if (price_rent != "") { 670 price_rent = ((price_rent * 1) > 1 && data['price_rent_visibility']) ? (formatNumber(data['price_rent']) + "â¬") : T("PRECIO_A_CONSULTAR"); 671 } 672 673 let price_sale_before = ((data['price_sale_before'] * 1) >= 1 && data['price_sale_visibility'] && (data['operation_search'].includes("v") || data['operation_search'] == "")) ? (numberWithCommas(data['price_sale_before'], locale.separador_miles)) : ""; 674 let price_rent_before = ((data['price_rent_before'] * 1) >= 1 && data['price_rent_visibility'] && (data['operation_search'].includes("a") || data['operation_search'] == "")) ? (numberWithCommas(data['price_rent_before'], locale.separador_miles)) : ""; 675 676 let elevator = data['elevator'] === true ? " <i class='google-symbols-elevator' title='" + T("ASCENSOR") + "'></i> " : ""; 677 let garage = data['garage'] === true ? " <i class='google-symbols-garage' title='" + T("GARAJE") + "'></i> " : ""; 678 let trastero = data['storage'] === true ? " <i class='google-symbols-garage-home' title='" + T("TRASTERO") + "'></i> " : ""; 679 let exterior = data['exterior'] == "1" ? " <i class='google-symbols-vertical-shades' title='" + T("EXTERIOR") + "'></i> " : ""; 680 let terraza = data['terrace'] === true ? " <i class='google-symbols-deck' title='" + T("TERRAZA") + "'></i> " : ""; 681 let balcon = data['balcony'] === true ? " <i class='google-symbols-curtains-closed' title='" + T("BALCON") + "'></i> " : ""; 682 let jardin = data['balcony'] === true ? " <i class='google-symbols-potted-plant' title='" + T("JARDIN") + "'></i> " : ""; 683 let piscina = data['balcony'] === true ? " <i class='google-symbols-pool' title='" + T("PISCINA") + "'></i> " : ""; 684 let virtual_tour_3d = data['3d'] === true ? " <i class='google-symbols-3d-rotation' title='" + T("TOUR_VIRTUAL") + "'></i> " : ""; 685 let text_seo = ""; 686 687 //Obtenemos el dato de las metaetiquetas 688 if (document.documentElement.dataset.cmsprm1 == "1") { 689 text_seo = url_text_seo_generate(data['type'], data['operation'], data['town'], title) 690 } else if (document.documentElement.dataset.cmsprm1 == "2") { 691 text_seo = url_text_seo_generate(data['type'], data['operation'], data['town']) 692 } 693 694 695 html_page_content = html_page_content + 696 `<div class="card-search_list card-data mt-1 mb-1 col-12 col-md-12 col-lg-12" data-name='${data['code']}'> 697 <div class="row mx-0 pb-4"> 698 <div class="col-12 col-md-4 img-card-search img-card-search-list p-0"> 699 <div class="labels-wrap labels-right" style="position: absolute; z-index: 1;
699 top: 17px; right: 20px;"> 700 <span class="label-operation label background-primary-color" style="font-size: 13px;line-height: 11px;font-weight: 500;margin: 0;text-transform: uppercase;padding: 3px 5px;color: #fff;border-radius: 2px;"> 701 Ref: ${(data['reference'] == '' ? data['code'] : data['reference'])} 702 </span></div> 703 <div id="carouselExampleControls${cont_image}" class="carousel slide" data-ride="carousel" data-interval="false"> 704 '<div class="carousel-inner">`; 705 active_cont = 1; 706 if (data['images'].length == 0) { 707 html_page_content += 708 `<div class="carousel-item active"> 709 <a href="${get_chromeless_property_url(text_seo, data['code'])}"> 710 <img src="${clean_image_path("")}" class="d-block w-100" style="height:100%; object-fit: cover;"> 711 </a> 712 </div>`; 713 } else { 714 data['images'].forEach(function (url) { 715 if (active_cont == 1) { 716 active = 'active' 717 } else { 718 active = ''; 719 } 720 html_page_content = html_page_content + 721 `<div class="carousel-item ${active}"> 722 <a href="${get_chromeless_property_url(text_seo, data['code'])}"> 723 <img src="${clean_image_path(url)}" class="d-block w-100" style="height:100%"> 724 </a> 725 </div>`; 726 active_cont = active_cont + 1; 727 }); 728 } 729 html_page_content += 730 `</div> 731 <a class="carousel-control-prev" href="#carouselExampleControls${cont_image}" role="button" data-slide="prev"> 732 <span class="carousel-control-prev-icon" aria-hidden="true"></span> 733 <span class="sr-only">Previous</span> 734 </a> 735 <a class="carousel-control-next" href="#carouselExampleControls${cont_image}" role="button" data-slide="next"> 736 <span class="carousel-control-next-icon" aria-hidden="true"></span> 737 <span class="sr-only">Next</span> 738 </a> 739 </div> 740 </div> 741 <div class="col-12 col-md-8 text-card-search-list pt-3 pb-5 pl-4 pr-4"> 742 <div class="row"> 743 <div class="col-12"> 744 <a href="${get_chromeless_property_url(text_seo, data['code'])}"> 745 <div class="title-text-card-search">${capitalizeFirstLetter(title)}</div> 746 </a> 747 <div class="desc-text-card-search-list">${capitalizeFirstLetter(data['desc'])}</div> 748 <div class="address-text-card-search"><i class="google-symbols-location-on sm"></i>${data['address']}</div> 749 </div> 750 </div> 751 <div class="row card-search-footer"> 752 <div class="col-12"> 753 <div class="features1-text-card-search">${habs}${banos}${elevator}${garage}${trastero}${exterior}${terraza}${balcon}${jardin}${piscina}${virtual_tour_3d}</div> 754 </div>`; 755 if (((price_sale_before * 1) > 1 && data['price_sale_visibility']) || ((price_rent_before * 1) > 1 && data['price_rent_visibility'])) { 756 html_page_content += 757 `<div class="col-12 text-right" style="font-size:0.9rem;line-height:0.9rem;color:red;">`; 758 if ((price_sale_before * 1) > 1) { 759 html_page_content += 760 `<span>${T("ANTES_VENTA")}: </span> 761 <span style="text-decoration: line-through;">${price_sale_before}â¬</span>`; 762 } 763 if ((price_sale_before * 1) > 1 && (price_rent_before * 1) > 1) { 764 html_page_content += " - "; 765 } 766 if ((price_rent_before * 1) > 1) { 767 html_page_content += 768 `<span>${T("ANTES_ALQUILER")}: </span>
769 <span style="text-decoration: line-through;">${price_rent_before}â¬</span>`; 770 } 771 html_page_content += 772 `</div>`; 773 } 774 html_page_content += 775 `<div class="col-12 text-right"> 776 <div class="price-text-card-search text-primary-color">${price_sale != "" ? (T("VENTA") + " " + price_sale) : ""}${(price_sale != "" && price_rent != "") ? " - " : ""}${price_rent != "" ? (T("ALQUILER") + " " + price_rent) : ""}${(price_sale == "" && price_rent == "") ? T("PRECIO_A_CONSULTAR") : ""}</div> 777 </div> 778 </div> 779 </div> 780 </div> 781 </div> 782 </div>`; 783 cont_image = cont_image + 1; 784 }); 785 786 return html_page_content; 787} 788 789function create_events(property_length) { 790 $(".card-data").mouseenter(function () { 791 let name = $(this).data("name"); 792 $("." + name).addClass("set-animation-play-light"); 793 }) 794 $(".card-data").mouseleave(function () { 795 let name = $(this).data("name"); 796 $("." + name).removeClass("set-animation-play-light"); 797 }) 798 799 //Si property_length es diferente de undefinido entonces creo su evento 800 801 if (property_length != undefined) { 802 for (let i = 0; i < property_length; i++) { 803 $('#carouselExampleControls' + i).on('touchstart', function (event) { 804 const xClick = event.originalEvent.touches[0].pageX; 805 $(this).one('touchmove', function (event) { 806 const xMove = event.originalEvent.touches[0].pageX; 807 const sensitivityInPx = 5; 808 809 if (Math.floor(xClick - xMove) > sensitivityInPx) { 810 $(this).carousel('next'); 811 } 812 else if (Math.floor(xClick - xMove) < -sensitivityInPx) { 813 $(this).carousel('prev'); 814 } 815 }); 816 $(this).on('touchend', function () { 817 $(this).off('touchmove'); 818 }); 819 }); 820 } 821 } 822} 823 824function reorder_data(data, max_by_page) { 825 let $temp_data = []; 826 let $arr = []; 827 let $i = 0; 828 data.forEach(function (element) { 829 $i++; 830 $arr.push(element); 831 if ($i == max_by_page) { 832 $temp_data.push($arr); 833 $arr = []; 834 $i = 0; 835 } 836 }); 837 838 if ($arr.length != 0) { 839 $temp_data.push($arr); 840 } 841 return $temp_data; 842}
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.