mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add more filtering possibilities with order helper
This commit is contained in:
@@ -532,14 +532,18 @@ final class SingleTaskController extends AbstractController
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
||||
$filterOrder = $this->buildFilterOrder();
|
||||
$flags = \array_merge(
|
||||
$filterOrder->getCheckboxData('status'),
|
||||
\array_map(fn ($i) => 'state_'.$i, $filterOrder->getCheckboxData('states'))
|
||||
);
|
||||
$nb = $this->singleTaskAclAwareRepository->countByCurrentUsersTasks(
|
||||
$filterOrder->getQueryString(),
|
||||
$filterOrder->getCheckbox('status')
|
||||
$flags
|
||||
);
|
||||
$paginator = $this->paginatorFactory->create($nb);
|
||||
$tasks = $this->singleTaskAclAwareRepository->findByCurrentUsersTasks(
|
||||
$filterOrder->getQueryString(),
|
||||
$filterOrder->getCheckbox('status'),
|
||||
$flags,
|
||||
$paginator->getCurrentPageFirstItemNumber(),
|
||||
$paginator->getItemsPerPage()
|
||||
);
|
||||
@@ -555,14 +559,19 @@ final class SingleTaskController extends AbstractController
|
||||
{
|
||||
$statuses = ['no-alert', 'warning', 'alert'];
|
||||
$statusTrans = [
|
||||
'Tasks without alert',
|
||||
'Tasks near deadline',
|
||||
'Tasks over deadline',
|
||||
'Tasks without alert',
|
||||
];
|
||||
$states = [
|
||||
// todo: get a list of possible states dynamically
|
||||
'new', 'in_progress', 'closed', 'canceled'
|
||||
];
|
||||
return $this->filterOrderHelperFactory
|
||||
->create(self::class)
|
||||
->addSearchBox()
|
||||
->addCheckbox('status', $statuses, $statuses, $statusTrans)
|
||||
->addCheckbox('states', $states, ['new', 'in_progress'])
|
||||
->build()
|
||||
;
|
||||
}
|
||||
|
Reference in New Issue
Block a user