Leave Request Preview - HR
Back to HR Dashboard
{{ $leaveRequest->status === 'Certified' ? 'HR CERTIFIED' : strtoupper($leaveRequest->status) }}
@if(session('error'))
@endforeach
@foreach($leaveTypeArray as $type)
@if(!in_array($type, $standardTypes))
@endif
@endforeach
@if($leaveRequest->admin_signatory)
@endif
@if($leaveRequest->status === 'Rejected' && isset($certData['rejection_comment']))
@endif
@endif
{{ session('error') }}
@endif
@if(session('success'))
{{ session('success') }}
@endif
Republic of the Philippines
DEPARTMENT OF AGRICULTURE
Cordillera Administrative Region
BPI Compound, Easter Road, Guisad, Baguio City
Stamp of Date of Receipt
APPLICATION FOR LEAVE
1. OFFICE/DEPARTMENT
2. NAME : (Last) (First) (Middle)
3. DATE OF FILING
4. POSITION
5. SALARY
6. DETAILS OF APPLICATION
6.A TYPE OF LEAVE TO BE AVAILED OF
@php
$standardTypes = [
'Vacation Leave', 'Mandatory/Forced Leave', 'Sick Leave', 'Maternity Leave', 'Paternity Leave',
'Special Privilege Leave', 'Solo Parent Leave', 'Study Leave', '10-Day VAWC Leave',
'Rehabilitation Privilege', 'Special Leave Benefits for Women', 'Special Emergency (Calamity) Leave', 'Adoption Leave'
];
$leaveTypeArray = is_string($leaveRequest->leave_type) && $leaveRequest->leave_type[0] === '['
? json_decode($leaveRequest->leave_type, true)
: (is_array($leaveRequest->leave_type) ? $leaveRequest->leave_type : [$leaveRequest->leave_type]);
@endphp
@foreach($standardTypes as $type)
Others:
6.B DETAILS OF LEAVE
In case of Vacation/Special Privilege Leave:
@if($leaveRequest->within_ph_details)
@endif
@if($leaveRequest->abroad_details)
@endif
In case of Sick Leave:
@if($leaveRequest->in_hospital_details)
@endif
@if($leaveRequest->out_patient_details)
@endif
In case of Special Leave Benefits for Women:
@if($leaveRequest->special_leave_details)
@endif
In case of Study Leave:
Other purpose:
6.C NUMBER OF WORKING DAYS APPLIED FOR
INCLUSIVE DATES
@php
$displayed = false;
$raw = $leaveRequest->inclusive_dates ?? '';
$ranges = [];
// Try to decode JSON if it looks like a JSON array
if (is_string($raw) && strlen($raw) > 0 && $raw[0] === '[') {
$decoded = json_decode($raw, true);
if (is_array($decoded)) {
$ranges = $decoded;
}
} elseif (is_array($raw)) {
$ranges = $raw;
} elseif (is_string($raw)) {
$ranges = explode(',', $raw);
}
if (count($ranges)) {
foreach($ranges as $idx => $range) {
$range = trim($range, " \"");
$dates = explode(' to ', $range);
if(count($dates) === 2) {
try {
$start = \Carbon\Carbon::parse($dates[0]);
$end = \Carbon\Carbon::parse($dates[1]);
if ($start->format('M Y') === $end->format('M Y')) {
echo $start->format('M j') . '-' . $end->format('j, Y');
} elseif ($start->format('Y') === $end->format('Y')) {
echo $start->format('M j') . ' - ' . $end->format('M j, Y');
} else {
echo $start->format('M j, Y') . ' - ' . $end->format('M j, Y');
}
} catch (Exception $e) {
echo $range;
}
} else {
// Format single date as 'M j, Y'
try {
$single = \Carbon\Carbon::parse($range);
echo $single->format('M j, Y');
} catch (Exception $e) {
echo $range;
}
}
if ($idx !== count($ranges) - 1) echo ', ';
$displayed = true;
}
}
if (!$displayed) {
echo $raw;
}
@endphp
6.D COMMUTATION
Division Chief (2nd Signatory)
@php
$adminParts = explode('|', $leaveRequest->admin_signatory);
$adminName = $adminParts[0] ?? '';
$adminPosition = $adminParts[1] ?? '';
@endphp
{{ $adminPosition }}
Rejected by HR
Reason: {{ $certData['rejection_comment'] }}
{{ $certData['rejected_by'] ?? '' }} {{ $certData['rejected_at'] ? 'on ' . \Carbon\Carbon::parse($certData['rejected_at'])->format('M d, Y g:i A') : '' }}
@endif
@if($leaveRequest->attachments)
@php
$attachments = is_string($leaveRequest->attachments) ? json_decode($leaveRequest->attachments, true) : $leaveRequest->attachments;
@endphp
@if(is_array($attachments) && count($attachments) > 0)
Reason: {{ $certData['rejection_comment'] }}
{{ $certData['rejected_by'] ?? '' }} {{ $certData['rejected_at'] ? 'on ' . \Carbon\Carbon::parse($certData['rejected_at'])->format('M d, Y g:i A') : '' }}
ATTACHMENTS
7. DETAILS OF ACTION ON APPLICATION