* Adjust for program module.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
/**
|
||||
* Submit data to product batch edit page by html form while click on the batch edit button.
|
||||
*/
|
||||
window.onClickBatchEdit = function(event)
|
||||
$(document).off('click', '[data-formaction]').on('click', '[data-formaction]', function()
|
||||
{
|
||||
const checkedList = zui.DTable.query(event.target).$.getChecks();
|
||||
|
||||
const $this = $(this);
|
||||
const dtable = zui.DTable.query($('#products'));
|
||||
const checkedList = dtable.$.getChecks();
|
||||
if(!checkedList.length) return;
|
||||
|
||||
const formData = new FormData();
|
||||
@@ -13,5 +14,10 @@ window.onClickBatchEdit = function(event)
|
||||
formData.append('productIDList[]', id);
|
||||
});
|
||||
|
||||
postAndLoadPage($(event.target.closest('button')).data('url'), formData, '', {app: 'program'});
|
||||
};
|
||||
postAndLoadPage($this.data('formaction'), formData);
|
||||
});
|
||||
|
||||
window.footerSummary = function(checkedIdList, pageSummary)
|
||||
{
|
||||
return {html: pageSummary};
|
||||
}
|
||||
|
||||
@@ -24,3 +24,8 @@ $(document).on('click', '.batch-btn', function()
|
||||
checkedList.forEach((id) => form.append('projectIdList[]', id));
|
||||
postAndLoadPage(url, form);
|
||||
});
|
||||
|
||||
window.footerSummary = function(checkedIdList, pageSummary)
|
||||
{
|
||||
return {html: pageSummary};
|
||||
}
|
||||
|
||||
@@ -37,30 +37,29 @@ $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(
|
||||
'type' => 'btn-group',
|
||||
'items' => array(
|
||||
array(
|
||||
'text' => $lang->edit,
|
||||
'btnType' => 'secondary size-sm',
|
||||
'data-url' => $this->createLink('product', 'batchEdit', "programID={$programID}"),
|
||||
'data-app' => $this->app->tab,
|
||||
'onClick' => jsRaw('window.onClickBatchEdit')
|
||||
)
|
||||
)
|
||||
) :
|
||||
null;
|
||||
$footToolbar = common::hasPriv('product', 'batchEdit') ? array(
|
||||
'type' => 'btn-group',
|
||||
'items' => array(
|
||||
array(
|
||||
'text' => $lang->edit,
|
||||
'className' => 'secondary size-sm batch-btn',
|
||||
'data-page' => 'batch',
|
||||
'data-app' => $this->app->tab,
|
||||
'data-formaction' => $this->createLink('product', 'batchEdit', "programID={$programID}")
|
||||
),
|
||||
)
|
||||
) : null;
|
||||
|
||||
dtable
|
||||
(
|
||||
setID('products'),
|
||||
set::userMap($users),
|
||||
set::cols($cols),
|
||||
set::data($data),
|
||||
set::nested(false),
|
||||
set::footToolbar($footToolbar),
|
||||
set::footPager(usePager()),
|
||||
set::footer(array('checkbox', 'toolbar', array('html' => $summary, 'className' => "text-dark"), 'flex', 'pager')),
|
||||
set::checkInfo(jsRaw("function(checkedIDList){ return window.footerSummary(checkedIDList, '{$summary}');}")),
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
@@ -64,7 +64,7 @@ dtable
|
||||
set::nested(false),
|
||||
set::footToolbar($footToolbar),
|
||||
set::footPager(usePager()),
|
||||
set::footer(array('checkbox', 'toolbar', array('html' => $summary, 'className' => "text-dark"), 'flex', 'pager')),
|
||||
set::checkInfo(jsRaw("function(checkedIDList){ return window.footerSummary(checkedIDList, '{$summary}');}")),
|
||||
);
|
||||
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user