* Fix batch edit products in program product page.

This commit is contained in:
dingguodong
2023-07-26 14:17:10 +08:00
parent e06ed6682d
commit 01decb02f8
2 changed files with 29 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
/**
* Submit data to product batch edit page by html form while click on the batch edit button.
*/
window.onClickBatchEdit = function(event)
{
const checkedList = zui.DTable.query(event.target).$.getChecks();
if(!checkedList.length) return;
const formData = new FormData();
checkedList.forEach(function(id)
{
formData.append('productIDList[]', id);
});
postAndLoadPage($(event.target.closest('button')).data('url'), formData, '', {app: 'product'});
};
+12 -1
View File
@@ -37,7 +37,18 @@ $products = initTableData($products, $cols, $this->product);
foreach($products as $product) $data[] = $this->product->formatDataForList($product, $users, $usersAvatar);
$summary = sprintf($lang->product->pageSummary, count($data));
$footToolbar = common::hasPriv('product', 'batchEdit') ? array('items' => array(array('text' => $lang->edit, 'class' => 'btn batch-btn size-sm primary', 'data-url' => $this->createLink('product', 'batchEdit', "programID={$programID}")))) : null;
$footToolbar = common::hasPriv('product', 'batchEdit') ?
array(
'items' => array(
array(
'text' => $lang->edit,
'class' => 'btn secondary toolbar-item size-sm',
'data-url' => $this->createLink('product', 'batchEdit', "programID={$programID}"),
'onClick' => jsRaw('window.onClickBatchEdit')
)
)
) :
null;
dtable
(