|
|
| if (
|
| document.querySelector(
|
| ".search_page, .signup_page, .add_listing, .login_page"
|
| )
|
| ) {
|
|
|
| const tabContent = document.querySelector(".login_content .left_side");
|
|
|
| const screenSizeQuery = window.matchMedia("(min-width: 575px)");
|
|
|
| function handleScreenSizeChange(e) {
|
| if (e.matches) {
|
| var sourceDivHeight = window.getComputedStyle(tabContent).height;
|
|
|
|
|
| document.documentElement.style.setProperty(
|
| "--searchHeight",
|
| `${sourceDivHeight}`
|
| );
|
| } else if (!e.matches) {
|
|
|
| document.documentElement.style.setProperty("--searchHeight", `auto`);
|
| }
|
| }
|
|
|
|
|
| handleScreenSizeChange(screenSizeQuery);
|
|
|
|
|
| screenSizeQuery.addListener(handleScreenSizeChange);
|
| }
|
| if (document.querySelector(".home_page")) {
|
|
|
| $(".owl-carousel").owlCarousel({
|
| // items: 3,
|
| margin: 20,
|
| loop: false,
|
| nav: true,
|
| dots: false,
|
| navText: ["←", "→"],
|
| responsive: {
|
| 0: {
|
| items: 1,
|
| nav: true,
|
| },
|
| 620: {
|
| items: 2,
|
| nav: false,
|
| },
|
| 1023: {
|
| items: 3,
|
| nav: false,
|
| },
|
| },
|
| });
|
|
|
| $(".owl-carousel2").owlCarousel({
|
| // items: 3,
|
| margin: 20,
|
| loop: false,
|
| nav: true,
|
| dots: false,
|
| navText: ["←", "→"],
|
| responsive: {
|
| 0: {
|
| items: 1,
|
| nav: true,
|
| },
|
| 620: {
|
| items: 2,
|
| nav: false,
|
| },
|
| 1023: {
|
| items: 3,
|
| nav: false,
|
| },
|
| },
|
| });
|
| }
|
|
|
|
|
| if (document.querySelector(".listing_page")) {
|
|
|
| document.addEventListener("DOMContentLoaded", function () {
|
| const headingContent = document.querySelector(".heading_content");
|
| const offset = document.querySelector(".compare_bar") ? 330 : 350;
|
|
|
| window.addEventListener("scroll", function () {
|
| if (window.scrollY >= offset) {
|
| headingContent.classList.add("heading_sticky");
|
| headingContent.style.top = document.querySelector(".compare_bar")
|
| ? "50px"
|
| : "0px";
|
| } else {
|
| headingContent.classList.remove("heading_sticky");
|
| }
|
| });
|
| });
|
|
|
|
|
| $(function () {
|
| var owl = $(".owl-carousel");
|
| owl.owlCarousel({
|
| items: 1,
|
| margin: 0,
|
| loop: true,
|
| nav: false,
|
| });
|
| });
|
| }
|
|
|
| $(document).ready(function () {
|
|
|
| var isListingPage = $(".listing_page").length > 0;
|
| var isRoomSelectionPage = $(".room_selection").length > 0;
|
|
|
| if (isListingPage || isRoomSelectionPage) {
|
|
|
| $(".applied_filters_cont").addClass("hidden_cont");
|
|
|
|
|
| const slider = document.getElementById("filter_slider");
|
| const sliderValue1 = document.getElementById("slider_value1");
|
| const sliderValue2 = document.getElementById("slider_value2");
|
|
|
|
|
|
|
| if (isListingPage) {
|
| noUiSlider.create(slider, {
|
| start: [3000, 160000],
|
| connect: true,
|
| step: 100,
|
| range: {
|
| min: 3000,
|
| max: 160000,
|
| },
|
| });
|
|
|
|
|
| $(".filter_price .btn_primary").on("click", function () {
|
| addOrUpdatePriceRangeFilter();
|
| });
|
|
|
|
|
| $(".filter_price .btn_line").on("click", function () {
|
|
|
| slider.noUiSlider.reset();
|
|
|
|
|
| $(".applied_price").remove();
|
|
|
|
|
| if ($(".applied_filters_cont").children().length === 0) {
|
| $(".applied_filters_cont").addClass("hidden_cont");
|
| }
|
| });
|
|
|
|
|
| slider.noUiSlider.on("slide", function (values, handle) {
|
|
|
| sliderValue1.innerText = Math.floor(values[0]);
|
| sliderValue2.innerText = Math.floor(values[1]);
|
| });
|
| }
|
|
|
|
|
| $(".parent_dropdown .form-check-input").on("change", function () {
|
| updateCheckboxFilters($(this).closest(".dropdown_filter"));
|
| });
|
|
|
|
|
| $(".applied_filters_cont").on("click", ".close", function (e) {
|
| e.stopPropagation();
|
| var item = $(this).parent();
|
| var checkboxId = item.data("checkbox-id");
|
|
|
|
|
|
|
| $("#" + checkboxId)
|
| .prop("checked", false)
|
| .trigger("change");
|
| });
|
|
|
| $(".applied_filters_cont").on(
|
| "click",
|
| ".applied_price .close",
|
| function (e) {
|
| slider.noUiSlider.reset();
|
|
|
|
|
| $(".applied_price").remove();
|
|
|
|
|
| if ($(".applied_filters_cont").children().length === 0) {
|
| $(".applied_filters_cont").addClass("hidden_cont");
|
| }
|
| }
|
| );
|
|
|
|
|
| function updateCheckboxFilters(activeFilter) {
|
|
|
| $(".applied_items").not(".applied_price").remove();
|
|
|
|
|
| var hasSelectedItems = false;
|
| if ($(".applied_filters_cont").children().length === 0) {
|
| hasSelectedItems = true;
|
| } else {
|
| hasSelectedItems = true;
|
| }
|
|
|
|
|
| var allCheckboxFilters = $();
|
|
|
|
|
| $(".parent_dropdown .dropdown_filter").each(function () {
|
| var filterName = $(this).find(".dropdown-toggle").text().trim();
|
| var appliedFilterDiv = $(
|
| '<div className="applied_' +
|
| filterName.toLowerCase() +
|
| ' applied_items"></div>'
|
| );
|
|
|
|
|
| var label = $('<p className="label">' + filterName + "</p>");
|
| appliedFilterDiv.append(label);
|
|
|
|
|
| var itemsContainer = $('<div className="items"></div>');
|
|
|
|
|
| $(this)
|
| .find(".form-check-input:checked")
|
| .each(function () {
|
| var checkboxLabel = $(this)
|
| .siblings(".form-check-label")
|
| .text()
|
| .trim();
|
| var checkboxId = $(this).attr("id");
|
| var appliedItem = $(
|
| '<p className="item" data-checkbox-id="' +
|
| checkboxId +
|
| '">' +
|
| checkboxLabel +
|
| ' <span className="close"><svg width="10" height="10" viewBox="0 0 10 10" fill="black" xmlns="http://www.w3.org/2000/svg"> <path d="M5.00047 4.05767L8.30027 0.757812L9.24306 1.70062L5.94327 5.00047L9.24306 8.30027L8.30027 9.24306L5.00047 5.94327L1.70062 9.24306L0.757812 8.30027L4.05767 5.00047L0.757812 1.70062L1.70062 0.757812L5.00047 4.05767Z" /> </svg> </span></p>'
|
| );
|
| itemsContainer.append(appliedItem);
|
| hasSelectedItems = true;
|
| });
|
|
|
|
|
| appliedFilterDiv.append(itemsContainer);
|
|
|
|
|
| if (
|
| itemsContainer.children().length > 0 &&
|
| !$(this).hasClass("filter_price")
|
| ) {
|
| allCheckboxFilters = allCheckboxFilters.add(appliedFilterDiv);
|
| }
|
| });
|
|
|
|
|
| $(".applied_filters_cont").append(
|
| allCheckboxFilters.toArray().sort(function (a, b) {
|
| return $(a).index() - $(b).index();
|
| })
|
| );
|
|
|
|
|
| $(".applied_filters_cont").toggleClass("hidden_cont", !hasSelectedItems);
|
| }
|
|
|
|
|
| function addOrUpdatePriceRangeFilter() {
|
|
|
| var existingFilter = $(".applied_price");
|
| if (existingFilter.length > 0) {
|
|
|
| updatePriceRangeFilter(existingFilter);
|
| } else {
|
|
|
| addPriceRangeFilter();
|
| }
|
| }
|
|
|
|
|
| function updatePriceRangeFilter(existingFilter) {
|
|
|
| var appliedItem = existingFilter.find(".item");
|
| appliedItem
|
| .find(".value")
|
| .text("₹" + sliderValue1.innerText + " - ₹" + sliderValue2.innerText);
|
| }
|
|
|
|
|
| function addPriceRangeFilter() {
|
|
|
| var appliedFilterDiv = $(
|
| '<div className="applied_price applied_items"></div>'
|
| );
|
|
|
|
|
| var label = $('<p className="label">Price Range</p>');
|
| appliedFilterDiv.append(label);
|
|
|
|
|
| var itemsContainer = $('<div className="items"></div>');
|
|
|
|
|
| var appliedItem = $(
|
| '<p className="item"><span className="value">₹' +
|
| sliderValue1.innerText +
|
| " - ₹" +
|
| sliderValue2.innerText +
|
| '</span><span className="close"><svg width="10" height="10" viewBox="0 0 10 10" fill="black" xmlns="http://www.w3.org/2000/svg"> <path d="M5.00047 4.05767L8.30027 0.757812L9.24306 1.70062L5.94327 5.00047L9.24306 8.30027L8.30027 9.24306L5.00047 5.94327L1.70062 9.24306L0.757812 8.30027L4.05767 5.00047L0.757812 1.70062L1.70062 0.757812L5.00047 4.05767Z" /> </svg></span></p>'
|
| );
|
| itemsContainer.append(appliedItem);
|
|
|
|
|
| appliedFilterDiv.append(itemsContainer);
|
|
|
|
|
| $(".applied_filters_cont").prepend(appliedFilterDiv);
|
|
|
|
|
| $(".applied_filters_cont").removeClass("hidden_cont");
|
| }
|
| }
|
| });
|
|
|
|
|
| if (document.querySelector(".property_details_page")) {
|
| $(function () {
|
|
|
| var owl = $(".owl-carousel");
|
| owl.owlCarousel({
|
| margin: 12,
|
| loop: true,
|
| nav: true,
|
| dots: false,
|
| // autoWidth: true,
|
|
|
| responsive: {
|
| 0: {
|
| items: 1,
|
| nav: true,
|
| },
|
| 575: {
|
| items: 2,
|
| nav: false,
|
| },
|
| },
|
| });
|
| });
|
|
|
|
|
| const allTableData = document.querySelectorAll(".price_td");
|
|
|
| allTableData.forEach((data) => {
|
| data.addEventListener("click", function (event) {
|
| allTableData.forEach((data) => {
|
| data.classList.remove("selected");
|
| });
|
|
|
| data.classList.toggle("selected");
|
| });
|
| });
|
|
|
|
|
| const allHeartBtn = document.querySelectorAll(".btn_h");
|
|
|
| allHeartBtn.forEach((btn) => {
|
| btn.addEventListener("click", function (event) {
|
| btn.classList.toggle("filled");
|
| });
|
| });
|
|
|
|
|
| const tabMenu = document.querySelector(
|
| ".amenities.scroll_content .nav-pills"
|
| );
|
| const tabContent = document.querySelector(
|
| ".amenities.scroll_content .tab-content"
|
| );
|
|
|
| const screenSizeQuery = window.matchMedia("(min-width: 576px)");
|
|
|
| function handleScreenSizeChange(e) {
|
| if (e.matches) {
|
| var sourceDivHeight = window.getComputedStyle(tabContent).height;
|
| tabMenu.style.height = sourceDivHeight;
|
| } else if (!e.matches) {
|
|
|
| tabMenu.style.height = "auto";
|
| }
|
| }
|
|
|
|
|
| handleScreenSizeChange(screenSizeQuery);
|
|
|
|
|
| screenSizeQuery.addListener(handleScreenSizeChange);
|
|
|
|
|
| document.addEventListener("DOMContentLoaded", function () {
|
| var main = new Splide("#main-carousel", {
|
| type: "fade",
|
| rewind: true,
|
| pagination: false,
|
| arrows: true,
|
| });
|
|
|
| var thumbnails = new Splide("#thumbnail-carousel", {
|
| fixedWidth: 200,
|
| fixedHeight: 141,
|
| gap: 14,
|
| rewind: true,
|
| pagination: false,
|
| isNavigation: true,
|
| arrows: false,
|
| breakpoints: {
|
| 1900: {
|
| fixedWidth: 180,
|
| fixedHeight: 100,
|
| },
|
| 991: {
|
| fixedWidth: 160,
|
| fixedHeight: 100,
|
| },
|
| 767: {
|
| fixedWidth: 120,
|
| fixedHeight: 80,
|
| },
|
| },
|
| });
|
|
|
| main.sync(thumbnails);
|
| main.mount();
|
| thumbnails.mount();
|
|
|
| var counterCurrent = document.querySelector(".current");
|
| var counterTotal = document.querySelector(".total");
|
|
|
|
|
| main.on("moved", function () {
|
| counterCurrent.textContent = main.index + 1;
|
| });
|
|
|
|
|
| main.on("refresh", function () {
|
| counterTotal.textContent = main.length;
|
| });
|
| });
|
| }
|
|
|
|
|
| if (document.querySelector(".nav_content")) {
|
| const burgerMenu = document.querySelector(".burger_menu");
|
| const navBar = document.querySelector(".nav_content_group");
|
| const body = document.querySelector("body");
|
| const navParent = document.querySelector("nav.navbar");
|
|
|
| burgerMenu.addEventListener("click", () => {
|
| navBar.classList.toggle("nav_menu_active");
|
| burgerMenu.classList.toggle("menu_open");
|
| body.classList.toggle("overflow_hide");
|
| navParent.classList.toggle("overflow_show");
|
| });
|
| }
|
|
|
| if (document.querySelector(".booking_flow")) {
|
| const bookingItems = document.querySelectorAll(".info_room_list .available");
|
|
|
| bookingItems.forEach(function (button) {
|
| button.addEventListener("click", function () {
|
|
|
| bookingItems.forEach(function (btn) {
|
| btn.classList.remove("selected");
|
| });
|
|
|
|
|
| button.classList.add("selected");
|
| });
|
| });
|
|
|
|
|
| const tableRows = document.querySelectorAll("tbody tr");
|
|
|
|
|
| tableRows.forEach((row) => {
|
| row.addEventListener("click", function () {
|
|
|
| const radioInputs = document.querySelectorAll("input[type='radio']");
|
| radioInputs.forEach((input) => (input.checked = false));
|
|
|
|
|
| const radioInput = row.querySelector("input[type='radio']");
|
| radioInput.checked = true;
|
|
|
|
|
| tableRows.forEach((row) => row.classList.remove("selected"));
|
|
|
|
|
| row.classList.add("selected");
|
| });
|
| });
|
|
|
|
|
| const couponBtn = document.querySelectorAll(".apply_coupn_btn");
|
| const couponWrapper = document.querySelector(".coupon_wrapper");
|
| couponBtn.forEach((btn) => {
|
| btn.addEventListener("click", function (e) {
|
| couponWrapper.classList.toggle("show");
|
| });
|
| });
|
| }
|
|
|