Selectează Farmacia de la care dorești să cumperi
În prezent nu se pot plasa în aceași comandă produse din farmacii diferite. Dacă doriți produse din farmacii diferite plasați câte o comandă pentru fiecare farmacie.
Loading...
' + '
' + '
' + store.store_name + '
' + '
' + store.store_street + ', ' + store.store_city + '
' + '
' + '
' + '
' + ' ' + '
' + '
' + ' '+store.store_phone+'' + '
' + '
' + '
Program
' + StoresMap.parseStoreTimings(store.store_timings) + '
' + '
' + '
' + ' ' + '
' + ' '; placesUl.append(li); }); }); return this }, createMarkers: function () { let markerConfig = { icon: normalIcon, map: map, } jQuery.each(stores, function (index, nearStores) { jQuery.each(nearStores, function (index, store) { markerConfig.position = {lat: parseFloat(store.lat), lng: parseFloat(store.lng)} markers.push(StoresMap.createMarker(markerConfig)); }); }); return this }, createMap: function () { map = new google.maps.Map(document.getElementById('farmaciiMap'), { zoom: 11, center: currentLocation }); return this }, panToLocation: function (element) { StoresMap.createPanLocation(parseFloat($(element).data('lat')), parseFloat($(element).data('lng'))); }, createPanLocation: function (dataLat, dataLng) { map.panTo(new google.maps.LatLng(dataLat, dataLng)); map.setZoom(16); markers.forEach(function (marker) { marker.setIcon(normalIcon); if (marker.getPosition()?.lat() === dataLat && marker.getPosition()?.lng() === dataLng) { marker.setIcon(selectedIcon); } }); }, createMarker: function (config) { let marker = new google.maps.Marker(config); marker.addListener("click", () => { map.setZoom(16); map.setCenter(marker.getPosition()); markers.forEach(function (marker) { marker.setIcon(normalIcon); }); marker.setIcon(selectedIcon); StoresMap.activateStoreLi(marker.getPosition()); }); return marker; }, activateStoreLi: function (position) { let lat = position.lat(); let storeLiBloc = jQuery('li[data-lat=\'' + lat + '\'] div.farmacie-bloc'); $('#places li div.farmacie-bloc').removeClass('active'); $('.select-store').children('i').remove(); storeLiBloc.addClass('active'); storeLiBloc.find('.select-store').append('') placesUl.get(0).scrollTop = jQuery('li[data-lat=\'' + lat + '\']').get(0).offsetTop - 200; }, activateStoreLiById: function (id) { let storeLi = jQuery('#store' + id); if (storeLi.length === 0) { return; } StoresMap.panToLocation(storeLi); let storeLiBloc = storeLi.children('div.farmacie-bloc'); $('#places li div.farmacie-bloc').removeClass('active'); $('.select-store').children('i').remove(); storeLiBloc.addClass('active'); storeLiBloc.find('.select-store').append('') placesUl.get(0).scrollTop = storeLi.get(0).offsetTop - 200; }, parseStoreTimings: function (storeTiming) { if (!storeTiming) { return 'Program indisponibil'; } let $storeTimings = JSON.parse(storeTiming) ?? {}; return '
Luni:
' + StoresMap.getTimings($storeTimings.MON ?? []) + '
' + '
Marti:
' + StoresMap.getTimings($storeTimings.TUE ?? []) + '
' + '
Miercuri:
' + StoresMap.getTimings($storeTimings.WED ?? []) + '
' + '
Joi:
' + StoresMap.getTimings($storeTimings.THU ?? []) + '
' + '
Vineri:
' + StoresMap.getTimings($storeTimings.FRI ?? []) + '
' + '
Sambata:
' + StoresMap.getTimings($storeTimings.SAT ?? []) + '
' + '
Duminica:
' + StoresMap.getTimings($storeTimings.SUN ?? []) + '
'; }, getTimings: function (storeTimings) { if (storeTimings.length === 0) { return 'Indisponibil' } let str = []; jQuery.each(storeTimings, function (key, timing) { let x = timing.openTime + ' - ' + timing.closeTime; str.push(x); }) return str.join(';'); }, searchCity: function (subsys) { $('#cauta_localitate').on('keyup', function (e) { if(e.which === 13){ StoresMap .getStores($(this).val(), subsys) .createStoreList(nearDistance); } if($(this).val().length > 2) { StoresMap .getStores($(this).val(), subsys) .createStoreList(nearDistance); } if($(this).val().length === 0) { StoresMap .getStores($(this).val(), subsys) .createStoreList(nearDistance); } }); jQuery('#cauta').click(function () { let term = jQuery('#cauta_localitate').val(); StoresMap .getStores(term, subsys) .createStoreList(nearDistance); }) }, confirmSelectedStore: function (storeName, storeId, element) { let draftTotal = parseInt($('.cart-items').text()); let selectedStoreId = parseInt('0'); triggerGTagEvent('click_selecteaza_farmacia_1', { pharma_id: storeId, pharma_name: storeName }); if (parseInt(draftTotal) > 0 && selectedStoreId !== storeId) { const txt = 'Schimbarea farmaciei presupune eliminarea produselor din coșul curent. Doriți sa continuați ?'; const dialogObj = []; dialogObj.title = 'Alege/Schimba farmacia'; dialogObj.question = txt; dialogObj.yesCallbackMethod = "StoresMap.getSelectedStore('"+storeName+"',"+storeId+","+[]+")"; dialogObj.yesButton = 'DA'; dialogObj.noButton = 'NU'; confirmDialogOpenAction(element, dialogObj); } else { this.getSelectedStore(storeName, storeId, element) } }, getSelectedStore: function (storeName, storeId, element) { $('.select-store').children('i').remove(); $(element).append('') $("input[name$='[store]']").val(storeId); $('#store_name').val(storeName); $('#modal_farmacii').modal('hide'); if (currentRouteName === 'sec_register' || (currentRouteName === 'my_account' && mapOpenedFromHeader.val() == 0) ) { return; } jQuery('#generalModal').hide(); setStoreInCookie(storeId); if (articleUrl) { window.location.href = articleUrl; } else { location.reload() } }, showMap: function () { $('.store_name').click(function (e) { e.preventDefault(); mapOpenedFromHeader.val(0); let subsys = jQuery(this).attr('id'); let articleUrlEl = $('#'+subsys).parent().parent().children('.product-info').find('a').prop('href'); if (typeof articleUrlEl !== undefined) { articleUrl = articleUrlEl; } if (jQuery(this).attr('id') === 'stores_header_button') { mapOpenedFromHeader.val(1); if (jQuery('#subsysNumber').val() !== undefined) { subsys = jQuery('#subsysNumber').val(); } else { subsys = 0; } } StoresMap.getLocation(); StoresMap.searchCity(subsys); StoresMap .getStores(null, subsys) .createStoreList(nearDistance); let storesModal = $('#modal_farmacii') storesModal.modal('show'); storesModal.on('shown.bs.modal', function () { StoresMap.activateStoreLiById($("input[name$='[store]']").val()) }); iniMap(); }); } } function iniMap(callback) { if (callback) { callback(); return ; } StoresMap.createMap().createMarkers().activateStoreLiById(userStore) } jQuery(document).ready(function () { /*StoresMap.getLocation();*/ StoresMap.showMap(); });