Compare commits
13 Commits
136dc8367e
...
adbfe09f01
Author | SHA1 | Date | |
---|---|---|---|
adbfe09f01 | |||
c60aa4c43a | |||
f71e0027eb | |||
3a8d60fddb | |||
5219334da2 | |||
de2ab661b5 | |||
e607897c5b | |||
57bd6c953e | |||
37812be99b | |||
ba7e152552 | |||
76b4d05620 | |||
e66a2510ca | |||
3b353cde0b |
@ -7,4 +7,14 @@ body {
|
||||
max-width: 800px;
|
||||
width: 95%;
|
||||
font: 18px/1.5 sans-serif;
|
||||
}
|
||||
|
||||
.hegre-navbar {
|
||||
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
|
||||
backdrop-filter: blur(5px);
|
||||
-webkit-backdrop-filter: blur(5px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
}
|
@ -40,8 +40,7 @@ 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: ^/*, roles: ROLE_USER }
|
||||
|
||||
when@test:
|
||||
security:
|
||||
|
81
src/Controller/EmployeeController.php
Normal file
81
src/Controller/EmployeeController.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use App\Form\EmployeeType;
|
||||
use App\Repository\EmployeeRepository;
|
||||
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('/employee', name: 'employee')]
|
||||
final class EmployeeController extends AbstractController
|
||||
{
|
||||
#[Route('',name: '_index', methods: ['GET'])]
|
||||
public function index(EmployeeRepository $employeeRepository): Response
|
||||
{
|
||||
return $this->render('employee/index.html.twig', [
|
||||
'employees' => $employeeRepository->findAll(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/new', name: '_new', methods: ['GET', 'POST'])]
|
||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$employee = new Employee();
|
||||
$form = $this->createForm(EmployeeType::class, $employee);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($employee);
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('employee/new.html.twig', [
|
||||
'employee' => $employee,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: '_show', methods: ['GET'])]
|
||||
public function show(Employee $employee): Response
|
||||
{
|
||||
return $this->render('employee/show.html.twig', [
|
||||
'employee' => $employee,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}/edit', name: '_edit', methods: ['GET', 'POST'])]
|
||||
public function edit(Request $request, Employee $employee, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$form = $this->createForm(EmployeeType::class, $employee);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
|
||||
return $this->render('employee/edit.html.twig', [
|
||||
'employee' => $employee,
|
||||
'form' => $form,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: '_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, Employee $employee, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete'.$employee->getId(), $request->getPayload()->getString('_token'))) {
|
||||
$entityManager->remove($employee);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('employee_index', [], Response::HTTP_SEE_OTHER);
|
||||
}
|
||||
}
|
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\AssignmentRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: AssignmentRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['employee', 'ride']
|
||||
)]
|
||||
|
@ -3,10 +3,11 @@
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use App\Repository\CategoryRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
|
||||
class Category
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: EmployeeRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_EMAIL', fields: ['email'])]
|
||||
class Employee implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\EmployeeSkillRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: EmployeeSkillRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['employee', 'skill']
|
||||
)]
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\IncidentRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: IncidentRepository::class)]
|
||||
class Incident
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
@ -3,10 +3,11 @@
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use App\Repository\IncidentTypeRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: IncidentTypeRepository::class)]
|
||||
class IncidentType
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
@ -3,10 +3,11 @@
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use App\Repository\MissionRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: MissionRepository::class)]
|
||||
class Mission
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
@ -5,18 +5,17 @@ namespace App\Entity;
|
||||
use App\Repository\MissionCategoryRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\UniqueConstraint(columns: ['mission', 'category'])]
|
||||
#[ORM\Entity(repositoryClass: MissionCategoryRepository::class)]
|
||||
class MissionCategory
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Mission::class, inversedBy: 'missionCategories')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
#[ORM\OneToMany(targetEntity: Mission::class, mappedBy: 'MissionCategory')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Mission $mission = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'missionCategories')]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
#[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'MissionCategory')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Category $category = null;
|
||||
|
||||
public function getMission(): ?Mission
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RepresentationRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: RepresentationRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['employee', 'ride']
|
||||
)]
|
||||
|
@ -3,9 +3,10 @@
|
||||
namespace App\Entity;
|
||||
|
||||
|
||||
use App\Repository\RequirementRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: RequirementRepository::class)]
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['mission', 'skill']
|
||||
)]
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\RideRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: RideRepository::class)]
|
||||
class Ride
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\SkillRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Entity(repositoryClass: SkillRepository::class)]
|
||||
class Skill
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
42
src/Form/EmployeeType.php
Normal file
42
src/Form/EmployeeType.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Employee;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||
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;
|
||||
|
||||
class EmployeeType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('email', EmailType::class, ['label' => 'Email Address'])
|
||||
->add('firstName', TextType::class, ['label' => 'First Name'])
|
||||
->add('lastName', TextType::class, ['label' => 'Last Name'])
|
||||
->add('password', PasswordType::class, ['label' => 'Password'])
|
||||
->add('roles', ChoiceType::class, [
|
||||
'label' => 'Roles (comma-separated)',
|
||||
'required' => false,
|
||||
'choices' => [
|
||||
'User' => 'ROLE_USER',
|
||||
'Admin' => 'ROLE_ADMIN',
|
||||
],
|
||||
'multiple' => true, // Allow multiple selections
|
||||
'expanded' => true, // Render as checkboxes
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Employee::class,
|
||||
]);
|
||||
}
|
||||
}
|
43
src/Repository/AssignmentRepository.php
Normal file
43
src/Repository/AssignmentRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Assignment>
|
||||
*/
|
||||
class AssignmentRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Assignment::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Assignment[] Returns an array of Assignment objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('a.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Assignment
|
||||
// {
|
||||
// return $this->createQueryBuilder('a')
|
||||
// ->andWhere('a.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/CategoryRepository.php
Normal file
43
src/Repository/CategoryRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Category;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Category>
|
||||
*/
|
||||
class CategoryRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Category::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Category[] Returns an array of Category objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('c.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Category
|
||||
// {
|
||||
// return $this->createQueryBuilder('c')
|
||||
// ->andWhere('c.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/EmployeeSkillRepository.php
Normal file
43
src/Repository/EmployeeSkillRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\EmployeeSkill;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<EmployeeSkill>
|
||||
*/
|
||||
class EmployeeSkillRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, EmployeeSkill::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return EmployeeSkill[] Returns an array of EmployeeSkill objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('e')
|
||||
// ->andWhere('e.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('e.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?EmployeeSkill
|
||||
// {
|
||||
// return $this->createQueryBuilder('e')
|
||||
// ->andWhere('e.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/IncidentRepository.php
Normal file
43
src/Repository/IncidentRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Incident;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Incident>
|
||||
*/
|
||||
class IncidentRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Incident::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Incident[] Returns an array of Incident objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('i')
|
||||
// ->andWhere('i.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('i.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Incident
|
||||
// {
|
||||
// return $this->createQueryBuilder('i')
|
||||
// ->andWhere('i.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/IncidentTypeRepository.php
Normal file
43
src/Repository/IncidentTypeRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\IncidentType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<IncidentType>
|
||||
*/
|
||||
class IncidentTypeRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, IncidentType::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return IncidentType[] Returns an array of IncidentType objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('i')
|
||||
// ->andWhere('i.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('i.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?IncidentType
|
||||
// {
|
||||
// return $this->createQueryBuilder('i')
|
||||
// ->andWhere('i.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/MissionRepository.php
Normal file
43
src/Repository/MissionRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Mission;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Mission>
|
||||
*/
|
||||
class MissionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Mission::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Mission[] Returns an array of Mission objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('m')
|
||||
// ->andWhere('m.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('m.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Mission
|
||||
// {
|
||||
// return $this->createQueryBuilder('m')
|
||||
// ->andWhere('m.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/RepresentationRepository.php
Normal file
43
src/Repository/RepresentationRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Representation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Representation>
|
||||
*/
|
||||
class RepresentationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Representation::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Representation[] Returns an array of Representation objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Representation
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/RequirementRepository.php
Normal file
43
src/Repository/RequirementRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Requirement;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Requirement>
|
||||
*/
|
||||
class RequirementRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Requirement::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Requirement[] Returns an array of Requirement objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Requirement
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/RideRepository.php
Normal file
43
src/Repository/RideRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Ride;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Ride>
|
||||
*/
|
||||
class RideRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Ride::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Ride[] Returns an array of Ride objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('r.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Ride
|
||||
// {
|
||||
// return $this->createQueryBuilder('r')
|
||||
// ->andWhere('r.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
43
src/Repository/SkillRepository.php
Normal file
43
src/Repository/SkillRepository.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Skill;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Skill>
|
||||
*/
|
||||
class SkillRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Skill::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Skill[] Returns an array of Skill objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?Skill
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
61
src/Service/RelationService.php
Normal file
61
src/Service/RelationService.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Employee;
|
||||
use App\Entity\EmployeeSkill;
|
||||
use App\Entity\Mission;
|
||||
use App\Entity\MissionCategory;
|
||||
use App\Entity\Representation;
|
||||
use App\Entity\Requirement;
|
||||
use App\Entity\Ride;
|
||||
use App\Entity\Skill;
|
||||
|
||||
class RelationService {
|
||||
public function setAssignment(Ride $ride, Employee $employee, \DateTime $startHour, \DateTime $endHour )
|
||||
{
|
||||
$assignment = new Assignment();
|
||||
|
||||
$assignment->setEmployee($employee);
|
||||
$assignment->setRide($ride);
|
||||
$assignment->setStartHour($startHour);
|
||||
$assignment->setEndHour($endHour);
|
||||
}
|
||||
|
||||
public function setEmployeeSkill(Skill $skill, Employee $employee )
|
||||
{
|
||||
$employeeSkill = new EmployeeSkill();
|
||||
|
||||
$employeeSkill->setEmployee($employee);
|
||||
$employeeSkill->setSkill($skill);
|
||||
}
|
||||
|
||||
public function setMissionCategory(Mission $mission, Category $category )
|
||||
{
|
||||
$missionCategory = new MissionCategory();
|
||||
|
||||
$missionCategory->setMission($mission);
|
||||
$missionCategory->setCategory($category);
|
||||
}
|
||||
|
||||
public function setRepresentation(Ride $ride, Employee $employee,int $count ,\DateTime $date )
|
||||
{
|
||||
$representation = new Representation();
|
||||
|
||||
$representation->setRide($ride);
|
||||
$representation->setEmployee($employee);
|
||||
$representation->setCount($count);
|
||||
$representation->setDate($date);
|
||||
}
|
||||
|
||||
public function setRequirement(Skill $skill, Mission $mission )
|
||||
{
|
||||
$requirement = new Requirement();
|
||||
|
||||
$requirement->setSkill($skill);
|
||||
$requirement->setMission($mission);
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
{% block stylesheets %}
|
||||
{% endblock %}
|
||||
|
||||
@ -12,11 +13,47 @@
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
||||
</header>
|
||||
{% for label, messages in app.flashes %}
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ label }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<div class="ml-5 mr-5 ">
|
||||
<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
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<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>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Attractions</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Employées</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
{% endblock %}
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
{% block title %}Dashboard{% endblock %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div class="wrapper">
|
||||
<h1>Welcome, *Dashboard User* !</h1>
|
||||
|
||||
This is a placeholder.
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
4
templates/employee/_delete_form.html.twig
Normal file
4
templates/employee/_delete_form.html.twig
Normal file
@ -0,0 +1,4 @@
|
||||
<form method="post" action="{{ path('employee_delete', {'id': employee.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ employee.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
templates/employee/_form.html.twig
Normal file
4
templates/employee/_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/employee/edit.html.twig
Normal file
13
templates/employee/edit.html.twig
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Employee{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Employee</h1>
|
||||
|
||||
{{ include('employee/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('employee_index') }}">back to list</a>
|
||||
|
||||
{{ include('employee/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
41
templates/employee/index.html.twig
Normal file
41
templates/employee/index.html.twig
Normal file
@ -0,0 +1,41 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Employee index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Employee index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Email</th>
|
||||
<th>FirstName</th>
|
||||
<th>LastName</th>
|
||||
<th>Roles</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for employee in employees %}
|
||||
<tr>
|
||||
<td>{{ employee.id }}</td>
|
||||
<td>{{ employee.email }}</td>
|
||||
<td>{{ employee.firstName }}</td>
|
||||
<td>{{ employee.lastName }}</td>
|
||||
<td>{{ employee.roles ? employee.roles|json_encode : '' }}</td>
|
||||
<td>
|
||||
<a href="{{ path('employee_show', {'id': employee.id}) }}">show</a>
|
||||
<a href="{{ path('employee_edit', {'id': employee.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="7">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('employee_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
templates/employee/new.html.twig
Normal file
11
templates/employee/new.html.twig
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Employee{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Employee</h1>
|
||||
|
||||
{{ include('employee/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('employee_index') }}">back to list</a>
|
||||
{% endblock %}
|
38
templates/employee/show.html.twig
Normal file
38
templates/employee/show.html.twig
Normal file
@ -0,0 +1,38 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Employee{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Employee</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ employee.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Email</th>
|
||||
<td>{{ employee.email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>FirstName</th>
|
||||
<td>{{ employee.firstName }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LastName</th>
|
||||
<td>{{ employee.lastName }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Roles</th>
|
||||
<td>{{ employee.roles ? employee.roles|json_encode : '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('employee_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('employee_edit', {'id': employee.id}) }}">edit</a>
|
||||
|
||||
{{ include('employee/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user