function formatCurrency(price) {
//abonee (abone extra) pesine (peşin extra)
//abonea (abone arabalı) pesina (peşin arabalı)
postType = document.fm.post.options[document.fm.post.selectedIndex].value;
transferType = document.fm.transfer.options[document.fm.transfer.selectedIndex].value;
if (postType == 2) {
price = price * 2; //express carpan
}
if (postType == 3) {
price = price * 2;
}
if (transferType == 2) {
price = price * 1.7; //arabali carpan
}
//return (((sign) ? '' : '-') + price + ',' + cents + ' TL'); //kodlu
//return (((sign) ? '' : '-') + price + '.' + cents); //küsüratlı
//return Math.ceil(price); //yuvarlamalı
document.getElementById('durum').innerHTML = "";
var internetPriceDiscountPercent = 10;
var internetPriceDiscountRate = (100 - internetPriceDiscountPercent) / 100;
document.getElementById('normalFiyat').innerHTML = "
' + $('
').text(point.title).html() + '
');
infoWindow.open({
anchor: marker,
map: map
});
});
});
}
function drawRoutePolyline(map, path) {
var polyline = new google.maps.Polyline(Object.assign({
path: path
}, getRoutePolylineStyle()));
polyline.setMap(map);
return polyline;
}
async function renderCachedRoute(map, cachedRoute, startLabel, endLabel, post, transfer, exprice, min_price) {
var distanceMeters = cachedRoute && cachedRoute.distance_meters ? parseInt(cachedRoute.distance_meters, 10) || 0 : 0;
var hydratedPath = hydrateCachedRoutePath(cachedRoute && cachedRoute.path_points ? cachedRoute.path_points : []);
if (!distanceMeters || hydratedPath.length < 2) {
return false;
}
drawRoutePolyline(map, hydratedPath);
fitRoutePath(map, hydratedPath);
await addRouteMarkers(map, hydratedPath, startLabel, endLabel);
priceCalculation(distanceMeters / 1000, startLabel, endLabel, post, transfer, exprice, min_price);
return true;
}
function calculateRouteDistanceFromDirections(route) {
var totalMeters = 0;
route.legs.forEach(function(leg) {
if (leg.distance && leg.distance.value) {
totalMeters += leg.distance.value;
}
});
return totalMeters / 1000;
}
function calculateRouteDistanceWithLegacyApi(map, start, end, post, transfer, exprice, min_price, startLabel, endLabel, routeMeta) {
var directionsService = new google.maps.DirectionsService();
var directionsRenderer = new google.maps.DirectionsRenderer({
suppressMarkers: true,
preserveViewport: false,
polylineOptions: getRoutePolylineStyle()
});
directionsRenderer.setMap(map);
directionsService.route({
origin: start,
destination: end,
travelMode: google.maps.TravelMode.DRIVING
}, async function(response, status) {
if (status === 'OK' && response.routes && response.routes[0]) {
directionsRenderer.setDirections(response);
var distanceKm = calculateRouteDistanceFromDirections(response.routes[0]);
var distanceMeters = Math.round(distanceKm * 1000);
await persistRouteDistanceCache(routeMeta, distanceMeters, serializeRoutePath(response.routes[0].overview_path || []));
priceCalculation(distanceKm, startLabel, endLabel, post, transfer, exprice, min_price);
} else {
showRouteError();
}
});
}
async function calculateAndDisplayRoute(map, start, end, post, transfer, exprice, min_price, startLabel, endLabel, routeMeta) {
to = end;
from = start;
postType = post;
transferType = transfer;
try {
const routesLibrary = await google.maps.importLibrary('routes');
const Route = routesLibrary.Route;
const cachedRoute = await fetchCachedRouteData(routeMeta);
if (cachedRoute && await renderCachedRoute(map, cachedRoute, startLabel, endLabel, post, transfer, exprice, min_price)) {
return;
}
const routeRequest = {
origin: start,
destination: end,
travelMode: 'DRIVING',
fields: ['path', 'distanceMeters', 'legs']
};
const routeResponse = await Route.computeRoutes(routeRequest);
const route = routeResponse.routes && routeResponse.routes[0];
var distanceMeters = (cachedRoute && cachedRoute.distance_meters ? parseInt(cachedRoute.distance_meters, 10) || 0 : 0) || extractRouteDistanceMeters(route);
var serializedPath = serializeRoutePath(route && route.path ? route.path : []);
if (!route || !route.path || !route.path.length) {
throw new Error('ROUTE_NOT_FOUND');
}
if (!distanceMeters || distanceMeters <= 0) {
throw new Error('ROUTE_DISTANCE_NOT_FOUND');
}
drawRoutePolyline(map, route.path);
fitRoutePath(map, route.path);
await addRouteMarkers(map, route.path, startLabel, endLabel);
if (!cachedRoute || !cachedRoute.path_points || !cachedRoute.path_points.length) {
await persistRouteDistanceCache(routeMeta, distanceMeters, serializedPath);
}
priceCalculation(distanceMeters / 1000, startLabel, endLabel, post, transfer, exprice, min_price);
} catch (error) {
calculateRouteDistanceWithLegacyApi(map, start, end, post, transfer, exprice, min_price, startLabel, endLabel, routeMeta);
}
}
function priceCalculation(distance, start, end, post, transfer, exprice, min_price) {
$('input[id="postVal"]').val(post);
$('input[id="transferVal"]').val(transfer);
$('input[id="expriceVal"]').val(exprice);
$('input[id="minpriceVal"]').val(min_price);
var kmPrice = 25;
var aboneextra = 0.00;
var pesinextra = 0.00;
var normPrice = 0;
var internetDiscountPercent = 0;
var discountRate = (100 - internetDiscountPercent) / 100;
if(distance >= 1) {
normPrice = distance * kmPrice;
}
//alert("KM Fiyat: " + normPrice);
if(exprice >= 1) {
normPrice = normPrice + exprice;
}
//alert("Ekstra Bölge Fiyat: " + exprice);
if(post==3 && normPrice <= 1800){ //arabali gonderi taBan fiyatini sabitle 30x4
normPrice = 1800;
}
if((normPrice*discountRate) < min_price){ //taban fiyat ekstra bolgeyse indirim yok
normPrice = min_price;
normPrice = normPrice*discountRate; //indirim uygula
//alert(exprice + " Tabanlı Fiyat: " + normPrice);
}else{
normPrice = normPrice*discountRate; //indirim uygula
//alert(discountRate + " İndirimli Fiyat: " + normPrice);
}
if(post==3 && normPrice > 10000){ //arabali gonderi taVan fiyatini sabitle 30x4
normPrice = 10000;
//alert("Son Fiyat 1: " + normPrice);
}
if(normPrice < 390 || !normPrice){ //taBan fiyati sabitle
normPrice = 390;
//alert("Son Fiyat 2: " + normPrice);
}
if(normPrice > 10000 || !normPrice){ //normal taVan fiyati sabitle
normPrice = 10000;
//alert("Son Fiyat 3: " + normPrice);
}
//gunu ve saati kontrol et
var dt = new Date();
var weekday = ["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"];
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
var hour_minute = (dt.getHours()<10?'0':'') + dt.getHours() +""+ (dt.getMinutes()<10?'0':'') + dt.getMinutes();
var date = dt.getDate();
if(hour_minute >= 1900 || hour_minute <= 0659){
//normPrice = normPrice*2.5;
}else if(weekday[dt.getDay()]=="Pazar" || (hour_minute >= 1700 && hour_minute <= 1900)){
normPrice = normPrice*1.5;
}else if(hour_minute >= 1900 && hour_minute <= 2359){
//normPrice = normPrice*2.5;
}
//
//ekrani kaydir
$('html, body').animate({
//scrollTop: $("#priceCalc").offset().top-30
scrollTop: 67
}, 1000);
var fromT = $(".tec-domain-cat3 .select2-bootstrap-append .select2 .selection .select2-selection .select2-selection__rendered").text();
fromT = fromT.replace("
", "");
fromT = fromT.replace("", "");
$(".tec-domain-cat3 .select2-bootstrap-append .select2 .selection .select2-selection .select2-selection__rendered").text(fromT);
var toT = $(".tec-domain-cat4 .select2-bootstrap-append .select2 .selection .select2-selection .select2-selection__rendered").text();
toT = toT.replace("
", "");
toT = toT.replace("", "");
$(".tec-domain-cat4 .select2-bootstrap-append .select2 .selection .select2-selection .select2-selection__rendered").text(toT);
formatCurrency(normPrice); //ucreti yazdir
}
jQuery(document).ready(function($) {
$('.counter').counterUp({
delay: 50,
time: 500
});
ensureRoutePointInputs('start');
ensureRoutePointInputs('end');
initSelects();
$(document).on('select2:select', '#start, #end', function(event) {
var prefix = this.id;
var item = event && event.params ? event.params.data || {} : {};
var selectedText = item.pricing_label || item.text || '';
setRoutePointCache(prefix, {
selection_id: item.id || '',
source_mode: 'dropdown',
pricing_label: selectedText,
route_query: item.route_query || '',
lat: item.cached_lat != null ? item.cached_lat : '',
lng: item.cached_lng != null ? item.cached_lng : '',
place_id: item.place_id || ''
});
initDirections(
prefix === 'start' ? selectedText : getCurrentRouteLabel('start'),
prefix === 'end' ? selectedText : getCurrentRouteLabel('end'),
$('#post').val(),
$('#transfer').val()
);
});
$(document).on('change', '#post, #transfer', function() {
initDirections(getCurrentRouteLabel('start'), getCurrentRouteLabel('end'), $('#post').val(), $('#transfer').val());
});
if (typeof window.resetMap === 'function' && !window.resetMap.__routeCacheWrapped) {
var originalResetMap = window.resetMap;
window.resetMap = function() {
clearRoutePointCache('start');
clearRoutePointCache('end');
return originalResetMap.apply(this, arguments);
};
window.resetMap.__routeCacheWrapped = true;
}
setTimeout(function() {autoLogin();}, 1000);
//eger site kapaliysa
siteClosed=0;
closedReason='
Bayram tatili sebebiyle geçici olarak hizmet veremiyoruz. Perşembe sabahı erkenden işimizin başındayız.
Sorularınız için bizi arayabilirsiniz.
0(536) 704 34 14
';
title="Mutlu Bayramlar!";
color="red";
icon="fa fa-heart-o";
//gunu ve saati kontrol et
var dt = new Date();
var weekday = ["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"];
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
var hour_minute = (dt.getHours()<10?'0':'') + dt.getHours() +""+ (dt.getMinutes()<10?'0':'') + dt.getMinutes();
var date = dt.getDate();
if(siteClosed==1){
setTimeout(function() {
if($.browser.webkit){
clsName="jconfirm-blur-bg";
}else{
clsName="jconfirm-blur-bg-nonwebkit";
}
jconfirm.defaults = {
onOpenBefore: function () {$("#allContent").addClass(clsName);},
onContentReady: function () {$("#allContent").addClass(clsName);},
onDestroy: function () {$("#allContent").removeClass(clsName);}
};
pop("siteClosed",closedReason,title,color,icon);
$('#post').prop('disabled', true);
$('#transfer').prop('disabled', true);
$('#start').prop('disabled', true);
$('#end').prop('disabled', true);
$('#startBut').prop('disabled', true);
$('#endBut').prop('disabled', true);
var startSnowing = function() {
$(document).snowfall('clear');
var deviceType = (navigator.userAgent.match(/iPad/i)) == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : "null";
if(deviceType.indexOf("iPhone")>=0 || deviceType.indexOf("iPad")>=0 || deviceType.indexOf("Android")>=0){
$('.collectonme').show();
$(document).snowfall({collection : '.collectonme', flakeCount : 100, deviceorientation : true, round : true, shadow : false, minSize: 3, maxSize:6, minSpeed : 2, maxSpeed : 5});
}else{
//$('.collectonme').hide();
$(document).snowfall({flakeCount : 120, deviceorientation : false, round : true, shadow : false, minSize: 4, maxSize:7, minSpeed : 2, maxSpeed : 5});
}
};
//loadScript("https://kuryelerburada.com/js/snowfall/snowfall.jquery.min.js", startSnowing);
//loadScript("https://kuryelerburada.com/js/snowfall/snowfall.min.js", startSnowing);
}, 4000);
}else if(hour_minute >= 1900 || hour_minute <= 0659){
//setTimeout(function() {pop("nightHours");}, 4000); eski
setTimeout(function() {pop("workingHours");}, 4000);
}else if(weekday[dt.getDay()]=="Pazar" || (hour_minute >= 1700 && hour_minute <= 1859)){
setTimeout(function() {pop("expressHours");}, 4000);
}else if(weekday[dt.getDay()]!="Pazar" && (hour_minute >= 1700 && hour_minute <= 1859)){
setTimeout(function() {pop("expressHours");}, 4000);
}
//mobil uygulama surum kontrolu
if ($("#app-version").length > 0) {
if($("#app-version").val()!="1.7.0"){
var deviceType = (navigator.userAgent.match(/iPad/i)) == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : "null";
if(deviceType.indexOf("iPhone")>=0 || deviceType.indexOf("iPad")>=0){
icon="fa fa-apple";
applink="https://kuryelerburada.com";
closedReason='
Bu uygulama artık kullanılmamaktadır. Tüm işlemleriniz için lütfen aşağıdaki bağlantıya tıklayarak web sitemizi ziyaret edin. Web sitemizi Safari tarayıcısı ile açtıktan sonra paylaşım butonunu kullanarak yeni uygulamamızı cihazınızın ana ekranına kolayca ekleyebilirsiniz.
Güncellemek için Dokunun
';
title="Uygulamamız Güncellendi";
color="red";
pop("siteClosed",closedReason,title,color,icon);
$('#post').prop('disabled', true);
$('#transfer').prop('disabled', true);
$('#start').prop('disabled', true);
$('#end').prop('disabled', true);
$('#startBut').prop('disabled', true);
$('#endBut').prop('disabled', true);
}else if(deviceType.indexOf("Android")>=0){
icon="fa fa-android";
applink="https://kuryelerburada.com";
closedReason='
Bu uygulama artık kullanılmamaktadır. Tüm işlemleriniz için lütfen aşağıdaki bağlantıya tıklayarak web sitemizi ziyaret edin. Web sitemizi Chrome trayıcısı ile açtıktan sonra paylaşım butonunu kullanarak yeni uygulamamızı cihazınızın ana ekranına kolayca ekleyebilirsiniz.
Güncellemek için Dokunun
';
title="Uygulamamız Güncellendi";
color="red";
pop("siteClosed",closedReason,title,color,icon);
$('#post').prop('disabled', true);
$('#transfer').prop('disabled', true);
$('#start').prop('disabled', true);
$('#end').prop('disabled', true);
$('#startBut').prop('disabled', true);
$('#endBut').prop('disabled', true);
}
}
}
//pop("startup");
});