...
Pham Family Dentistry
16019 Nacogdoches Rd Ste. 110, 78247 San Antonio, Texas, United States
+1 2106258668
danphamdds@gmail.com
www.phamfamilydentistry.com
Treatments:
LipLase® / M021-5AF/1 S / LightWalker ATS
SmoothEye® / M021-5AF/1 S / LightWalker ATS
Facial Hair Reduction / M021-5AF/1 S / LightWalker ATS
NightLase® - Snoring Treatment (Sleep Dentistry) / M021-5AF/1 S / LightWalker ATS
Conservative Dentistry (General Dentistry) / M021-5AF/1 S / LightWalker ATS
Endodontics / M021-5AF/1 S / LightWalker ATS
Implantology (Implants) / M021-5AF/1 S / LightWalker ATS
Laser-Assisted Ceramic Debonding (Cosmetic Dentistry) / M021-5AF/1 S / LightWalker ATS
Oral Surgery (Cosmetic Dentistry) / M021-5AF/1 S / LightWalker ATS
Peri-implantitis / M021-5AF/1 S / LightWalker ATS
Periodontics / M021-5AF/1 S / LightWalker ATS
Treatment of Wrinkles / M021-5AF/1 S / LightWalker ATS
ComfortLase™ - Pain Relief / M021-5AF/1 S / LightWalker ATS
Aphthae And Herpes Treatment / M021-5AF/1 S / LightWalker ATS
'; }); // bounds TMD.clinicFinder.mapBounds = bounds; // fit bounds if ( TMD.clinicFinder.map && fitBounds) { const d = TMD.clinicFinder.distance / 111; bounds.extend({ lat: TMD.clinicFinder.currentLoc.lat-TMD, lng:TMD.clinicFinder.currentLoc.lng-d }); bounds.extend({ lat: TMD.clinicFinder.currentLoc.lat+d, lng:TMD.clinicFinder.currentLoc.lng+d }); TMD.clinicFinder.map.fitBounds(bounds); } // set zoom // if ( TMD.clinicFinder.map.getZoom() > 17 ) { TMD.clinicFinder.map.setZoom(17); } // HTML //$('#loc-info').html(h); const MAX_CLUSTER_ZOOM = 16; if ( TMD.clinicFinder.global === 1 ) { // no clustering } else { if ( TMD.clinicFinder.markerCluster ) { TMD.clinicFinder.markerCluster.setMap(null); } TMD.clinicFinder.markerCluster = new markerClusterer.MarkerClusterer({ map: TMD.clinicFinder.map, markers: TMD.clinicFinder.mapMarkers, algorithm: new markerClusterer.SuperClusterAlgorithm({ minZoom: 0, // min zoom to generate clusters on maxZoom: MAX_CLUSTER_ZOOM, // max zoom level to cluster the points on minPoints: 2, // 2 minimum points to form a cluster radius: 80, // cluster radius in pixels (40) extent: 512, // tile extent (radius is calculated relative to it) (512) nodeSize: 64, // size of the KD-tree leaf node, affects performance log: false, // whether to log timing info }), renderer: { render: function ({ count:count, position:position }, stats) { const clusterMark = document.createElement("div"); clusterMark.className = "cluster-marker"; clusterMark.textContent = count; // create marker using svg icon // return new google.maps.Marker({ return new google.maps.marker.AdvancedMarkerElement({ position: position, // icon: { url: `data:image/svg+xml;base64,${svg}`, scaledSize: new google.maps.Size(60, 60) }, // adjust zIndex to be above other markers // content: clusterIcon, content: clusterMark, // zIndex: Number(google.maps.Marker.MAX_ZINDEX) + count, // zIndex: Number(google.maps.marker.AdvancedMarkerElement.MAX_ZINDEX) + count, }); } }, onClusterClick: function(event, cluster, map) { map.fitBounds(cluster.bounds); if ( map.getZoom() > (MAX_CLUSTER_ZOOM+1) ) { map.setZoom((MAX_CLUSTER_ZOOM+1)); } } }); } } TMD.clinicFinder.initMap2 = function() { var head = document.getElementsByTagName('head')[0]; // Save the original method var insertBefore = head.insertBefore; // Replace it! head.insertBefore = function (newElement, referenceElement) { if (newElement.href && newElement.href.indexOf('//fonts.googleapis.com/css?family=Roboto') > -1) { // console.info('Desrobotizado.'); return; } insertBefore.call(head, newElement, referenceElement); }; function setMap() { const parser = new DOMParser(); // A marker with a custom inline SVG. TMD.clinicFinder.markerIcon = function(active) { const size = 56 * (active? 2.85 : 2.1); const mapMarker = document.createElement("div"); mapMarker.classList.add('loc-marker'); if (window.TMD.clinicFinder.type === 100 && active) { mapMarker.classList.add('active'); } else { mapMarker.classList.add('widget'); } return mapMarker; /* return parser.parseFromString( '
', "image/svg+xml", ).documentElement; */ /* TMD.clinicFinder.markerIcon = { path: 'M 11.925 23.377 C 11.925 23.377 5.145 15.451 4.894 10.871 C 4.705 7.423 7.99 3.457 11.925 3.457 C 15.859 3.457 19.32 7.669 18.932 11.104 C 18.306 16.645 11.925 23.377 11.925 23.377 Z M 11.935 7.607 C 10.333 7.607 9.033 8.816 9.033 10.309 C 9.033 11.805 10.333 13.014 11.935 13.014 C 13.537 13.014 14.837 11.805 14.837 10.309 C 14.837 8.816 13.537 7.607 11.935 7.607 Z', fillColor: '#ed1c24', fillOpacity: .7, strokeWeight: 2, strokeColor: '#ffffff', strokeOpacity: .7, rotation: 0, scale: 2.1, anchor: new google.maps.Point(12, 24), }; TMD.clinicFinder.markerIcon2 = { path: 'M 11.925 23.377 C 11.925 23.377 5.145 15.451 4.894 10.871 C 4.705 7.423 7.99 3.457 11.925 3.457 C 15.859 3.457 19.32 7.669 18.932 11.104 C 18.306 16.645 11.925 23.377 11.925 23.377 Z M 11.935 7.607 C 10.333 7.607 9.033 8.816 9.033 10.309 C 9.033 11.805 10.333 13.014 11.935 13.014 C 13.537 13.014 14.837 11.805 14.837 10.309 C 14.837 8.816 13.537 7.607 11.935 7.607 Z', fillColor: '#ed1c24', fillOpacity: 1, strokeWeight: 4, strokeColor: '#ffffff', strokeOpacity: .9, rotation: 0, scale: 2.85, anchor: new google.maps.Point(12, 24), }; */ } const mapOptions = { mapId: '8edcc4aa4e2bd3af', // 'FOTONA_FAD_MAP_MAIN' gestureHandling: 'greedy', // gestureHandling: 'cooperative', clickableIcons: false, disableDoubleClickZoom: true, // with mapId, styles controlled in cloud: // https://console.cloud.google.com/google/maps-apis/studio/maps?project=clinicfinder // // https://mapstyle.withgoogle.com/ styles: [ ], mapTypeControl: ( window.TMD.clinicFinder.type === 100 ), mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DEFAULT, // style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, // style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, }, panControl: false, scaleControl: false, fullscreenControl: false, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE, }, rotateControl: true, // visible on high zoom, if available streetViewControl: ( window.TMD.clinicFinder.type === 100 ), streetViewControlOptions: { // position: google.maps.ControlPosition.TOP_LEFT, }, center: TMD.clinicFinder.currentLoc, minZoom: (TMD.clinicFinder.global === 1) ? 1 : 3, zoom: 8, }; // big map TMD.clinicFinder.map = new google.maps.Map( document.getElementById("map"), mapOptions ); // datail map and marker if ( window.TMD.clinicFinder.type === 100 ) { // app only TMD.clinicFinder.mapDetail = new google.maps.Map( document.getElementById("map-detail"), $.extend({}, mapOptions, { mapId: 'f5628d4a9752657c', //'FOTONA_FAD_MAP_DETAIL' // gestureHandling: 'greedy', gestureHandling: 'cooperative', }) ); // TMD.clinicFinder.markerDetail = new google.maps.Marker({ TMD.clinicFinder.markerDetail = new google.maps.marker.AdvancedMarkerElement({ position: TMD.clinicFinder.currentLoc, content: TMD.clinicFinder.markerIcon(true), map: TMD.clinicFinder.mapDetail }); // search on map center var searchHereControl = document.createElement('div'); new createControl( searchHereControl, TMD.clinicFinder.map, '', TMD.clinicFinder.tr.keys['mapicon_search'], function() { document.getElementById("id-location").value = ''; var c = TMD.clinicFinder.map.getCenter(); TMD.clinicFinder.currentLoc = { lat: c.lat(), lng:c.lng() } setLocation(); } ); TMD.clinicFinder.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(searchHereControl); // heading indicator TMD.clinicFinder.headingControl = document.createElement('div'); new createControl( TMD.clinicFinder.headingControl, TMD.clinicFinder.map, '', TMD.clinicFinder.tr.keys['mapicon_orientation'], function() { TMD.clinicFinder.map.setHeading(0); }, '4px' ); TMD.clinicFinder.map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(TMD.clinicFinder.headingControl); TMD.clinicFinder.headingControl.style.display = ' none'; } else { // widget TMD.clinicFinder.headingControl = document.createElement('div'); } var autocomplete = new google.maps.places.Autocomplete( document.getElementById("id-location"), { strictBounds: false, types: ["geocode"], // ["(regions)"], fields: ["geometry", "name", "formatted_address"], // fields: ["formatted_address", "geometry", "name"], // componentRestrictions: { country: "us" } } ); // change map coords & search on location found autocomplete.addListener('place_changed', function(){ var place = autocomplete.getPlace(); if (place && place.geometry) { // console.log('z', place.name, place.geometry.location.lat(), place.geometry.location.lng()); TMD.clinicFinder.ga('clinic_finder', 'search_loc', document.getElementById("id-location").value, 0); TMD.clinicFinder.currentLoc = {lat: place.geometry.location.lat(), lng: place.geometry.location.lng() } setLocation(); } else { // console.log('z', "***"); } }); // heading change TMD.clinicFinder.map.addListener('heading_changed', function() { if (TMD.clinicFinder.map.getHeading() !== 0) { TMD.clinicFinder.headingControl.style.display = 'block'; } else { TMD.clinicFinder.headingControl.style.display = 'none'; } }); // set center on dblclick TMD.clinicFinder.map.addListener('dblclick', function(e) { if ( mapPan(e) ) { var c = TMD.clinicFinder.map.getCenter(); TMD.clinicFinder.currentLoc = { lat: c.lat(), lng:c.lng() }; $('[name="location"]').val(''); setLocation(); } }); // widget - click to close details if ( window.TMD.clinicFinder.type === 1 ) { TMD.clinicFinder.map.addListener('click', function(e) { detailsClose(false); }); } // dragend if (TMD.clinicFinder.global === 1) { // no } else { var dragEndTO = null; TMD.clinicFinder.map.addListener('dragend', function() { clearTimeout(dragEndTO); if ( $('#cf-row-3').hasClass('ty-100') ) { // no dragend search } else { dragEndTO = setTimeout(function() { // var c = TMD.clinicFinder.map.getCenter(); // TMD.clinicFinder.currentLoc = { lat: c.lat(), lng:c.lng() }; setLocation(350); }, 500); } }); } } var setloc = false; // did we receive clinic Id in the URL? var c = getQueryVariable('clinic'); if ( c ) { c = parseInt(c.split('-')[0], 10); if ( !isNaN(c) ) { setloc = true; wireUp(); setMap(); TMD.clinicFinder.ga('clinic_finder', 'url_c', c); getLocationData(c, true); } } // did we get loc in URL? if ( !setloc ) { if ( window.TMD.clinicFinder.type === 100 ) { var p = (getQueryVariable('pos') + '').split('|'); if ( p.length > 3 ) { lat = parseFloat(p[0]); lng = parseFloat(p[1]); d = parseInt(p[2], 10); z = parseInt(p[3], 10); // treatments? if ( p.length > 4 ) { var t = p[4].split('-'); for(var i = 0; i < t.length; i++) { t[i] = parseInt(t[i], 10); if ( isNaN(t[i]) || t[i] === 0 ) { t = []; break; } } if ( t && t.length && t.length > 0 ) { $('#id-treatment').selectpicker('val', t); repaintTreatmentSelect(t); } // location text? if ( p.length > 5 ) { $('[name="location"]').val(p[5].slice(0, 100)); } } if ( lat > -90 && lat < 90 && lng > -200 && lng < 200 && !isNaN(d) && !isNaN(z) ) { TMD.clinicFinder.ga('clinic_finder', 'url_p', 0); $('#id-distance > option[value="' + d + '"]').prop('selected', true); setloc = true; wireUp(); setMap(); TMD.clinicFinder.currentLoc = { lat:lat, lng:lng }; $('#id-distance').val(d).change(); // should trigger update // setLocation(); } } } } // did above fail? if ( !setloc ) { function geolocFallback(reason) { __dbg('geoLoc fallback: ' + reason); // try G loc $.ajax({ url: 'https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyB6U98kQAxkjSZ2k5FIzCDNZdhlq0aquMk', type: 'POST', processData: false, data: JSON.stringify({ homeMobileCountryCode: null, homeMobileNetworkCode: null, radioType: '', carrier: '', considerIp: true, cellTowers: [ // See the Cell Tower Objects section below. ], wifiAccessPoints: [ // See the WiFi Access Point Objects section below. ] }) }).always(function(o, status, rq) { if ( status = 'success' && o && o.location ) { TMD.clinicFinder.currentLoc = { lat: o.location.lat, lng:o.location.lng }; // console.log('Got G loc', TMD.clinicFinder.currentLoc); setloc = true; } else { TMD.clinicFinder.currentLoc = { lat: 46.0654859, lng: 14.527748 }; // console.log('NO G loc, default', TMD.clinicFinder.currentLoc); /* //fake 4 debug TMD.clinicFinder.currentLoc = { lat: 45.799223, lng:15.170846 }; console.log('FAKE LOCATION', TMD.clinicFinder.currentLoc); $('[name="location"]').val('Dev lokacija'); setloc = true; */ } wireUp(); setMap(); if ( setloc ) { setLocation(); } }); } // Try HTML5 geolocation. if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { //DEBUG: console.log('GOT POSITION', TMD.clinicFinder.currentLoc, position.coords.accuracy); TMD.clinicFinder.currentLoc = { lat:position.coords.latitude, lng:position.coords.longitude }; TMD.clinicFinder.locAccuracy = position.coords.accuracy; wireUp(); setMap(true); // $('[name="location"]').val('Zaznana lokacija'); setLocation(); }, function error(err) { console.log('GeoLoc error.', err); geolocFallback('Geoloc ERR: ' + err.message + ' (' + err.code + ')'); }, { maximumAge:10000, timeout:5000, enableHighAccuracy: true } ); } else { // no geoloc console.log('No geoloc functionality'); geolocFallback('no geoloc'); // wireUp(); // setMap(); } } // no clinic id param } // initMap() function enableEnterKey(input) { /* Store original event listener */ const _addEventListener = input.addEventListener const addEventListenerWrapper = (type, listener) => { if (type === 'keydown') { /* Store existing listener function */ const _listener = listener listener = (event) => { /* Simulate a 'down arrow' keypress if no address has been selected */ const suggestionSelected = document.getElementsByClassName('pac-item-selected').length if (event.key === 'Enter' && !suggestionSelected) { const e = new KeyboardEvent('keydown', { key: 'ArrowDown', code: 'ArrowDown', keyCode: 40, }) _listener.apply(input, [e]) } _listener.apply(input, [event]) } } _addEventListener.apply(input, [type, listener]) } input.addEventListener = addEventListenerWrapper } enableEnterKey( document.getElementById("id-location") ); /** location data utils */ function getLocationData(clinic, setCurrLoc) { var url = "/inc/v-1/ajax/cf/public/" TMD.clinicFinder.distance = ( parseInt($("#id-distance").val(), 10) || 50 ) * TMD.clinicFinder.du; TMD.clinicFinder.ga('clinic_finder', 'search_dist', TMD.clinicFinder.distance, parseInt($("#id-distance").val(), 10)); var tid = []; $('#id-treatment option:selected').each(function(i, e) { tid.push(e.value); }) if ( tid.length === 0 ) { tid = [0]; } else { TMD.clinicFinder.ga('clinic_finder', 'search_treat', tid.join(',', 6) + (tid.length > 6? ',...':''), tid.length); } TMD.clinicFinder.tids = tid; var data = {}; var gaLabel = '', gaVal = 0; if ( clinic ) { data = { cmd: "glob-get", clinicid: clinic, lat: Math.floor(TMD.clinicFinder.currentLoc.lat*10000000), lng: Math.floor(TMD.clinicFinder.currentLoc.lng*10000000), lang: 'us' }; gaLabel = 'c:' + clinic } else { if ( TMD.clinicFinder.global === 1 ) { data = { cmd: "glob-get", // d: 50000, // tid: tid.join(', '), lat: Math.floor(TMD.clinicFinder.currentLoc.lat*10000000), lng: Math.floor(TMD.clinicFinder.currentLoc.lng*10000000), lang: 'us' }; } else { data = { cmd: "glob-get", d: TMD.clinicFinder.distance, tid: tid.join(', '), lat: Math.floor(TMD.clinicFinder.currentLoc.lat*10000000), lng: Math.floor(TMD.clinicFinder.currentLoc.lng*10000000), lang: 'us' }; } gaLabel = 'd:' + TMD.clinicFinder.distance + ', ll:' + TMD.clinicFinder.currentLoc.lat.toFixed(5) + ',' + TMD.clinicFinder.currentLoc.lng.toFixed(5); } TMD.clinicFinder.loaderTimeout = setTimeout( () => { clearTimeout(TMD.clinicFinder.loaderTimeout); $('#map_over').addClass('op-1'); }, 300 ); $.ajax({ type: 'POST', url: url, data: data, dataType: 'json', error: function (XMLHttpRequest, textStatus, err){ console.log('get data ERR', clinic, err); if ( clinic ) { TMD.clinic = {}; } else { TMD.clinicFinder.locations = []; renderLocation(); } TMD.clinicFinder.ga('clinic_finder', 'fail_search', gaLabel, gaVal); }, success: function (rez, textStatus){ // console.log('get data OK clinic:' + clinic, rez.data); if ( clinic ) { TMD.clinic = rez; renderLocation(clinic); if ( setCurrLoc === true ) { if ( rez.data && rez.data.locations && rez.data.locations.length && rez.data.locations.length > 0 ) { TMD.clinicFinder.currentLoc = { lat: rez.data.locations[0].lat, lng: rez.data.locations[0].lon }; // console.log('current loc 453', TMD.clinicFinder.currentLoc); setLocation(); gaVal = 1; } } } else { TMD.clinicFinder.locations = []; if (rez && rez.ok && rez.data.locations && rez.data.locations.length) { TMD.clinicFinder.locations = rez.data.locations; gaVal = rez.data.locations.length; } renderLocation(); } TMD.clinicFinder.ga('clinic_finder', 'search_set', gaLabel, gaVal); } }); } // getLocationData() function setDetailPos() { // console.log('det pos'); return false; } function renderContacts(loc, i) { let s; let lnk = '#map-zoom'; if ( window.TMD.clinicFinder.type === 1 ) { if ( i === -1) { $('#clinic-detail-title').html(loc.naziv); lnk = 'javascript:void(setDetailPos())'; s = '
'; // s += '
' + loc.naziv + '
'; } else { s = '
'; s += '
' + loc.naziv + '
'; } if ( i === -1 ) { s += '
' + '' + '
'; } if ( i !== -1 && window.TMD.simpleInfo ) { // simple info for small screen heights s += '
' + '' + loc.naslov_ulica + ', ' + loc.naslov_kraj +'
'; } else { // full info for comfortable heights // s += '
'; if (loc.email) { s += '
' + loc.email + '
'; } else { s += '
'; } if (loc.pozivnast) { s += '
+' + loc.pozivnast + ' ' + loc.telefon + '
'; } else { s += '
'; } if (loc.web) { let link = loc.web; if ( link.slice(0,4).toLowerCase() !== 'http' ) { link = 'http://' + link; } s += '
' + loc.web.replace(/^https?:\/\//i, '').replace(/\/$/, '') + '
'; } else { s += '
'; } if (loc.tretmaji) { s += '
'; /* for (var i = 0; i < loc.tretmaji.length; i++) { s += '
' + loc.tretmaji[i].tretma + '
'; } */ var t = []; for (var i = 0; i < loc.tretmaji.length; i++) { t.push(loc.tretmaji[i].tretma); } t = [...new Set(t)].sort(); for (var i = 0; i < t.length; i++) { s += '
' + t[i] + '
'; } s += '
'; } } if ( i === -1) { // no } else { s += '' + window.TMD.clinicFinder.tr.keys['details_info'] + ''; } s += '
'; } else { if ( i === -1) { $('#clinic-detail-title').html(loc.naziv); lnk = 'javascript:void(setDetailPos())'; s = '
'; // s += '
' + loc.naziv + '
'; } else { s = '
'; s += '
' + loc.naziv + '
'; } if ( i === -1 ) { // s += '
' + loc.naziv + '
'; s += '
' + '' + '
'; } if ( i !== -1 && TMD.clinicFinder.simpleInfo ) { // simple info for small screen heights s += '
' + '' + loc.naslov_ulica + ', ' + loc.naslov_kraj +'
'; } else { // full info for comfortable heights s += '
'; if (loc.email) { s += '
' + '' + loc.email + '
'; } else { s += '
'; } if (loc.pozivnast) { s += '
' +'+' + loc.pozivnast + ' ' + loc.telefon + '
'; } else { s += '
'; } if (loc.web) { let link = loc.web; if ( link.slice(0,4).toLowerCase() !== 'http' ) { link = 'http://' + link; } s += '
' +'' + loc.web.replace(/^https?:\/\//i, '').replace(/\/$/, '') + '
'; } else { s += '
'; } } if ( i === -1) { // no } else { if ( !TMD.clinicFinder.simpleInfo ) { s += '
' + TMD.clinicFinder.tr.keys['map_info'] + '
'; } s += '
' + TMD.clinicFinder.tr.keys['details_info'] + '
'; } s += '
'; } return s; } function renderTreats(loc, i) { let s = '
'; if ( loc.tretmaji && loc.tretmaji.length ) { let trt = []; let rng = []; let dev = []; $.each(loc.tretmaji, function(i, t) { dev[t.pid] = t.commname; // + ' ' + t.model; rng[t.range] = TMD.clinicFinder.rangeD[t.range].rangeD; trt[t.tid] = { tid: t.tid, dev: dev[t.pid], rng: rng[t.range], rid: t.range, // trt: ( t.tretma2 && t.tretma2.length > 1? t.tretma2 : t.tretma ) + (t.tretma2_desc && t.tretma2_desc.length > 1? ' (' + t.tretma2_desc + ')' : ''), trt: t.tretma } }); trt.sort(function(a, b) { const r = a.rng.localeCompare(b.rng); if ( r === 0 ) { const d = a.dev.localeCompare(b.dev); if ( d === 0 ) { return a.trt.localeCompare(b.trt); } else { return d; } } else { return r; } }); // s += '
' + TMD.clinicFinder.tr.keys['treatments'] + '
'; s += '
' + TMD.clinicFinder.tr.keys['treatments'] + '
'; let r = '', li = []; $.each(trt, function(i, t) { if ( t && t.tid ) { if ( t.rng !== r ) { if ( li.length > 0 ) { // s += '
- ' + li.join('
- ') + '
'; s += '
' li = [...new Set(li)].sort(); for (var i = 0; i < li.length; i++) { s += '
' + li[i] + '
' } s += '
' } s += '
' + TMD.clinicFinder.tr.keys['range_' + t.rid] + '
'; r = t.rng; li = []; } li.push(t.trt); } }); if ( li.length > 0 ) { // s += '
- ' + li.join('
- ') + '
'; s += '
' li = [...new Set(li)].sort(); for (var i = 0; i < li.length; i++) { s += '
' + li[i] + '
' } s += '
' } dev.sort(function(a, b) { return a.localeCompare(b); }); s += '
' + TMD.clinicFinder.tr.keys['devices'] + '
'; li = [] $.each(dev, function(i, d) { if (d) { li.push(d); } }); // s += '
- ' + li.join('
- ') + '
'; s += '
' for (var i = 0; i < li.length; i++) { s += '
' + li[i] + '
'; } s += '
' } s += '
'; return s; } function renderLocation(clinic) { clearTimeout(TMD.clinicFinder.loaderTimeout); $('#map_over').removeClass('op-1'); if (clinic) { // render detail if ( TMD.clinic && TMD.clinic.ok && TMD.clinic.data.locations && TMD.clinic.data.locations.length ) { const loc = TMD.clinic.data.locations[0]; $('#clinic-detail').data('cid', parseInt(clinic, 10)); $('#clinic-detail-body1').html( renderContacts(loc, -1) ); $('#clinic-detail-body2').html( renderTreats(loc, -1) ); TMD.clinicFinder.ga('clinic_finder', 'show_detail', loc.naziv + ' / detail', loc.clinicid); // set height if ( TMD.clinicFinder.wh === null ) { console.log('*** WH is null ***'); TMD.clinicFinder.wh = 500; } var dh = TMD.clinicFinder.wh - $('#cfd-row-1').outerHeight() - $('#cfd-row-2').outerHeight(); var db = $('#clinic-detail-body1').outerHeight(); var detH = dh - db - 10; if ( detH < 70 ) { // $('#map-detail').css({ height: detH + 'px', opacity: 0 }); } else { // $('#map-detail').css({ height: detH + 'px', opacity: 1 }); } $('#map-detail').css('height', Math.min(dh, 500) + 'px'); // $('#clinic-detail-body2').css('height', dh + 'px'); const ll = { lat: loc.lat, lng: loc.lon }; TMD.clinicFinder.mapDetail.setCenter(ll); TMD.clinicFinder.mapDetail.setZoom(16); // 17 TMD.clinicFinder.markerDetail.position = ll; // URL history var w = window; if ( parent ) { w = parent; } if ( w.history.pushState ) { var newurl = w.location.protocol + "//" + w.location.host + w.location.pathname + '?clinic=' + loc.clinicid + '-' + unidecodeFix(unidecode(loc.naziv)) + '&lang=' + TMD.clinicFinder.tr.lang; w.history.pushState({ path: newurl }, '', newurl); } $('#clinic-detail').modal('show'); } } else { // render found locatins const MAX = 100; var s = []; if (TMD.clinicFinder.locations.length > 0) { var notifyMax = false; var inRange = false; if ( TMD.clinicFinder.global === 1 ) { inRange = true; s.push( renderContacts(TMD.clinicFinder.locations[0], 0) ); if ( TMD.clinicFinder.globalLoc === null ) { // clone all TMD.clinicFinder.globalLoc = TMD.clinicFinder.locations.map((loc) => loc); } TMD.clinicFinder.locations = TMD.clinicFinder.globalLoc.filter((loc) => { if ( TMD.clinicFinder.globalRange === 0 ) { return true; } else { if ( !loc.tretmaji ) { console.log('No TREATs', loc); } return ( loc.tretmaji && loc.tretmaji.some((t) => t.range === TMD.clinicFinder.globalRange) ); } }); $('[data-global-range="' + TMD.clinicFinder.globalRange + '"]').text( $('[data-global-range="' + TMD.clinicFinder.globalRange + '"]').data('text') + ' ' + TMD.clinicFinder.locations.length );console.log('Total: {%s} - range: {%s} {%s}', TMD.clinicFinder.globalLoc.length, TMD.clinicFinder.globalRange, TMD.clinicFinder.locations.length) } else { inRange = ( TMD.clinicFinder.locations[0].razdalja <= TMD.clinicFinder.distance ); // filter out ut to MAX in distance or top N regardless $.each(TMD.clinicFinder.locations, function(i, l) { if ( (i >= MAX) || (inRange && l.razdalja > TMD.clinicFinder.distance) || (!inRange && i > 3) ) { TMD.clinicFinder.locations.splice(i); if ( i >= MAX ) { notifyMax = true; } return false; } }); $.each(TMD.clinicFinder.locations, function(i, loc) { if (i >= MAX ) { return false } s.push( renderContacts(loc, i) ); }); } if ( notifyMax ) { $('#loc-notification').html(TMD.clinicFinder.tr.keys['loc_found_max']); } else { $('#loc-notification').html((TMD.clinicFinder.tr.keys['loc_found'] + '').replace('{0}', ( TMD.clinicFinder.locations.length ))); } } else { $('#loc-notification').html(TMD.clinicFinder.tr.keys['loc_none_found']); } // set content $("#id-loc-result").html(s.join('')); // -- widget detail close $('#id-loc-result .doctor .icon-x').on('click', function(e) { e.preventDefault(); detailsClose(false); return false; }); // wire if ( window.TMD.clinicFinder.type === 100 ) { // app // - swiper if ( TMD.clinicFinder.swiper ) { TMD.clinicFinder.swiper.destroy(true, true); } TMD.clinicFinder.swiper = new Swiper("#id-swiper", { loop: false, grabCursor: true, //cssMode: true, //autoHeight: true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, slidesPerView: 1, spaceBetween: 16, breakpoints: { 768: { slidesPerView: 2, spaceBetween: 16, }, 1024: { slidesPerView: 3, spaceBetween: 16, }, 1200: { slidesPerView: 4, spaceBetween: 16, }, 1400: { slidesPerView: 5, spaceBetween: 16, }, }, }); if ( TMD.clinicFinder.swiper ) { TMD.clinicFinder.swiper.slideTo(0, 100); } } else { // widget } // GA $('[data-ga]').off('click').on('click', function(e) { // DEBUG: console.log('GA', dbg_cnt++); TMD.clinicFinder.ga('clinic_finder', $(this).data('ga'), $(this).closest('[data-container]').find('[data-clinic-title]').text().trim() + ' / ' + $(this).closest('[data-container]').data('container') , $(this).closest('[data-container]').data('cid') ); }); // - click div to select $("#id-loc-result [data-index]").on('click', function(e) { activateLocation( $(this).data('index'), null, false ); }); // - click address to zoom $('[data-map="zoom"]').on('click', function(e) { e.preventDefault(); activateLocation( $(this).data('index'), true, false ); return false; }); // - see location details $('#id-loc-result [data-clinic]').on('click', function(e) { e.preventDefault(); const cid = this.dataset.clinic; getLocationData(cid); }); // map markers setMarkers(true, !inRange); } // if (clinic) } // renderLocation(){ // dbg counter let dbg_cnt = 0; // repaintTreatmentSelect function repaintTreatmentSelect(v) { const disp = []; v.map(e => disp.push( $('#id-treatment option[value="' + e + '"]').text() )); const sorted = [...disp].sort(); const uniq = [...new Set(sorted)]; $('#id-treatment ~ .dropdown-toggle').prop('title', uniq.join(', ')); if ( ( window.TMD.clinicFinder.type === 100 ) ) { // $('#id-treatment ~ .dropdown-toggle .filter-option-inner-inner').html('' + uniq.length + '' + uniq.join('') + ''); $('#id-treatment ~ .dropdown-toggle .filter-option-inner-inner').html('' + uniq.join('') + ''); } else { var $treatment = $('select.sel-treatment'); var $multiselectContainer = $('.multiselect-container'); $multiselectContainer.html( '
' + uniq.join('
') + '
' ); $('select.sel-treatment ~ .cselectpicker-button .filter-option-inner-inner').text( uniq.join(', ')); $multiselectContainer.on('click', '.icon', function() { var t = $(this).parent().text(); $(this).parent().remove(); $treatment.find('option').each(function(i, e) { if ( e.innerText == t ) { $(e).prop('selected', false); } }); $treatment.selectpicker('refresh'); }); } } // wireUp function wireUp() { // ranges to dictionary if (TMD.clinicFinder.ranges) { const rng = {}; $.each(TMD.clinicFinder.ranges, function(i, r) { rng[r.rid] = { range: r.range, range2: r.range2, rangeD: (r.range2?.length > 1? r.range2 : r.range) } }); TMD.clinicFinder.rangeD = rng; } // init distance // $('#id-distance').val(50); // search again on dist / treatment change var setLocationTO; var setSelectVal = false; $('#id-location').on('focus', function() { this.select(); }); $('#id-distance').on('change', setLocation); if ( window.TMD.clinicFinder.type === 1 ) { // widget $('#id-location').on('focus', function() { this.select(); }); $('.map-finder input[type="submit"]').on('click', function(e) { e.preventDefault(); setLocation(); return false; }); } // app $('#id-treatment').on('changed.bs.select', (ev, clickedIndex, isSelected, prev) => { // un-focus $('#id-treatment ~ .dropdown-menu .form-control').blur(); // pojdi skozi originalni select, najdi vse z istim tekstom, poberi value in ga postavi/pobriši bs-select const v = prev; if ( clickedIndex !== null ) { const s = $('#id-treatment option:eq(' + clickedIndex + ')') if ( s.length > 0 ) { $('#id-treatment option').each((i, e) => { if ( e.innerText === s[0].innerText ) { const index = v.indexOf(e.value); if ( isSelected === true ) { if ( index === -1 ) { v.push(e.value); } } else if ( isSelected === false ) { if (index > -1) { v.splice(index, 1); } } } }); setSelectVal = true; $('#id-treatment').selectpicker('val', v); if ( v.length > 0 ) { repaintTreatmentSelect(v); } else { $('#id-treatment ~ .dropdown-toggle .filter-option-inner-inner').text(TMD.clinicFinder.tr.keys['treatment_select'].split('|')[1]); $('#id-treatment ~ .dropdown-toggle').prop('title', ''); } } } else { // deselectAll? if ( isSelected === null ) { if ( !setSelectVal ) { $('#id-treatment ~ .dropdown-menu input[type="search"]').val(''); $('#id-treatment ~ .dropdown-toggle').prop('title', ''); $('#id-treatment').selectpicker('refresh'); $('#id-treatment ~ .dropdown-toggle .filter-option-inner-inner').text(TMD.clinicFinder.tr.keys['treatment_select'].split('|')[1]); } } setSelectVal = false; } }).on('change', () => { // zakasnjen update clearTimeout(setLocationTO); setLocationTO = setTimeout(setLocation, 650); }); // focus search hack $('#id-treatment ~ .dropdown-menu .form-control').attr({ 'aria-selected': false, 'tabindex': -1 }); var blurState = false; $('.bs-searchbox .form-control').on('focus', function() { if (!blurState) { $(this).blur(); blurState = true; } }); $('.selectpicker').on('hide.bs.select', function() { blurState = false; }); // details modal close $('#clinic-detail').on('hidden.bs.modal', () => { var url = './'; if ( window.TMD.clinicFinder.query ) { url = './?' + window.TMD.clinicFinder.query; } w.history.pushState({ url: url, title: 'Clinic Finder' }, null, url ); }); // swap view $('[data-swap]').on('click', function(e) { e.preventDefault(); if ( $(this).data('swap') === 'map' ) { // swap views? if ( $('#cf-row-4').hasClass('ty-100') ) { var y = $('#cf-row-3').height(); $('#cf-row-3').addClass('ty-100'); $('#cf-row-4').removeClass('ty-100').css('transform', 'translateY(-' + y + 'px)'); $('button[data-swap="map"]').removeClass('btn-secondary'); $('button[data-swap="list"]').addClass('btn-secondary'); } } else { if ( $('#cf-row-3').hasClass('ty-100') ) { $('#cf-row-3').removeClass('ty-100'); $('#cf-row-4').addClass('ty-100').css('transform', ''); $('button[data-swap="list"]').removeClass('btn-secondary'); $('button[data-swap="map"]').addClass('btn-secondary'); } } }); // history change var w = window; if ( parent ) { w = parent; } if ( window.TMD.clinicFinder.type === 100 ) { w.addEventListener("popstate", function(e) { var c = getQueryVariable('clinic'); var p = getQueryVariable('pos'); //DEBUG: console.log('POP STATE', c, p, e.state); detailsClose(false); if ( c ) { getLocationData(c); } }); } } var setHeightTO = null; var setHeightInit = false; var setHeight = function(now) { // only for app if ( window.TMD.clinicFinder.type !== 100 ) { return false; } var action = function() { var h = 100; var wh = window.innerHeight; var ww = window.innerWidth; if ( parent && parent.document ) { var wh = parent.innerHeight; var hh = $('header', parent.document).outerHeight(); // console.log('wh:%s, hh:%s', wh, hh) //$('main', parent.document).css('margin-top', hh + 'px'); // rešeno s CSS (main.css) wh -= hh; if ( ww > 991 ) { // !setHeightInit ) { setHeightInit = true; parent.document.querySelector('#clinic-finder').height = wh; // console.log('>991', wh); } else { parent.document.querySelector('#clinic-finder').height = wh + $('#clinic-detail-body2').outerHeight(); } } TMD.clinicFinder.wh = wh; // console.log('ww×wh: %s×%s', ww, wh); // if ( wh < 634 ) { // if ( wh < 434 ) { // if ( ( wh < 540 && ww < 992 ) || ( wh < 478 ) ) { if ( ( wh < 550 && ww < 992 ) || ( wh < 478 ) ) { // move map offscreen h = wh - $('#cf-row-1').height() - $('#cf-row-2').height() - 10; $('#cf-row-3').removeClass('ty-100'); // $('#id-swiper, #id-loc-result').css('height', h + 'px'); $('#cf-row-4').addClass('ty-100').css('transform', ''); // $('#map').css({ 'height': (h-10) + 'px' }); $('#map-swap').addClass('op-1'); // $('[data-map="zoom"]').show(); $('#div-swiper-box').css('height', (h-70) + 'px'); $('#map').css('height', (h-40) + 'px'); /* if ( wh < 498 ) { $('#div-swiper-box').css('height', (240+(wh-498)) + 'px'); } else { $('#div-swiper-box').css('height', '240px'); } */ // correct container h $('#cf-global-app').css('height', ( $('#cf-row-1').height() + $('#cf-row-2').height() + $('#cf-row-3').height() + 48) + 'px' ); } else { // map onscreen $('#map-swap').removeClass('op-1'); // TMD.clinicFinder.simpleInfo = ( wh < 634 ); if ( TMD.clinicFinder.simpleInfo ) { $('#div-swiper-box').css('height', '100px'); } else { $('#div-swiper-box').css('height', '240px'); } h = wh - $('#cf-row-1').height() - $('#cf-row-2').height() - $('#cf-row-3').height() - 10; // $('#map').css('height', h + 'px') // $('#map').css({ 'height': (h-10) + 'px' }); $('#map').css({ 'height': (h+4) + 'px' }); $('#cf-row-3').removeClass('ty-100'); // $('#id-swiper, #id-loc-result').css('height', ''); $('#cf-row-4').removeClass('ty-100').css('transform', ''); // $('[data-map="zoom"]').hide(); // correct container h $('#cf-global-app').css('height', ( $('#cf-row-1').height() + $('#cf-row-2').height() + $('#cf-row-3').height() + $('#cf-row-4').height() + 80 ) + 'px' ); } $('#cf-row-4').removeClass('op-0'); }; if ( now === 1 ) { action(); } else { clearTimeout(setHeightTO); setHeightTO = setTimeout(action, 500); } }; function initUI() { // restyle parent /* $('main .container h1', parent.document).remove(); $('main .container', parent.document).addClass('container-fluid').removeClass('container'); // .css('background', '#0f0f11'); $('main .container-fluid .row:eq(0)', parent.document).css({ 'margin-left':'-30px', 'margin-right':'-30px' }); $('main', parent.document).css({ 'overflow':'hidden' }); $('main #clinic-finder', parent.document).css({ 'margin-left':'0', 'margin-right':'0' }); */ // translate $('[data-tran]').each(function(i, e) { if (TMD.clinicFinder.tr.keys[e.dataset.tran]) { if ( e.dataset.tranType ) { if ( e.dataset.tranType === 'placeholder' ) { e.placeholder = TMD.clinicFinder.tr.keys[e.dataset.tran]; } else if ( e.dataset.tranType === 'label' ) { e.label = TMD.clinicFinder.tr.keys[e.dataset.tran]; } else if ( e.dataset.tranType === 'value' ) { e.value = TMD.clinicFinder.tr.keys[e.dataset.tran]; } else if ( e.dataset.tranType === 'selectpicker' ) { var t_A = (TMD.clinicFinder.tr.keys[e.dataset.tran] + '|*|*|*|*').split('|'); e.dataset.deselectAllText = t_A[0]; e.dataset.noneSelectedText = t_A[1]; e.dataset.noneResultsText = t_A[2]; } } else { e.innerHTML = TMD.clinicFinder.tr.keys[e.dataset.tran]; } } }); // - distance unit if ( TMD.clinicFinder.tr.keys['distance_unit'] ) { if ( TMD.clinicFinder.tr.keys['distance_unit'] !== 'km' ) { TMD.clinicFinder.du = 1.609344; // km for 1 mile } $('#id-distance > option').each(function(i, e) { e.innerText = parseInt(e.innerText, 10) + ' ' + TMD.clinicFinder.tr.keys['distance_unit']; }); } // langs? if ( TMD.clinicFinder.tr.ln && TMD.clinicFinder.tr.ln.length && TMD.clinicFinder.tr.ln.length > 0 ) { $.each(TMD.clinicFinder.tr.ln, function(i, e) { var e2 = e; if (e2 === 'en') { e2 = 'gb'; } $('#lang-btns ul.dropdown-menu').append('
'); }); $('#lang-btns').addClass('on'); } // treatmens selectpicker $('#id-treatment').html( TMD.clinicFinder.tr.treatsOpts ); // post trans // - app var dstpiker = $('select.dist-selectpicker').selectpicker(); // breaks widget: vdstpiker.data('selectpicker').findLis = function() { console.log('find lis D'); }; var selpiker = $('select.treat-selpicker').selectpicker(); // breaks widget: selpiker.data('selectpicker').findLis = function() { console.log('find lis s'); }; // - widget var $treatment = $('select.sel-treatment'); if ($treatment.length > 0) { selpiker = $treatment.selectpicker({ styleBase: 'btn cselectpicker-button', width: '100%', size: 6 }) } // $('.bs-actionsbox') $('.bs-actionsbox > .btn-group').prepend(''); $('.bs-actionsbox > .btn-group .bs-close').on('click', function(e) { e.preventDefault(); selpiker.selectpicker('toggle'); }); // show fade in $('#cf-global-app').addClass('op-1'); } // titling $('#clinic-detail').on('shown.bs.modal', function() { document.title = $('#clinic-detail-title').text() + ' | Fotona'; }).on('hide.bs.modal', function() { document.title = TMD.clinicFinder.tr.keys['cf_title'] + ' | Fotona'; }); // loaders... $('head').append( $('
').attr('href', '/inc/clinic-finder/global/line-awesome/css/line-awesome.min.css') ); if ( window.TMD.clinicFinder.type === 100 ) { // $('head').append( $('
').attr('href', '/inc/clinic-finder/global/bs-select/css/bootstrap-select.min.css') ); $('head').append( $('
').attr('href', '/inc/clinic-finder/global/swiper/swiper-bundle.min.css') ); // $.getScript('/inc/clinic-finder/global/bs-select/js/bootstrap-select.min.js', function() { // }); $.getScript('/inc/clinic-finder/global/swiper/swiper-bundle.min.js', function() { TMD.clinicFinder.loaded = true; $(window).on('resize orientationchange load', setHeight); setHeight(1); initUI(); }); } else { $.getScript('/inc/clinic-finder/global/bs-select/js/bootstrap-select.min.js', function() { TMD.clinicFinder.loaded = true; initUI(); }); } // local debug if ( document.location.hostname.indexOf('.int.tmd') > 2 ) { $('#cf-main-content').addClass('show'); } if ( document.location.hostname.indexOf('edit.fotona') > -1 ) { var present = parseInt(getQueryVariable('present')); if ( present && present >= 1 && present <= 5) { TMD.clinicFinder.global = 1; $('body').append( `
`); $('[data-global-range]').on('click', (e) => { TMD.clinicFinder.globalRange = $(e.currentTarget).data('globalRange'); window.scrollTo(0, 0); if ( $('#map').data('moved') ) { // moved } else { $('#map').data('moved', true).prependTo('body').css({ position: 'absolute', height: '100svh', 'z-index': 999, top: 0, right: 0, bottom: 0, left: 0, }) } renderLocation(); }); let msize = 32; $('[data-icosize]').on('click', (e) => { if ( $(e.currentTarget).data('icosize') === '+' ) { msize += 4; } else { msize -= 4; } if ( msize < 3 || msize > 68 ) { msize = 32; } $('#map .loc-marker').css({ 'width': msize + 'px', 'height': msize + 'px' }); }); } } }); // TMD.boot.push(fn ())