$(document).ready(function() { $('.showStatus').on('click', function() { $('#modalTracking .trackInfo').html(''); var ref = $(this).data('reference'); $.ajax({ url: ajaxTrackingLink, data: 'track='+ref, dataType: 'json', method: 'get', success: function(json) { var html = ''; if (json.error != 'error') { var last = json.current html = ''+last.date+'

Aktualny status przesyłki to:

'; html += ''+last.status.description+'
'; } else { html = '
Wystąpił błąd: Przesyłka nie istnieje w systemie.
'; } $('#modalTracking #myModalLabel').html('Śledzenie przesyłki InPost nr:
'+json.result.tracking_number); $('#modalTracking .trackInfo').html(html); $('#modalTracking').modal('show'); } }); }); $('.showHistory').on('click', function() { $('#modalTracking .trackInfo').html(''); var ref = $(this).data('reference'); $.ajax({ url: ajaxTrackingHistoryLink, data: 'track='+ref, dataType: 'json', method: 'get', success: function(json) { var html = ''; if (json.error != 'error') { var lista = json.result.tracking_details; $.each(lista, function(index, value) { var curr = ''; if (index == 0) { curr = ' current'; } html += '
'+value.date+'

Aktualny status przesyłki to:

'; html += ''+value.statusPL.description+'
'; }); } else { html = '
Wystąpił błąd: Przesyłka nie istnieje w systemie.
'; } $('#modalTracking #myModalLabel').html('Historia statusów przesyłki nr:
'+json.result.tracking_number); $('#modalTracking .trackInfo').html(html); $('#modalTracking').modal('show'); } }); }); }); var assetsServer = 'https://api-pl-points.easypack24.net/v1'; function openModalMap(id) { $('#easypack-widget').empty(); $('#easypack-map').empty(); var pointType = ['parcel_locker_only']; if (pTypes == 1) { pointType = ['parcel_locker', 'pop']; } if (mapBox == 1) { if (imap == 'google') { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: pointType }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: pointType, googleKey: imgm }, }); } else { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: pointType }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: pointType, }, }); } if (imw == 1) { var width = 500; var height = ($(window).height() * 0.7); // 600 } else { var width = $(window).width() - 25; var height = ($(window).height() -25); // 600 } if (mapShow == 2) { width = ($(window).width() * 0.7); } easyPack.modalMap(function (point, modal) { updateInpostInfo(id, point.name); modal.closeModal(); return false; }, {width: width, height: height}); } else { if (imap == 'google') { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: pointType }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: pointType, googleKey: imgm }, }); } else { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: pointType }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: pointType, }, }); } easyPack.mapWidget('easypack-widget', function(point) { updateInpostInfo(id, point.name); }); } } function updateInpostInfo(customer, point) { console.log(customer+' '+point); $.ajax({ type: 'POST', headers: {"cache-control": "no-cache"}, url: baseDirShop + 'module/inpostship/setUserPoint', async: false, cache: false, dataType: 'json', data: 'id=' + customer + '&point=' + point, success: function (jsonData) { if (jsonData == true) { window.location.refresh(); } } }); }