diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 6f0de0f..abacea9 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -2,7 +2,11 @@ namespace App\Controller; +use App\Entity\UserApp; +use App\Form\UserAppType; +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; @@ -23,6 +27,24 @@ class ProfileController extends AbstractController 'user' => $user, ]); } + + #[Route('profile/{id}/edit', name: 'app_profile_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response + { + $form = $this->createForm(UserAppType::class, $userApp); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $entityManager->flush(); + + return $this->redirectToRoute('app_profile', [], Response::HTTP_SEE_OTHER); + } + + return $this->render('profile/edit.html.twig', [ + 'user_app' => $userApp, + 'form' => $form, + ]); + } } diff --git a/src/Controller/UserAppController.php b/src/Controller/UserAppController.php index 7af1863..87635ae 100644 --- a/src/Controller/UserAppController.php +++ b/src/Controller/UserAppController.php @@ -14,7 +14,7 @@ use Symfony\Component\Routing\Attribute\Route; #[Route('/user')] final class UserAppController extends AbstractController { - #[Route(name: 'app_user_app_index', methods: ['GET'])] + #[Route(name: 'app_user_index', methods: ['GET'])] public function index(UserRepository $userRepository): Response { return $this->render('user_app/index.html.twig', [ @@ -22,7 +22,7 @@ final class UserAppController extends AbstractController ]); } - #[Route('/{id}', name: 'app_user_app_show', methods: ['GET'])] + #[Route('/{id}', name: 'app_user_show', methods: ['GET'])] public function show(UserApp $userApp): Response { return $this->render('user_app/show.html.twig', [ @@ -30,7 +30,7 @@ final class UserAppController extends AbstractController ]); } - #[Route('/{id}/edit', name: 'app_user_app_edit', methods: ['GET', 'POST'])] + #[Route('/{id}/edit', name: 'app_user_edit', methods: ['GET', 'POST'])] public function edit(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response { $form = $this->createForm(UserAppType::class, $userApp); @@ -39,7 +39,7 @@ final class UserAppController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $entityManager->flush(); - return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER); + return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER); } return $this->render('user_app/edit.html.twig', [ @@ -48,7 +48,7 @@ final class UserAppController extends AbstractController ]); } - #[Route('/{id}', name: 'app_user_app_delete', methods: ['POST'])] + #[Route('/{id}', name: 'app_user_delete', methods: ['POST'])] public function delete(Request $request, UserApp $userApp, EntityManagerInterface $entityManager): Response { if ($this->isCsrfTokenValid('delete'.$userApp->getId(), $request->getPayload()->getString('_token'))) { @@ -56,6 +56,6 @@ final class UserAppController extends AbstractController $entityManager->flush(); } - return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER); + return $this->redirectToRoute('app_user_index', [], Response::HTTP_SEE_OTHER); } } diff --git a/src/Form/UserAppType.php b/src/Form/UserAppType.php index dbd2033..3af7796 100644 --- a/src/Form/UserAppType.php +++ b/src/Form/UserAppType.php @@ -13,7 +13,6 @@ class UserAppType extends AbstractType { $builder ->add('nickname') - ->add('roles') ->add('password') ->add('firstName') ->add('lastName') diff --git a/templates/base.html.twig b/templates/base.html.twig index 1b5a07a..f7bf832 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -31,10 +31,13 @@ FAQ Messagerie -
+
Profil + + Déconnexion +
@@ -68,14 +71,8 @@

Contactez-nous

Email: support@hegresphere.com

Téléphone: +33 1 23 45 67 89

- - Déconnexion - -
-

© 2024 HegreSphere. Tous droits réservés.

-
diff --git a/templates/profile/edit.html.twig b/templates/profile/edit.html.twig new file mode 100644 index 0000000..d95b157 --- /dev/null +++ b/templates/profile/edit.html.twig @@ -0,0 +1,32 @@ +{% extends 'base.html.twig' %} + +{% block title %}Modifier l'utilisateur{% endblock %} + +{% block body %} +
+

Modifier l'utilisateur

+ +
+ {{ form_start(form) }} + +
+ {{ form_row(form.nickname, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.firstName, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.lastName, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.tel, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.address, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.mail, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.password, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} +
+
+ {{ form_widget(form) }} +
+ + + + {{ form_end(form) }} +
+
+{% endblock %} \ No newline at end of file diff --git a/templates/profile/intern.html.twig b/templates/profile/intern.html.twig index 5e74532..1482561 100644 --- a/templates/profile/intern.html.twig +++ b/templates/profile/intern.html.twig @@ -1,14 +1,45 @@
-

Bonjour {{ app.user.firstName }} {{ app.user.lastName }}

+

Bonjour {{ app.user.nickname }}

Vous êtes à la recherche d'un stage.

+
+

Nom : {{ app.user.firstName }}

+

Prénom : {{ app.user.lastName }}

Adresse : {{ app.user.address }}

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

Email : {{ app.user.mail }}

+

Vos diplômes :

+ +

Vos compétences :

+ +
+ Accéder aux favoris + +
+
+ Modifier + +
diff --git a/templates/user_app/edit.html.twig b/templates/user_app/edit.html.twig index 346e18e..65b9dd9 100644 --- a/templates/user_app/edit.html.twig +++ b/templates/user_app/edit.html.twig @@ -1,13 +1,50 @@ {% extends 'base.html.twig' %} -{% block title %}Edit UserApp{% endblock %} +{% block title %}Modifier l'utilisateur{% endblock %} {% block body %} -

Edit UserApp

+
+

Modifier l'utilisateur

- {{ include('user_app/_form.html.twig', {'button_label': 'Update'}) }} +
+ {{ form_start(form) }} - back to list +
+ {{ form_row(form.nickname, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.firstName, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.lastName, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.tel, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.address, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.mail, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} + {{ form_row(form.password, {'attr': {'class': 'w-full p-3 border rounded-md'}}) }} +
+
+ {{ form_widget(form) }} +
- {{ include('user_app/_delete_form.html.twig') }} -{% endblock %} + + + {{ form_end(form) }} +
+ +
+ + Retour à la liste des utilisateurs + + + +
+
+{% endblock %} \ No newline at end of file diff --git a/templates/user_app/index.html.twig b/templates/user_app/index.html.twig index b2c562e..5579c3d 100644 --- a/templates/user_app/index.html.twig +++ b/templates/user_app/index.html.twig @@ -1,49 +1,56 @@ {% extends 'base.html.twig' %} -{% block title %}UserApp index{% endblock %} +{% block title %}Liste des utilisateurs{% endblock %} {% block body %} -

UserApp index

+
+

Liste des Utilisateurs

- - - - - - - - - - - - - - - - - {% for user_app in user_apps %} - - - - - - - - - - - - - {% else %} - - - - {% endfor %} - -
IdNicknameRolesPasswordFirstNameLastNameTelAddressMailactions
{{ user_app.id }}{{ user_app.nickname }}{{ user_app.roles ? user_app.roles|json_encode : '' }}{{ user_app.password }}{{ user_app.firstName }}{{ user_app.lastName }}{{ user_app.tel }}{{ user_app.address }}{{ user_app.mail }} - show - edit -
no records found
+
+ + + + + + + + + + + + + {% for user_app in user_apps %} + + + + + + + + + {% else %} + + + + {% endfor %} + +
IDNicknameFirstNameLastNameMailActions
{{ user_app.id }}{{ user_app.nickname }}{{ user_app.firstName }}{{ user_app.lastName }}{{ user_app.mail }} + + Voir + - Create new -{% endblock %} + + Modifier + + +
+ + + +
+
Aucun utilisateur trouvé
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/user_app/show.html.twig b/templates/user_app/show.html.twig index 931539c..933e8fa 100644 --- a/templates/user_app/show.html.twig +++ b/templates/user_app/show.html.twig @@ -1,54 +1,58 @@ {% extends 'base.html.twig' %} -{% block title %}UserApp{% endblock %} +{% block title %}Détail de l'utilisateur{% endblock %} {% block body %} -

UserApp

+
+

Détail de l'utilisateur

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Id{{ user_app.id }}
Nickname{{ user_app.nickname }}
Roles{{ user_app.roles ? user_app.roles|json_encode : '' }}
Password{{ user_app.password }}
FirstName{{ user_app.firstName }}
LastName{{ user_app.lastName }}
Tel{{ user_app.tel }}
Address{{ user_app.address }}
Mail{{ user_app.mail }}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID{{ user_app.id }}
Nom{{ user_app.lastName }}
Prénom{{ user_app.firstName }}
Téléphone{{ user_app.tel }}
Adresse{{ user_app.address }}
E-mail{{ user_app.mail }}
+
- back to list +
+ + Retour à la liste des utilisateurs + - edit +
+ + Modifier cet utilisateur + - {{ include('user_app/_delete_form.html.twig') }} -{% endblock %} + + Supprimer + +
+
+
+{% endblock %} \ No newline at end of file