diff --git a/src/Controller/EmployeeController.php b/src/Controller/EmployeeController.php index 1a2d60d..6d7cd17 100644 --- a/src/Controller/EmployeeController.php +++ b/src/Controller/EmployeeController.php @@ -92,5 +92,31 @@ final class EmployeeController extends AbstractController ]); } + #[Route('/application/{id}/update-status/{status}', name: 'app_employee_update_application_status', methods: ['POST'])] + public function updateApplicationStatus(int $id, string $status): Response + { + $employee = $this->getUser(); + if (!$employee instanceof Employee) { + throw $this->createAccessDeniedException('Seuls les employés peuvent accéder à cette action.'); + } + + $application = $this->internApplicationRepository->find($id); + + if (!$application) { + throw $this->createNotFoundException('Candidature introuvable.'); + } + + $company = $employee->getCompany(); + if ($application->getApplication()->getCompany() !== $company) { + throw $this->createAccessDeniedException('Cette candidature ne vous appartient pas.'); + } + + $application->setStatus($status); + $this->entityManager->flush(); + + $this->addFlash('success', 'Le statut de la candidature a bien été mis à jour.'); + + return $this->redirectToRoute('app_employee_seeApplications'); + } } diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 8263c94..9462052 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -63,17 +63,17 @@ class ProfileController extends AbstractController ]); } - #[Route('/profile/{id}/visit', name: 'app_profile_visit')] + #[Route('/profile/visit/{id}', name: 'app_profile_visit')] public function visitProfile(EntityManagerInterface $entityManager, int $id): Response { - $user = $entityManager->getRepository(Intern::class)->find($id); + $candidat = $entityManager->getRepository(Intern::class)->find($id); - if (!$user) { + if (!$candidat) { throw $this->createNotFoundException('Utilisateur non trouvé.'); } - return $this->render('profile/index.html.twig', [ - 'user' => $user, + return $this->render('profile/visit.html.twig', [ + 'candidat' => $candidat, ]); } diff --git a/templates/employee/applications.html.twig b/templates/employee/applications.html.twig index 18efabb..eb1dc91 100644 --- a/templates/employee/applications.html.twig +++ b/templates/employee/applications.html.twig @@ -3,22 +3,41 @@ {% block title %}Liste des Candidatures{% endblock %} {% block body %} -

Candidatures reçues

+
+

Candidatures reçues

-{% for app in applications %} -
-

Annonce : {{ app.application.title }}

-

Candidat : {{ app.intern.firstName }} {{ app.intern.lastName }}

-

Date : {{ app.applicationDate|date('d/m/Y') }}

-

Statut : {{ app.status }}

+ {% for app in applications %} +
+

Annonce : {{ app.application.title }}

+

Candidat : {{ app.intern.firstName }} {{ app.intern.lastName }}

+

Date : {{ app.applicationDate|date('d/m/Y') }}

+

Statut : {{ app.status|capitalize }}

- - Voir le profil du candidat - + + Voir le profil du candidat + + + {% if app.status == 'En Attente' %} +
+
+ +
+ +
+ +
+
+ {% endif %} +
+ {% else %} +

Aucune candidature pour le moment.

+ {% endfor %}
-{% else %} -

Aucune candidature pour le moment.

-{% endfor %} - {% endblock %} diff --git a/templates/profile/employee.html.twig b/templates/profile/employee.html.twig index be1c7df..d83f460 100644 --- a/templates/profile/employee.html.twig +++ b/templates/profile/employee.html.twig @@ -8,9 +8,9 @@

Téléphone : {{ app.user.tel }}

Email : {{ app.user.mail }}

- - Voir les candidatures reçues + + Voir les candidatures reçues diff --git a/templates/profile/visit.html.twig b/templates/profile/visit.html.twig index b202ac7..8a2858a 100644 --- a/templates/profile/visit.html.twig +++ b/templates/profile/visit.html.twig @@ -7,18 +7,18 @@

Profil du candidat

-

Nom : {{ user.lastName }}

-

Prénom : {{ user.firstName }}

-

Email : {{ user.mail }}

-

Téléphone : {{ user.tel }}

-

Adresse : {{ user.address }}

+

Nom : {{ candidat.lastName }}

+

Prénom : {{ candidat.firstName }}

+

Email : {{ candidat.mail }}

+

Téléphone : {{ candidat.tel }}

+

Adresse : {{ candidat.address }}

Diplômes