/** * 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 tooltip != 'undefined') { $('.label-tooltip').tooltip(); } $(document).on('click', '.select_all', function(e) { if ($(this).is(':checked')) { $('.select_one').each(function() { $(this).prop('checked', 'checked').change(); }); } else { $('.select_one').each(function() { $(this).removeAttr('checked').change(); }); } }); $(document).on('click', '.select_pww_all', function(e) { if ($(this).is(':checked')) { $('.select_pww_one').each(function() { $(this).prop('checked', 'checked').change(); }); } else { $('.select_pww_one').each(function() { $(this).removeAttr('checked').change(); }); } }); $(document).on('change', '.select_ins_all', function(e) { let ins = $(this).val(); $('.select_one').each(function() { if ($(this).is(':checked')) { $(this).closest('tr').find('.select_ins_one').val(ins).change(); } }); }); $(document).on('change', '.select_sendtype_all', function(e) { let ins = $(this).val(); $('.select_one').each(function() { let service = $(this).data('service'); if ($(this).is(':checked')) { if (ins == 'parcel_locker') { if (service != 5 && service != 6 && service != 2) { $(this).closest('tr').find('.select_sendtype_one').val(ins).change(); } } else { $(this).closest('tr').find('.select_sendtype_one').val(ins).change(); } } }); }); $(document).on('change', '.select_packtype_all', function(e) { let pt = $(this).val(); $('.select_one').each(function() { if ($(this).is(':checked')) { $(this).closest('tr').find('.select_packtype_one').val(pt).change(); } }); }); $('.selectAllCheckbox').on('click', function () { var chked = false; if ($(this).is(':checked')) { chked = true; } $('.chBox').each(function() { if (chked) { $(this).attr('checked', 'checked') } else { $(this).removeAttr('checked') } }); }); $('.settingsInpost').on('click', function() { $('.alertInpost').remove(); var mapType = $('#INPOSTSHIP_MAP_TYPE').val(); if (mapType == 'google') { var api = $('#INPOSTSHIP_GOOGLE_MAPS_API').val(); if (api == '') { $('#INPOSTSHIP_GOOGLE_MAPS_API').after('
Wybrałeś jako typ mapy Google Maps. Musisz podać klucz API aby działały poprawnie!
'); return false; } return true; } return true; }); $('.btnToPrepare').on('click', function(){ var html = $(this).html(); $(this).html(html + ''); }); $('.btnToAll').on('click', function() { var error = 0; $('.errorSize').each(function() { $(this).removeClass('errorSize'); }); var owner = $('#ownSize'); if (owner.is(':checked')) { var s1 = parseInt($('#size1').val()); var s2 = parseInt($('#size2').val()); var s3 = parseInt($('#size3').val()); if (s1 > 350) { error = 1; $('#size1').addClass('errorSize'); } if (s2 > 240) { error = 1; $('#size2').addClass('errorSize'); } if (s3 > 240) { error = 1; $('#size3').addClass('errorSize'); } } var rnumber = $('#refNumber').val(); if (rnumber.length < 3) { $('#refNumber').addClass('errorSize'); error = 1; } var recEmail = $('#recEmail').val(); if (recEmail.length < 1) { $('#recEmail').addClass('errorSize'); error = 1; } var recPhone = $('#recPhone').val(); if (recPhone.length < 1) { $('#recPhone').addClass('errorSize'); error = 1; } var ins = $('#ins').val(); var total = $('#totalOrder').val(); if (ins < total) { $('#ins').addClass('errorSize'); error = 1; } if (error == 1) { return false; } $(this).find('span').text('trwa tworzenie przesyłki...'); }); $('.add-package').click(function(){ $('.packageCreate').toggle(); }); $('#ajax-update-point').click(function(){ $('.ajax-inpost-result').empty(); pointSteps(); }); }); function pointSteps() { $('.ajax-inpost-result').append(''); setPointStep1(); } function setPointStep1() { $.ajax({ url: step1url+'?action=deletePoint', dataType: 'json', method: 'get', success: function() { $('.ajax-inpost-result div').append('Krok 1 - baza punktów wyczyszczona.
'); setPointStep2(); } }); } async function setPointStep2() { if (points_count === undefined) { // var points_count = 0; } if (points_all === undefined) { // var points_all = 0; } $('.ajax-inpost-result div').append('Krok 2 - Import punktów z Inpost.
'); $('.ajax-inpost-result div').append('0 z '+points_all+'
Krok 3 Zakończono import. Zaraz nastąpi przeładowanie strony.
'); var time = 5; setInterval(function() { $('.ccc').text(' (za '+time+'s)'); time--; }, 1000); setTimeout(function() { window.location.reload(true); }, 5000); }