feat: streamlined teamer info modals, internal teamer remarks
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\Application;
|
||||
|
||||
use App\Entity\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class InfoController extends AbstractController
|
||||
{
|
||||
#[Route('/admin/application/info/{uuid}', name: 'app_admin_application_info')]
|
||||
public function index(Application $application): Response
|
||||
{
|
||||
return $this->render('admin/application/modal_info.html.twig', [
|
||||
'application' => $application,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\Teamer;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Teamer;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class RemarksController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{}
|
||||
|
||||
#[Route('/admin/teamer/remarks/{uuid}', name: 'app_admin_teamer_remarks_internal')]
|
||||
#[IsGranted('ROLE_ADMIN')]
|
||||
public function index(Teamer $teamer, Request $request): Response
|
||||
{
|
||||
$returnUrl = $this->getReturnUrl($request, 'app_administrative_teamer_index');
|
||||
|
||||
$form = $this
|
||||
->createFormBuilder([
|
||||
'remarks' => $teamer->getRemarksInternal(),
|
||||
], [
|
||||
'action' => $this->generateUrl('app_admin_teamer_remarks_internal', [
|
||||
'uuid' => $teamer->getUuid(),
|
||||
'r' => $returnUrl,
|
||||
])
|
||||
])
|
||||
->add('remarks', TextareaType::class, [
|
||||
'label' => 'Anmerkungen',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'rows' => 10,
|
||||
],
|
||||
])
|
||||
->getForm()
|
||||
;
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$teamer->setRemarksInternal($form->get('remarks')->getData());
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Die Anmerkungen wurden gespeichert.');
|
||||
|
||||
return $this->redirectToRoute('app_admin_teamer_remarks_internal', [
|
||||
'uuid' => $teamer->getUuid(),
|
||||
'r' => $returnUrl,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->render('admin/teamer/remarks_internal.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'form' => $form->createView(),
|
||||
'returnUrl' => $returnUrl,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -51,8 +51,18 @@ class CreateController extends AbstractController
|
||||
$yearFrom = (int) date('Y');
|
||||
$yearsRange = range($yearFrom + 1, $yearFrom - 10);
|
||||
|
||||
$returnUrl = $this->getReturnUrl($request, 'app_admin_teamer_skills', [
|
||||
'uuid' => $teamer->getUuid(),
|
||||
]);
|
||||
|
||||
$form = $this
|
||||
->createFormBuilder($attendance)
|
||||
->createFormBuilder($attendance, [
|
||||
'action' => $this->generateUrl('app_admin_teamer_skills_training_attendance_create', [
|
||||
'training_id' => $training->getId(),
|
||||
'teamer_id' => $teamer->getId(),
|
||||
'r' => $returnUrl,
|
||||
])
|
||||
])
|
||||
->add('date', AbbreviatedDateType::class, [
|
||||
'label' => 'Datum',
|
||||
'years' => $yearsRange,
|
||||
@@ -79,11 +89,7 @@ class CreateController extends AbstractController
|
||||
'training_name' => $training->getName(),
|
||||
]);
|
||||
|
||||
$redirectUrl = $this->getReturnUrl($request, 'app_admin_teamer_skills', [
|
||||
'uuid' => $teamer->getUuid(),
|
||||
]);
|
||||
|
||||
return new HxRedirectResponse($redirectUrl);
|
||||
return new HxRedirectResponse($returnUrl);
|
||||
}
|
||||
|
||||
return $this->render('admin/teamer/training_attendance/modal_create.html.twig', [
|
||||
|
||||
@@ -2,28 +2,35 @@
|
||||
|
||||
namespace App\Controller\Administrative\Teamer;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Teamer;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class InfoController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(private readonly DispositionRepository $dispositionRepository)
|
||||
{}
|
||||
|
||||
#[Route('/administrative/teamer/info/{uuid}', name: 'app_administrative_teamer_info')]
|
||||
#[IsGranted(new Expression('is_granted("ROLE_ADMINISTRATIVE") or is_granted("ROLE_HOUSE_MANAGER")'))]
|
||||
public function index(Teamer $teamer): Response
|
||||
public function index(Teamer $teamer, Request $request): Response
|
||||
{
|
||||
$returnUrl = $this->getReturnUrl($request, 'app_administrative_assignment_index');
|
||||
|
||||
$recentDispositions = $this->dispositionRepository->findRecentDispositionsByTeamer($teamer);
|
||||
|
||||
return $this->render('administrative/teamer/modal_info.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'recentDispositions' => $recentDispositions,
|
||||
'returnUrl' => $returnUrl,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -83,6 +83,9 @@ class Teamer implements TimestampableEntityInterface
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $remarks = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $remarksInternal = null;
|
||||
|
||||
#[ORM\ManyToMany(targetEntity: Availability::class, inversedBy: 'teamers')]
|
||||
#[ORM\OrderBy(['dateFrom' => 'ASC'])]
|
||||
private Collection $availabilities;
|
||||
@@ -388,6 +391,18 @@ class Teamer implements TimestampableEntityInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRemarksInternal(): ?string
|
||||
{
|
||||
return $this->remarksInternal;
|
||||
}
|
||||
|
||||
public function setRemarksInternal(?string $remarksInternal): static
|
||||
{
|
||||
$this->remarksInternal = $remarksInternal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Availability>
|
||||
*/
|
||||
|
||||
@@ -285,6 +285,13 @@ class AdminMenuBuilder extends AbstractMenuBuilder
|
||||
'title' => 'Vergangene Einsätze',
|
||||
],
|
||||
]);
|
||||
$menu->addChild('Anmerkungen (intern)', [
|
||||
'route' => 'app_admin_teamer_remarks_internal',
|
||||
'routeParameters' => $this->getDefaultRouteParameters('uuid'),
|
||||
'linkAttributes' => [
|
||||
'title' => 'Anmerkungen (intern)',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->addDivider($menu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user