feat : ajout de la gestion Congé

This commit is contained in:
2026-03-05 14:09:50 +01:00
parent fc2b184c50
commit 20a651895f
55 changed files with 4171 additions and 144 deletions

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);
}
}