@php
$staff = $instance->staff;
$appliedOutcome = $instance->meta['probation_outcome'] ?? null;
$appliedAt = $instance->meta['probation_outcome_applied_at'] ?? null;
$currentLeaveGroup = $leaveGroups->firstWhere('id', $staff?->leave_group_id);
$currentProbationEnd = $staff?->probation_end_date?->format('Y-m-d') ?? $staff?->probationEndDate()?->format('Y-m-d');
$selectedOutcome = old('probation_outcome', $appliedOutcome);
$pfFeatureOn = $pfFeatureOn ?? false;
$gfFeatureOn = $gfFeatureOn ?? false;
$swfFeatureOn = $swfFeatureOn ?? false;
$showFundOptions = $pfFeatureOn || $gfFeatureOn || $swfFeatureOn;
$defaultPermanentDate = $defaultPermanentDate ?? ($staff?->probationEndDate()?->format('Y-m-d') ?? now()->format('Y-m-d'));
@endphp
{{ __('Probation employment decision') }}
{{ __('Choose whether to confirm the employee as permanent or extend probation. Set the confirmation effective date and, if enabling funds, when PF/GF/SWF contributions should start.') }}
@if($staff)
@include('admin.staff.partials.employment_lifecycle', ['staff' => $staff])
@endif
@if($appliedOutcome && $appliedAt)
@if($appliedOutcome === \App\Services\PerformanceAppraisal\StaffProbationOutcomeService::OUTCOME_PERMANENT)
{{ __('Last applied: permanent confirmation') }}
@if(! empty($instance->meta['permanent_date']))
— {{ __('effective') }}: {{ \Carbon\Carbon::parse($instance->meta['permanent_date'])->format('d/m/Y') }}
@endif
@if(! empty($instance->meta['confirmed_leave_group_id']))
— {{ __('Leave group') }}:
{{ $leaveGroups->firstWhere('id', (int) $instance->meta['confirmed_leave_group_id'])?->name ?? '#' . $instance->meta['confirmed_leave_group_id'] }}
@endif
@php
$fundApplied = [];
if (array_key_exists('pf_enrolled', $instance->meta ?? [])) {
$fundApplied[] = __('PF').': '.($instance->meta['pf_enrolled'] ? __('Enabled') : __('Disabled'))
.(! empty($instance->meta['pf_enrolled_at']) ? ' ('.$instance->meta['pf_enrolled_at'].')' : '');
}
if (array_key_exists('gf_enrolled', $instance->meta ?? [])) {
$fundApplied[] = __('GF').': '.($instance->meta['gf_enrolled'] ? __('Enabled') : __('Disabled'))
.(! empty($instance->meta['gf_enrolled_at']) ? ' ('.$instance->meta['gf_enrolled_at'].')' : '');
}
if (array_key_exists('swf_enrolled', $instance->meta ?? [])) {
$fundApplied[] = __('SWF').': '.($instance->meta['swf_enrolled'] ? __('Enabled') : __('Disabled'))
.(! empty($instance->meta['swf_enrolled_at']) ? ' ('.$instance->meta['swf_enrolled_at'].')' : '');
}
@endphp
@if($fundApplied !== [])
{{ implode(' · ', $fundApplied) }}
@endif
@else
{{ __('Last applied: probation extended to :date', ['date' => $instance->meta['probation_extended_to'] ?? '—']) }}
@endif
({{ \Carbon\Carbon::parse($appliedAt)->format('d/m/Y H:i') }})
@if((int) get_setting('enothi') === 1)
@endif
@endif
@if($staff?->isProbationary())
@else
{{ __('This employee is no longer on probation. Staff record changes can be made from the employee profile.') }}
@endif