Merge branch 'feature/RideController' into develop
This commit is contained in:
commit
ffcdd46003
@ -23,7 +23,7 @@ doctrine:
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
controller_resolver:
|
||||
auto_mapping: false
|
||||
auto_mapping: true
|
||||
|
||||
when@test:
|
||||
doctrine:
|
||||
|
@ -37,6 +37,9 @@ security:
|
||||
# https://symfony.com/doc/current/security/impersonating_user.html
|
||||
# switch_user: true
|
||||
|
||||
role_hierarchy:
|
||||
ROLE_ADMIN: ['ROLE_USER']
|
||||
|
||||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
access_control:
|
||||
|
@ -1,49 +0,0 @@
|
||||
<?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 Version20241017154551 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('CREATE SEQUENCE category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE employee_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE mission_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE ride_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
|
||||
}
|
||||
|
||||
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('DROP SEQUENCE category_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE employee_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_type_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE mission_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE ride_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE "user_id_seq" CASCADE');
|
||||
$this->addSql('DROP TABLE "user"');
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?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 Version20241017154952 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('CREATE SEQUENCE category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE employee_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE mission_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE ride_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, is_verified BOOLEAN NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
|
||||
}
|
||||
|
||||
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('DROP SEQUENCE category_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE employee_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_type_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE mission_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE ride_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE "user_id_seq" CASCADE');
|
||||
$this->addSql('DROP TABLE "user"');
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?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 Version20241114142616 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('CREATE SEQUENCE category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE employee_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE incident_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE mission_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE ride_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, is_verified BOOLEAN NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON "user" (email)');
|
||||
}
|
||||
|
||||
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('DROP SEQUENCE category_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE employee_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE incident_type_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE mission_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE ride_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE "user_id_seq" CASCADE');
|
||||
$this->addSql('DROP TABLE "user"');
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20241011084601 extends AbstractMigration
|
||||
final class Version20241212162704 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
@ -27,8 +27,10 @@ final class Version20241011084601 extends AbstractMigration
|
||||
$this->addSql('CREATE SEQUENCE mission_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE ride_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE assignment (employee INT NOT NULL, ride INT NOT NULL, start_hour TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_hour TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(employee, ride))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_30C544BA5D9F75A19B3D7CD0 ON assignment (employee, ride)');
|
||||
$this->addSql('CREATE TABLE assignment (employee_id INT NOT NULL, ride_id INT NOT NULL, start_hour TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_hour TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(employee_id, ride_id))');
|
||||
$this->addSql('CREATE INDEX IDX_30C544BA8C03F15C ON assignment (employee_id)');
|
||||
$this->addSql('CREATE INDEX IDX_30C544BA302A8A70 ON assignment (ride_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_30C544BA8C03F15C302A8A70 ON assignment (employee_id, ride_id)');
|
||||
$this->addSql('CREATE TABLE category (id INT NOT NULL, label VARCHAR(30) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE employee (id INT NOT NULL, missions_id INT DEFAULT NULL, incidents_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(30) NOT NULL, last_name VARCHAR(30) NOT NULL, password VARCHAR(255) NOT NULL, roles JSON NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_5D9F75A117C042CF ON employee (missions_id)');
|
||||
@ -36,19 +38,20 @@ final class Version20241011084601 extends AbstractMigration
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON employee (email)');
|
||||
$this->addSql('CREATE TABLE employee_skill (employee INT NOT NULL, skill INT NOT NULL, PRIMARY KEY(employee, skill))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_B630E90E5D9F75A15E3DE477 ON employee_skill (employee, skill)');
|
||||
$this->addSql('CREATE TABLE incident (id INT NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE incident (id INT NOT NULL, ride_id INT DEFAULT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_3D03A11A302A8A70 ON incident (ride_id)');
|
||||
$this->addSql('CREATE TABLE incident_type (id INT NOT NULL, incidents_id INT DEFAULT NULL, label VARCHAR(30) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_66D2209655955332 ON incident_type (incidents_id)');
|
||||
$this->addSql('CREATE TABLE mission (id INT NOT NULL, label VARCHAR(30) NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE mission_category (mission INT NOT NULL, category INT NOT NULL, PRIMARY KEY(mission, category))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_EB018789067F23C64C19C1 ON mission_category (mission, category)');
|
||||
$this->addSql('CREATE TABLE representation (employee INT NOT NULL, ride INT NOT NULL, count INT NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(employee, ride))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_29D5499E5D9F75A19B3D7CD0 ON representation (employee, ride)');
|
||||
$this->addSql('CREATE TABLE representation (employee_id INT NOT NULL, ride_id INT NOT NULL, count INT NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(employee_id, ride_id))');
|
||||
$this->addSql('CREATE INDEX IDX_29D5499E8C03F15C ON representation (employee_id)');
|
||||
$this->addSql('CREATE INDEX IDX_29D5499E302A8A70 ON representation (ride_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_29D5499E8C03F15C302A8A70AA9E377A ON representation (employee_id, ride_id, date)');
|
||||
$this->addSql('CREATE TABLE requirement (mission INT NOT NULL, skill INT NOT NULL, PRIMARY KEY(mission, skill))');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_DB3F55509067F23C5E3DE477 ON requirement (mission, skill)');
|
||||
$this->addSql('CREATE TABLE ride (id INT NOT NULL, incident_types_id INT DEFAULT NULL, missions_id INT DEFAULT NULL, label VARCHAR(30) NOT NULL, count INT NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_9B3D7CD076775724 ON ride (incident_types_id)');
|
||||
$this->addSql('CREATE INDEX IDX_9B3D7CD017C042CF ON ride (missions_id)');
|
||||
$this->addSql('CREATE TABLE ride (id INT NOT NULL, label VARCHAR(30) NOT NULL, count INT NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE TABLE skill (id INT NOT NULL, label VARCHAR(30) 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)');
|
||||
@ -65,11 +68,14 @@ final class Version20241011084601 extends AbstractMigration
|
||||
$$ 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 assignment ADD CONSTRAINT FK_30C544BA8C03F15C FOREIGN KEY (employee_id) REFERENCES employee (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BA302A8A70 FOREIGN KEY (ride_id) REFERENCES ride (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE employee ADD CONSTRAINT FK_5D9F75A117C042CF FOREIGN KEY (missions_id) REFERENCES mission (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE employee ADD CONSTRAINT FK_5D9F75A155955332 FOREIGN KEY (incidents_id) REFERENCES incident (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE incident ADD CONSTRAINT FK_3D03A11A302A8A70 FOREIGN KEY (ride_id) REFERENCES ride (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE incident_type ADD CONSTRAINT FK_66D2209655955332 FOREIGN KEY (incidents_id) REFERENCES incident (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE ride ADD CONSTRAINT FK_9B3D7CD076775724 FOREIGN KEY (incident_types_id) REFERENCES incident_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE ride ADD CONSTRAINT FK_9B3D7CD017C042CF FOREIGN KEY (missions_id) REFERENCES mission (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE representation ADD CONSTRAINT FK_29D5499E8C03F15C FOREIGN KEY (employee_id) REFERENCES employee (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE representation ADD CONSTRAINT FK_29D5499E302A8A70 FOREIGN KEY (ride_id) REFERENCES ride (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
@ -83,11 +89,14 @@ final class Version20241011084601 extends AbstractMigration
|
||||
$this->addSql('DROP SEQUENCE mission_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE ride_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE assignment DROP CONSTRAINT FK_30C544BA8C03F15C');
|
||||
$this->addSql('ALTER TABLE assignment DROP CONSTRAINT FK_30C544BA302A8A70');
|
||||
$this->addSql('ALTER TABLE employee DROP CONSTRAINT FK_5D9F75A117C042CF');
|
||||
$this->addSql('ALTER TABLE employee DROP CONSTRAINT FK_5D9F75A155955332');
|
||||
$this->addSql('ALTER TABLE incident DROP CONSTRAINT FK_3D03A11A302A8A70');
|
||||
$this->addSql('ALTER TABLE incident_type DROP CONSTRAINT FK_66D2209655955332');
|
||||
$this->addSql('ALTER TABLE ride DROP CONSTRAINT FK_9B3D7CD076775724');
|
||||
$this->addSql('ALTER TABLE ride DROP CONSTRAINT FK_9B3D7CD017C042CF');
|
||||
$this->addSql('ALTER TABLE representation DROP CONSTRAINT FK_29D5499E8C03F15C');
|
||||
$this->addSql('ALTER TABLE representation DROP CONSTRAINT FK_29D5499E302A8A70');
|
||||
$this->addSql('DROP TABLE assignment');
|
||||
$this->addSql('DROP TABLE category');
|
||||
$this->addSql('DROP TABLE employee');
|
@ -2,17 +2,93 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use App\Entity\Representation;
|
||||
use App\Entity\Ride;
|
||||
use App\Form\RepresentationType;
|
||||
use App\Repository\RepresentationRepository;
|
||||
use App\Repository\RideRepository;
|
||||
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;
|
||||
|
||||
class RepresentationController extends AbstractController
|
||||
#[Route('/representation', name: 'representation')]
|
||||
final class RepresentationController extends AbstractController
|
||||
{
|
||||
#[Route('/representation', name: 'app_representation')]
|
||||
public function index(): Response
|
||||
public function __toString(): string
|
||||
{
|
||||
// TODO: Implement __toString() method.
|
||||
return "";
|
||||
}
|
||||
|
||||
#[Route(name: '_index', methods: ['GET'])]
|
||||
public function index(RepresentationRepository $representationRepository): Response
|
||||
{
|
||||
return $this->render('representation/index.html.twig', [
|
||||
'controller_name' => 'RepresentationController',
|
||||
'representations' => $representationRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: '_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager, RideRepository $rideRepository): Response
|
||||
{
|
||||
$representation = new Representation();
|
||||
$form = $this->createForm(RepresentationType::class, $representation);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$ride = $rideRepository->find($representation->getRide());
|
||||
$newCount = $ride->getCount() + $representation->getCount();
|
||||
$ride->setCount($newCount);
|
||||
|
||||
$entityManager->persist($representation);
|
||||
$entityManager->flush();
|
||||
//
|
||||
return $this->redirectToRoute('representation_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('representation/new.html.twig', [
|
||||
'representation' => $representation,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{employee}', name: '_show', methods: ['GET'])]
|
||||
public function show(Representation $representation): Response
|
||||
{
|
||||
return $this->render('representation/show.html.twig', [
|
||||
'representation' => $representation,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{employee}/edit', name: '_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Representation $representation, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(RepresentationType::class, $representation);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('representation_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('representation/edit.html.twig', [
|
||||
'representation' => $representation,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{employee}', name: '_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Representation $representation, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$representation->getEmployee(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($representation);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('representation_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
||||
|
100
src/Controller/RideController.php
Normal file
100
src/Controller/RideController.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Ride;
|
||||
use App\Form\RideType;
|
||||
use App\Repository\RideRepository;
|
||||
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('/ride', name: 'ride')]
|
||||
final class RideController extends AbstractController
|
||||
{
|
||||
#[Route(name: '_index', methods: ['GET'])]
|
||||
public function index(RideRepository $rideRepository): Response
|
||||
{
|
||||
return $this->render('ride/index.html.twig', [
|
||||
'rides' => $rideRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: '_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$ride = new Ride();
|
||||
$form = $this->createForm(RideType::class, $ride);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($ride);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('ride_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('ride/new.html.twig', [
|
||||
'ride' => $ride,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: '_show', methods: ['GET'])]
|
||||
public function show(Ride $ride): Response
|
||||
{
|
||||
return $this->render('ride/show.html.twig', [
|
||||
'ride' => $ride,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: '_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Ride $ride, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(RideType::class, $ride);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('ride_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('ride/edit.html.twig', [
|
||||
'ride' => $ride,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/increment', name: '_increment', methods: ['GET', 'POST'])]
|
||||
public function incrementCount(Request $request, Ride $ride, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(RideType::class);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$ride->setCount($ride->getCount() + 15);
|
||||
$entityManager->persist($ride);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
|
||||
return $this->redirectToRoute('ride_show', ['id' => $ride->getId()], Response::HTTP_SEE_OTHER);
|
||||
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: '_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Ride $ride, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$ride->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($ride);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('ride_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -7,18 +7,16 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AssignmentRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['employee', 'ride']
|
||||
columns: ['employee_id', 'ride_id']
|
||||
)]
|
||||
class Assignment
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Employee::class, inversedBy: 'assignments')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?Employee $employee = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Ride::class, inversedBy: 'assignments')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?Ride $ride = null;
|
||||
|
||||
#[ORM\Column]
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Repository\EmployeeRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@ -34,23 +35,30 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
private array $roles = [];
|
||||
|
||||
#[ORM\OneToMany(targetEntity: EmployeeSkill::class, mappedBy: 'employee')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'employee')]
|
||||
private Collection $employeeSkills;
|
||||
|
||||
//Changer en ManyToMany et pareil dans mission
|
||||
#[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'employee')]
|
||||
private Collection $missions;
|
||||
|
||||
//Changer en OneToMany et inversement dans incident
|
||||
#[ORM\ManyToOne(targetEntity: Incident::class, inversedBy: 'employee')]
|
||||
private Collection $incidents;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Assignment::class, mappedBy: 'employee')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'employee')]
|
||||
private Collection $assignments;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Representation::class, mappedBy: 'employee')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'employee')]
|
||||
private Collection $representations;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->assignments = new ArrayCollection();
|
||||
$this->representations = new ArrayCollection();
|
||||
$this->employeeSkills = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeeSkills(): Collection
|
||||
{
|
||||
return $this->employeeSkills;
|
||||
@ -77,25 +85,25 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmployeeMissions(): Collection
|
||||
{
|
||||
return $this->employeeMissions;
|
||||
}
|
||||
// public function getEmployeeMissions(): Collection
|
||||
// {
|
||||
// return $this->employeeMissions;
|
||||
// }
|
||||
//
|
||||
// public function setEmployeeMissions(Collection $employeeMissions): void
|
||||
// {
|
||||
// $this->employeeMissions = $employeeMissions;
|
||||
// }
|
||||
|
||||
public function setEmployeeMissions(Collection $employeeMissions): void
|
||||
{
|
||||
$this->employeeMissions = $employeeMissions;
|
||||
}
|
||||
|
||||
public function getEmployeeIncidents(): Collection
|
||||
{
|
||||
return $this->employeeIncidents;
|
||||
}
|
||||
|
||||
public function setEmployeeIncidents(Collection $employeeIncidents): void
|
||||
{
|
||||
$this->employeeIncidents = $employeeIncidents;
|
||||
}
|
||||
// public function getEmployeeIncidents(): Collection
|
||||
// {
|
||||
// return $this->employeeIncidents;
|
||||
// }
|
||||
//
|
||||
// public function setEmployeeIncidents(Collection $employeeIncidents): void
|
||||
// {
|
||||
// $this->employeeIncidents = $employeeIncidents;
|
||||
// }
|
||||
|
||||
public function getAssignments(): Collection
|
||||
{
|
||||
@ -239,7 +247,7 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMissions(): Collection
|
||||
public function getMissions(): ?Collection
|
||||
{
|
||||
return $this->missions;
|
||||
}
|
||||
@ -249,7 +257,7 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
$this->missions = $missions;
|
||||
}
|
||||
|
||||
public function getIncidents(): Collection
|
||||
public function getIncidents(): ?Collection
|
||||
{
|
||||
return $this->incidents;
|
||||
}
|
||||
@ -259,5 +267,8 @@ class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
$this->incidents = $incidents;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->firstName . ' ' . $this->lastName;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class Incident
|
||||
#[ORM\OneToMany(targetEntity: IncidentType::class, mappedBy: 'incident')]
|
||||
private ?IncidentType $incidentType;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'incident')]
|
||||
#[ORM\ManyToOne(targetEntity: Ride::class, inversedBy: 'incidents')]
|
||||
private ?Ride $ride;
|
||||
|
||||
public function getEmployeeincidents(): Collection
|
||||
|
@ -25,9 +25,6 @@ class Mission
|
||||
#[ORM\OneToMany(targetEntity: Employee::class, mappedBy: 'mission')]
|
||||
private ?Employee $employee = null;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Ride::class, mappedBy: 'mission')]
|
||||
private ?Ride $ride;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: MissionCategory::class, mappedBy: 'mission')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'mission')]
|
||||
private Collection $missionCategories;
|
||||
|
@ -7,18 +7,16 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: RepresentationRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['employee', 'ride']
|
||||
columns: ['employee_id', 'ride_id', 'date']
|
||||
)]
|
||||
class Representation
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Employee::class, inversedBy: 'representations')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?Employee $employee = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Ride::class, inversedBy: 'representations')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?Ride $ride = null;
|
||||
|
||||
#[ORM\Column]
|
||||
|
@ -21,17 +21,15 @@ class Ride
|
||||
private ?int $count = null;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Assignment::class, mappedBy: 'ride')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'ride')]
|
||||
private Collection $assignments;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: Representation::class, mappedBy: 'ride')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'ride')]
|
||||
private Collection $representations;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: IncidentType::class, inversedBy: 'ride')]
|
||||
private Collection $incidentTypes;
|
||||
#[ORM\OneToMany(targetEntity: Incident::class, mappedBy: 'ride')]
|
||||
private Collection $incidents;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'ride')]
|
||||
#[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'ride')]
|
||||
private Collection $missions;
|
||||
|
||||
public function getAssignments(): Collection
|
||||
@ -62,7 +60,7 @@ class Ride
|
||||
|
||||
public function getRepresentations(): Collection
|
||||
{
|
||||
return $this->representations;
|
||||
return $this->incidents;
|
||||
}
|
||||
|
||||
public function addRepresentation(Representation $representation): static
|
||||
@ -122,16 +120,6 @@ class Ride
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIncidentTypes(): Collection
|
||||
{
|
||||
return $this->incidentTypes;
|
||||
}
|
||||
|
||||
public function setIncidentTypes(Collection $incidentTypes): void
|
||||
{
|
||||
$this->incidentTypes = $incidentTypes;
|
||||
}
|
||||
|
||||
public function getMissions(): Collection
|
||||
{
|
||||
return $this->missions;
|
||||
@ -142,5 +130,18 @@ class Ride
|
||||
$this->missions = $missions;
|
||||
}
|
||||
|
||||
public function getIncidents(): Collection
|
||||
{
|
||||
return $this->incidents;
|
||||
}
|
||||
|
||||
public function setIncidents(Collection $incidents): void
|
||||
{
|
||||
$this->incidents = $incidents;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
}
|
||||
|
39
src/Form/RepresentationType.php
Normal file
39
src/Form/RepresentationType.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use App\Entity\Representation;
|
||||
use App\Entity\Ride;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RepresentationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('employee', EntityType::class, [
|
||||
'class' => Employee::class,
|
||||
'choice_label' => 'email',
|
||||
])
|
||||
->add('ride', EntityType::class, [
|
||||
'class' => Ride::class,
|
||||
'choice_label' => 'label',
|
||||
])
|
||||
->add('count')
|
||||
->add('date', null, [
|
||||
'widget' => 'single_text',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Representation::class,
|
||||
]);
|
||||
}
|
||||
}
|
38
src/Form/RideType.php
Normal file
38
src/Form/RideType.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Incident;
|
||||
use App\Entity\IncidentType;
|
||||
use App\Entity\Mission;
|
||||
use App\Entity\Ride;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RideType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('label')
|
||||
->add('count')
|
||||
->add('incidents', EntityType::class, [
|
||||
'class' => Incident::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
->add('missions', EntityType::class, [
|
||||
'class' => Mission::class,
|
||||
'choice_label' => 'id',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Ride::class,
|
||||
]);
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-dark p-3 m-2 rounded hegre-navbar">
|
||||
<a class="navbar-brand " href="#">
|
||||
<img src="https://getbootstrap.com/docs/4.4/assets/brand/bootstrap-solid.svg" width="30" height="30" class="d-inline-block align-top" alt="">
|
||||
HergeLand
|
||||
HegreLand
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
@ -34,14 +34,18 @@
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="#">Dashboard<span class="sr-only"></span></a>
|
||||
<a class="nav-link" href="{{ path('dashboard') }}">Dashboard<span class="sr-only"></span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Attractions</a>
|
||||
<a class="nav-link" href="{{ path('ride_index') }}">Attractions</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Employées</a>
|
||||
<a class="nav-link" href="{{ path('representation_index') }}">Représentation</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ path('employee_index') }}">Employées</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
4
templates/representation/_delete_form.html.twig
Normal file
4
templates/representation/_delete_form.html.twig
Normal file
@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('app_representation_delete', {'employee': representation.employee}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ representation.employee) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
templates/representation/_form.html.twig
Normal file
4
templates/representation/_form.html.twig
Normal file
@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
13
templates/representation/edit.html.twig
Normal file
13
templates/representation/edit.html.twig
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Representation{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Representation</h1>
|
||||
|
||||
{{ include('representation/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('representation_index') }}">back to list</a>
|
||||
|
||||
{{ include('representation/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
39
templates/representation/index.html.twig
Normal file
39
templates/representation/index.html.twig
Normal file
@ -0,0 +1,39 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Representation index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Representation index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Employee</th>
|
||||
<th>Ride</th>
|
||||
<th>Count</th>
|
||||
<th>Date</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for representation in representations %}
|
||||
<tr>
|
||||
<td>{{ representation.employee }}</td>
|
||||
<td>{{ representation.ride }}</td>
|
||||
<td>{{ representation.count }}</td>
|
||||
<td>{{ representation.date ? representation.date|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>
|
||||
<a href="{{ path('representation_show', {'employee': representation.employee}) }}">show</a>
|
||||
<a href="{{ path('representation_edit', {'employee': representation.employee}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="5">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('representation_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
templates/representation/new.html.twig
Normal file
11
templates/representation/new.html.twig
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Representation{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Representation</h1>
|
||||
|
||||
{{ include('representation/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('representation_index') }}">back to list</a>
|
||||
{% endblock %}
|
34
templates/representation/show.html.twig
Normal file
34
templates/representation/show.html.twig
Normal file
@ -0,0 +1,34 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Representation{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Representation</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Employee</th>
|
||||
<td>{{ representation.employee }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Ride</th>
|
||||
<td>{{ representation.ride }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Count</th>
|
||||
<td>{{ representation.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<td>{{ representation.date ? representation.date|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('representation_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('representation_edit', {'employee': representation.employee}) }}">edit</a>
|
||||
|
||||
{{ include('representation/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
4
templates/ride/_delete_form.html.twig
Normal file
4
templates/ride/_delete_form.html.twig
Normal file
@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('ride_delete', {'id': ride.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ ride.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
templates/ride/_form.html.twig
Normal file
4
templates/ride/_form.html.twig
Normal file
@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
13
templates/ride/edit.html.twig
Normal file
13
templates/ride/edit.html.twig
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Ride{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Ride</h1>
|
||||
|
||||
{{ include('ride/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('ride_index') }}">back to list</a>
|
||||
|
||||
{{ include('ride/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
37
templates/ride/index.html.twig
Normal file
37
templates/ride/index.html.twig
Normal file
@ -0,0 +1,37 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Ride index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Ride index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Label</th>
|
||||
<th>Count</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for ride in rides %}
|
||||
<tr>
|
||||
<td>{{ ride.id }}</td>
|
||||
<td>{{ ride.label }}</td>
|
||||
<td>{{ ride.count }}</td>
|
||||
<td>
|
||||
<a href="{{ path('ride_show', {'id': ride.id}) }}">show</a>
|
||||
<a href="{{ path('ride_edit', {'id': ride.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('ride_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
templates/ride/new.html.twig
Normal file
11
templates/ride/new.html.twig
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Ride{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Ride</h1>
|
||||
|
||||
{{ include('ride/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('ride_index') }}">back to list</a>
|
||||
{% endblock %}
|
36
templates/ride/show.html.twig
Normal file
36
templates/ride/show.html.twig
Normal file
@ -0,0 +1,36 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Ride{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block body %}
|
||||
<h1>Ride</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ ride.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Label</th>
|
||||
<td>{{ ride.label }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Count</th>
|
||||
<td>{{ ride.count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<a href="{{ path('ride_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('ride_edit', {'id': ride.id}) }}">edit</a>
|
||||
|
||||
<form method="post" action="{{ path('ride_increment', {'id': ride.id}) }}" onsubmit="return confirm('Attraction complète ?');">
|
||||
|
||||
{{ include('ride/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user