Ajout des notification + page employé (#6)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié

Reviewed-on: #6
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #6.
This commit is contained in:
2026-03-10 12:35:17 +00:00
committed by Autin
parent ae42c70d50
commit f493ea237b
126 changed files with 9215 additions and 935 deletions

View File

@@ -0,0 +1,97 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Absence;
use App\Entity\AbsenceType;
use App\Entity\Employee;
use App\Enum\HalfDay;
use DateTime;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
final class AbsenceFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
$this->createAbsence(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_STANDARD, Employee::class),
$this->getReference(FixtureReferences::ABSENCE_TYPE_CONGE, AbsenceType::class),
'2026-03-03',
HalfDay::AM,
'2026-03-03',
HalfDay::PM,
'CP standard non forfait'
);
$this->createAbsence(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_4H, Employee::class),
$this->getReference(FixtureReferences::ABSENCE_TYPE_CONGE, AbsenceType::class),
'2026-03-04',
HalfDay::AM,
'2026-03-04',
HalfDay::PM,
'CP employe 4h'
);
$this->createAbsence(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_FORFAIT, Employee::class),
$this->getReference(FixtureReferences::ABSENCE_TYPE_AUTRE, AbsenceType::class),
'2026-03-05',
HalfDay::AM,
'2026-03-05',
HalfDay::AM,
'Absence forfait demi-journee'
);
$this->createAbsence(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_INTERIM, Employee::class),
$this->getReference(FixtureReferences::ABSENCE_TYPE_ABSENT, AbsenceType::class),
'2026-03-06',
HalfDay::AM,
'2026-03-06',
HalfDay::PM,
'Absence interim'
);
$manager->flush();
}
public function getDependencies(): array
{
return [
EmployeeFixtures::class,
AbsenceTypeFixtures::class,
];
}
private function createAbsence(
ObjectManager $manager,
Employee $employee,
AbsenceType $type,
string $startDate,
HalfDay $startHalf,
string $endDate,
HalfDay $endHalf,
string $comment
): void {
$absence = new Absence()
->setEmployee($employee)
->setType($type)
->setStartDate(new DateTime($startDate))
->setStartHalf($startHalf)
->setEndDate(new DateTime($endDate))
->setEndHalf($endHalf)
->setComment($comment)
;
$manager->persist($absence);
}
}

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\AbsenceType;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
final class AbsenceTypeFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$definitions = [
[FixtureReferences::ABSENCE_TYPE_RTT, 'R', 'RTT', '#feba01', false],
[FixtureReferences::ABSENCE_TYPE_CONGE, 'C', 'CONGÉ', '#008000', true],
[FixtureReferences::ABSENCE_TYPE_MALADIE, 'M', 'MALADIE', '#ed07da', true],
[FixtureReferences::ABSENCE_TYPE_AT, 'AT', 'ACCIDENT DE TRAVAIL', '#e41111', true],
[FixtureReferences::ABSENCE_TYPE_FORMATION, 'F', 'FORMATION', '#6c72e0', true],
[FixtureReferences::ABSENCE_TYPE_EXCEPTIONNEL, 'EX', 'CONGE EXCEPTIONNEL', '#8834ae', true],
[FixtureReferences::ABSENCE_TYPE_ABSENT, 'ABS', 'ABSENT', '#823a21', false],
[FixtureReferences::ABSENCE_TYPE_AUTRE, 'AUT', 'AUTRE', '#f07d60', true],
];
foreach ($definitions as [$reference, $code, $label, $color, $countAsWorkedHours]) {
$absenceType = new AbsenceType()
->setCode($code)
->setLabel($label)
->setColor($color)
->setCountAsWorkedHours($countAsWorkedHours)
;
$manager->persist($absenceType);
$this->addReference($reference, $absenceType);
}
$manager->flush();
}
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Contract;
use App\Enum\TrackingMode;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
final class ContractFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$contract35 = new Contract()
->setName('35h')
->setTrackingMode(TrackingMode::TIME)
->setWeeklyHours(35)
->setIsActive(true)
;
$contract4h = new Contract()
->setName('4h')
->setTrackingMode(TrackingMode::TIME)
->setWeeklyHours(4)
->setIsActive(true)
;
$forfait = new Contract()
->setName('Forfait')
->setTrackingMode(TrackingMode::PRESENCE)
->setWeeklyHours(null)
->setIsActive(true)
;
$interim = new Contract()
->setName('Interim')
->setTrackingMode(TrackingMode::TIME)
->setWeeklyHours(35)
->setIsActive(true)
;
$manager->persist($contract35);
$manager->persist($contract4h);
$manager->persist($forfait);
$manager->persist($interim);
$manager->flush();
$this->addReference(FixtureReferences::CONTRACT_35, $contract35);
$this->addReference(FixtureReferences::CONTRACT_4H, $contract4h);
$this->addReference(FixtureReferences::CONTRACT_FORFAIT, $forfait);
$this->addReference(FixtureReferences::CONTRACT_INTERIM, $interim);
}
}

View File

@@ -0,0 +1,91 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Contract;
use App\Entity\Employee;
use App\Entity\EmployeeContractPeriod;
use App\Enum\ContractNature;
use DateTimeImmutable;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
final class EmployeeContractPeriodFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
$this->createPeriod(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_STANDARD, Employee::class),
$this->getReference(FixtureReferences::CONTRACT_35, Contract::class),
'2025-01-01',
null,
ContractNature::CDI,
false
);
$this->createPeriod(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_4H, Employee::class),
$this->getReference(FixtureReferences::CONTRACT_4H, Contract::class),
'2026-01-01',
'2026-12-31',
ContractNature::CDD,
false
);
$this->createPeriod(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_FORFAIT, Employee::class),
$this->getReference(FixtureReferences::CONTRACT_FORFAIT, Contract::class),
'2024-01-01',
null,
ContractNature::CDI,
false
);
$this->createPeriod(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_INTERIM, Employee::class),
$this->getReference(FixtureReferences::CONTRACT_INTERIM, Contract::class),
'2026-02-01',
'2026-06-30',
ContractNature::INTERIM,
false
);
$manager->flush();
}
public function getDependencies(): array
{
return [
EmployeeFixtures::class,
ContractFixtures::class,
];
}
private function createPeriod(
ObjectManager $manager,
Employee $employee,
Contract $contract,
string $startDate,
?string $endDate,
ContractNature $nature,
bool $paidLeaveSettled
): void {
$period = new EmployeeContractPeriod()
->setEmployee($employee)
->setContract($contract)
->setStartDate(new DateTimeImmutable($startDate))
->setEndDate(null === $endDate ? null : new DateTimeImmutable($endDate))
->setContractNature($nature)
->setPaidLeaveSettled($paidLeaveSettled)
;
$manager->persist($period);
}
}

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Contract;
use App\Entity\Employee;
use App\Entity\Site;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
final class EmployeeFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
$site = $this->getReference(FixtureReferences::SITE_MAIN, Site::class);
$employeeStandard = new Employee()
->setFirstName('Alice')
->setLastName('Martin')
->setSite($site)
->setContract($this->getReference(FixtureReferences::CONTRACT_35, Contract::class))
->setDisplayOrder(1)
;
$employee4h = new Employee()
->setFirstName('Bruno')
->setLastName('Petit')
->setSite($site)
->setContract($this->getReference(FixtureReferences::CONTRACT_4H, Contract::class))
->setDisplayOrder(2)
;
$employeeForfait = new Employee()
->setFirstName('Chloe')
->setLastName('Durand')
->setSite($site)
->setContract($this->getReference(FixtureReferences::CONTRACT_FORFAIT, Contract::class))
->setDisplayOrder(3)
;
$employeeInterim = new Employee()
->setFirstName('David')
->setLastName('Leroy')
->setSite($site)
->setContract($this->getReference(FixtureReferences::CONTRACT_INTERIM, Contract::class))
->setDisplayOrder(4)
;
$manager->persist($employeeStandard);
$manager->persist($employee4h);
$manager->persist($employeeForfait);
$manager->persist($employeeInterim);
$manager->flush();
$this->addReference(FixtureReferences::EMPLOYEE_STANDARD, $employeeStandard);
$this->addReference(FixtureReferences::EMPLOYEE_4H, $employee4h);
$this->addReference(FixtureReferences::EMPLOYEE_FORFAIT, $employeeForfait);
$this->addReference(FixtureReferences::EMPLOYEE_INTERIM, $employeeInterim);
}
public function getDependencies(): array
{
return [
SiteFixtures::class,
ContractFixtures::class,
];
}
}

View File

@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Employee;
use App\Entity\EmployeeLeaveBalance;
use App\Enum\LeaveRuleCode;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
final class EmployeeLeaveBalanceFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager): void
{
$this->createOpeningBalance(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_STANDARD, Employee::class),
LeaveRuleCode::CDI_CDD_NON_FORFAIT,
2026,
0.0,
0.0
);
$this->createOpeningBalance(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_4H, Employee::class),
LeaveRuleCode::CDI_CDD_NON_FORFAIT,
2026,
0.0,
0.0
);
$this->createOpeningBalance(
$manager,
$this->getReference(FixtureReferences::EMPLOYEE_FORFAIT, Employee::class),
LeaveRuleCode::FORFAIT_218,
2026,
0.0,
0.0
);
$manager->flush();
}
public function getDependencies(): array
{
return [
EmployeeFixtures::class,
];
}
private function createOpeningBalance(
ObjectManager $manager,
Employee $employee,
LeaveRuleCode $ruleCode,
int $year,
float $openingDays,
float $openingSaturdays
): void {
$balance = new EmployeeLeaveBalance()
->setEmployee($employee)
->setRuleCode($ruleCode)
->setYear($year)
->setOpeningDays($openingDays)
->setOpeningSaturdays($openingSaturdays)
->setAccruedDays(0.0)
->setAccruedSaturdays(0.0)
->setTakenDays(0.0)
->setTakenSaturdays(0.0)
->setClosingDays($openingDays)
->setClosingSaturdays($openingSaturdays)
->setIsLocked(false)
;
$manager->persist($balance);
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
final class FixtureReferences
{
public const SITE_MAIN = 'site.main';
public const CONTRACT_35 = 'contract.35h';
public const CONTRACT_4H = 'contract.4h';
public const CONTRACT_FORFAIT = 'contract.forfait';
public const CONTRACT_INTERIM = 'contract.interim';
public const ABSENCE_TYPE_RTT = 'absence_type.rtt';
public const ABSENCE_TYPE_CONGE = 'absence_type.conge';
public const ABSENCE_TYPE_MALADIE = 'absence_type.maladie';
public const ABSENCE_TYPE_AT = 'absence_type.at';
public const ABSENCE_TYPE_FORMATION = 'absence_type.formation';
public const ABSENCE_TYPE_EXCEPTIONNEL = 'absence_type.exceptionnel';
public const ABSENCE_TYPE_ABSENT = 'absence_type.absent';
public const ABSENCE_TYPE_AUTRE = 'absence_type.autre';
public const EMPLOYEE_STANDARD = 'employee.standard_non_forfait';
public const EMPLOYEE_4H = 'employee.four_hours';
public const EMPLOYEE_FORFAIT = 'employee.forfait';
public const EMPLOYEE_INTERIM = 'employee.interim';
public const USER_ADMIN_EMILIE = 'user.admin.emilie';
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\Site;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
final class SiteFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$site = new Site()
->setName('SITE TEST')
->setColor('#75aed9')
->setDisplayOrder(1)
;
$manager->persist($site);
$manager->flush();
$this->addReference(FixtureReferences::SITE_MAIN, $site);
}
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use App\Entity\User;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
final class UserFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$emilie = new User()
->setUsername('emilie')
->setRoles(['ROLE_ADMIN'])
->setPassword('$2y$13$swd6WU4z7Z4MeZwl9hHaFez8xB/GMZxyrCDQUlFEY55JQUzTW0bPO')
;
$manager->persist($emilie);
$manager->flush();
$this->addReference(FixtureReferences::USER_ADMIN_EMILIE, $emilie);
}
}