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
+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');