add price feature
All checks were successful
/ ls (pull_request) Successful in 1m37s
/ ls (push) Successful in 1m37s

This commit is contained in:
lubiana 2025-06-29 23:18:23 +02:00
parent 15f8db46a0
commit 64f5341371
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
18 changed files with 484 additions and 157 deletions

View file

@ -4,6 +4,7 @@ namespace App\Controller;
use App\Entity\FoodOrder;
use App\Form\FoodOrderType;
use App\Form\OrderFinalize;
use App\Repository\FoodOrderRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -104,11 +105,21 @@ final class FoodOrderController extends AbstractController
], Response::HTTP_SEE_OTHER);
}
#[Route('/{id}', name: 'app_food_order_show', methods: ['GET'])]
public function show(FoodOrder $foodOrder): Response
#[Route('/{id}', name: 'app_food_order_show', methods: ['GET', 'POST'])]
public function show(Request $request, FoodOrder $foodOrder, EntityManagerInterface $entityManager): Response
{
$form = null;
if ($foodOrder->isClosed()) {
$form = $this->createForm(OrderFinalize::class, $foodOrder);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($foodOrder);
$entityManager->flush();
}
}
return $this->render('food_order/show.html.twig', [
'food_order' => $foodOrder,
'form' => $form,
]);
}
}