mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-05 20:44:19 +01:00
Introduce importmap, enhance elimination workflows, and update assets
This commit adds initial importmap configuration to manage assets, updates the elimination preparation workflow with form enhancements and database changes, introduces new styles and JS assets, refines translations, and improves entity handling with an input bag update method.
This commit is contained in:
@@ -8,7 +8,9 @@ use App\Entity\Elimination;
|
||||
use App\Entity\Quiz;
|
||||
use App\Entity\Season;
|
||||
use App\Factory\EliminationFactory;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
@@ -23,8 +25,15 @@ final class PrepareEliminationController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/backoffice/elimination/{elimination}', name: 'app_prepare_elimination_view')]
|
||||
public function viewElimination(Elimination $elimination): Response
|
||||
public function viewElimination(Elimination $elimination, Request $request, EntityManagerInterface $em): Response
|
||||
{
|
||||
if ('POST' === $request->getMethod()) {
|
||||
$elimination->updateFromInputBag($request->request);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', 'Elimination updated');
|
||||
}
|
||||
|
||||
return $this->render('backoffice/prepare_elimination/index.html.twig', [
|
||||
'controller_name' => 'PrepareEliminationController',
|
||||
'elimination' => $elimination,
|
||||
|
||||
@@ -10,6 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Safe\DateTimeImmutable;
|
||||
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
|
||||
use Symfony\Bridge\Doctrine\Types\UuidType;
|
||||
use Symfony\Component\HttpFoundation\InputBag;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
#[ORM\Entity(repositoryClass: EliminationRepository::class)]
|
||||
@@ -62,6 +63,19 @@ class Elimination
|
||||
return $this->quiz;
|
||||
}
|
||||
|
||||
/** @param InputBag<bool|float|int|string> $inputBag */
|
||||
public function updateFromInputBag(InputBag $inputBag): self
|
||||
{
|
||||
foreach ($this->data as $name => $screenColour) {
|
||||
$newColour = $inputBag->get('colour-'.mb_strtolower($name));
|
||||
if (\is_string($newColour)) {
|
||||
$this->data[$name] = $inputBag->get('colour-'.mb_strtolower($name));
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[ORM\PrePersist]
|
||||
public function setCreatedAtValue(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user