/** * NOTICE OF LICENSE * * This file is licenced under the Software License Agreement. * With the purchase or the installation of the software in your application * you accept the licence agreement. * * You must not modify, adapt or create derivative works of this source code * * @author PrestaHelp.com * @copyright 2019 PrestaHelp * @license LICENSE.txt */ $(document).ready(function () { if (typeof checkout == 'undefined') { checkout = 'default'; } if (checkout == 'default') { if ($("#cgv").length) { // $("#cgv").unbind('click', inpostCGV($('#cgv'))).bind('click', inpostCGV($('#cgv'))); } else { $("button.standard-checkout").unbind('click', inpostCGV($('#cgv'))).bind('click', inpostCGV($('#cgv'))); } if (showWeek == 0) { $('.delivery-option').each(function() { var idd = parseInt($(this).find('input').val()); if (idd == inpostkey_week || idd == inpostkey_week_cod) { $(this).hide(); } }); } } if (checkout == 'onepagecheckoutps') { console.log(checkout); $('.approval-payment #regulamin').on('click', function() { console.log('onepagecheckoutps_step_three_container') }) $("#regulamin").unbind('click', inpostCGV($("#regulamin"))).bind('click', inpostCGV($("#regulamin"))); } if (checkout == 'onepagecheckout') { if ($("#cgv").length) { // $("#cgv").unbind('click', inpostCGV($('#cgv'))).bind('click', inpostCGV($('#cgv'))); } else { $("button.confirm_button").unbind('click', inpostCGV($('#cgv'))).bind('click', inpostCGV($('#cgv'))); } setTimeout(function() { initInpost($('#carrierTable .carrier_action input:checked')); }, 500); } $('.delivery_option_radio').off('click', '.delivery_option_radio', inpostBindRadio); $('.delivery_option_radio').on('click', '.delivery_option_radio', inpostBindRadio); initInpost($('.delivery_option_radio' + ":checked")); $('#inpostshipmodal .modal-footer button').on('click', function() { $('#inpostshipmodal').modal('hide'); }); $('#inpostshipmodal .modal-header button').on('click', function() { $('#inpostshipmodal').modal('hide'); }); $(document).on('click', '#inpostshipmodal .modal-footer button', function() { $('#inpostshipmodal').modal('hide'); }); $(document).on('click', '#inpostshipmodal .modal-header button', function() { $('#inpostshipmodal').modal('hide'); }); }); var assetsServer = 'https://api-pl-points.easypack24.net/v1'; function openModalMap(id) { $('#easypack-widget').empty(); $('#easypack-map').empty(); if (mapBox == 1) { if (imap == 'google') { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: ['parcel_locker_only'] }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: ['parcel_locker_only'], googleKey: imgm }, }); } else { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: ['parcel_locker_only'] }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: ['parcel_locker_only'] }, }); } var width = 500; if (mapShow == 2) { width = ($(window).width() * 0.7); } easyPack.modalMap(function (point, modal) { updateInpostInfo(cart, id, point.name); modal.closeModal(); return false; }, {width: width, height: 600}); } else { if (imap == 'google') { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: ['parcel_locker_only'] }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: ['parcel_locker_only'], googleKey: imgm }, }); } else { easyPack.init({ instance: 'pl', defaultLocale: 'pl', points: { types: ['parcel_locker_only'] }, locales: 'pl', apiEndpoint: assetsServer, mapType: imap, searchType: imap, map: { useGeolocation: true, initialTypes: ['parcel_locker_only'], }, }); } easyPack.mapWidget('easypack-widget', function(point) { updateInpostInfo(cart, id, point.name); }); } } function inpostCGVUncheck() { $("#cgv").prop('checked', false); if (typeof $.uniform != 'undefined') { $.uniform.update(); } } function inpostBindRadio(e) { inpostCGVUncheck(); initInpost($(this), true); } function updateInpostInfo(id_cart, id_carrier, point) { $('.saveInfo').remove(); if (point.length < 9) { $('.tr-inpost-box .inpostship-main').css({ 'border': '1px solid #999' }); $('.point-info').remove(); var week = 0; if ($('.weekPack').is(':checked')){ week = 1; } $.ajax({ type: 'POST', headers: {"cache-control": "no-cache"}, url: baseDir + 'modules/inpostship/setPoint.php', async: false, cache: false, dataType: 'json', data: 'id_cart=' + id_cart + '&id_carrier=' + id_carrier + '&point=' + point + '&week='+week, success: function (jsonData) { $('.saveInfo').remove(); if (jsonData === false) { $('.tr-inpost-box .inpostship-main').css({ 'border': '3px solid #ff0000' }); $('.tr-inpost-box .inpostship-main').append('Paczkomat nie został poprawnie zapisany'); } else { $('.tr-inpost-box .inpostship-main').css({ 'border': '3px solid #67A901' }); $('.tr-inpost-box .inpostship-main').append('
Wybrany paczkomat:
' + jsonData.point_code + ', ul. ' + jsonData.point_address1 + ', ' + jsonData.point_address2 + '
' + jsonData.point_desc + '
| Paczka w weekend (+' + weekPrice + ' zł) | |
| ' + 'Wybierz paczkomat z mapy' + ' | ' + '|