1"use strict"; 2 3angular 4 .module("dpiApp") 5 .controller( 6 "PropertyListCriteriaController", 7 function ( 8 $scope, 9 $timeout, 10 $http, 11 configService, 12 $rootScope, 13 $location, 14 $route, 15 $routeParams, 16 $localStorage, 17 $window, 18 location, 19 BookingService, // for slot booking 20 $compile, // for slot booking 21 polygonFilter 22 ) { 23 $scope.member_details = {}; 24 $scope.search_by_polygon = 0; 25 $rootScope.using_saved_zip = true; //use it skip saved search zip if user enter in location 26 $rootScope.ignore_watcher = false; 27 $scope.is_coming_from_home = 0; 28 $scope.shareMail = { subject: "", msg: "" }; 29 $scope.show_advanced_text = "Show Advanced Search"; 30 $scope.page_heading = ""; 31 $scope.userid = isNaN(current_theme) ? user_id : current_theme; 32 $scope.mls_ids = mls_ids != undefined ? mls_ids : []; 33 $scope.show_default = 1; // For default website show default list 34 $scope.property_list = {}; 35 $scope.recordLimit = 20; 36 $scope.currentPage = 1; 37 $scope.newCurrentPage = 1; 38 $scope.property_found = 0; 39 $scope.visible_property_found = 0; 40 $scope.totalItemsProp = 0; 41 $scope.search_but_show_hide = 1; 42 $scope.fb_button_visible = 0; // Facebook Share button 43 $scope.visited = {}; 44 $scope.search = {}; 45 $scope.bedrating = 0; 46 $scope.bathrating = 0; 47 $scope.search.property_type = ""; 48 $scope.property_types_array = []; 49 $scope.pageChanged = false; 50 $scope.propertyTypeDropdownText = ""; 51 $scope.nextPropertyMl = null; 52 $scope.previousPropertyMl = null; 53 // Modal close with route handling 54 $scope.goingToLogin = false; 55 //$scope.search.min_price = '150000'; // For V2 Release no default search is required as per client thats why commented and set those fields value ='' below 56 //$scope.search.max_price = '500000'; // For V2 Release no default search is required as per client thats why commented and set those fields value ='' below 57 $scope.search.min_price = ""; 58 $scope.search.max_price = ""; 59 $scope.search_listing_sort = "listprice_asc"; 60 $rootScope.city_page_sort = "listprice_asc"; 61 $scope.search_listing_date_sort = "listdate_"; 62 $rootScope.city_page_date_sort = "listdate_"; 63 64 // Image category search 65 $scope.image_category = ""; 66 $rootScope.image_category = ""; 67 $scope.image_category_options = []; 68 $scope.fetchImageCategories = function() { 69 var httpRequest = $http({ 70 method: "POST", 71 url: base_url + "/shared/image-categories", 72 }).success(function (data, status) { 73 $scope.image_category_options = data.image_categories; 74 }).error(function (data, status) { 75 console.error(data); 76 }); 77 } 78 79 $scope.fetchImageCategories(); 80 81 $scope.moveMap = false; 82 83 // Property Details Map 84 $scope.mapLoaded = false; 85 86 // fromResetButton 87 $scope.fromResetButton = false; 88 89 $scope.sethbaths = {}; 90 $scope.all_bound = {}; // lat lng boundary 91 $scope.front_spinner = 0; 92 $scope.search_loader = 0; 93 $scope.advance_open = 0; 94 $scope.fivehundred_msg_status = 0; 95 $scope.property_ml_id = $routeParams.property_ml_id; 96 $scope.latitude = 27.6648; 97 $scope.longitude = -81.5158; 98 $scope.address = ""; 99 $scope.filter_data = {}; 100 $scope.furnished_active = 101 $scope.water_front_active = 102 $scope.water_access_active = 103 $scope.view_active = 104 $scope.pool_active = 105 $scope.pet_active = 106 $scope.hbaths_active = 107 $scope.complex_name_active = 108 $scope.subdivision_name_active = 109 $scope.development_name_active = 110 $scope.county_active = 111 $scope.zip_code_active = 112 $scope.foreclosure_active = 113 $scope.short_sale_active = 114 ""; 115 $scope.hopa = ""; 116 $scope.advanced_search = {}; 117 $scope.advanced_search_updated = {}; 118 $scope.optionsFromQuery = []; // Filter Value array 119 $scope.show_loader = 1; // Search property loader 120 $scope.searchLoaderCount = 0; 121 $scope.sqft_footage_active = ""; 122 $scope.polygoncount = 0; 123 $scope.modal_loader = 1; // Modal Pop up loader 124 $scope.price_view_value = "Enter Price"; 125 $scope.hitsavedsearch = 0; 126 $scope.copyright = Date.now(); 127 $scope.priceRanges = [ 128 0, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 129 900000, 1000000, 1250000, 1500000, 1750000, 2000000, 2250000, 2500000, 130 2750000, 131 ]; 132 $scope.priceRangesLabel = [ 133 "$0", 134 "$100,000", 135 "$200,000", 136 "$300,000", 137 "$400,000", 138 "$500,000", 139 "$600,000", 140 "$700,000", 141 "$800,000", 142 "$900,000", 143 "$1M", 144 "$1.25M", 145 "$1.5M", 146 "$1.75M", 147 "$2M", 148 "$2.25M", 149 "$2.5M", 150 "$2.75M", 151 ]; 152 $scope.minSelectedIndex = 0; 153 $scope.maxSelectedIndex = 0;
154 $scope.priceMinLimitStart = 0; 155 $scope.priceMinLimitTotal = 10; 156 $scope.priceMaxLimitTotal = 10; 157 $scope.showMinPriceList = true; 158 $scope.showMaxPriceList = false; 159 $scope.realtorMedias = []; 160 $scope.realtorSlides = []; 161 $scope.slideDescription = ""; 162 $scope.activeFolderSlide = null; 163 $scope.activeFileSlide = null; 164 $scope.menu_id = 165 typeof $routeParams.menu_id == "undefined" ? 2 : $routeParams.menu_id; 166 $scope.searchCondition = ""; 167 $scope.quickSearchCalled = false; 168 $scope.captchaRegistry = {}; 169 // $scope.selectedBedRating = 0; 170 171 // PIT for pagination 172 $scope.pit = {}; 173 $scope.propertyDetailsFetching = true; 174 $scope.property_det = {}; 175 $scope.callingSearchProperty = false; 176 177 $scope.request = {}; 178 179 $scope.relatedPropertiesLoaded = false; 180 $scope.makeToFavClicked = false; 181 $scope.hasPolygon = false; 182 $scope.localBedRating = 0; 183 $scope.localBathRating = 0; 184 $scope.localHbathRating = 0; 185 // $rootScope.firstSearchLoading = true; 186 $rootScope.advanceSearchWatcherEnabled = true; 187 $scope.bedStarRating = 4; 188 $scope.bathStarRating = 4; 189 $scope.hBathStarRating = 4; 190 $scope.resetFilterTimeThreshold = 30; // In minutes 191 192 function normalizeAdvancedSearch(value) { 193 if (!value) { 194 return {}; 195 } 196 197 if (typeof value === "string") { 198 try { 199 return JSON.parse(value); 200 } catch (error) { 201 console.error("Failed to parse advanced search filters", error, value); 202 return {}; 203 } 204 } 205 206 return value; 207 } 208 209 $scope.page_name = $rootScope.page_name; 210 $scope.menu_id = typeof $routeParams.menu_id == 'undefined' ? $localStorage.city_page_menu_id : $routeParams.menu_id; 211 $scope.criteria_id = typeof $routeParams.criteria_id == 'undefined' ? $localStorage.city_page_criteria_id : $routeParams.criteria_id; 212 $scope.location_id = typeof $routeParams.location_id == 'undefined' ? $localStorage.city_page_location_id : $routeParams.location_id; 213 $scope.locationName = ''; 214 $scope.page_title = ""; 215 216 /****** Get Current Route Name ******/ 217 $scope.location = $location.path(); 218 $scope.routeName = $route.current.$$route.name; 219 $scope.locationBasedFilters = ["city", "zip_code", "subdivision_name", "mls_#", "subdivision_number", "address", "building_name", "building_name_number"]; 220 221 $scope.currentRoute = $scope.routeName; 222 $scope.markerPopupOpened = false; 223 // get specific parts of the URL like search parameters 224 var searchParamsUrlCopy = $location.search(); 225 // Check if searchParams is an empty object 226 var isEmpty = 227 Object.keys(searchParamsUrlCopy).length === 0 && 228 searchParamsUrlCopy.constructor === Object; 229 230 // Load map in property details page/modal 231 $scope.loadMap = function () { 232 if ($scope.mapLoaded) return; 233 // optional guard if lat/lng missing: 234 // if (!$scope.property_det || !$scope.property_det.lat || !$scope.property_det.lng) return; 235 try { 236 initMap(); 237 $scope.mapLoaded = true; 238 } catch (e) { 239 // keep placeholder visible if initMap fails 240 $scope.mapLoaded = false; 241 // optionally 242 } 243 } 244 245 $scope.$on("$destroy", function () { 246 if (typeof resetCriteriaMapState === "function") { 247 resetCriteriaMapState(); 248 } 249 }); 250 251 $scope.$on("$locationChangeStart", function (event, next, current) { 252 const urlString = current; 253 const searchTerm = "property-details"; 254 var browserUrl = window.location.href; 255
256 if (urlString.includes(searchTerm)) { 257 $rootScope.doNotCallZipCode = true; 258 } else { 259 $rootScope.doNotCallZipCode = false; 260 261 if ( 262 browserUrl.includes("11/search/11") && 263 !urlString.includes("11/search/11") 264 ) { 265 //$window.location.href = current; // Change the URL to the specified one 266 // Extract path from the full URL 267 var path = new URL(current).pathname; 268 $timeout(function () { 269 $location.path(path); // Redirect to the specified partial path 270 }, 100); // Delay in milliseconds 271 } 272 } 273 }); 274 275 // Keep property details modal state in sync with browser back/forward 276 $scope.$on("$locationChangeSuccess", function (event, newUrl, oldUrl) { 277 var path = $location.path(); // e.g. "/property-details/123456" or "/propertylist-criteria/..." 278 279 if (path.indexOf("/property-details/") === 0) { 280 // Extract the ML from the path 281 var parts = path.split("/property-details/"); 282 var ml = parts[1]; 283 284 // Only reopen modal on back/forward if it is currently closed 285 if (ml && $rootScope.propertyDetailsModalClosed) { 286 // Call fetchPropertyDetails WITHOUT updating URL again 287 $scope.fetchPropertyDetails(ml, { updateUrl: false }); 288 } 289 } else { 290 // Any non-property-details URL should not have the details modal open 291 if (jQuery("#propertyProjectDetailModal").hasClass("in")) { 292 $scope.hidePropertyDetailModal(); 293 } 294 $rootScope.propertyDetailsModalClosed = true; 295 } 296 }); 297 298 $scope.setFiltersForTheCityPages = function () { 299 300 // Set scope variables for city page 301 if ($rootScope.locationName != '') { 302 // Clearing the scope variables 303 $scope.search = {}; 304 $scope.advanced_search = {}; 305 $scope.bedrating = 0; 306 $scope.bathrating = 0; 307 $scope.locationName = $rootScope.locationName; 308 309 $scope.advanced_search.city = [$rootScope.locationName]; 310 // Set the city to localStorage for polygon clear and reset search 311 $localStorage.city = [$rootScope.locationName]; 312 313 // Setting extra filters 314 if ($rootScope.propertyType != '') { 315 $scope.search.property_type = $rootScope.propertyType; 316 if ($scope.property_types_array.indexOf($rootScope.propertyType) === -1) { 317 $scope.property_types_array.push($rootScope.propertyType); 318 } 319 } 320 if ($rootScope.bedroomFilter != 0) { 321 $scope.bedrating = $rootScope.bedroomFilter; 322 $scope.advanced_search.bedrooms = $rootScope.bedroomFilter; 323 } 324 if ($rootScope.bathroomFilter != 0) { 325 $scope.bathrating = $rootScope.bathroomFilter; 326 $scope.advanced_search.bathrooms = $rootScope.bathroomFilter; 327 } 328 329 if (typeof $rootScope.min_list_price != 'undefined' || $rootScope.min_list_price != 0) { 330 $scope.search.min_price = $rootScope.min_list_price; 331 } 332 if (typeof $rootScope.max_list_price != 'undefined' || $rootScope.max_list_price != 0) { 333 $scope.search.max_price = $rootScope.max_list_price; 334 } 335 336 if($rootScope.luxuryWaterfrontProperties){ 337 $scope.advanced_search.water_front = "Yes"; 338 } 339 340 // Resetting the $rootScope filters 341 $rootScope.locationName = ''; 342 $rootScope.propertyType = ''; 343 $rootScope.bedroomFilter = 0; 344 $rootScope.bathroomFilter = 0; 345 $rootScope.min_list_price = 0; 346 $rootScope.max_list_price = 0; 347 } 348 349 // 350 $rootScope.resettingFilters = false;
351 if (typeof $rootScope.previousRoute == 'undefined' || $rootScope.previousRoute == 'for_sale' || $rootScope.previousRoute == 'for_rent' || $scope.fromResetButton) { 352 $scope.fromResetButton = false; 353 $scope.searchProperty(); 354 } 355 } 356 357 $scope.fetchRealtorCriteria = function (fromResetButton = false) { 358 $scope.fromResetButton = fromResetButton; 359 360 361 362 if ($scope.location_id === $localStorage.city_page_location_id && $scope.criteria_id == $localStorage.city_page_criteria_id && $scope.menu_id == $localStorage.city_page_menu_id && !fromResetButton) { 363 // Code to handle page reload 364 365 setTimeout(() => { 366 $scope.searchProperty(); 367 }, 1000); 368 } else { 369 $rootScope.resettingFilters = true; 370 $rootScope.user_id = $scope.userid; 371 $rootScope.location_id = $scope.location_id; 372 $rootScope.criteria_id = $scope.criteria_id; 373 $rootScope.menu_id = $scope.menu_id; 374 // Retrieve the search criteria 375 var httpRequest = $http({ 376 method: 'POST', 377 url: base_url + '/shared-city/realtor-criteria', 378 data: { 379 user_id: $scope.userid, 380 location_id: $rootScope.location_id, 381 criteria_id: [$rootScope.criteria_id], 382 menu_id: $rootScope.menu_id 383 } 384 }).success(function (data, status) { 385 // Reset any previous criteria 386 // localStorage.clear(); 387 // $localStorage.$reset(); 388 389 $localStorage.search_params = ""; 390 $rootScope.resetFilterParams = {}; 391 // $rootScope.resettingFilters = false; 392 // $rootScope.firstCitySearchLoading = true; 393 $rootScope.locationName = data.location_name; 394 $scope.locationName = data.location_name; 395 // Setting title for for_sale and for_rent pages 396 var menuName = ""; 397 if ($scope.menu_id == 3 || $scope.menu_id == 2) { 398 menuName = "For Sale"; 399 } else { 400 menuName = "For Rent"; 401 } 402 403 var criteriaName = ""; 404 if ($rootScope.criteria_id == 39 || $rootScope.criteria_id == 66) { 405 criteriaName = "Homes"; 406 } else { 407 criteriaName = "Condos"; 408 } 409 410 var companyName = ""; 411 if ($scope.agentDetails.company != "") { 412 companyName = $scope.agentDetails.company; 413 } else { 414 companyName = $scope.agentDetails.first_name; 415 companyName += $scope.agentDetails.middle_name != "" ? " " + $scope.agentDetails.middle_name : ""; 416 companyName += " " + $scope.agentDetails.last_name 417 } 418 // var pageTitle = {City} {Homes/Condos} {For Sale/For Rent} | {Company Name}; 419 420 421 422 423 var pageTitle = $scope.locationName + " " + criteriaName + " " + menuName + " | " + companyName; 424 $scope.page_title = pageTitle; 425 426 427 428 $rootScope.resetFilterParams.locationName = data.location_name; 429 var searchAttributes = data.search_attributes; 430 // For Waterfront properties 431 if($rootScope.luxuryWaterfrontProperties){ 432 data.property_type = $rootScope.luxuryWaterfrontPropertyTypes[0]; 433 data.property_types = $rootScope.luxuryWaterfrontPropertyTypes; 434 } 435 436 $rootScope.propertyType = data.property_type; 437 $rootScope.propertyTypes = data.property_types;
438 data.property_types.forEach((item) => { 439 if ($scope.property_types_array.indexOf(item) === -1) { 440 $scope.property_types_array.push(item); 441 } 442 }); 443 if ($scope.property_types_array.length > 0) { 444 $scope.setPropertyTypeDropdownText($scope.property_types_array[0]); 445 } else { 446 $scope.setPropertyTypeDropdownText("all"); 447 } 448 449 450 var views = data.views; 451 $rootScope.bedroomFilter = data.bedroom_filter; 452 $rootScope.bathroomFilter = data.bathroom_filter; 453 // $rootScope.previousRoute = $scope.routeName; 454 $rootScope.resetFilterParams.criteriaId = $rootScope.criteria_id; 455 $rootScope.resetFilterParams.propertyType = $rootScope.propertyType; 456 $rootScope.resetFilterParams.bedroomFilter = $rootScope.bedroomFilter; 457 $rootScope.resetFilterParams.bathroomFilter = $rootScope.bathroomFilter; 458 $localStorage.city_page_menu_id = $scope.menu_id; 459 $localStorage.city_page_location_id = $rootScope.location_id; 460 $localStorage.city_page_criteria_id = $rootScope.criteria_id; 461 // For Waterfront properties 462 if($rootScope.luxuryWaterfrontProperties){ 463 $rootScope.min_list_price = $rootScope.luxuryWaterfrontMinPrice; 464 $rootScope.water_front = "Yes"; 465 } else { 466 $rootScope.min_list_price = searchAttributes.min_list_price; 467 } 468 469 $rootScope.max_list_price = searchAttributes.max_list_price; 470 $rootScope.resetFilterParams.min_list_price = $rootScope.min_list_price; 471 $rootScope.resetFilterParams.max_list_price = $rootScope.max_list_price; 472 473 474 475 $scope.setFiltersForTheCityPages(); 476 }); 477 478 } 479 } 480 481 if (typeof $rootScope.firstCitySearchLoading == 'undefined' || $rootScope.firstCitySearchLoading == true) { 482 483 484 485 486 487 488 489 490 491 492 $scope.fetchRealtorCriteria(); 493 } 494 495 // Reset filters based on time 496 $scope.resetFilterBasedOnTime = function () { 497 const timeNow = Date.now(); // In milliseconds 498 const filterExpirationTime = 499 $localStorage.filter_expiration_time != undefined 500 ? $localStorage.filter_expiration_time 501 : 0; 502 // 503 if ( 504 filterExpirationTime != 0 && 505 filterExpirationTime <= timeNow && 506 $localStorage.agent_zip_search != undefined 507 ) { 508 // Call reset search if agent zip code is not undefined 509 // 510 $scope.resetSearch(); 511 } 512 }; 513 514 // Hide if any modal backdrop still remains on page load 515 $scope.hideModalBackdrop = function () {
516 jQuery(".modal-backdrop").hide(); 517 }; 518 $scope.hideModalBackdrop(); 519 520 $scope.registerCaptcha = function(formName, refreshFn, loadFn) { 521 $scope.captchaRegistry[formName] = { refresh: refreshFn, load: loadFn }; 522 }; 523 524 $scope.reloadAllCaptchas = function() { 525 angular.forEach($scope.captchaRegistry, function(captcha) { 526 if (captcha.load) captcha.load(); 527 }); 528 }; 529 530 // Form Submit handler 531 $scope.initForm = function (formId, param, reloadCaptchas = true) { 532 if (reloadCaptchas) { 533 $scope.reloadAllCaptchas(); 534 } 535 // Reset the form 536 $scope.resetJsForm(formId); 537 var form = document.getElementById(formId); 538 if (!form) return; 539 540 var isValid = true; 541 } 542 543 $scope.resetJsForm = function (formId) { 544 var form = document.getElementById(formId); 545 if (!form) return; 546 // 1. Reset the form 547 form.reset(); 548 549 // 2. Hide all error messages 550 form.querySelectorAll('.error').forEach(el => { 551 el.style.display = 'none'; 552 }); 553 554 // 3. Clear message text 555 const msg = form.querySelector('.form-message'); 556 if (msg) msg.innerText = ''; 557 558 // 4. OPTIONAL: reset Angular scope (important for your setup) 559 const scope = angular.element(form).scope(); 560 if (scope) { 561 scope.$applyAsync(() => { 562 scope.contact = {}; 563 564 // reset captcha if exists 565 if (scope.captchaRegistry && scope.captchaRegistry['buyer']) { 566 scope.captchaRegistry['buyer'].refresh(); 567 } 568 }); 569 } 570 } 571 572 function validateEmail(email) { 573 const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; 574 return regex.test(email); 575 } 576 577 $scope.submitJsForm = function (formId, param) { 578 var form = document.getElementById(formId); 579 if (!form) return; 580 var isValid = true; 581 // reset errors 582 form.querySelectorAll(".error").forEach(el => el.style.display = "none"); 583 584 // validation 585 if (!form.name.value.trim()) { 586 form.querySelector(".name-error").style.display = "block"; 587 isValid = false; 588 } 589 590 if (!form.email.value.trim()) { 591 form.querySelector(".email-error").style.display = "block"; 592 isValid = false; 593 } 594 595 if (!form.msg.value.trim()) { 596 form.querySelector(".msg-error").style.display = "block"; 597 isValid = false; 598 } 599 600 // phone regex 601 var phone = form.phone.value.trim(); 602 // var regex = /^$|^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/; 603 // To accept em-dashes 604 var regex = /^$|^([\+][0-9]{1,3}[ \.\-–—])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-–—\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/; 605 606 if (phone && !regex.test(phone)) { 607 form.querySelector(".phone-error").style.display = "block"; 608 isValid = false; 609 } 610 // Phone number should be greater than or equal to 10 digits 611 if (phone && phone.length < 10) { 612 form.querySelector(".phone-error").style.display = "block"; 613 isValid = false; 614 } 615 616 if (!validateEmail(form.email.value)) { 617 form.querySelector(".email-error").innerHTML = "Invalid email address"; 618 form.querySelector(".email-error").style.display = "block"; 619 isValid = false;
620 } 621 622 if (!isValid) return; 623 624 var scope = $scope; 625 626 var captchaObj = scope.request && 627 scope.request.captcha && 628 scope.request.captcha[param]; 629 630 if (!captchaObj || !captchaObj.value) { 631 alert("Please enter captcha"); 632 return; 633 } 634 635 var payload = { 636 request: { 637 name: form.name.value, 638 phone: form.phone.value, 639 email: form.email.value, 640 msg: form.msg.value, 641 captcha: { 642 id: captchaObj.id, 643 value: captchaObj.value 644 } 645 }, 646 member_id: user_id, 647 param: param, 648 property_url: window.location.href 649 }; 650 651 fetch(base_url + "/firsthometheme/send-request-mail", { 652 method: "POST", 653 headers: { "Content-Type": "application/json" }, 654 body: JSON.stringify(payload) 655 }) 656 .then(res => res.json()) 657 .then(function (data) { 658 659 if (data.success == 1) { 660 661 // Fire custom event for successful form submission 662 window.dispatchEvent(new CustomEvent("dpi:formSubmitSuccess", { 663 detail: { 664 formId: formId, 665 param: param, 666 data: data 667 } 668 })); 669 670 // Same as contact_me setupBookingAfterContact() 671 BookingService.setInitialData({ 672 member_id: user_id // same as contact_me; or use $scope.userid 673 }); 674 BookingService.setAfterContact(data); 675 var hasBooking = BookingService.isBookingLinkVisible(); 676 var messageEl = form.querySelector(".form-message"); 677 if(formId == 'adviceForm' || formId == 'requestForm') { 678 messageEl.innerHTML = 679 "<span style='color:green'>Your query has been sent successfully. We will contact you soon.</span>"; 680 } else { 681 messageEl.innerHTML = 682 "<span style='color:white'>Your query has been sent successfully. We will contact you soon.</span>"; 683 } 684 // Only show slot-booking when client booking info exists (same as contact_me) 685 var existing = form.querySelector('.slot-booking-container'); 686 if (existing) { 687 existing.parentNode.removeChild(existing); 688 } 689 if (hasBooking) { 690 var slotAttrs = 'member-details="member_details"'; 691 if (formId === 'adviceForm' || formId === 'requestForm') { 692 slotAttrs += ' close-parent-modal-on-open="true"'; 693 } 694 if (formId === 'expertForm') { 695 slotAttrs += ' append-modal-to-body="true" book-button-dark="true" banner-highlight="false" banner-center-align="false"'; 696 } 697 var el = angular.element('<div class="slot-booking-container"><slot-booking ' + slotAttrs + '></slot-booking></div>'); 698 messageEl.parentNode.insertBefore(el[0], messageEl.nextSibling); 699 $compile(el)($scope); 700 701 $scope.$applyAsync(); // Apply the changes to the scope so the directive renders correctly 702 } 703 704 // log the user in 705 $rootScope.is_front_logged = 1; 706 localStorage.setItem("usr_info", data.usr_info); 707 localStorage.setItem("access_token", data.token); 708 709 $rootScope.refreshLoggedUser(); 710 711 var client_details = []; 712 client_details = $scope.loggedUserDetails(); 713 $rootScope.logged_user_id = client_details[0]; 714 $rootScope.logged_user_name = client_details[1]; 715 716 // 717 // if (scope.reloadAllCaptchas) { 718 // scope.reloadAllCaptchas(); 719 // } 720 721 form.reset(); 722 723 // Repopulate email 724 var emailField = form.querySelector("[logged-user-email]"); 725 726 if (emailField) { 727 728 var fn = angular.element(emailField).data("populateLoggedUserEmail"); 729 730 if (fn) { 731 fn(); 732 } 733 734 } 735 736 // Hide form successfully message after 2 seconds 737 setTimeout(function () { 738 form.querySelector(".form-message").innerHTML = ""; 739 }, 10000); 740 741 } else { 742 form.querySelector(".form-message").innerHTML = 743 "<span style='color:red'>" + (data.message || "Error") + "</span>"; 744 } 745 $scope.reloadAllCaptchas(); 746 scope.$apply(); 747 748 }) 749 .catch(function (error) { 750 // Log the error 751 console.error(error); 752 form.querySelector(".form-message").innerHTML = 753 "<span style='color:red'>Some error occurred</span>"; 754 755 }); 756 } 757 758 $scope.getSelectedBed = function (bedrating, sp) { 759 $scope.bedrating = bedrating; 760 $scope.advanced_search.bedrooms = $scope.bedrating; 761 762 if (!sp) { 763 $scope.callingSearchProperty = true; 764 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 765 } 766 }; 767 768 // Set $scope variables based on $localStorage 769 $scope.setScopeVariablesBasedOnLocalStorage = function () { 770 var allBound = $scope.all_bound; 771 772 773 if ( 774 $localStorage.city_page_search_params != undefined && 775 $localStorage.city_page_search_params != "" 776 ) { 777 var localStorageSearchParams = JSON.parse( 778 $localStorage.city_page_search_params 779 ); 780 // 781 // 782 $scope.search.property_type = 783 localStorageSearchParams.property_type != undefined 784 ? localStorageSearchParams.property_type 785 : ""; 786 $scope.property_types_array = 787 localStorageSearchParams.property_types != undefined 788 ? localStorageSearchParams.property_types 789 : []; 790 $scope.search.min_price = 791 localStorageSearchParams.min_price != undefined 792 ? localStorageSearchParams.min_price 793 : ""; 794 $scope.search.max_price = 795 localStorageSearchParams.max_price != undefined 796 ? localStorageSearchParams.max_price 797 : ""; 798 // $scope.search_listing_sort = 799 // localStorageSearchParams.search_listing_sort != undefined 800 // ? localStorageSearchParams.search_listing_sort 801 // : "listprice_asc"; 802 $scope.search_listing_sort = 803 localStorageSearchParams.search_listing_sort != undefined 804 ? localStorageSearchParams.search_listing_sort 805 : $rootScope.city_page_sort; 806 $scope.search_listing_date_sort = 807 localStorageSearchParams.search_listing_date_sort != undefined 808 ? localStorageSearchParams.search_listing_date_sort 809 : $rootScope.city_page_date_sort; 810 $scope.image_category = 811 localStorageSearchParams.image_category != undefined 812 ? localStorageSearchParams.image_category 813 : ""; 814 $scope.bedrating = 815 localStorageSearchParams.bedroom != undefined 816 ? localStorageSearchParams.bedroom 817 : 0; 818 $scope.localBedRating = 819 localStorageSearchParams.bedroom != undefined 820 ? localStorageSearchParams.bedroom 821 : 0; 822 $scope.bathrating = 823 localStorageSearchParams.bathroom != undefined 824 ? localStorageSearchParams.bathroom 825 : 0; 826 $scope.localBathRating = 827 localStorageSearchParams.bathroom != undefined 828 ? localStorageSearchParams.bathroom 829 : 0; 830 $scope.recordLimit = 831 localStorageSearchParams.limit != undefined 832 ? localStorageSearchParams.limit 833 : 20; 834 $scope.currentPage = 835 localStorageSearchParams.page != undefined 836 ? localStorageSearchParams.page 837 : 1; 838 $scope.all_bound = 839 localStorageSearchParams.all_bound != undefined 840 ? localStorageSearchParams.all_bound 841 : {}; 842 // "" rather than {} / "[]": an empty object is truthy, which 843 // is what made the old "is a polygon active" checks fire 844 // when nothing was drawn. 845 $scope.polygon_lat_long = 846 localStorageSearchParams.polygon_lat_long != undefined 847 ? localStorageSearchParams.polygon_lat_long 848 : ""; 849 $rootScope.polygon_lat_long = 850 localStorageSearchParams.polygon_lat_long != undefined 851 ? JSON.stringify(localStorageSearchParams.polygon_lat_long) 852 : ""; 853 const rawAdvanceSearch = 854 localStorageSearchParams.advance_search != undefined 855 ? localStorageSearchParams.advance_search 856 : {}; 857 $scope.advanced_search = normalizeAdvancedSearch(rawAdvanceSearch); 858 // $scope.bedrating = 859 // $scope.advanced_search.bedrooms != undefined 860 // ? $scope.advanced_search.bedrooms 861 // : 0; 862 // $scope.bathrating = 863 // $scope.advanced_search.bathrooms != undefined 864 // ? $scope.advanced_search.bathrooms 865 // : 0; 866 $scope.localHBathRating = 867 $scope.advanced_search.hbaths != undefined 868 ? $scope.advanced_search.hbaths 869 : 0; 870 $scope.pit = 871 localStorageSearchParams.pit != undefined 872 ? localStorageSearchParams.pit 873 : {}; 874 // 875 // 876 } 877 }; 878 879 // Resolve page refresh issue upon polygon draw 880 if($rootScope.cityPageFirstLoading) { 881 882 883 $scope.setScopeVariablesBasedOnLocalStorage(); 884 } 885 886 887 $scope.bedRatingClicked = function (rating) { 888 $scope.bedrating = rating; 889 if (typeof $scope.advanced_search == 'string') { 890 const advancedSearch = JSON.parse($scope.advanced_search); 891 advancedSearch.bedrooms = $scope.bedrating; 892 $scope.advanced_search = advancedSearch; 893 } else { 894 $scope.advanced_search.bedrooms = $scope.bedrating; 895 } 896 897 jQuery("#bed-star-rating").trigger("click.bs.dropdown"); 898 }; 899 $scope.bathRatingClicked = function (rating) { 900 $scope.bathrating = rating; 901 if (typeof $scope.advanced_search == 'string') { 902 const advancedSearch = JSON.parse($scope.advanced_search); 903 advancedSearch.bathrooms = $scope.bathrating; 904 $scope.advanced_search = advancedSearch; 905 } else { 906 $scope.advanced_search.bathrooms = $scope.bathrating; 907 } 908 jQuery("#bath-star-rating").trigger("click.bs.dropdown"); 909 }; 910 911 // $modalInstance.opened.then(function () { 912 // $state.go(newPath); 913 // }); 914 // $modalInstance.result.then(null, function () { 915 // $state.go(oldPath); 916 // }); 917 $scope.$on("$stateChangeSuccess", function () { 918 if ($state.current.name != newPath) { 919 $modalInstance.dismiss("cancel"); 920 } 921 }); 922 923 $scope.showPropertyBasedOnMl = function (ml) { 924 // Close the opened modal 925 // jQuery('#propertyProjectDetailModal').modal('hide'); 926 927 // Show the property 928 $scope.fetchPropertyDetails(ml); 929 }; 930 931 $scope.fetchRelatedProperties = function (ml) { 932 // jQuery('#propertyProjectDetailModal').on('hidden.bs.modal', function () { 933 // 934 // $scope.propertyDetailsFetching = false;
935 // $scope.front_spinner = 0; 936 // $location.path('/11/search/11', false); 937 // return; 938 // }); 939 // 940 $scope.relatedPropertiesLoaded = false; 941 var token = localStorage.getItem("access_token"); // If login 942 943 if ($localStorage.city_page_search_params) { 944 var search_params = JSON.parse($localStorage.city_page_search_params); 945 } else { 946 var search_params = ""; 947 } 948 949 var httpRequest = $http({ 950 method: "POST", 951 // url: base_url + '/firsthometheme/property-details-new', 952 url: base_url + "/shared/fetch-related-properties", 953 data: { 954 property_ml_id: $scope.property_ml_id, 955 member_id: $scope.userid, 956 search_params: search_params, 957 }, 958 headers: { 959 "Content-Type": "application/json; charset=utf-8", 960 "Access-Token": token, 961 }, 962 // ignoreLoadingBar: true 963 }).success(function (data, status) { 964 $scope.relatedPropertiesLoaded = true; 965 if (data.related_properties.length === 0) { 966 // $scope.has_property = 0; 967 $scope.allRelatedProperty = []; 968 } else { 969 $scope.allRelatedProperty = data.related_properties; 970 } 971 setTimeout(function () { 972 // ProjectGallery(); 973 // projectDetailImgVideoSwiperSlider(); 974 // ImageFitCont(); 975 relatedPropertiesSlider(); 976 }, 1000); 977 setTimeout(function () { 978 $scope.fixCssBackgoundImageDoubleEncodingIssue(); 979 }, 1000); 980 }); 981 }; 982 983 // $scope.fetchPropertyDetails = function (ml) { 984 // // $scope.front_spinner = 1; 985 986 // // Show modal route 987 // const propertyDetailUrl = "/property-details-2/" + ml; 988 // 989 // window.history.pushState("object or string", "Title", propertyDetailUrl); 990 // } 991 992 $scope.fetchPropertyDetails = function (ml, options) { 993 options = options || {}; 994 var updateUrl = options.updateUrl !== false; 995 996 // Reset map loaded flag 997 $scope.mapLoaded = false; 998 // Change path on modal close 999 if ($scope.makeToFavClicked == true) { 1000 return; 1001 } 1002 // Clear synchronously (not only inside the async $http success below) so the 1003 // $locationChangeSuccess handler doesn't see a stale "modal closed" flag and 1004 // re-invoke fetchPropertyDetails a second time for this same open/navigate. 1005 $rootScope.propertyDetailsModalClosed = false; 1006 const userName = $scope.agentDetails.user_name; 1007 const browserUrl = window.location.href; 1008 const urlParts = browserUrl.split("/"); 1009 if (updateUrl) { 1010 if (urlParts[3] == userName) { 1011 history.pushState( 1012 {}, 1013 "", 1014 window.location.origin + 1015 "/" + 1016 userName + 1017 "/property-details/" + 1018 ml 1019 ); 1020 } else { 1021 history.pushState( 1022 {}, 1023 "", 1024 window.location.origin + "/property-details/" + ml 1025 ); 1026 } 1027 } 1028 jQuery("#propertyProjectDetailModal").on( 1029 "hidden.bs.modal", 1030 function () { 1031 // Reset map loaded flag 1032 $scope.mapLoaded = false;
1033 $scope.propertyDetailsFetching = false; 1034 $rootScope.propertyDetailsModalClosed = true; 1035 $scope.front_spinner = 0; 1036 if ($scope.goingToLogin == false) { 1037 // $location.path('/11/search/11', false); 1038 // Making dynamic /11/search/11 & /11/search-property/11 1039 if ($scope.routeName == "mylisting") { 1040 var searchUrl = "our_listings"; 1041 } else if ($scope.routeName == "my_listings") { 1042 var searchUrl = "my_listings"; 1043 } else { 1044 var searchUrl = 1045 "/propertylist-criteria/" + 1046 $scope.location_id + 1047 "/" + 1048 $scope.menu_id + 1049 "/" + 1050 $scope.criteria_id; 1051 } 1052 // Only update Angular location; do NOT push another history entry 1053 location.skipReload().path(searchUrl).replace(); 1054 1055 // Ensure browser URL is in sync even on the first close 1056 history.replaceState({}, "", $location.absUrl()); 1057 } else { 1058 $scope.goingToLogin == false; 1059 } 1060 // window.history.pushState("object or string", "Search Page Title", '/11/search/11'); 1061 return; 1062 } 1063 ); 1064 1065 // Add event listener to the form modal close 1066 jQuery("#contactAgent").on( 1067 "hidden.bs.modal", 1068 function () { 1069 $scope.resetJsForm("adviceForm"); 1070 } 1071 ); 1072 jQuery("#requestShowing").on( 1073 "hidden.bs.modal", 1074 function () { 1075 $scope.resetJsForm("requestForm"); 1076 } 1077 ); 1078 $scope.front_spinner = 1; 1079 $scope.propertyDetailsFetching = true; 1080 // $scope.propertyDetailsFetching = true; 1081 1082 // Change route 1083 // Only when we are actively opening from a user click, not from back/forward 1084 if (updateUrl) { 1085 $location.path("/property-details/" + ml, false); 1086 } 1087 1088 // Show the modal 1089 jQuery("#propertyProjectDetailModal").on( 1090 "shown.bs.modal", 1091 function (e) { 1092 // 1093 // Reload all captchas 1094 // $scope.reloadAllCaptchas(); 1095 $scope.initForm("expertForm", "expert", true); 1096 $scope.initForm("adviceForm", "advice", false); 1097 $scope.initForm("requestForm", "request", false); 1098 // jQuery('#propertyProjectDetailModal .modal-body').mCustomScrollbar("scrollTo", ".propertyProjectDetail-content-wrap"); 1099 jQuery( 1100 "#propertyProjectDetailModal .modal-body" 1101 ).mCustomScrollbar(); 1102 1103 // Scroll to top 1104 // $('#propertyProjectDetailModal').animate({ scrollTop: 0 }, 'fast'); 1105 } 1106 ); 1107 1108 jQuery("#propertyProjectDetailModal").modal(); 1109 1110 $scope.property_ml_id = ml; 1111 var fb_app_id = $rootScope.fb_app_id; 1112 1113 // Find previous and next index 1114 // Loose equality (==) is intentional: `ml` can arrive as a number (property 1115 // card clicks, PREV/NEXT) or as a string (URL-path-derived calls, e.g. the 1116 // $locationChangeSuccess handler), while propertyMlsIds always holds numbers. 1117 var findMlIndex = function (list, value) { 1118 for (var i = 0; i < list.length; i++) { 1119 if (list[i] == value) { 1120 return i; 1121 } 1122 } 1123 return -1; 1124 }; 1125 1126 var liveList = $rootScope.propertyMlsIds || []; 1127 var activeList = liveList; 1128 var mlIndex = findMlIndex(liveList, ml); 1129 1130 if (mlIndex !== -1) { 1131 // Live list is authoritative whenever it actually contains this property — 1132 // keep the pinned snapshot in sync with genuine new searches. 1133 $rootScope.pinnedPropertyMlsIds = liveList.slice(); 1134 } else if ($rootScope.pinnedPropertyMlsIds && findMlIndex($rootScope.pinnedPropertyMlsIds, ml) !== -1) { 1135 // Live list was replaced by something (e.g. a background map-bounds re-search) 1136 // that no longer contains the property already open in the modal — keep using 1137 // the last list the user was actually browsing so PREV/NEXT stay correct. 1138 activeList = $rootScope.pinnedPropertyMlsIds; 1139 mlIndex = findMlIndex(activeList, ml); 1140 } 1141 1142 if (mlIndex == -1) { 1143 $scope.previousPropertyMl = null; 1144 $scope.nextPropertyMl = null; 1145 } else { 1146 if (mlIndex > 0) { 1147 $scope.previousPropertyMl = activeList[mlIndex - 1]; 1148 } else { 1149 $scope.previousPropertyMl = null; 1150 } 1151 if (mlIndex + 1 < activeList.length) { 1152 $scope.nextPropertyMl = activeList[mlIndex + 1]; 1153 } else { 1154 $scope.nextPropertyMl = null; 1155 } 1156 } 1157 1158 // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON START// 1159 if (fb_app_id != "") { 1160 $scope.fb_button_visible = 1; 1161 } 1162 // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON END// 1163 1164 var token = localStorage.getItem("access_token"); // If login 1165 if ($localStorage.city_page_search_params) { 1166 var search_params = JSON.parse($localStorage.city_page_search_params); 1167 } else { 1168 var search_params = ""; 1169 } 1170 1171 var $httpRequest = $http({ 1172 method: "POST", 1173 // url: base_url + '/firsthometheme/property-details-updated', 1174 url: base_url + "/shared/property-details", 1175 data: { 1176 property_ml_id: $scope.property_ml_id, 1177 member_id: $scope.userid, 1178 search_params: search_params, 1179 }, 1180 headers: { 1181 "Content-Type": "application/json; charset=utf-8", 1182 "Access-Token": token, 1183 }, 1184 }).success(function (data, status) { 1185 $scope.front_spinner = 0; 1186 $rootScope.propertyDetailsModalClosed = false;
1187 if (data.property_det.length === 0) { 1188 $scope.has_property = 0; 1189 } else { 1190 // if ($localStorage.mls_id) { 1191 // var storeMlsIds = JSON.parse($localStorage.mls_id); 1192 // var indexofMlsId = storeMlsIds.indexOf($scope.property_ml_id); 1193 // if (indexofMlsId > -1) { 1194 // $rootScope.all_property_search_list = storeMlsIds; 1195 // $rootScope.currentPropertyIndex = indexofMlsId; 1196 // } 1197 // } 1198 $scope.property_det = data.property_det; 1199 // Set shareMail subject and message 1200 let propertyUrl = 1201 base_url + "/property-details/" + $scope.property_det.ml; 1202 $scope.shareMail["msg"] = "Check out this property " + propertyUrl; 1203 $scope.shareMail["subject"] = 1204 $scope.property_det.address + 1205 "-" + 1206 $scope.property_det.city_name + 1207 ", " +
1208 $scope.property_det.state + 1209 ", " + 1210 $scope.property_det.zip_code; 1211 1212 $scope.allRelatedProperty = []; 1213 $scope.has_property = 1; 1214 $scope.property_ml_id = $scope.property_det.ml; 1215 1216 $scope.latitude = parseFloat(data.property_det.lat); 1217 $scope.longitude = parseFloat(data.property_det.lng); 1218 1219 $scope.address = data.property_det.address; 1220 fb_app_id = data.user_fb_app_id; 1221 1222 if (data.logged_user_fav_property > 0) { 1223 // For Checking user fav property 1224 $scope.fav_status = 1; 1225 } else { 1226 $scope.fav_status = 0; 1227 } 1228 1229 $scope.property_image_url = ""; // image share url for FB 1230 1231 if (data.property_det.getimage.length > 0) { 1232 // check property images.. In which position get image set for the facebook share 1233 for (var i = 0; i < data.property_det.getimage.length; i++) { 1234 if ( 1235 typeof data.property_det.getimage[i].image_path != "undefined" 1236 ) { 1237 var last = data.property_det.getimage[i].image_path 1238 .split("/") 1239 .pop(); // no_image.png 1240 var no_image_last = last.split("."); // no_image 1241 1242 if (no_image_last[0] != "no_image") { 1243 $scope.property_image = 1244 theme_image_url + 1245 data.property_det.getsisdetails.getmlsdetails.name.toLowerCase() + 1246 "/" + 1247 data.property_det.getimage[i].image_path; 1248 $scope.property_image_url = base_url + $scope.property_image; 1249 break; 1250 } 1251 } 1252 } 1253 } 1254 $scope.property_url = $location.absUrl(); 1255 1256 setTimeout(function () { 1257 ProjectGallery(); 1258 projectDetailImgVideoSwiperSlider(); 1259 ImageFitCont(); 1260 1261 // FOR FACE BOOK INITILIZATION // 1262 window.fbAsyncInit = function () { 1263 FB.init({ 1264 appId: fb_app_id, 1265 status: true, 1266 cookie: true, 1267 xfbml: true, 1268 }); 1269 }; 1270 (function () { 1271 var e = document.createElement("script"); 1272 e.async = true; 1273 e.src = 1274 document.location.protocol + 1275 "//connect.facebook.net/en_US/all.js"; 1276 document.getElementById("fb-root").appendChild(e); 1277 })(); 1278 // FOR FACE BOOK INITILIZATION // 1279 1280 // Remove map loading call, it'll only be called when we click the "Load Map" button 1281 // Wasim 29-01-2026 1282 // initMap(); // init map call 1283 1284 const homeProjectSliderSwiper = new Swiper( 1285 ".home-project-slider", 1286 { 1287 navigation: { 1288 nextEl: ".home-project-slider .swiper-button-next", 1289 prevEl: ".home-project-slider .swiper-button-prev", 1290 }, 1291 slidesPerView: 1, 1292 spaceBetween: 30, 1293 breakpoints: { 1294 320: { 1295 slidesPerView: 1, 1296 }, 1297 768: { 1298 slidesPerView: 2, 1299 }, 1300 992: { 1301 slidesPerView: 3, 1302 }, 1303 1200: { 1304 slidesPerView: 4, 1305 }, 1306 }, 1307 } 1308 ); 1309 }, 1000); 1310 1311 setTimeout(() => { 1312 jQuery( 1313 "#propertyProjectDetailModal .modal-body" 1314 ).mCustomScrollbar("scrollTo", ["top", null]); 1315 }, 500); 1316 1317 $scope.propertyDetailsFetching = false;
1318 // fetch related properties 1319 $scope.fetchRelatedProperties(ml); 1320 } 1321 setTimeout(function () { 1322 if ($rootScope.is_front_logged == 1) { 1323 $rootScope.checkLastServieCallTimeAfterLogin(); // To continuous update date time for logged user 1324 $rootScope.$apply(); 1325 } else { 1326 $rootScope.$broadcast("visitedPropertyPage"); // For Dpi-V2 requirement 1327 } 1328 }, 500); 1329 }); 1330 }; 1331 // $scope.fetchPropertyDetailsAfterStateChanged = function (ml) { 1332 // $scope.front_spinner = 1; 1333 // $scope.propertyDetailsFetching = true; 1334 // // Show the modal 1335 // jQuery('#propertyProjectDetailModal').on('shown.bs.modal', function (e) { 1336 // // 1337 // // jQuery('#propertyProjectDetailModal .modal-body').mCustomScrollbar("scrollTo", ".propertyProjectDetail-content-wrap"); 1338 // jQuery('#propertyProjectDetailModal .modal-body').mCustomScrollbar(); 1339 1340 // // Scroll to top 1341 // // $('#propertyProjectDetailModal').animate({ scrollTop: 0 }, 'fast'); 1342 // }); 1343 1344 // jQuery('#propertyProjectDetailModal').modal(); 1345 1346 // $scope.property_ml_id = ml; 1347 // var fb_app_id = $rootScope.fb_app_id; 1348 1349 // // Find previous and next index 1350 // const mlIndex = $rootScope.propertyMlsIds.indexOf(ml); 1351 // if (mlIndex == -1) { 1352 // $scope.previousPropertyMl = null; 1353 // $scope.nextPropertyMl = null; 1354 // } else { 1355 // if (mlIndex > 0) { 1356 // $scope.previousPropertyMl = $rootScope.propertyMlsIds[mlIndex - 1]; 1357 // } else { 1358 // $scope.previousPropertyMl = null; 1359 // } 1360 // if ((mlIndex + 1) < $rootScope.propertyMlsIds.length) { 1361 // $scope.nextPropertyMl = $rootScope.propertyMlsIds[mlIndex + 1]; 1362 // } else { 1363 // $scope.nextPropertyMl = null; 1364 // } 1365 // } 1366 1367 // // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON START// 1368 // if (fb_app_id != '') { 1369 // $scope.fb_button_visible = 1; 1370 // } 1371 // // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON END// 1372 1373 // var token = localStorage.getItem("access_token"); // If login 1374 // if ($localStorage.city_page_search_params) { 1375 // var search_params = JSON.parse($localStorage.city_page_search_params) 1376 // } else { 1377 // var search_params = ''; 1378 // } 1379 1380 // var $httpRequest = $http({ 1381 // method: 'POST', 1382 // url: base_url + '/firsthometheme/property-details-updated', 1383 // data: { 1384 // property_ml_id: $scope.property_ml_id, 1385 // member_id: $scope.userid, 1386 // search_params: search_params 1387 // }, 1388 // headers: { 1389 // 'Content-Type': 'application/json; charset=utf-8', 1390 // 'Access-Token': token, 1391 // } 1392 // }).success(function (data, status) { 1393 // $scope.front_spinner = 0; 1394 // 1395 // if (data.property_det.length === 0) { 1396 // $scope.has_property = 0; 1397 // } else { 1398 // // if ($localStorage.mls_id) { 1399 // // var storeMlsIds = JSON.parse($localStorage.mls_id); 1400 // // var indexofMlsId = storeMlsIds.indexOf($scope.property_ml_id); 1401 // // if (indexofMlsId > -1) { 1402 // // $rootScope.all_property_search_list = storeMlsIds; 1403 // // $rootScope.currentPropertyIndex = indexofMlsId; 1404 // // } 1405 // // } 1406 // $scope.allRelatedProperty = []; 1407 // $scope.has_property = 1; 1408 // $scope.property_det = data.property_det; 1409 // $scope.property_ml_id = $scope.property_det.ml 1410 1411 // $scope.latitude = parseFloat(data.property_det.lat); 1412 // $scope.longitude = parseFloat(data.property_det.lng); 1413 1414 // $scope.address = data.property_det.address; 1415 // fb_app_id = data.user_fb_app_id; 1416 1417 // if (data.logged_user_fav_proerty > 0) // For Checking user fav property 1418 // { 1419 // $scope.fav_status = 1; 1420 // } else { 1421 // $scope.fav_status = 0; 1422 // } 1423 1424 // $scope.property_image_url = ''; // image share url for FB 1425 1426 // if (data.property_det.getimage.length > 0) // check property images.. In which position get image set for the facebook share 1427 // { 1428 // for (var i = 0; i < data.property_det.getimage.length; i++) { 1429 // if (typeof data.property_det.getimage[i].image_path != 'undefined') { 1430 // var last = data.property_det.getimage[i].image_path.split("/").pop(); // no_image.png 1431 // var no_image_last = last.split("."); // no_image 1432 1433 // if (no_image_last[0] != 'no_image') { 1434 // $scope.property_image = theme_image_url + data.property_det.getsisdetail
1434s.getmlsdetails.name.toLowerCase() + '/' + data.property_det.getimage[i].image_path; 1435 // $scope.property_image_url = base_url + $scope.property_image; 1436 // break; 1437 // } 1438 // } 1439 // } 1440 // } 1441 // $scope.property_url = $location.absUrl(); 1442 1443 // setTimeout(function () { 1444 // ProjectGallery(); 1445 // projectDetailImgVideoSwiperSlider(); 1446 // ImageFitCont(); 1447 1448 // // FOR FACE BOOK INITILIZATION // 1449 // window.fbAsyncInit = function () { 1450 // FB.init({ 1451 // appId: fb_app_id, 1452 // status: true, 1453 // cookie: true, 1454 // xfbml: true 1455 // }); 1456 // }; 1457 // (function () { 1458 // var e = document.createElement('script'); 1459 // e.async = true; 1460 // e.src = document.location.protocol + 1461 // '//connect.facebook.net/en_US/all.js'; 1462 // document.getElementById('fb-root').appendChild(e); 1463 // }()); 1464 // // FOR FACE BOOK INITILIZATION // 1465 1466 // initMap(); // init map call 1467 1468 // const homeProjectSliderSwiper = new Swiper('.home-project-slider', { 1469 // navigation: { 1470 // nextEl: '.home-project-slider .swiper-button-next', 1471 // prevEl: '.home-project-slider .swiper-button-prev', 1472 // }, 1473 // slidesPerView: 1, 1474 // spaceBetween: 30, 1475 // breakpoints: { 1476 // 320: { 1477 // slidesPerView: 1, 1478 // }, 1479 // 768: { 1480 // slidesPerView: 2 1481 // }, 1482 // 992: { 1483 // slidesPerView: 3 1484 // }, 1485 // 1200: { 1486 // slidesPerView: 4 1487 // } 1488 // } 1489 // }); 1490 // }, 1000); 1491 1492 // setTimeout(() => { 1493 // jQuery('#propertyProjectDetailModal .modal-body').mCustomScrollbar('scrollTo', ['top', null]); 1494 // }, 500); 1495 1496 // $scope.propertyDetailsFetching = false; 1497 // // fetch related properties 1498 // $scope.fetchRelatedProperties(ml); 1499 // } 1500 // }); 1501 // } 1502 1503 // page heading Setting 1504 if (typeof $scope.meta_heading[$routeParams.page_name] != "undefined") { 1505 $scope.page_heading = $scope.meta_heading[$routeParams.page_name]; 1506 } else { 1507 $scope.$on("menudatareceived", function (event, args) { 1508 $scope.page_heading = $scope.meta_heading[$routeParams.page_name]; 1509 }); 1510 } 1511 1512 // image fit call on page load 1513 setTimeout(function () { 1514 ImageFitCont(); 1515 jQuery(document).on("click", ".dropdown-menu", function (evt) { 1516 evt.stopPropagation(); 1517 }); 1518 jQuery(document).on("click", function (event) { 1519 var clickover = jQuery(event.target); 1520 1521 clickover = clickover.hasClass("feature_listpanel"); 1522 var _opened = jQuery("#advance_collapse").hasClass("in"); 1523 if (_opened == true && clickover != true) { 1524 jQuery(".collapse").collapse("hide"); 1525 } 1526 }); 1527 }, 500); 1528 1529 /**********************/ 1530
1531 $scope.newobject.active_class = $routeParams.page_name; // Active Class Settings 1532 1533 /****** Get Current Route Name ******/ 1534 /** 1535 /* Copy search Url 1536 */ 1537 $scope.searchUrlCopy = function () { 1538 $scope.searchStorage = $localStorage.city_page_search_params; 1539 1540 //$scope.curreUrl = document.URL; 1541 $scope.curreUrl = window.location.href.split("?")[0]; 1542 var generateSearchUrl = encodeURI( 1543 $scope.curreUrl + "?search=" + btoa($scope.searchStorage) 1544 ); 1545 //var generateSearchUrl = "mailto:?subject=Search Property Link&body="+$scope.curreUrl+'?params='+$scope.searchStorage; 1546 1547 //tiny url api 1548 let query = { 1549 url: generateSearchUrl, 1550 }; 1551 var tinyurl; 1552 $.get("/firsthometheme/generate-tiny-url", query).done(function (data) { 1553 tinyurl = data.data; 1554 1555 $("#urlInput").val(tinyurl); 1556 $scope.myFunction(); 1557 }); 1558 //window.location = generateSearchUrl; 1559 //window.open(generateSearchUrl, '_blank'); 1560 }; 1561 1562 $scope.printFlyer = function (ml) { 1563 let data = { 1564 agent_id: user_id, 1565 property_ml_id: ml, 1566 member_id: user_id, 1567 }; 1568 let printPath = 1569 $location.protocol() + 1570 "://" + 1571 $location.host() + 1572 "/firsthometheme/print-flyer?member_id=" + 1573 user_id + 1574 "&agent_id=" + 1575 user_id + 1576 "&property_ml_id=" + 1577 ml; 1578 // 1579 //$location.path(printPath); 1580 //window.location.href=printPath; 1581 window.open(printPath, "_blank"); 1582 }; 1583 1584 $scope.copyToSafari = function () { 1585 var copyText = document.getElementById("urlInput"); 1586 var text_to_share = copyText.value; 1587 var range, selection; 1588 var h = document.createElement("DIV"); 1589 var t = document.createTextNode(text_to_share); 1590 h.appendChild(t); 1591 document.body.appendChild(h); 1592 var element = h; 1593 if (document.body.createTextRange) { 1594 range = document.body.createTextRange(); 1595 range.moveToElementText(element); 1596 range.select(); 1597 } else if (window.getSelection) { 1598 selection = window.getSelection(); 1599 range = document.createRange(); 1600 range.selectNodeContents(element); 1601 selection.removeAllRanges(); 1602 selection.addRange(range); 1603 } 1604 try { 1605 document.execCommand("copy"); 1606 } catch (err) { 1607 } finally { 1608 element.remove(); 1609 } 1610 }; 1611 /** 1612 * Click handler for Copy 1613 */ 1614 $scope.myFunction = function () { 1615 /* Get the text field */ 1616 var copyText = document.getElementById("urlInput"); 1617 /* Select the text field */ 1618 copyText.select(); 1619 /* Copy the text inside the text field */ 1620 document.execCommand("copy"); 1621 /* Alert the copied text */ 1622 swal({ 1623 title: "Copy Search Settings", 1624 text: "Click on Copy button to copy the link. Then paste the link in an email and send it.", 1625 button: "Copy", 1626 // closeOnClickOutside: true, 1627 // showCancelButton: true, 1628 // cancelButtonText: 'Cancel', 1629 // buttons: { 1630 // cancel: true, 1631 // confirm: true, 1632 // }, 1633 // buttons: { 1634 // cancel: { 1635 // text: "Cancel", 1636 // value: null, 1637 // visible: false, 1638 // className: "", 1639 // closeModal: true, 1640 // }, 1641 // confirm: { 1642 // text: "OK", 1643 // value: true, 1644 // visible: true, 1645 // className: "", 1646 // closeModal: true 1647 // } 1648 // }, 1649 content: { 1650 element: "input", 1651 attributes: { 1652 value: copyText.value, 1653 readonly: "true", 1654 }, 1655 }, 1656 }).then((value) => { 1657 // 1658 // 1659 if (value == null) { 1660 // Clicked on the backdrop. Do nothing. Just close the modal 1661 return; 1662 } 1663 $scope.copyToSafari(); 1664 swal("Copied to Clipboard"); 1665 }); 1666 // .then((value) => { 1667 // 1668 // 1669 // }, function (dismiss) { 1670 // if (dismiss == 'cancel') { 1671 // 1672 // } 1673 // }); 1674 }; 1675 1676 /* 1677 $scope.$on('$viewContentLoaded', function(){ 1678 // console.log('viewContentLoaded') 1679 var pathArr = $location.path().split('/'); 1680 if(pathArr.indexOf('search')==2) 1681 { 1682 setTimeout(()=>{ 1683 1684 if (typeof $scope.agent_zip_search != 'undefined' && $scope.agent_zip_search != '' && $scope.is_coming_from_home == 0) { 1685 // 1686 //$rootScope.using_saved_zip=true; 1687 1688 if (!$scope.advanced_search.zip_code) { 1689 $scope.advanced_search.zip_code = []; 1690 $scope.advanced_search.zip_code[0] = $scope.agent_zip_search; 1691 } 1692 else { 1693 if ($scope.advanced_search.zip_code.indexOf($scope.agent_zip_search) === '-1') 1694 $scope.advanced_search.zip_code.push($scope.agent_zip_search); 1695 } 1696 } 1697 },2000); 1698 } 1699 //Here your view content is fully loaded !! 1700 }); 1701 1702 */ 1703 ///// AGENT WEBSITE DETAILS START ///// 1704 $scope.getAgentDetails = 1705 function () // get agent details for home page of his website 1706 { 1707 var agent_id = $scope.userid; 1708 var httpRequest = $http({ 1709 method: "POST", 1710 url: base_url + "/firsthometheme/get-agent-details", 1711 data: { 1712 agent_id: agent_id, 1713 }, 1714 }).success(function (data, status) { 1715 $scope.agentDetails = data.agent_details; 1716 $rootScope.city_page_sort = $scope.agentDetails.city_page_sort; 1717 $scope.search_listing_sort = $rootScope.city_page_sort; 1718 if($scope.agentDetails.city_page_date_sort != null) { 1719 $rootScope.city_page_date_sort = $scope.agentDetails.search_listing_date_sort; 1720 $scope.search_listing_date_sort = $rootScope.city_page_date_sort; 1721 } 1722 $scope.agent_zip_search = data.agent_details.zip_search; 1723 $localStorage.agent_zip_search = data.agent_details.zip_search; 1724 $scope.agent_set_zip_code = data.agent_details.zip_search; // For only reset search 1725 $scope.property_details_view_count = 1726 data.agent_details.property_details_view_count; //property_details_view_count 1727 localStorage.setItem( 1728 "prop_view_limit", 1729 $scope.property_details_view_count 1730 ); 1731 localStorage.setItem( 1732 "dev_view_limit", 1733 $scope.development_view_count 1734 ); 1735 1736 if ($scope.routeName == "search_property") { 1737 // $scope.getSelectedBed(0, 1); 1738 // $scope.getSelectedBath(0, 1); 1739 $scope.bedrooms[0].current = 0; 1740 $scope.bathrooms[0].current = 0; 1741 $scope.advanced_search.bedrooms = 0; 1742 $scope.advanced_search.bathrooms = 0; 1743 if ( 1744 typeof $scope.agent_zip_search != "undefined" && 1745 $scope.agent_zip_search != "" && 1746 $scope.is_coming_from_home == 0 1747 ) { 1748 // 1749 //$rootScope.using_saved_zip=true; 1750 1751 if (!$scope.advanced_search.zip_code) { 1752 $scope.advanced_search.zip_code = []; 1753 $scope.advanced_search.zip_code[0] = $scope.agent_zip_search; 1754 } else { 1755 if ( 1756 $scope.advanced_search.zip_code.indexOf( 1757 $scope.agent_zip_search 1758 ) === "-1" 1759 ) 1760 $scope.advanced_search.zip_code.push( 1761 $scope.agent_zip_search 1762 ); 1763 } 1764 } 1765 } 1766 }); 1767 }; 1768 ///// AGENT WEBSITE DETAILS START ///// 1769 1770 // For Google Map 1771 var markers = []; 1772 1773 $scope.shareFriend = function () { 1774 var property_url = $location.absUrl(); 1775 var data = { 1776 share: $scope.shareMail, 1777 member_id: $scope.userid, //Agent id Website owner 1778 property_url: property_url, 1779 recaptcha_code: document.querySelector(`[name="h-captcha-response"]`) 1780 .value, 1781 }; 1782 1783 var httpRequest = $http({ 1784 method: "POST", 1785 //url: base_url + '/firsthometheme/send-request-mail', 1786 url: base_url + "/firsthometheme/send-share-mail", 1787 data: data, 1788 }) 1789 .success(function (data, status) { 1790 if (data.success == 1) { 1791 $scope.showSuccMsg = 1; 1792 $scope.change_class = "#71b100"; 1793 $scope.show_message = 1794 "This property has been successfully shared via mail"; 1795 // $scope.shareFriendForm.reset(); 1796 // Close the shareFriend Modal 1797 jQuery('#shareFriend').modal('hide'); 1798 $scope.shareMail = {}; 1799 } else { 1800 $scope.showSuccMsg = 1; 1801 $scope.show_message = "Some error occured."; 1802 $scope.change_class = "#F00"; 1803 } 1804 1805 $timeout(function () { 1806 $scope.showSuccMsg = 0; 1807 angular.element(".close").trigger("click"); 1808 $scope.$digest(); 1809 }, 3000); 1810 }) 1811 .error(function (data, status, header, config) { 1812 $scope.showSuccMsg = 1; 1813 $scope.show_message = "Some error occured."; 1814 $scope.change_class = "#F00"; 1815 1816 $timeout(function () { 1817 $scope.showSuccMsg = 0; 1818 angular.element(".close").trigger("click"); 1819 $scope.$digest(); 1820 }, 3000); 1821 }); 1822 }; 1823 $scope.getAllProperty = function () { 1824 var httpRequest = $http({ 1825 method: "POST", 1826 url: base_url + "/firsthometheme/all-property", 1827 data: {}, 1828 }).success(function (data, status) { 1829 $scope.property_type = data.all_property_type; 1830 }); 1831 }; 1832 if ( 1833 $scope.routeName == "search_property" || 1834 $scope.routeName == "home" || 1835 $scope.routeName == "mylisting" || 1836 $scope.routeName == "my_listings" || 1837 $scope.routeName == "property_criteria" 1838 ) { 1839 $scope.getAllProperty(); 1840 } 1841 // if ($scope.routeName == "search_property") { 1842 // $scope.getAllProperty(); 1843 // } else if ($scope.routeName == "property_details") {
1844 // const ml = $routeParams.property_ml_id; 1845 // $scope.fetchPropertyDetailsAfterStateChanged(ml); 1846 // } 1847 1848 // The single-active-polygon tracker and the DrawingManager hook now 1849 // live in the shared polygonFilter service (config/config-service.js) 1850 // instead of being copy-pasted into every listing controller. 1851 function trackFilterPolygon(polygon) { 1852 polygonFilter.track(polygon); 1853 } 1854 1855 function clearFilterPolygon() { 1856 polygonFilter.clear(); 1857 } 1858 1859 // The user-drawn overlay comes from the view's DrawingManager, so 1860 // hook its polygoncomplete here instead of relying on the view's 1861 // own handler. Re-hooks whenever the view swaps in a new instance. 1862 function ensurePolygonDrawHook() { 1863 if (typeof drawingManager === "undefined" || !drawingManager) return; 1864 polygonFilter.hookDrawingManager(drawingManager); 1865 } 1866 1867 // START NEW FEATURES ADDED FOR POLYGON DRAW // 1868 $scope.drawOrRemovePolygone = function () { 1869 $scope.hasPolygon = true; 1870 $scope.polygoncount++; 1871 1872 $scope.search_by_polygon = 1; 1873 $rootScope.polygon_lat_long = $scope.polygon_lat_long; 1874 1875 // Everything between here and searchProperty() is bookkeeping. 1876 // It used to be able to throw (it computed the bounding box via 1877 // Leaflet's L.geoJson, and L is injected lazily by the view), and 1878 // when it did, the search never fired and the $apply() that the 1879 // view runs after this function never ran either - so the listing 1880 // did not update and the Remove button never appeared. The search 1881 // now happens whatever else fails. 1882 try { 1883 // var cond = JSON.parse($localStorage.city_page_search_params); 1884 var cond = 1885 $localStorage.city_page_search_params != undefined && 1886 $localStorage.city_page_search_params != "" 1887 ? JSON.parse($localStorage.city_page_search_params) 1888 : {}; 1889 cond.polygon_lat_long = $rootScope.polygon_lat_long; 1890 $scope.currentPage = 1; 1891 cond.currentPage = $scope.currentPage; 1892 cond.page = $scope.currentPage; // searchProperty reads `page` 1893 $localStorage.city_page_search_params = JSON.stringify(cond); 1894 1895 $scope.all_bound = polygonFilter.bounds($rootScope.polygon_lat_long); 1896 } catch (e) { 1897 console.warn("drawOrRemovePolygone bookkeeping failed", e); 1898 } 1899 1900 // A freshly drawn polygon must never be swallowed by the 1901 // searchConditionIsSame() de-dupe. 1902 $scope.searchCondition = ""; 1903 $scope.callingSearchProperty = true; 1904 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 1905 }; 1906 1907 $scope.clearPolygonOnResetSearch = function () { 1908 clearFilterPolygon(); 1909 document.getElementById("specify_by_polygon").value = ""; 1910 $scope.polygoncount = 0; 1911 $rootScope.polygon_lat_long = ""; 1912 $scope.polygon_lat_long = ""; 1913 $scope.hasPolygon = false; 1914 $scope.search_by_polygon = 0; 1915 $rootScope.hitorybackbtn = 0; 1916 // var cond = JSON.parse($localStorage.city_page_search_params); 1917 var cond = 1918 $localStorage.city_page_search_params != undefined && 1919 $localStorage.city_page_search_params != "" 1920 ? JSON.parse($localStorage.city_page_search_params) 1921 : {}; 1922 if (cond.polygon_lat_long) { 1923 delete cond["polygon_lat_long"]; 1924 }
1925 // Without this the edited copy was discarded and the polygon 1926 // stayed in local storage. 1927 $localStorage.city_page_search_params = JSON.stringify(cond); 1928 } 1929 $scope.clearPolygonStucture = function (fromResetButton = false) { 1930 clearFilterPolygon(); 1931 $scope.polygoncount = 0; 1932 $rootScope.polygon_lat_long = ""; 1933 $scope.polygon_lat_long = ""; 1934 $scope.hasPolygon = false; 1935 $scope.search_by_polygon = 0; 1936 $rootScope.hitorybackbtn = 0; 1937 // var cond = JSON.parse($localStorage.city_page_search_params); 1938 var cond = 1939 $localStorage.city_page_search_params != undefined && 1940 $localStorage.city_page_search_params != "" 1941 ? JSON.parse($localStorage.city_page_search_params) 1942 : {}; 1943 if (cond.polygon_lat_long) { 1944 delete cond["polygon_lat_long"]; 1945 } 1946 // if(cond.all_bound) { 1947 // delete cond["all_bound"]; 1948 // } 1949 cond.advance_search = typeof cond.advance_search === 'string' ? JSON.parse(cond.advance_search) : cond.advance_search; 1950 if(typeof cond.advance_search == 'undefined') { 1951 cond.advance_search = {}; 1952 } 1953 // Add city for city pages 1954 cond.advance_search.city = $localStorage.city; // Since city is already an array 1955 1956 $scope.currentPage = 1; 1957 cond.currentPage = $scope.currentPage; 1958 $localStorage.city_page_search_params = JSON.stringify(cond); 1959 $scope.all_bound = {}; 1960 $scope.advance_search = cond.advance_search; 1961 $scope.callingSearchProperty = false; 1962 1963 1964 1965 1966 if (fromResetButton) { 1967 $scope.fetchRealtorCriteria(fromResetButton); 1968 return; 1969 } 1970 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 1971 // $scope.resetSearch(); 1972 }; 1973 1974 /** 1975 * Water access filter options 1976 */ 1977 $scope.waterAccessFilterOptions = function (optionsArray) { 1978 let valuesArray = []; 1979 optionsArray.forEach((option) => { 1980 let optionValue = parseInt(option) == 1 ? "Yes" : "No"; 1981 valuesArray.push(optionValue); 1982 }); 1983 return valuesArray.join(", "); 1984 }; 1985 1986 /****** Check All property inside polygon or not ****/ 1987 function isPointInPoly(poly, y, x) { 1988 var c = false, 1989 j = poly.length - 1, 1990 i; 1991 1992 for (i = 0; i < poly.length; i++) { 1993 if ( 1994 ((poly[i][0] < y && poly[j][0] >= y) || 1995 (poly[j][0] < y && poly[i][0] >= y)) && 1996 (poly[i][1] <= x || poly[j][1] <= x) 1997 ) { 1998 if ( 1999 poly[i][1] + 2000 ((y - poly[i][0]) / (poly[j][0] - poly[i][0])) * 2001 (poly[j][1] - poly[i][1]) < 2002 x 2003 ) { 2004 c = !c; 2005 } 2006 } 2007 j = i; 2008 } 2009 return c; 2010 } 2011 /****** Check All property inside polygon or not ****/ 2012 2013 // END NEW FEATURES ADDED FOR POLYGON DRAW // 2014 2015 $scope.getDistinct = function ( 2016 params // Filter For Advanced Search 2017 ) { 2018 $scope.advanced_search = normalizeAdvancedSearch($scope.advanced_search); 2019 2020 2021 2022 2023 2024 $scope.modal_loader = 1; 2025 $scope.filter_data = ""; 2026 var httpRequest = $http({ 2027 method: "POST", 2028 url: base_url + "/shared/search-filter", 2029 data: { 2030 filter: params, 2031 advanced_search: typeof $scope.advanced_search === 'string' ? $scope.advanced_search : JSON.stringify($scope.advanced_search), 2032 member_id: $scope.userid, 2033 }, 2034 }).success(function (data, status) { 2035 $scope.modal_loader = 0; 2036 $scope.filter_data = data; 2037 $scope.optionsFromQuery = data.get_val; 2038 2039 if ( 2040 $rootScope.polygon_lat_long && 2041 $scope.uniquezipcode_array && 2042 data.filter_param == "zip_code" 2043 ) { 2044 $scope.optionsFromQuery = $scope.uniquezipcode_array; 2045 } 2046 if ( 2047 $rootScope.polygon_lat_long && 2048 $scope.uniquecounty_array && 2049 data.filter_param == "county" 2050 ) { 2051 $scope.optionsFromQuery = $scope.uniquecounty_array; 2052 } 2053 if ( 2054 $rootScope.polygon_lat_long && 2055 $scope.development_Name_array && 2056 data.filter_param == "development_name" 2057 ) { 2058 $scope.optionsFromQuery = $scope.development_Name_array; 2059 } 2060 if ( 2061 $rootScope.polygon_lat_long && 2062 $scope.complex_Name_array && 2063 data.filter_param == "complex_name" 2064 ) { 2065 $scope.optionsFromQuery = $scope.complex_Name_array; 2066 } 2067 if ( 2068 $rootScope.polygon_lat_long && 2069 $scope.views_Name_array && 2070 data.filter_param == "view" 2071 ) { 2072 $scope.optionsFromQuery = $scope.views_Name_array; 2073 } 2074 if ( 2075 $rootScope.polygon_lat_long && 2076 $scope.water_access_array && 2077 data.filter_param == "water_access" 2078 ) { 2079 $scope.optionsFromQuery = $scope.water_access_array; 2080 } 2081 if ( 2082 $rootScope.polygon_lat_long && 2083 $scope.subdivision_Name_array && 2084 data.filter_param == "subdivision_name" 2085 ) { 2086 $scope.optionsFromQuery = $scope.subdivision_Name_array; 2087 } 2088 }); 2089 }; 2090 2091 /**** Generate Polygon Boundary ******/ 2092 $scope.generateBoundary = function () { 2093 $scope.search_by_polygon = 1; 2094 $scope.all_bound = polygonFilter.bounds($rootScope.polygon_lat_long); 2095 }; 2096 /**** Generate Polygon Boundary ******/ 2097 2098 /* Bedroom Bathroom icon setup start */ 2099 2100 $scope.bedrooms = [ 2101 { 2102 current: 0, 2103 max: 4, 2104 }, 2105 ]; 2106 $scope.bathrooms = [ 2107 { 2108 current: 0, 2109 max: 4, 2110 }, 2111 ]; 2112 $scope.halfbathrooms = [ 2113 { 2114 current: 0, 2115 max: 4, 2116 }, 2117 ]; 2118 2119 $scope.getSelectedBath = function (bathrating, sp) { 2120 $scope.bathrating = bathrating; 2121 $scope.advanced_search.bathrooms = $scope.bathrating; 2122 2123 if (!sp) { 2124 $scope.callingSearchProperty = true; 2125 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 2126 } 2127 }; 2128 $scope.getSelectedHalfBath = function (halfbath) { 2129 $scope.halfbath = halfbath; 2130 $scope.advanced_search.hbaths = $scope.halfbath; 2131 if ($scope.advanced_search["hbaths"] == "undefined") { 2132 $scope.hbaths_active = ""; 2133 } else { 2134 $scope.hbaths_active = "active"; 2135 } 2136 }; 2137 2138 /* Bedroom Bathroom icon setup end */ 2139 2140 /******* ADVANCED SEARCH ACTIVE FUNCTION SEARCH *******/ 2141 2142 $scope.advance_search_make_green_active = function () { 2143 if (typeof $scope.advanced_search["sqft_footage"] != "undefined") { 2144 $scope.sqft_footage_active = "active"; 2145 } else { 2146 $scope.sqft_footage_active = ""; 2147 } 2148 if (typeof $scope.advanced_search["hopa"] != "undefined") { 2149 $scope.hopa = "active"; 2150 } else { 2151 $scope.hopa = ""; 2152 } 2153 if ( 2154 typeof $scope.advanced_search["membership_fee_required"] != 2155 "undefined" 2156 ) { 2157 $scope.mebership_fee_active = "active"; 2158 } else { 2159 $scope.mebership_fee_active = ""; 2160 } 2161 2162 if (typeof $scope.advanced_search["short_sale"] != "undefined") { 2163 $scope.short_sale_active = "active"; 2164 } else { 2165 $scope.short_sale_active = ""; 2166 } 2167 if (typeof $scope.advanced_search["foreclosure"] != "undefined") { 2168 $scope.foreclosure_active = "active"; 2169 } else { 2170 $scope.foreclosure_active = ""; 2171 } 2172 if ( 2173 typeof $scope.advanced_search["zip_code"] != "undefined" && 2174 $scope.advanced_search["zip_code"].length > 0 2175 ) { 2176 $scope.zip_code_active = "active"; 2177 } else { 2178 $scope.zip_code_active = ""; 2179 } 2180 if (typeof $scope.advanced_search["county"] != "undefined") { 2181 $scope.county_active = "active"; 2182 } else { 2183 $scope.county_active = ""; 2184 } 2185 if (typeof $scope.advanced_search["development_name"] != "undefined") { 2186 $scope.development_name_active = "active"; 2187 } else { 2188 $scope.development_name_active = ""; 2189 } 2190 if (typeof $scope.advanced_search["subdivision_name"] != "undefined") { 2191 $scope.subdivision_name_active = "active"; 2192 } else { 2193 $scope.subdivision_name_active = ""; 2194 } 2195 if (typeof $scope.advanced_search["complex_name"] != "undefined") { 2196 $scope.complex_name_active = "active"; 2197 } else { 2198 $scope.complex_name_active = ""; 2199 } 2200 if (typeof $scope.advanced_search["hbaths"] != "undefined") { 2201 $scope.hbaths_active = "active"; 2202 } else { 2203 $scope.hbaths_active = ""; 2204 } 2205 if (typeof $scope.advanced_search["pet"] != "undefined") { 2206 $scope.pet_active = "active"; 2207 } else { 2208 $scope.pet_active = ""; 2209 } 2210 if (typeof $scope.advanced_search["pool"] != "undefined") { 2211 $scope.pool_active = "active"; 2212 } else { 2213 $scope.pool_active = ""; 2214 } 2215 if (typeof $scope.advanced_search["view"] != "undefined") { 2216 $scope.view_active = "active"; 2217 } else { 2218 $scope.view_active = ""; 2219 } 2220 if (typeof $scope.advanced_search["water_access"] != "undefined") { 2221 $scope.water_access_active = "active"; 2222 } else { 2223 $scope.water_access_active = ""; 2224 } 2225 if (typeof $scope.advanced_search["water_front"] != "undefined") { 2226 $scope.water_front_active = "active"; 2227 } else { 2228 $scope.water_front_active = ""; 2229 } 2230 if (typeof $scope.advanced_search["furnished"] != "undefined") { 2231 $scope.furnished_active = "active"; 2232 } else { 2233 $scope.furnished_active = ""; 2234 } 2235 if (typeof $scope.advanced_search["hoa_fee"] != "undefined") { 2236 $scope.hoa_fee_active = "active"; 2237 } else { 2238 $scope.hoa_fee_active = ""; 2239 } 2240 }; 2241 2242 /******* ADVANCED SEARCH ACTIVE FUNCTION END *******/ 2243 2244 $scope.setSearchParamsInLocalStorage = function () { 2245 var agentid = $scope.userid; 2246 2247 2248 var cond = { 2249 property_type: $scope.search.property_type, 2250 property_types: $scope.property_types_array, 2251 bedroom: $scope.bedrating, 2252 bathroom: $scope.bathrating, 2253 min_price: $scope.search.min_price, 2254 max_price: $scope.search.max_price, 2255 search_listing_sort: $scope.search_listing_sort, 2256 search_listing_date_sort: $scope.search_listing_date_sort, 2257 image_category: $scope.image_category, 2258 limit: $scope.recordLimit, 2259 page: $scope.currentPage, 2260 advance_search: typeof $scope.advanced_search === 'string' ? $scope.advanced_search : JSON.stringify($scope.advanced_search), 2261 agentid: agentid, 2262 all_bound: typeof $scope.all_bound === 'string' ? $scope.all_bound : JSON.stringify($scope.all_bound), 2263 pit: $scope.pit, 2264 mls_ids: mls_ids, 2265 }; 2266 if (polygonFilter.has($scope.polygon_lat_long)) { 2267 cond.polygon_lat_long = polygonFilter.parse($scope.polygon_lat_long); 2268 } 2269 2270 2271 2272 2273 2274 2275 2276 $localStorage.city_page_search_params = JSON.stringify(cond); // Set search parameters in local storage 2277 }; 2278 2279 2280 2281 if ( 2282 $scope.currentRoute == "property_details" || 2283 $rootScope.previousRoute === $scope.currentRoute || 2284 typeof $rootScope.previousRoute === "undefined" 2285 ) { 2286 2287 $scope.setScopeVariablesBasedOnLocalStorage(); 2288 } 2289 2290 if ( 2291 $scope.currentRoute == "property_details" || 2292 $rootScope.previousRoute === $scope.currentRoute 2293 ) { 2294 $scope.setSearchParamsInLocalStorage(); 2295 } 2296 2297 2298 2299 $scope.searchConditionIsSame = function (condition) { 2300 var stringCondition = JSON.stringify(condition); 2301 return $scope.searchCondition === stringCondition; 2302 }; 2303 $scope.fixCssBackgoundImageDoubleEncodingIssue = function () { 2304 // get all the elements with the thumbnail classes 2305 const thumbnailElements = $('.project-thumb.imageFit'); 2306 thumbnailElements.each(function () { 2307 // Remove background-image inline CSS 2308 $(this).css("background-image", ""); 2309 2310 // Get the image source 2311 var imageSource = $(this).find('img').attr('src'); 2312 // Manually encode only the specific characters 2313 imageSource = imageSource.replace(/\*/g, '%2A') 2314 .replace(/\(/g, '%28') 2315 .replace(/\)/g, '%29'); 2316 2317 // add the image source to the background-image 2318 $(this).css('background-image', 'url(' + imageSource + ')'); 2319
2319 }); 2320 }; 2321 function parseJsonField(value, fallback) { 2322 if (value == null || value === "") { 2323 return fallback; 2324 } 2325 if (typeof value === "object") { 2326 return value; 2327 } 2328 if (typeof value === "string") { 2329 try { 2330 return JSON.parse(value); 2331 } catch (e) { 2332 return fallback; 2333 } 2334 } 2335 return fallback; 2336 } 2337 2338 function whenCriteriaMapReady(fn, attempt) { 2339 attempt = attempt || 0; 2340 if (typeof criteriaMap2 !== "undefined" && criteriaMap2) { 2341 fn(); 2342 return; 2343 } 2344 if (attempt >= 20) { 2345 return; 2346 } 2347 $timeout(function () { 2348 whenCriteriaMapReady(fn, attempt + 1); 2349 }, 100); 2350 } 2351 2352 function attachPolygonListeners(polygonset) { 2353 google.maps.event.addListener(polygonset, "dragend", function () { 2354 isBeingDragged = false; 2355 draw_polygon_change = true; 2356 var myJson = JSON.stringify(polygonset.getPath().getArray()); 2357 setPolygonLatLngChnage(myJson); 2358 }); 2359 2360 google.maps.event.addListener( 2361 polygonset, 2362 "dragstart", 2363 function () { 2364 isBeingDragged = true; 2365 } 2366 ); 2367 2368 polygonset.getPaths().forEach(function (path) { 2369 google.maps.event.addListener( 2370 path, 2371 "insert_at", 2372 function () { 2373 var myJson = JSON.stringify( 2374 polygonset.getPath().getArray() 2375 ); 2376 setPolygonLatLngChnage(myJson); 2377 draw_polygon_change = true; 2378 } 2379 ); 2380 2381 google.maps.event.addListener(path, "remove_at", function () { 2382 var myJson = JSON.stringify(polygonset.getPath().getArray()); 2383 setPolygonLatLngChnage(myJson); 2384 draw_polygon_change = true; 2385 }); 2386 2387 google.maps.event.addListener(path, "set_at", function () { 2388 if (!isBeingDragged) { 2389 var myJson = JSON.stringify( 2390 polygonset.getPath().getArray() 2391 ); 2392 setPolygonLatLngChnage(myJson); 2393 draw_polygon_change = true; 2394 } 2395 }); 2396 }); 2397 } 2398 2399 $scope.scheduleCriteriaMapUpdate = function (propertylatlngs, allBound) { 2400 var attempt = 0; 2401 2402 function run() { 2403 if ( 2404 typeof google === "undefined" || 2405 !google.maps || 2406 typeof initMap2 !== "function" 2407 ) { 2408 if (attempt < 10) { 2409 attempt++; 2410 $timeout(run, 100); 2411 } 2412 return; 2413 } 2414 2415 $timeout(function () { 2416 initMap2(propertylatlngs, allBound); 2417 // initMap2 is what creates the view's DrawingManager, so 2418 // the draw hook can only be attached once it has run. 2419 ensurePolygonDrawHook(); 2420 if (typeof refreshCriteriaMap === "function") { 2421 refreshCriteriaMap(); 2422 } 2423 $timeout(function () { 2424 if (typeof refreshCriteriaMap === "function") { 2425 refreshCriteriaMap(); 2426 } 2427 }, 300); 2428 2429 $timeout(function () { 2430 var hasPolygon = polygonFilter.has($rootScope.polygon_lat_long); 2431 2432 if ( 2433 $scope.marker_map_prioperties.length == 0 && 2434 !hasPolygon 2435 ) { 2436 const defaultZipSearch = localStorage.getItem( 2437 "default_zip_search" 2438 ); 2439 2440 if (!$scope.all_bound) { 2441 centerToZipCode(defaultZipSearch); 2442 } 2443 } 2444 }, 500); 2445 }, 100); 2446 } 2447 2448 run(); 2449 }; 2450 2451 /******* SEARCH PROPERTY BUTTON AJAX START *******/ 2452 $scope.searchProperty = function ( 2453 cond, 2454 allbound, //cond 2455 options // { fromMap: true } — omitted by every existing caller 2456 ) { 2457 options = options || {};
2458 if ($scope.pageChanged == false) { 2459 $scope.currentPage = 1; 2460 } 2461 if ($rootScope.resettingFilters == true) { 2462 return; 2463 } 2464 2465 2466 2467 if ($rootScope.previousRoute == undefined) { 2468 2469 $rootScope.previousRoute = $scope.currentRoute; 2470 } 2471 // $rootScope.previousRoute = 'search_property' 2472 // $scope.currentRoute = 'search_property' 2473 2474 // $scope.resetFilterBasedOnTime(); 2475 if ($scope.routeName == "home" && $scope.quickSearchCalled == false) { 2476 return; 2477 } 2478 $scope.callingSearchProperty = true; 2479 2480 // Set local storage search from $scope 2481 // if (!$scope.firstSearchLoading) { 2482 // if ( 2483 // $scope.currentRoute == "property_details" || 2484 // $rootScope.previousRoute === $scope.currentRoute 2485 // ) { 2486 $scope.setSearchParamsInLocalStorage(); 2487 // } 2488 // Mls Ids 2489 // 2490 2491 // Scroll to top of the page — skipped for map-bounds driven searches so a 2492 // pan/zoom gesture isn't interrupted by a smooth-scroll of the window. 2493 if (!options.fromMap) { 2494 $window.scrollTo(0, 0); 2495 const elmnt = document.getElementById("top_div"); 2496 if (elmnt && typeof elmnt.scrollIntoView === "function") { 2497 elmnt.scrollIntoView({ behavior: "smooth" }); 2498 } 2499 } 2500 2501 $scope.searchLoaderCount++; 2502 if (typeof localStorage.getItem("hit_saved_search") !== "undefined") { 2503 $scope.hitsavedsearch = localStorage.getItem("hit_saved_search"); 2504 localStorage.removeItem("hit_saved_search"); 2505 } 2506 2507 $scope.all_bound = allbound; 2508 2509 var agentid = $scope.userid; // Site owner 2510 $scope.front_spinner = 1; 2511 var backwards = localStorage.getItem("backwards"); 2512 if ( 2513 $rootScope.fromhomesearch == 1 || 2514 $scope.hitsavedsearch == 1 || 2515 $localStorage.backwards == 1 2516 ) { 2517 2518 $localStorage.backwards = 0; 2519 $scope.is_coming_from_home = 1; 2520 $rootScope.fromhomesearch = 0; 2521 $scope.hitsavedsearch = 0; 2522 2523 // var cond = JSON.parse($localStorage.city_page_search_params); 2524 var cond = 2525 $localStorage.city_page_search_params != undefined && 2526 $localStorage.city_page_search_params != "" 2527 ? JSON.parse($localStorage.city_page_search_params) 2528 : {}; 2529 2530 $scope.search.property_type = cond.property_type; 2531 $scope.property_types_array = cond.property_types; 2532 $scope.bedrating = cond.bedroom; 2533 $scope.bathrating = cond.bathroom; 2534 $scope.search.min_price = cond.min_price; 2535 $scope.search.max_price = cond.max_price; 2536 $scope.search_listing_sort = cond.search_listing_sort; 2537 $scope.search_listing_date_sort = cond.search_listing_date_sort; 2538 $scope.image_category = cond.image_category; 2539 $scope.recordLimit = cond.limit; 2540 $scope.currentPage = cond.page; 2541 $scope.advanced_search = JSON.parse(cond.advance_search); 2542 $scope.all_bound = JSON.parse(cond.all_bound); 2543 } 2544
2545 if ($rootScope.hitorybackbtn == 1 && polygonFilter.has($rootScope.polygon_lat_long)) { 2546 $scope.generateBoundary(); 2547 } 2548 /** 2549 * loading from copied search param 2550 If there is query params of search include it in localstorage 2551 */ 2552 if ($routeParams.search) { 2553 2554 $localStorage.city_page_search_params = ""; 2555 try { 2556 var setParams = JSON.parse(atob($routeParams.search)); 2557 2558 $scope.search.property_type = setParams.property_type; 2559 $scope.property_types_array = setParams.property_types; 2560 $scope.bedrating = setParams.bedroom; 2561 $scope.bathrating = setParams.bathroom; 2562 $scope.search.min_price = setParams.min_price; 2563 $scope.search.max_price = setParams.max_price; 2564 $scope.search_listing_sort = setParams.search_listing_sort; 2565 $scope.search_listing_date_sort = setParams.search_listing_date_sort; 2566 $scope.image_category = setParams.image_category; 2567 $scope.recordLimit = setParams.limit; 2568 $scope.currentPage = setParams.page; 2569 $scope.advanced_search = setParams.advance_search 2570 ? JSON.parse(setParams.advance_search) 2571 : []; 2572 // $scope.all_bound = setParams.all_bound 2573 // ? JSON.parse(setParams.all_bound) 2574 // : []; 2575 if (setParams.all_bound) { 2576 if (typeof setParams.all_bound == 'string') { 2577 $scope.all_bound = JSON.parse(setParams.all_bound); 2578 } else { 2579 $scope.all_bound = setParams.all_bound; 2580 } 2581 } else { 2582 $scope.all_bound = {}; 2583 } 2584 // $scope.polygon_lat_long = setParams.polygon_lat_long 2585 // ? JSON.parse(setParams.polygon_lat_long) 2586 // : []; 2587 if (typeof setParams.polygon_lat_long == "string") { 2588 $scope.polygon_lat_long = setParams.polygon_lat_long 2589 ? setParams.polygon_lat_long 2590 : '[]'; 2591 $rootScope.polygon_lat_long = setParams.polygon_lat_long; 2592 } else { 2593 $scope.polygon_lat_long = setParams.polygon_lat_long 2594 ? JSON.stringify(setParams.polygon_lat_long) 2595 : '[]'; 2596 $rootScope.polygon_lat_long = JSON.stringify(setParams.polygon_lat_long); 2597 } 2598 //For map pointer 2599 $rootScope.hitorybackbtn = 1; 2600 $localStorage.city_page_search_params = JSON.stringify(setParams); 2601 2602 location.skipReload().url($location.path()); 2603 } catch (e) { 2604 console.warn("parse error of search params"); 2605 } 2606 } 2607 if (typeof $scope.advanced_search == 'string') { 2608 $scope.advanced_search = JSON.parse($scope.advanced_search); 2609 } 2610 if ($scope.polygoncount == 1) { 2611 $rootScope.using_saved_zip = false; 2612 $scope.advanced_search.zip_code = []; 2613 $scope.polygoncount++; 2614 } 2615 2616 2617 2618 if ( 2619 $localStorage.city_page_search_params != undefined && 2620 $localStorage.city_page_search_params != "" 2621 ) { 2622 2623 var localStorageSearchParams = JSON.parse( 2624 $localStorage.city_page_search_params 2625 ); 2626 var cond = { 2627 property_type: localStorageSearchParams.property_type, 2628 property_types: localStorageSearchParams.property_types, 2629 bedroom: localStorageSearchParams.bedroom, 2630 bathroom: localStorageSearchParams.bathroom, 2631 min_price: localStorageSearchParams.min_price, 2632 max_price: localStorageSearchParams.max_price, 2633 search_listing_sort: $scope.search_listing_sort, 2634 search_listing_date_sort : $scope.search_listing_date_sort, 2635 image_category: $scope.image_category, 2636 limit: $scope.recordLimit, 2637 page: $scope.currentPage, 2638 advance_search: localStorageSearchParams.advance_search, 2639 advance_search_updated: localStorageSearchParams.advance_search, 2640 agentid: agentid, 2641 // all_bound: localStorageSearchParams.all_bound, 2642 all_bound: typeof allbound != 'undefined' ? JSON.stringify(allbound) : localStorageSearchParams.all_bound, 2643 pit: localStorageSearchParams.pit, 2644 mls_ids: mls_ids, 2645 }; 2646 $scope.setScopeVariablesBasedOnLocalStorage(); 2647 } else { 2648 2649 var cond = { 2650 property_type: $scope.search.property_type, 2651 property_types: $scope.property_types_array, 2652 bedroom: $scope.bedrating, 2653 bathroom: $scope.bathrating, 2654 min_price: $scope.search.min_price, 2655 max_price: $scope.search.max_price, 2656 search_listing_sort: $scope.search_listing_sort, 2657 search_listing_date_sort : $scope.search_listing_date_sort, 2658 image_category: $scope.image_category, 2659 limit: $scope.recordLimit, 2660 page: $scope.currentPage, 2661 advance_search: JSON.stringify($scope.advanced_search), 2662 agentid: agentid, 2663 // all_bound: JSON.stringify($scope.all_bound), 2664 all_bound: JSON.stringify($scope.all_bound), 2665 pit: $scope.pit, 2666 mls_ids: mls_ids, 2667 }; 2668 // $scope.firstSearchLoading = false;
2669 } 2670 2671 // var cond = JSON.parse($localStorage.city_page_search_params); 2672 2673 var apiurl = ""; 2674 let searchPropertyUrl = "search-property-result"; 2675 if (polygonFilter.has($rootScope.polygon_lat_long)) { 2676 // The API does json_decode() on this, so it must be a JSON 2677 // string and not an array. 2678 cond.polygon_lat_long = polygonFilter.toPayload($rootScope.polygon_lat_long); 2679 $scope.hasPolygon = true; 2680 searchPropertyUrl = "search-property-result-with-polygon"; 2681 apiurl = base_url + "/shared/" + searchPropertyUrl; 2682 } else { 2683 $scope.hasPolygon = false; 2684 apiurl = base_url + "/shared/" + searchPropertyUrl; 2685 } 2686 2687 var token = localStorage.getItem("access_token"); // If login 2688 2689 if ($scope.searchConditionIsSame(cond)) { 2690 // Bail out cleanly. This previously returned after show_loader = 1 and 2691 // after wiping $rootScope.propertyMlsIds, stranding the spinner and 2692 // breaking the details modal PREV/NEXT. 2693 $scope.show_loader = 0; 2694 $scope.front_spinner = 0; 2695 $scope.searchLoaderCount = 0; 2696 $scope.callingSearchProperty = false; 2697 return; 2698 } 2699 $scope.show_loader = 1; 2700 $rootScope.propertyMlsIds = []; 2701 cond.menu_id = $scope.menu_id; 2702 cond.criteria_id = $scope.criteria_id; 2703 cond.page_name = $scope.page_name; 2704 if ( 2705 !isEmpty 2706 ) { 2707 2708 cond.advance_search = JSON.parse(cond.advance_search); 2709 cond.advance_search.bedrooms = cond.bedroom; 2710 cond.advance_search.bathrooms = cond.bathroom; 2711 $rootScope.advanceSearchWatcherEnabled = false; 2712 $scope.bedrating = cond.bedroom; 2713 $scope.bathrating = cond.bathroom; 2714 $scope.advanced_search = cond.advance_search; 2715 cond.advance_search = JSON.stringify(cond.advance_search); 2716 $scope.searchCondition = JSON.stringify(cond); 2717 2718 2719 2720 2721 } 2722 2723 2724 2725 2726 2727 2728 var boundObj = parseJsonField(cond.all_bound, {}); 2729 2730 2731 if (cond.all_bound && typeof cond.all_bound != 'undefined' && cond.all_bound != "" && cond.all_bound != "{}" && Object.keys(boundObj).length > 2) { 2732 // Has all_bound remove all location based filters from advanced_search 2733 2734 cond.advance_search = parseJsonField(cond.advance_search, {}); 2735 2736 2737 $scope.locationBasedFilters.forEach(function (filter) { 2738 if (cond.advance_search[filter]) { 2739 delete cond.advance_search[filter]; 2740 } 2741 2742 }); 2743 cond.advance_search = JSON.stringify(cond.advance_search); 2744 } 2745 2746 // Added by Wasim on 2025-08-21 to resolve save search 2747 $scope.searchCondition = JSON.stringify(cond); 2748 2749 // Set the location id 2750 // Wasim 2025-03-07: This code is added to encounter duplicate location names 2751 // But if we add the location_id logic the new city search will not be possible since we aren't getting the location id for locations in the auto complete 2752 cond.location_id = $rootScope.location_id; 2753 2754 // Fix city page property type issue. 2755 if (cond.property_types && cond.property_types.length > 0) { 2756 cond.property_type = cond.property_types[0]; 2757 } else { 2758 cond.property_type = ""; 2759 } 2760 2761 var httpRequest = $http({ 2762 method: "POST", 2763 url: apiurl, 2764 data: cond, 2765 headers: { 2766 "Content-Type": "application/json; charset=utf-8", 2767 "Access-Token": token, 2768 }, 2769 }).success(function (data, status) { 2770 if(searchPropertyUrl == "search-property-result-with-polygon" && $rootScope.cityPageFirstLoading) { 2771 $scope.moveMap = true; 2772 } else { 2773 $scope.moveMap = false;
2774 } 2775 $rootScope.cityPageFirstLoading = false; 2776 $scope.pageChanged = false; 2777 $rootScope.resettingFilters = false; 2778 2779 $scope.search.put_location = ''; 2780 allbound = parseJsonField(allbound, {}); 2781 if (typeof allbound != 'undefined' && Object.keys(allbound).length > 0) { 2782 var localStorageSearchParams = JSON.parse($localStorage.city_page_search_params); 2783 $scope.all_bound = allbound; 2784 localStorageSearchParams.all_bound = $scope.all_bound; 2785 2786 if (typeof localStorageSearchParams.advance_search == 'string') { 2787 localStorageSearchParams.advance_search = JSON.parse(localStorageSearchParams.advance_search); 2788 } 2789 2790 delete localStorageSearchParams.advance_search.zip_code; 2791 delete $scope.advanced_search.zip_code; 2792 // $localStorage.search_params = JSON.stringify(localStorageSearchParams); 2793 } 2794 2795 // Set $scope.advanced_search 2796 if ( 2797 !isEmpty 2798 ) { 2799 2800 const advancedSearch = parseJsonField(cond.advance_search, {}); 2801 $scope.advanced_search = advancedSearch; 2802 } 2803 if (typeof cond.advance_search === "string") { 2804 $scope.advanced_search_updated = JSON.parse(cond.advance_search); 2805 } else { 2806 $scope.advanced_search_updated = cond.advance_search; 2807 } 2808 2809 $rootScope.previousRoute = $scope.currentRoute; 2810 2811 $rootScope.firstCitySearchLoading = false; 2812 $scope.callingSearchProperty = false; 2813 $rootScope.advanceSearchWatcherEnabled = true; 2814 // $scope.searchCondition = JSON.stringify(cond); 2815 $rootScope.propertyMlsIds = []; 2816 $scope.front_spinner = 0; 2817 $scope.show_loader = 0; 2818 $scope.fivehundred_msg_status = 0; 2819 $scope.all_property_list = data.all_property; 2820 $scope.pit = data.pit; 2821 // Add mls ids in rootscope 2822 2823 2824 data.all_property.forEach(function (property) { 2825 // $rootScope.propertyMlsIds.push(property.ml); 2826 $rootScope.propertyMlsIds.push(property.id); 2827 }); 2828 // $scope.searchLoaderCount--; 2829 $scope.searchLoaderCount = 0; 2830 2831 $scope.property_found = data.total_matched_property; // to show all matched property count 2832 $scope.marker_map_prioperties = data.all_map_property; 2833 $scope.last_update_corn_time = data.last_update_corn_time; // Last Update Mid Florida Property 2834 2835 $scope.bedrooms[0].current = cond.bedroom; 2836 $scope.bathrooms[0].current = cond.bathroom; 2837 2838 // Set filter_expiration_time 2839 const currentTimeInMilliseconds = Date.now(); 2840 const expirationTime = 2841 currentTimeInMilliseconds + 2842 $scope.resetFilterTimeThreshold * 60 * 1000; 2843 $localStorage.filter_expiration_time = expirationTime; 2844 2845 //$rootScope.all_property_search_list = $scope.all_property_list.map(a => a.ml); 2846 var resultArray = $scope.marker_map_prioperties.map((a) => a.ml); 2847 $localStorage.mls_id = JSON.stringify(resultArray); 2848 2849 /* Map and Pagination propety start */ 2850 if (data.total_matched_property > 500) { 2851 $scope.visible_property_found = 500; 2852 $scope.fivehundred_msg_status = 1; 2853 } else { 2854 $scope.visible_property_found = data.total_matched_property; 2855 $scope.fivehundred_msg_status = 0; 2856 } 2857 /* Map and Pagination propety end */ 2858 2859 setTimeout(function () { 2860 ImageFitCont(); 2861 }, 500); 2862 setTimeout(function () { 2863 $scope.fixCssBackgoundImageDoubleEncodingIssue(); 2864 }, 1000); 2865 2866 //***** Google map integration code here start *****// 2867 var ip = 0; 2868 var tmp = {}; 2869 var tmp_arr = []; 2870 $scope.propertylatlngs = []; 2871 2872 var latlngArray = Array(); 2873 if ($rootScope.polygon_lat_long) { 2874 var latngtdata = JSON.parse($rootScope.polygon_lat_long); 2875 for (var i = 0; i < latngtdata.length; i++) { 2876 latlngArray[i] = [latngtdata[i].lat, latngtdata[i].lng]; 2877 } 2878 } 2879 // 2880 for (ip = 0; ip < $scope.marker_map_prioperties.length; ip++) { 2881 tmp = $scope.marker_map_prioperties[ip]; 2882 if (latlngArray.length > 0) { 2883 var checkPropertyBelongs = isPointInPoly( 2884 latlngArray, 2885 tmp.lat, 2886 tmp.lng 2887 ); 2888 } 2889 2890 var prop_image = ""; 2891 2892 if ( 2893 typeof tmp.getimage != "undefined" && 2894 tmp.getimage != null && 2895 tmp.getimage.length > 0 2896 ) { 2897 prop_image = tmp.getimage[0].image_path; 2898 } 2899 2900 var mapCurrency = ""; 2901 if (tmp.currency_sign) { 2902 mapCurrency = tmp.currency_sign; 2903 } else { 2904 mapCurrency = "$"; 2905 } 2906 2907 tmp_arr = [ 2908 tmp.address + 2909 ", " + 2910 tmp.city_name + 2911 ", " + 2912 tmp.state + 2913 " - " + 2914 tmp.zip_code, 2915 tmp.lat, 2916 tmp.lng, 2917 tmp.address + 2918 ", " + 2919 tmp.city_name + 2920 ", " + 2921 tmp.state + 2922 " - " + 2923 tmp.zip_code, 2924 tmp.list_price, 2925 tmp.id, 2926 prop_image, 2927 tmp.beds, 2928 tmp.fbaths, 2929 tmp.hbaths, 2930 tmp.sqft_liv_area, 2931 tmp.ml, 2932 tmp.office_name, 2933 tmp.mls_id, 2934 mapCurrency, 2935 tmp.rent_sale, 2936 tmp.property_measurement_unit_short 2937 ]; 2938 $scope.propertylatlngs.push(tmp_arr); 2939 } 2940 2941 // Set property type dropdown text 2942 2943 2944 2945 if ($scope.propertyTypeDropdownText == "") { 2946 $scope.setPropertyTypeDropdownTextFromAllPropertyTypes(); 2947 } 2948 2949 var allBound = 2950 $scope.all_bound != undefined ? $scope.all_bound : {}; 2951 $scope.scheduleCriteriaMapUpdate( 2952 $scope.propertylatlngs, 2953 allBound 2954 ); 2955 2956 $rootScope.history = $location.$$path; 2957 2958 2959 2960 2961 2962 2963 2964 2965 if ($rootScope.polygon_lat_long) { 2966 var specify_by_polygon = $rootScope.polygon_lat_long; 2967 // Move map for page refresh 2968 2969 2970 // if (specify_by_polygon != "" && ($rootScope.hitorybackbtn == 1 || $scope.moveMap) && !specify_by_polygon.includes("undefined")) { 2971 if ( 2972 specify_by_polygon && 2973 specify_by_polygon !== "" && 2974 !specify_by_polygon.includes("undefined") 2975 ) { 2976 if ($scope.moveMap && data.all_property.length > 0) { 2977 2978 let firstLat = data.all_property[0].lat; 2979 let firstLong = data.all_property[0].lng; 2980 var latlng = new google.maps.LatLng(firstLat, firstLong); 2981 whenCriteriaMapReady(function () { 2982 criteriaMap2.setCenter(latlng); 2983 if (typeof refreshCriteriaMap === "function") { 2984 refreshCriteriaMap(); 2985 } 2986 }); 2987 $scope.moveMap = false;
2988 } 2989 draw_polygon_change = true; 2990 var specify_by_polygon_arr = JSON.parse(specify_by_polygon); 2991 var polygonset = new google.maps.Polygon({ 2992 paths: specify_by_polygon_arr, 2993 strokeWeight: 2, 2994 fillColor: "#1aff1a", 2995 fillOpacity: 0.5, 2996 draggable: true, 2997 editable: true, 2998 geodesic: true, 2999 }); 3000 whenCriteriaMapReady(function () { 3001 polygonset.setMap(criteriaMap2); 3002 // Register it so the next rebuild replaces this 3003 // overlay instead of stacking on top of it. 3004 trackFilterPolygon(polygonset); 3005 if (typeof drawingManager !== "undefined" && drawingManager) { 3006 drawingManager.setDrawingMode(null); 3007 } 3008 attachPolygonListeners(polygonset); 3009 if (typeof refreshCriteriaMap === "function") { 3010 refreshCriteriaMap(); 3011 } 3012 }); 3013 3014 setTimeout(function () { 3015 $(document) 3016 .find(".result-blocks .col-sm-6:nth-child(2) a") 3017 .trigger("mouseover"); 3018 }, 2000); 3019 } 3020 3021 $rootScope.hitorybackbtn = 0; 3022 3023 if ($rootScope.polygon_lat_long && draw_polygon_change) { 3024 draw_polygon_change = false; 3025 // Generate All ZIP code Array From result set // 3026 $scope.zipcode_array = $scope.all_property_list.map( 3027 (a) => a.zip_code 3028 ); 3029 $scope.uniquezipcode_array = $scope.zipcode_array.filter( 3030 function (item, pos) { 3031 return $scope.zipcode_array.indexOf(item) == pos; 3032 } 3033 ); 3034 3035 // Generate All County Name Array From result set // 3036 $scope.county_array = $scope.all_property_list.map( 3037 (a) => a.county 3038 ); 3039 $scope.uniquecounty_array = $scope.county_array.filter(function ( 3040 item, 3041 pos 3042 ) { 3043 return $scope.county_array.indexOf(item) == pos; 3044 }); 3045 3046 // Generate All Development Name Array From result set // 3047 $scope.development_Name = $scope.all_property_list.map( 3048 (a) => a.development_name 3049 ); 3050 $scope.development_Name_array = $scope.development_Name.filter( 3051 function (item, pos) { 3052 return $scope.development_Name.indexOf(item) == pos; 3053 } 3054 ); 3055 3056 // Generate All Complex Name Array From result set // 3057 $scope.complex_Name = $scope.all_property_list.map( 3058 (a) => a.complex_name 3059 ); 3060 $scope.complex_Name_array = $scope.complex_Name.filter(function ( 3061 item, 3062 pos 3063 ) { 3064 return $scope.complex_Name.indexOf(item) == pos; 3065 }); 3066 3067 // Generate All View Array From result set // 3068 $scope.views_Name = $scope.all_property_list.map((a) => a.view); 3069 $scope.views_Name_array = $scope.views_Name.filter(function ( 3070 item, 3071 pos 3072 ) { 3073 return $scope.views_Name.indexOf(item) == pos; 3074 }); 3075 3076 // Generate Water Access Array From result set // 3077 $scope.water_access = $scope.all_property_list.map( 3078 (a) => a.water_access 3079 ); 3080 $scope.water_access_array = $scope.water_access.filter(function ( 3081 item, 3082 pos 3083 ) { 3084 return $scope.water_access.indexOf(item) == pos; 3085 }); 3086 3087 // Generate All Subdivition Name Array From result set // 3088 $scope.subdivision_Name = $scope.all_property_list.map( 3089 (a) => a.subdivision_name 3090 ); 3091 $scope.subdivision_Name_array = $scope.subdivision_Name.filter( 3092 function (item, pos) { 3093 return $scope.subdivision_Name.indexOf(item) == pos; 3094 } 3095 ); 3096 } 3097 } 3098 3099 3100 3101 3102 3103 3104 3105 }).error(function (data, status) {
3106 // Without this, a failed request strands show_loader = 1 and 3107 // searchLoaderCount > 0 forever — the latter permanently disables the 3108 // Save Search button. Map-driven searches make this much easier to hit. 3109 $scope.show_loader = 0; 3110 $scope.front_spinner = 0; 3111 $scope.searchLoaderCount = 0; 3112 $scope.callingSearchProperty = false; 3113 $rootScope.advanceSearchWatcherEnabled = true; 3114 console.error("searchProperty failed", status, data); 3115 }); 3116 }; 3117 3118 // Call $scope.searchProperty on first page load 3119 // if ($rootScope.firstSearchLoading) { 3120 // $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3121 // } 3122 3123 // Project Details Page Function // 3124 3125 // Project Details Page Function // 3126 $scope.propertyDetails = function () { 3127 $scope.front_spinner = 1; 3128 $scope.property_ml_id = $routeParams.property_ml_id; 3129 var fb_app_id = $rootScope.fb_app_id; 3130 // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON START// 3131 if (fb_app_id != "") { 3132 $scope.fb_button_visible = 1; 3133 } 3134 // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON END// 3135 3136 var token = localStorage.getItem("access_token"); // If login 3137 3138 if ($localStorage.city_page_search_params) { 3139 var search_params = JSON.parse($localStorage.city_page_search_params); 3140 } else { 3141 var search_params = ""; 3142 } 3143 3144 var httpRequest = $http({ 3145 method: "POST", 3146 url: base_url + "/firsthometheme/property-details-new", 3147 data: { 3148 property_ml_id: $scope.property_ml_id, 3149 member_id: $scope.userid, 3150 search_params: search_params, 3151 }, 3152 headers: { 3153 "Content-Type": "application/json; charset=utf-8", 3154 "Access-Token": token, 3155 }, 3156 }).success(function (data, status) { 3157 $scope.front_spinner = 0; 3158 3159 if (data.property_det.length === 0) { 3160 //if property is in database 3161 $scope.has_property = 0; 3162 } else { 3163 if ($localStorage.mls_id) { 3164 var storeMlsIds = JSON.parse($localStorage.mls_id); 3165 var indexofMlsId = storeMlsIds.indexOf($scope.property_ml_id); 3166 if (indexofMlsId > -1) { 3167 $rootScope.all_property_search_list = storeMlsIds; 3168 $rootScope.currentPropertyIndex = indexofMlsId; 3169 } 3170 } 3171 3172 $scope.allRelatedProperty = data.realted_property; 3173 $scope.has_property = 1; 3174 $scope.property_det = data.property_det; 3175 $scope.last_update_corn_time = data.last_update_corn_time; 3176 $scope.latitude = my_lat = parseFloat(data.property_det.lat); 3177 $scope.longitude = my_lng = parseFloat(data.property_det.lng); 3178 $scope.address = address = data.property_det.address; 3179 fb_app_id = data.user_fb_app_id; 3180 3181 let propertyUrl = 3182 base_url + "/property-details/" + $scope.property_det.ml; 3183 $scope.shareMail["msg"] = "Check out this property " + propertyUrl; 3184 $scope.shareMail["subject"] = 3185 $scope.property_det.address + 3186 "-" + 3187 $scope.property_det.city_name + 3188 ", " +
3189 $scope.property_det.state + 3190 ", " + 3191 $scope.property_det.zip_code; 3192 3193 // Set property details page in the local storage // 3194 localStorage.setItem( 3195 "prevroute", 3196 "/property-details/" + $scope.property_det.ml 3197 ); 3198 3199 if (data.logged_user_fav_proerty > 0) { 3200 // For Checking user fav property 3201 $scope.fav_status = 1; 3202 } else { 3203 $scope.fav_status = 0; 3204 } 3205 3206 // For Meta setting We use below section [Share image and Url] // 3207 3208 $scope.property_image_url = ""; // image share url for FB 3209 3210 if (data.property_det.getimage.length > 0) { 3211 // check property images.. In which position get image set for the facebook share 3212 for (var i = 0; i < data.property_det.getimage.length; i++) { 3213 if ( 3214 typeof data.property_det.getimage[i].image_path != "undefined" 3215 ) { 3216 var last = data.property_det.getimage[i].image_path 3217 .split("/") 3218 .pop(); // no_image.png 3219 var no_image_last = last.split("."); // no_image 3220 3221 if (no_image_last[0] != "no_image") { 3222 $scope.property_image = 3223 theme_image_url + 3224 data.property_det.getsisdetails.getmlsdetails.name.toLowerCase() + 3225 "/" + 3226 data.property_det.getimage[i].image_path; 3227 $scope.property_image_url = 3228 base_url + $scope.property_image; 3229 break; 3230 } 3231 } 3232 } 3233 } 3234 3235 $scope.property_url = $location.absUrl(); 3236 3237 setTimeout(function () { 3238 ProjectGallery(); 3239 projectDetailImgVideoSwiperSlider(); 3240 ImageFitCont(); 3241 3242 // FOR FACE BOOK INITILIZATION // 3243 window.fbAsyncInit = function () { 3244 FB.init({ 3245 appId: fb_app_id, 3246 status: true, 3247 cookie: true, 3248 xfbml: true, 3249 }); 3250 }; 3251 (function () { 3252 var e = document.createElement("script"); 3253 e.async = true; 3254 e.src = 3255 document.location.protocol + 3256 "//connect.facebook.net/en_US/all.js"; 3257 document.getElementById("fb-root").appendChild(e); 3258 })(); 3259 // FOR FACE BOOK INITILIZATION // 3260 3261 // Remove map loading call, it'll only be called when we click the "Load Map" button 3262 // Wasim 29-01-2026 3263 // initMap(); // init map call 3264 3265 const homeProjectSliderSwiper = new Swiper( 3266 ".home-project-slider", 3267 { 3268 navigation: { 3269 nextEl: ".home-project-slider .swiper-button-next", 3270 prevEl: ".home-project-slider .swiper-button-prev", 3271 }, 3272 slidesPerView: 1, 3273 spaceBetween: 30, 3274 breakpoints: { 3275 320: { 3276 slidesPerView: 1, 3277 }, 3278 768: { 3279 slidesPerView: 2, 3280 }, 3281 992: { 3282 slidesPerView: 3, 3283 }, 3284 1200: { 3285 slidesPerView: 4, 3286 }, 3287 }, 3288 } 3289 ); 3290 3291 /* $('.home-project-slider').swiper({ 3292 nextButton: '.project-slider .swiper-button-next', 3293 prevButton: '.project-slider .swiper-button-prev', 3294 slidesPerView: 4, 3295 spaceBetween: 30, 3296 breakpoints: { 3297 1024: { 3298 slidesPerView: 2 3299 }, 3300 768: { 3301 slidesPerView: 1 3302 } 3303 } 3304 }); */ 3305 }, 1000); 3306 } 3307 }); 3308 }; 3309 3310 // New Property details API 3311 $scope.fetchPropertyDetailsNew = function () { 3312 $rootScope.property_details_api_called = true; 3313 $scope.front_spinner = 1; 3314 $scope.propertyDetailsFetching = true;
3315 $scope.property_ml_id = $routeParams.property_ml_id; 3316 const ml = $scope.property_ml_id; 3317 var fb_app_id = $rootScope.fb_app_id; 3318 3319 // IF FACEBOOK APP ID NOT PUTED FACEBOOK SHARE NOT VISIBLE BUTTON START// 3320 if (fb_app_id != "") { 3321 $scope.fb_button_visible = 1; 3322 } 3323 3324 var token = localStorage.getItem("access_token"); // If login 3325 if ($localStorage.city_page_search_params) { 3326 var search_params = JSON.parse($localStorage.city_page_search_params); 3327 } else { 3328 var search_params = ""; 3329 } 3330 3331 var $httpRequest = $http({ 3332 method: "POST", 3333 // url: base_url + '/firsthometheme/property-details-updated', 3334 url: base_url + "/shared/property-details", 3335 data: { 3336 property_ml_id: $scope.property_ml_id, 3337 member_id: $scope.userid, 3338 search_params: search_params, 3339 }, 3340 headers: { 3341 "Content-Type": "application/json; charset=utf-8", 3342 "Access-Token": token, 3343 }, 3344 }).success(function (data, status) { 3345 $scope.front_spinner = 0; 3346 if (data.property_det.length === 0) { 3347 $scope.has_property = 0; 3348 } else { 3349 // if ($localStorage.mls_id) { 3350 // var storeMlsIds = JSON.parse($localStorage.mls_id); 3351 // var indexofMlsId = storeMlsIds.indexOf($scope.property_ml_id); 3352 // if (indexofMlsId > -1) { 3353 // $rootScope.all_property_search_list = storeMlsIds; 3354 // $rootScope.currentPropertyIndex = indexofMlsId; 3355 // } 3356 // } 3357 $scope.property_det = data.property_det; 3358 // Reset map loaded flag 3359 $scope.mapLoaded = false; 3360 // Set shareMail subject and message 3361 let propertyUrl = 3362 base_url + "/property-details/" + $scope.property_det.ml; 3363 $scope.shareMail["msg"] = "Check out this property " + propertyUrl; 3364 $scope.shareMail["subject"] = 3365 $scope.property_det.address + 3366 "-" + 3367 $scope.property_det.city_name + 3368 ", " +
3369 $scope.property_det.state + 3370 ", " + 3371 $scope.property_det.zip_code; 3372 3373 $scope.allRelatedProperty = []; 3374 $scope.has_property = 1; 3375 3376 $scope.property_ml_id = $scope.property_det.ml; 3377 3378 $scope.latitude = parseFloat(data.property_det.lat); 3379 $scope.longitude = parseFloat(data.property_det.lng); 3380 3381 $scope.address = data.property_det.address; 3382 fb_app_id = data.user_fb_app_id; 3383 3384 if (data.logged_user_fav_property > 0) { 3385 // For Checking user fav property 3386 $scope.fav_status = 1; 3387 } else { 3388 $scope.fav_status = 0; 3389 } 3390 3391 $scope.property_image_url = ""; // image share url for FB 3392 3393 if (data.property_det.getimage.length > 0) { 3394 // check property images.. In which position get image set for the facebook share 3395 for (var i = 0; i < data.property_det.getimage.length; i++) { 3396 if ( 3397 typeof data.property_det.getimage[i].image_path != "undefined" 3398 ) { 3399 var last = data.property_det.getimage[i].image_path 3400 .split("/") 3401 .pop(); // no_image.png 3402 var no_image_last = last.split("."); // no_image 3403 3404 if (no_image_last[0] != "no_image") { 3405 $scope.property_image_url = data.property_det.getimage[i].image_path; 3406 // $scope.property_image = 3407 // theme_image_url + 3408 // data.property_det.getsisdetails.getmlsdetails.name.toLowerCase() + 3409 // "/" + 3410 // data.property_det.getimage[i].image_path; 3411 // $scope.property_image_url = 3412 // base_url + $scope.property_image; 3413 break; 3414 } 3415 } 3416 } 3417 } 3418 $scope.property_url = $location.absUrl(); 3419 3420 setTimeout(function () { 3421 ProjectGallery(); 3422 projectDetailImgVideoSwiperSlider(); 3423 ImageFitCont(); 3424 3425 // FOR FACE BOOK INITILIZATION // 3426 window.fbAsyncInit = function () { 3427 FB.init({ 3428 appId: fb_app_id, 3429 status: true, 3430 cookie: true, 3431 xfbml: true, 3432 }); 3433 }; 3434 (function () { 3435 var e = document.createElement("script"); 3436 e.async = true; 3437 e.src = 3438 document.location.protocol + 3439 "//connect.facebook.net/en_US/all.js"; 3440 document.getElementById("fb-root").appendChild(e); 3441 })(); 3442 // FOR FACE BOOK INITILIZATION // 3443 3444 // Remove map loading call, it'll only be called when we click the "Load Map" button 3445 // Wasim 29-01-2026 3446 // initMap(); // init map call 3447 3448 const homeProjectSliderSwiper = new Swiper( 3449 ".home-project-slider", 3450 { 3451 navigation: { 3452 nextEl: ".home-project-slider .swiper-button-next", 3453 prevEl: ".home-project-slider .swiper-button-prev", 3454 }, 3455 slidesPerView: 1, 3456 spaceBetween: 30, 3457 breakpoints: { 3458 320: { 3459 slidesPerView: 1, 3460 }, 3461 768: { 3462 slidesPerView: 2, 3463 }, 3464 992: { 3465 slidesPerView: 3, 3466 }, 3467 1200: { 3468 slidesPerView: 4, 3469 }, 3470 }, 3471 } 3472 ); 3473 }, 1000); 3474 3475 setTimeout(() => { 3476 jQuery( 3477 "#propertyProjectDetailModal .modal-body" 3478 ).mCustomScrollbar("scrollTo", ["top", null]); 3479 }, 500); 3480 3481 $scope.propertyDetailsFetching = false;
3482 // fetch related properties 3483 $scope.fetchRelatedProperties(ml); 3484 } 3485 }); 3486 }; 3487 3488 3489 // if ($scope.routeName == 'property_details' && ($rootScope.property_details_api_called == false || typeof $rootScope.property_details_api_called == 'undefined')) { 3490 // // Call Property details 3491 // $scope.property_ml_id = $routeParams.property_ml_id; 3492 // $scope.fetchPropertyDetailsNew(); 3493 // } 3494 // Project Details Page Function // 3495 3496 $scope.getRelatedImageSource = function (imagename, mlsname) { 3497 //var newbaseurl = 'https://dpirealtywebsites.com' 3498 if (imagename == "") 3499 return ( 3500 base_url + "/public/themes/" + current_theme + "/images/no_menu.png" 3501 ); 3502 else 3503 return ( 3504 base_url + 3505 "/dpi_beta/uploads/" + 3506 mlsname.toLowerCase() + 3507 "/" + 3508 imagename 3509 ); 3510 }; 3511 // Project Details Page Function // 3512 3513 /******* SEARCH PROPERTY BUTTON AJAX END *******/ 3514 3515 /******* Search Filter Checkbox Making Start *******/ 3516 3517 $scope.checker = function ( 3518 index, 3519 val // index= filter field name ; val= value[ex: Yes/No] 3520 ) { 3521 if (typeof $scope.advanced_search == 'string') { 3522 $scope.advanced_search = JSON.parse($scope.advanced_search); 3523 if ( 3524 typeof $scope.advanced_search[index] != "undefined" && 3525 $scope.advanced_search[index] == val 3526 ) { 3527 delete $scope.advanced_search[index]; 3528 } else { 3529 $scope.advanced_search[index] = val; // Push advanced search filter in advanced_search array 3530 } 3531 } else { 3532 if ( 3533 typeof $scope.advanced_search[index] != "undefined" && 3534 $scope.advanced_search[index] == val 3535 ) { 3536 delete $scope.advanced_search[index]; 3537 } else { 3538 $scope.advanced_search[index] = val; // Push advanced search filter in advanced_search array 3539 } 3540 } 3541 3542 }; 3543 3544 /******* Search Filter Checkbox Making End *******/ 3545 3546 /******* SEARCH PROPERTY BUTTON AJAX END *******/ 3547 3548 $scope.changePage = function () // Pagination 3549 { 3550 $scope.pageChanged = true; 3551 if ($scope.search_by_polygon) { 3552 // 3553 var cond = 3554 $localStorage.city_page_search_params != undefined && 3555 $localStorage.city_page_search_params != "" 3556 ? JSON.parse($localStorage.city_page_search_params) 3557 : {}; 3558 cond.page = $scope.currentPage; 3559 $localStorage.city_page_search_params = JSON.stringify(cond); 3560 $scope.callingSearchProperty = true; 3561 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3562 } else { 3563 // var cond = JSON.parse($localStorage.city_page_search_params); 3564 var cond = 3565 $localStorage.city_page_search_params != undefined && 3566 $localStorage.city_page_search_params != "" 3567 ? JSON.parse($localStorage.city_page_search_params) 3568 : {}; 3569 cond.page = $scope.currentPage; 3570 $localStorage.city_page_search_params = JSON.stringify(cond); 3571 $scope.callingSearchProperty = true; 3572 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3573 } 3574 }; 3575 3576 // For project details page // 3577 $scope.showNextProperty = function () { 3578 if ($rootScope.currentPropertyIndex < 20 && $localStorage.mls_id) { 3579 $rootScope.currentPropertyIndex = $rootScope.currentPropertyIndex + 1; 3580 var storeMlsIds = JSON.parse($localStorage.mls_id);
3581 $routeParams.property_ml_id = 3582 storeMlsIds[$rootScope.currentPropertyIndex]; 3583 $location.path("/property-details/" + $routeParams.property_ml_id); 3584 } 3585 }; 3586 3587 $scope.showPreviousProperty = function () { 3588 if ($rootScope.currentPropertyIndex >= 0 && $localStorage.mls_id) { 3589 $rootScope.currentPropertyIndex = $rootScope.currentPropertyIndex - 1; 3590 var storeMlsIds = JSON.parse($localStorage.mls_id); 3591 $routeParams.property_ml_id = 3592 storeMlsIds[$rootScope.currentPropertyIndex]; 3593 $location.path("/property-details/" + $routeParams.property_ml_id); 3594 } 3595 }; 3596 // For project details page // 3597 3598 /* DETAILS PAGE BACK BUTTON */ 3599 $scope.backToSearchpage = function () { 3600 $localStorage.backwards = 1; 3601 if ($rootScope.history && $rootScope.polygon_lat_long) { 3602 $rootScope.hitorybackbtn = 1; 3603 } 3604 var prevUrl = $rootScope.history ? $rootScope.history : "/"; 3605 $location.path(prevUrl); 3606 }; 3607 /* DETAILS PAGE BACK BUTTON */ 3608 3609 /******* Search Details Page Start *******/ 3610 3611 $scope.goToProjectDetails = function (prop_id, prop_ml_id) { 3612 $location.path("/property-details/" + prop_ml_id); 3613 }; 3614 3615 //============ SHARE WITH FACEBOOK START ===========// 3616 $scope.share = function (post) { 3617 var fbpopup = window.open( 3618 "https://www.facebook.com/sharer/sharer.php?u=" + 3619 base_url + 3620 "/property-details/" + 3621 $scope.property_det.ml, 3622 "pop", 3623 "width=600, height=400, scrollbars=no" 3624 ); 3625 $("#share").modal("hide"); 3626 }; 3627 //============ SHARE WITH FACEBOOK END ===========// 3628 //============ SHARE WITH LINKEDIN START ===========// 3629 $scope.linkedInShare = function (post) { 3630 window.open( 3631 "https://www.linkedin.com/shareArticle?mini=true&url=" + 3632 base_url + 3633 "/property-details/" + 3634 $scope.property_det.ml, 3635 "pop", 3636 "width=600, height=400, scrollbars=no" 3637 ); 3638 $("#share").modal("hide"); 3639 }; 3640 //============ SHARE WITH LINKEDIN END ===========// 3641 3642 /******* Search Details Page End *******/ 3643 3644 $scope.makeToFav = 3645 function () // From Property Details page make a property favourite list 3646 { 3647 $scope.saveFavourite($scope.property_ml_id, "", "details"); 3648 }; 3649 3650 /****** Request/ And 2 get advice Send Mail To Contact Agent Start ******/ 3651 3652 $scope.submitFormMail = function (param) { 3653 const formData = angular.copy($scope.request); 3654 formData.captcha = { 3655 id: $scope.request.captcha[param].id, 3656 value: $scope.request.captcha[param].value, 3657 }; 3658 var property_url = $location.absUrl(); 3659 3660 var data = { 3661 request: formData, 3662 member_id: $scope.userid, //Agent id Website owner 3663 param: param, 3664 property_url: property_url, 3665 }; 3666 3667 var httpRequest = $http({ 3668 method: "POST", 3669 url: base_url + "/firsthometheme/send-request-mail", 3670 data: data, 3671 }) 3672 .success(function (data, status) { 3673 if (data.success == 1) { 3674 // Reload all captchas 3675 $scope.reloadAllCaptchas(); 3676 3677 if (param == "expert") { 3678 $scope.showSuccMsg = 1; 3679 $scope.change_class = "#FFF"; 3680 } else if (param == "advice") { 3681 $scope.showSuccMsg1 = 1; 3682 $scope.change_class = "#71b100"; 3683 } else { 3684 $scope.showSuccMsg2 = 1; 3685 $scope.change_class = "#71b100"; 3686 } 3687 3688 $scope.show_message = 3689 "Your query has been sent successfully.We will contact you soon."; 3690 3691 $timeout(function () { 3692 $scope.showSuccMsg1 = 0; 3693 $scope.showSuccMsg2 = 0; 3694 $scope.showSuccMsg = 0; 3695 angular.element(".close").trigger("click"); 3696 $scope.$digest(); 3697 }, 3000); 3698 $scope.requestForm.reset(); 3699 $scope.adviceForm.reset(); 3700 $scope.expertForm.reset(); 3701 } else { 3702 if (param == "expert") { 3703 $scope.showSuccMsg = 1; 3704 } else if (param == "advice") { 3705 $scope.showSuccMsg1 = 1; 3706 } else { 3707 $scope.showSuccMsg2 = 1; 3708 } 3709 if(data.message) { 3710 $scope.show_message = data.message; 3711 } else { 3712 $scope.show_message = "Some error occured."; 3713 } 3714 $scope.change_class = "#F00"; 3715 3716 $timeout(function () { 3717 $scope.showSuccMsg1 = 0; 3718 $scope.showSuccMsg2 = 0; 3719 $scope.showSuccMsg = 0; 3720 $scope.$digest(); 3721 }, 3000); 3722 } 3723 }) 3724 .error(function (data, status, header, config) { 3725 if (param == "expert") { 3726 $scope.showSuccMsg = 1; 3727 } else if (param == "advice") { 3728 $scope.showSuccMsg1 = 1; 3729 } else { 3730 $scope.showSuccMsg2 = 1; 3731 } 3732 $scope.show_message = "Some error occured."; 3733 $scope.change_class = "#F00"; 3734 $timeout(function () { 3735 $scope.showSuccMsg1 = 0; 3736 $scope.showSuccMsg2 = 0; 3737 $scope.showSuccMsg = 0; 3738 $scope.$digest(); 3739 }, 3000); 3740 }); 3741 }; 3742 3743 /****** Request Send Mail To Contact Agent End******/ 3744 3745 /**** Remove Search Filter ****/ 3746 $scope.removeSearchFilter = function (index) { 3747 // 3748 // 3749 // 3750 // 3751 // 3752 // 3753 3754 if (typeof $scope.advanced_search === 'string' && $scope.advanced_search) { 3755 $scope.advanced_search = JSON.parse($scope.advanced_search); 3756 } 3757 // 3758 // 3759 if (typeof $scope.advanced_search[index] != "undefined") { 3760 3761 3762 if (index == "bedrooms") { 3763 3764 $scope.bedrating = 0; 3765 3766 $scope.getSelectedBed($scope.bedrating); 3767 $scope.bedrooms[0].current = 0; 3768 } else if (index == "bathrooms") { 3769 $scope.bathrating = 0; 3770 $scope.getSelectedBath($scope.bathrating); 3771 $scope.bathrooms[0].current = 0; 3772 } 3773 $scope.agent_zip_search = ""; 3774 delete $scope.advanced_search[index]; 3775 3776 3777 // $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3778 // 3779 } 3780 // 3781 }; 3782 3783 // CHANGE PROPERTY TYPE // 3784 3785 $scope.changePropertyType = function () { 3786 $(".m200").toggleClass("open"); 3787 3788 3789 // var cond = JSON.parse($localStorage.city_page_search_params); 3790 var cond = 3791 $localStorage.city_page_search_params != undefined && 3792 $localStorage.city_page_search_params != "" 3793 ? JSON.parse($localStorage.city_page_search_params) 3794 : {}; 3795 cond.property_type = $scope.search.property_type; 3796 $localStorage.city_page_search_params = JSON.stringify(cond); 3797 $scope.callingSearchProperty = true; 3798 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3799 }; 3800 $scope.closePropertyDropdown = function () { 3801 $(".m200").toggleClass("open"); 3802 }; 3803 $scope.setPropertyTypeDropdownText = function (propertyType) { 3804 if (propertyType == "all") { 3805 // $scope.setPropertyTypeDropdownText(propertyType); 3806 $scope.propertyTypeDropdownText = "Property Type"; 3807 return; 3808 } 3809 $scope.propertyTypeDropdownText = ""; 3810 const firstPropertyTypeStringLength = $scope.property_types_array[0].length; 3811 if (firstPropertyTypeStringLength > 13) { 3812 $scope.propertyTypeDropdownText = $scope.property_types_array[0].substring(0, 13) + "..."; 3813 } else { 3814 $scope.propertyTypeDropdownText = $scope.property_types_array[0]; 3815 } 3816 if ($scope.property_types_array.length > 1) { 3817 $scope.propertyTypeDropdownText += " +"; 3818 $scope.propertyTypeDropdownText += $scope.property_types_array.length - 1; 3819 } 3820 } 3821 3822 $scope.setPropertyTypeDropdownTextFromAllPropertyTypes = function () { 3823 $scope.propertyTypeDropdownText = ""; 3824 // Check if no property types is selected 3825 3826 3827 3828 if ($scope.property_types_array.length == 0) { 3829 $scope.propertyTypeDropdownText = "Property Type"; 3830 return; 3831 } 3832 const firstPropertyTypeStringLength = $scope.property_types_array[0].length; 3833 if (firstPropertyTypeStringLength > 13) { 3834 $scope.propertyTypeDropdownText = $scope.property_types_array[0].substring(0, 13) + "..."; 3835 } else { 3836 $scope.propertyTypeDropdownText = $scope.property_types_array[0]; 3837 } 3838 if ($scope.property_types_array.length > 1) { 3839 $scope.propertyTypeDropdownText += " +"; 3840 $scope.propertyTypeDropdownText += $scope.property_types_array.length - 1; 3841 } 3842 } 3843
3844 // Support for multiple property types 3845 $scope.togglePropertyTypes = function (propertyType) { 3846 if (propertyType === "all") { 3847 $scope.setPropertyTypeDropdownText(propertyType); 3848 $scope.property_types_array = []; 3849 3850 3851 $('#user_all').prop("checked", true); 3852 var cond = 3853 $localStorage.city_page_search_params != undefined && 3854 $localStorage.city_page_search_params != "" 3855 ? JSON.parse($localStorage.city_page_search_params) 3856 : {}; 3857 cond.property_types = $scope.property_types_array; 3858 cond.property_type = ""; 3859 $localStorage.city_page_search_params = JSON.stringify(cond); 3860 $scope.callingSearchProperty = true; 3861 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3862 3863 3864 return; 3865 } 3866 if ($scope.property_types_array.indexOf(propertyType) === -1) { 3867 $scope.property_types_array.push(propertyType); 3868 } else { 3869 $scope.property_types_array.splice($scope.property_types_array.indexOf(propertyType), 1); 3870 } 3871 $scope.setPropertyTypeDropdownText(propertyType); 3872 // $(".m200").toggleClass("open"); 3873 3874 3875 // var cond = JSON.parse($localStorage.city_page_search_params); 3876 var cond = 3877 $localStorage.city_page_search_params != undefined && 3878 $localStorage.city_page_search_params != "" 3879 ? JSON.parse($localStorage.city_page_search_params) 3880 : {}; 3881 // var cond = 3882 // $localStorage.city_page_search_params != undefined && 3883 // $localStorage.city_page_search_params != "" 3884 // ? JSON.parse($localStorage.city_page_search_params) 3885 // : {}; 3886 cond.property_types = $scope.property_types_array; 3887 $localStorage.city_page_search_params = JSON.stringify(cond); 3888 // $localStorage.city_page_search_params = JSON.stringify(cond); 3889 $scope.callingSearchProperty = true; 3890 // $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3891 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3892 3893 3894 }; 3895 3896 $scope.changeMinPrice = function () { 3897 // var cond = JSON.parse($localStorage.city_page_search_params); 3898 var cond = 3899 $localStorage.city_page_search_params != undefined && 3900 $localStorage.city_page_search_params != "" 3901 ? JSON.parse($localStorage.city_page_search_params) 3902 : {}; 3903 cond.min_price = $scope.search.min_price; 3904 $localStorage.city_page_search_params = JSON.stringify(cond); 3905 $scope.callingSearchProperty = true; 3906 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3907 }; 3908 $scope.changeMaxPrice = function () { 3909 // var cond = JSON.parse($localStorage.city_page_search_params); 3910 var cond = 3911 $localStorage.city_page_search_params != undefined && 3912 $localStorage.city_page_search_params != "" 3913 ? JSON.parse($localStorage.city_page_search_params) 3914 : {}; 3915 cond.max_price = $scope.search.max_price; 3916 $localStorage.city_page_search_params = JSON.stringify(cond); 3917 $scope.callingSearchProperty = true; 3918 $scope.searchProperty($localStorage.city_page_search_params, $scope.all_bound); 3919 3920 if ($scope.search.max_price == null) { 3921 $scope.priceMinLimitTotal = 10; 3922 $scope.priceMaxLimitStart = $scope.minSelectedIndex + 1; 3923 } 3924 }; 3925
3926 ////////////////////////////////// 3927 3928 // For reset your search params // 3929 $scope.resetSearch = function () // Reset Search 3930 { 3931 3932 3933 3934 3935 // $scope.clearPolygonStucture(); 3936 listneradded_zoom = false; 3937 listneradded_drag = false; 3938 3939 $scope.search.put_location = ""; 3940 $localStorage.city_page_search_params = ""; 3941 $scope.currentPage = 1; //after reset search paging start from 1st 3942 $scope.search.property_type = ""; 3943 $scope.property_types_array = []; 3944 $scope.search.min_price = ""; 3945 $scope.search.max_price = ""; 3946 // $scope.search_listing_sort = "listprice_asc"; 3947 $scope.search_listing_sort = $rootScope.city_page_sort; 3948 $scope.search_listing_date_sort = $rootScope.city_page_date_sort; 3949 $scope.image_category = $rootScope.image_category; 3950 $scope.recordLimit = 20; 3951 $scope.currentPage = 1; 3952 $scope.advanced_search = {}; 3953 $scope.advanced_search.zip_code = [$localStorage.agent_zip_search]; 3954 if ($scope.menu_id == 14 && $scope.criteria_id == 99) { 3955 delete $scope.advanced_search.zip_code; 3956 } 3957 $scope.halfbathrooms[0].current = 0; 3958 $scope.bedrating = 0; 3959 $scope.bedrooms[0].current = 0; 3960 $scope.bathrating = 0; 3961 $scope.bathrooms[0].current = 0; 3962 // $scope.agent_zip_search = ''; 3963 $scope.agent_zip_search = $localStorage.agent_zip_search; 3964 if ($scope.menu_id == 14 && $scope.criteria_id == 99) { 3965 delete $scope.advanced_search.agent_zip_search; 3966 } 3967 3968 $scope.all_bound = {}; 3969 3970 if (!$scope.callingSearchProperty) { 3971 $scope.searchProperty(); 3972 } 3973 }; 3974 3975 /*********** ADVANCED SEARCH SECTION SHOW HIDE START ************/ 3976 $scope.animate = false; 3977 $scope.showHide = function () { 3978 $scope.animate = !$scope.animate; 3979 if ($scope.animate == true) { 3980 $scope.show_advanced_text = "Hide Advanced Search"; 3981 } else { 3982 $scope.show_advanced_text = "Show Advanced Search"; 3983 } 3984 }; 3985 3986 /*********** ADVANCED SEARCH SECTION SHOW HIDE START ************/ 3987 3988 /* make active with active class advanced filter */ 3989 /* make active with active class advanced filter */ 3990 $scope.$watch( 3991 "advanced_search", 3992 function (newVal, oldVal) { 3993 3994 if (!$rootScope.advanceSearchWatcherEnabled) { 3995 return; 3996 } 3997 // if ($rootScope.firstSearchLoading) { 3998 // return; 3999 // } 4000 if (oldVal === newVal) { 4001 4002 4003 4004 4005 4006 if ( 4007 // $rootScope.firstSearchLoading && 4008 Object.keys($scope.advanced_search).length != 0 4009 ) { 4010 $scope.callingSearchProperty = true; 4011 $scope.searchProperty(); 4012 } 4013 } else { 4014 4015 4016 4017 if ($rootScope.hitback) { 4018 $rootScope.hitback = 0; 4019 // var cond = JSON.parse($localStorage.city_page_search_params); 4020 var cond = 4021 $localStorage.city_page_search_params != undefined && 4022 $localStorage.city_page_search_params != "" 4023 ? JSON.parse($localStorage.city_page_search_params) 4024 : {}; 4025 var agentid = $scope.userid; // Site owner 4026 4027 $scope.search.property_type = cond.property_type; 4028 $scope.property_types_array = cond.property_types; 4029 $scope.bedrating = cond.bedroom; 4030 $scope.bathrating = cond.bathroom;
4031 $scope.search.min_price = cond.min_price; 4032 $scope.search.max_price = cond.max_price; 4033 $scope.search_listing_sort = cond.search_listing_sort; 4034 $scope.search_listing_date_sort = cond.search_listing_date_sort; 4035 $scope.image_category = cond.image_category; 4036 $scope.recordLimit = cond.limit; 4037 $scope.currentPage = cond.page; 4038 $scope.advanced_search = JSON.parse(cond.advance_search); 4039 $scope.all_bound = JSON.parse(cond.all_bound); 4040 4041 $scope.bedrooms[0].current = cond.bedroom; 4042 $scope.bathrooms[0].current = cond.bathroom; 4043 4044 var cond = { 4045 property_type: $scope.search.property_type, 4046 property_types: $scope.property_types_array, 4047 bedroom: $scope.bedrating, 4048 bathroom: $scope.bathrating, 4049 min_price: $scope.search.min_price, 4050 max_price: $scope.search.max_price, 4051 search_listing_sort: $scope.search_listing_sort, 4052 search_listing_date_sort: $scope.search_listing_date_sort, 4053 image_category: $scope.image_category, 4054 limit: $scope.recordLimit, 4055 page: $scope.currentPage, 4056 advanced_search: JSON.parse(cond.advance_search), 4057 all_bound: typeof $scope.all_bound === 'string' ? $scope.all_bound : JSON.stringify(cond.all_bound), 4058 agentid: agentid, 4059 }; 4060 $localStorage.backwards = 1; // from property details page back to search page 4061 $scope.callingSearchProperty = true; 4062 $scope.searchProperty(cond, $scope.all_bound); 4063 4064 } else { 4065 if ($localStorage.city_page_search_params) { 4066 // var cond = JSON.parse($localStorage.city_page_search_params); 4067 var cond = 4068 $localStorage.city_page_search_params != undefined && 4069 $localStorage.city_page_search_params != "" 4070 ? JSON.parse($localStorage.city_page_search_params) 4071 : {}; 4072 if (newVal.bedrooms) { 4073 cond.bedroom = newVal.bedrooms; 4074 } else { 4075 cond.bedroom = 0; 4076 } 4077 if (newVal.bathrooms) { 4078 cond.bathroom = newVal.bathrooms; 4079 } else { 4080 cond.bathroom = 0; 4081 } 4082 4083 var new_advance_serach = JSON.stringify(newVal); 4084 cond.advance_search = new_advance_serach; 4085 4086 cond = JSON.stringify(cond); 4087 if ($rootScope.ignore_watcher == false) { 4088 $scope.callingSearchProperty = true; 4089 $scope.searchProperty(cond, $scope.all_bound); 4090 } else { 4091 $scope.callingSearchProperty = true; 4092 $scope.searchProperty(cond, $scope.all_bound); 4093 $rootScope.ignore_watcher = false;
4094 } 4095 4096 //Call save search history 4097 var usertoken = localStorage.getItem("access_token"); 4098 if (typeof usertoken != "undefined") { 4099 $scope.saveSearchHistory(); 4100 } 4101 4102 // $localStorage.city_page_search_params = cond; 4103 } else { 4104 var agentid = $scope.userid; // Site owner 4105 4106 var cond = { 4107 property_type: $scope.search.property_type, 4108 property_types: $scope.property_types_array, 4109 bedroom: $scope.bedrating, 4110 bathroom: $scope.bathrating, 4111 min_price: $scope.search.min_price, 4112 max_price: $scope.search.max_price, 4113 search_listing_sort: $scope.search_listing_sort, 4114 search_listing_date_sort: $scope.search_listing_date_sort, 4115 image_category: $scope.image_category, 4116 limit: $scope.recordLimit, 4117 page: $scope.currentPage, 4118 advance_search: JSON.stringify([]), 4119 agentid: agentid, 4120 }; 4121 $scope.callingSearchProperty = true; 4122 $scope.searchProperty(cond, $scope.all_bound); 4123 4124 // $localStorage.city_page_search_params = cond; 4125 } 4126 // Involking search function any changes in search filter 4127 } 4128 4129 $("#searchModal").modal("hide"); // After Search modal close 4130 4131 $scope.advance_search_make_green_active(); 4132 } //else end 4133 }, 4134 true 4135 ); /**********************************************************/ 4136 4137 $scope.sortListingSearchProperty = function () { 4138 // var cond = JSON.parse($localStorage.city_page_search_params); 4139 var cond = 4140 $localStorage.city_page_search_params != undefined && 4141 $localStorage.city_page_search_params != "" 4142 ? JSON.parse($localStorage.city_page_search_params) 4143 : {}; 4144 4145 4146 var cond = { 4147 property_type: $scope.search.property_type, 4148 property_types: $scope.property_types_array, 4149 bedroom: $scope.bedrating, 4150 bathroom: $scope.bathrating, 4151 min_price: $scope.search.min_price, 4152 max_price: $scope.search.max_price, 4153 search_listing_sort: $scope.search_listing_sort, 4154 search_listing_date_sort: $scope.search_listing_date_sort, 4155 image_category: $scope.image_category, 4156 limit: $scope.recordLimit, 4157 page: $scope.currentPage, 4158 advanced_search: 4159 typeof cond.advance_search === "undefined" 4160 ? {} 4161 : typeof cond.advance_search === 'string' ? JSON.parse(cond.advance_search) : cond.advance_search, 4162 // advanced_search: 4163 // typeof cond.advance_search === "undefined" 4164 // ? [] 4165 // : JSON.parse(cond.advance_search), 4166 all_bound: typeof cond.all_bound === 'string' ? cond.all_bound : JSON.stringify(cond.all_bound), 4167 agentid: $scope.userid, 4168 }; 4169 $scope.callingSearchProperty = true; 4170 $scope.searchProperty(cond, $scope.all_bound); 4171 }; 4172 4173 $scope.changeImageCategory = function (imgageCategoryOption = {}) { 4174 // Check if empty object 4175 if (Object.keys(imgageCategoryOption).length == 0) { 4176 $scope.image_category = ""; 4177 } else { 4178 $scope.image_category = imgageCategoryOption.visible_name; 4179 } 4180 // var cond = JSON.parse($localStorage.search_params); 4181 var cond = 4182 $localStorage.search_params != undefined && 4183 $localStorage.search_params != "" 4184 ? $scope.getSearchParamsFromLocalStorage() 4185 : {}; 4186 4187 4188 var cond = { 4189 property_type: $scope.search.property_type, 4190 property_types: $scope.property_types_array, 4191 bedroom: $scope.bedrating, 4192 bathroom: $scope.bathrating, 4193 min_price: $scope.search.min_price, 4194 max_price: $scope.search.max_price, 4195 search_listing_sort: $scope.search_listing_sort, 4196 search_listing_date_sort: $scope.search_listing_date_sort, 4197 image_category: $scope.image_category, 4198 limit: $scope.recordLimit, 4199 page: $scope.currentPage, 4200 advanced_search: 4201 typeof cond.advance_search === "undefined" 4202 ? {} 4203 : typeof cond.advance_search === 'string' ? JSON.parse(cond.advance_search) : cond.advance_search, 4204 // advanced_search: 4205 // typeof cond.advance_search === "undefined" 4206 // ? [] 4207 // : JSON.parse(cond.advance_search), 4208 all_bound: typeof cond.all_bound === 'string' ? cond.all_bound : JSON.stringify(cond.all_bound), 4209 agentid: $scope.userid, 4210 }; 4211 $scope.callingSearchProperty = true; 4212 $scope.searchProperty(cond, $scope.all_bound); 4213 }; 4214 4215 /**********************************************************/ 4216 4217 // Responsive Toggle View // 4218 $scope.toggleFilter = function () { 4219 $(".middle_searchform").toggleClass("open"); 4220 }; 4221 4222 $scope.toggleView = function () { 4223 //$('.middle_searchform').toggleClass('open'); 4224 $(".search_results").toggleClass("mapview"); 4225 if ($(".search_results").hasClass("mapview")) { 4226 $("#toggleView").html("List"); 4227 } else $("#toggleView").html("Map"); 4228 $timeout(function () { 4229 if (typeof refreshCriteriaMap === "function") { 4230 refreshCriteriaMap(); 4231 } 4232 }, 100); 4233 }; 4234 $("#navbar").on("show.bs.collapse", function () { 4235 $("header").addClass("higherzindex"); 4236 }); 4237 $("#navbar").on("hidden.bs.collapse", function () { 4238 $("header").removeClass("higherzindex"); 4239 }); 4240 // Responsive Toggle End // 4241 4242 // SAVE SEARCH
4243 $scope.saveSearch = function (user_id, page) { 4244 // if ($localStorage.city_page_search_params) { 4245 // var parsed_data = $localStorage.city_page_search_params; 4246 // } 4247 4248 4249 4250 if ($scope.searchCondition != "") { 4251 var searchCondition = JSON.parse($scope.searchCondition); 4252 // remove pit and mls id from search condition 4253 delete searchCondition.pit; 4254 delete searchCondition.mls_ids; 4255 var parsed_data = JSON.stringify(searchCondition); 4256 } 4257 const saveSearchEditing = localStorage.getItem("save_search_editing"); 4258 const saveSearchId = localStorage.getItem("save_search_id"); 4259 4260 if (saveSearchEditing == 1) { 4261 var data = { 4262 page: page, 4263 parsed_data: parsed_data, 4264 member_id: $scope.userid, 4265 save_search_id: saveSearchId, 4266 }; 4267 } else { 4268 var data = { 4269 page: page, 4270 parsed_data: parsed_data, 4271 member_id: $scope.userid, 4272 }; 4273 } 4274 4275 // 4276 // return; 4277 4278 4279 var token = localStorage.getItem("access_token"); 4280 var config = { 4281 headers: { 4282 "Content-Type": "application/json; charset=utf-8", 4283 "Access-Token": token, 4284 }, 4285 }; 4286 4287 $http 4288 .post(base_url + "/firstclient/save-search", data, config) 4289 .success(function (data, status, headers, config) { 4290 if (data.success == 1) { 4291 $scope.change_class = "success-save"; 4292 $scope.show_message = "Search saved successfully."; 4293 $scope.showSuccMsg = 1; 4294 setTimeout(function () { 4295 $scope.$apply(function () { 4296 $scope.showSuccMsg = 0; 4297 }); 4298 if (localStorage.getItem("save_search_editing") == 1) { 4299 localStorage.setItem("save_search_editing", 0); 4300 localStorage.setItem("save_search_id", 0); 4301 // close the tab 4302 window.close(); 4303 } 4304 }, 2000); 4305 } else if (data.success == 2) { 4306 localStorage.setItem( 4307 "prevroute", 4308 "/11/" + $routeParams.page_name + $routeParams.menu_id 4309 ); 4310 // Close the modal then redirect to login 4311 $scope.goingToLogin = true; 4312 // 4313 // jQuery('#propertyProjectDetailModal').modal('hide'); 4314 $scope.hidePropertyDetailModal(); 4315 $scope.showClientLoginPopup(); // Show login popup instead of redirecting to user-login 4316 // $location.path("/user-login"); 4317 } else { 4318 $scope.change_class = "error-save"; 4319 $scope.show_message = "Some error occured."; 4320 $scope.showSuccMsg = 1; 4321 setTimeout(function () { 4322 $scope.$apply(function () { 4323 $scope.showSuccMsg = 0; 4324 }); 4325 }, 2000); 4326 } 4327 }); 4328 }; 4329 4330 /******************** SAVE SEARCH BY LOGGED IN USER START *******************/ 4331 4332 /** 4333 * 4334 * Hide the property detail modal start 4335 * 4336 */ 4337 $scope.hidePropertyDetailModal = function () { 4338 jQuery("#propertyProjectDetailModal").modal("hide"); 4339 // If backdrop still remains
4340 jQuery(".modal-backdrop").hide(); 4341 }; 4342 /** 4343 * 4344 * Hide the property detail modal end 4345 * 4346 */ 4347 4348 /******************** FAVOURITE PROPERTY BY LOGGED IN USER START *******************/ 4349 $scope.saveFavourite = function (property_ml_id, i, page) { 4350 var data = { 4351 property_ml_id: property_ml_id, 4352 member_id: $scope.userid, 4353 }; 4354 4355 var token = localStorage.getItem("access_token"); 4356 var config = { 4357 headers: { 4358 "Content-Type": "application/json; charset=utf-8", 4359 "Access-Token": token, 4360 }, 4361 }; 4362 4363 $http 4364 .post(base_url + "/firstclient/favourite-property-new", data, config) 4365 .success(function (data, status, headers, config) { 4366 $scope.makeToFavClicked = false; 4367 4368 if (page == "search") { 4369 // For Search Pages if like from search page 4370 if (data.success == 1) { 4371 if ( 4372 typeof $scope.all_property_list[i].fav_status != 4373 "undefined" && 4374 $scope.all_property_list[i].fav_status == 1 4375 ) 4376 $scope.all_property_list[i].fav_status = 0; 4377 else $scope.all_property_list[i].fav_status = 1; 4378 } else if (data.success == 2) { 4379 if ($scope.routeName === "property_details") { 4380 // After login 4381 localStorage.setItem( 4382 "prevroute", 4383 "/property-details/" + property_ml_id 4384 ); 4385 } else { 4386 localStorage.setItem( 4387 "prevroute", 4388 "/11/" + $routeParams.page_name + "/" + $routeParams.menu_id 4389 ); 4390 } 4391 // Close the modal then redirect to login 4392 $scope.goingToLogin = true; 4393 // 4394 // jQuery('#propertyProjectDetailModal').modal('hide'); 4395 $scope.hidePropertyDetailModal(); 4396 $scope.showClientLoginPopup(); // Show login popup instead of redirecting to user-login 4397 // $location.path("/user-login"); 4398 } 4399 } else if (page == "details") { 4400 // For Search Pages if like from property details page 4401 if (data.success == 1) { 4402 if ( 4403 typeof $scope.fav_status != "undefined" && 4404 $scope.fav_status == 1 4405 ) 4406 $scope.fav_status = 0; 4407 else $scope.fav_status = 1; 4408 } else if (data.success == 2) { 4409 if ($scope.routeName === "property_details") { 4410 // After login 4411 localStorage.setItem( 4412 "prevroute", 4413 "/property-details/" + property_ml_id 4414 ); 4415 } 4416 // Hide property details modal 4417 $scope.goingToLogin = true; 4418 // 4419 // jQuery('#propertyProjectDetailModal').modal('hide'); 4420 $scope.hidePropertyDetailModal(); 4421 $scope.showClientLoginPopup();
4421 // Show login popup instead of redirecting to user-login 4422 // $location.path("/user-login"); 4423 } 4424 } 4425 }); 4426 }; 4427 4428 // Capture the login and registration modal hide 4429 jQuery('#clientLoginModal').on('hidden.bs.modal', function (e) { 4430 let searchUrl = "/propertylist-criteria/" + $scope.location_id + "/" + $scope.menu_id + "/" + $scope.criteria_id; 4431 $scope.goingToLogin = false; 4432 location.skipReload().path(searchUrl).replace(); 4433 }); 4434 jQuery('#clientRegistrationModal').on('hidden.bs.modal', function (e) { 4435 let searchUrl = "/propertylist-criteria/" + $scope.location_id + "/" + $scope.menu_id + "/" + $scope.criteria_id; 4436 $scope.goingToLogin = false; 4437 location.skipReload().path(searchUrl).replace(); 4438 }); 4439 4440 /******************** FAVOURITE PROPERTY BY LOGGED IN USER END *******************/ 4441 4442 /************** SAVE IDX SEARCH BY LOGGED IN USER START ***************/ 4443 4444 /********** QUICK SEARCH STRAT **********/ 4445 4446 $scope.quickSearch = function () { 4447 $scope.quickSearchCalled = true; 4448 var agentid = $scope.userid; // Site owner 4449 $rootScope.fromhomesearch = 1; 4450 4451 var cond = { 4452 property_type: $scope.search.property_type, 4453 property_types: $scope.property_types_array, 4454 bedroom: $scope.bedrating, 4455 bathroom: $scope.bathrating, 4456 min_price: $scope.search.min_price, 4457 max_price: $scope.search.max_price, 4458 search_listing_sort: $scope.search_listing_sort, 4459 search_listing_date_sort: $scope.search_listing_date_sort, 4460 image_category: $scope.image_category, 4461 limit: $scope.recordLimit, 4462 page: $scope.currentPage, 4463 advance_search: typeof $scope.advanced_search === 'string' ? $scope.advanced_search : JSON.stringify($scope.advanced_search), 4464 agentid: agentid, 4465 }; 4466 4467 if (typeof cond != "undefined") { 4468 $localStorage.city_page_search_params = JSON.stringify(cond); // Set search parameters in local storage 4469 } 4470 4471 // $location.path('/11/search/11'); 4472 // Making dynamic /11/search/11 & /11/search-property/11 4473 const pageName = 4474 $routeParams.page_name == undefined 4475 ? "search" 4476 : $routeParams.page_name; 4477 const menuId = 4478 $routeParams.menu_id == undefined ? "11" : $routeParams.menu_id; 4479 var searchUrl = "/11/" + pageName + "/" + menuId; 4480 $location.path(searchUrl); 4481 //$location.path($scope.menu_id+'/'+$routeParams.page_name+'/'+$scope.menu_id); 4482 }; 4483 4484 /********** QUICK SEARCH END **********/ 4485 4486 /* For Dynamic Meta data call Start */ 4487 4488 function initializeCityPageSearch() { 4489 if ( 4490 $scope.criteria_id > 0 && 4491 $scope.menu_id > 0 && 4492 $scope.callingSearchProperty === false 4493 ) { 4494 $scope.callingSearchProperty = true; 4495 $scope.advance_search = {}; 4496 if ( 4497 $scope.currentRoute != "property_details" && 4498 $rootScope.previousRoute !== $scope.currentRoute && 4499 isEmpty 4500 ) { 4501 4502 // Save the access token and usr_info before clearing 4503 const accessToken = localStorage.getItem("access_token"); 4504 const userInfo = localStorage.getItem("usr_info"); 4505 const visited = localStorage.getItem("visited"); 4506 $localStorage.$reset(); 4507 localStorage.clear(); 4508 localStorage.setItem("usr_info", userInfo); 4509 localStorage.setItem("access_token", accessToken); 4510 if(visited) { 4511 localStorage.setItem("visited", visited); 4512 } 4513 } 4514 // $scope.firstSearchLoading = true; 4515 $scope.searchProperty(); 4516 } else { 4517 $scope.advance_search = {}; 4518 if (
4519 $routeParams.page_name != "search-property" && 4520 $rootScope.fromhomesearch != 1 && 4521 $scope.currentRoute != "property_details" && 4522 $rootScope.previousRoute !== $scope.currentRoute && 4523 isEmpty && 4524 typeof $rootScope.previousRoute !== "undefined" 4525 ) { 4526 4527 4528 // Save the access token and usr_info before clearing 4529 const accessToken = localStorage.getItem("access_token"); 4530 const userInfo = localStorage.getItem("usr_info"); 4531 const visited = localStorage.getItem("visited"); 4532 $localStorage.$reset(); 4533 localStorage.clear(); 4534 localStorage.setItem("usr_info", userInfo); 4535 localStorage.setItem("access_token", accessToken); 4536 if(visited) { 4537 localStorage.setItem("visited", visited); 4538 } 4539 } 4540 4541 // $scope.firstSearchLoading = true; 4542 if ($rootScope.doNotCallZipCode !== true) { 4543 $scope.getAgentDetails(); 4544 } 4545 } 4546 } 4547 4548 $scope.allSetMeta = 4549 function (onComplete) // Call all meta tag and social tag set for user/ default 4550 { 4551 var request = $http({ 4552 method: "POST", 4553 url: base_url + "/firsthometheme/all-social-meta", 4554 data: { 4555 menu_id: $scope.menu_id, 4556 userid: $scope.userid, 4557 }, 4558 }); 4559 4560 request.success(function (data, status) { 4561 $scope.allsocialmeta = data.social_meta_des; 4562 4563 if ( 4564 data.listing_sorts && 4565 data.listing_sorts.city_page_sort 4566 ) { 4567 $rootScope.city_page_sort = data.listing_sorts.city_page_sort; 4568 $scope.search_listing_sort = $rootScope.city_page_sort; 4569 } 4570 4571 $scope.search_listing_date_sort = $rootScope.city_page_date_sort; 4572 4573 if ($scope.allsocialmeta.og_url == 1) { 4574 $scope.allsocialmeta.og_url = $location.absUrl(); 4575 } 4576 }); 4577 4578 if (typeof onComplete === "function") { 4579 request.finally(onComplete); 4580 } 4581 4582 return request; 4583 }; 4584 4585 /* For Dynamic Meta data call End */ 4586 //====================================================================// 4587 if ($scope.routeName !== "property_details") { 4588 $scope.allSetMeta(initializeCityPageSearch); // self invoking after meta load 4589 } else { 4590 initializeCityPageSearch(); 4591 } 4592 $scope.getPublicRelatorMedias = function () { 4593 $http({ 4594 method: "POST", 4595 url: "https://api.ibuyervideos.com/api/public-medias", 4596 data: { 4597 user_id: $scope.userid, 4598 mls_id: $scope.property_ml_id, 4599 }, 4600 }).success(function (data, status) { 4601 $scope.realtorMedias = data.medias; 4602 4603 if ($scope.realtorMedias.children.length) { 4604 $scope.realtorSlides = $scope.realtorMedias.children[0].files; 4605 // $scope.slideDescription = $scope.realtorMedias.folder.folder_description; 4606 $scope.activeFolderSlide = 0; 4607 $scope.activeFileSlide = null; 4608 $scope.setDescription(); 4609 } else if ($scope.realtorMedias.files.length) { 4610 $scope.realtorSlides = $scope.realtorMedias.files; 4611 // $scope.slideDescription = $scope.realtorMedias.folder.folder_description; 4612 $scope.activeFileSlide = index; 4613 $scope.activeFolderSlide = null; 4614 $scope.setDescription(); 4615 } 4616 }); 4617 }; 4618 4619 $scope.changeFolderSlide = function (index) { 4620 $scope.realtorSlides = $scope.realtorMedias.children[index].files; 4621 $scope.activeFolderSlide = index; 4622 $scope.activeFileSlide = null;
4623 fileFolder_detail_sliderSwiper.update(); 4624 window.setTimeout(function () { 4625 window.dispatchEvent(new Event("resize")); 4626 fileFolder_detail_sliderSwiper.slideTo(0); 4627 $scope.setDescription(fileFolder_detail_sliderSwiper.realIndex); 4628 }, 1000); 4629 }; 4630 4631 $scope.changeFileSlide = function (index) { 4632 $scope.realtorSlides = $scope.realtorMedias.files; 4633 $scope.activeFileSlide = index; 4634 $scope.activeFolderSlide = null; 4635 fileFolder_detail_sliderSwiper.update(); 4636 window.setTimeout(function () { 4637 window.dispatchEvent(new Event("resize")); 4638 fileFolder_detail_sliderSwiper.slideTo(index); 4639 $scope.setDescription(fileFolder_detail_sliderSwiper.realIndex); 4640 }, 1000); 4641 }; 4642 4643 $scope.setDescription = function (index = null) { 4644 if ($scope.activeFolderSlide != null) { 4645 $scope.slideDescription = index 4646 ? $scope.realtorSlides[index].description 4647 : $scope.realtorMedias.children[0].files[0].description; 4648 } else if ($scope.activeFileSlide != null) { 4649 $scope.slideDescription = index 4650 ? $scope.realtorSlides[index].description 4651 : $scope.realtorMedias.files[0].description; 4652 } 4653 if (projectDetailFileFolderModal.classList.contains("in")) { 4654 $scope.$apply(); 4655 } 4656 }; 4657 4658 if ($scope.routeName === "property_details") { 4659 $scope.getPublicRelatorMedias(); 4660 } 4661 4662 $scope.setMinPrice = function (price) { 4663 let minIndex = $scope.priceRanges.indexOf(price); 4664 // $scope.priceMinLimitStart = Math.min(index + 1, 9); 4665 $scope.priceMaxLimitStart = minIndex + 1; 4666 $scope.search.min_price = $scope.priceRanges[minIndex]; 4667 $scope.minSelectedIndex = minIndex; 4668 $scope.showMinPriceList = false; 4669 $scope.showMaxPriceList = true; 4670 4671 if ($scope.maxSelectedIndex == 0) { 4672 $scope.maxSelectedIndex = $scope.minSelectedIndex; 4673 } 4674 }; 4675 4676 $scope.setMaxPrice = function (price) { 4677 let maxIndex = $scope.priceRanges.indexOf(price); 4678 $scope.maxSelectedIndex = maxIndex; 4679 $scope.search.max_price = $scope.priceRanges[$scope.maxSelectedIndex]; 4680 $scope.priceMaxLimitStart = $scope.maxSelectedIndex + 1; 4681 $scope.priceMinLimitTotal = Math.min($scope.maxSelectedIndex, 10); 4682 $scope.showMinPriceList = true; 4683 $scope.showMaxPriceList = false; 4684 $scope.closePriceList(); 4685 }; 4686 4687 $scope.setMaxPriceEmpty = function () { 4688 $scope.maxSelectedIndex = null; 4689 $scope.search.max_price = ""; 4690 $scope.priceMaxLimitStart = $scope.minSelectedIndex + 1; 4691 $scope.priceMinLimitTotal = 10; 4692 // $scope.closePriceList(); 4693 }; 4694 4695 $scope.adjustMinDropdown = function () { 4696 $scope.showMinPriceList = true; 4697 $scope.showMaxPriceList = false; 4698 }; 4699 4700 $scope.adjustMaxDropdown = function () { 4701 $scope.showMinPriceList = false; 4702 $scope.showMaxPriceList = true; 4703 }; 4704 4705 $scope.closePriceList = function () { 4706 $(".mw165").toggleClass("open"); 4707 $scope.changeMaxPrice(); 4708 }; 4709 4710 // price Range Value change watch function start // 4711 $scope.$watchGroup( 4712 ["search.min_price", "search.max_price"], 4713 function (newValues, oldValues, scope) { 4714 // if ($rootScope.firstSearchLoading) { 4715 // return; 4716 // } 4717 if ( 4718 newValues[0] > 0 && 4719 (newValues[1] == "" || newValues[1] == null) 4720 ) { 4721 $scope.price_view_value = 4722 "$" + $scope.kFormatter(newValues[0]) + "+"; 4723 } else if ( 4724 (newValues[0] == "" || newValues[0] == 0 || newValues[0] == null) && 4725 newValues[1] > 0 4726 ) { 4727 $scope.price_view_value = 4728 "Up To $" + $scope.kFormatter(newValues[1]) + "+"; 4729 } else if ( 4730 newValues[0] != "" && 4731 newValues[1] != "" && 4732 newValues[0] > 0 && 4733 newValues[1] > 0 4734 ) { 4735 $scope.price_view_value = 4736 "$" + 4737 $scope.kFormatter(newValues[0]) + 4738 " - $" + 4739 $scope.kFormatter(newValues[1]); 4740 } else if ( 4741 (newValues[0] == "" || newValues[0] == 0 || newValues[0] == null) && 4742 (newValues[1] == "" || newValues[1] == null) 4743 ) { 4744 $scope.price_view_value = "Enter Price"; 4745 } 4746 } 4747 ); 4748 4749 // price Range Value change watch function end // 4750 4751 $scope.kFormatter = function ( 4752 num //price formatter after 1000 its convert to K $2000 = $2k 4753 ) { 4754 return num > 999 ? parseFloat((num / 1000).toFixed(1)) + "k" : num; 4755 }; 4756 4757 // Save Search History Of loggedin User Start//
4758 $scope.saveSearchHistory = function () { 4759 if ($localStorage.city_page_search_params) { 4760 var parsed_data = $localStorage.city_page_search_params; 4761 } 4762 var data = { 4763 parsed_data: parsed_data, 4764 member_id: $scope.userid, 4765 }; 4766 var token = localStorage.getItem("access_token"); 4767 var config = { 4768 headers: { 4769 "Content-Type": "application/json; charset=utf-8", 4770 "Access-Token": token, 4771 }, 4772 }; 4773 $http 4774 .post(base_url + "/firstclient/save-search-history", data, config) 4775 .success(function (data, status, headers, config) { 4776 if (data.success == 1) { 4777 // 4778 } else { 4779 // 4780 } 4781 }); 4782 }; 4783 // Save Search History Of loggedin User End// 4784
4785 ////////////////////////////////////////////////////////////////////////////// 4786 4787 // if ($scope.routeName == 'search_property' && $scope.callingSearchProperty == false) { 4788 // if (typeof $scope.all_bound != 'undefined' && Object.keys($scope.all_bound).length > 0) { 4789 // $scope.searchProperty({}, $scope.all_bound); 4790 // } else { 4791 // $scope.searchProperty(); 4792 // } 4793 4794 // } 4795 4796 // Add event listener for project-thumb 4797 jQuery(".project-thumb > a").hover(function () { 4798 var mlCode = jQuery(this).attr("id"); 4799 4800 4801 jQuery(".marker_googlemap").removeClass("property_hovered"); 4802 jQuery(".marker_" + mlCode).addClass("property_hovered"); 4803 }); 4804 } 4805 ); // Controller end
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.