diff --git a/src/Controller/FaultController.php b/src/Controller/FaultController.php index 0f98579..bb1f2d9 100644 --- a/src/Controller/FaultController.php +++ b/src/Controller/FaultController.php @@ -9,42 +9,73 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; -class FaultController extends AbstractController +use Symfony\Component\Routing\Attribute\Route; + +#[Route('/fault')] +final class FaultController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly FaultRepository $faultRepository - ) + #[Route(name: 'app_fault_index', methods: ['GET'])] + public function index(FaultRepository $faultRepository): Response { + return $this->render('fault/index.html.twig', [ + 'faults' => $faultRepository->findAll(), + ]); } - #[Route('/fault/add', name: 'fault_add')] - public function add(Request $request): Response + + #[Route('/new', name: 'app_fault_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $fault = new Fault(); $form = $this->createForm(FaultType::class, $fault); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($fault); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($fault); + $entityManager->flush(); - return $this->redirectToRoute("fault_list"); + return $this->redirectToRoute('app_fault_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('fault/add.html.twig', [ + return $this->render('fault/new.html.twig', [ + 'fault' => $fault, 'form' => $form, ]); } - #[Route('/fault/list', name: 'fault_list')] - public function list(): Response + #[Route('/{id}', name: 'app_fault_show', methods: ['GET'])] + public function show(Fault $fault): Response { - $faults = $this->faultRepository->findAll(); - - return $this->render('fault/list.html.twig', [ - 'faults' => $faults, + return $this->render('fault/show.html.twig', [ + 'fault' => $fault, ]); } -} \ No newline at end of file + + #[Route('/{id}/edit', name: 'app_fault_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Fault $fault, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(FaultType::class, $fault); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_fault_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('fault/edit.html.twig', [ + 'fault' => $fault, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_fault_delete', methods: ['POST'])] + public function delete(Request $request, Fault $fault, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$fault->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($fault); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_fault_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/InterventionController.php b/src/Controller/InterventionController.php index 280d5a9..11cce71 100644 --- a/src/Controller/InterventionController.php +++ b/src/Controller/InterventionController.php @@ -11,41 +11,71 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -class InterventionController extends AbstractController +#[Route('/intervention')] +final class InterventionController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly InterventionRepository $interventionRepository - ) + #[Route(name: 'app_intervention_index', methods: ['GET'])] + public function index(InterventionRepository $interventionRepository): Response { + return $this->render('intervention/index.html.twig', [ + 'interventions' => $interventionRepository->findAll(), + ]); } - #[Route('/intervention/add', name: 'intervention_add')] - public function add(Request $request): Response + + #[Route('/new', name: 'app_intervention_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $intervention = new Intervention(); $form = $this->createForm(InterventionType::class, $intervention); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($intervention); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($intervention); + $entityManager->flush(); - return $this->redirectToRoute("intervention_list"); + return $this->redirectToRoute('app_intervention_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('intervention/add.html.twig', [ + return $this->render('intervention/new.html.twig', [ + 'intervention' => $intervention, 'form' => $form, ]); } - #[Route('/intervention/list', name: 'intervention_list')] - public function list(): Response + #[Route('/{id}', name: 'app_intervention_show', methods: ['GET'])] + public function show(Intervention $intervention): Response { - $interventions = $this->interventionRepository->findAll(); - - return $this->render('intervention/list.html.twig', [ - 'interventions' => $interventions, + return $this->render('intervention/show.html.twig', [ + 'intervention' => $intervention, ]); } -} \ No newline at end of file + + #[Route('/{id}/edit', name: 'app_intervention_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Intervention $intervention, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(InterventionType::class, $intervention); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_intervention_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('intervention/edit.html.twig', [ + 'intervention' => $intervention, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_intervention_delete', methods: ['POST'])] + public function delete(Request $request, Intervention $intervention, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$intervention->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($intervention); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_intervention_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/SkillController.php b/src/Controller/SkillController.php index 92ed955..2d2adac 100644 --- a/src/Controller/SkillController.php +++ b/src/Controller/SkillController.php @@ -9,42 +9,73 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; -class SkillController extends AbstractController +#[Route('/skill')] +final class SkillController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly SkillRepository $skillRepository - ) + #[Route(name: 'app_skill_index', methods: ['GET'])] + public function index(SkillRepository $skillRepository): Response { + return $this->render('skill/index.html.twig', [ + 'skills' => $skillRepository->findAll(), + ]); } - #[Route('/skill/add', name: 'skill_add')] - public function add(Request $request): Response + #[Route('/new', name: 'app_skill_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $skill = new Skill(); $form = $this->createForm(SkillType::class, $skill); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $this->entityManager->persist($skill); - $this->entityManager->flush(); + $entityManager->persist($skill); + $entityManager->flush(); + + return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('skill/add.html.twig', [ + return $this->render('skill/new.html.twig', [ + 'skill' => $skill, 'form' => $form, ]); } - #[Route('/skill/list', name: 'skill_list')] - public function list(): Response + #[Route('/{id}', name: 'app_skill_show', methods: ['GET'])] + public function show(Skill $skill): Response { - $skills = $this->skillRepository->findAll(); - - return $this->render('skill/list.html.twig', [ - 'skills' => $skills, + return $this->render('skill/show.html.twig', [ + 'skill' => $skill, ]); } -} \ No newline at end of file + #[Route('/{id}/edit', name: 'app_skill_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(SkillType::class, $skill); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('skill/edit.html.twig', [ + 'skill' => $skill, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_skill_delete', methods: ['POST'])] + public function delete(Request $request, Skill $skill, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$skill->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($skill); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_skill_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/StockController.php b/src/Controller/StockController.php index 52df48c..0252e71 100644 --- a/src/Controller/StockController.php +++ b/src/Controller/StockController.php @@ -9,62 +9,73 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; -class StockController extends AbstractController +#[Route('/stock')] +final class StockController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly StockRepository $stockRepository - ) + #[Route(name: 'app_stock_index', methods: ['GET'])] + public function index(StockRepository $stockRepository): Response { + return $this->render('stock/index.html.twig', [ + 'stocks' => $stockRepository->findAll(), + ]); } - #[Route('/stock/add', name: 'stock_add')] - public function add(Request $request): Response + #[Route('/new', name: 'app_stock_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $stock = new Stock(); $form = $this->createForm(StockType::class, $stock); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($stock); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($stock); + $entityManager->flush(); + + return $this->redirectToRoute('app_stock_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('stock/add.html.twig', [ + return $this->render('stock/new.html.twig', [ + 'stock' => $stock, 'form' => $form, ]); } - #[Route('/stock/list', name: 'stock_list')] - public function list(): Response + #[Route('/{id}', name: 'app_stock_show', methods: ['GET'])] + public function show(Stock $stock): Response { - $stocks = $this->stockRepository->findAll(); - - return $this->render('stock/list.html.twig', [ - 'stocks' => $stocks, + return $this->render('stock/show.html.twig', [ + 'stock' => $stock, ]); } - #[Route('/stock/update/{id}', name: 'stock_update')] - public function update(int $id, Request $request): Response + #[Route('/{id}/edit', name: 'app_stock_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Stock $stock, EntityManagerInterface $entityManager): Response { - $stock = $this->stockRepository->find($id); $form = $this->createForm(StockType::class, $stock); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($stock); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_stock_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('stock/add.html.twig', [ + return $this->render('stock/edit.html.twig', [ + 'stock' => $stock, 'form' => $form, ]); } + #[Route('/{id}', name: 'app_stock_delete', methods: ['POST'])] + public function delete(Request $request, Stock $stock, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$stock->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($stock); + $entityManager->flush(); + } -} \ No newline at end of file + return $this->redirectToRoute('app_stock_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 70588d5..6a5e8a0 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -9,70 +9,73 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; -class UserController extends AbstractController +#[Route('/user')] +final class UserController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly UserRepository $userRepository - ) + #[Route(name: 'app_user_index', methods: ['GET'])] + public function index(UserRepository $userRepository): Response { + return $this->render('user/index.html.twig', [ + 'users' => $userRepository->findAll(), + ]); } - #[Route('/user/add', name: 'user_add')] - public function add(Request $request): Response + #[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $user = new User(); $form = $this->createForm(UserType::class, $user); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($user); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($user); + $entityManager->flush(); + + return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('user/add.html.twig', [ + return $this->render('user/new.html.twig', [ + 'user' => $user, 'form' => $form, ]); } - #[Route('/user/list', name: 'user_list')] - public function list(): Response + #[Route('/{id}', name: 'app_user_show', methods: ['GET'])] + public function show(User $user): Response { - $users = $this->userRepository->findAll(); - - return $this->render('user/list.html.twig', [ - 'users' => $users, + return $this->render('user/show.html.twig', [ + 'user' => $user, ]); } - #[Route('/user/update/{id}', name: 'user_update')] - public function update(int $id, Request $request): Response + #[Route('/{id}/edit', name: 'app_user_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, User $user, EntityManagerInterface $entityManager): Response { - $user = $this->userRepository->find($id); $form = $this->createForm(UserType::class, $user); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($user); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('user/add.html.twig', [ + return $this->render('user/edit.html.twig', [ + 'user' => $user, 'form' => $form, ]); } - #[Route('/user/delete/{id}', name: '_delete')] - public function delete(int $id): Response + #[Route('/{id}', name: 'app_user_delete', methods: ['POST'])] + public function delete(Request $request, User $user, EntityManagerInterface $entityManager): Response { - $user = $this->userRepository->find($id); - $this->entityManager->remove($user); - $this->entityManager->flush(); + if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($user); + $entityManager->flush(); + } - return $this->redirectToRoute('app_user_list'); + return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER); } } diff --git a/src/Controller/VehicleController.php b/src/Controller/VehicleController.php index 54b8ac7..4921a28 100644 --- a/src/Controller/VehicleController.php +++ b/src/Controller/VehicleController.php @@ -11,41 +11,71 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -class VehicleController extends AbstractController +#[Route('/vehicle')] +final class VehicleController extends AbstractController { - public function __construct( - private readonly EntityManagerInterface $entityManager, - private readonly VehicleRepository $vehicleRepository - ) + #[Route(name: 'app_vehicle_index', methods: ['GET'])] + public function index(VehicleRepository $vehicleRepository): Response { + return $this->render('vehicle/index.html.twig', [ + 'vehicles' => $vehicleRepository->findAll(), + ]); } - #[\Symfony\Component\Routing\Annotation\Route('/vehicle/add', name: 'vehicle_add')] - public function add(Request $request): Response + + #[Route('/new', name: 'app_vehicle_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response { $vehicle = new Vehicle(); $form = $this->createForm(VehicleType::class, $vehicle); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) - { - $this->entityManager->persist($vehicle); - $this->entityManager->flush(); + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->persist($vehicle); + $entityManager->flush(); - return $this->redirectToRoute("vehicle_list"); + return $this->redirectToRoute('app_vehicle_index', [], Response::HTTP_SEE_OTHER); } - return $this->render('vehicle/add.html.twig', [ + return $this->render('vehicle/new.html.twig', [ + 'vehicle' => $vehicle, 'form' => $form, ]); } - #[Route('/vehicle/list', name: 'vehicle_list')] - public function list(): Response + #[Route('/{id}', name: 'app_vehicle_show', methods: ['GET'])] + public function show(Vehicle $vehicle): Response { - $vehicles = $this->vehicleRepository->findAll(); - - return $this->render('vehicle/list.html.twig', [ - 'vehicles' => $vehicles, + return $this->render('vehicle/show.html.twig', [ + 'vehicle' => $vehicle, ]); } -} \ No newline at end of file + + #[Route('/{id}/edit', name: 'app_vehicle_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Vehicle $vehicle, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(VehicleType::class, $vehicle); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_vehicle_index', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('vehicle/edit.html.twig', [ + 'vehicle' => $vehicle, + 'form' => $form, + ]); + } + + #[Route('/{id}', name: 'app_vehicle_delete', methods: ['POST'])] + public function delete(Request $request, Vehicle $vehicle, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete'.$vehicle->getId(), $request->getPayload()->getString('_token'))) { + $entityManager->remove($vehicle); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_vehicle_index', [], Response::HTTP_SEE_OTHER); + } +} diff --git a/src/Form/FaultType.php b/src/Form/FaultType.php index 9960312..86e2112 100644 --- a/src/Form/FaultType.php +++ b/src/Form/FaultType.php @@ -2,9 +2,8 @@ namespace App\Form; +use App\Entity\Fault; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\IntegerType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,14 +14,13 @@ class FaultType extends AbstractType { $builder ->add('Wording', TextType::class) - ->add('save', SubmitType::class) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - // Configure your form options here + 'data_class' => Fault::class, ]); } } diff --git a/src/Form/SkillType.php b/src/Form/SkillType.php index bfee7c8..91c8164 100644 --- a/src/Form/SkillType.php +++ b/src/Form/SkillType.php @@ -2,10 +2,9 @@ namespace App\Form; +use App\Entity\Skill; +use Doctrine\DBAL\Types\TextType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -14,17 +13,15 @@ class SkillType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('Wording', TextType::class) - ->add('description', TextAreaType::class) - ->add('Save', SubmitType::class) - + ->add('Wording',TextType::class) + ->add('Description', TextType::class) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - // Configure your form options here + 'data_class' => Skill::class, ]); } } diff --git a/src/Form/StockType.php b/src/Form/StockType.php index 958daa0..ce3c486 100644 --- a/src/Form/StockType.php +++ b/src/Form/StockType.php @@ -3,13 +3,9 @@ namespace App\Form; use App\Entity\Stock; +use Doctrine\DBAL\Types\IntegerType; +use Doctrine\DBAL\Types\TextType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; -use Symfony\Component\Form\Extension\Core\Type\EmailType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -19,9 +15,8 @@ class StockType extends AbstractType { $builder ->add('Wording', TextType::class) - ->add('description', TextAreaType::class) + ->add('Description', TextType::class) ->add('Quantity', IntegerType::class) - ->add('save', SubmitType::class) ; } diff --git a/src/Form/UserType.php b/src/Form/UserType.php index 7bef9c4..6728110 100644 --- a/src/Form/UserType.php +++ b/src/Form/UserType.php @@ -3,11 +3,8 @@ namespace App\Form; use App\Entity\User; +use Doctrine\DBAL\Types\TextType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\DateType; -use Symfony\Component\Form\Extension\Core\Type\EmailType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -16,13 +13,15 @@ class UserType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder + ->add('email', TextType::class) ->add('FirstName', TextType::class) ->add('LastName', TextType::class) - ->add('BirthDate', DateType::class) - ->add('Email', EmailType::class) + ->add('BirthDate', \DateTime::class, [ + 'widget' => 'single_text', + ]) ->add('Phone', TextType::class) - ->add('Type', TextType::class) - ->add('Save', SubmitType::class) + ->add('roles', TextType::class) + ->add('password', TextType::class) ; } diff --git a/src/Form/VehicleType.php b/src/Form/VehicleType.php index 47e3161..5571267 100644 --- a/src/Form/VehicleType.php +++ b/src/Form/VehicleType.php @@ -2,10 +2,9 @@ namespace App\Form; +use App\Entity\Vehicle; +use Doctrine\DBAL\Types\TextType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\IntegerType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -15,16 +14,14 @@ class VehicleType extends AbstractType { $builder ->add('LicensePlate', TextType::class) - ->add('Brand', IntegerType::class) - ->add('Save', SubmitType::class) - + ->add('Brand', TextType::class) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - // Configure your form options here + 'data_class' => Vehicle::class, ]); } } diff --git a/templates/fault/_delete_form.html.twig b/templates/fault/_delete_form.html.twig new file mode 100644 index 0000000..8879cca --- /dev/null +++ b/templates/fault/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/fault/_form.html.twig b/templates/fault/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/fault/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/fault/add.html.twig b/templates/fault/add.html.twig deleted file mode 100644 index 601e2ec..0000000 --- a/templates/fault/add.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Ajouter une panne{% endblock %} - -{% block body %} -

Ajouter une panne

- - {{ form(form) }} - -{% endblock %} diff --git a/templates/fault/edit.html.twig b/templates/fault/edit.html.twig new file mode 100644 index 0000000..77f631e --- /dev/null +++ b/templates/fault/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Fault{% endblock %} + +{% block body %} +

Edit Fault

+ + {{ include('fault/_form.html.twig', {'button_label': 'Update'}) }} + + back to list + + {{ include('fault/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/fault/index.html.twig b/templates/fault/index.html.twig new file mode 100644 index 0000000..8f96b09 --- /dev/null +++ b/templates/fault/index.html.twig @@ -0,0 +1,35 @@ +{% extends 'base.html.twig' %} + +{% block title %}Fault index{% endblock %} + +{% block body %} +

Fault index

+ + + + + + + + + + + {% for fault in faults %} + + + + + + {% else %} + + + + {% endfor %} + +
IdWordingactions
{{ fault.id }}{{ fault.Wording }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/fault/list.html.twig b/templates/fault/list.html.twig deleted file mode 100644 index 2a2b1d0..0000000 --- a/templates/fault/list.html.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello UserController!{% endblock %} - -{% block body %} - {% for fault in faults %} - {{ fault.Wording }} - {% endfor %} -{% endblock %} \ No newline at end of file diff --git a/templates/fault/new.html.twig b/templates/fault/new.html.twig new file mode 100644 index 0000000..4b3151d --- /dev/null +++ b/templates/fault/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Fault{% endblock %} + +{% block body %} +

Create new Fault

+ + {{ include('fault/_form.html.twig') }} + + back to list +{% endblock %} diff --git a/templates/fault/show.html.twig b/templates/fault/show.html.twig new file mode 100644 index 0000000..3c46804 --- /dev/null +++ b/templates/fault/show.html.twig @@ -0,0 +1,26 @@ +{% extends 'base.html.twig' %} + +{% block title %}Fault{% endblock %} + +{% block body %} +

Fault

+ + + + + + + + + + + + +
Id{{ fault.id }}
Wording{{ fault.Wording }}
+ + back to list + + edit + + {{ include('fault/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/intervention/_delete_form.html.twig b/templates/intervention/_delete_form.html.twig new file mode 100644 index 0000000..c4200f6 --- /dev/null +++ b/templates/intervention/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/intervention/_form.html.twig b/templates/intervention/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/intervention/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/intervention/edit.html.twig b/templates/intervention/edit.html.twig new file mode 100644 index 0000000..5968dbd --- /dev/null +++ b/templates/intervention/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Intervention{% endblock %} + +{% block body %} +

Edit Intervention

+ + {{ include('intervention/_form.html.twig', {'button_label': 'Update'}) }} + + back to list + + {{ include('intervention/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/intervention/index.html.twig b/templates/intervention/index.html.twig new file mode 100644 index 0000000..084df18 --- /dev/null +++ b/templates/intervention/index.html.twig @@ -0,0 +1,43 @@ +{% extends 'base.html.twig' %} + +{% block title %}Intervention index{% endblock %} + +{% block body %} +

Intervention index

+ + + + + + + + + + + + + + + {% for intervention in interventions %} + + + + + + + + + + {% else %} + + + + {% endfor %} + +
IdWordingTimestampDescriptionAddressStatusactions
{{ intervention.id }}{{ intervention.Wording }}{{ intervention.Timestamp ? intervention.Timestamp|date('Y-m-d H:i:s') : '' }}{{ intervention.Description }}{{ intervention.Address }}{{ intervention.Status }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/intervention/list.html.twig b/templates/intervention/list.html.twig deleted file mode 100644 index dc14f06..0000000 --- a/templates/intervention/list.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello InterventionController!{% endblock %} - -{% block body %} - {% for intervention in interventions %} - {{ intervention.Wording }} - {{ intervention.Timestamp|date('Y-m-d H:i:s') }} {{ intervention.Description }} - {{ intervention.Address }} - {{ intervention.Status }} - {% endfor %} -{% endblock %} - diff --git a/templates/intervention/new.html.twig b/templates/intervention/new.html.twig new file mode 100644 index 0000000..f1ff396 --- /dev/null +++ b/templates/intervention/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Intervention{% endblock %} + +{% block body %} +

Create new Intervention

+ + {{ include('intervention/_form.html.twig') }} + + back to list +{% endblock %} diff --git a/templates/intervention/show.html.twig b/templates/intervention/show.html.twig new file mode 100644 index 0000000..976ecee --- /dev/null +++ b/templates/intervention/show.html.twig @@ -0,0 +1,42 @@ +{% extends 'base.html.twig' %} + +{% block title %}Intervention{% endblock %} + +{% block body %} +

Intervention

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Id{{ intervention.id }}
Wording{{ intervention.Wording }}
Timestamp{{ intervention.Timestamp ? intervention.Timestamp|date('Y-m-d H:i:s') : '' }}
Description{{ intervention.Description }}
Address{{ intervention.Address }}
Status{{ intervention.Status }}
+ + back to list + + edit + + {{ include('intervention/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/skill/_delete_form.html.twig b/templates/skill/_delete_form.html.twig new file mode 100644 index 0000000..a5d89c4 --- /dev/null +++ b/templates/skill/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/skill/_form.html.twig b/templates/skill/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/skill/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/skill/add.html.twig b/templates/skill/add.html.twig deleted file mode 100644 index 9ca6ffa..0000000 --- a/templates/skill/add.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{# templates/user/add.html.twig #} -{% extends 'base.html.twig' %} - -{% block title %}Ajouter une intervention {% endblock %} - -{% block body %} -

Ajouter une compétence

- - {{ form(form) }} -{% endblock %} diff --git a/templates/skill/edit.html.twig b/templates/skill/edit.html.twig new file mode 100644 index 0000000..16d97d1 --- /dev/null +++ b/templates/skill/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Skill{% endblock %} + +{% block body %} +

Edit Skill

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

Skill index

+ + + + + + + + + + + + {% for skill in skills %} + + + + + + + {% else %} + + + + {% endfor %} + +
IdWordingDescriptionactions
{{ skill.id }}{{ skill.Wording }}{{ skill.Description }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/skill/list.html.twig b/templates/skill/list.html.twig deleted file mode 100644 index 53899e1..0000000 --- a/templates/skill/list.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello InterventionController!{% endblock %} - -{% block body %} - {% for skill in skills %} - {{ skill.Wording }} - {{ skill.Description }} - {% endfor %} -{% endblock %} \ No newline at end of file diff --git a/templates/skill/new.html.twig b/templates/skill/new.html.twig new file mode 100644 index 0000000..2ff534a --- /dev/null +++ b/templates/skill/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Skill{% endblock %} + +{% block body %} +

Create new Skill

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

Skill

+ + + + + + + + + + + + + + + + +
Id{{ skill.id }}
Wording{{ skill.Wording }}
Description{{ skill.Description }}
+ + back to list + + edit + + {{ include('skill/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/stock/_delete_form.html.twig b/templates/stock/_delete_form.html.twig new file mode 100644 index 0000000..2bbd21c --- /dev/null +++ b/templates/stock/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/stock/_form.html.twig b/templates/stock/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/stock/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/stock/add.html.twig b/templates/stock/add.html.twig deleted file mode 100644 index 0f684e5..0000000 --- a/templates/stock/add.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Ajouter un utilisateur{% endblock %} - -{% block body %} -

Ajouter du stock

- - {{ form(form) }} - -{% endblock %} diff --git a/templates/stock/edit.html.twig b/templates/stock/edit.html.twig new file mode 100644 index 0000000..635bc01 --- /dev/null +++ b/templates/stock/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Stock{% endblock %} + +{% block body %} +

Edit Stock

+ + {{ include('stock/_form.html.twig', {'button_label': 'Update'}) }} + + back to list + + {{ include('stock/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/stock/index.html.twig b/templates/stock/index.html.twig new file mode 100644 index 0000000..7c47c7a --- /dev/null +++ b/templates/stock/index.html.twig @@ -0,0 +1,39 @@ +{% extends 'base.html.twig' %} + +{% block title %}Stock index{% endblock %} + +{% block body %} +

Stock index

+ + + + + + + + + + + + + {% for stock in stocks %} + + + + + + + + {% else %} + + + + {% endfor %} + +
IdWordingDescriptionQuantityactions
{{ stock.id }}{{ stock.Wording }}{{ stock.Description }}{{ stock.Quantity }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/stock/list.html.twig b/templates/stock/list.html.twig deleted file mode 100644 index 4cd9c76..0000000 --- a/templates/stock/list.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello StockController!{% endblock %} - -{% block body %} - {% for stock in stocks %} - {{ stock.Wording }} - {{ stock.Description }} - {{ stock.Quantity }} - {% endfor %} -{% endblock %} \ No newline at end of file diff --git a/templates/stock/new.html.twig b/templates/stock/new.html.twig new file mode 100644 index 0000000..8048e2a --- /dev/null +++ b/templates/stock/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Stock{% endblock %} + +{% block body %} +

Create new Stock

+ + {{ include('stock/_form.html.twig') }} + + back to list +{% endblock %} diff --git a/templates/stock/show.html.twig b/templates/stock/show.html.twig new file mode 100644 index 0000000..127f783 --- /dev/null +++ b/templates/stock/show.html.twig @@ -0,0 +1,34 @@ +{% extends 'base.html.twig' %} + +{% block title %}Stock{% endblock %} + +{% block body %} +

Stock

+ + + + + + + + + + + + + + + + + + + + +
Id{{ stock.id }}
Wording{{ stock.Wording }}
Description{{ stock.Description }}
Quantity{{ stock.Quantity }}
+ + back to list + + edit + + {{ include('stock/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/user/_delete_form.html.twig b/templates/user/_delete_form.html.twig new file mode 100644 index 0000000..6d59fa6 --- /dev/null +++ b/templates/user/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/user/_form.html.twig b/templates/user/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/user/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/user/add.html.twig b/templates/user/add.html.twig deleted file mode 100644 index 3440b9d..0000000 --- a/templates/user/add.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{# templates/user/add.html.twig #} -{% extends 'base.html.twig' %} - -{% block title %}Ajouter un utilisateur{% endblock %} - -{% block body %} -

Ajouter un utilisateur

- - {{ form(form) }} -{% endblock %} diff --git a/templates/user/edit.html.twig b/templates/user/edit.html.twig new file mode 100644 index 0000000..141d94a --- /dev/null +++ b/templates/user/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit User{% endblock %} + +{% block body %} +

Edit User

+ + {{ include('user/_form.html.twig', {'button_label': 'Update'}) }} + + back to list + + {{ include('user/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/user/index.html.twig b/templates/user/index.html.twig new file mode 100644 index 0000000..d0d941a --- /dev/null +++ b/templates/user/index.html.twig @@ -0,0 +1,47 @@ +{% extends 'base.html.twig' %} + +{% block title %}User index{% endblock %} + +{% block body %} +

User index

+ + + + + + + + + + + + + + + + + {% for user in users %} + + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
IdEmailFirstNameLastNameBirthDatePhoneRolesPasswordactions
{{ user.id }}{{ user.email }}{{ user.FirstName }}{{ user.LastName }}{{ user.BirthDate ? user.BirthDate|date('Y-m-d') : '' }}{{ user.Phone }}{{ user.roles ? user.roles|json_encode : '' }}{{ user.password }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/user/list.html.twig b/templates/user/list.html.twig deleted file mode 100644 index e48b70b..0000000 --- a/templates/user/list.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello UserController!{% endblock %} - -{% block body %} - {% for user in users %} - {{ user.FirstName }} - {{ user.LastName }} - {{ user.BirthDate|date("Y-m-d") }} - {{ user.Email }} - {{ user.Phone }} - {{ user.Type }} - {% endfor %} -{% endblock %} \ No newline at end of file diff --git a/templates/user/new.html.twig b/templates/user/new.html.twig new file mode 100644 index 0000000..35e728d --- /dev/null +++ b/templates/user/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New User{% endblock %} + +{% block body %} +

Create new User

+ + {{ include('user/_form.html.twig') }} + + back to list +{% endblock %} diff --git a/templates/user/show.html.twig b/templates/user/show.html.twig new file mode 100644 index 0000000..721f820 --- /dev/null +++ b/templates/user/show.html.twig @@ -0,0 +1,50 @@ +{% extends 'base.html.twig' %} + +{% block title %}User{% endblock %} + +{% block body %} +

User

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Id{{ user.id }}
Email{{ user.email }}
FirstName{{ user.FirstName }}
LastName{{ user.LastName }}
BirthDate{{ user.BirthDate ? user.BirthDate|date('Y-m-d') : '' }}
Phone{{ user.Phone }}
Roles{{ user.roles ? user.roles|json_encode : '' }}
Password{{ user.password }}
+ + back to list + + edit + + {{ include('user/_delete_form.html.twig') }} +{% endblock %} diff --git a/templates/vehicle/_delete_form.html.twig b/templates/vehicle/_delete_form.html.twig new file mode 100644 index 0000000..0b4bd70 --- /dev/null +++ b/templates/vehicle/_delete_form.html.twig @@ -0,0 +1,4 @@ +
+ + +
diff --git a/templates/vehicle/_form.html.twig b/templates/vehicle/_form.html.twig new file mode 100644 index 0000000..bf20b98 --- /dev/null +++ b/templates/vehicle/_form.html.twig @@ -0,0 +1,4 @@ +{{ form_start(form) }} + {{ form_widget(form) }} + +{{ form_end(form) }} diff --git a/templates/vehicle/add.html.twig b/templates/vehicle/add.html.twig deleted file mode 100644 index 3440b9d..0000000 --- a/templates/vehicle/add.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{# templates/user/add.html.twig #} -{% extends 'base.html.twig' %} - -{% block title %}Ajouter un utilisateur{% endblock %} - -{% block body %} -

Ajouter un utilisateur

- - {{ form(form) }} -{% endblock %} diff --git a/templates/vehicle/edit.html.twig b/templates/vehicle/edit.html.twig new file mode 100644 index 0000000..adefbbe --- /dev/null +++ b/templates/vehicle/edit.html.twig @@ -0,0 +1,13 @@ +{% extends 'base.html.twig' %} + +{% block title %}Edit Vehicle{% endblock %} + +{% block body %} +

Edit Vehicle

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

Vehicle index

+ + + + + + + + + + + + {% for vehicle in vehicles %} + + + + + + + {% else %} + + + + {% endfor %} + +
IdLicensePlateBrandactions
{{ vehicle.id }}{{ vehicle.LicensePlate }}{{ vehicle.Brand }} + show + edit +
no records found
+ + Create new +{% endblock %} diff --git a/templates/vehicle/list.html.twig b/templates/vehicle/list.html.twig deleted file mode 100644 index 1741382..0000000 --- a/templates/vehicle/list.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block title %}Hello UserController!{% endblock %} - -{% block body %} - {% for vehicle in vehicles %} - {{ vehicle.LicensePlate }} - {{ vehicle.Brand }} - {% endfor %} -{% endblock %} \ No newline at end of file diff --git a/templates/vehicle/new.html.twig b/templates/vehicle/new.html.twig new file mode 100644 index 0000000..bb67b33 --- /dev/null +++ b/templates/vehicle/new.html.twig @@ -0,0 +1,11 @@ +{% extends 'base.html.twig' %} + +{% block title %}New Vehicle{% endblock %} + +{% block body %} +

Create new Vehicle

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

Vehicle

+ + + + + + + + + + + + + + + + +
Id{{ vehicle.id }}
LicensePlate{{ vehicle.LicensePlate }}
Brand{{ vehicle.Brand }}
+ + back to list + + edit + + {{ include('vehicle/_delete_form.html.twig') }} +{% endblock %}