@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
List {{ $title_menu }}
@include('components.alert')

@foreach ($rows as $i => $r) @php $keepQuery = request()->query(); unset($keepQuery['export']); $filterQueryString = http_build_query($keepQuery); $status = $r->master_status ?? 'in_progress'; $progress = $r->evaluation_progress ?? 'not_started'; $isPeriodLocked = isset($periodStatus) && $periodStatus === 'locked'; // Row styling based on status - 4-status system $rowStyle = ''; $rowClass = ''; if ($status === 'approved') { $rowClass = 'status-approved'; } elseif ($status === 'need_approval') { $rowClass = 'status-need-approval'; } elseif ($status === 'ready_for_approval') { $rowClass = 'status-ready-for-approval'; } elseif ($status === 'in_progress' || !$status) { $rowClass = 'status-in-progress'; } // Combined status for display - 4-status system $combinedStatus = $progress; // Determine status based on master status if ($status === 'approved') { $combinedStatus = 'approved'; } elseif ($status === 'need_approval') { // Need approval after admin revision → Sudah Dicek $combinedStatus = 'sudah_dicek'; } elseif ($status === 'ready_for_approval') { // Supervisor completed → Belum Dicek $combinedStatus = 'belum_dicek'; } else { // in_progress or no master → Sedang Berjalan $combinedStatus = 'sedang_berjalan'; } // Status badge styling (4-status system) $statusBadge = [ 'approved' => ['class' => 'bg-primary', 'text' => 'Approved'], 'sudah_dicek' => [ 'class' => 'bg-success', 'text' => 'Sudah Dicek', ], 'belum_dicek' => [ 'class' => 'bg-warning', 'text' => 'Belum Dicek', ], 'sedang_berjalan' => [ 'class' => 'bg-info', 'text' => 'Sedang Berjalan', ], ][$combinedStatus] ?? [ 'class' => 'bg-secondary', 'text' => ucwords(str_replace('_', ' ', $combinedStatus)), ]; $progressText = "{$r->submitted_months}/{$r->required_evaluation_months} bulan"; if ($r->rest_months > 0) { $progressText .= " ({$r->rest_months} cuti)"; } // Prepare position history display $positionDisplay = ''; $departmentDisplay = ''; $positions = []; $departments = []; foreach ($r->position_history as $position) { $positions[] = $position->position_name; $departments[] = $position->department_name; } $positionDisplay = implode('
', array_unique($positions)); $departmentDisplay = implode('
', array_unique($departments)); @endphp @endforeach
Action No Karyawan Posisi (Periode) Departemen Status
@if ($authorize && $authorize->edit == '1') @if ($r->master_id && $status === 'approved') {{-- Employee has assignment and evaluation master and it's approved - show View button --}} @else {{-- All other statuses - show Detail button (unlock is on detail page) --}} @php // For incomplete status, ensure master record exists $detailMasterId = $r->master_id; if (!$detailMasterId) { $incompleteMaster = DB::table( 'trs_pa_evaluation_master', ) ->where('employee_nik', $r->employee_nik) ->where('period_id', $activePeriod->id) ->first(); if (!$incompleteMaster) { // Create master record if it doesn't exist $detailMasterId = DB::table( 'trs_pa_evaluation_master', )->insertGetId([ 'employee_nik' => $r->employee_nik, 'period_id' => $activePeriod->id, 'status' => 'in_progress', 'isactive' => '1', 'created_at' => now(), 'updated_at' => now(), 'user_create' => auth()->user()->username ?? auth()->user()->id, 'user_update' => auth()->user()->username ?? auth()->user()->id, ]); } else { $detailMasterId = $incompleteMaster->id; } } @endphp @endif @endif
{{ ($rows->currentPage() - 1) * $rows->perPage() + $loop->iteration }}
{{ $r->employee_name }} - {{ $r->employee_nik }}
{!! $positionDisplay !!} {!! $departmentDisplay !!} {{ $statusBadge['text'] }} @if ($r->has_late_unlock) TERLAMBAT @endif @if ($r->master_id)
{{ $progressText }}
@endif
@php $isPaginator = $rows instanceof \Illuminate\Pagination\AbstractPaginator; $totalData = $isPaginator ? $rows->total() : $rows->count(); $firstItem = $isPaginator ? $rows->firstItem() ?? 0 : ($totalData > 0 ? 1 : 0); $lastItem = $isPaginator ? $rows->lastItem() ?? $totalData : $totalData; @endphp
@if ($totalData > 0) Data {{ $firstItem }} - {{ $lastItem }} dari {{ $totalData }} data. @else Tidak ada data. @endif
@if ($isPaginator)
{{ $rows->appends(request()->query())->links('pagination::bootstrap-4') }}
@endif
{{-- Legend --}}
@endsection @push('js') @endpush