search and export from invoice archive (#2408)

This commit is contained in:
Kevin Papst
2021-03-10 01:50:27 +01:00
committed by GitHub
parent c34e9f576d
commit db1344573f
22 changed files with 544 additions and 72 deletions

View File

@@ -9,6 +9,7 @@
namespace App\EventSubscriber\Actions;
use App\Constants;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
@@ -33,4 +34,9 @@ abstract class AbstractActionsSubscriber implements EventSubscriberInterface
{
return $this->urlGenerator->generate($route, $parameters);
}
protected function documentationLink(string $url): string
{
return Constants::HOMEPAGE . '/documentation/' . $url;
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\EventSubscriber\Actions;
use App\Event\PageActionsEvent;
class InvoiceArchiveSubscriber extends AbstractActionsSubscriber
{
public static function getSubscribedEvents(): array
{
return [
'actions.invoice_details' => ['onActions', 1000],
];
}
public function onActions(PageActionsEvent $event)
{
$actions = $event->getActions();
if ($this->isGranted('view_invoice')) {
$actions['back'] = ['url' => $this->path('invoice'), 'translation_domain' => 'actions'];
}
$actions['visibility'] = '#modal_invoices';
$actions['download'] = ['url' => $this->path('invoice_export'), 'class' => 'toolbar-action'];
$actions['help'] = ['url' => $this->documentationLink('invoices.html'), 'target' => '_blank'];
$event->setActions($actions);
}
}

View File

@@ -88,8 +88,6 @@ class UserSubscriber extends AbstractActionsSubscriber
$actions['trash'] = ['url' => $this->path('admin_user_delete', ['id' => $user->getId()]), 'class' => 'modal-ajax-form'];
}
$payload['actions'] = array_merge($payload['actions'], $actions);
$event->setPayload($payload);
$event->setActions($actions);
}
}