Add new update package version 0.235 to autoload admin
This commit is contained in:
@@ -218,16 +218,48 @@ if ( $this -> next_order_id )
|
||||
];
|
||||
}
|
||||
$grid -> buttons[] = [
|
||||
'label' => 'Wyślij ponownie zamówienie do apilo.com',
|
||||
'url' => '/admin/shop_order/send_order_to_apilo/order_id=' . $this -> order['id'],
|
||||
'icon' => 'fa-refresh',
|
||||
'class' => 'btn btn-primary btn-sm mr5 ml5 pull-right btn-send-order-to-apilo'
|
||||
'label' => '',
|
||||
'url' => '#',
|
||||
'icon' => 'fa-ellipsis-v',
|
||||
'class' => 'btn btn-primary',
|
||||
'id' => 'integrationsDropdownBtn'
|
||||
];
|
||||
$grid -> default_buttons = false;
|
||||
$grid -> external_code = $out;
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
<div class="dropdown-menu dropdown-menu-right" id="integrationsDropdownMenu">
|
||||
<a class="dropdown-item btn-send-order-to-apilo" href="/admin/shop_order/send_order_to_apilo/order_id=<?= $this -> order['id'];?>">
|
||||
<i class="fa fa-refresh"></i> Wyślij ponownie zamówienie do apilo.com
|
||||
</a>
|
||||
<a class="dropdown-item btn-toggle-trustmate" href="#">
|
||||
<i class="fa fa-<?= $this -> order['trustmate_send'] ? 'times' : 'check';?>"></i>
|
||||
<?= $this -> order['trustmate_send'] ? 'Odznacz zamówienie jako wysłane do trustmate.io' : 'Zaznacz zamówienie jako wysłane do trustmate.io';?>
|
||||
</a>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$( function() {
|
||||
var btn = $( '#integrationsDropdownBtn' );
|
||||
var menu = $( '#integrationsDropdownMenu' );
|
||||
|
||||
// Opakuj przycisk w dropdown wrapper
|
||||
btn.wrap( '<div class="dropdown d-inline-block pull-right"></div>' );
|
||||
menu.appendTo( btn.parent() );
|
||||
|
||||
// Ręczna obsługa toggle dropdown
|
||||
btn.on( 'click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
menu.toggleClass( 'show' );
|
||||
});
|
||||
|
||||
// Zamknij dropdown po kliknięciu poza nim
|
||||
$( document ).on( 'click', function(e) {
|
||||
if ( !btn.is( e.target ) && !menu.is( e.target ) && menu.has( e.target ).length === 0 ) {
|
||||
menu.removeClass( 'show' );
|
||||
}
|
||||
});
|
||||
});
|
||||
$( function()
|
||||
{
|
||||
var timer = '';
|
||||
@@ -603,4 +635,54 @@ function order_status_change($order_id, $status, $email) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( 'body' ).on( 'click', '.btn-toggle-trustmate', function(e) {
|
||||
e.preventDefault();
|
||||
var currentState = <?= $this -> order['trustmate_send'] ? 'true' : 'false';?>;
|
||||
|
||||
$.alert({
|
||||
title: 'Potwierdź',
|
||||
content: currentState ? 'Czy na pewno chcesz odznaczyć zamówienie jako wysłane do trustmate.io?' : 'Czy na pewno chcesz zaznaczyć zamówienie jako wysłane do trustmate.io?',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-times',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
columnClass: 'col-12 col-lg-10',
|
||||
theme: 'modern',
|
||||
icon: 'fa fa-question',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Tak',
|
||||
btnClass: 'btn-success',
|
||||
keys: ['enter'],
|
||||
action: function() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/admin/shop_order/toggle_trustmate_send/',
|
||||
data: {
|
||||
order_id: <?= $this -> order['id'];?>
|
||||
},
|
||||
beforeSend: function() {
|
||||
$( '#overlay' ).show();
|
||||
},
|
||||
success: function( response ) {
|
||||
$( '#overlay' ).hide();
|
||||
var data = jQuery.parseJSON( response );
|
||||
if ( data.result === true ) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: 'Nie',
|
||||
btnClass: 'btn-dark',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user