Clean up total/subtotal display
This commit is contained in:
parent
01950bebdc
commit
3e4506c376
File diff suppressed because one or more lines are too long
|
@ -773,6 +773,29 @@ ul.wc_coupon_list_block {
|
|||
vertical-align:middle;
|
||||
font-size: 1em;
|
||||
}
|
||||
.split-input {
|
||||
display: block;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
||||
margin: 1px;
|
||||
width: 70px;
|
||||
input {
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
|
||||
-moz-box-sizing: border-box; /* Firefox, other Gecko */
|
||||
box-sizing: border-box; /* Opera/IE 8+ */
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
margin: 0;
|
||||
color: #555;
|
||||
background: transparent;
|
||||
}
|
||||
input:last-child {
|
||||
color: #bbb;
|
||||
border-top: 1px dashed #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
.quantity {
|
||||
text-align: center;
|
||||
|
|
|
@ -324,6 +324,16 @@ jQuery( function ( $ ) {
|
|||
} );
|
||||
}
|
||||
return false;
|
||||
})
|
||||
// Subtotal/total inputs
|
||||
.on( 'keyup', '.woocommerce_order_items .split-input input:eq(0)', function(){
|
||||
var $subtotal = $(this).next();
|
||||
if ( $subtotal.val() === '' || $subtotal.is('.match-total') ) {
|
||||
$subtotal.val( $(this).val() ).addClass('match-total');
|
||||
}
|
||||
})
|
||||
.on( 'keyup', '.woocommerce_order_items .split-input input:eq(0)', function(){
|
||||
$(this).removeClass('match-total');
|
||||
});
|
||||
|
||||
$( '#woocommerce-order-items' )
|
||||
|
@ -600,7 +610,7 @@ jQuery( function ( $ ) {
|
|||
order_id: woocommerce_admin_meta_boxes.post_id,
|
||||
security: woocommerce_admin_meta_boxes.order_item_nonce
|
||||
};
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: woocommerce_admin_meta_boxes.ajax_url,
|
||||
data: data,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php echo ( isset( $item['line_total'] ) ) ? wc_price( wc_round_tax_total( $item['line_total'] ) ) : ''; ?>
|
||||
</div>
|
||||
<div class="edit" style="display: none;">
|
||||
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : ''; ?>" class="line_total wc_input_price" /></label>
|
||||
<input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : ''; ?>" class="line_total wc_input_price" />
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -168,10 +168,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="edit" style="display: none;">
|
||||
<span class="subtotal"><label><?php _e( 'Subtotal', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'Before pre-tax discounts.', 'woocommerce' ); ?>" href="#">[?]</a> <input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_subtotal'] ) ) ? esc_attr( wc_format_localized_price( $item['line_subtotal'] ) ) : ''; ?>" class="line_subtotal wc_input_price" /></label></span>
|
||||
|
||||
<label><?php _e( 'Total', 'woocommerce' ); ?>: <a class="tips" data-tip="<?php _e( 'After pre-tax discounts.', 'woocommerce' ); ?>" href="#">[?]</a> <input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : ''; ?>" class="line_total wc_input_price" /></label>
|
||||
<div class="edit" style="display: block;">
|
||||
<div class="split-input">
|
||||
<input type="text" name="line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['line_total'] ) ) ? esc_attr( wc_format_localized_price( $item['line_total'] ) ) : ''; ?>" class="line_total wc_input_price tips" data-tip="<?php _e( 'After pre-tax discounts.', 'woocommerce' ); ?>" />
|
||||
<input type="text" name="line_subtotal[<?php echo absint( $item_id ); ?>]" value="<?php echo ( isset( $item['line_subtotal'] ) ) ? esc_attr( wc_format_localized_price( $item['line_subtotal'] ) ) : ''; ?>" class="line_subtotal wc_input_price tips" data-tip="<?php _e( 'Before pre-tax discounts.', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
@ -202,9 +203,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
?>
|
||||
</div>
|
||||
<div class="edit" style="display: none;">
|
||||
<span class="subtotal"><input type="text" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>][<?php echo absint( $tax_item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $tax_item_subtotal ) ) ? esc_attr( wc_format_localized_price( $tax_item_subtotal ) ) : ''; ?>" class="line_subtotal_tax wc_input_price" /></span>
|
||||
|
||||
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>][<?php echo absint( $tax_item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $tax_item_total ) ) ? esc_attr( wc_format_localized_price( $tax_item_total ) ) : ''; ?>" class="line_tax wc_input_price" />
|
||||
<div class="split-input">
|
||||
<input type="text" name="line_tax[<?php echo absint( $item_id ); ?>][<?php echo absint( $tax_item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $tax_item_total ) ) ? esc_attr( wc_format_localized_price( $tax_item_total ) ) : ''; ?>" class="line_tax wc_input_price tips" data-tip="<?php _e( 'After pre-tax discounts.', 'woocommerce' ); ?>" />
|
||||
<input type="text" name="line_subtotal_tax[<?php echo absint( $item_id ); ?>][<?php echo absint( $tax_item_id ); ?>]" value="<?php echo ( isset( $tax_item_subtotal ) ) ? esc_attr( wc_format_localized_price( $tax_item_subtotal ) ) : ''; ?>" class="line_subtotal_tax wc_input_price tips" data-tip="<?php _e( 'Before pre-tax discounts.', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php echo ( isset( $item['cost'] ) ) ? wc_price( wc_round_tax_total( $item['cost'] ) ) : ''; ?>
|
||||
</div>
|
||||
<div class="edit" style="display: none;">
|
||||
<label><?php _e( 'Total', 'woocommerce' ); ?>: <input type="text" name="shipping_cost[<?php echo $item_id; ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['cost'] ) ) ? esc_attr( wc_format_localized_price( $item['cost'] ) ) : ''; ?>" class="line_total wc_input_price" /></label>
|
||||
<input type="text" name="shipping_cost[<?php echo $item_id; ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $item['cost'] ) ) ? esc_attr( wc_format_localized_price( $item['cost'] ) ) : ''; ?>" class="line_total wc_input_price" />
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
|
Loading…
Reference in New Issue