{{ __('navbar.reprimands') }}

@if(!($isInbox ?? false) && ($canManage ?? false))
Export @include('reprimands.create')
@endif
@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 @if($canManage ?? false) @endif @if(($isInbox ?? false) || ($canManage ?? false)) @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 status text $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'; } } // Cek apakah user bisa approve di inbox $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 @if($canManage ?? false) @endif @if($canManage ?? false) @endif @if(($isInbox ?? false) || ($canManage ?? false)) @endif @endforeach
# {{ __('form.Employees') }} {{ __('form.Reprimand-Type') }} {{ __('form.Effective-Date') }} {{ __('form.End-Date') }} {{ __('form.Watchers') }} LampiranStatus Approval{{ __('table.Action') }}
{{ $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
{{ $statusLabel }} {{ $approvalStatusText }} @if($isInbox ?? false) {{-- Tombol approve/reject di inbox --}} @if($canApprove) @endif @else {{-- Tombol edit/delete hanya hrd & super-admin --}} @endif
@if(!($isInbox ?? false)) @include('reprimands.edit') {{-- Import Modal --}}

{{ __('form.Confrim-Import') }}

{{ __('form.Confrim-Import-D') }}

@csrf

{{ __('form.Format-File') }}: .xlsx, .xls, .csv

{{-- MODAL CHANGES IMPORT --}} @if(session('change_count') && session('change_count') > 0) @endif {{-- MODAL ERROR IMPORT --}} @if(session('import_errors')) @endif @endif {{-- Approve modal — pakai component yang sama kayak KPI --}}