store search in session (#2735)

* allow to detect used query filters
* allow to set label in action buttons
* allow to reset last search from session
* migrate invoice archive to new search system
* display number of used search filters
This commit is contained in:
Kevin Papst
2021-08-26 01:37:40 +02:00
committed by GitHub
parent 56524a9773
commit 98a3fc99a2
55 changed files with 365 additions and 81 deletions

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\ActivityQuery;
class ActivitiesSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class ActivitiesSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var ActivityQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_activity_admin');
$event->addQuickExport($this->path('activity_export'));

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\CustomerQuery;
class CustomersSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class CustomersSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var CustomerQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_customer_admin');
$event->addQuickExport($this->path('customer_export'));

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\InvoiceArchiveQuery;
class InvoiceArchiveSubscriber extends AbstractActionsSubscriber
{
@@ -20,10 +21,16 @@ class InvoiceArchiveSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$payload = $event->getPayload();
/** @var InvoiceArchiveQuery $query */
$query = $payload['query'];
if ($this->isGranted('view_invoice')) {
$event->addBack($this->path('invoice'));
}
$event->addSearchToggle();
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_invoices');
$event->addQuickExport($this->path('invoice_export'));
$event->addHelp($this->documentationLink('invoices.html'));

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\ProjectQuery;
class ProjectsSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,13 @@ class ProjectsSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var ProjectQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_project_admin');
$event->addQuickExport($this->path('project_export'));

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\TagQuery;
class TagsSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class TagsSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var TagQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
if ($this->isGranted('manage_tag')) {
$event->addCreate($this->path('tags_create'));

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\TeamQuery;
class TeamsSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class TeamsSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var TeamQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
if ($this->isGranted('create_team')) {
$event->addCreate($this->path('admin_team_create'), false);

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\TimesheetQuery;
class TimesheetsSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class TimesheetsSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var TimesheetQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_timesheet');
if ($this->isGranted('export_own_timesheet')) {

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\TimesheetQuery;
class TimesheetsTeamSubscriber extends AbstractActionsSubscriber
{
@@ -20,7 +21,12 @@ class TimesheetsTeamSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var TimesheetQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
$event->addColumnToggle('#modal_timesheet_admin');
if ($this->isGranted('export_other_timesheet')) {

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
use App\Repository\Query\UserQuery;
class UsersSubscriber extends AbstractActionsSubscriber
{
@@ -20,10 +21,17 @@ class UsersSubscriber extends AbstractActionsSubscriber
public function onActions(PageActionsEvent $event): void
{
$event->addSearchToggle();
$payload = $event->getPayload();
/** @var UserQuery $query */
$query = $payload['query'];
$event->addSearchToggle($query);
if ($event->isIndexView()) {
$event->addColumnToggle('#modal_user_admin');
}
$event->addQuickExport($this->path('user_export'));
if ($this->isGranted('create_user')) {