@if(session('success') || session('error') || session('warning'))
@php
$type = session('success') ? 'success' : (session('error') ? 'error' : 'warning');
$message = session('success') ?? session('error') ?? session('warning');
$styles = [
'success' => 'bg-green-100 border-green-500 text-green-800 dark:bg-green-900/40 dark:border-green-400 dark:text-green-200',
'error' => 'bg-red-100 border-red-500 text-red-800 dark:bg-red-900/40 dark:border-red-400 dark:text-red-200',
'warning' => 'bg-yellow-100 border-yellow-500 text-yellow-800 dark:bg-yellow-900/40 dark:border-yellow-400 dark:text-yellow-200',
];
@endphp
@endif
{{-- ===================== MOBILE SEARCH & FILTER ===================== --}}
{{-- Filter date --}}
@if($canManage ?? false)
@endif
{{-- ===================== DESKTOP TABLE ===================== --}}
| # |
{{ __('form.Employees') }} |
{{ __('form.Reprimand-Type') }} |
{{ __('form.Effective-Date') }} |
{{ __('form.End-Date') }} |
{{ __('form.Watchers') }} |
Lampiran |
@if($canManage ?? false)
Status |
Approval |
@endif
@if(($isInbox ?? false) || ($canManage ?? false))
{{ __('table.Action') }} |
@endif
@foreach ($data as $reprimand)
@php
$now = \Carbon\Carbon::now();
$effectiveDate = \Carbon\Carbon::parse($reprimand->effective_date);
$endDate = $reprimand->end_date ? \Carbon\Carbon::parse($reprimand->end_date) : null;
if ($now->lt($effectiveDate)) {
$statusLabel = 'Upcoming';
$statusClass = 'text-blue-600 bg-blue-100';
} elseif ($endDate && $now->gt($endDate)) {
$statusLabel = 'Inactive';
$statusClass = 'text-gray-500 bg-gray-100';
} else {
$statusLabel = 'Active';
$statusClass = 'text-green-600 bg-green-100';
}
$approval = $reprimand->approval;
$approvalStatusText = '-';
$approvalStatusClass = 'text-gray-500 bg-gray-100';
if ($approval) {
if ($approval->status === 'approved') {
$approvalStatusText = 'Approved';
$approvalStatusClass = 'text-green-600 bg-green-100';
} elseif ($approval->status === 'rejected') {
$rejectedStep = $approval->steps->firstWhere('status', 'rejected');
$rejectedBy = $rejectedStep?->approver?->name ?? ucfirst($rejectedStep?->approver_role ?? '');
$approvalStatusText = 'Rejected' . ($rejectedBy ? ' by ' . $rejectedBy : '');
$approvalStatusClass = 'text-red-600 bg-red-100';
} else {
$activeStep = $approval->steps->firstWhere('status', 'active');
if ($activeStep) {
$approverName = $activeStep->approver?->name ?? ucfirst($activeStep->approver_role ?? '');
$approvalStatusText = 'Pending ' . $approverName;
} else {
$approvalStatusText = 'Waiting';
}
$approvalStatusClass = 'text-yellow-600 bg-yellow-100';
}
}
$canApprove = false;
if ($isInbox ?? false) {
$currentStep = $approval?->steps->firstWhere('status', 'active');
$currentUser = auth()->user();
if ($currentStep) {
$canApprove = ($currentStep->user_id === $currentUser->id) ||
($currentStep->approver_role && $currentUser->hasRole($currentStep->approver_role));
}
}
@endphp
| {{ $loop->iteration }} |
{{ $reprimand->employee->fullname ?? '-' }} |
{{ $reprimand->reprimandType->name ?? '-' }} |
{{ \Carbon\Carbon::parse($reprimand->effective_date)->format('d M Y') }} |
{{ $reprimand->end_date ? \Carbon\Carbon::parse($reprimand->end_date)->format('d M Y') : '-' }} |
@php $watcherIds = json_decode($reprimand->watchers, true) ?? []; @endphp
@if(count($watcherIds))
@foreach($watcherIds as $watcherId)
@if(isset($employees[$watcherId]))
{{ $employees[$watcherId] }}
@endif
@endforeach
@else -
@endif
|
@if($reprimand->attachment)
@else
-
@endif
|
@if($canManage ?? false)
{{ $statusLabel }} |
{{ $approvalStatusText }} |
@endif
@if(($isInbox ?? false) || ($canManage ?? false))
@if($isInbox ?? false)
@if($canApprove)
@endif
@else
@endif
|
@endif
@endforeach
{{-- ===================== MOBILE CARD LIST (VIRTUAL SCROLL) ===================== --}}
{{-- Skeleton loading --}}
@for ($i = 0; $i < 5; $i++)
@endfor
{{-- Cards container --}}
{{-- Empty states --}}
Tidak ada hasil ditemukan
{{-- Loading spinner --}}