Skip to content

Commit

Permalink
Improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadNateqi committed Jan 28, 2025
1 parent 0763875 commit d48b7a5
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@ jQuery( function( $ ) {

$( document ).on( 'change', '.post-type-shop_order select[name="action"], .post-type-shop_order select[name="action2"], .woocommerce_page_wc-orders select[name="action"], .woocommerce_page_wc-orders select[name="action2"]', function ( e ) {
e.preventDefault();
let actionSelected = $( this ).val();
let actionSelected = $( this ).val();
const $emailSelection = $( '.wpo_bewc_email_selection' );


if ( 'wpo_bewc_send_email' === actionSelected ) {

// Move the element to the correct location if it's not.
if ( ! $( '.wpo_bewc_email_selection' ).parent().is( '.tablenav' ) ) {
$( '.wpo_bewc_email_selection' )
.insertAfter( '#wpbody-content .tablenav-pages' )
.css( {
'display': 'block',
'clear': 'left',
'padding-top': '6px',
} );
if ( ! $emailSelection.parent().is( '.tablenav' ) ) {
$emailSelection.insertAfter( '#wpbody-content .tablenav-pages' ).css( {
'display': 'block',
'clear': 'left',
'padding-top': '6px',
} );
}

$( '.wpo_bewc_email_selection' )
.show()
.closest( 'body' ).find( '.tablenav' ).css( {
'height': 'auto',
} );
$emailSelection.show().closest( 'body' ).find( '.tablenav' ).css( {
'height': 'auto',
} );
} else {
$( '.wpo_bewc_email_selection' ).hide().closest( 'body' ).find( '.tablenav' ).css( {
$emailSelection.hide().closest( 'body' ).find( '.tablenav' ).css( {
'height': 'initial',
} );
}
Expand Down

0 comments on commit d48b7a5

Please sign in to comment.