Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ec3044cb3 | ||
| f024a6a8de |
@@ -30,6 +30,10 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
$rttStartDate: '%env(RTT_START_DATE)%'
|
$rttStartDate: '%env(RTT_START_DATE)%'
|
||||||
|
|
||||||
|
App\State\EmployeeRttSummaryProvider:
|
||||||
|
arguments:
|
||||||
|
$rttStartDate: '%env(RTT_START_DATE)%'
|
||||||
|
|
||||||
App\Repository\Contract\AbsenceReadRepositoryInterface: '@App\Repository\AbsenceRepository'
|
App\Repository\Contract\AbsenceReadRepositoryInterface: '@App\Repository\AbsenceRepository'
|
||||||
App\Repository\Contract\EmployeeContractPeriodReadRepositoryInterface: '@App\Repository\EmployeeContractPeriodRepository'
|
App\Repository\Contract\EmployeeContractPeriodReadRepositoryInterface: '@App\Repository\EmployeeContractPeriodRepository'
|
||||||
App\Repository\Contract\EmployeeScopedRepositoryInterface: '@App\Repository\EmployeeRepository'
|
App\Repository\Contract\EmployeeScopedRepositoryInterface: '@App\Repository\EmployeeRepository'
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.1.45'
|
app.version: '0.1.46'
|
||||||
|
|||||||
@@ -332,10 +332,19 @@ const carryMonth = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const showCarryRow = computed(() => {
|
const showCarryRow = computed(() => {
|
||||||
return (
|
if (currentMonth.value !== carryMonth.value) return false
|
||||||
currentMonth.value === carryMonth.value &&
|
if ((props.summary?.carryFromPreviousYearMinutes ?? 0) === 0) return false
|
||||||
(props.summary?.carryFromPreviousYearMinutes ?? 0) > 0
|
|
||||||
)
|
// On the first exercise, hide carry if carry month is before rttStartDate
|
||||||
|
if (props.summary?.rttStartDate) {
|
||||||
|
const startDate = new Date(props.summary.rttStartDate)
|
||||||
|
const viewYear = currentMonth.value >= 6 ? props.summary.year - 1 : props.summary.year
|
||||||
|
const viewDate = new Date(viewYear, currentMonth.value - 1, 1)
|
||||||
|
const startMonthDate = new Date(startDate.getFullYear(), startDate.getMonth(), 1)
|
||||||
|
if (viewDate < startMonthDate) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
// --- Month report row (cumulated balance from previous months) ---
|
// --- Month report row (cumulated balance from previous months) ---
|
||||||
@@ -390,6 +399,18 @@ const monthReport = computed(() => {
|
|||||||
const showMonthReportRow = computed(() => {
|
const showMonthReportRow = computed(() => {
|
||||||
// Not on the carry month — carry row handles that
|
// Not on the carry month — carry row handles that
|
||||||
if (currentMonth.value === carryMonth.value) return false
|
if (currentMonth.value === carryMonth.value) return false
|
||||||
|
|
||||||
|
// On the first exercise (containing rttStartDate), hide report for months before the start date
|
||||||
|
if (props.summary?.rttStartDate) {
|
||||||
|
const startDate = new Date(props.summary.rttStartDate)
|
||||||
|
const startYear = startDate.getFullYear()
|
||||||
|
const startMonth = startDate.getMonth() + 1
|
||||||
|
const viewYear = currentMonth.value >= 6 ? props.summary.year - 1 : props.summary.year
|
||||||
|
const viewDate = new Date(viewYear, currentMonth.value - 1, 1)
|
||||||
|
const startMonthDate = new Date(startYear, startMonth - 1, 1)
|
||||||
|
if (viewDate < startMonthDate) return false
|
||||||
|
}
|
||||||
|
|
||||||
const r = monthReport.value
|
const r = monthReport.value
|
||||||
return r.total !== 0
|
return r.total !== 0
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -32,4 +32,5 @@ export type EmployeeRttSummary = {
|
|||||||
availableMinutes: number
|
availableMinutes: number
|
||||||
weeks: EmployeeRttWeekSummary[]
|
weeks: EmployeeRttWeekSummary[]
|
||||||
monthPayments: RttMonthPayment[]
|
monthPayments: RttMonthPayment[]
|
||||||
|
rttStartDate: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ final class EmployeeRttSummary
|
|||||||
public int $currentYearRecoveryMinutes = 0;
|
public int $currentYearRecoveryMinutes = 0;
|
||||||
public int $availableMinutes = 0;
|
public int $availableMinutes = 0;
|
||||||
public int $totalPaidMinutes = 0;
|
public int $totalPaidMinutes = 0;
|
||||||
|
public ?string $rttStartDate = null;
|
||||||
|
|
||||||
/** @var list<RttMonthPayment> */
|
/** @var list<RttMonthPayment> */
|
||||||
public array $monthPayments = [];
|
public array $monthPayments = [];
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
|||||||
|
|
||||||
final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
||||||
{
|
{
|
||||||
|
private ?string $rttStartDate;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private Security $security,
|
private Security $security,
|
||||||
private RequestStack $requestStack,
|
private RequestStack $requestStack,
|
||||||
@@ -34,7 +36,10 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
|||||||
private EmployeeRttBalanceRepository $rttBalanceRepository,
|
private EmployeeRttBalanceRepository $rttBalanceRepository,
|
||||||
private EmployeeRttPaymentRepository $rttPaymentRepository,
|
private EmployeeRttPaymentRepository $rttPaymentRepository,
|
||||||
private RttRecoveryComputationService $rttRecoveryService,
|
private RttRecoveryComputationService $rttRecoveryService,
|
||||||
) {}
|
string $rttStartDate = '',
|
||||||
|
) {
|
||||||
|
$this->rttStartDate = '' !== $rttStartDate ? $rttStartDate : null;
|
||||||
|
}
|
||||||
|
|
||||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): EmployeeRttSummary
|
public function provide(Operation $operation, array $uriVariables = [], array $context = []): EmployeeRttSummary
|
||||||
{
|
{
|
||||||
@@ -93,7 +98,15 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
|
|||||||
$summary->carryBonus50Minutes = $carry->bonus50Minutes;
|
$summary->carryBonus50Minutes = $carry->bonus50Minutes;
|
||||||
$summary->currentYearRecoveryMinutes = array_sum(array_map(static fn ($d) => $d->totalMinutes, $currentByWeekStart));
|
$summary->currentYearRecoveryMinutes = array_sum(array_map(static fn ($d) => $d->totalMinutes, $currentByWeekStart));
|
||||||
$summary->availableMinutes = $summary->carryFromPreviousYearMinutes + $summary->currentYearRecoveryMinutes;
|
$summary->availableMinutes = $summary->carryFromPreviousYearMinutes + $summary->currentYearRecoveryMinutes;
|
||||||
$summary->weeks = array_map(
|
|
||||||
|
// Pass rttStartDate only if it falls within this exercise
|
||||||
|
if (null !== $this->rttStartDate) {
|
||||||
|
$startDate = new DateTimeImmutable($this->rttStartDate);
|
||||||
|
if ($startDate >= $periodFrom && $startDate <= $periodTo) {
|
||||||
|
$summary->rttStartDate = $this->rttStartDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$summary->weeks = array_map(
|
||||||
static function (array $week) use ($currentByWeekStart) {
|
static function (array $week) use ($currentByWeekStart) {
|
||||||
$detail = $currentByWeekStart[$week['start']->format('Y-m-d')] ?? new WeekRecoveryDetail();
|
$detail = $currentByWeekStart[$week['start']->format('Y-m-d')] ?? new WeekRecoveryDetail();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user