Compare commits
9 Commits
5c303bf412
...
27195a780a
Author | SHA1 | Date | |
---|---|---|---|
27195a780a | |||
2903005bcc | |||
f8ecfcc07d | |||
958070bd54 | |||
0861ed2112 | |||
120906c0c5 | |||
911f3a24cc | |||
0a85c0854b | |||
30f58aca76 |
@ -5,6 +5,7 @@
|
|||||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||||
parameters:
|
parameters:
|
||||||
app.jwtsecret : '%env(JWT_SECRET)%'
|
app.jwtsecret : '%env(JWT_SECRET)%'
|
||||||
|
cv_directory: '%kernel.project_dir%/public/cv'
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
_defaults:
|
_defaults:
|
||||||
|
@ -19,9 +19,12 @@ use App\Repository\InternSkillRepository;
|
|||||||
use App\Repository\SkillRepository;
|
use App\Repository\SkillRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use Symfony\Component\Validator\Constraints\File;
|
||||||
|
|
||||||
#[Route('/intern')]
|
#[Route('/intern')]
|
||||||
final class InternController extends AbstractController
|
final class InternController extends AbstractController
|
||||||
@ -70,6 +73,63 @@ final class InternController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/{id}/resume', name: 'app_intern_resume', methods: ['GET', 'POST'])]
|
||||||
|
public function addResume(Request $request, Intern $intern, EntityManagerInterface $entityManager, #[Autowire('%cv_directory%')] string $cvDirectory): Response
|
||||||
|
{
|
||||||
|
// Création d'un formulaire spécifique pour le CV plutôt que d'utiliser InternType entier
|
||||||
|
$form = $this->createFormBuilder($intern)
|
||||||
|
->add('resume', FileType::class, [
|
||||||
|
'label' => 'CV : ',
|
||||||
|
'mapped' => false, // Ne pas lier directement à l'entité
|
||||||
|
'constraints' => [
|
||||||
|
new File([
|
||||||
|
'maxSize' => '1024k',
|
||||||
|
'mimeTypes' => [
|
||||||
|
'application/pdf',
|
||||||
|
'application/x-pdf',
|
||||||
|
],
|
||||||
|
'mimeTypesMessage' => 'Merci de bien vouloir envoyer un fichier PDF valide.',
|
||||||
|
])
|
||||||
|
],
|
||||||
|
])
|
||||||
|
->getForm();
|
||||||
|
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$cvFile = $form->get('resume')->getData();
|
||||||
|
|
||||||
|
if ($cvFile) {
|
||||||
|
// Génération d'un nom de fichier unique
|
||||||
|
$newFilename = $intern->getId().'_'.date("d-m-Y").'_'.random_int(0,99999999).'.pdf';
|
||||||
|
|
||||||
|
// Déplacement vers le répertoire de stockage
|
||||||
|
$cvFile->move(
|
||||||
|
$cvDirectory,
|
||||||
|
$newFilename
|
||||||
|
);
|
||||||
|
|
||||||
|
if($intern->getResume() !== null){
|
||||||
|
unlink($cvDirectory.'/'.$intern->getResume());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mise à jour de l'entité avec le nom du fichier
|
||||||
|
$intern->setResume($newFilename);
|
||||||
|
$intern->setResumeName($cvFile->getClientOriginalName()); // Conserver le nom original du fichier
|
||||||
|
}
|
||||||
|
|
||||||
|
$entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('app_profile', [], Response::HTTP_SEE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('intern/resume.html.twig', [
|
||||||
|
'intern' => $intern,
|
||||||
|
'form' => $form->createView(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[Route('/{id}', name: 'app_intern_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_intern_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, Intern $intern,): Response
|
public function delete(Request $request, Intern $intern,): Response
|
||||||
{
|
{
|
||||||
|
@ -25,8 +25,10 @@ class ProfileController extends AbstractController
|
|||||||
#[Route('/profile', name: 'app_profile')]
|
#[Route('/profile', name: 'app_profile')]
|
||||||
public function profile(): Response
|
public function profile(): Response
|
||||||
{
|
{
|
||||||
|
// Charger l'utilisateur connecté
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
|
// Vérifiez les rôles si nécessaire
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
throw $this->createAccessDeniedException('Vous devez être connecté pour accéder à cette page.');
|
throw $this->createAccessDeniedException('Vous devez être connecté pour accéder à cette page.');
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,15 @@ use App\Entity\Company;
|
|||||||
class Intern extends UserApp
|
class Intern extends UserApp
|
||||||
{
|
{
|
||||||
|
|
||||||
#[ORM\Column(type: Types::TEXT,nullable: true)]
|
#[ORM\Column(type: Types::TEXT, length: 255, nullable: true)]
|
||||||
private ?string $coverLetter = null;
|
private ?string $coverLetter = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255,nullable: true)]
|
#[ORM\Column(type: Types::TEXT, length: 255, nullable: true)]
|
||||||
private ?string $resume = null;
|
private ?string $resume = null;
|
||||||
|
|
||||||
|
#[ORM\Column(type: Types::TEXT, length: 255, nullable: true)]
|
||||||
|
private ?string $resumeName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, InternDegree>
|
* @var Collection<int, InternDegree>
|
||||||
*/
|
*/
|
||||||
@ -75,6 +78,18 @@ class Intern extends UserApp
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getResumeName(): ?string
|
||||||
|
{
|
||||||
|
return $this->resumeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setResumeName(string $resumeName): static
|
||||||
|
{
|
||||||
|
$this->resumeName = $resumeName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, InternDegree>
|
* @return Collection<int, InternDegree>
|
||||||
*/
|
*/
|
||||||
|
@ -4,8 +4,11 @@ namespace App\Form;
|
|||||||
|
|
||||||
use App\Entity\Intern;
|
use App\Entity\Intern;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Validator\Constraints\File;
|
||||||
|
|
||||||
class InternType extends AbstractType
|
class InternType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -20,7 +23,9 @@ class InternType extends AbstractType
|
|||||||
->add('tel')
|
->add('tel')
|
||||||
->add('address')
|
->add('address')
|
||||||
->add('mail')
|
->add('mail')
|
||||||
->add('coverLetter')
|
->add('coverLetter', TextareaType::class, [
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
->add('resume')
|
->add('resume')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -56,23 +56,11 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if 'ROLE_INTERN' in app.user.roles %}
|
|
||||||
<div class="mt-4">
|
|
||||||
<button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded-full">
|
|
||||||
<i class="fas fa-check-circle"></i> Valider la sélection
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if 'ROLE_ADMIN' in app.user.roles %}
|
|
||||||
<!-- Lien pour ajouter un nouveau diplôme -->
|
<!-- Lien pour ajouter un nouveau diplôme -->
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<a href="{{ path('app_degree_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4
|
<a href="{{ path('app_degree_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
|
||||||
rounded-full">
|
|
||||||
<i class="fas fa-plus-circle"></i> Ajouter un nouveau diplôme
|
<i class="fas fa-plus-circle"></i> Ajouter un nouveau diplôme
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,55 +1,25 @@
|
|||||||
{% extends 'base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block title %}Liste des FAQs{% endblock %}
|
{% block title %}FAQ{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container mx-auto p-6">
|
<div class="container mx-auto p-6">
|
||||||
<h1 class="text-3xl font-bold mb-4">Liste des FAQs</h1>
|
<h1 class="text-3xl font-bold mb-4">FAQ</h1>
|
||||||
|
|
||||||
<div class="overflow-x-auto bg-white shadow-lg rounded-lg">
|
<div class="flex flex-col gap-4">
|
||||||
<table class="min-w-full table-auto">
|
{% for faq in faqs %}
|
||||||
<thead>
|
<div>
|
||||||
<tr class="bg-gray-800 text-white">
|
<h2 class="font-bold text-4xl">Question : {{ faq.question }}</h2>
|
||||||
<th class="px-4 py-2 text-left">Question</th>
|
<p class="italic text-gray-700">Dernière modification : {{ faq.updateDate|date("d-m-y") }}</p>
|
||||||
<th class="px-4 py-2 text-left">Réponse</th>
|
<p class="text-2xl ml-10">Réponse : {{ faq.answer }}</p>
|
||||||
<th class="px-4 py-2 text-left">Denrnière modif</th>
|
</div>
|
||||||
<th class="px-4 py-2 text-left">Actions</th>
|
<hr class="border-black"/>
|
||||||
</tr>
|
{% endfor %}
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for faq in faqs %}
|
|
||||||
<tr class="border-b">
|
|
||||||
<td class="px-4 py-2">{{ faq.question }}</td>
|
|
||||||
<td class="px-4 py-2">{{ faq.answer }}</td>
|
|
||||||
<td class="px-4 py-2">{{ faq.updateDate|date("d-m-y") }}</td>
|
|
||||||
<td class="px-4 py-2">
|
|
||||||
<a href="{{ path('app_faq_show', {'id': faq.id}) }}" class="text-teal-500 hover:text-teal-700 mr-3">
|
|
||||||
<i class="fas fa-eye"></i> Voir
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="{{ path('app_faq_edit', {'id': faq.id}) }}" class="text-yellow-500 hover:text-yellow-700 mr-3">
|
|
||||||
<i class="fas fa-edit"></i> Modifier
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<form method="post" action="{{ path('app_faq_delete', {'id': faq.id}) }}" style="display:inline;">
|
|
||||||
<input type="hidden" name="_method" value="DELETE">
|
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ faq.id) }}">
|
|
||||||
<button type="submit" class="text-red-500 hover:text-red-700">
|
|
||||||
<i class="fas fa-trash-alt"></i> Supprimer
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<a href="{{ path('app_faq_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
|
<a href="{{ path('app_faq_new') }}" class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full">
|
||||||
<i class="fas fa-plus-circle"></i> Ajouter une FAQ
|
<i class="fas fa-plus-circle"></i> Ajouter une FAQ / Poser une question
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
23
templates/intern/resume.html.twig
Normal file
23
templates/intern/resume.html.twig
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}Resume{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="container mx-auto p-6">
|
||||||
|
<h1 class="text-4xl font-semibold text-gray-800 mb-6">Ajouter / Modifier le CV</h1>
|
||||||
|
|
||||||
|
<div class="bg-white shadow-md rounded-lg p-6">
|
||||||
|
{{ form_start(form, {'attr': {'enctype': 'multipart/form-data'}}) }}
|
||||||
|
|
||||||
|
<div class="mt-6">
|
||||||
|
{{ form_widget(form) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="bg-teal-500 hover:bg-teal-600 text-white px-6 py-3 rounded-lg mt-4">
|
||||||
|
Enregistrer
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -2,11 +2,30 @@
|
|||||||
<h2 class="text-xl font-semibold mb-4">Bonjour {{ app.user.nickname }}</h2>
|
<h2 class="text-xl font-semibold mb-4">Bonjour {{ app.user.nickname }}</h2>
|
||||||
<p class="text-gray-700">Vous êtes à la recherche d'un stage.</p>
|
<p class="text-gray-700">Vous êtes à la recherche d'un stage.</p>
|
||||||
<br>
|
<br>
|
||||||
<p class="text-gray-600">Nom : {{ app.user.firstName }}</p>
|
|
||||||
<p class="text-gray-600">Prénom : {{ app.user.lastName }}</p>
|
<div class="flex flex-col gap-5">
|
||||||
<p class="text-gray-600">Adresse : {{ app.user.address }}</p>
|
<p class="text-gray-600">Nom : {{ app.user.firstName }}</p>
|
||||||
<p class="text-gray-600">Téléphone : {{ app.user.tel }}</p>
|
<p class="text-gray-600">Prénom : {{ app.user.lastName }}</p>
|
||||||
<p class="text-gray-600">Email : {{ app.user.mail }}</p>
|
<p class="text-gray-600">Adresse : {{ app.user.address }}</p>
|
||||||
|
<p class="text-gray-600">Téléphone : {{ app.user.tel }}</p>
|
||||||
|
<p class="text-gray-600">Email : {{ app.user.mail }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if app.user.resume != "" %}
|
||||||
|
<div class="flex justify-around">
|
||||||
|
<div>
|
||||||
|
<iframe height="575px" width="400px" src={{ 'cv/' ~ app.user.resume }}></iframe>
|
||||||
|
{% if app.user.resumeName != "" %}
|
||||||
|
<p class="text-gray-600 italic">Nom du fichier : {{ app.user.resumeName }}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full"
|
||||||
|
href="{{ path('app_intern_resume',{id: app.user.id}) }}"> Ajouter / Modifier le CV
|
||||||
|
</a>
|
||||||
|
|
||||||
<h3 class="text-lg font-semibold mt-6">Vos diplômes :</h3>
|
<h3 class="text-lg font-semibold mt-6">Vos diplômes :</h3>
|
||||||
<ul class="list-disc list-inside text-gray-800">
|
<ul class="list-disc list-inside text-gray-800">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user