Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions _dev/js/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ import $ from 'jquery';
import prestashop from 'prestashop';

function initRmaItemSelector() {
$(`${prestashop.themeSelectors.order.returnForm} table thead input[type=checkbox]`).on('click', function () {
const checked = $(this).prop('checked');
$(`${prestashop.themeSelectors.order.returnForm} table tbody input[type=checkbox]`).each((_, checkbox) => {
$(checkbox).prop('checked', checked);
});
$(prestashop.themeSelectors.order.returnFormCheckAll).on('click', function () {
$(prestashop.themeSelectors.order.returnFormCheckItem).prop('checked', this.checked);
});
}

Expand All @@ -40,4 +37,4 @@ function setupCustomerScripts() {
}
}

$(document).ready(setupCustomerScripts);
$(setupCustomerScripts);
3 changes: 2 additions & 1 deletion _dev/js/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ prestashop.themeSelectors = {
searchLink: '.js-search-link',
},
order: {
returnForm: '#order-return-form, .js-order-return-form',
returnFormCheckItem: '.js-order-return-check-item',
returnFormCheckAll: '.js-order-return-check-all',
},
arrowDown: '.arrow-down, .js-arrow-down',
arrowUp: '.arrow-up, .js-arrow-up',
Expand Down
12 changes: 10 additions & 2 deletions templates/customer/_partials/order-detail-return.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
<table id="order-products" class="table table-bordered return">
<thead class="thead-default">
<tr>
<th class="head-checkbox"><input type="checkbox"/></th>
<th class="head-checkbox">
<input type="checkbox" class="js-order-return-check-all">
</th>
<th>{l s='Product' d='Shop.Theme.Catalog'}</th>
<th>{l s='Quantity' d='Shop.Theme.Catalog'}</th>
<th>{l s='Returned' d='Shop.Theme.Customeraccount'}</th>
Expand All @@ -42,7 +44,13 @@
<td>
{if !$product.is_virtual}
<span id="_desktop_product_line_{$product.id_order_detail}">
<input type="checkbox" id="cb_{$product.id_order_detail}" name="ids_order_detail[{$product.id_order_detail}]" value="{$product.id_order_detail}">
<input
id="cb_{$product.id_order_detail}"
class="js-order-return-check-item"
name="ids_order_detail[{$product.id_order_detail}]"
type="checkbox"
value="{$product.id_order_detail}"
>
</span>
{/if}
</td>
Expand Down