jQuery(document).ready(function($) { /* Blurbs as Tabs */ $('.tab-title').each(function () { var section_id = $(this).find("a").attr("href"); $(this).find("a").removeAttr("href"); $(this).click(function() { // Check if the current tab is already active if ($(this).hasClass("active-tab")) { // If it's active, hide the content and remove the active class $(this).removeClass("active-tab"); $('.tab-content').hide(); } else { // If it's not active, show the content and set the tab as active $(this).siblings().removeClass("active-tab"); $(this).addClass("active-tab"); $('.tab-content').hide(); $(section_id).show(); } }); }); });
/* -------------------------------------------- ------ Blurbs as Tabs Custom Styling ------ -------------------------------------------- */ /* Style the Blurbs Tabs */ #blurb-tabs .et_pb_column { } #blurb-tabs .tab-title { } /* Hover Styles for Blurb Tabs - Titles */ #blurb-tabs .tab-title { } #blurb-tabs .tab-title:hover { cursor:pointer; } #blurb-tabs .active-tab { } #blurb-tabs .tab-title.active-tab .et_pb_blurb_container h4 a { color:#000; /* Active tab title color */ } #blurb-tabs .tab-title.active-tab .et-pb-icon { } /* Tab Titles Mobile Styles */ @media (max-width: 767px ) { #blurb-tabs .tab-title { } #blurb-tabs .tab-title .et_pb_main_blurb_image { } } @media (max-width: 479px ) { #blurb-tabs .tab-title { } #blurb-tabs .tab-title .et_pb_blurb_content { /* This moves icon to the right */ } #blurb-tabs .tab-title .et_pb_main_blurb_image { /* Fix icon margins on mobile */ } } /* Hide the tabs content/sections */ .tab-content { display:none; } .tab-open { display:block; }

Center Locator

{{#.}} {{/.}} {{#.}}
{{close_to}}
{{address_line_1}}
{{address_line_2}}
{{address_line_3}}
{{city}}, {{state_county}} {{postcode}}
{{#telephones}} +({{country_code}}) {{area_code}} {{number}}
{{/telephones}} {{#emails}} {{address}} {{/emails}}
{{website}}
{{/.}} h1 { font-family: 'Ubuntu', sans-serif; line-height: 1.1; color: #555555; text-align: center; } /* Style for vertical tabs */ #tabs { display: flex; flex-direction: row; width: 100%; flex-wrap: wrap; } #tabs .tab { width: 25%; background-color: #f1f1f1; border-right: 1px solid #ddd; padding: 10px; box-sizing: border-box; } #tabs .tab input { margin-bottom: 15px; padding: 10px; width: 100%; font-size: 16px; box-sizing: border-box; border-radius: 5px; border: 1px solid #ccc; } #tabs .tab button { display: block; background-color: inherit; color: black; padding: 10px; width: 100%; border: none; text-align: left; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease; } #tabs .tab button:hover { background-color: #ddd; } /* Styles for the active/selected state */ #tabs .tab button.active { background-color: #da4d38; color: white; } #tabs-content { width: 75%; padding: 20px; overflow: hidden; } #address_details { display: flex; flex-wrap: wrap; font-family: 'Maven Pro', sans-serif; } .address-box { width: 33.33%; padding: 0 15px; margin-bottom: 2em; text-align: left; line-height: 23px; box-sizing: border-box; } .city-title { color: #3f3f3f; font-size: 16px; font-weight: 700; } .address-info { font-size: 16px; font-family: "Montserrat"; font-style: normal; font-weight: 300; color: rgb(63, 63, 63); } #website-title { color: #5040ae; } #website-title:hover { color: #d5d5d5; } #error-message { color: red; font-size: 18px; text-align: center; margin-top: 20px; } /* Media Queries for Responsive Design */ @media (max-width: 768px) { /* Stack the tabs vertically */ #tabs { flex-direction: column; } #tabs .tab { width: 100%; border-right: none; margin-bottom: 10px; } #tabs-content { width: 100%; } .address-box { width: 100%; padding: 0 15px; margin-bottom: 2em; } } @media (max-width: 480px) { h1 { font-size: 18px; } #tabs .tab button { font-size: 14px; padding: 8px; } #tabs .tab input { font-size: 14px; padding: 8px; } .address-info { font-size: 14px; } #error-message { font-size: 16px; } } var apiUrl = 'https://murli.brahmakumaris.org/iservices/api.do?action=addressList&cid=182'; var data = []; // Fetch centers data async function fetchCenters() { try { const response = await fetch(apiUrl, { method: 'GET', credentials: 'same-origin' }); const result = await response.json(); return result.response.data; } catch (error) { displayErrorMessage('Failed to load data. Please try again later.'); console.error(error); } } // Initialize the state tabs fetchCenters().then(data => { if (!data || data.length === 0) { displayErrorMessage('No data available.'); return; } // Filter out unique states const states = data.filter((value, index, self) => index === self.findIndex((t) => t.state_county === value.state_county) ); // Sort states alphabetically states.sort((a, b) => a.state_county.localeCompare(b.state_county)); // Render state tab buttons let template = $("#stateTabList").html(); let stateTabs = Mustache.render(template, states); $("#stateTab").append(stateTabs); }); // Fetch and display centers for a selected state function getStateCenters(state, button) { // Remove active class from all buttons var buttons = document.querySelectorAll("#stateTab button"); buttons.forEach(btn => btn.classList.remove('active')); // Add active class to the clicked button button.classList.add('active'); fetchCenters().then(data => { // Filter centers by state const centers = data.filter(item => item.state_county === state); if (centers.length === 0) { displayErrorMessage('No centers found for this state.'); return; } // Clear error message $("#error-message").html(''); // Render address details let template = $("#addressDetails").html(); let addressDetails = Mustache.render(template, centers); $("#address_details").html(addressDetails); }); } // Filter states in the search bar function filterStates() { var input, filter, buttons, i; input = document.getElementById("stateSearch"); filter = input.value.toUpperCase(); buttons = document.querySelectorAll("#stateTab button"); for (i = 0; i < buttons.length; i++) { let txtValue = buttons[i].textContent || buttons[i].innerText; if (txtValue.toUpperCase().indexOf(filter) > -1) { buttons[i].style.display = ""; } else { buttons[i].style.display = "none"; } } } // Display error message function displayErrorMessage(message) { $("#address_details").html(''); $("#error-message").html(message); }