diff --git a/.gitignore b/.gitignore index 799075b..805e9d5 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ composer.lock /packages/* !/packages/README.md /composer.lock +.phpunit.result.cache diff --git a/assets/css/admin.scss b/assets/css/admin.scss index daa8197..f7aae6b 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -671,6 +671,7 @@ tbody.packaging_list { border-radius: 3px; display: inline-flex; white-space: nowrap; + max-width: 100%; &.status-draft, &.status-processing, &.status-requested, &.status-partially-shipped, &.status-partially-delivered, &.status-open, &.status-partially-returned { background: #f8dda7; @@ -691,6 +692,11 @@ tbody.packaging_list { background: #f8dda7; color: #94660c; } + + > span { + overflow: hidden; + text-overflow: ellipsis; + } } a.button.wc-stc-shipment-action-button { diff --git a/assets/js/blocks/checkout-pickup-location-select/index.js b/assets/js/blocks/checkout-pickup-location-select/index.js index f6f2341..0b74b59 100644 --- a/assets/js/blocks/checkout-pickup-location-select/index.js +++ b/assets/js/blocks/checkout-pickup-location-select/index.js @@ -1 +1,2 @@ -import './slotfills/pickup-location-select'; \ No newline at end of file +import './slotfills/pickup-location-select'; +import './set-payment-method'; \ No newline at end of file diff --git a/assets/js/blocks/checkout-pickup-location-select/set-payment-method.js b/assets/js/blocks/checkout-pickup-location-select/set-payment-method.js new file mode 100644 index 0000000..a3c0c7b --- /dev/null +++ b/assets/js/blocks/checkout-pickup-location-select/set-payment-method.js @@ -0,0 +1,38 @@ +import { registerPlugin } from "@wordpress/plugins"; +import { useEffect, useState, useCallback, useRef } from '@wordpress/element'; +import { useSelect } from '@wordpress/data'; +import { extensionCartUpdate } from '@woocommerce/blocks-checkout'; +import _ from 'lodash'; +import { PAYMENT_STORE_KEY } from '@woocommerce/block-data'; + +const render = () => { + const { + currentPaymentMethod + } = useSelect( ( select ) => { + const paymentStore = select( PAYMENT_STORE_KEY ); + + return { + currentPaymentMethod: paymentStore.getActivePaymentMethod(), + } + } ); + + useEffect( () => { + if ( currentPaymentMethod ) { + extensionCartUpdate( { + namespace: 'woocommerce-shiptastic-set-payment-method', + data: { + 'active_method': currentPaymentMethod, + }, + } ); + } + }, [ + currentPaymentMethod + ] ); + + return null; +}; + +registerPlugin( 'woocommerce-shiptastic-set-payment-method', { + render, + scope: 'woocommerce-checkout', +} ); \ No newline at end of file diff --git a/assets/js/static/admin-shipment.js b/assets/js/static/admin-shipment.js index 7c2e489..6c5c534 100644 --- a/assets/js/static/admin-shipment.js +++ b/assets/js/static/admin-shipment.js @@ -402,8 +402,6 @@ window.shiptastic.admin = window.shiptastic.admin || {}; }; this.onAddItemSuccess = function( data ) { - this.getShipmentContent().find( '.shipment-item-list' ).append( data.new_item ); - this.refreshDom(); this.unblockItems(); }; diff --git a/assets/js/static/admin-shipments-table.js b/assets/js/static/admin-shipments-table.js index ab64c3c..cb76c23 100644 --- a/assets/js/static/admin-shipments-table.js +++ b/assets/js/static/admin-shipments-table.js @@ -37,7 +37,6 @@ window.shiptastic.admin = window.shiptastic.admin || {}; }); if ( self.params.bulk_actions.hasOwnProperty( action ) && ids.length > 0 ) { - var actionData = self.params.bulk_actions[ action ]; $( '.bulk-action-wrapper' ).find( '.bulk-title' ).text( actionData['title'] ); @@ -63,6 +62,7 @@ window.shiptastic.admin = window.shiptastic.admin || {}; bulk_action : action, step : step, type : type, + referer : window.location.href, ids : ids, security : actionData['nonce'] }, diff --git a/assets/js/static/admin-shipping-provider-method.js b/assets/js/static/admin-shipping-provider-method.js index fa309d6..585f7c0 100644 --- a/assets/js/static/admin-shipping-provider-method.js +++ b/assets/js/static/admin-shipping-provider-method.js @@ -20,7 +20,7 @@ window.shiptastic.admin = window.shiptastic.admin || {}; .on( 'change', 'select[id$=shipping_provider]', self.showOrHideAll ) .on( 'click', '.wc-stc-shipping-provider-method-tabs .nav-tab-wrapper a.nav-tab', self.onChangeTab ) .on( 'change', '.override-checkbox :input', self.onChangeOverride ) - .on( 'change', '.wc-gzd-shipping-provider-method-tab-content :input[id]', self.onChangeInput ); + .on( 'change', '.wc-stc-shipping-provider-method-tab-content :input[id]', self.onChangeInput ); $( document.body ).on( 'wc_backbone_modal_loaded', self.onShippingMethodOpen ); @@ -65,6 +65,7 @@ window.shiptastic.admin = window.shiptastic.admin || {}; if ( $tab.length > 0 ) { $navTab.addClass( 'nav-tab-active' ); $tab.addClass( 'tab-content-active' ); + $tab.find( ':input:visible' ).trigger( 'change' ); } diff --git a/includes/admin/views/html-order-add-return-shipment-items.php b/includes/admin/views/html-order-add-return-shipment-items.php index 2b9a44a..685d6eb 100644 --- a/includes/admin/views/html-order-add-return-shipment-items.php +++ b/includes/admin/views/html-order-add-return-shipment-items.php @@ -6,7 +6,7 @@ ?>
get_available_items_for_return() as $item_id => $item_data ) : +foreach ( $order_shipment->get_selectable_items_for_return() as $item_id => $item_data ) : ?>