use dialog to duplicate timesheet (#2567)

* fix: display time budget in customer listing if set
* updated api methods with annotations
* do not require checkboxes for system configurations
* open dialog for duplicated timesheets
This commit is contained in:
Kevin Papst
2021-05-12 22:32:08 +02:00
committed by GitHub
parent f81f9ba492
commit f2b32b211b
16 changed files with 271 additions and 230 deletions

View File

@@ -12,9 +12,12 @@ namespace App\EventSubscriber\Actions;
use App\Entity\Timesheet;
use App\Event\PageActionsEvent;
/**
* @internal
*/
abstract class AbstractTimesheetSubscriber extends AbstractActionsSubscriber
{
protected function timesheetActions(PageActionsEvent $event, string $routeListing, string $routeEdit): void
protected function timesheetActions(PageActionsEvent $event, string $routeEdit, string $routeDuplicate): void
{
$payload = $event->getPayload();
@@ -35,7 +38,8 @@ abstract class AbstractTimesheetSubscriber extends AbstractActionsSubscriber
}
if ($this->isGranted('duplicate', $timesheet)) {
$event->addAction('copy', ['url' => $this->path('duplicate_timesheet', ['id' => $timesheet->getId()]), 'class' => 'api-link', 'attr' => ['data-payload' => '{"copy": "all"}', 'data-event' => 'kimai.timesheetStart kimai.timesheetUpdate', 'data-method' => 'PATCH', 'data-msg-error' => 'action.update.error', 'data-msg-success' => 'action.update.success']]);
$class = $event->isView('edit') ? '' : 'modal-ajax-form';
$event->addAction('copy', ['url' => $this->path($routeDuplicate, ['id' => $timesheet->getId()]), 'class' => $class]);
}
if ($event->countActions() > 0) {