@foreach($application->stepper as $index => $step)
@php
$isCompleted = $step['completed'] ?? false;
$isRejected = $step['rejected'] ?? false;
$isCurrent =
!$isCompleted
&& !$isRejected
&& collect($application->stepper)
->take($index)
->every(
fn($s) => $s['completed'] ?? false
);
@endphp
{{-- =================================================
STEP CIRCLE
================================================== --}}
{{-- APPLIED --}}
@if($index === 0)
{{-- FINAL --}}
@elseif($step['final'] ?? false)
@if(in_array($step['final_status'] ?? null, [
'intern-offered',
'job-offered',
'ppo'
]))
@elseif(($step['final_status'] ?? null) === 'not-selected')
@else
●
@endif
{{-- REJECTED --}}
@elseif($isRejected)
{{-- COMPLETED --}}
@elseif($isCompleted)
{{-- CURRENT --}}
@elseif($isCurrent)
{{-- PENDING --}}
@else
●
@endif
{{-- LABEL --}}
{{ $step['label'] }}
{{-- DATE --}}
@if(!empty($step['date']))
{{ $step['date'] }}
@endif
{{-- REJECTED MESSAGE --}}
@if($isRejected)
@if(in_array($step['slug'] ?? null, [
'1st-shortlist',
'2nd-shortlist'
]))
Not Shortlisted
@elseif(($step['slug'] ?? null) === 'interview')
Not Selected
@endif
@endif
{{-- FINAL RESULT TEXT --}}
@if(
($step['final'] ?? false)
&& ($step['completed'] ?? false)
)
{{
in_array($step['final_status'] ?? null, [
'intern-offered',
'job-offered',
'ppo'
])
? 'Selected'
: 'Position Closed'
}}
@endif
{{-- CONNECTOR --}}
@if(!$loop->last)
@php
$nextStep =
$application->stepper[$index + 1] ?? null;
$lineCompleted =
($isCompleted || $isRejected)
&&
(
($nextStep['completed'] ?? false)
||
($nextStep['rejected'] ?? false)
);
@endphp