${location.address.city}, ${location.address.region ?? 'TX'} ${location.address.postalCode}`; if (address) { address.innerHTML = addressContent; } if (addressBlock) { addressBlock.ariaLabel = location.address?.full || ''; addressBlock.dataset.location = location.id || ''; } if (locationLink) { if (location.Url) { locationLink.href = location.Url; locationLink.dataset.varsLocationLink = location.Url; locationLink.classList.remove('hidden'); } else { locationLink.classList.add('hidden'); } } if (phoneLink) { if (location.Phone) { phoneLink.innerHTML = location.Phone; phoneLink.href = 'tel:' + location.Phone; phoneLink.parentElement.classList.remove('hidden'); } else { phoneLink.parentElement.classList.add('hidden'); } } if (directions) { directions.href = "https://maps.google.com/maps/place/" + location.address.googleAddress; } if (primaryTimeslots) { primaryTimeslots.setAttribute('location', location.address.apiString); primaryTimeslots.setAttribute('location-id', location.id); primaryTimeslots.setAttribute('phone', location.Phone); primaryTimeslots.outerHTML = primaryTimeslots.outerHTML; } } async function updateNearestBUCTile(selectedLocation) { try { const nearestTile = document.querySelector('nearest-location-timeslots'); const nearestTileWrap = document.querySelector('#widgetNearbyBUC'); const qcTileWrap = document.querySelector('#widgetQuickCare'); if (selectedLocation.hasNearbyBUC) { nearestTile.setAttribute('distance-from', selectedLocation.coordsParamStr); nearestTile.outerHTML = nearestTile.outerHTML; nearestTileWrap.classList.remove('hidden'); qcTileWrap.classList.add('hidden'); } else { nearestTileWrap.classList.add('hidden'); qcTileWrap.classList.remove('hidden'); } } catch (err) { console.warn('Cannot fetch nearby Breeze Urgent Care locations.', err); } } function updateMoreCareTeamLink(widget, provider, location, isExisting) { const moreCareTeamLink = widget.querySelector('#moreCareTeamLink'); if (moreCareTeamLink) { if (location.primProvCategory === 'MD') { moreCareTeamLink.href = `${location.Url}?doctorsOnly=true`; } else if ( location.primProvCategory === 'MDCT' && (isExisting === true || typeof isExisting === undefined) ) { moreCareTeamLink.href = `${location.Url}?doctor=${location.primProvShortName}&providers=${location.careTeamString}`; } else { let selectedLocData = {}; if (window.pageState.locations?.length) { selectedLocData = window.pageState.locations?.filter((loc) => (loc.id == location.id))?.[0]; moreCareTeamLink.href = `${location.Url}?${location.primProvCategory === 'MDCT' && location.primProvShortName ? `doctor=${location.primProvShortName}&` : ''}${selectedLocData.careTeamStringPlusMDs ? `providers=${selectedLocData.careTeamStringPlusMDs}` : ''}`; } else { moreCareTeamLink.href = `${location.Url}`; } } } } const careTiles = Array.from(document.querySelectorAll('provider-timeslots, nearest-location-timeslots')); careTiles.forEach((tile, i) => { tile.setAttribute('data-event-vars', JSON.stringify({ context: 'pdp', position: i + 1 })) });