diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/compose.override.yaml b/compose.override.yaml index 8dc54de..fc37713 100644 --- a/compose.override.yaml +++ b/compose.override.yaml @@ -1,4 +1,3 @@ - services: ###> doctrine/doctrine-bundle ### database: @@ -16,3 +15,4 @@ services: MP_SMTP_AUTH_ACCEPT_ANY: 1 MP_SMTP_AUTH_ALLOW_INSECURE: 1 ###< symfony/mailer ### + diff --git a/compose.yaml b/compose.yaml index 89c74d1..3bc2b6e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,13 +1,12 @@ - services: ###> doctrine/doctrine-bundle ### database: image: postgres:${POSTGRES_VERSION:-16}-alpine environment: - POSTGRES_DB: ${POSTGRES_DB:-app} + POSTGRES_DB: ${POSTGRES_DB:-hegresphere} # You should definitely change the password in production - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!} - POSTGRES_USER: ${POSTGRES_USER:-app} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-Btssio2024} + POSTGRES_USER: ${POSTGRES_USER:-bourgoino} healthcheck: test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"] timeout: 5s @@ -23,3 +22,4 @@ volumes: ###> doctrine/doctrine-bundle ### database_data: ###< doctrine/doctrine-bundle ### + diff --git a/composer.json b/composer.json index 6cda857..eaf6016 100644 --- a/composer.json +++ b/composer.json @@ -42,8 +42,10 @@ "symfony/validator": "7.1.*", "symfony/web-link": "7.1.*", "symfony/yaml": "7.1.*", + "symfonycasts/sass-bundle": "^0.7.0", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "ext-http": "*" }, "config": { "allow-plugins": { @@ -100,7 +102,7 @@ "symfony/browser-kit": "7.1.*", "symfony/css-selector": "7.1.*", "symfony/debug-bundle": "7.1.*", - "symfony/maker-bundle": "^1.0", + "symfony/maker-bundle": "^1.61", "symfony/phpunit-bridge": "^7.1", "symfony/stopwatch": "7.1.*", "symfony/web-profiler-bundle": "7.1.*" diff --git a/composer.lock b/composer.lock index 9b4a29f..58fd270 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1bc99d81c026aaf4e662ffffde457d04", + "content-hash": "39f4377209acc13ab9e977a5301faef0", "packages": [ { "name": "composer/semver", @@ -7423,6 +7423,61 @@ ], "time": "2025-01-07T12:50:05+00:00" }, + { + "name": "symfonycasts/sass-bundle", + "version": "v0.7.0", + "source": { + "type": "git", + "url": "https://github.com/SymfonyCasts/sass-bundle.git", + "reference": "d88601c50eff716d9273dffbd736adefdc19e2fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SymfonyCasts/sass-bundle/zipball/d88601c50eff716d9273dffbd736adefdc19e2fc", + "reference": "d88601c50eff716d9273dffbd736adefdc19e2fc", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/asset-mapper": "^6.3|^7.0", + "symfony/console": "^5.4|^6.3|^7.0", + "symfony/filesystem": "^5.4|^6.3|^7.0", + "symfony/http-client": "^5.4|^6.3|^7.0", + "symfony/process": "^5.4|^6.3|^7.0" + }, + "require-dev": { + "matthiasnoback/symfony-config-test": "^5.0", + "phpstan/phpstan-symfony": "^1.4", + "symfony/framework-bundle": "^6.3|^7.0", + "symfony/phpunit-bridge": "^6.3|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfonycasts\\SassBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mathéo Daninos", + "homepage": "https://github.com/WebMamba" + } + ], + "description": "Delightful Sass Support for Symfony + AssetMapper", + "keywords": [ + "asset-mapper", + "sass" + ], + "support": { + "issues": "https://github.com/SymfonyCasts/sass-bundle/issues", + "source": "https://github.com/SymfonyCasts/sass-bundle/tree/v0.7.0" + }, + "time": "2024-05-22T14:59:07+00:00" + }, { "name": "twig/extra-bundle", "version": "v3.20.0", diff --git a/config/bundles.php b/config/bundles.php index 4e3a560..1ebcba9 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -13,4 +13,5 @@ return [ Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfonycasts\SassBundle\SymfonycastsSassBundle::class => ['all' => true], ]; diff --git a/config/services.yaml b/config/services.yaml index 2d6a76f..c77d5e2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,7 +4,7 @@ # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: - + app.jwtsecret : '%env(JWT_SECRET)%' services: # default configuration for services in *this* file _defaults: diff --git a/migrations/Version20241121141451.php b/migrations/Version20241121141451.php new file mode 100644 index 0000000..d51cde4 --- /dev/null +++ b/migrations/Version20241121141451.php @@ -0,0 +1,38 @@ +addSql('DROP SEQUENCE status_id_seq CASCADE'); + $this->addSql('DROP TABLE status'); + $this->addSql('ALTER TABLE userapp ADD is_verified BOOLEAN NOT NULL'); + $this->addSql('ALTER TABLE userapp ALTER roles SET NOT NULL'); + } + + 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('CREATE SEQUENCE status_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE status (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE userApp DROP is_verified'); + $this->addSql('ALTER TABLE userApp ALTER roles DROP NOT NULL'); + } +} diff --git a/migrations/Version20241121141722.php b/migrations/Version20241121141722.php new file mode 100644 index 0000000..6259ec7 --- /dev/null +++ b/migrations/Version20241121141722.php @@ -0,0 +1,40 @@ +addSql('ALTER TABLE userapp ALTER first_name DROP NOT NULL'); + $this->addSql('ALTER TABLE userapp ALTER last_name DROP NOT NULL'); + $this->addSql('ALTER TABLE userapp ALTER tel DROP NOT NULL'); + $this->addSql('ALTER TABLE userapp ALTER address DROP NOT NULL'); + $this->addSql('ALTER TABLE userapp ALTER mail DROP NOT NULL'); + } + + 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('ALTER TABLE userApp ALTER first_name SET NOT NULL'); + $this->addSql('ALTER TABLE userApp ALTER last_name SET NOT NULL'); + $this->addSql('ALTER TABLE userApp ALTER tel SET NOT NULL'); + $this->addSql('ALTER TABLE userApp ALTER address SET NOT NULL'); + $this->addSql('ALTER TABLE userApp ALTER mail SET NOT NULL'); + } +} diff --git a/migrations/Version20241121141818.php b/migrations/Version20241121141818.php new file mode 100644 index 0000000..7eb43e8 --- /dev/null +++ b/migrations/Version20241121141818.php @@ -0,0 +1,31 @@ +addSql('CREATE SCHEMA public'); + } +} diff --git a/migrations/Version20241121141912.php b/migrations/Version20241121141912.php new file mode 100644 index 0000000..fbc5345 --- /dev/null +++ b/migrations/Version20241121141912.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE userapp ALTER is_verified DROP NOT NULL'); + } + + 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('ALTER TABLE userApp ALTER is_verified SET NOT NULL'); + } +} diff --git a/migrations/Version20241121142119.php b/migrations/Version20241121142119.php new file mode 100644 index 0000000..44746a0 --- /dev/null +++ b/migrations/Version20241121142119.php @@ -0,0 +1,34 @@ +addSql('ALTER TABLE intern ALTER cover_letter DROP NOT NULL'); + $this->addSql('ALTER TABLE intern ALTER resume DROP NOT NULL'); + } + + 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('ALTER TABLE intern ALTER cover_letter SET NOT NULL'); + $this->addSql('ALTER TABLE intern ALTER resume SET NOT NULL'); + } +} diff --git a/migrations/Version20241121142432.php b/migrations/Version20241121142432.php new file mode 100644 index 0000000..8226230 --- /dev/null +++ b/migrations/Version20241121142432.php @@ -0,0 +1,31 @@ +addSql('CREATE SCHEMA public'); + } +} diff --git a/migrations/Version20241121145353.php b/migrations/Version20241121145353.php new file mode 100644 index 0000000..439bd80 --- /dev/null +++ b/migrations/Version20241121145353.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE employee ALTER company_id DROP NOT NULL'); + } + + 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('ALTER TABLE employee ALTER company_id SET NOT NULL'); + } +} diff --git a/public/js/map.js b/public/js/map.js new file mode 100644 index 0000000..ae168ad --- /dev/null +++ b/public/js/map.js @@ -0,0 +1,7 @@ + + +// initialize the map on the "map" div with a given center and zoom +var map = L.map('map', { + center: [51.505, -0.09], + zoom: 13 +}); diff --git a/src/Controller/AnnouncementController.php b/src/Controller/AnnouncementController.php index 699d90b..707e1fc 100644 --- a/src/Controller/AnnouncementController.php +++ b/src/Controller/AnnouncementController.php @@ -20,7 +20,6 @@ final class AnnouncementController extends AbstractController $user = $this->getUser(); $announcements = []; - // Récupérer les paramètres de recherche $companyName = $request->query->get('company_name'); $location = $request->query->get('location'); $category = $request->query->get('category'); @@ -47,18 +46,27 @@ final class AnnouncementController extends AbstractController $announcements = $announcementRepository->findBy(['status' => 'Verified']); } - // Filtrer les annonces en fonction des critères de recherche if ($companyName || $location || $category) { $announcements = $announcementRepository->searchAnnouncements($companyName, $location, $category); } + $favorites = []; + if (in_array('ROLE_INTERN', $user->getRoles())) { + $favorites = array_map( + fn($f) => $f->getAnnouncement()->getId(), + $user->getFavorites()->toArray() + ); + } + return $this->render('announcement/index.html.twig', [ 'announcements' => $announcements, + 'favorites' => $favorites, 'showNonValidated' => $request->query->get('show_non_validated', false), ]); } + #[Route('/new', name: 'app_announcement_new', methods: ['GET', 'POST'])] public function new(Request $request, EntityManagerInterface $entityManager): Response { diff --git a/src/Controller/InternController.php b/src/Controller/InternController.php index ff4b627..7e08ded 100644 --- a/src/Controller/InternController.php +++ b/src/Controller/InternController.php @@ -7,6 +7,8 @@ use App\Entity\Degree; use App\Entity\Intern; use App\Entity\InternApplication; use App\Entity\InternDegree; +use App\Entity\InternSkill; +use App\Entity\Skill; use App\Form\InternType; use App\Repository\InternRepository; use Doctrine\ORM\EntityManagerInterface; @@ -146,4 +148,50 @@ final class InternController extends AbstractController return $this->redirectToRoute('app_profile'); } + + #[Route('/skills/add', name:'app_intern_add_skills', methods:['POST'])] + public function addSkills(Request $request, EntityManagerInterface $entityManager): Response + { + $intern = $this->getUser(); + + if (!$intern instanceof Intern) { + throw $this->createAccessDeniedException("Seuls les stagiaires peuvent sélectionner des compétences."); + } + + $selectedSkillIds = $request->request->all('selected_skills'); + + if ($selectedSkillIds == []) { + $this->addFlash('error', "Aucune sélection valide n'a été effectuée."); + return $this->redirectToRoute('app_skill_index'); + } + + $skillRepository = $entityManager->getRepository(Skill::class); + $internSkillRepository = $entityManager->getRepository(InternSkill::class); + + foreach ($selectedSkillIds as $skillId) { + $skill = $skillRepository->find($skillId); + + if (!$skill) continue; + + $existingInternSkill = $internSkillRepository->findOneBy([ + 'intern' => $intern, + 'skill' => $skill + ]); + + if (!$existingInternSkill) { + $internSkill = new InternSkill(); + $internSkill->setIntern($intern); + $internSkill->setSkill($skill); + + $entityManager->persist($internSkill); + } + } + + $entityManager->flush(); + + $this->addFlash('success', 'Les compétences ont été ajoutées avec succès.'); + + return $this->redirectToRoute('app_profile'); + } + } diff --git a/src/Controller/InternFavoriteController.php b/src/Controller/InternFavoriteController.php new file mode 100644 index 0000000..1a04b22 --- /dev/null +++ b/src/Controller/InternFavoriteController.php @@ -0,0 +1,136 @@ +getUser()->getIntern(); + + $existing = $repo->findOneBy([ + 'intern' => $intern, + 'announcement' => $announcement + ]); + + if ($existing) { + $em->remove($existing); + } else { + $favorite = new InternFavorite(); + $favorite->setIntern($intern); + $favorite->setAnnouncement($announcement); + $em->persist($favorite); + } + + $em->flush(); + + return $this->redirectToRoute('app_announcement_index'); + } + + #[Route('/announcement/{id}/favorite/toggle', name: 'app_favorite_toggle', methods: ['POST'])] + public function toggle(Announcement $announcement, EntityManagerInterface $em, Security $security): RedirectResponse + { + $user = $security->getUser(); + + if (!$user instanceof Intern) { + throw new AccessDeniedHttpException('Seuls les stagiaires peuvent ajouter aux favoris.'); + } + + $favorite = $em->getRepository(InternFavorite::class)->findOneBy([ + 'intern' => $user, + 'announcement' => $announcement + ]); + + if ($favorite) { + $em->remove($favorite); + } else { + $favorite = new InternFavorite(); + $favorite->setIntern($user); + $favorite->setAnnouncement($announcement); + $em->persist($favorite); + } + + $em->flush(); + + return new RedirectResponse($_SERVER['HTTP_REFERER'] ?? '/'); + } + + #[Route('/announcement/{id}', name: 'app_announcement_show')] + public function show(Announcement $announcement, InternFavoriteRepository $internFavoriteRepository): Response + { + $user = $this->getUser(); + $isFavorite = false; + + if (in_array('ROLE_INTERN', $user->getRoles())) { + $favorite = $internFavoriteRepository->findOneBy([ + 'announcement' => $announcement, + 'intern' => $user, + ]); + + $isFavorite = $favorite ? true : false; + } + + return $this->render('announcement/show.html.twig', [ + 'announcement' => $announcement, + 'isFavorite' => $isFavorite, + ]); + } + + #[Route('/favorite/add/{id}', name: 'app_favorite_add')] + public function addFavorite(Announcement $announcement, EntityManagerInterface $entityManager): Response + { + $user = $this->getUser(); + + // Vérifier si l'intern a déjà ce favori + $existingFavorite = $entityManager->getRepository(InternFavorite::class)->findOneBy([ + 'announcement' => $announcement, + 'intern' => $user, + ]); + + if (!$existingFavorite) { + $favorite = new InternFavorite(); + $favorite->setAnnouncement($announcement); + $favorite->setIntern($user); + + $entityManager->persist($favorite); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_announcement_show', ['id' => $announcement->getId()]); + } + + #[Route('/favorite/remove/{id}', name: 'app_favorite_remove')] + public function removeFavorite(Announcement $announcement, EntityManagerInterface $entityManager): Response + { + $user = $this->getUser(); + + $favorite = $entityManager->getRepository(InternFavorite::class)->findOneBy([ + 'announcement' => $announcement, + 'intern' => $user, + ]); + + if ($favorite) { + $entityManager->remove($favorite); + $entityManager->flush(); + } + + return $this->redirectToRoute('app_announcement_show', ['id' => $announcement->getId()]); + } +} diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 4277747..8263c94 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -7,6 +7,7 @@ use App\Entity\Intern; use App\Entity\InternApplication; use App\Entity\UserApp; use App\Form\UserAppType; +use App\Repository\SkillRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -84,4 +85,16 @@ class ProfileController extends AbstractController 'user_app' => $userApp, ]); } + + #[Route('/profile/pickSkill', name: 'app_profile_pickSkill', methods: ['GET'])] + public function pickSkill(UserApp $userApp): Response + { + + return $this->render('skill/index.html.twig', [ + 'user_app' => $userApp, + ]); + } + + + } \ No newline at end of file diff --git a/src/Entity/Annonce.php b/src/Entity/Annonce.php new file mode 100644 index 0000000..dc600bb --- /dev/null +++ b/src/Entity/Annonce.php @@ -0,0 +1,57 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getTitre(): ?string + { + return $this->Titre; + } + + public function setTitre(string $Titre): static + { + $this->Titre = $Titre; + + return $this; + } + + public function getDescription(): ?string + { + return $this->Description; + } + + public function setDescription(string $Description): static + { + $this->Description = $Description; + + return $this; + } +} diff --git a/src/Entity/Competence.php b/src/Entity/Competence.php new file mode 100644 index 0000000..ee8394b --- /dev/null +++ b/src/Entity/Competence.php @@ -0,0 +1,42 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getLibelle(): ?string + { + return $this->Libelle; + } + + public function setLibelle(string $Libelle): static + { + $this->Libelle = $Libelle; + + return $this; + } +} diff --git a/src/Entity/Demandeur.php b/src/Entity/Demandeur.php new file mode 100644 index 0000000..fae439e --- /dev/null +++ b/src/Entity/Demandeur.php @@ -0,0 +1,65 @@ +id; + } + + public function getLM(): ?string + { + return $this->LM; + } + + public function setLM(string $LM): static + { + $this->LM = $LM; + + return $this; + } + + public function getCV(): ?string + { + return $this->CV; + } + + public function setCV(string $CV): static + { + $this->CV = $CV; + + return $this; + } + + public function getMail(): ?string + { + return $this->Mail; + } + + public function setMail(string $Mail): static + { + $this->Mail = $Mail; + + return $this; + } +} diff --git a/src/Entity/Diplome.php b/src/Entity/Diplome.php new file mode 100644 index 0000000..5ca827e --- /dev/null +++ b/src/Entity/Diplome.php @@ -0,0 +1,42 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getLibelle(): ?string + { + return $this->Libelle; + } + + public function setLibelle(string $Libelle): static + { + $this->Libelle = $Libelle; + + return $this; + } +} diff --git a/src/Entity/Employe.php b/src/Entity/Employe.php new file mode 100644 index 0000000..1d4fa6c --- /dev/null +++ b/src/Entity/Employe.php @@ -0,0 +1,35 @@ +id; + } + + public function getMail(): ?string + { + return $this->Mail; + } + + public function setMail(string $Mail): static + { + $this->Mail = $Mail; + + return $this; + } +} diff --git a/src/Entity/Entreprise.php b/src/Entity/Entreprise.php new file mode 100644 index 0000000..2807a19 --- /dev/null +++ b/src/Entity/Entreprise.php @@ -0,0 +1,87 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getNom(): ?string + { + return $this->Nom; + } + + public function setNom(string $Nom): static + { + $this->Nom = $Nom; + + return $this; + } + + public function getAdresse(): ?string + { + return $this->Adresse; + } + + public function setAdresse(string $Adresse): static + { + $this->Adresse = $Adresse; + + return $this; + } + + public function getTel(): ?string + { + return $this->Tel; + } + + public function setTel(string $Tel): static + { + $this->Tel = $Tel; + + return $this; + } + + public function getMail(): ?string + { + return $this->Mail; + } + + public function setMail(string $Mail): static + { + $this->Mail = $Mail; + + return $this; + } +} diff --git a/src/Entity/Favoris.php b/src/Entity/Favoris.php new file mode 100644 index 0000000..be05f56 --- /dev/null +++ b/src/Entity/Favoris.php @@ -0,0 +1,52 @@ +id; + } + + public function getUser(): ?UserApp + { + return $this->user; + } + + public function setUser(?UserApp $user): static + { + $this->user = $user; + return $this; + } + + public function getAnnouncement(): ?Announcement + { + return $this->announcement; + } + + public function setAnnouncement(?Announcement $announcement): static + { + $this->announcement = $announcement; + return $this; + } +} diff --git a/src/Entity/Formulaire.php b/src/Entity/Formulaire.php new file mode 100644 index 0000000..7a8308b --- /dev/null +++ b/src/Entity/Formulaire.php @@ -0,0 +1,36 @@ +id; + } + + public function getDate(): ?\DateTimeInterface + { + return $this->Date; + } + + public function setDate(\DateTimeInterface $Date): static + { + $this->Date = $Date; + + return $this; + } +} diff --git a/src/Entity/Liste.php b/src/Entity/Liste.php new file mode 100644 index 0000000..eccf868 --- /dev/null +++ b/src/Entity/Liste.php @@ -0,0 +1,36 @@ +id; + } + + public function getDate(): ?\DateTimeInterface + { + return $this->Date; + } + + public function setDate(\DateTimeInterface $Date): static + { + $this->Date = $Date; + + return $this; + } +} diff --git a/src/Entity/Utilisateur.php b/src/Entity/Utilisateur.php new file mode 100644 index 0000000..705b358 --- /dev/null +++ b/src/Entity/Utilisateur.php @@ -0,0 +1,135 @@ +messages = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getNom(): ?string + { + return $this->Nom; + } + + public function setNom(string $Nom): static + { + $this->Nom = $Nom; + + return $this; + } + + public function getPrenom(): ?string + { + return $this->Prenom; + } + + public function setPrenom(string $Prenom): static + { + $this->Prenom = $Prenom; + + return $this; + } + + public function getTel(): ?string + { + return $this->Tel; + } + + public function setTel(string $Tel): static + { + $this->Tel = $Tel; + + return $this; + } + + public function getAdresse(): ?string + { + return $this->Adresse; + } + + public function setAdresse(string $Adresse): static + { + $this->Adresse = $Adresse; + + return $this; + } + + // Getter et setter pour la relation avec Message + /** + * @return Collection + */ + public function getMessages(): Collection + { + return $this->messages; + } + + public function addMessage(Message $message): static + { + if (!$this->messages->contains($message)) { + $this->messages[] = $message; + $message->setUtilisateur($this); + } + + return $this; + } + + public function removeMessage(Message $message): static + { + if ($this->messages->removeElement($message)) { + if ($message->getUtilisateur() === $this) { + $message->setUtilisateur(null); + } + } + + return $this; + } +} diff --git a/src/Entity/Verifie.php b/src/Entity/Verifie.php new file mode 100644 index 0000000..fa39d14 --- /dev/null +++ b/src/Entity/Verifie.php @@ -0,0 +1,42 @@ +id; + } + + public function setId(int $id): static + { + $this->id = $id; + + return $this; + } + + public function getLibelle(): ?string + { + return $this->Libelle; + } + + public function setLibelle(string $Libelle): static + { + $this->Libelle = $Libelle; + + return $this; + } +} diff --git a/src/Form/ResetPasswordRequestFormType.php b/src/Form/ResetPasswordRequestFormType.php new file mode 100644 index 0000000..b92b33e --- /dev/null +++ b/src/Form/ResetPasswordRequestFormType.php @@ -0,0 +1,25 @@ +add('email', EmailType::class) + ; + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + // Configure your form options here + ]); + } +} diff --git a/src/Repository/AnnonceRepository.php b/src/Repository/AnnonceRepository.php new file mode 100644 index 0000000..776c143 --- /dev/null +++ b/src/Repository/AnnonceRepository.php @@ -0,0 +1,43 @@ + + */ +class AnnonceRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Annonce::class); + } + +// /** +// * @return Annonce[] Returns an array of Annonce 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): ?Annonce +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/CompetenceRepository.php b/src/Repository/CompetenceRepository.php new file mode 100644 index 0000000..f4fbf89 --- /dev/null +++ b/src/Repository/CompetenceRepository.php @@ -0,0 +1,43 @@ + + */ +class CompetenceRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Competence::class); + } + +// /** +// * @return Competence[] Returns an array of Competence 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): ?Competence +// { +// return $this->createQueryBuilder('c') +// ->andWhere('c.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/DemandeurRepository.php b/src/Repository/DemandeurRepository.php new file mode 100644 index 0000000..6ef82d1 --- /dev/null +++ b/src/Repository/DemandeurRepository.php @@ -0,0 +1,43 @@ + + */ +class DemandeurRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Demandeur::class); + } + +// /** +// * @return Demandeur[] Returns an array of Demandeur objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('d') +// ->andWhere('d.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('d.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Demandeur +// { +// return $this->createQueryBuilder('d') +// ->andWhere('d.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/DiplomeRepository.php b/src/Repository/DiplomeRepository.php new file mode 100644 index 0000000..777400a --- /dev/null +++ b/src/Repository/DiplomeRepository.php @@ -0,0 +1,43 @@ + + */ +class DiplomeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Diplome::class); + } + +// /** +// * @return Diplome[] Returns an array of Diplome objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('d') +// ->andWhere('d.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('d.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Diplome +// { +// return $this->createQueryBuilder('d') +// ->andWhere('d.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/EmployeRepository.php b/src/Repository/EmployeRepository.php new file mode 100644 index 0000000..87ac38f --- /dev/null +++ b/src/Repository/EmployeRepository.php @@ -0,0 +1,43 @@ + + */ +class EmployeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Employe::class); + } + +// /** +// * @return Employe[] Returns an array of Employe 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): ?Employe +// { +// return $this->createQueryBuilder('e') +// ->andWhere('e.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/EntrepriseRepository.php b/src/Repository/EntrepriseRepository.php new file mode 100644 index 0000000..3d0e694 --- /dev/null +++ b/src/Repository/EntrepriseRepository.php @@ -0,0 +1,43 @@ + + */ +class EntrepriseRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Entreprise::class); + } + +// /** +// * @return Entreprise[] Returns an array of Entreprise 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): ?Entreprise +// { +// return $this->createQueryBuilder('e') +// ->andWhere('e.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/FavorisRepository.php b/src/Repository/FavorisRepository.php new file mode 100644 index 0000000..4b12a36 --- /dev/null +++ b/src/Repository/FavorisRepository.php @@ -0,0 +1,43 @@ + + */ +class FavorisRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Favoris::class); + } + +// /** +// * @return Favoris[] Returns an array of Favoris objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('f') +// ->andWhere('f.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('f.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Favoris +// { +// return $this->createQueryBuilder('f') +// ->andWhere('f.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/FormulaireRepository.php b/src/Repository/FormulaireRepository.php new file mode 100644 index 0000000..f27aa6a --- /dev/null +++ b/src/Repository/FormulaireRepository.php @@ -0,0 +1,43 @@ + + */ +class FormulaireRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Formulaire::class); + } + +// /** +// * @return Formulaire[] Returns an array of Formulaire objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('f') +// ->andWhere('f.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('f.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Formulaire +// { +// return $this->createQueryBuilder('f') +// ->andWhere('f.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/ListeRepository.php b/src/Repository/ListeRepository.php new file mode 100644 index 0000000..570b25f --- /dev/null +++ b/src/Repository/ListeRepository.php @@ -0,0 +1,43 @@ + + */ +class ListeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Liste::class); + } + +// /** +// * @return Liste[] Returns an array of Liste objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('l') +// ->andWhere('l.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('l.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Liste +// { +// return $this->createQueryBuilder('l') +// ->andWhere('l.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/UtilisateurRepository.php b/src/Repository/UtilisateurRepository.php new file mode 100644 index 0000000..df1e4c6 --- /dev/null +++ b/src/Repository/UtilisateurRepository.php @@ -0,0 +1,43 @@ + + */ +class UtilisateurRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Utilisateur::class); + } + +// /** +// * @return Utilisateur[] Returns an array of Utilisateur objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('u.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Utilisateur +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/VerifieRepository.php b/src/Repository/VerifieRepository.php new file mode 100644 index 0000000..c5384d7 --- /dev/null +++ b/src/Repository/VerifieRepository.php @@ -0,0 +1,43 @@ + + */ +class VerifieRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Verifie::class); + } + +// /** +// * @return Verifie[] Returns an array of Verifie objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('v') +// ->andWhere('v.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('v.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Verifie +// { +// return $this->createQueryBuilder('v') +// ->andWhere('v.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Security/UserAuthenticator.php b/src/Security/UserAuthenticator.php new file mode 100644 index 0000000..a8d7224 --- /dev/null +++ b/src/Security/UserAuthenticator.php @@ -0,0 +1,60 @@ +getPayload()->getString('nickname'); + + $request->getSession()->set(SecurityRequestAttributes::LAST_USERNAME, $nickname); + + return new Passport( + new UserBadge($nickname), + new PasswordCredentials($request->getPayload()->getString('password')), + [ + new CsrfTokenBadge('authenticate', $request->getPayload()->getString('_csrf_token')), + new RememberMeBadge(), + ] + ); + } + + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) { + return new RedirectResponse($targetPath); + } + + // For example: + return new RedirectResponse($this->urlGenerator->generate('index')); + //throw new \Exception('TODO: provide a valid redirect inside '.__FILE__); + } + + protected function getLoginUrl(Request $request): string + { + return $this->urlGenerator->generate(self::LOGIN_ROUTE); + } +} diff --git a/symfony.lock b/symfony.lock index cf1900f..fdb5abe 100644 --- a/symfony.lock +++ b/symfony.lock @@ -288,6 +288,9 @@ "config/packages/messenger.yaml" ] }, + "symfonycasts/sass-bundle": { + "version": "v0.7.0" + }, "twig/extra-bundle": { "version": "v3.13.0" } diff --git a/templates/announcement/index.html.twig b/templates/announcement/index.html.twig index 0920dd6..debc235 100644 --- a/templates/announcement/index.html.twig +++ b/templates/announcement/index.html.twig @@ -7,84 +7,66 @@

Liste des Annonces

{% if 'ROLE_ADMIN' in app.user.roles %} - -
- - -
+
+ + +
{% endif %} {% if 'ROLE_EMPLOYEE' in app.user.roles %} - -
- - Créer une annonce - -
+
+ + Créer une annonce + +
{% endif %} -
- - - + + +
{% for announcement in announcements %}
- -
+
{% if announcement.status == 'notVerified' %} Non validée {% else %} Validée {% endif %} + +
+ +
-

{{ announcement.title }}

- -

{{ announcement.company.name }}

-
- - Date du stage : {{ announcement.date }} + Date du stage : {{ announcement.date }}
- -
- - {{ announcement.company.address }} + {{ announcement.company.address }}
- - + Détails
@@ -94,4 +76,3 @@
{% endblock %} - diff --git a/templates/announcement/show.html.twig b/templates/announcement/show.html.twig index 260e57c..b4dff6a 100644 --- a/templates/announcement/show.html.twig +++ b/templates/announcement/show.html.twig @@ -80,6 +80,16 @@ {% endif %} + +
+ +
diff --git a/templates/broadcast/FAQ.stream.html.twig b/templates/broadcast/FAQ.stream.html.twig new file mode 100644 index 0000000..988ccf4 --- /dev/null +++ b/templates/broadcast/FAQ.stream.html.twig @@ -0,0 +1,22 @@ +{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #} +{% block create %} + + + +{% endblock %} + +{% block update %} + + + +{% endblock %} + +{% block remove %} + +{% endblock %} diff --git a/templates/degree/index.html.twig b/templates/degree/index.html.twig index 93b9be5..0b309fd 100644 --- a/templates/degree/index.html.twig +++ b/templates/degree/index.html.twig @@ -35,21 +35,19 @@ {% endif %} {% if 'ROLE_ADMIN' in app.user.roles %} - - - Modifier - + + + Modifier + - -
- - - -
+ +
+ + + +
{% endif %} diff --git a/templates/intern/index.html.twig b/templates/intern/index.html.twig index 02c128a..29708b1 100644 --- a/templates/intern/index.html.twig +++ b/templates/intern/index.html.twig @@ -48,4 +48,18 @@ {% endfor %} +

Vos compétences :

+ + + Sélectionner vos compétences + {% endblock %} diff --git a/templates/profile/intern.html.twig b/templates/profile/intern.html.twig index fbfef2b..2447be0 100644 --- a/templates/profile/intern.html.twig +++ b/templates/profile/intern.html.twig @@ -26,13 +26,21 @@

Vos compétences :


Selectionner vos compétences + href="{{ path('app_skill_index',{id: app.user.id}) }}"> Sélectionner vos compétences +
Accéder aux favoris diff --git a/templates/security/reset_password_request.html.twig b/templates/security/reset_password_request.html.twig new file mode 100644 index 0000000..baba306 --- /dev/null +++ b/templates/security/reset_password_request.html.twig @@ -0,0 +1,14 @@ +{% extends 'base.html.twig' %} + +{% block title %}Demande de réinitialisation de mot de passe{% endblock %} + +{% block body %} +
+

Demande de réinitialisation de mot de passe

+ {{ form_start(requestPassForm) }} + {{ form_row(requestPassForm.email) }} + + + {{ form_end(requestPassForm) }} +
+{% endblock %} diff --git a/templates/skill/index.html.twig b/templates/skill/index.html.twig index e5e911f..0b31564 100644 --- a/templates/skill/index.html.twig +++ b/templates/skill/index.html.twig @@ -6,47 +6,70 @@
+ + {% if 'ROLE_INTERN' in app.user.roles %} +
+ +
+ + {% endif %} + + {% if 'ROLE_ADMIN' in app.user.roles %} + + {% endif %}
{% endblock %}