feat: generate draft assignments from a staffing matrix

This commit is contained in:
fromme committed 2026-10-15 18:11:51 +02:00
1 parent 3116d23199
commit 2fc9806c69
41 files changed
+2618

No files matched your search

@@ -0,0 +1,49 @@
<?php
namespace App\Controller\Admin\System\StaffingRule;
use App\Entity\StaffingRule;
use App\Form\StaffingRuleType;
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 CreateController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LoggerInterface $logger,
) {
}
#[Route('/admin/system/staffing-rule/create', name: 'app_admin_system_staffing_rule_create')]
#[IsGranted('ROLE_TEAM_ADMIN')]
public function index(Request $request): Response
{
$rule = new StaffingRule();
$form = $this->createForm(StaffingRuleType::class, $rule);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->entityManager->persist($rule);
$this->entityManager->flush();
$this->addFlash('success', 'Die Zeile der Besetzungsmatrix wurde angelegt');
$this->logger->info('Create staffing rule', [
'staffing_rule_id' => $rule->getId(),
'product_code' => $rule->getProductCode(),
]);
return new HxRedirectResponse($this->generateUrl('app_admin_system_staffing_rule_index'));
}
return $this->render('admin/system/staffing_rule/modal_create.html.twig', [
'form' => $form->createView(),
]);
}
}