Compare commits

..

2 Commits

Author SHA1 Message Date
ab4653d172 Merge remote-tracking branch 'origin/feature/Controller' into feature/Controller
# Conflicts:
#	templates/plats/index.html.twig
2024-11-21 15:12:24 +01:00
a675b7270d push de controller 2024-11-21 15:11:11 +01:00
38 changed files with 1326 additions and 182 deletions

360
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241010155711 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE eat_id_seq CASCADE');
$this->addSql('CREATE TABLE customer (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, number_phone VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE customer_table (customer_id INT NOT NULL, table_id INT NOT NULL, PRIMARY KEY(customer_id, table_id))');
$this->addSql('CREATE INDEX IDX_381CFA7D9395C3F3 ON customer_table (customer_id)');
$this->addSql('CREATE INDEX IDX_381CFA7DECFF285C ON customer_table (table_id)');
$this->addSql('CREATE TABLE discount (id INT NOT NULL, id_dishes_id INT DEFAULT NULL, description VARCHAR(255) NOT NULL, percentage VARCHAR(255) NOT NULL, fixed_amount DOUBLE PRECISION NOT NULL, start_date DATE NOT NULL, date_end DATE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_E1E0B40E20686F5D ON discount (id_dishes_id)');
$this->addSql('CREATE TABLE dishes (id INT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, category VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, number_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "order" (id INT NOT NULL, id_order_detail_id INT NOT NULL, id_status_order_id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, status VARCHAR(255) NOT NULL, total VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F52993988D09BBCB ON "order" (id_order_detail_id)');
$this->addSql('CREATE INDEX IDX_F5299398F91B0968 ON "order" (id_status_order_id)');
$this->addSql('CREATE TABLE order_user (order_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(order_id, user_id))');
$this->addSql('CREATE INDEX IDX_C062EC5E8D9F6D38 ON order_user (order_id)');
$this->addSql('CREATE INDEX IDX_C062EC5EA76ED395 ON order_user (user_id)');
$this->addSql('CREATE TABLE order_dishes (order_id INT NOT NULL, dishes_id INT NOT NULL, PRIMARY KEY(order_id, dishes_id))');
$this->addSql('CREATE INDEX IDX_9BC2C3888D9F6D38 ON order_dishes (order_id)');
$this->addSql('CREATE INDEX IDX_9BC2C388A05DD37A ON order_dishes (dishes_id)');
$this->addSql('CREATE TABLE order_detail (id INT NOT NULL, quantity DOUBLE PRECISION NOT NULL, unit_price DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservation (id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, number_people INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE reservation_user (reservation_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(reservation_id, user_id))');
$this->addSql('CREATE INDEX IDX_9BAA1B21B83297E7 ON reservation_user (reservation_id)');
$this->addSql('CREATE INDEX IDX_9BAA1B21A76ED395 ON reservation_user (user_id)');
$this->addSql('CREATE TABLE status_order (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE status_table (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "table" (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7D9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7DECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E20686F5D FOREIGN KEY (id_dishes_id) REFERENCES dishes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F52993988D09BBCB FOREIGN KEY (id_order_detail_id) REFERENCES order_detail (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F5299398F91B0968 FOREIGN KEY (id_status_order_id) REFERENCES status_order (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5E8D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5EA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C3888D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C388A05DD37A FOREIGN KEY (dishes_id) REFERENCES dishes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE eat_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7D9395C3F3');
$this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7DECFF285C');
$this->addSql('ALTER TABLE discount DROP CONSTRAINT FK_E1E0B40E20686F5D');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F52993988D09BBCB');
$this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F5299398F91B0968');
$this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5E8D9F6D38');
$this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5EA76ED395');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C3888D9F6D38');
$this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C388A05DD37A');
$this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21B83297E7');
$this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21A76ED395');
$this->addSql('DROP TABLE customer');
$this->addSql('DROP TABLE customer_table');
$this->addSql('DROP TABLE discount');
$this->addSql('DROP TABLE dishes');
$this->addSql('DROP TABLE "order"');
$this->addSql('DROP TABLE order_user');
$this->addSql('DROP TABLE order_dishes');
$this->addSql('DROP TABLE order_detail');
$this->addSql('DROP TABLE reservation');
$this->addSql('DROP TABLE reservation_user');
$this->addSql('DROP TABLE status_order');
$this->addSql('DROP TABLE status_table');
$this->addSql('DROP TABLE "table"');
$this->addSql('DROP TABLE "user"');
$this->addSql('DROP TABLE messenger_messages');
}
}

77
public/css/list.css Normal file
View File

@ -0,0 +1,77 @@
/* Global styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1 {
text-align: center;
color: #db5559;
margin-bottom: 20px;
}
/* Table styles */
.table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.table th, .table td {
padding: 12px;
text-align: left;
border: 1px solid #ddd;
}
.table th {
background-color: #db5559;
color: white;
}
.table tr:nth-child(even) {
background-color: #f2f2f2;
}
.table tr:hover {
background-color: #ddd;
}
/* Action links */
a {
text-decoration: none;
color: #db5559;
font-weight: bold;
}
a:hover {
color: #38538e;
text-decoration: underline;
}
/* New client button */
a[href*="app_clients_new"] {
display: inline-block;
margin-top: 20px;
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border-radius: 5px;
font-size: 16px;
text-align: center;
transition: background-color 0.3s ease;
}
a[href*="app_clients_new"]:hover {
background-color: #388E3C;
}
/* Empty table row message */
.table td[colspan="6"] {
text-align: center;
font-style: italic;
color: #666;
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\Clients;
use App\Form\ClientsType;
use App\Repository\ClientsRepository;
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;
#[Route('/clients')]
final class ClientsController extends AbstractController
{
#[Route(name: 'app_clients_index', methods: ['GET'])]
public function index(ClientsRepository $clientsRepository): Response
{
return $this->render('clients/index.html.twig', [
'clients' => $clientsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_clients_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$client = new Clients();
$form = $this->createForm(ClientsType::class, $client);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($client);
$entityManager->flush();
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('clients/new.html.twig', [
'client' => $client,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_clients_show', methods: ['GET'])]
public function show(Clients $client): Response
{
return $this->render('clients/show.html.twig', [
'client' => $client,
]);
}
#[Route('/{id}/edit', name: 'app_clients_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Clients $client, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ClientsType::class, $client);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('clients/edit.html.twig', [
'client' => $client,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_clients_delete', methods: ['POST'])]
public function delete(Request $request, Clients $client, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$client->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($client);
$entityManager->flush();
}
return $this->redirectToRoute('app_clients_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\Commandes;
use App\Form\CommandesType;
use App\Repository\CommandesRepository;
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;
#[Route('/commandes')]
final class CommandesController extends AbstractController
{
#[Route(name: 'app_commandes_index', methods: ['GET'])]
public function index(CommandesRepository $commandesRepository): Response
{
return $this->render('commandes/index.html.twig', [
'commandes' => $commandesRepository->findAll(),
]);
}
#[Route('/new', name: 'app_commandes_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$commande = new Commandes();
$form = $this->createForm(CommandesType::class, $commande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($commande);
$entityManager->flush();
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('commandes/new.html.twig', [
'commande' => $commande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_commandes_show', methods: ['GET'])]
public function show(Commandes $commande): Response
{
return $this->render('commandes/show.html.twig', [
'commande' => $commande,
]);
}
#[Route('/{id}/edit', name: 'app_commandes_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(CommandesType::class, $commande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('commandes/edit.html.twig', [
'commande' => $commande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_commandes_delete', methods: ['POST'])]
public function delete(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$commande->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($commande);
$entityManager->flush();
}
return $this->redirectToRoute('app_commandes_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\DetailsCommande;
use App\Form\DetailsCommandeType;
use App\Repository\DetailsCommandeRepository;
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;
#[Route('/details/commande')]
final class DetailsCommandeController extends AbstractController
{
#[Route(name: 'app_details_commande_index', methods: ['GET'])]
public function index(DetailsCommandeRepository $detailsCommandeRepository): Response
{
return $this->render('details_commande/index.html.twig', [
'details_commandes' => $detailsCommandeRepository->findAll(),
]);
}
#[Route('/new', name: 'app_details_commande_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$detailsCommande = new DetailsCommande();
$form = $this->createForm(DetailsCommandeType::class, $detailsCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($detailsCommande);
$entityManager->flush();
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('details_commande/new.html.twig', [
'details_commande' => $detailsCommande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_details_commande_show', methods: ['GET'])]
public function show(DetailsCommande $detailsCommande): Response
{
return $this->render('details_commande/show.html.twig', [
'details_commande' => $detailsCommande,
]);
}
#[Route('/{id}/edit', name: 'app_details_commande_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, DetailsCommande $detailsCommande, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(DetailsCommandeType::class, $detailsCommande);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('details_commande/edit.html.twig', [
'details_commande' => $detailsCommande,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_details_commande_delete', methods: ['POST'])]
public function delete(Request $request, DetailsCommande $detailsCommande, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$detailsCommande->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($detailsCommande);
$entityManager->flush();
}
return $this->redirectToRoute('app_details_commande_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\Reductions;
use App\Form\ReductionsType;
use App\Repository\ReductionsRepository;
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;
#[Route('/reductions')]
final class ReductionsController extends AbstractController
{
#[Route(name: 'app_reductions_index', methods: ['GET'])]
public function index(ReductionsRepository $reductionsRepository): Response
{
return $this->render('reductions/index.html.twig', [
'reductions' => $reductionsRepository->findAll(),
]);
}
#[Route('/new', name: 'app_reductions_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$reduction = new Reductions();
$form = $this->createForm(ReductionsType::class, $reduction);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($reduction);
$entityManager->flush();
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reductions/new.html.twig', [
'reduction' => $reduction,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_reductions_show', methods: ['GET'])]
public function show(Reductions $reduction): Response
{
return $this->render('reductions/show.html.twig', [
'reduction' => $reduction,
]);
}
#[Route('/{id}/edit', name: 'app_reductions_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ReductionsType::class, $reduction);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('reductions/edit.html.twig', [
'reduction' => $reduction,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_reductions_delete', methods: ['POST'])]
public function delete(Request $request, Reductions $reduction, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$reduction->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($reduction);
$entityManager->flush();
}
return $this->redirectToRoute('app_reductions_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -2,12 +2,13 @@
namespace App\Entity; namespace App\Entity;
use AllowDynamicProperties;
use App\Repository\ClientsRepository; use App\Repository\ClientsRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientsRepository::class)] #[AllowDynamicProperties] #[ORM\Entity(repositoryClass: ClientsRepository::class)]
class Clients class Clients
{ {
#[ORM\Id] #[ORM\Id]

41
src/Form/ClientsType.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace App\Form;
use App\Entity\Clients;
use App\Entity\Commandes;
use App\Entity\Tables;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ClientsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Prenom')
->add('Nom')
->add('Email')
->add('Telephone')
->add('table', EntityType::class, [
'class' => Tables::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('commandes', EntityType::class, [
'class' => Commandes::class,
'choice_label' => 'id',
'multiple' => true,
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Clients::class,
]);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Form;
use App\Entity\Clients;
use App\Entity\Commandes;
use App\Entity\Plats;
use App\Entity\StatutCommandes;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CommandesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('DateHeure', null, [
'widget' => 'single_text',
])
->add('Statut')
->add('Total')
->add('Client', EntityType::class, [
'class' => Clients::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('plats', EntityType::class, [
'class' => Plats::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('StatutCommande', EntityType::class, [
'class' => StatutCommandes::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Commandes::class,
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Form;
use App\Entity\Commandes;
use App\Entity\DetailsCommande;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DetailsCommandeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Quantite')
->add('PrixUnitaire')
->add('Commande', EntityType::class, [
'class' => Commandes::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => DetailsCommande::class,
]);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Form;
use App\Entity\Reductions;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ReductionsType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('Description')
->add('Prix')
->add('Pourcentage')
->add('MontantFixe')
->add('DateDebut', null, [
'widget' => 'single_text',
])
->add('DateFin', null, [
'widget' => 'single_text',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Reductions::class,
]);
}
}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_clients_delete', {'id': client.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ client.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Clients{% endblock %}
{% block body %}
<h1>Edit Clients</h1>
{{ include('clients/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_clients_index') }}">back to list</a>
{{ include('clients/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,44 @@
{% extends 'base.html.twig' %}
{% block title %}Clients index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Clients index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Prenom</th>
<th>Nom</th>
<th>Email</th>
<th>Telephone</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for client in clients %}
<tr>
<td>{{ client.id }}</td>
<td>{{ client.Prenom }}</td>
<td>{{ client.Nom }}</td>
<td>{{ client.Email }}</td>
<td>{{ client.Telephone }}</td>
<td>
<a href="{{ path('app_clients_show', {'id': client.id}) }}">show</a>
<a href="{{ path('app_clients_edit', {'id': client.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_clients_new') }}">Créer un nouveau client</a>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Clients{% endblock %}
{% block body %}
<h1>Create new Clients</h1>
{{ include('clients/_form.html.twig') }}
<a href="{{ path('app_clients_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block title %}Clients{% endblock %}
{% block body %}
<h1>Clients</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ client.id }}</td>
</tr>
<tr>
<th>Prenom</th>
<td>{{ client.Prenom }}</td>
</tr>
<tr>
<th>Nom</th>
<td>{{ client.Nom }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ client.Email }}</td>
</tr>
<tr>
<th>Telephone</th>
<td>{{ client.Telephone }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_clients_index') }}">back to list</a>
<a href="{{ path('app_clients_edit', {'id': client.id}) }}">edit</a>
{{ include('clients/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends 'base.html.twig' %}
{% block title %}Hello CommandeController!{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code>/home/bayardk@stsio.lan/Documents/FestinHegre/src/Controller/CommandeController.php</code></li>
<li>Your template at <code>/home/bayardk@stsio.lan/Documents/FestinHegre/templates/commande/index.html.twig</code></li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_commandes_delete', {'id': commande.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ commande.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Commandes{% endblock %}
{% block body %}
<h1>Edit Commandes</h1>
{{ include('commandes/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_commandes_index') }}">back to list</a>
{{ include('commandes/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,42 @@
{% extends 'base.html.twig' %}
{% block title %}Commandes index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Commandes index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>DateHeure</th>
<th>Statut</th>
<th>Total</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for commande in commandes %}
<tr>
<td>{{ commande.id }}</td>
<td>{{ commande.DateHeure ? commande.DateHeure|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ commande.Statut ? 'Yes' : 'No' }}</td>
<td>{{ commande.Total }}</td>
<td>
<a href="{{ path('app_commandes_show', {'id': commande.id}) }}">show</a>
<a href="{{ path('app_commandes_edit', {'id': commande.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">pas de commande crée</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_commandes_new') }}">Créer une nouvelle commande</a>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Commandes{% endblock %}
{% block body %}
<h1>Create new Commandes</h1>
{{ include('commandes/_form.html.twig') }}
<a href="{{ path('app_commandes_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,34 @@
{% extends 'base.html.twig' %}
{% block title %}Commandes{% endblock %}
{% block body %}
<h1>Commandes</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ commande.id }}</td>
</tr>
<tr>
<th>DateHeure</th>
<td>{{ commande.DateHeure ? commande.DateHeure|date('Y-m-d H:i:s') : '' }}</td>
</tr>
<tr>
<th>Statut</th>
<td>{{ commande.Statut ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<th>Total</th>
<td>{{ commande.Total }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_commandes_index') }}">back to list</a>
<a href="{{ path('app_commandes_edit', {'id': commande.id}) }}">edit</a>
{{ include('commandes/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_details_commande_delete', {'id': details_commande.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ details_commande.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit DetailsCommande{% endblock %}
{% block body %}
<h1>Edit DetailsCommande</h1>
{{ include('details_commande/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_details_commande_index') }}">back to list</a>
{{ include('details_commande/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,41 @@
{% extends 'base.html.twig' %}
{% block title %}DetailsCommande index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}">
{% endblock %}
{% block body %}
<h1>DetailsCommande index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Quantite</th>
<th>PrixUnitaire</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for details_commande in details_commandes %}
<tr>
<td>{{ details_commande.id }}</td>
<td>{{ details_commande.Quantite }}</td>
<td>{{ details_commande.PrixUnitaire }}</td>
<td>
<a href="{{ path('app_details_commande_show', {'id': details_commande.id}) }}">show</a>
<a href="{{ path('app_details_commande_edit', {'id': details_commande.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">pas de détails de commande disponible</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_details_commande_new') }}">Créer le détails d'une commande</a>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New DetailsCommande{% endblock %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% block body %}
<h1>Create new DetailsCommande</h1>
{{ include('details_commande/_form.html.twig') }}
<a href="{{ path('app_details_commande_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends 'base.html.twig' %}
{% block title %}DetailsCommande{% endblock %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% block body %}
<h1>DetailsCommande</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ details_commande.id }}</td>
</tr>
<tr>
<th>Quantite</th>
<td>{{ details_commande.Quantite }}</td>
</tr>
<tr>
<th>PrixUnitaire</th>
<td>{{ details_commande.PrixUnitaire }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_details_commande_index') }}">back to list</a>
<a href="{{ path('app_details_commande_edit', {'id': details_commande.id}) }}">edit</a>
{{ include('details_commande/_delete_form.html.twig') }}
{% endblock %}

View File

@ -1,7 +1,10 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block title %}Plats index{% endblock %} {% block title %}Plats index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %} {% block body %}
<h1>Plats index</h1> <h1>Plats index</h1>
@ -35,11 +38,11 @@
</tr> </tr>
{% else %} {% else %}
<tr> <tr>
<td colspan="8">no records found</td> <td colspan="8">pas de plats disponible</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<a href="{{ path('app_plats_new') }}">Create new</a> <a href="{{ path('app_plats_new') }}">Créer un nouveaux plat</a>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_reductions_delete', {'id': reduction.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ reduction.id) }}">
<button class="btn">Delete</button>
</form>

View File

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Reductions{% endblock %}
{% block body %}
<h1>Edit Reductions</h1>
{{ include('reductions/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_reductions_index') }}">back to list</a>
{{ include('reductions/_delete_form.html.twig') }}
{% endblock %}

View File

@ -0,0 +1,48 @@
{% extends 'base.html.twig' %}
{% block title %}Reductions index{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/list.css') }}"> <!-- Ajout du fichier CSS -->
{% endblock %}
{% block body %}
<h1>Reductions index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Description</th>
<th>Prix</th>
<th>Pourcentage</th>
<th>MontantFixe</th>
<th>DateDebut</th>
<th>DateFin</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for reduction in reductions %}
<tr>
<td>{{ reduction.id }}</td>
<td>{{ reduction.Description }}</td>
<td>{{ reduction.Prix }}</td>
<td>{{ reduction.Pourcentage }}</td>
<td>{{ reduction.MontantFixe }}</td>
<td>{{ reduction.DateDebut ? reduction.DateDebut|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ reduction.DateFin ? reduction.DateFin|date('Y-m-d H:i:s') : '' }}</td>
<td>
<a href="{{ path('app_reductions_show', {'id': reduction.id}) }}">show</a>
<a href="{{ path('app_reductions_edit', {'id': reduction.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="8">pas encore de réductions</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_reductions_new') }}">Créer une réduction</a>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Reductions{% endblock %}
{% block body %}
<h1>Create new Reductions</h1>
{{ include('reductions/_form.html.twig') }}
<a href="{{ path('app_reductions_index') }}">back to list</a>
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends 'base.html.twig' %}
{% block title %}Reductions{% endblock %}
{% block body %}
<h1>Reductions</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ reduction.id }}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ reduction.Description }}</td>
</tr>
<tr>
<th>Prix</th>
<td>{{ reduction.Prix }}</td>
</tr>
<tr>
<th>Pourcentage</th>
<td>{{ reduction.Pourcentage }}</td>
</tr>
<tr>
<th>MontantFixe</th>
<td>{{ reduction.MontantFixe }}</td>
</tr>
<tr>
<th>DateDebut</th>
<td>{{ reduction.DateDebut ? reduction.DateDebut|date('Y-m-d H:i:s') : '' }}</td>
</tr>
<tr>
<th>DateFin</th>
<td>{{ reduction.DateFin ? reduction.DateFin|date('Y-m-d H:i:s') : '' }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_reductions_index') }}">back to list</a>
<a href="{{ path('app_reductions_edit', {'id': reduction.id}) }}">edit</a>
{{ include('reductions/_delete_form.html.twig') }}
{% endblock %}