544 lines
24 KiB
JavaScript
544 lines
24 KiB
JavaScript
/**
|
|
*
|
|
* 2014-2023 Presta-Mod.pl Rafał Zontek
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* Poniższy kod jest kodem płatnym, rozpowszechanie bez pisemnej zgody autora zabronione
|
|
* Moduł można zakupić na stronie Presta-Mod.pl. Modyfikacja kodu jest zabroniona,
|
|
* wszelkie modyfikacje powodują utratę gwarancji
|
|
*
|
|
* http://presta-mod.pl
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
*
|
|
* @author Presta-Mod.pl Rafał Zontek <biuro@presta-mod.pl>
|
|
* @copyright 2014-2023 Presta-Mod.pl
|
|
* @license Licecnja na jedną domenę
|
|
* Presta-Mod.pl Rafał Zontek
|
|
*
|
|
*/
|
|
$(document).ready(function () {
|
|
let pm_others = $('.pminpostpaczkomaty-others');
|
|
let pm_inpostpaczkomaty_duration_error = 4000;
|
|
let pm_inpostpaczkomaty_duration_conf = 2000;
|
|
|
|
function addListToOther(d) {
|
|
let html_to_add = `<tr><td><a class="print-package-label" href="${d.link2}" target="_blank"><i class="material-icons" aria-hidden="true">print</i> ${d.packcode}</a></td><td><a class="btn-view" href="${d.link}" target="_blank"><i class="material-icons" aria-hidden="true">visibility</i></a></td></tr>`;
|
|
pm_others.find('table').append(html_to_add);
|
|
pm_others.find('tr:last').hide().fadeIn().fadeOut().fadeIn();
|
|
pm_others.scrollTop(pm_others.prop("scrollHeight"));
|
|
}
|
|
|
|
|
|
function showNewLabelButtons() {
|
|
$('.createnew').addClass('hidden');
|
|
$('.printlabel').addClass('hidden');
|
|
$('.send').removeClass('hidden');
|
|
$('.sendandprint').removeClass('hidden');
|
|
$('.payforpack').addClass('hidden');
|
|
}
|
|
|
|
function showPrintButtons() {
|
|
$('.payforpack').addClass('hidden');
|
|
$('.send').addClass('hidden');
|
|
$('.sendandprint').addClass('hidden');
|
|
$('.createnew').removeClass('hidden');
|
|
$('.printlabel').removeClass('hidden');
|
|
}
|
|
function removeDisable() {
|
|
$('.pminpostbutton-ajax').removeAttr('disabled');
|
|
if ($('.pm-button-loading').length) {
|
|
setTimeout(function() {
|
|
$('.pm-button-loading').removeClass('pm-button-loading');
|
|
}, 500);
|
|
}
|
|
}
|
|
function disablePaczkomatyInputs() {
|
|
$('.paczkomaty-form').find('input[type="text"],select,input[type="radio"]').attr('disabled','disabled');
|
|
$('#pminpostorder_format').removeAttr('disabled');
|
|
$('#pminpostorder_size_l').removeAttr('disabled');
|
|
}
|
|
|
|
function assignEvents() {
|
|
$('.paczkomaty-form').find('.switch').addClass('ps-switch');
|
|
$('.pminpostbutton-ajax').parent().addClass('text-center');
|
|
|
|
if ($('input[name="pminpostorder_pobranie"]:checked').val() == 0) {
|
|
$('#pminpostorder_pobranie_value').attr('disabled','disabled');
|
|
}
|
|
|
|
if ($('input[name="pminpostorder_ubezpieczenie"]:checked').val() == 0) {
|
|
$('#pminpostorder_ubezpieczenie_value').attr('disabled','disabled');
|
|
}
|
|
|
|
$('.btnpaczkomaty-size input:checked').parent().parent().addClass('active');
|
|
|
|
$('input[name="PMINPOSTPACZKOMATY_SHIPX"]:checked').click();
|
|
$('input[name="PMINPOSTPACZKOMATY_SHIPY"]:checked').click();
|
|
let pm_inpostpaczkomaty_machine_label = 'Paczkomat: ';
|
|
$('#pminpostorder_machine').change();
|
|
if (pm_inpostpaczkomaty_wpzl == 1) {
|
|
let paczkomatPlaceholder = 'Wprowadź miejscowość, ulicę, lub nazwę paczkomatu';
|
|
$('#pminpostorder_selected').hide().parent().append('<input class="paczkomaty_input form-control" type="text" placeholder="'+paczkomatPlaceholder+'" id="pminpostorder_selected_COPY">');
|
|
$('#pminpostorder_selected_COPY').val($('#pminpostorder_selected').val());
|
|
$('#pminpostorder_selected_COPY').paczkomaty(
|
|
'https://maps.googleapis.com/maps/api/geocode/json',
|
|
{
|
|
formatItem: function(data, i, max, value, term) {
|
|
return '<span class="paczkomat_name">'+pm_inpostpaczkomaty_machine_label+data.name+'</span> <span>'+data.address.line1+', '+data.address.line2+'</span>';
|
|
},
|
|
parse: function(data) {
|
|
let mytab = [];
|
|
for (let i = 0; i < data.length; i++){
|
|
mytab[mytab.length] = { data: data[i], value: pm_inpostpaczkomaty_machine_label+ data.name+' '+data[i].address.line1 + ': ' + data[i].address.line2+ ' '+data[i].location_description};
|
|
}
|
|
return mytab;
|
|
},
|
|
}
|
|
)
|
|
.result(function(event, data, formatted) {
|
|
if (data.status != '404') {
|
|
$(this).val(data.name+': '+data.address.line1+', '+data.address.line2);
|
|
$('#pminpostorder_selected').val(data.name);
|
|
}
|
|
}).getPaczkomatName();
|
|
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').hide().parent().append('<input type="text" placeholder="'+paczkomatPlaceholder+'" id="PMINPOSTPACZKOMATY_MACHINE_COPY">');
|
|
$('#PMINPOSTPACZKOMATY_MACHINE_COPY').val($('#PMINPOSTPACZKOMATY_MACHINE').val());
|
|
$('#PMINPOSTPACZKOMATY_MACHINE_COPY').paczkomaty(
|
|
'https://maps.googleapis.com/maps/api/geocode/json',
|
|
{
|
|
formatItem: function(data, i, max, value, term) {
|
|
return '<span class="paczkomat_name">'+pm_inpostpaczkomaty_machine_label+data.name+'</span> <span>'+data.address.line1+' '+data.address.line2+'</span>';
|
|
},
|
|
parse: function(data) {
|
|
let mytab = [];
|
|
for (let i = 0; i < data.length; i++){
|
|
mytab[mytab.length] = { data: data[i], value: pm_inpostpaczkomaty_machine_label+ data.name+' '+data[i].address.line1 + ': ' + data[i].address.line2+ ' '+data[i].location_description};
|
|
}
|
|
return mytab;
|
|
},
|
|
}
|
|
)
|
|
.result(function(event, data, formatted) {
|
|
$(this).val(data.name+': '+data.address.line1);
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').val(data.name);
|
|
}).getPaczkomatName();
|
|
}
|
|
|
|
if ($('#PMINPOSTPACZKOMATY_SHIPPING_METHOD').val() == 1) { //Redy hide machine list
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').parent().parent().show();
|
|
} else {
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').parent().parent().hide();
|
|
}
|
|
|
|
refreshConfigFields();
|
|
|
|
if ($('#PMINPOSTPACZKOMATY_LABEL_FORMAT').val() == 'Pdf') { //Ready hide format list
|
|
$('#PMINPOSTPACZKOMATY_LABEL_SIZE').parent().parent().show();
|
|
} else {
|
|
$('#PMINPOSTPACZKOMATY_LABEL_SIZE').parent().parent().hide();
|
|
}
|
|
|
|
$('.module_tab.active').click();
|
|
}
|
|
|
|
$(document).on('click','.show-paczkomaty-form',function () {
|
|
if (!$('.paczkomaty-form').is(':visible')) {
|
|
$('.paczkomaty-form').fadeIn();
|
|
} else {
|
|
$('.paczkomaty-form').fadeOut();
|
|
}
|
|
});
|
|
|
|
$(document).on('keydown', function(e) {
|
|
if (e.ctrlKey && e.altKey && e.keyCode == 83) {
|
|
if ($('.pminpostbutton-ajax.send').is(':visible') && !$('.pminpostbutton-ajax.send').is(':disabled')) {
|
|
e.preventDefault();
|
|
$('.pminpostbutton-ajax.send').click();
|
|
}
|
|
} else if (e.ctrlKey && e.altKey && e.keyCode == 80) {
|
|
if ($('.pminpostbutton-ajax.printlabel').is(':visible') && !$('.pminpostbutton-ajax.printlabel').is(':disabled')) {
|
|
e.preventDefault();
|
|
$('.pminpostbutton-ajax.printlabel').click();
|
|
}
|
|
}
|
|
else if (e.ctrlKey && e.altKey && e.keyCode == 78) {
|
|
if ($('.pminpostbutton-ajax.createnew').is(':visible') && !$('.pminpostbutton-ajax.createnew').is(':disabled')) {
|
|
e.preventDefault();
|
|
$('.pminpostbutton-ajax.createnew').click();
|
|
}
|
|
}
|
|
});
|
|
|
|
$(document).on('click','.pminpostbutton-ajax',function () {
|
|
$(this).addClass('pm-button-loading');
|
|
$('.pminpostbutton-ajax').attr('disabled','disabled');
|
|
if ($(this).is('.send')) {
|
|
let ppmform = $('.paczkomaty-form').find('form').serialize();
|
|
let urlpost = $(this).attr('href');
|
|
$.ajax({
|
|
url: urlpost,
|
|
method: 'post',
|
|
data: ppmform,
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
removeDisable();
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.notice({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
disablePaczkomatyInputs();
|
|
showPrintButtons();
|
|
addListToOther(d);
|
|
}
|
|
}
|
|
});
|
|
} else if ($(this).is('.send2')) {
|
|
$(this).attr('disabled','disabled');
|
|
let t = this;
|
|
let ppmform = $('.paczkomaty-form').find('form').serialize();
|
|
let urlpost = $(this).attr('href');
|
|
|
|
$.ajax({
|
|
url: urlpost,
|
|
method: 'post',
|
|
data: ppmform,
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
removeDisable();
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$('#send_order_a'+d.id_order).addClass('hidden');
|
|
$('#send_order_b'+d.id_order).addClass('hidden');
|
|
$('#send_order_c'+d.id_order).addClass('hidden');
|
|
$('#print_order'+d.id_order).removeClass('hidden');
|
|
$('#nr_listu'+d.id_order).html(d.packcode);
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
} else if ($(this).is('.printlabel2')) {
|
|
$(this).attr('disabled','disabled');
|
|
let t = this;
|
|
let url = '';
|
|
if ($('#pminpostorder_format').length) {
|
|
url = $(t).attr('href')+'&check=1&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val()
|
|
} else {
|
|
url = $(t).attr('href')+'&check=1';
|
|
}
|
|
$.ajax({
|
|
url: url,
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
removeDisable();
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.notice({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
window.location.href = $(t).attr('href');
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
} else if ($(this).is('.sendandprint')) {
|
|
let ppmform = $('.paczkomaty-form').find('form').serialize();
|
|
let urlpost = $(this).attr('href');
|
|
$.ajax({
|
|
url: urlpost,
|
|
method: 'post',
|
|
data: ppmform,
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
removeDisable();
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.notice({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
disablePaczkomatyInputs();
|
|
showPrintButtons();
|
|
addListToOther(d);
|
|
$.ajax({
|
|
url: $('.printlabel').attr('href')+'&check=1&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val(),
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
removeDisable();
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.notice({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
window.location.href = $('.printlabel').attr('href')+'&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
} else if ($(this).is('.printlabel')) {
|
|
$.ajax({
|
|
url: $('.printlabel').attr('href')+'&check=1&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val(),
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.notice({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
window.location.href = $('.printlabel').attr('href')+'&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val();
|
|
}
|
|
removeDisable();
|
|
}
|
|
});
|
|
} else if ($(this).is('.createnew')) {
|
|
$.ajax({
|
|
url: $('.createnew').attr('href')+'&check=1',
|
|
dataType: 'json',
|
|
success: function (d) {
|
|
if (d.error !== false) {
|
|
$.growl.error({title: "", message: d.error, duration: pm_inpostpaczkomaty_duration_error, style: ' growl-error pm-growl-error'});
|
|
} else {
|
|
$.growl.warning({title: '', message: d.confirmation, duration: pm_inpostpaczkomaty_duration_conf, style: ' growl-notice pm-growl-notice'});
|
|
$('.paczkomaty-form').find('input[type="text"],select,input[type="radio"]').removeAttr('disabled');
|
|
showNewLabelButtons();
|
|
}
|
|
removeDisable();
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
});
|
|
|
|
$(document).on('click', '.refresh_status', function(){
|
|
let t = this;
|
|
let urlpost = $(this).attr('href');
|
|
let last = $(this).html();
|
|
$(this).html('<img src="../modules/pminpostpaczkomaty/views/img/throbber.gif">');
|
|
$.ajax({
|
|
url: urlpost,
|
|
dataType: 'JSON',
|
|
success: function(s) {
|
|
removeDisable();
|
|
if (s.error) {
|
|
$.confirm({
|
|
title: '',
|
|
content: s.error,
|
|
buttons: {
|
|
cancel: {
|
|
text: 'OK'
|
|
}
|
|
}
|
|
});
|
|
$(t).html(last);
|
|
} else {
|
|
$(t).html(s.status);
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$(document).on('change','select[name="pminpostorder_machine"]', function(){
|
|
if ($(this).val() == 1) {
|
|
$('#pminpostorder_selected_from').parents('.form-group').fadeIn();
|
|
} else {
|
|
$('#pminpostorder_selected_from').parents('.form-group').fadeOut();
|
|
}
|
|
});
|
|
|
|
$(document).on('change','input[name="pminpostorder_pobranie"]', function(){
|
|
if ($('input[name="pminpostorder_pobranie"]:checked').val() == 0) {
|
|
$('#pminpostorder_pobranie_value').attr('disabled','disabled');
|
|
} else {
|
|
$('#pminpostorder_pobranie_value').removeAttr('disabled');
|
|
}
|
|
});
|
|
|
|
$(document).on('change','input[name="pminpostorder_ubezpieczenie"]', function(){
|
|
if ($('input[name="pminpostorder_ubezpieczenie"]:checked').val() == 0) {
|
|
$('#pminpostorder_ubezpieczenie_value').attr('disabled','disabled');
|
|
} else {
|
|
$('#pminpostorder_ubezpieczenie_value').removeAttr('disabled');
|
|
}
|
|
});
|
|
|
|
$(document).on('change','#pminpostorder_pobranie_value', function(){
|
|
$(this).val($(this).val().replace(',','.'));
|
|
});
|
|
|
|
$(document).on('change','#pminpostorder_ubezpieczenie_value', function(){
|
|
$(this).val($(this).val().replace(',','.'));
|
|
});
|
|
|
|
if (!$('.printlabel').is('.hidden')) {
|
|
disablePaczkomatyInputs();
|
|
}
|
|
|
|
//Config
|
|
function refreshConfigFields() {
|
|
if ($('#PMINPOSTPACZKOMATY_GGMAP').val() == 2) {
|
|
$('#PMINPOSTPACZKOMATY_GEO_on').parent().parent().parent().hide();
|
|
$('#PMINPOSTPACZKOMATY_MAP_TOKEN').parent().parent().show();
|
|
} else {
|
|
$('#PMINPOSTPACZKOMATY_MAP_TOKEN').parent().parent().hide();
|
|
$('#PMINPOSTPACZKOMATY_GEO_on').parent().parent().parent().show();
|
|
}
|
|
}
|
|
|
|
$(document).on('click', '#pminpostpaczkomaty-organization-id-set', function(e) {
|
|
e.preventDefault();
|
|
$('#PMINPOSTPACZKOMATY_ID').val($(this).text());
|
|
$.growl.notice({ title: '', message: sprintf(pm_inpostpaczkomaty_label_id, $(this).text()) });
|
|
});
|
|
|
|
$(document).on('click','.module_tab', function(e) {
|
|
e.preventDefault();
|
|
$('#configContainer').find($(this).data('target')).show();
|
|
$('#selected_menu').val(($(this).index()));
|
|
$.each($(this).siblings(), function(){
|
|
$('#configContainer').find($(this).data('target')).hide();
|
|
});
|
|
$(this).addClass('active').siblings().removeClass('active');
|
|
return false;
|
|
});
|
|
|
|
$(document).on('click', '.expand_raben', function(e) {
|
|
e.preventDefault();
|
|
let target = $(this).data('target');
|
|
if($('.'+target).toggle().is(':visible')) {
|
|
$(this).find('i').addClass('icon-angle-double-up').removeClass('icon-angle-double-down').html(' '+label_unexpand);
|
|
} else {
|
|
$(this).find('i').addClass('icon-angle-double-down').removeClass('icon-angle-double-up').html(' '+label_expand);
|
|
}
|
|
return false;
|
|
});
|
|
|
|
$(document).on('change','#PMINPOSTPACZKOMATY_SHIPPING_METHOD',function(){ // Hide machine list
|
|
if ($(this).val() == 1) {
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').parent().parent().show();
|
|
} else {
|
|
$('#PMINPOSTPACZKOMATY_MACHINE').parent().parent().hide();
|
|
}
|
|
});
|
|
|
|
$(document).on('change','#PMINPOSTPACZKOMATY_GGMAP',function(){ // Hide machine list
|
|
refreshConfigFields();
|
|
});
|
|
|
|
$(document).on('change','#PMINPOSTPACZKOMATY_LABEL_FORMAT',function(){ // Hide format list
|
|
if ($(this).val() == 'Pdf') {
|
|
$('#PMINPOSTPACZKOMATY_LABEL_SIZE').parent().parent().show();
|
|
} else {
|
|
$('#PMINPOSTPACZKOMATY_LABEL_SIZE').parent().parent().hide();
|
|
}
|
|
});
|
|
|
|
$(document).on('click', 'button[name="CREATE_DELIVERY_METHOD"]', function(){
|
|
if ($(this).is('.submit')){
|
|
$(this).removeClass('submit');
|
|
return true;
|
|
} else if ($(this).is('.nosubmit')) {
|
|
$(this).removeClass('nosubmit');
|
|
return false;
|
|
} else {
|
|
let t = this;
|
|
$.confirm({
|
|
title: '',
|
|
content: pm_inpostpaczkomaty_create_text,
|
|
buttons: {
|
|
custom: {
|
|
text: pm_inpostpaczkomaty_create,
|
|
btnClass: 'btn-blue',
|
|
action: function() {
|
|
$(t).addClass('submit');
|
|
$(t).click();
|
|
}
|
|
},
|
|
cancel: {
|
|
text: pm_inpostpaczkomaty_cancel,
|
|
action: function() {
|
|
$(t).addClass('nosubmit');
|
|
$(t).click();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
})
|
|
|
|
$(document).on('click','#PMINPOSTPACZKOMATY_SHIPX_on',function(){ // show shipx
|
|
$('#PMINPOSTPACZKOMATY_PASSWORD').parent().parent().hide();
|
|
$('#PMINPOSTPACZKOMATY_LOGIN').parent().parent().hide();
|
|
$('#PMINPOSTPACZKOMATY_ID').parent().parent().show();
|
|
$('#PMINPOSTPACZKOMATY_TOKEN').parent().parent().show();
|
|
});
|
|
|
|
$(document).on('click','#PMINPOSTPACZKOMATY_SHIPX_off',function(){ // hide shipx
|
|
$('#PMINPOSTPACZKOMATY_PASSWORD').parent().parent().show();
|
|
$('#PMINPOSTPACZKOMATY_LOGIN').parent().parent().show();
|
|
$('#PMINPOSTPACZKOMATY_ID').parent().parent().hide();
|
|
$('#PMINPOSTPACZKOMATY_TOKEN').parent().parent().hide();
|
|
});
|
|
|
|
|
|
$(document).on('click','.refresh_all_packages', function(){
|
|
let change_state = $(this).index()-1;
|
|
$.each($('.refresh_status'),function(){
|
|
let t = this;
|
|
let urlpost = $(this).attr('href')+'&change_order_state='+change_state.toString();
|
|
let last = $(this).html();
|
|
$(this).html('<img src="../modules/pminpostpaczkomaty/views/img/throbber.gif">');
|
|
$.ajax({
|
|
url: urlpost,
|
|
dataType: 'JSON',
|
|
success: function(s) {
|
|
if (s.error) {
|
|
$(t).html(last);
|
|
} else {
|
|
$(t).html(s.status);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
$(document).on('click','.btnpaczkomaty-size', function(){
|
|
if ($(this).find('input').is(':disabled')) {
|
|
return true
|
|
} else {
|
|
$('.btnpaczkomaty-size').find('input').attr('checked', false);
|
|
$('.btnpaczkomaty-size').removeClass('active');
|
|
$(this).addClass('active');
|
|
$(this).find('input[type="radio"]').prop("checked", true);
|
|
}
|
|
|
|
return true;
|
|
});
|
|
|
|
$(document).on('change', '#pminpostorder_format', function(){
|
|
if ($(this).val() != 'Pdf') {
|
|
$('#pminpostorder_size_l').attr('disabled', 'disabled');
|
|
} else {
|
|
$('#pminpostorder_size_l').removeAttr('disabled');
|
|
}
|
|
});
|
|
|
|
$(document).on('click', '.print-package-label', function(){
|
|
window.location.href = $(this).attr('href')+'&format='+$('#pminpostorder_format').val()+'&size_l='+$('#pminpostorder_size_l').val();
|
|
return false;
|
|
})
|
|
|
|
assignEvents();
|
|
if (typeof(_PS_VERSION_) != 'undefined' && (_PS_VERSION_ == '1.7.8.1' || parseInt(_PS_VERSION_.replaceAll('.','')) >= 1780 || _PS_VERSION_.toString()[0] == '8')) {
|
|
$('.paczkomaty-form').find('.col-lg-4,.col-lg-8').css('display','inline-block');
|
|
$('.paczkomaty-form').find('.col-lg-4').css('text-align', 'right').css('font-weight', 'bold');
|
|
$('.paczkomaty-form').find('.col-lg-8').css('float','right');
|
|
$('.paczkomaty-form').find('.col-lg-8').find('.switch label').css('left','0px').css('position', 'absolute');
|
|
$('.paczkomaty-form').find('.col-lg-8').find('.switch input, .switch a').css('left','0px').css('position', 'absolute');;
|
|
}
|
|
// if (_PS_VERSION_[0] == 8) {
|
|
// $('.paczkomaty-form .form-wrapper').css('width','100%');
|
|
// }
|
|
}); |