feat: all-season assignments
This commit is contained in:
1 parent
675cec1b69
commit
cf876ed224
119 files changed
+6194
-294
No files matched your search
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\SeasonAssignment;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\SeasonAssignmentTask;
|
||||
use App\Form\SeasonTaskDeadlineType;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class TaskDeadlineController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route(
|
||||
path: '/administrative/season-assignment/task/{uuid}/deadline',
|
||||
name: 'app_administrative_season_assignment_task_deadline'
|
||||
)]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(SeasonAssignmentTask $task, Request $request): Response
|
||||
{
|
||||
$seasonAssignment = $task->getSeasonAssignment();
|
||||
|
||||
$returnUrl = $this->getReturnUrl($request, 'app_administrative_season_assignment_detail', [
|
||||
'uuid' => $seasonAssignment?->getUuid(),
|
||||
]);
|
||||
|
||||
$form = $this->createForm(SeasonTaskDeadlineType::class, $task, [
|
||||
'action' => $this->generateUrl('app_administrative_season_assignment_task_deadline', [
|
||||
'uuid' => $task->getUuid(),
|
||||
'r' => $returnUrl,
|
||||
]),
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Change season assignment task deadlines', [
|
||||
'season_assignment_id' => $seasonAssignment?->getId(),
|
||||
'teamer' => $seasonAssignment?->getTeamer()?->getFullName(),
|
||||
'task' => $task->getTaskKey(),
|
||||
'deadline_override_1' => $task->getDeadlineOverride1()?->format('Y-m-d'),
|
||||
'deadline_override_2' => $task->getDeadlineOverride2()?->format('Y-m-d'),
|
||||
]);
|
||||
|
||||
$this->addFlash('success', 'Die Fristen wurden gespeichert');
|
||||
|
||||
return new HxRedirectResponse($returnUrl);
|
||||
}
|
||||
|
||||
return $this->render('administrative/season_assignment/modal_task_deadline.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'task' => $task,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user