[#SIRH-14] Ajouter un onglet Observation sur la fiche employé (#8)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
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: #8 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #8.
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Repository\BonusRepository;
|
||||
use App\Repository\EmployeeRepository;
|
||||
use App\Repository\EmployeeRttPaymentRepository;
|
||||
use App\Repository\MileageAllowanceRepository;
|
||||
use App\Repository\ObservationRepository;
|
||||
use App\Repository\WorkHourRepository;
|
||||
use App\Service\Contracts\EmployeeContractResolver;
|
||||
use DateInterval;
|
||||
@@ -36,6 +37,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
private EmployeeRttPaymentRepository $rttPaymentRepository,
|
||||
private BonusRepository $bonusRepository,
|
||||
private MileageAllowanceRepository $mileageAllowanceRepository,
|
||||
private ObservationRepository $observationRepository,
|
||||
private EmployeeContractResolver $contractResolver,
|
||||
) {}
|
||||
|
||||
@@ -62,20 +64,22 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$monthNumber = (int) $from->format('n');
|
||||
$rttPayments = $this->rttPaymentRepository->findByYearAndMonth($year, $monthNumber);
|
||||
|
||||
$bonuses = $this->bonusRepository->findByMonth($from, $to);
|
||||
$mileages = $this->mileageAllowanceRepository->findByMonth($from, $to);
|
||||
$bonuses = $this->bonusRepository->findByMonth($from, $to);
|
||||
$mileages = $this->mileageAllowanceRepository->findByMonth($from, $to);
|
||||
$observations = $this->observationRepository->findByMonth($from, $to);
|
||||
|
||||
$days = $this->buildDays($from, $to);
|
||||
$contractMap = $this->contractResolver->resolveForEmployeesAndDays($employees, $days);
|
||||
$driverMap = $this->contractResolver->resolveIsDriverForEmployeesAndDays($employees, $days);
|
||||
|
||||
$workHourMap = $this->buildWorkHourMap($workHours);
|
||||
$absenceMap = $this->buildAbsenceMap($absences);
|
||||
$rttPaymentMap = $this->buildRttPaymentMap($rttPayments);
|
||||
$bonusMap = $this->buildBonusMap($bonuses);
|
||||
$mileageMap = $this->buildMileageMap($mileages);
|
||||
$workHourMap = $this->buildWorkHourMap($workHours);
|
||||
$absenceMap = $this->buildAbsenceMap($absences);
|
||||
$rttPaymentMap = $this->buildRttPaymentMap($rttPayments);
|
||||
$bonusMap = $this->buildBonusMap($bonuses);
|
||||
$mileageMap = $this->buildMileageMap($mileages);
|
||||
$observationMap = $this->buildObservationMap($observations);
|
||||
|
||||
$siteGroups = $this->aggregateBySite($employees, $days, $contractMap, $driverMap, $workHourMap, $absenceMap, $rttPaymentMap, $bonusMap, $mileageMap);
|
||||
$siteGroups = $this->aggregateBySite($employees, $days, $contractMap, $driverMap, $workHourMap, $absenceMap, $rttPaymentMap, $bonusMap, $mileageMap, $observationMap);
|
||||
|
||||
$options = new Options();
|
||||
$options->set('isRemoteEnabled', true);
|
||||
@@ -204,6 +208,23 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function buildObservationMap(array $observations): array
|
||||
{
|
||||
$map = [];
|
||||
foreach ($observations as $observation) {
|
||||
$employeeId = $observation->getEmployee()?->getId();
|
||||
if (!$employeeId) {
|
||||
continue;
|
||||
}
|
||||
$map[$employeeId] = $observation->getContent();
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
private function aggregateBySite(
|
||||
array $employees,
|
||||
array $days,
|
||||
@@ -214,6 +235,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
array $rttPaymentMap,
|
||||
array $bonusMap,
|
||||
array $mileageMap,
|
||||
array $observationMap,
|
||||
): array {
|
||||
$siteGroups = [];
|
||||
|
||||
@@ -234,6 +256,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
$rttPaymentMap[$employeeId] ?? 0,
|
||||
$bonusMap[$employeeId] ?? 0.0,
|
||||
$mileageMap[$employeeId] ?? 0.0,
|
||||
$observationMap[$employeeId] ?? '',
|
||||
);
|
||||
|
||||
if (!isset($siteGroups[$siteId])) {
|
||||
@@ -261,6 +284,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
int $rttPaidMinutes,
|
||||
float $bonusAmount,
|
||||
float $mileageKm,
|
||||
string $observation,
|
||||
): array {
|
||||
$contractName = null;
|
||||
$presenceDays = 0.0;
|
||||
@@ -373,6 +397,7 @@ class SalaryRecapPrintProvider implements ProviderInterface
|
||||
'driverMeals' => $driverMeals,
|
||||
'driverOvernight' => $driverOvernight,
|
||||
'driverSaturdays' => $driverSaturdays,
|
||||
'observation' => $observation,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user