diff --git a/config/packages/security.yaml b/config/packages/security.yaml index fbfb8ed2..f882a2de 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -26,8 +26,8 @@ security: # Easy way to control access for large sections of your site # Note: Only the *first* access control that matches will be used access_control: - # - { path: ^/admin, roles: ROLE_ADMIN } - # - { path: ^/profile, roles: ROLE_USER } + - { path: ^/admin, roles: ROLE_ADMIN } + - { path: ^/logged, roles: ROLE_USER } when@test: security: diff --git a/src/Controller/ExpenseController.php b/src/Controller/ExpenseController.php index bd71f49e..78925b14 100644 --- a/src/Controller/ExpenseController.php +++ b/src/Controller/ExpenseController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\Expense; -use App\Form\ExpenseType; +use App\Form\Expense1Type; use App\Repository\ExpenseRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ final class ExpenseController extends AbstractController public function new(Request $request, EntityManagerInterface $entityManager): Response { $expense = new Expense(); - $form = $this->createForm(ExpenseType::class, $expense); + $form = $this->createForm(Expense1Type::class, $expense); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ final class ExpenseController extends AbstractController #[Route('/{id}/edit', name: 'app_expense_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(ExpenseType::class, $expense); + $form = $this->createForm(Expense1Type::class, $expense); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Controller/FestivalController.php b/src/Controller/FestivalController.php index 3ca4be3f..b3d778cb 100644 --- a/src/Controller/FestivalController.php +++ b/src/Controller/FestivalController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\Festival; -use App\Form\FestivalType; +use App\Form\Festival1Type; use App\Repository\FestivalRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ final class FestivalController extends AbstractController public function new(Request $request, EntityManagerInterface $entityManager): Response { $festival = new Festival(); - $form = $this->createForm(FestivalType::class, $festival); + $form = $this->createForm(Festival1Type::class, $festival); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ final class FestivalController extends AbstractController #[Route('/{id}/edit', name: 'app_festival_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(FestivalType::class, $festival); + $form = $this->createForm(Festival1Type::class, $festival); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Controller/GroupOfProductsController.php b/src/Controller/GroupOfProductsController.php index d782bb4f..c5a12b03 100644 --- a/src/Controller/GroupOfProductsController.php +++ b/src/Controller/GroupOfProductsController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\GroupOfProducts; -use App\Form\GroupOfProductsType; +use App\Form\GroupOfProducts1Type; use App\Repository\GroupOfProductsRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ final class GroupOfProductsController extends AbstractController public function new(Request $request, EntityManagerInterface $entityManager): Response { $groupOfProduct = new GroupOfProducts(); - $form = $this->createForm(GroupOfProductsType::class, $groupOfProduct); + $form = $this->createForm(GroupOfProducts1Type::class, $groupOfProduct); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ final class GroupOfProductsController extends AbstractController #[Route('/{id}/edit', name: 'app_group_of_products_edit', methods: ['GET', 'POST'])] public function edit(Request $request, GroupOfProducts $groupOfProduct, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(GroupOfProductsType::class, $groupOfProduct); + $form = $this->createForm(GroupOfProducts1Type::class, $groupOfProduct); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Controller/ProductController.php b/src/Controller/ProductController.php index b4b90b18..0a100920 100644 --- a/src/Controller/ProductController.php +++ b/src/Controller/ProductController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\Product; -use App\Form\ProductType; +use App\Form\Product1Type; use App\Repository\ProductRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ final class ProductController extends AbstractController public function new(Request $request, EntityManagerInterface $entityManager): Response { $product = new Product(); - $form = $this->createForm(ProductType::class, $product); + $form = $this->createForm(Product1Type::class, $product); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ final class ProductController extends AbstractController #[Route('/{id}/edit', name: 'app_product_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Product $product, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(ProductType::class, $product); + $form = $this->createForm(Product1Type::class, $product); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Controller/SellingController.php b/src/Controller/SellingController.php index 3375a47f..bd4666e8 100644 --- a/src/Controller/SellingController.php +++ b/src/Controller/SellingController.php @@ -3,7 +3,7 @@ namespace App\Controller; use App\Entity\Selling; -use App\Form\SellingType; +use App\Form\Selling1Type; use App\Repository\SellingRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -26,7 +26,7 @@ final class SellingController extends AbstractController public function new(Request $request, EntityManagerInterface $entityManager): Response { $selling = new Selling(); - $form = $this->createForm(SellingType::class, $selling); + $form = $this->createForm(Selling1Type::class, $selling); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { @@ -53,7 +53,7 @@ final class SellingController extends AbstractController #[Route('/{id}/edit', name: 'app_selling_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response { - $form = $this->createForm(SellingType::class, $selling); + $form = $this->createForm(Selling1Type::class, $selling); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/Controller/SerieFestivalController.php b/src/Controller/SerieFestivalController.php new file mode 100644 index 00000000..5884e0f0 --- /dev/null +++ b/src/Controller/SerieFestivalController.php @@ -0,0 +1,81 @@ +render('serie_festival/index.html.twig', [ + 'serie_festivals' => $serieFestivalRepository->findAll(), + ]); + } + + #[Route('/new', name: 'app_serie_festival_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response + { + $serieFestival = new SerieFestival(); + $form = $this->createForm(SerieFestivalType::class, $serieFestival); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($serieFestival); + $entityManager->flush(); + + return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('serie_festival/new.html.twig', [ + 'serie_festival' => $serieFestival, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_serie_festival_show', methods: ['GET'])] + public function show(SerieFestival $serieFestival): Response + { + return $this->render('serie_festival/show.html.twig', [ + 'serie_festival' => $serieFestival, + ]); + } + + #[Route('/{id}/edit', name: 'app_serie_festival_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, SerieFestival $serieFestival, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(SerieFestivalType::class, $serieFestival); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('serie_festival/edit.html.twig', [ + 'serie_festival' => $serieFestival, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_serie_festival_delete', methods: ['POST'])] + public function delete(Request $request, SerieFestival $serieFestival, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$serieFestival->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($serieFestival); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Form/Expense1Type.php b/src/Form/Expense1Type.php new file mode 100644 index 00000000..a52b9fe3 --- /dev/null +++ b/src/Form/Expense1Type.php @@ -0,0 +1,32 @@ +add('name') + ->add('price') + ->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Expense::class, + ]); + } +} diff --git a/src/Form/Festival1Type.php b/src/Form/Festival1Type.php new file mode 100644 index 00000000..61a2be25 --- /dev/null +++ b/src/Form/Festival1Type.php @@ -0,0 +1,48 @@ +add('name') + ->add('date_start', null, [ + 'widget' => 'single_text', + ]) + ->add('date_end', null, [ + 'widget' => 'single_text', + ]) + ->add('fraisInscription') + ->add('fondDeCaisseAvant') + ->add('fondDeCaisseApres') + ->add('dateCreation', null, [ + 'widget' => 'single_text', + ]) + ->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'id', + ]) + ->add('serieFestival', EntityType::class, [ + 'class' => SerieFestival::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Festival::class, + ]); + } +} diff --git a/src/Form/GroupOfProducts1Type.php b/src/Form/GroupOfProducts1Type.php new file mode 100644 index 00000000..47badba4 --- /dev/null +++ b/src/Form/GroupOfProducts1Type.php @@ -0,0 +1,43 @@ +add('name') + ->add('products', EntityType::class, [ + 'class' => Product::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('sellings', EntityType::class, [ + 'class' => Selling::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => GroupOfProducts::class, + ]); + } +} diff --git a/src/Form/Product1Type.php b/src/Form/Product1Type.php new file mode 100644 index 00000000..9459ff05 --- /dev/null +++ b/src/Form/Product1Type.php @@ -0,0 +1,47 @@ +add('name') + ->add('price') + ->add('stock') + ->add('image') + ->add('comment') + ->add('groupOfProducts', EntityType::class, [ + 'class' => GroupOfProducts::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('sellings', EntityType::class, [ + 'class' => Selling::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Product::class, + ]); + } +} diff --git a/src/Form/Selling1Type.php b/src/Form/Selling1Type.php new file mode 100644 index 00000000..13461982 --- /dev/null +++ b/src/Form/Selling1Type.php @@ -0,0 +1,45 @@ +add('note') + ->add('sum') + ->add('reduction') + ->add('groupOfProducts', EntityType::class, [ + 'class' => GroupOfProducts::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('products', EntityType::class, [ + 'class' => Product::class, + 'choice_label' => 'id', + 'multiple' => true, + ]) + ->add('festival', EntityType::class, [ + 'class' => Festival::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Selling::class, + ]); + } +} diff --git a/src/Form/SerieFestivalType.php b/src/Form/SerieFestivalType.php new file mode 100644 index 00000000..80e11530 --- /dev/null +++ b/src/Form/SerieFestivalType.php @@ -0,0 +1,34 @@ +add('name') + ->add('dateCreation', null, [ + 'widget' => 'single_text', + ]) + ->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_label' => 'id', + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => SerieFestival::class, + ]); + } +} diff --git a/templates/festival/index.html.twig b/templates/festival/index.html.twig index 76359492..cc1ba87a 100644 --- a/templates/festival/index.html.twig +++ b/templates/festival/index.html.twig @@ -12,6 +12,10 @@ Name Date_start Date_end + FraisInscription + FondDeCaisseAvant + FondDeCaisseApres + DateCreation actions @@ -22,6 +26,10 @@ {{ festival.name }} {{ festival.dateStart ? festival.dateStart|date('Y-m-d') : '' }} {{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }} + {{ festival.fraisInscription }} + {{ festival.fondDeCaisseAvant }} + {{ festival.fondDeCaisseApres }} + {{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }} show edit @@ -29,7 +37,7 @@ {% else %} - no records found + no records found {% endfor %} diff --git a/templates/festival/show.html.twig b/templates/festival/show.html.twig index 1d8f06b3..7be70776 100644 --- a/templates/festival/show.html.twig +++ b/templates/festival/show.html.twig @@ -23,6 +23,22 @@ Date_end {{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }} + + FraisInscription + {{ festival.fraisInscription }} + + + FondDeCaisseAvant + {{ festival.fondDeCaisseAvant }} + + + FondDeCaisseApres + {{ festival.fondDeCaisseApres }} + + + DateCreation + {{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }} + diff --git a/templates/product/index.html.twig b/templates/product/index.html.twig index 82c7c810..de4629c6 100644 --- a/templates/product/index.html.twig +++ b/templates/product/index.html.twig @@ -12,6 +12,8 @@ Name Price Stock + Image + Comment actions @@ -22,6 +24,8 @@ {{ product.name }} {{ product.price }} {{ product.stock }} + {{ product.image }} + {{ product.comment }} show edit @@ -29,7 +33,7 @@ {% else %} - no records found + no records found {% endfor %} diff --git a/templates/product/show.html.twig b/templates/product/show.html.twig index 33d7a9af..fb54796e 100644 --- a/templates/product/show.html.twig +++ b/templates/product/show.html.twig @@ -23,6 +23,14 @@ Stock {{ product.stock }} + + Image + {{ product.image }} + + + Comment + {{ product.comment }} + diff --git a/templates/selling/index.html.twig b/templates/selling/index.html.twig index 1c57758c..51b43d3f 100644 --- a/templates/selling/index.html.twig +++ b/templates/selling/index.html.twig @@ -10,7 +10,6 @@ Id Note - Products Sum Reduction actions @@ -21,7 +20,6 @@ {{ selling.id }} {{ selling.note }} - {{ selling.products }} {{ selling.sum }} {{ selling.reduction }} @@ -31,7 +29,7 @@ {% else %} - no records found + no records found {% endfor %} diff --git a/templates/selling/show.html.twig b/templates/selling/show.html.twig index 2c953f1d..6cafe071 100644 --- a/templates/selling/show.html.twig +++ b/templates/selling/show.html.twig @@ -15,10 +15,6 @@ Note {{ selling.note }} - - Products - {{ selling.products }} - Sum {{ selling.sum }} diff --git a/templates/serie_festival/_delete_form.html.twig b/templates/serie_festival/_delete_form.html.twig new file mode 100644 index 00000000..28e18156 --- /dev/null +++ b/templates/serie_festival/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/serie_festival/_form.html.twig b/templates/serie_festival/_form.html.twig new file mode 100644 index 00000000..bf20b98f --- /dev/null +++ b/templates/serie_festival/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/serie_festival/edit.html.twig b/templates/serie_festival/edit.html.twig new file mode 100644 index 00000000..355aef9a --- /dev/null +++ b/templates/serie_festival/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit SerieFestival{% endblock %} + +{% block body %} +

Edit SerieFestival

+ + {{ include('serie_festival/_form.html.twig', {'button_label': 'Update'}) }} + + back to list + + {{ include('serie_festival/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/serie_festival/index.html.twig b/templates/serie_festival/index.html.twig new file mode 100644 index 00000000..5364d8b2 --- /dev/null +++ b/templates/serie_festival/index.html.twig @@ -0,0 +1,37 @@ +{% extends 'base.html.twig' %} + +{% block title %}SerieFestival index{% endblock %} + +{% block body %} +

SerieFestival index

+ + + + + + + + + + + + {% for serie_festival in serie_festivals %} + + + + + + + {% else %} + + + + {% endfor %} + +
IdNameDateCreationactions
{{ serie_festival.id }}{{ serie_festival.name }}{{ serie_festival.dateCreation ? serie_festival.dateCreation|date('Y-m-d') : '' }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/serie_festival/new.html.twig b/templates/serie_festival/new.html.twig new file mode 100644 index 00000000..94da7ab8 --- /dev/null +++ b/templates/serie_festival/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New SerieFestival{% endblock %} + +{% block body %} +

Create new SerieFestival

+ + {{ include('serie_festival/_form.html.twig') }} + + back to list +{% endblock %} diff --git a/templates/serie_festival/show.html.twig b/templates/serie_festival/show.html.twig new file mode 100644 index 00000000..9967fcbf --- /dev/null +++ b/templates/serie_festival/show.html.twig @@ -0,0 +1,30 @@ +{% extends 'base.html.twig' %} + +{% block title %}SerieFestival{% endblock %} + +{% block body %} +

SerieFestival

+ + + + + + + + + + + + + + + + +
Id{{ serie_festival.id }}
Name{{ serie_festival.name }}
DateCreation{{ serie_festival.dateCreation ? serie_festival.dateCreation|date('Y-m-d') : '' }}
+ + back to list + + edit + + {{ include('serie_festival/_delete_form.html.twig') }} +{% endblock %}