Sorry, we couldn't find any results matching your filters
Please try changing your filters and search again.
{"version":3,"sources":["priory.mapBlock.js"],"names":["mapBlock","handleCurrentLocation","el","wrapper","querySelector","currentLocation","location","reset","innerHTML","dataset","value","removeAttribute","addEventListener","navigator","geolocation","getCurrentPosition","position","coords","latitude","longitude","setAttribute","handleSearch","radius","isCurrentLocation","locationValue","radiusValue","locationsListValue","locations","classList","remove","fetch","then","response","json","data","mapWrapper","length","map","GoogleMap","add","initBlock","ControlBinders","register"],"mappings":"AAAA,MAAMA,SAAW,MACf,MAIMC,EAAwBC,IAC5B,MAAMC,EAAUD,EAAGE,cAAc,eAC3BC,EAAkBF,EAAQC,cAAc,2BACxCE,EAAWH,EAAQC,cAAc,oCACjCG,EAAQ,KACZF,EAAgBG,UAAY,uBAC5BH,EAAgBI,QAAQJ,gBAAkB,GAC1CC,EAASI,MAAQ,GACjBJ,EAASK,gBAAgB,aAE3BN,EAAgBO,iBAAiB,QAAS,KACQ,KAA5CP,EAAgBI,QAAQJ,gBAC1BQ,UAAUC,YAAYC,mBAAmBC,IACvCX,EAAgBI,QAAQJ,mBAAqBW,EAASC,OAAOC,YAAYF,EAASC,OAAOE,YACzFb,EAASI,MAAQ,mBACjBJ,EAASc,aAAa,WAAY,IAClCf,EAAgBG,UAAY,SAC3B,IAAMD,KAETA,OAIAc,EAAenB,IACnB,MAAMC,EAAUD,EAAGE,cAAc,eACZD,EAAQC,cAAc,yBAC9BQ,iBAAiB,QAAS,KACrC,MAAMP,EAAkBF,EAAQC,cAAc,2BACxCE,EAAWH,EAAQC,cAAc,oCACjCkB,EAASnB,EAAQC,cAAc,gCAC/BmB,EAAuC,qBAAnBjB,EAASI,MAC7Bc,EAAgBD,EAAoBlB,EAAgBI,QAAQJ,gBAAkBC,EAASI,MACvFe,EAAcH,EAAOZ,MAErBgB,EADgBxB,EAAGE,cAAc,oBACEK,QAAQkB,UAC3B,KAAlBH,GACFlB,EAASsB,UAAUC,OAAO,0BAC1BC,gEAAgEN,YAAwBC,uBAAiCF,mBAAmCG,KAAsBK,KAAKC,GAAYA,EAASC,OAAOF,KAAKG,IACtN,MAAMC,EAAajC,EAAGE,cAAc,mBACpC,GAAI+B,EAAY,CACd,MAAM3B,EAAY0B,EAAKP,UAAUS,OAAS,4GAA4G,wQAEtJ,GADAD,EAAW3B,UAAYA,GAClB0B,EAAKP,UAAUS,OAClB,OAEF,MAAMC,EAAMnC,EAAGE,cAAc,cAI7B,IAAIkC,UAAUD,EAHE,CACdV,UAAWO,SAMjB5B,EAASsB,UAAUW,IAAI,6BAI7B,MAAO,CACLC,UA9DgBtC,IAChBD,EAAsBC,GACtBmB,EAAanB,MAHA,GAkEjBuC,eAAeC,SAAS,aAAcxC,GAAMF,SAASwC,UAAUtC","sourcesContent":["const mapBlock = (() => {\r\n\r\n const initBlock = (el) => {\r\n handleCurrentLocation(el);\r\n handleSearch(el);\r\n };\r\n \r\n const handleCurrentLocation = el => {\r\n const wrapper = el.querySelector('.map-search');\r\n const currentLocation = wrapper.querySelector('[data-current-location]');\r\n const location = wrapper.querySelector('input[name=\"preferred-location\"]');\r\n const reset = () => {\r\n currentLocation.innerHTML = 'Use current location';\r\n currentLocation.dataset.currentLocation = '';\r\n location.value = '';\r\n location.removeAttribute('disabled'); \r\n }\r\n currentLocation.addEventListener('click', () => {\r\n if (currentLocation.dataset.currentLocation === ''){\r\n navigator.geolocation.getCurrentPosition(position => {\r\n currentLocation.dataset.currentLocation = `${position.coords.latitude},${position.coords.longitude}`;\r\n location.value = 'Current Location';\r\n location.setAttribute('disabled','');\r\n currentLocation.innerHTML = 'Clear';\r\n }, () => reset()); \r\n } else {\r\n reset();\r\n }\r\n });\r\n };\r\n \r\n const handleSearch = el => {\r\n const wrapper = el.querySelector('.map-search');\r\n const searchButton = wrapper.querySelector('button[type=\"submit\"]'); \r\n searchButton.addEventListener('click', () => {\r\n const currentLocation = wrapper.querySelector('[data-current-location]');\r\n const location = wrapper.querySelector('input[name=\"preferred-location\"]');\r\n const radius = wrapper.querySelector('select[name=\"search-radius\"]');\r\n const isCurrentLocation = location.value === 'Current Location'\r\n const locationValue = isCurrentLocation\r\n ? currentLocation.dataset.currentLocation \r\n : location.value;\r\n const radiusValue = radius.value;\r\n \r\n const locationsList = el.querySelector('[data-locations]');\r\n const locationsListValue = locationsList.dataset.locations;\r\n \r\n if (locationValue !== ''){\r\n location.classList.remove('input-validation-error');\r\n fetch(`/Umbraco/surface/Locations/GetLocationsSearch?location=${locationValue}&radius=${radiusValue}&isCurrentLocation=${isCurrentLocation}&locationsList=${locationsListValue}`)\r\n .then(response => response.json()\r\n .then(data => {\r\n const mapWrapper = el.querySelector('.map-block__map');\r\n if (mapWrapper){\r\n const innerHTML = data.locations.length \r\n ? `
`\r\n : `Please try changing your filters and search again.