Compare commits
13 Commits
feature/Gi
...
master
Author | SHA1 | Date | |
---|---|---|---|
0d6b65ef20 | |||
![]() |
fc8387808f | ||
d1df840ae2 | |||
56809b3fbc | |||
997b20fddb | |||
75e47bacc0 | |||
![]() |
a14a4ba64e | ||
![]() |
21ff384396 | ||
1d03855c8a | |||
dc0a7e915a | |||
a79caf705d | |||
cb7f8bb772 | |||
225b58a0c9 |
2
.idea/HegreEtConfort.iml
generated
2
.idea/HegreEtConfort.iml
generated
@ -3,7 +3,6 @@
|
|||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="App\Tests\" />
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="App\Tests\" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
||||||
@ -135,6 +134,7 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/extra-bundle" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/extra-bundle" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php84" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
4
.idea/dataSources.xml
generated
4
.idea/dataSources.xml
generated
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
<data-source source="LOCAL" name="HegreEtConfort@172.20.96.1" uuid="21423ae4-3232-4641-affb-06399f70655a">
|
<data-source source="LOCAL" name="hegreetconfort@localhost" uuid="21423ae4-3232-4641-affb-06399f70655a">
|
||||||
<driver-ref>postgresql</driver-ref>
|
<driver-ref>postgresql</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:postgresql://172.20.96.1:5432/HegreEtConfort</jdbc-url>
|
<jdbc-url>jdbc:postgresql://localhost:5432/hegreetconfort</jdbc-url>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
</component>
|
</component>
|
||||||
|
1
.idea/php.xml
generated
1
.idea/php.xml
generated
@ -142,6 +142,7 @@
|
|||||||
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
|
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
|
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
|
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php84" />
|
||||||
</include_path>
|
</include_path>
|
||||||
</component>
|
</component>
|
||||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
body {
|
body {
|
||||||
background: url("../image/fond.png") center center / cover no-repeat !important;
|
background: url("../image/fond.png") center center / cover no-repeat !important;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
4
assets/vendor/@hotwired/turbo/turbo.index.js
vendored
4
assets/vendor/@hotwired/turbo/turbo.index.js
vendored
@ -1,5 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
|
<<<<<<< HEAD
|
||||||
|
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
|
||||||
|
=======
|
||||||
* Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
|
* Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
|
||||||
|
>>>>>>> b29391d6550c182d7b75efab8795a238c1936a27
|
||||||
* Original file: /npm/@hotwired/turbo@7.3.0/dist/turbo.es2017-esm.js
|
* Original file: /npm/@hotwired/turbo@7.3.0/dist/turbo.es2017-esm.js
|
||||||
*
|
*
|
||||||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
1345
composer.lock
generated
1345
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -10,25 +10,19 @@ security:
|
|||||||
class: App\Entity\Utilisateur
|
class: App\Entity\Utilisateur
|
||||||
property: email
|
property: email
|
||||||
firewalls:
|
firewalls:
|
||||||
dev:
|
|
||||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
|
||||||
security: false
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
lazy: true
|
lazy: true
|
||||||
provider: app_user_provider
|
provider: app_user_provider
|
||||||
|
|
||||||
form_login:
|
form_login:
|
||||||
login_path: app_login
|
login_path: app_login
|
||||||
check_path: app_login
|
check_path: app_login
|
||||||
|
success_handler: App\Security\CustomAuthenticationSuccessHandler
|
||||||
enable_csrf: true
|
enable_csrf: true
|
||||||
csrf_token_id: authenticate
|
csrf_token_id: authenticate
|
||||||
|
|
||||||
logout:
|
logout:
|
||||||
path: app_logout
|
path: app_logout
|
||||||
target: app_login
|
target: app_login
|
||||||
|
|
||||||
|
|
||||||
# activate different ways to authenticate
|
# activate different ways to authenticate
|
||||||
# https://symfony.com/doc/current/security.html#the-firewall
|
# https://symfony.com/doc/current/security.html#the-firewall
|
||||||
|
|
||||||
@ -39,7 +33,8 @@ security:
|
|||||||
# Note: Only the *first* access control that matches will be used
|
# Note: Only the *first* access control that matches will be used
|
||||||
access_control:
|
access_control:
|
||||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
- { path: ^/admin, roles: ROLE_ADMIN }
|
||||||
- { path: ^/profile, roles: ROLE_USER }
|
- { path: ^/secretaire, roles: ROLE_SECRETAIRE }
|
||||||
|
- { path: ^/chauffagiste, roles: ROLE_CHAUFFAGISTE }
|
||||||
|
|
||||||
when@test:
|
when@test:
|
||||||
security:
|
security:
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20250410150126 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql('CREATE SEQUENCE fault_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE SEQUENCE intervention_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE SEQUENCE stock_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE SEQUENCE utilisateur_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE SEQUENCE vehicle_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE TABLE fault (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE TABLE intervention (id INT NOT NULL, wording VARCHAR(255) NOT NULL, timestamp TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, description VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE TABLE skill (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE TABLE stock (id INT NOT NULL, wording VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, quantity VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE TABLE utilisateur (id INT NOT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, birth_date DATE NOT NULL, phone VARCHAR(255) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON utilisateur (email)');
|
|
||||||
$this->addSql('CREATE TABLE vehicle (id INT NOT NULL, license_plate VARCHAR(255) NOT NULL, brand VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
|
||||||
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
|
|
||||||
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
|
|
||||||
$this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\'');
|
|
||||||
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
|
|
||||||
BEGIN
|
|
||||||
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
|
|
||||||
RETURN NEW;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;');
|
|
||||||
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
|
|
||||||
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
|
|
||||||
}
|
|
||||||
|
|
||||||
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('DROP SEQUENCE fault_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP SEQUENCE intervention_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP SEQUENCE skill_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP SEQUENCE stock_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP SEQUENCE utilisateur_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP SEQUENCE vehicle_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP TABLE fault');
|
|
||||||
$this->addSql('DROP TABLE intervention');
|
|
||||||
$this->addSql('DROP TABLE skill');
|
|
||||||
$this->addSql('DROP TABLE stock');
|
|
||||||
$this->addSql('DROP TABLE utilisateur');
|
|
||||||
$this->addSql('DROP TABLE vehicle');
|
|
||||||
$this->addSql('DROP TABLE messenger_messages');
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,13 +6,42 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
#[Route('/calendrier')]
|
||||||
class CalendrierController extends AbstractController
|
class CalendrierController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/calendrier', name: 'app_calendrier')]
|
#[Route(name: 'app_calendrier_index', methods: ['GET'])]
|
||||||
public function index(): Response
|
public function index(): Response
|
||||||
{
|
{
|
||||||
return $this->render('calendrier/index.html.twig', [
|
return $this->render('calendrier/index.html.twig', [
|
||||||
'controller_name' => 'CalendrierController',
|
'controller_name' => 'CalendrierController',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/secretaire', name: 'app_calendrier_indexSecretaire')]
|
||||||
|
public function indexSecretaire(): Response
|
||||||
|
{
|
||||||
|
return $this->render('calendrier/indexSecretaire.html.twig', [
|
||||||
|
'controller_name' => 'CalendrierController',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/chauffagiste', name: 'app_calendrier_indexChauffagiste')]
|
||||||
|
public function indexChauffagiste(): Response
|
||||||
|
{
|
||||||
|
return $this->render('calendrier/indexChauffagiste.html.twig', [
|
||||||
|
'controller_name' => 'CalendrierController',
|
||||||
|
]); }
|
||||||
|
|
||||||
|
// créer intervention : secretaire + admin
|
||||||
|
// créer un nouveau rdv
|
||||||
|
// modifier un rdv
|
||||||
|
// supprimer un rdv
|
||||||
|
// choisir un chauffagiste
|
||||||
|
// deconnexion
|
||||||
|
|
||||||
|
// créer intervention : chauffagiste
|
||||||
|
// modifier un rdv
|
||||||
|
// deconnexion
|
||||||
|
|
||||||
|
// quand on créer une rdv, alors cela nous redirige vers la page intervention
|
||||||
}
|
}
|
||||||
|
29
src/Controller/DashboardController.php
Normal file
29
src/Controller/DashboardController.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
class DashboardController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/admin/dashboard', name: 'admin_dashboard')]
|
||||||
|
public function admin(): Response
|
||||||
|
{
|
||||||
|
return $this->render('dashboard/admin.html.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/secretaire/dashboard', name: 'secretaire_dashboard')]
|
||||||
|
public function secretaire(): Response
|
||||||
|
{
|
||||||
|
return $this->render('dashboard/secretaire.html.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/chauffagiste/dashboard', name: 'chauffagiste_dashboard')]
|
||||||
|
public function chauffagiste(): Response
|
||||||
|
{
|
||||||
|
return $this->render('dashboard/chauffagiste.html.twig');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ final class FaultController extends AbstractController
|
|||||||
#[Route(name: 'app_fault_index', methods: ['GET'])]
|
#[Route(name: 'app_fault_index', methods: ['GET'])]
|
||||||
public function index(FaultRepository $faultRepository): Response
|
public function index(FaultRepository $faultRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render('fault/index.html.twig', [
|
return $this->render('fault/admin.html.twig', [
|
||||||
'faults' => $faultRepository->findAll(),
|
'faults' => $faultRepository->findAll(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ final class SkillController extends AbstractController
|
|||||||
#[Route(name: 'app_skill_index', methods: ['GET'])]
|
#[Route(name: 'app_skill_index', methods: ['GET'])]
|
||||||
public function index(SkillRepository $skillRepository): Response
|
public function index(SkillRepository $skillRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render('skill/index.html.twig', [
|
return $this->render('skill/admin.html.twig', [
|
||||||
'skills' => $skillRepository->findAll(),
|
'skills' => $skillRepository->findAll(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ final class StockController extends AbstractController
|
|||||||
#[Route(name: 'app_stock_index', methods: ['GET'])]
|
#[Route(name: 'app_stock_index', methods: ['GET'])]
|
||||||
public function index(StockRepository $stockRepository): Response
|
public function index(StockRepository $stockRepository): Response
|
||||||
{
|
{
|
||||||
return $this->render('stock/index.html.twig', [
|
return $this->render('stock/admin.html.twig', [
|
||||||
'stocks' => $stockRepository->findAll(),
|
'stocks' => $stockRepository->findAll(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
#[Route('/user')]
|
#[Route('/user')]
|
||||||
@ -23,13 +24,18 @@ final class UserController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]
|
#[Route('/new', name: 'app_user_new', methods: ['GET', 'POST'])]
|
||||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
public function new(Request $request, EntityManagerInterface $entityManager, UserPasswordHasherInterface $passwordHasher): Response
|
||||||
{
|
{
|
||||||
$user = new Utilisateur();
|
$user = new Utilisateur();
|
||||||
$form = $this->createForm(UserType::class, $user);
|
$form = $this->createForm(UserType::class, $user);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
// Hash du mot de passe
|
||||||
|
$plainPassword = $form->get('plainPassword')->getData();
|
||||||
|
$hashedPassword = $passwordHasher->hashPassword($user, $plainPassword);
|
||||||
|
$user->setPassword($hashedPassword);
|
||||||
|
|
||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
|
@ -31,6 +31,19 @@ class Utilisateur implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
private ?string $Phone = null;
|
private ?string $Phone = null;
|
||||||
|
|
||||||
|
private ?string $plainPassword = null;
|
||||||
|
|
||||||
|
public function getPlainPassword(): ?string
|
||||||
|
{
|
||||||
|
return $this->plainPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPlainPassword(?string $plainPassword): void
|
||||||
|
{
|
||||||
|
$this->plainPassword = $plainPassword;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var list<string> The user roles
|
* @var list<string> The user roles
|
||||||
*/
|
*/
|
||||||
@ -179,6 +192,6 @@ class Utilisateur implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
public function eraseCredentials(): void
|
public function eraseCredentials(): void
|
||||||
{
|
{
|
||||||
// If you store any temporary, sensitive data on the user, clear it here
|
// If you store any temporary, sensitive data on the user, clear it here
|
||||||
// $this->plainPassword = null;
|
$this->plainPassword = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use App\Entity\Utilisateur;
|
|||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
@ -23,10 +24,17 @@ class UserType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('Phone', TextType::class)
|
->add('Phone', TextType::class)
|
||||||
->add('roles', ChoiceType::class, [
|
->add('roles', ChoiceType::class, [
|
||||||
|
'choices' => [
|
||||||
|
'Secretaire' => 'ROLE_SECRETAIRE',
|
||||||
|
'Chauffagiste' => 'ROLE_CHAUFFAGISTE',
|
||||||
|
],
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
])
|
])
|
||||||
->add('password', TextType::class)
|
->add('plainPassword', PasswordType::class, [
|
||||||
;
|
'mapped' => false,
|
||||||
|
'required' => true,
|
||||||
|
'label' => 'Mot de passe',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
@ -15,6 +15,7 @@ class VehicleType extends AbstractType
|
|||||||
$builder
|
$builder
|
||||||
->add('LicensePlate', TextType::class)
|
->add('LicensePlate', TextType::class)
|
||||||
->add('Brand', TextType::class)
|
->add('Brand', TextType::class)
|
||||||
|
->add('Model', TextType::class)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
src/Security/CustomAuthenticationSuccessHandler.php
Normal file
32
src/Security/CustomAuthenticationSuccessHandler.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Security;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
|
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
|
||||||
|
|
||||||
|
class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface
|
||||||
|
{
|
||||||
|
private RouterInterface $router;
|
||||||
|
|
||||||
|
public function __construct(RouterInterface $router)
|
||||||
|
{
|
||||||
|
$this->router = $router;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onAuthenticationSuccess(Request $request, TokenInterface $token): RedirectResponse
|
||||||
|
{
|
||||||
|
$user = $token->getUser();
|
||||||
|
$roles = $user->getRoles();
|
||||||
|
|
||||||
|
return match (true) {
|
||||||
|
in_array('ROLE_ADMIN', $roles) => new RedirectResponse($this->router->generate('admin_dashboard')),
|
||||||
|
in_array('ROLE_SECRETAIRE', $roles) => new RedirectResponse($this->router->generate('secretaire_dashboard')),
|
||||||
|
in_array('ROLE_CHAUFFAGISTE', $roles) => new RedirectResponse($this->router->generate('chauffagiste_dashboard')),
|
||||||
|
default => new RedirectResponse($this->router->generate('_login')),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -2,16 +2,53 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
<title>{% block title %}Mon App Symfony{% 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>">
|
{% block stylesheets %}{% endblock %}
|
||||||
{% block stylesheets %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
|
||||||
{% endblock %}
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block body %}{% endblock %}
|
|
||||||
|
{% if app.user %}
|
||||||
|
<div class="user-info">
|
||||||
|
Connecté en tant que {{ app.user.email }} |
|
||||||
|
Rôles :
|
||||||
|
{% for role in app.user.roles %}
|
||||||
|
{{ role }}{% if not loop.last %}, {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
|
<li><a href="{{ path('admin_dashboard') }}">Dashboard Admin</a></li>
|
||||||
|
<li><a href="{{ path('app_user_index') }}">Gérer un utilisateur</a></li>
|
||||||
|
<li><a href="{{ path('app_calendrier_index') }}">Tous les plannings</a></li>
|
||||||
|
<li><a href="{{ path('app_stock_index') }}">Gérer les stocks</a></li>
|
||||||
|
<li><a href="{{ path('app_vehicle_index') }}">Gérer les véhicules</a></li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_granted('ROLE_SECRETAIRE') %}
|
||||||
|
<li><a href="{{ path('secretaire_dashboard') }}">Dashboard Secrétaire</a></li>
|
||||||
|
<li><a href="{{ path('app_user_index') }}">Créer un chauffagiste</a></li>
|
||||||
|
<li><a href="{{ path('app_calendrier_indexSecretaire') }}">Plannings chauffagistes</a></li>
|
||||||
|
<li><a href="{{ path('app_stock_index') }}">Gérer les stocks</a></li>
|
||||||
|
<li><a href="{{ path('app_vehicle_index') }}">Gérer les véhicules</a></li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if is_granted('ROLE_CHAUFFAGISTE') %}
|
||||||
|
<li><a href="{{ path('chauffagiste_dashboard') }}">Dashboard Chauffagiste</a></li>
|
||||||
|
<li><a href="{{ path('app_calendrier_indexChauffagiste') }}">Mon planning</a></li>
|
||||||
|
<li><a href="{{ path('app_intervention_index') }}">Mes interventions</a></li>
|
||||||
|
<li><a href="{{ path('app_stock_index') }}">Pièces détachées</a></li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<li><a href="{{ path('app_logout') }}">Déconnexion</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% block javascripts %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
7
templates/dashboard/admin.html.twig
Normal file
7
templates/dashboard/admin.html.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Bienvenue Admin</h1>
|
||||||
|
<p>Tu as tous les droits ici !</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
7
templates/dashboard/chauffagiste.html.twig
Normal file
7
templates/dashboard/chauffagiste.html.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Bienvenue chauffagiste</h1>
|
||||||
|
<p>Vas travailler</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
7
templates/dashboard/secretaire.html.twig
Normal file
7
templates/dashboard/secretaire.html.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<h1>Bienvenue Secretaire</h1>
|
||||||
|
<p>Fais ce que tu veux</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
<img class="logoProfile" src="{{ asset('styles/image/profile.png') }}" alt="Logo Profil">
|
<img class="logoProfile" src="{{ asset('styles/image/profile.png') }}" alt="Logo Profil">
|
||||||
<img class="logoPassword" src="{{ asset('styles/image/password.png') }}" alt="Logo Password">
|
<img class="logoPassword" src="{{ asset('styles/image/password.png') }}" alt="Logo Password">
|
||||||
<form method="post">
|
|
||||||
|
<form method="post" action="{{ path('app_login') }}">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user