feat: streamlined teamer info modals, internal teamer remarks
This commit is contained in:
1 parent
0b743172e7
commit
9192e8220d
13 files changed
+201
-86
No files matched your search
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user