feat: group the sidebar, add a settings hub and move account actions to a header user menu

This commit is contained in:
fromme committed 2026-11-12 11:13:30 +01:00
1 parent acd8e78e55
commit 7095456d36
16 files changed
+487 -477

No files matched your search

+6
View File
@@ -23,6 +23,12 @@ export default class extends Controller {
this.openValue = false
}
closeOutside(event) {
if (false === this.element.contains(event.target)) {
this.close()
}
}
open() {
this.openValue = true
}
+1
View File
@@ -0,0 +1 @@
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 500 153" xmlns="http://www.w3.org/2000/svg"><g fill="#0084d4"><path d="m332.922 85.597c4.527 0 7.819 3.292 7.819 7.819 0 4.115-2.675 6.79-5.762 7.613l6.791 11.934h-3.704l-6.379-11.523h-7.613v11.523h-3.292v-27.366zm-8.642 12.963h8.642c2.469 0 4.527-2.058 4.527-5.144 0-3.293-2.264-5.144-5.35-5.144h-7.819z" fill-rule="nonzero"/><path d="m374.28 85.597v2.88h-15.432v9.877h13.374v2.881h-13.374v9.053h15.843v2.675h-19.135v-27.366z" fill-rule="nonzero"/><path d="m389.095 85.597h3.292v27.366h-3.292z"/><path d="m406.79 111.317.823-2.675c1.029.411 4.733 1.852 8.436 1.852 4.527 0 6.791-1.852 6.791-4.527 0-3.498-3.498-4.321-6.996-5.35-4.321-1.234-8.848-2.675-8.848-8.024 0-4.939 3.704-7.408 9.259-7.408 3.292 0 6.79 1.029 8.642 1.852l-.823 2.675s-4.115-1.646-7.613-1.646c-3.704 0-6.173 1.852-6.173 4.527 0 3.292 3.704 4.321 6.996 5.349 4.321 1.235 8.848 2.675 8.848 8.025 0 5.144-4.116 7.407-9.671 7.407-4.321 0-8.025-1.234-9.671-2.057z" fill-rule="nonzero"/><path d="m458.848 85.597v2.88h-15.432v9.877h13.374v2.881h-13.374v9.053h15.843v2.675h-19.136v-27.366z" fill-rule="nonzero"/><path d="m476.955 85.597 8.642 12.963 5.967 9.259-.206-9.259v-12.963h3.292v27.366h-3.498l-8.642-13.375-5.761-9.053.206 9.259v13.169h-3.292v-27.366z" fill-rule="nonzero"/><path d="m339.712 123.663v2.88h-15.432v9.877h13.374v2.88h-13.374v9.054h15.843v2.881h-19.135v-27.572z" fill-rule="nonzero"/><path d="m352.263 123.663 8.231 23.251 8.23-23.251h3.498l-9.876 27.366h-3.704l-9.877-27.366z" fill-rule="nonzero"/><path d="m401.44 123.663v2.88h-15.432v9.877h13.375v2.88h-13.375v9.054h15.844v2.881h-19.136v-27.572z" fill-rule="nonzero"/><path d="m416.872 123.663 8.642 12.963 5.967 9.259-.205-9.259v-12.963h3.292v27.366h-3.498l-8.642-13.375-5.761-9.053.205 9.259v13.169h-3.292v-27.366z" fill-rule="nonzero"/><path d="m466.872 123.457v3.086h-9.259v24.486h-3.292v-24.692h-9.259v-2.88z" fill-rule="nonzero"/><path d="m475.309 149.177.823-2.675c1.028.412 4.732 1.852 8.436 1.852 4.527 0 6.79-1.852 6.79-4.527 0-3.498-3.498-4.321-6.996-5.35-4.321-1.234-8.848-2.675-8.848-8.024 0-4.939 3.704-7.408 9.26-7.408 3.292 0 6.79 1.029 8.642 1.852l-.823 2.675s-4.116-1.646-7.614-1.646c-3.703 0-6.172 1.852-6.172 4.527 0 3.292 3.703 4.321 6.995 5.349 4.321 1.235 8.848 2.675 8.848 8.025 0 5.144-4.115 7.408-9.671 7.408-4.115 0-8.024-1.235-9.67-2.058z" fill-rule="nonzero"/><path d="m367.695 1.852v10.905h-33.333v17.078h28.395v11.112h-28.395v15.637h33.951v10.906h-47.12v-65.638z" fill-rule="nonzero"/><path d="m418.93 16.255c0 5.556-3.292 11.729-10.7 16.255l11.317 13.169s2.264-4.115 2.264-9.465h9.876c-.206 10.082-4.938 17.901-4.938 17.901l12.14 13.992h-14.609l-4.938-5.761c-4.527 3.909-10.494 6.173-17.284 6.173-12.346 0-23.457-7.202-23.457-20.782 0-8.848 5.761-14.404 11.728-18.519-3.292-4.321-5.761-7.202-5.761-12.963 0-11.317 9.465-15.638 16.872-15.638 7.408 0 17.49 4.321 17.49 15.638zm-28.189 31.276c0 6.173 4.526 10.082 11.728 10.082 3.704 0 6.996-1.029 9.671-3.292l-14.403-16.667c-4.116 2.264-6.996 5.35-6.996 9.877zm5.967-30.659c0 3.293 2.057 5.144 4.321 7.614 3.704-1.646 6.378-4.527 6.378-7.819 0-3.91-2.674-5.35-5.349-5.35-3.498 0-5.35 2.263-5.35 5.555z" fill-rule="nonzero"/><path d="m479.424 1.852c11.111 0 20.164 9.259 20.164 20.988 0 12.551-9.053 21.399-19.958 21.399h-15.844v23.456h-13.169v-65.843zm-15.638 31.276h13.169c6.173 0 9.671-4.527 9.671-10.288 0-7.202-5.556-9.877-10.7-9.877h-12.14z" fill-rule="nonzero"/><path d="m220.165.617c-74.898 11.317-167.902 39.301-167.902 78.601 0 36.42 86.009 27.161 86.009 27.161s-137.86 45.884-137.86-14.404c0-68.312 173.868-91.358 219.753-91.358z" fill-rule="nonzero"/></g><path d="m34.979 151.235c74.898-11.112 167.902-39.301 167.902-78.601 0-36.42-86.009-27.161-86.009-27.161s137.861-45.885 137.861 14.404c0 68.518-173.869 91.358-219.754 91.358z" fill="#f8c62f" fill-rule="nonzero"/><path d="m124.897 70.576-26.337 8.231 25.103 1.646-.823-4.939z" fill="#0084d4" fill-rule="nonzero"/><path d="m156.173 72.428-18.93 5.967-7.202 19.959-3.498-23.251 8.231-22.017 3.498 16.256z" fill="#f8c62f" fill-rule="nonzero"/></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

+3
View File
@@ -340,6 +340,9 @@ services:
- name: knp_menu.menu_builder
method: createTeamerMenu
alias: default_teamer
- name: knp_menu.menu_builder
method: createUserMenu
alias: default_user
App\Menu\AdminMenuBuilder:
arguments:
@@ -0,0 +1,22 @@
<?php
namespace App\Controller\Administrative\System;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* The settings overview, linked from the sidebar instead of a submenu of every settings page.
* The template shows each role only the pages it may open.
*/
class IndexController extends AbstractController
{
#[Route('/administrative/system', name: 'app_administrative_system_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(): Response
{
return $this->render('administrative/system/index.html.twig');
}
}
+39 -69
View File
@@ -134,77 +134,39 @@ abstract class AbstractMenuBuilder
...(null !== $returnUrl ? ['uri' => $returnUrl] : ['route' => $defaultRoute]),
'extras' => [
'icon' => 'arrow-left',
'back' => true,
],
]);
}
protected function addAdminItem(ItemInterface $menu): void
{
if ($this->security->isGranted('ROLE_TEAM_ADMIN')) {
$this->addDivider($menu);
$menu->addChild('zum Adminbereich', [
'route' => 'app_admin_index',
'linkAttributes' => [
'title' => 'zum Adminbereich',
],
'extras' => [
'icon' => 'user',
],
]);
}
}
/**
* Areas the user can switch to, in priority order, with the label of their link.
*/
protected const AREA_LINKS = [
'ROLE_TEAM_ADMIN' => ['zum Adminbereich', 'app_admin_index'],
'ROLE_MANAGER' => ['zum Managementbereich', 'app_manager_index'],
'ROLE_HOUSE_MANAGER' => ['zum Hausleitungsbereich', 'app_house_manager_index'],
'ROLE_TEAMER' => ['zum Teambereich', 'app_teamer_index'],
];
protected function addManagerItem(ItemInterface $menu): void
/**
* Adds the links to the other areas the user has, then logout, or the way back to the
* own user while impersonating someone.
*/
protected function addAccountItems(ItemInterface $menu): void
{
if ($this->security->isGranted('ROLE_MANAGER')) {
$this->addDivider($menu);
$menu->addChild('zum Managementbereich', [
'route' => 'app_manager_index',
'linkAttributes' => [
'title' => 'zum Managementbereich',
],
'extras' => [
'icon' => 'user',
],
]);
}
}
$currentArea = $this->resolveArea();
protected function addTeamerItem(ItemInterface $menu): void
{
if ($this->security->isGranted('ROLE_TEAMER')) {
$this->addDivider($menu);
$menu->addChild('zum Teambereich', [
'route' => 'app_teamer_index',
'linkAttributes' => [
'title' => 'zum Teambereich',
],
'extras' => [
'icon' => 'user',
],
]);
foreach (self::AREA_LINKS as $role => [$label, $route]) {
if ($role !== $currentArea && $this->security->isGranted($role)) {
$menu->addChild($label, [
'route' => $route,
'extras' => [
'icon' => 'arrow-right',
],
]);
}
}
}
protected function addHouseManagerItem(ItemInterface $menu): void
{
if ($this->security->isGranted('ROLE_HOUSE_MANAGER')) {
$this->addDivider($menu);
$menu->addChild('zum Hausleitungsbereich', [
'route' => 'app_house_manager_index',
'linkAttributes' => [
'title' => 'zum Hausleitungsbereich',
],
'extras' => [
'icon' => 'user',
],
]);
}
}
protected function addLogoutItem(ItemInterface $menu): void
{
$this->addDivider($menu);
$token = $this->security->getToken();
@@ -214,9 +176,6 @@ abstract class AbstractMenuBuilder
$menu->addChild('zum eigenen Benutzer', [
'route' => $originalUser->getDefaultRoute(),
'routeParameters' => ['_switch_user' => '_exit'],
'linkAttributes' => [
'title' => 'zurück',
],
'extras' => [
'icon' => 'logout',
],
@@ -224,9 +183,6 @@ abstract class AbstractMenuBuilder
} else {
$menu->addChild('Logout', [
'route' => 'app_security_logout',
'linkAttributes' => [
'title' => 'Logout',
],
'extras' => [
'icon' => 'logout',
],
@@ -234,6 +190,20 @@ abstract class AbstractMenuBuilder
}
}
/**
* Adds the heading of a group of sidebar items. The items themselves follow as siblings,
* so their level, active state and route patterns stay as they are.
*/
protected function addHeading(ItemInterface $menu, string $label): void
{
$menu->addChild(Uuid::v4(), [
'label' => $label,
'extras' => [
'heading' => true,
],
]);
}
protected function addDivider(ItemInterface $menu): void
{
$menu->addChild(Uuid::v4(), [
+90 -244
View File
@@ -21,6 +21,8 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$this->addHeading($menu, 'Planung');
$menu->addChild('Einsatzübersicht', [
'route' => 'app_administrative_assignment_index',
'linkAttributes' => [
@@ -44,83 +46,17 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$menu->addChild('Bewerbungsübersicht', [
'route' => 'app_admin_application_index',
$menu->addChild('Verfügbarkeiten', [
'route' => 'app_administrative_availability_index',
'linkAttributes' => [
'title' => 'Bewerbungsübersicht',
'title' => 'Verfügbarkeiten',
],
'extras' => [
'icon' => 'mail',
'icon' => 'calendar',
],
]);
$menu->addChild('Bewerbungseingang TYPO3', [
'route' => 'app_admin_application_form_submission_index',
'linkAttributes' => [
'title' => 'Bewerbungseingang TYPO3',
],
'extras' => [
'icon' => 'typo3',
'routes' => [
['pattern' => '/^app_admin_application_form_submission_/'],
],
],
]);
$documentMenu = $menu->addChild('Dokumente', [
'extras' => [
'icon' => 'document',
],
]);
$documentMenu->addChild('Übersicht', [
'route' => 'app_administrative_document_index',
'linkAttributes' => [
'title' => 'Übersicht',
],
]);
$documentMenu->addChild('akzeptierte Honorarnoten', [
'route' => 'app_administrative_document_accepted',
'routeParameters' => [
'type' => Upload::TYPE_INVOICE,
],
'linkAttributes' => [
'title' => 'akzeptierte Honorarnoten',
],
]);
$documentMenu->addChild('geprüfte Honorverträge', [
'route' => 'app_administrative_document_accepted',
'routeParameters' => [
'type' => Upload::TYPE_CONTRACT,
],
'linkAttributes' => [
'title' => 'geprüfte Honorverträge',
],
]);
$menu->addChild('Teamer:innen-Feedback', [
'route' => 'app_administrative_feedback_index',
'linkAttributes' => [
'title' => 'Teamer:innen-Feedback',
],
'extras' => [
'icon' => 'feedback',
'routes' => [
['pattern' => '/^app_administrative_feedback_/'],
],
],
]);
$menu->addChild('Reiseleitungsfeedback', [
'route' => 'app_administrative_questionnaire_index',
'linkAttributes' => [
'title' => 'Reiseleitungsfeedback nach Einsätzen',
],
'extras' => [
'icon' => 'document',
'routes' => [
['pattern' => '/^app_administrative_questionnaire_/'],
],
],
]);
$this->addHeading($menu, 'Team');
$menu->addChild('Teamübersicht', [
'route' => 'app_administrative_teamer_index',
@@ -175,13 +111,86 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$menu->addChild('Verfügbarkeiten', [
'route' => 'app_administrative_availability_index',
$documentMenu = $menu->addChild('Dokumente', [
'extras' => [
'icon' => 'document',
],
]);
$documentMenu->addChild('Übersicht', [
'route' => 'app_administrative_document_index',
'linkAttributes' => [
'title' => 'Verfügbarkeiten',
'title' => 'Übersicht',
],
]);
$documentMenu->addChild('akzeptierte Honorarnoten', [
'route' => 'app_administrative_document_accepted',
'routeParameters' => [
'type' => Upload::TYPE_INVOICE,
],
'linkAttributes' => [
'title' => 'akzeptierte Honorarnoten',
],
]);
$documentMenu->addChild('geprüfte Honorverträge', [
'route' => 'app_administrative_document_accepted',
'routeParameters' => [
'type' => Upload::TYPE_CONTRACT,
],
'linkAttributes' => [
'title' => 'geprüfte Honorverträge',
],
]);
$this->addHeading($menu, 'Bewerbungen');
$menu->addChild('Bewerbungsübersicht', [
'route' => 'app_admin_application_index',
'linkAttributes' => [
'title' => 'Bewerbungsübersicht',
],
'extras' => [
'icon' => 'calendar',
'icon' => 'mail',
],
]);
$menu->addChild('Bewerbungseingang TYPO3', [
'route' => 'app_admin_application_form_submission_index',
'linkAttributes' => [
'title' => 'Bewerbungseingang TYPO3',
],
'extras' => [
'icon' => 'typo3',
'routes' => [
['pattern' => '/^app_admin_application_form_submission_/'],
],
],
]);
$this->addHeading($menu, 'Feedback &amp; Auswertung');
$menu->addChild('Teamer:innen-Feedback', [
'route' => 'app_administrative_feedback_index',
'linkAttributes' => [
'title' => 'Teamer:innen-Feedback',
],
'extras' => [
'icon' => 'feedback',
'routes' => [
['pattern' => '/^app_administrative_feedback_/'],
],
],
]);
$menu->addChild('Reiseleitungsfeedback', [
'route' => 'app_administrative_questionnaire_index',
'linkAttributes' => [
'title' => 'Reiseleitungsfeedback nach Einsätzen',
],
'extras' => [
'icon' => 'document',
'routes' => [
['pattern' => '/^app_administrative_questionnaire_/'],
],
],
]);
@@ -215,176 +224,18 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$settingsMenu = $menu->addChild('Einstellungen', [
$this->addDivider($menu);
$menu->addChild('Einstellungen', [
'route' => 'app_administrative_system_index',
'linkAttributes' => [
'title' => 'Einstellungen',
],
'extras' => [
'icon' => 'settings',
],
]);
$settingsMenu->addChild('Verfügbarkeiten', [
'route' => 'app_admin_system_availability_index',
'linkAttributes' => [
'title' => 'Verfügbarkeiten',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_availability_/'],
],
],
]);
$settingsMenu->addChild('Honorare', [
'route' => 'app_admin_system_fee_index',
'linkAttributes' => [
'title' => 'Honorare',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_fee_/'],
],
],
]);
$settingsMenu->addChild('Fortbildungen', [
'route' => 'app_admin_system_training_index',
'linkAttributes' => [
'title' => 'Fortbildungen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_training_/'],
],
],
]);
$settingsMenu->addChild('E-Mail-Texte', [
'route' => 'app_admin_system_email_text_index',
'linkAttributes' => [
'title' => 'E-Mail-Texte',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_email_text_/'],
],
],
]);
$settingsMenu->addChild('Jobprofile', [
'route' => 'app_admin_system_job_profile_index',
'linkAttributes' => [
'title' => 'Jobprofile',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_job_profile_/'],
],
],
]);
$settingsMenu->addChild('Besetzungsmatrix', [
'route' => 'app_administrative_system_staffing_rule_index',
'linkAttributes' => [
'title' => 'Besetzungsmatrix',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_staffing_rule_/'],
],
],
]);
$settingsMenu->addChild('Reisen', [
'route' => 'app_administrative_system_destination_index',
'linkAttributes' => [
'title' => 'Reisen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_destination_/'],
],
],
]);
$settingsMenu->addChild('Feedbackvorlagen', [
'route' => 'app_admin_system_feedback_set_index',
'linkAttributes' => [
'title' => 'Feedbackvorlagen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_feedback_set_/'],
],
],
]);
$settingsMenu->addChild('FAQ', [
'route' => 'app_administrative_system_faq_index',
'linkAttributes' => [
'title' => 'FAQ',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_faq_/'],
],
],
]);
$settingsMenu->addChild('News', [
'route' => 'app_administrative_system_news_index',
'linkAttributes' => [
'title' => 'News',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_news_/'],
],
],
]);
$settingsMenu->addChild('Dokumente', [
'route' => 'app_administrative_system_document_index',
'linkAttributes' => [
'title' => 'Dokumente',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_document_/'],
],
],
]);
$settingsMenu->addChild('Saisonteam-Dokumente', [
'route' => 'app_administrative_system_season_task_document_index',
'linkAttributes' => [
'title' => 'Saisonteam-Dokumente',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_season_task_document_/'],
],
],
]);
$settingsMenu->addChild('Mailvorlagen', [
'route' => 'app_administrative_system_mailing_template_index',
'linkAttributes' => [
'title' => 'Mailvorlagen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_mailing_template_/'],
],
],
]);
$settingsMenu->addChild('Ansprechpersonen', [
'route' => 'app_admin_system_contact_index',
'linkAttributes' => [
'title' => 'Ansprechpersonen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_contact_/'],
],
],
]);
$settingsMenu->addChild('Administrative Benutzer:innen', [
'route' => 'app_admin_system_user_index',
'linkAttributes' => [
'title' => 'Administrative Benutzer:innen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_admin_system_user_/'],
['pattern' => '/^app_admin_system_/'],
['pattern' => '/^app_administrative_system_/'],
],
],
]);
@@ -399,11 +250,6 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$this->addTeamerItem($menu);
$this->addManagerItem($menu);
$this->addHouseManagerItem($menu);
$this->addLogoutItem($menu);
return $menu;
}
-5
View File
@@ -42,11 +42,6 @@ class HouseManagerMenuBuilder extends AbstractMenuBuilder
],
]);
$this->addAdminItem($menu);
$this->addManagerItem($menu);
$this->addTeamerItem($menu);
$this->addLogoutItem($menu);
return $menu;
}
}
+58 -117
View File
@@ -20,6 +20,9 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
'icon' => 'chart',
],
]);
$this->addHeading($menu, 'Planung');
$menu->addChild('Einsatzübersicht', [
'route' => 'app_administrative_assignment_index',
'linkAttributes' => [
@@ -32,6 +35,7 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
],
],
]);
$menu->addChild('Zeitleiste', [
'route' => 'app_administrative_timeline',
'linkAttributes' => [
@@ -41,6 +45,48 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
'icon' => 'table',
],
]);
$this->addHeading($menu, 'Team');
$menu->addChild('Teamübersicht', [
'route' => 'app_administrative_teamer_index',
'linkAttributes' => [
'title' => 'Teamübersicht',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_teamer_/'],
],
],
]);
$menu->addChild('Saisonteamer', [
'route' => 'app_administrative_season_teamer_index',
'linkAttributes' => [
'title' => 'Saisonteamer',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_season_teamer_/'],
],
],
]);
$menu->addChild('Saisoneinsätze', [
'route' => 'app_administrative_season_assignment_index',
'linkAttributes' => [
'title' => 'Saisoneinsätze',
],
'extras' => [
'icon' => 'calendar',
'routes' => [
['pattern' => '/^app_administrative_season_assignment_/'],
],
],
]);
$documentMenu = $menu->addChild('Dokumente', [
'extras' => [
'icon' => 'document',
@@ -70,42 +116,9 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
'title' => 'geprüfte Honorverträge',
],
]);
$menu->addChild('Teamübersicht', [
'route' => 'app_administrative_teamer_index',
'linkAttributes' => [
'title' => 'Teamübersicht',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_teamer_/'],
],
],
]);
$menu->addChild('Saisonteamer', [
'route' => 'app_administrative_season_teamer_index',
'linkAttributes' => [
'title' => 'Saisonteamer',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_season_teamer_/'],
],
],
]);
$menu->addChild('Saisoneinsätze', [
'route' => 'app_administrative_season_assignment_index',
'linkAttributes' => [
'title' => 'Saisoneinsätze',
],
'extras' => [
'icon' => 'calendar',
'routes' => [
['pattern' => '/^app_administrative_season_assignment_/'],
],
],
]);
$this->addHeading($menu, 'Feedback &amp; Auswertung');
$menu->addChild('Teamer:innen-Feedback', [
'route' => 'app_administrative_feedback_index',
'linkAttributes' => [
@@ -118,6 +131,7 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
],
],
]);
$menu->addChild('Reiseleitungsfeedback', [
'route' => 'app_administrative_questionnaire_index',
'linkAttributes' => [
@@ -130,6 +144,7 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
],
],
]);
$statisticsMenu = $menu->addChild('Statistiken', [
'extras' => [
'icon' => 'chart',
@@ -159,96 +174,22 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
'title' => 'Bewerbungen pro Destination',
],
]);
$settingsMenu = $menu->addChild('Einstellungen', [
$this->addDivider($menu);
$menu->addChild('Einstellungen', [
'route' => 'app_administrative_system_index',
'linkAttributes' => [
'title' => 'Einstellungen',
],
'extras' => [
'icon' => 'settings',
],
]);
$settingsMenu->addChild('Besetzungsmatrix', [
'route' => 'app_administrative_system_staffing_rule_index',
'linkAttributes' => [
'title' => 'Besetzungsmatrix',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_staffing_rule_/'],
['pattern' => '/^app_admin_system_/'],
['pattern' => '/^app_administrative_system_/'],
],
],
]);
$settingsMenu->addChild('Reisen', [
'route' => 'app_administrative_system_destination_index',
'linkAttributes' => [
'title' => 'Reisen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_destination_/'],
],
],
]);
$settingsMenu->addChild('FAQ', [
'route' => 'app_administrative_system_faq_index',
'linkAttributes' => [
'title' => 'FAQ',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_faq_/'],
],
],
]);
$settingsMenu->addChild('News', [
'route' => 'app_administrative_system_news_index',
'linkAttributes' => [
'title' => 'News',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_news_/'],
],
],
]);
$settingsMenu->addChild('Dokumente', [
'route' => 'app_administrative_system_document_index',
'linkAttributes' => [
'title' => 'Dokumente',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_document_/'],
],
],
]);
$settingsMenu->addChild('Saisonunterlagen', [
'route' => 'app_administrative_system_season_task_document_index',
'linkAttributes' => [
'title' => 'Saisonunterlagen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_season_task_document_/'],
],
],
]);
$settingsMenu->addChild('Mailvorlagen', [
'route' => 'app_administrative_system_mailing_template_index',
'linkAttributes' => [
'title' => 'Mailvorlagen',
],
'extras' => [
'routes' => [
['pattern' => '/^app_administrative_system_mailing_template_/'],
],
],
]);
$this->addAdminItem($menu);
$this->addTeamerItem($menu);
$this->addHouseManagerItem($menu);
$this->addLogoutItem($menu);
return $menu;
}
+12
View File
@@ -40,6 +40,18 @@ class MenuBuilder extends AbstractMenuBuilder
};
}
/**
* The account menu behind the user's picture in the header: the other areas and logout.
*/
public function createUserMenu(array $options): ItemInterface
{
$menu = $this->createRootElement();
$this->addAccountItems($menu);
return $menu;
}
public function createTeamerMenu(array $options): ItemInterface
{
return match ($this->resolveArea()) {
-5
View File
@@ -170,11 +170,6 @@ class TeamerMenuBuilder extends AbstractMenuBuilder
],
]);
$this->addAdminItem($menu);
$this->addManagerItem($menu);
$this->addHouseManagerItem($menu);
$this->addLogoutItem($menu);
return $menu;
}
+5
View File
@@ -0,0 +1,5 @@
{# The E&P logo with the app name beside it, as in the header of the apps portal (EP/apps) and epbms. #}
<span class="flex items-center gap-3">
<img class="h-9 w-auto" src="{{ asset('build/images/ep-logo.svg') }}" alt="E&amp;P Reisen &amp; Events" width="157" height="48">
<span class="pl-3 border-l border-line text-sm font-bold uppercase tracking-wide text-brand">Team</span>
</span>
+13 -9
View File
@@ -3,7 +3,7 @@
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{% if item.level == 0 %}
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
<div class="min-h-full flex grow flex-col gap-y-5">
<nav class="flex flex-1 flex-col">
<ul role="list" class="space-y-1">
{{ block('children') }}
@@ -19,7 +19,10 @@
{% endblock %}
{% block item %}
{% if item.displayed %}
{% if item.displayed and item.extras.heading is defined %}
{# the heading of a group of items, see AbstractMenuBuilder::addHeading() #}
<li class="px-2 pt-5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted">{{ item.label|raw }}</li>
{% elseif item.displayed %}
<li>
{%- if item.hasChildren and item.displayChildren %}
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
@@ -41,9 +44,10 @@
{% import _self as knp_menu %}
<a href="{{ item.uri }}"
class="{{ html_classes('', {
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold text-gray-700 hover:bg-gray-50': item.level == 1,
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700 hover:bg-gray-50': item.level > 1,
'bg-gray-50': matcher.isCurrent(item) or matcher.isAncestor(item)
'group flex gap-x-3 p-2 text-sm leading-6 font-semibold': item.level == 1,
'block py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
'text-ink hover:bg-white/60 hover:text-brand': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
'bg-white text-brand': matcher.isCurrent(item) or matcher.isAncestor(item)
}) }}"
{{ knp_menu.attributes(item.linkAttributes) }}>
{{ block('label') }}
@@ -57,14 +61,14 @@
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
{{ stimulus_target('sidebar-menu', 'button') }}
{{ knp_menu.attributes(item.linkAttributes) }}
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
class="{{ html_classes('hover:bg-white/60 hover:text-brand flex items-center w-full text-left p-2 gap-x-3 text-sm leading-6 font-semibold', { 'text-brand': matcher.isAncestor(item), 'text-ink': not matcher.isAncestor(item) }) }}"
aria-expanded="false">
{{ block('label') }}
</button>
{% elseif item.extras.divider is defined %}
<hr class="my-4 h-px bg-gray-200">
<hr class="my-4 h-px border-line">
{% else %}
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
<div class="hover:bg-white/60 group flex gap-x-3 p-2 text-sm leading-5 font-semibold text-ink"
role="button">
{{ block('label') }}
</div>
@@ -73,7 +77,7 @@
{% block label -%}
{% if item.extras.icon is defined -%}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 text-gray-400') -}}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-brand' : 'text-muted')) -}}
<span class="flex-1">{{ item.label|raw }}</span>
{%- else -%}
{{ item.label|raw }}
+35
View File
@@ -0,0 +1,35 @@
{#
The account menu behind the user's picture: own profile, the other areas (MenuBuilder::createUserMenu)
and logout. Opens on click, closes on a click elsewhere and on Escape.
#}
{% set user_menu = knp_menu_get('default_user') %}
<div class="relative"
{{ stimulus_controller('toggle', { open: false }, { closed: 'hidden' }) }}
{{ stimulus_action('toggle', 'closeOutside', 'click@window')|stimulus_action('toggle', 'close', 'keydown.esc@window') }}>
<button type="button"
class="flex items-center gap-x-2 text-sm text-ink hover:text-brand"
aria-haspopup="true"
{{ stimulus_action('toggle', 'toggle') }}>
{% if app.user.teamer and app.user.teamer.photo %}
<img src="{{ asset(app.user.teamer.photo | upload_filename_full | imagine_filter('profile')) }}"
class="h-8 w-8 rounded-full object-cover"
alt="">
{% else %}
{{ icon('user', 'w-8 h-8 text-brand') }}
{% endif %}
<span class="hidden sm:inline">{{ app.user.firstName }}</span>
</button>
<div class="hidden absolute right-0 top-full mt-2 z-40 min-w-56 border border-line bg-white py-1 text-sm shadow-lg"
role="menu"
{{ stimulus_target('toggle', 'toggle') }}>
{% if app.user.teamer %}
<a href="{{ path('app_teamer_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
{% elseif is_granted('ROLE_ADMINISTRATIVE') %}
<a href="{{ path('app_administrative_profile_index') }}" class="user-menu-item" role="menuitem">{{ icon('user', 'w-5 h-5 text-muted') }}Mein Profil</a>
{% endif %}
{% for item in user_menu.children %}
{% if loop.last %}<hr class="my-1 border-line">{% endif %}
<a href="{{ item.uri }}" class="user-menu-item" role="menuitem">{{ icon(item.extras.icon, 'w-5 h-5 text-muted') }}{{ item.label }}</a>
{% endfor %}
</div>
</div>
@@ -0,0 +1,71 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Einstellungen{% endblock %}
{# role: who may open the page; the routes under app_admin_system_ are admin-only #}
{% set groups = [
{
title: 'Reisen & Besetzung',
pages: [
{ route: 'app_administrative_system_destination_index', label: 'Reisen', description: 'Reisen und ihre Destinationen', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_staffing_rule_index', label: 'Besetzungsmatrix', description: 'Wie jeder Termin eines Produkts besetzt wird – daraus entstehen die Einsatzentwürfe', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_admin_system_job_profile_index', label: 'Jobprofile', description: 'Die Aufgaben, für die Teamer:innen eingesetzt werden', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_availability_index', label: 'Verfügbarkeiten', description: 'Zeiträume, für die Teamer:innen ihre Verfügbarkeit angeben', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Teamer:innen',
pages: [
{ route: 'app_admin_system_fee_index', label: 'Honorare', description: 'Honorarsätze', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_training_index', label: 'Fortbildungen', description: 'Fortbildungen, die bei Teamer:innen hinterlegt werden', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_admin_system_feedback_set_index', label: 'Feedbackvorlagen', description: 'Bewertungskategorien für das Teamer:innen-Feedback', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Kommunikation',
pages: [
{ route: 'app_admin_system_email_text_index', label: 'E-Mail-Texte', description: 'Wortlaut der automatischen E-Mails', role: 'ROLE_TEAM_ADMIN' },
{ route: 'app_administrative_system_mailing_template_index', label: 'Mailvorlagen', description: 'Vorlagen für Rundmails an die Teamer:innen eines Einsatzes', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_news_index', label: 'News', description: 'Meldungen im Teambereich', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_faq_index', label: 'FAQ', description: 'Fragen und Antworten im Teambereich', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_admin_system_contact_index', label: 'Ansprechpersonen', description: 'Kontakte, die Teamer:innen im Teambereich sehen', role: 'ROLE_TEAM_ADMIN' },
],
},
{
title: 'Dokumente',
pages: [
{ route: 'app_administrative_system_document_index', label: 'Dokumente', description: 'Dokumente für Teamer:innen', role: 'ROLE_ADMINISTRATIVE' },
{ route: 'app_administrative_system_season_task_document_index', label: 'Saisonteam-Dokumente', description: 'Standarddokumente der Saisonteam-Checkliste', role: 'ROLE_ADMINISTRATIVE' },
],
},
{
title: 'Zugänge',
pages: [
{ route: 'app_admin_system_user_index', label: 'Administrative Benutzer:innen', description: 'Zugänge für Admins, Management und Hausleitungen', role: 'ROLE_TEAM_ADMIN' },
],
},
] %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Einstellungen
</h1>
<div class="space-y-8">
{% for group in groups %}
{% set pages = group.pages|filter(page => is_granted(page.role)) %}
{% if pages is not empty %}
<section>
<h2 class="pb-3 text-base font-semibold uppercase tracking-wide text-brand">{{ group.title }}</h2>
<div class="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
{% for page in pages %}
<a href="{{ path(page.route) }}" class="block border border-line bg-white p-4 hover:border-brand" {{ qa_attribute('settings-page', page.route) }}>
<span class="block font-semibold text-brand">{{ page.label }}</span>
<span class="block pt-1 text-muted">{{ page.description }}</span>
</a>
{% endfor %}
</div>
</section>
{% endif %}
{% endfor %}
</div>
{% endblock %}
+25 -28
View File
@@ -1,33 +1,30 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] gap-8 py-8">
<div class="lg:col-span-full flex items-center justify-between pb-4 lg:pb-0">
<a href="{{ path(app.user ? app.user.defaultRoute : 'app_security_login') }}">
<img class="h-8 w-auto" src="{{ asset('build/images/logo.svg') }}" alt="E&amp;P Team">
</a>
{% if app.user %}
<div class="flex items-center space-x-4">
{% if app.user.teamer and app.user.teamer.photo %}
<a href="{{ path('app_teamer_profile_index') }}" title="Mein Profil">
<img src="{{ asset(app.user.teamer.photo | upload_filename_full | imagine_filter('profile')) }}"
class="h-8 w-auto rounded-full"
alt="{{ app.user.teamer.firstName }}">
</a>
{% elseif is_granted('ROLE_ADMINISTRATIVE') %}
<a href="{{ path('app_administrative_profile_index') }}" title="Mein Profil">
{{ icon('user', 'w-8 h-8') }}
</a>
{% endif %}
<button type="button"
class="lg:hidden"
{{ stimulus_controller('mobilenav', [], [], { 'mobilenav': '#mobilenav' }) }}
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'open' }) }}>
{{ icon('menu', 'w-8 h-8 text-gray-700') }}
</button>
</div>
{% endif %}
{# E&P header as in the apps portal (EP/apps) and epbms: logo with the app name, brand bar #}
<header>
<div class="border-b border-line bg-white">
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 py-3 flex items-center justify-between gap-x-4">
<a href="{{ path(app.user ? app.user.defaultRoute : 'app_security_login') }}">
{% include '_partials/_brand.html.twig' %}
</a>
{% if app.user %}
<div class="flex items-center gap-x-4">
{% include '_partials/_user_menu.html.twig' %}
<button type="button"
class="lg:hidden"
{{ stimulus_controller('mobilenav', [], [], { 'mobilenav': '#mobilenav' }) }}
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'open' }) }}>
<span class="sr-only">Menü</span>
{{ icon('menu', 'w-8 h-8 text-brand') }}
</button>
</div>
{% endif %}
</div>
</div>
<div class="h-2 bg-brand" aria-hidden="true"></div>
</header>
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] gap-8 py-8">
<div class="hidden lg:block">
{% block main_menu %}{% endblock %}
</div>
@@ -39,9 +36,9 @@
class="fixed z-50 top-0 left-0 inset-0 pr-16 bg-black/70 -translate-x-full"
{{ stimulus_controller('mobilenav', [], { 'closed': '-translate-x-full' }, { 'mobilenav': '#mobilenav' }) }}
>
<div class="h-screen w-full bg-white">
<div class="h-screen w-full bg-page">
<div class="flex justify-between p-8">
<img src="{{ asset('build/images/logo.svg') }}" alt="" class="block w-auto h-8">
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="" class="block w-auto h-9">
<button type="button"
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'close' }) }}>
{{ icon('close', 'w-8 h-8') }}
@@ -0,0 +1,107 @@
<?php
declare(strict_types=1);
namespace App\Tests\Controller\Administrative\System;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpFoundation\Response;
/**
* The settings overview replaced the settings submenu, so it is the only way to the settings
* pages: it has to list every page a role may open, and none it may not.
*/
class IndexControllerTest extends WebTestCase
{
private KernelBrowser $client;
private EntityManagerInterface $entityManager;
protected function setUp(): void
{
$this->client = static::createClient(server: ['HTTPS' => true]);
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
$this->entityManager->createQuery(sprintf('DELETE FROM %s', User::class))->execute();
}
public function testAnAdminSeesEverySettingsPage(): void
{
$routes = $this->settingsRoutes(['ROLE_TEAM_ADMIN']);
$this->assertCount(15, $routes);
$this->assertContains('app_admin_system_user_index', $routes);
}
public function testAManagerSeesOnlyTheSharedSettingsPages(): void
{
$routes = $this->settingsRoutes(['ROLE_MANAGER']);
$this->assertCount(7, $routes);
foreach ($routes as $route) {
$this->assertStringStartsWith('app_administrative_system_', $route);
}
}
public function testEveryListedPageOpens(): void
{
$crawler = $this->request(['ROLE_TEAM_ADMIN']);
foreach ($crawler->filter('[data-qa-settings-page]')->extract(['href']) as $href) {
$this->client->request('GET', $href);
$this->assertSame(Response::HTTP_OK, $this->client->getResponse()->getStatusCode(), $href);
}
}
public function testTheUserMenuLinksTheOtherAreasButNotTheCurrentOne(): void
{
$crawler = $this->request(['ROLE_TEAM_ADMIN', 'ROLE_MANAGER']);
$labels = $crawler->filter('[role="menu"] a')->each(static fn (Crawler $link): string => trim($link->text()));
$this->assertContains('zum Managementbereich', $labels);
$this->assertNotContains('zum Adminbereich', $labels);
$this->assertContains('Logout', $labels);
}
/**
* @param list<string> $roles
*
* @return list<string>
*/
private function settingsRoutes(array $roles): array
{
return $this->request($roles)->filter('[data-qa-settings-page]')->extract(['data-qa-settings-page']);
}
/**
* @param list<string> $roles
*/
private function request(array $roles): Crawler
{
$user = (new User())
->setFirstName('Erika')
->setLastName('Einstellung')
->setEmail('[email protected]')
->setRoles($roles)
->setBusProAddressId(1)
->setBusProPersonId(1)
;
$this->entityManager->persist($user);
$this->entityManager->flush();
$this->client->loginUser($user);
$crawler = $this->client->request('GET', '/administrative/system');
$this->assertSame(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
return $crawler;
}
}