mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 11:09:29 +00:00
Merge 89c230322a into 023d38d170
This commit is contained in:
commit
bc778ba2e0
2 changed files with 59 additions and 0 deletions
|
|
@ -361,4 +361,35 @@ class PartListsController extends AbstractController
|
||||||
{
|
{
|
||||||
return $this->showListWithFilter($request,'parts/lists/all_list.html.twig');
|
return $this->showListWithFilter($request,'parts/lists/all_list.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route(path: '/parts/filter/less_than_desired', name: 'parts_filter_less_than_desired')]
|
||||||
|
public function showLessThanDesiredFilter(Request $request): Response
|
||||||
|
{
|
||||||
|
return $this->showListWithFilter($request,
|
||||||
|
'parts/lists/all_list.html.twig',
|
||||||
|
function (PartFilter $filter) {
|
||||||
|
$filter->lessThanDesired->setValue(true);
|
||||||
|
},
|
||||||
|
function (FormInterface $filterForm) {
|
||||||
|
$this->disableFormFieldAfterCreation($filterForm->get('lessThanDesired')->get('value'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route(path: '/parts/filter/custom', name: 'parts_filter_custom')]
|
||||||
|
public function showCustomFilter(Request $request): Response
|
||||||
|
{
|
||||||
|
// TODO custom filters will need custom access permission checks!
|
||||||
|
return $this->showListWithFilter($request,
|
||||||
|
'parts/lists/all_list.html.twig',
|
||||||
|
function (PartFilter $filter) {
|
||||||
|
;
|
||||||
|
},
|
||||||
|
function (FormInterface $filterForm) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,38 @@ class ToolsTreeBuilder
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getFilterNode(): array
|
||||||
|
{
|
||||||
|
$nodes = [];
|
||||||
|
|
||||||
|
if ($this->security->isGranted('@parts.read')) {
|
||||||
|
$nodes[] = (new TreeViewNode(
|
||||||
|
$this->translator->trans('filter.less_than_desired'),
|
||||||
|
$this->urlGenerator->generate('parts_filter_less_than_desired')
|
||||||
|
))->setIcon("fa-treeview fa-fw fa-solid fa-circle-exclamation");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->security->isGranted('@parts.read')) {
|
||||||
|
$nodes[] = (new TreeViewNode(
|
||||||
|
$this->translator->trans('filter.custom'),
|
||||||
|
$this->urlGenerator->generate('parts_filter_custom')
|
||||||
|
))->setIcon("fa-treeview fa-fw fa-solid fa-code");
|
||||||
|
}
|
||||||
|
return $nodes;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getToolsNode(): array
|
protected function getToolsNode(): array
|
||||||
{
|
{
|
||||||
$nodes = [];
|
$nodes = [];
|
||||||
|
|
||||||
|
if ($this->security->isGranted('@parts.read')) {
|
||||||
|
$nodes[] = (new TreeViewNode(
|
||||||
|
$this->translator->trans('filter.title'),
|
||||||
|
null,
|
||||||
|
$this->getFilterNode()
|
||||||
|
))->setIcon("fa-fw fa-treeview fa-solid fa-filter");
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->security->isGranted('@labels.create_labels')) {
|
if ($this->security->isGranted('@labels.create_labels')) {
|
||||||
$nodes[] = (new TreeViewNode(
|
$nodes[] = (new TreeViewNode(
|
||||||
$this->translator->trans('tree.tools.tools.label_dialog'),
|
$this->translator->trans('tree.tools.tools.label_dialog'),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue