first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
@CHARSET "UTF-8";
.dpd-hidden {
display: none;
}
.dpd-package {
}
.dpd-dimensions label {
display: block;
}
.dpd-dimensions p, .dpd-dimensions p label {
display: inline;
}
.dpd-dimensions p.form-row input {
width: 50px;
}
.dpd-button-add {
float: right;
}
.dpd-button-add-package {
float: right;
}
.dpd-button-delete, .dpd-button-delete-created {
color: #a00;
vertical-align: top;
float: right;
font-size: 13px;
line-height: 26px;
height: 28px;
margin: 0;
padding: 0 10px 1px;
cursor: pointer;
}
.dpd-button-delete-package {
color: #a00;
float: right;
font-size: 13px;
line-height: 26px;
height: 28px;
margin: 0;
padding: 0 10px 1px;
cursor: pointer;
}
.dpd-spinner {
float: none;
}
.dpd_error {
color: red;
margin: 0 4px 2px 0;
cursor: pointer;
}
a.dpd_error {
color: red;
margin: 0 4px 2px 0;
cursor: pointer;
}
.dpd-print-message {
display: block;
margin: 10px 0px 10px 0px;
}
.flexible_shipping_shipment_content span.optional {
display: none;
}

View File

@@ -0,0 +1 @@
@CHARSET "UTF-8";.dpd-hidden{display:none}.dpd-dimensions label{display:block}.dpd-dimensions p,.dpd-dimensions p label{display:inline}.dpd-dimensions p.form-row input{width:50px}.dpd-button-add{float:right}.dpd-button-add-package{float:right}.dpd-button-delete,.dpd-button-delete-created{color:#a00;vertical-align:top;float:right;font-size:13px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer}.dpd-button-delete-package{color:#a00;float:right;font-size:13px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer}.dpd-spinner{float:none}.dpd_error{color:red;margin:0 4px 2px 0;cursor:pointer}a.dpd_error{color:red;margin:0 4px 2px 0;cursor:pointer}.dpd-print-message{display:block;margin:10px 0 10px 0}.flexible_shipping_shipment_content span.optional{display:none}

View File

@@ -0,0 +1,34 @@
#dpd_popup {
position: fixed;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 100000;
display: none;
left: 0;
top: 0;
}
#dpd_popup > a {
position: absolute;
right: 30px;
color: white;
top: 20px;
}
#dpd_map {
position: fixed;
z-index: 100001;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
height: 80%;
border: none;
}
@media screen and (max-width: 768px) {
#dpd_map {
width: 90%;
}
}

View File

@@ -0,0 +1 @@
#dpd_popup{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.8);z-index:100000;display:none;left:0;top:0}#dpd_popup>a{position:absolute;right:30px;color:#fff;top:20px}#dpd_map{position:fixed;z-index:100001;top:50%;left:50%;transform:translate(-50%,-50%);width:50%;height:80%;border:none}@media screen and (max-width:768px){#dpd_map{width:90%}}

View File

@@ -0,0 +1,214 @@
jQuery(document).on('click','.dpd-button-add-package', function() {
var count = jQuery(this).attr('data-count');
if ( typeof count != 'undefined' ) {
var count_additional = parseInt(jQuery(this).attr('data-count_additional')) + 1;
jQuery(this).attr('data-count_additional', count_additional);
var html = jQuery('#dpd_additional_package_template_' + count).html()
html = html.split('_additional_key_').join(count_additional);
html = html.split('_count_').join(count);
jQuery(this).parent().before(html);
}
var id = jQuery(this).attr('data-id');
if ( typeof id != 'undefined' ) {
var count_additional = parseInt(jQuery(this).attr('data-count_additional')) + 1;
jQuery(this).attr('data-count_additional', count_additional);
var html = jQuery('#dpd_additional_package_template_' + id).html()
html = html.split('_additional_key_').join(count_additional);
html = html.split('_count_').join(count);
jQuery(this).parent().before(html);
}
})
jQuery(document).on('click','.dpd-button-delete-package', function() {
if ( jQuery(this).attr('disabled') == 'disabled' ) {
return;
}
jQuery(this).parent().remove();
})
jQuery(document).on('click','.dpd-button-delete-created', function( e ) {
var count = jQuery(this).attr('data-count');
if ( typeof count != 'undefined' ) {
if (jQuery(this).attr('disabled') == 'disabled') {
return;
}
jQuery('.dpd-button').attr('disabled', 'disabled');
jQuery(this).parent().find('.spinner').css({visibility: 'visible'});
var count = jQuery(this).attr('data-count');
dpd_ajax('delete_created_package', count);
}
var id = jQuery(this).attr('data-id');
if ( typeof id != 'undefined' ) {
e.stopImmediatePropagation();
e.preventDefault();
var id = fs_id(this);
var fs_action = 'cancel';
fs_ajax( this, id, fs_action );
}
})
jQuery(document).on('click','.dpd-button-create', function(e) {
var count = jQuery(this).attr('data-count');
if ( typeof count != 'undefined' ) {
if (jQuery(this).attr('disabled') == 'disabled') {
return;
}
jQuery('.dpd-button').attr('disabled', 'disabled');
jQuery(this).parent().find('.spinner').css({visibility: 'visible'});
dpd_ajax('create_package', count);
}
var id = jQuery(this).attr('data-id');
if ( typeof id != 'undefined' ) {
e.stopImmediatePropagation();
e.preventDefault();
var id = fs_id(this);
var fs_action = 'send';
fs_ajax( this, id, fs_action );
}
})
jQuery(document).on('click','.dpd-button-save', function(e) {
var count = jQuery(this).attr('data-count');
if ( typeof count != 'undefined' ) {
if (jQuery(this).attr('disabled') == 'disabled') {
return;
}
jQuery('.dpd-button').attr('disabled', 'disabled');
jQuery(this).parent().find('.spinner').css({visibility: 'visible'});
var count = jQuery(this).attr('data-count');
dpd_ajax('save_package', count);
}
var id = jQuery(this).attr('data-id');
if ( typeof id != 'undefined' ) {
e.stopImmediatePropagation();
e.preventDefault();
var id = fs_id(this);
var fs_action = 'save';
fs_ajax( this, id, fs_action );
}
})
jQuery(document).on('click','.dpd-button-delete', function() {
if ( jQuery(this).attr('disabled') == 'disabled' ) {
return;
}
jQuery('.dpd-button').attr('disabled','disabled');
jQuery(this).parent().find('.spinner').css({visibility: 'visible'});
var count = jQuery(this).attr('data-count');
dpd_ajax( 'delete_package', count );
})
jQuery(document).on('click','.dpd-button-print', function() {
if ( jQuery(this).attr('disabled') == 'disabled' ) {
return;
}
jQuery('.dpd-button').attr('disabled','disabled');
jQuery(this).parent().find('.spinner').css({visibility: 'visible'});
var count = jQuery(this).attr('data-count');
var ajax_data = {
'action' : 'wpdesk_dpd',
'dpd_action' : 'print_label',
'security' : jQuery("#dpd_ajax_nonce").val(),
'post_id' : jQuery("input[name=post_id]").val(),
'shipment_id' : jQuery(this).attr('data-shipment-id'),
'key' : jQuery("#dpd_"+count+"_key").val(),
};
jQuery.ajax({
url : dpd_ajax_object.ajax_url,
data : ajax_data,
method : 'POST',
dataType: 'JSON',
success: function( data ) {
jQuery('#print_message_' + data.post.shipment_id).html(data.message);
},
error: function ( xhr, ajaxOptions, thrownError ) {
alert( xhr.status + ': ' + thrownError );
},
complete: function() {
jQuery('.dpd-button').removeAttr('disabled','disabled');
jQuery('.dpd-spinner').css({visibility: 'hidden'});
}
});
})
jQuery(document).on('click','.dpd-button-label', function() {
var shipment_id = jQuery(this).attr('data-shipment-id');
var url = dpd_ajax_object.ajax_url + '?action=wpdesk_dpd&dpd_action=get_label&security=' + jQuery("#dpd_ajax_nonce").val();
url = url + '&shipment_id=' + shipment_id;
url = url + '&post_id=' + jQuery("input[name=post_id]").val();
var count = jQuery(this).attr('data-count');
url = url + '&key=' + jQuery("#dpd_"+count+"_key").val(),
window.open( url, '_blank');
})
jQuery(document).on('change','.dpd-product', function() {
})
jQuery(document).on('change','.dpd-declared_value', function() {
if ( jQuery(this).is(':checked') ) {
jQuery(this).closest('.dpd-package').find('.dpd-declared_value-value').show();
}
else {
jQuery(this).closest('.dpd-package').find('.dpd-declared_value-value').hide();
}
})
jQuery(document).on('change','.dpd-cod', function() {
if ( jQuery(this).is(':checked') ) {
jQuery(this).closest('.dpd-package').find('.dpd-cod-value').show();
}
else {
jQuery(this).closest('.dpd-package').find('.dpd-cod-value').hide();
}
})
jQuery(document).on('change','.dpd-pickup', function() {
if ( jQuery(this).is(':checked') ) {
jQuery(this).closest('.dpd-package').find('.dpd-pickup-value').show();
}
else {
jQuery(this).closest('.dpd-package').find('.dpd-pickup-value').hide();
}
})
function dpd_init() {
jQuery('.dpd-product').each(function(){
jQuery(this).change();
})
jQuery('.dpd-disabled').each(function(){
jQuery(this).prop('disabled',true);
})
jQuery('.dpd-declared_value').each(function(){
jQuery(this).change();
})
jQuery('.dpd-cod').each(function(){
jQuery(this).change();
})
jQuery('.dpd-pickup').each(function(){
jQuery(this).change();
})
}
dpd_init();

View File

@@ -0,0 +1,30 @@
jQuery(document).on('click','.dpd-button-add-package',function(){var count=jQuery(this).attr('data-count');if(typeof count!='undefined'){var count_additional=parseInt(jQuery(this).attr('data-count_additional'))+1;jQuery(this).attr('data-count_additional',count_additional);var html=jQuery('#dpd_additional_package_template_'+count).html()
html=html.split('_additional_key_').join(count_additional);html=html.split('_count_').join(count);jQuery(this).parent().before(html)}
var id=jQuery(this).attr('data-id');if(typeof id!='undefined'){var count_additional=parseInt(jQuery(this).attr('data-count_additional'))+1;jQuery(this).attr('data-count_additional',count_additional);var html=jQuery('#dpd_additional_package_template_'+id).html()
html=html.split('_additional_key_').join(count_additional);html=html.split('_count_').join(count);jQuery(this).parent().before(html)}})
jQuery(document).on('click','.dpd-button-delete-package',function(){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery(this).parent().remove()})
jQuery(document).on('click','.dpd-button-delete-created',function(e){var count=jQuery(this).attr('data-count');if(typeof count!='undefined'){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery('.dpd-button').attr('disabled','disabled');jQuery(this).parent().find('.spinner').css({visibility:'visible'});var count=jQuery(this).attr('data-count');dpd_ajax('delete_created_package',count)}
var id=jQuery(this).attr('data-id');if(typeof id!='undefined'){e.stopImmediatePropagation();e.preventDefault();var id=fs_id(this);var fs_action='cancel';fs_ajax(this,id,fs_action)}})
jQuery(document).on('click','.dpd-button-create',function(e){var count=jQuery(this).attr('data-count');if(typeof count!='undefined'){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery('.dpd-button').attr('disabled','disabled');jQuery(this).parent().find('.spinner').css({visibility:'visible'});dpd_ajax('create_package',count)}
var id=jQuery(this).attr('data-id');if(typeof id!='undefined'){e.stopImmediatePropagation();e.preventDefault();var id=fs_id(this);var fs_action='send';fs_ajax(this,id,fs_action)}})
jQuery(document).on('click','.dpd-button-save',function(e){var count=jQuery(this).attr('data-count');if(typeof count!='undefined'){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery('.dpd-button').attr('disabled','disabled');jQuery(this).parent().find('.spinner').css({visibility:'visible'});var count=jQuery(this).attr('data-count');dpd_ajax('save_package',count)}
var id=jQuery(this).attr('data-id');if(typeof id!='undefined'){e.stopImmediatePropagation();e.preventDefault();var id=fs_id(this);var fs_action='save';fs_ajax(this,id,fs_action)}})
jQuery(document).on('click','.dpd-button-delete',function(){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery('.dpd-button').attr('disabled','disabled');jQuery(this).parent().find('.spinner').css({visibility:'visible'});var count=jQuery(this).attr('data-count');dpd_ajax('delete_package',count)})
jQuery(document).on('click','.dpd-button-print',function(){if(jQuery(this).attr('disabled')=='disabled'){return}
jQuery('.dpd-button').attr('disabled','disabled');jQuery(this).parent().find('.spinner').css({visibility:'visible'});var count=jQuery(this).attr('data-count');var ajax_data={'action':'wpdesk_dpd','dpd_action':'print_label','security':jQuery("#dpd_ajax_nonce").val(),'post_id':jQuery("input[name=post_id]").val(),'shipment_id':jQuery(this).attr('data-shipment-id'),'key':jQuery("#dpd_"+count+"_key").val(),};jQuery.ajax({url:dpd_ajax_object.ajax_url,data:ajax_data,method:'POST',dataType:'JSON',success:function(data){jQuery('#print_message_'+data.post.shipment_id).html(data.message)},error:function(xhr,ajaxOptions,thrownError){alert(xhr.status+': '+thrownError)},complete:function(){jQuery('.dpd-button').removeAttr('disabled','disabled');jQuery('.dpd-spinner').css({visibility:'hidden'})}})})
jQuery(document).on('click','.dpd-button-label',function(){var shipment_id=jQuery(this).attr('data-shipment-id');var url=dpd_ajax_object.ajax_url+'?action=wpdesk_dpd&dpd_action=get_label&security='+jQuery("#dpd_ajax_nonce").val();url=url+'&shipment_id='+shipment_id;url=url+'&post_id='+jQuery("input[name=post_id]").val();var count=jQuery(this).attr('data-count');url=url+'&key='+jQuery("#dpd_"+count+"_key").val(),window.open(url,'_blank')})
jQuery(document).on('change','.dpd-product',function(){})
jQuery(document).on('change','.dpd-declared_value',function(){if(jQuery(this).is(':checked')){jQuery(this).closest('.dpd-package').find('.dpd-declared_value-value').show()}else{jQuery(this).closest('.dpd-package').find('.dpd-declared_value-value').hide()}})
jQuery(document).on('change','.dpd-cod',function(){if(jQuery(this).is(':checked')){jQuery(this).closest('.dpd-package').find('.dpd-cod-value').show()}else{jQuery(this).closest('.dpd-package').find('.dpd-cod-value').hide()}})
jQuery(document).on('change','.dpd-pickup',function(){if(jQuery(this).is(':checked')){jQuery(this).closest('.dpd-package').find('.dpd-pickup-value').show()}else{jQuery(this).closest('.dpd-package').find('.dpd-pickup-value').hide()}})
function dpd_init(){jQuery('.dpd-product').each(function(){jQuery(this).change()})
jQuery('.dpd-disabled').each(function(){jQuery(this).prop('disabled',!0)})
jQuery('.dpd-declared_value').each(function(){jQuery(this).change()})
jQuery('.dpd-cod').each(function(){jQuery(this).change()})
jQuery('.dpd-pickup').each(function(){jQuery(this).change()})}
dpd_init()

View File

@@ -0,0 +1,47 @@
function dpd_choosen_point( pointID ) {
jQuery( '.js--popup-dpd' ).hide();
let $field = jQuery( '#dpd_pickup_point_id' );
if ( $field.find( 'option[value="' + pointID + '"]' ).length === 0 ) {
$field.append( '<option value="' + pointID + '">' + pointID + '</option>' );
$field.val( pointID );
} else {
$field.val( pointID ).trigger( 'change' );
}
jQuery('body').trigger('update_checkout');
}
( function ( $ ) {
var body = $( 'body' );
body.on(
'click',
'.js--choose-point-dpd',
function () {
var popup = $( '.js--popup-dpd' );
if ( ! popup.length ) {
var map_url = new URL( __jsDpdVars.map_url );
map_url.searchParams.append( 'direct_delivery_cod', $( this ).attr( 'data-direct_delivery_cod' ) );
var close_button = $( '<a></a>' ).attr( 'href', '#0' ).text( __jsDpdVars.l10n.close_popup ).addClass( 'js--popup-close-button-dpd' );
var iframe = $( '<iframe>' ).attr( 'id', 'dpd_map' ).attr( 'src', map_url )
popup = $( '<div></div>' ).attr( 'id', 'dpd_popup' ).addClass( 'js--popup-dpd' ).append( close_button ).append( iframe );
$( '.js--popup-container-dpd' ).html( popup );
}
popup.show();
return false;
}
);
body.on(
'click',
'.js--popup-close-button-dpd',
function () {
$( '.js--popup-dpd' ).hide();
return false;
}
);
} )( jQuery );

View File

@@ -0,0 +1,4 @@
function dpd_choosen_point(pointID){jQuery('.js--popup-dpd').hide();let $field=jQuery('#dpd_pickup_point_id');if($field.find('option[value="'+pointID+'"]').length===0){$field.append('<option value="'+pointID+'">'+pointID+'</option>');$field.val(pointID)}else{$field.val(pointID).trigger('change')}
jQuery('body').trigger('update_checkout')}(function($){var body=$('body');body.on('click','.js--choose-point-dpd',function(){var popup=$('.js--popup-dpd');if(!popup.length){var map_url=new URL(__jsDpdVars.map_url);map_url.searchParams.append('direct_delivery_cod',$(this).attr('data-direct_delivery_cod'));var close_button=$('<a></a>').attr('href','#0').text(__jsDpdVars.l10n.close_popup).addClass('js--popup-close-button-dpd');var iframe=$('<iframe>').attr('id','dpd_map').attr('src',map_url)
popup=$('<div></div>').attr('id','dpd_popup').addClass('js--popup-dpd').append(close_button).append(iframe);$('.js--popup-container-dpd').html(popup)}
popup.show();return!1});body.on('click','.js--popup-close-button-dpd',function(){$('.js--popup-dpd').hide();return!1})})(jQuery)