fix weekly view day format (#2893)

* make duplicate project action available on details page
* move "weekly hours" form to main menu
* changed label of week chooser
* hide quick entries menu for punch mode users
This commit is contained in:
Kevin Papst
2021-11-01 20:23:17 +01:00
committed by GitHub
parent 1d32e4ecee
commit 36c08b0dea
14 changed files with 39 additions and 27 deletions

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber;
use App\Event\ConfigureMainMenuEvent;
use App\Timesheet\TrackingModeService;
use App\Twig\IconExtension;
use App\Utils\MenuItemModel;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -21,10 +22,12 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
final class MenuSubscriber implements EventSubscriberInterface
{
private $security;
private $trackingModeService;
public function __construct(AuthorizationCheckerInterface $security)
public function __construct(AuthorizationCheckerInterface $security, TrackingModeService $trackingModeService)
{
$this->security = $security;
$this->trackingModeService = $trackingModeService;
}
public static function getSubscribedEvents(): array
@@ -49,9 +52,18 @@ final class MenuSubscriber implements EventSubscriberInterface
if ($auth->isGranted('view_own_timesheet')) {
$timesheets = new MenuItemModel('timesheet', 'menu.timesheet', 'timesheet', [], $icons->icon('timesheet'));
$timesheets->setChildRoutes(['timesheet_export', 'timesheet_edit', 'timesheet_create', 'timesheet_multi_update', 'quick_entry']);
$timesheets->setChildRoutes(['timesheet_export', 'timesheet_edit', 'timesheet_create', 'timesheet_multi_update']);
$menu->addItem($timesheets);
if ($auth->isGranted('edit_own_timesheet')) {
$mode = $this->trackingModeService->getActiveMode();
if ($mode->canEditDuration() || $mode->canEditEnd()) {
$menu->addItem(
new MenuItemModel('quick_entry', 'quick_entry.title', 'quick_entry', [], $icons->icon('weekly-times'))
);
}
}
$menu->addItem(
new MenuItemModel('calendar', 'calendar.title', 'calendar', [], $icons->icon('calendar'))
);