wip: functionality for new role 'management'

This commit is contained in:
Björn Fromme
2024-02-14 14:59:47 +01:00
parent 7f05cf30b6
commit 7c7addf531
17 changed files with 312 additions and 68 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240214134047 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE feedback ADD hotel VARCHAR(255) DEFAULT NULL, ADD hotel_code VARCHAR(32) DEFAULT NULL, ADD hotel_bus_pro_id INT DEFAULT NULL, ADD assignment_date_to DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', CHANGE assignment_date assignment_date_from DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE feedback ADD assignment_date DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', DROP hotel, DROP hotel_code, DROP hotel_bus_pro_id, DROP assignment_date_from, DROP assignment_date_to');
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ class IndexController extends AbstractController
}
#[Route('/admin', name: 'app_admin_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(): Response
{
$applications = $this->applicationRepository->getNew();
@@ -11,7 +11,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
class CrmSelectionsController extends AbstractController
{
#[Route('/admin/teamer/crm-selections/{uuid}', name: 'app_admin_teamer_crm_selections')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
return $this->render('admin/teamer/crm_selections.html.twig', [
@@ -7,6 +7,7 @@ use App\Repository\DispositionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class InfoController extends AbstractController
{
@@ -14,6 +15,7 @@ class InfoController extends AbstractController
{}
#[Route('/admin/teamer/info/{uuid}', name: 'app_admin_teamer_info')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
$recentDispositions = $this->dispositionRepository->findRecentDispositionsByTeamer($teamer);
@@ -15,7 +15,7 @@ class SkillsController extends AbstractController
{}
#[Route('/admin/teamer/skills/{uuid}', name: 'app_admin_teamer_skills')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
#[IsGranted('ROLE_ADMIN')]
public function index(Teamer $teamer): Response
{
$trainings = $this->trainingRepository->getList();
@@ -0,0 +1,42 @@
<?php
namespace App\Controller\Administrative\Feedback;
use App\Repository\FeedbackRepository;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class IndexController extends AbstractController
{
public function __construct(
private readonly FeedbackRepository $feedbackRepository,
private readonly PaginatorInterface $paginator
) {
}
#[Route('/administrative/feedback', name: 'app_administrative_feedback_index')]
public function index(Request $request): Response
{
$query = $this
->feedbackRepository
->getListQuery()
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'feedback.createdAt',
'defaultSortDirection' => 'desc',
]
);
return $this->render('administrative/feedback/index.html.twig', [
'pagination' => $pagination,
]);
}
}
@@ -1,6 +1,6 @@
<?php
namespace App\Controller\Admin\Teamer;
namespace App\Controller\Administrative\Teamer;
use App\Repository\TeamerRepository;
use App\Service\Common\TeamerFilterHandler;
@@ -20,7 +20,7 @@ class IndexController extends AbstractController
) {
}
#[Route('/admin/teamer', name: 'app_admin_teamer_index')]
#[Route('/administrative/teamer', name: 'app_administrative_teamer_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Request $request): Response
{
@@ -41,7 +41,7 @@ class IndexController extends AbstractController
]
);
return $this->render('admin/teamer/index.html.twig', [
return $this->render('administrative/teamer/index.html.twig', [
'pagination' => $pagination,
'filterDto' => $filterDto,
]);
@@ -1,6 +1,6 @@
<?php
namespace App\Controller\Admin\Teamer;
namespace App\Controller\Administrative\Teamer;
use App\Entity\Teamer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -10,11 +10,11 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
class ProfileController extends AbstractController
{
#[Route('/admin/teamer/profile/{uuid}', name: 'app_admin_teamer_profile')]
#[Route('/administrative/teamer/profile/{uuid}', name: 'app_administrative_teamer_profile')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer): Response
{
return $this->render('admin/teamer/profile.html.twig', [
return $this->render('administrative/teamer/profile.html.twig', [
'teamer' => $teamer,
]);
}
@@ -1,6 +1,6 @@
<?php
namespace App\Controller\Admin\Teamer;
namespace App\Controller\Administrative\Teamer;
use App\Entity\Teamer;
use App\Repository\DispositionRepository;
@@ -19,7 +19,7 @@ class RecentAssignmentsController extends AbstractController
) {
}
#[Route('/admin/teamer/recent-assignments/{uuid}', name: 'app_admin_teamer_recent_assignments')]
#[Route('/administrative/teamer/recent-assignments/{uuid}', name: 'app_administrative_teamer_recent_assignments')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer, Request $request): Response
{
@@ -39,7 +39,7 @@ class RecentAssignmentsController extends AbstractController
);
return $this->render('admin/teamer/recent_assignments.html.twig', [
return $this->render('administrative/teamer/recent_assignments.html.twig', [
'teamer' => $teamer,
'pagination' => $pagination,
]);
+75 -8
View File
@@ -40,8 +40,20 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
#[ORM\Column(length: 255, nullable: true)]
private ?string $jobProfileName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $hotel = null;
#[ORM\Column(length: 32, nullable: true)]
private ?string $hotelCode = null;
#[ORM\Column(nullable: true)]
private ?int $hotelBusProId = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $assignmentDate = null;
private ?\DateTimeImmutable $assignmentDateFrom = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
private ?\DateTimeImmutable $assignmentDateTo = null;
#[ORM\Column]
#[Assert\Count(min: 1, minMessage: 'Bitte gib eine Bewertung ab')]
@@ -69,10 +81,17 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
{
$instance = new static($user);
$destination = $assignment->getDestination();
$jobProfile = $assignment->getJobProfile();
$instance
->setDestinationName($assignment->getDestination()->getProduct())
->setAssignmentDate($assignment->getEffectiveDateFrom())
->setJobProfileName($assignment->getJobProfile()->getName())
->setAssignmentDateFrom($assignment->getEffectiveDateFrom())
->setAssignmentDateTo($assignment->getEffectiveDateTo())
->setDestinationName($destination->getProduct())
->setHotel($destination->getHotel())
->setHotelCode($destination->getHotelCode())
->setHotelBusProId($destination->getHotelBusProId())
->setJobProfileName($jobProfile->getName())
;
return $instance;
@@ -124,14 +143,26 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
return $this;
}
public function getAssignmentDate(): ?\DateTimeImmutable
public function getAssignmentDateFrom(): ?\DateTimeImmutable
{
return $this->assignmentDate;
return $this->assignmentDateFrom;
}
public function setAssignmentDate(\DateTimeImmutable $assignmentDate): static
public function setAssignmentDateFrom(\DateTimeImmutable $assignmentDateFrom): static
{
$this->assignmentDate = $assignmentDate;
$this->assignmentDateFrom = $assignmentDateFrom;
return $this;
}
public function getAssignmentDateTo(): ?\DateTimeImmutable
{
return $this->assignmentDateTo;
}
public function setAssignmentDateTo(?\DateTimeImmutable $assignmentDateTo): static
{
$this->assignmentDateTo = $assignmentDateTo;
return $this;
}
@@ -148,6 +179,42 @@ class Feedback implements BlameableEntityInterface, TimestampableEntityInterface
return $this;
}
public function getHotel(): ?string
{
return $this->hotel;
}
public function setHotel(?string $hotel): static
{
$this->hotel = $hotel;
return $this;
}
public function getHotelCode(): ?string
{
return $this->hotelCode;
}
public function setHotelCode(?string $hotelCode): static
{
$this->hotelCode = $hotelCode;
return $this;
}
public function getHotelBusProId(): ?int
{
return $this->hotelBusProId;
}
public function setHotelBusProId(?int $hotelBusProId): static
{
$this->hotelBusProId = $hotelBusProId;
return $this;
}
public function getRatings(): array
{
return $this->ratings;
+17 -4
View File
@@ -49,14 +49,27 @@ class AdminMenuBuilder extends AbstractMenuBuilder
'icon' => 'document',
],
]);
$menu->addChild('Feedbackübersicht', [
'route' => 'app_administrative_feedback_index',
'linkAttributes' => [
'title' => 'Feedbackübersicht',
],
'extras' => [
'icon' => 'feedback',
'routes' => [
['pattern' => '/^app_administrative_feedback_/']
],
],
]);
$menu->addChild('Teamübersicht', [
'route' => 'app_admin_teamer_index',
'route' => 'app_administrative_teamer_index',
'linkAttributes' => [
'title' => 'Teamübersicht',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_teamer_/'],
['pattern' => '/^app_admin_teamer_/']
],
],
@@ -181,7 +194,7 @@ class AdminMenuBuilder extends AbstractMenuBuilder
$menu = $this->createRootElement();
$menu->addChild('Stammdaten &amp; Foto', [
'route' => 'app_admin_teamer_profile',
'route' => 'app_administrative_teamer_profile',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Stammdaten & Foto',
@@ -209,7 +222,7 @@ class AdminMenuBuilder extends AbstractMenuBuilder
],
]);
$menu->addChild('Vergangene Einsätze', [
'route' => 'app_admin_teamer_recent_assignments',
'route' => 'app_administrative_teamer_recent_assignments',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Vergangene Einsätze',
@@ -219,7 +232,7 @@ class AdminMenuBuilder extends AbstractMenuBuilder
$this->addDivider($menu);
$menu->addChild('zurück zur Übersicht', [
'route' => 'app_admin_teamer_index',
'route' => 'app_administrative_teamer_index',
'extras' => [
'icon' => 'arrow-left',
],
+27 -36
View File
@@ -40,18 +40,30 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
'icon' => 'document',
],
]);
// $menu->addChild('Teamübersicht', [
// 'route' => 'app_admin_teamer_index',
// 'linkAttributes' => [
// 'title' => 'Teamübersicht',
// ],
// 'extras' => [
// 'icon' => 'users',
// 'routes' => [
// ['pattern' => '/^app_admin_teamer_/']
// ],
// ],
// ]);
$menu->addChild('Teamübersicht', [
'route' => 'app_administrative_teamer_index',
'linkAttributes' => [
'title' => 'Teamübersicht',
],
'extras' => [
'icon' => 'users',
'routes' => [
['pattern' => '/^app_administrative_teamer_/']
],
],
]);
$menu->addChild('Feedbackübersicht', [
'route' => 'app_administrative_feedback_index',
'linkAttributes' => [
'title' => 'Feedbackübersicht',
],
'extras' => [
'icon' => 'feedback',
'routes' => [
['pattern' => '/^app_administrative_feedback_/']
],
],
]);
$settingsMenu = $menu->addChild('Einstellungen', [
'linkAttributes' => [
'title' => 'Einstellungen',
@@ -96,35 +108,14 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
$menu = $this->createRootElement();
$menu->addChild('Stammdaten &amp; Foto', [
'route' => 'app_admin_teamer_profile',
'route' => 'app_administrative_teamer_profile',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Stammdaten & Foto',
],
]);
$menu->addChild('Jobprofile &amp; Skills', [
'route' => 'app_admin_teamer_skills',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Jobprofile & Skills',
],
]);
$menu->addChild('Verfügbarkeit', [
'route' => 'app_admin_teamer_availability',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Verfügbarkeit',
],
]);
$menu->addChild('Selektionsmerkmale', [
'route' => 'app_admin_teamer_crm_selections',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Selektionsmerkmale',
],
]);
$menu->addChild('Vergangene Einsätze', [
'route' => 'app_admin_teamer_recent_assignments',
'route' => 'app_administrative_teamer_recent_assignments',
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
'linkAttributes' => [
'title' => 'Vergangene Einsätze',
@@ -134,7 +125,7 @@ class ManagerMenuBuilder extends AbstractMenuBuilder
$this->addDivider($menu);
$menu->addChild('zurück zur Übersicht', [
'route' => 'app_admin_teamer_index',
'route' => 'app_administrative_teamer_index',
'extras' => [
'icon' => 'arrow-left',
],
+12
View File
@@ -5,6 +5,7 @@ namespace App\Repository;
use App\Entity\Feedback;
use App\Entity\Teamer;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ManagerRegistry;
/**
@@ -22,6 +23,17 @@ class FeedbackRepository extends ServiceEntityRepository
parent::__construct($registry, Feedback::class);
}
public function getListQuery(): Query
{
$qb = $this->createQueryBuilder('feedback');
return $qb
->select('feedback', 'teamer')
->innerJoin('feedback.teamer', 'teamer')
->getQuery()
;
}
public function getNew(int $limit = 5): array
{
$qb = $this->createQueryBuilder('feedback');
@@ -0,0 +1,78 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Feedbackübersicht{% endblock %}
{% block content %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Feedbackübersicht
</h1>
</div>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Name', 'teamer.lastName') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Vorname', 'teamer.firstName') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Einsatzzeitraum', 'feedback.assignmentDateFrom') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Haus', 'feedback.hotel') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Note', 'feedback.averageRating') }}
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for feedback in pagination %}
<tr>
<td>
{{ feedback.teamer.lastName }}
</td>
<td>
{{ feedback.teamer.firstName }}
</td>
<td>
{% if feedback.assignmentDateFrom and feedback.assignmentDateTo %}
{{ feedback.assignmentDateFrom|date('d.m.Y') }}-
<br>
{{ feedback.assignmentDateTo|date('d.m.Y') }}
{% else %}
-
{% endif %}
</td>
<td>
{{ feedback.hotel|default('-') }}
</td>
<td>
{% if feedback.averageRating %}
{{ feedback.averageRating|format_rating }}
{% else %}
-
{% endif %}
</td>
<td>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
{% endblock %}
@@ -1,4 +1,4 @@
{% extends 'admin/layout.html.twig' %}
{% extends 'administrative/layout.html.twig' %}
{% block title %}Teamübersicht{% endblock %}
@@ -70,12 +70,12 @@
</div>
</td>
<td>
<a href="{{ path('app_admin_teamer_profile', { 'uuid': teamer.uuid }) }}">
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': teamer.uuid }) }}">
<span class="whitespace-nowrap">{{ teamer.lastName }}</span>
</a>
</td>
<td>
<a href="{{ path('app_admin_teamer_profile', { 'uuid': teamer.uuid }) }}" class="whitespace-nowrap">
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': teamer.uuid }) }}" class="whitespace-nowrap">
{{ teamer.firstName }}
</a>
</td>
@@ -94,7 +94,7 @@
</td>
<td>
<div class="flex items-center space-x-1 justify-end">
<a href="{{ path('app_admin_teamer_profile', { 'uuid': teamer.uuid }) }}" title="Teamer:innenprofil {{ teamer }}">
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': teamer.uuid }) }}" title="Teamer:innenprofil {{ teamer }}">
{{ icon('user') }}
</a>
</div>
@@ -1,11 +1,15 @@
{% extends 'admin/layout.html.twig' %}
{% extends 'administrative/layout.html.twig' %}
{% block title %}Stammdaten und Foto {{ teamer }}{% endblock %}
{% block content %}
<div class="grid lg:grid-cols-3 gap-y-8 lg:gap-y-0 lg:gap-x-8">
<div>
{{ knp_menu_render(knp_menu_get('admin_teamer')) }}
{% if is_granted('ROLE_MANAGER') %}
{{ knp_menu_render(knp_menu_get('manager_teamer')) }}
{% elseif is_granted('ROLE_ADMIN') %}
{{ knp_menu_render(knp_menu_get('admin_teamer')) }}
{% endif %}
</div>
<div class="lg:col-span-2">
<h1 class="text-2xl font-bold pb-8">
@@ -1,11 +1,15 @@
{% extends 'admin/layout.html.twig' %}
{% extends 'administrative/layout.html.twig' %}
{% block title %}Vergangene Einsätze &amp; Feeback {{ teamer }}{% endblock %}
{% block content %}
<div class="grid lg:grid-cols-3 gap-y-8 lg:gap-y-0 lg:gap-x-8">
<div>
{{ knp_menu_render(knp_menu_get('admin_teamer')) }}
{% if is_granted('ROLE_MANAGER') %}
{{ knp_menu_render(knp_menu_get('manager_teamer')) }}
{% elseif is_granted('ROLE_ADMIN') %}
{{ knp_menu_render(knp_menu_get('admin_teamer')) }}
{% endif %}
</div>
<div class="lg:col-span-2">
<h1 class="text-2xl font-bold pb-8">