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B,aAAc,CAAET,KAAMlB,EAAU,YAAa0B,MAAMlB,GAC5DE,EAAQkB,QAAQpB,EAAIqB,UAAU3B,EAAE4B,aAAapB,GAASqB,YAAa,CAAEC,QAAS,CAAC,GAAI,KAAM,C","sources":["webpack://lionwheel/./app/javascript/src/brain/near_businesses.js"],"sourcesContent":["import {defaultTranslations} from \"../helpers/datatables\";\nimport {initMap} from \"../services/map\";\nimport {updateQueryStringParameter} from \"../helpers/utils\";\n\n$(() => {\n $('#send-near-search').on('click', e => {\n e.preventDefault()\n const lat = $('#latitude').val()\n const lng = $('#longitude').val()\n const radius = $('#radius').val()\n let url = window.location.href\n url = updateQueryStringParameter(url, 'lat', lat)\n url = updateQueryStringParameter(url, 'lng', lng)\n url = updateQueryStringParameter(url, 'radius', radius)\n window.location.replace(url)\n })\n\n $('.near-businesses-table').DataTable({\n dom: 'tp',\n paging: false,\n order: [[0, 'asc']],\n searchHighlight: true,\n responsive: true,\n lengthChange: false,\n language: defaultTranslations()\n })\n\n const mapContainer = document.getElementById('near_businesses_map')\n initMap(mapContainer, mapCallback)\n})\n\nconst buildIcon = color => (\n L.divIcon({\n className: \"box\",\n iconSize: [28, 41],\n iconAnchor: [14, 41],\n html: `\n
\n \n \n \n \n \n
\n `\n })\n)\n\nconst mapCallback = (map) => {\n const markers = []\n\n gon.locations?.forEach(({ location, name, website, address, phone }) => {\n const icon = buildIcon('aaaaaa')\n const popup = `
\n
\n ${address}\n
\n
\n ${name}\n
\n ${phone ?\n `
\n ${phone}\n
`\n : ''}\n ${website ?\n `
\n \n ${website}\n \n
`\n : ''}\n
`\n markers.push(L.marker([location.latitude, location.longitude], { icon: icon })\n .bindPopup(popup).openPopup()\n .addTo(map))\n })\n L.marker(gon.source_point, { icon: buildIcon('e30e0e') }).addTo(map)\n if (markers.length) map.fitBounds(L.featureGroup(markers).getBounds(), { padding: [10, 10] })\n}\n"],"names":["$","on","e","preventDefault","lat","val","lng","radius","url","window","location","href","updateQueryStringParameter","replace","DataTable","dom","paging","order","searchHighlight","responsive","lengthChange","language","defaultTranslations","mapContainer","document","getElementById","initMap","mapCallback","buildIcon","color","L","divIcon","className","iconSize","iconAnchor","html","map","_gon$locations","markers","gon","locations","forEach","name","website","address","phone","icon","popup","push","marker","latitude","longitude","bindPopup","openPopup","addTo","source_point","length","fitBounds","featureGroup","getBounds","padding"],"sourceRoot":""}