@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
{{ $title_menu }}
@include('components.alert')
{{-- Status Notice for Approved --}} @if ($master->status === 'approved')
Status: Evaluasi ini telah disetujui dan tidak dapat diubah lagi. @if (isset($master->approved_at))
Disetujui pada: {{ \Carbon\Carbon::parse($master->approved_at)->format('d M Y H:i') }} @endif
@endif {{-- Employee Information --}}
Informasi Karyawan
NIP : {{ $master->employee_nip ?? '-' }}
Nama : {{ $master->employee_name }}
Periode Evaluasi
Periode : Q{{ $master->quarter }} {{ $master->year }}
Durasi : {{ $format->tanggal($master->start_date) }} - {{ $format->tanggal($master->end_date) }}
Status : @php // Get period status $period = DB::table('mst_period')->where('id', $master->period_id)->first(); $isPeriodLocked = $period && $period->status === 'locked'; // Get evaluation data $status = $master->status ?? 'in_progress'; // Calculate submitted months and check for missing evaluations $submittedMonths = 0; $hasMissingEvaluationsShow = false; // Count submitted evaluation segments if (isset($segmentsByMonth) && !empty($segmentsByMonth)) { foreach ($segmentsByMonth as $segment) { if ($segment && isset($evaluationItems[$segment->id]) && count($evaluationItems[$segment->id]) > 0) { $submittedMonths++; } } } // Check for missing evaluations by comparing required vs submitted $startDate = \Carbon\Carbon::parse($master->start_date)->startOfMonth(); $endDate = \Carbon\Carbon::parse($master->end_date)->startOfMonth(); $currentMonth = $startDate->copy(); $requiredMonths = 0; while ($currentMonth <= $endDate) { $monthKey = $currentMonth->format('Y-m'); $isRestMonth = isset($restMonths[$monthKey]); if (!$isRestMonth) { $requiredMonths++; } $currentMonth->addMonth(); } $hasMissingEvaluationsShow = $submittedMonths < $requiredMonths; // Determine combined status based on 4-status logic (matching edit view) $combinedStatus = 'sedang_berjalan'; 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 → Sedang Berjalan $combinedStatus = 'sedang_berjalan'; } // Status badge styling (4-status system - matching edit view) $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)), ]; @endphp {{ $statusBadge['text'] }} @if (isset($master->has_late_unlock) && $master->has_late_unlock) TERLAMBAT @endif
{{-- Evaluation Display (Read-only) --}}
Evaluasi Per Standard Set
@if (empty($standardSetTabs))
Tidak ada data periode evaluasi.
@else {{-- Position Tabs --}} {{-- Tab Content --}} {{-- Tab Content --}}
@foreach ($standardSetTabs as $positionKey => $setData)
{{ $setData['position_name'] ?? '-' }} — {{ isset($setData['month_labels']) ? implode(', ', $setData['month_labels']) : '-' }}
@php $tabKey = $positionKey; $allStandardItems = collect(); if (isset($standardItemsBySet[$tabKey])) { $allStandardItems = $standardItemsBySet[$tabKey]; } @endphp @if ($allStandardItems->isNotEmpty())
@foreach ($setData['months'] as $monthKey) @php $monthLabel = \Carbon\Carbon::createFromFormat( 'Y-m', $monthKey, )->format('M Y'); $segment = $segmentsByMonth[$monthKey] ?? null; $restMonth = $restMonths[$monthKey] ?? null; @endphp @if ($restMonth) @elseif($segment) @else @endif @endforeach @foreach ($setData['months'] as $monthKey) @php $segment = $segmentsByMonth[$monthKey] ?? null; $restMonth = $restMonths[$monthKey] ?? null; @endphp @if ($restMonth) @elseif($segment) @else @endif @endforeach @foreach ($allStandardItems as $standardItem) @foreach ($setData['months'] as $monthKey) @php $segment = $segmentsByMonth[ $monthKey ] ?? null; $restMonth = $restMonths[$monthKey] ?? null; $evaluationItem = null; // Find evaluation item for this standard item and segment if ( $segment && isset( $evaluationItems[ $segment->id ], ) ) { // First try exact match by standard_item_id $evaluationItem = $evaluationItems[ $segment->id ]->firstWhere( 'standard_item_id', $standardItem->id, ); // If no exact match, try matching by name and order only if (!$evaluationItem) { $evaluationItem = $evaluationItems[ $segment->id ]->first(function ( $item, ) use ($standardItem) { return $item->item_name === $standardItem->name && $item->item_order == $standardItem->order; }); } } @endphp @if ($restMonth) @elseif($evaluationItem) {{-- Bobot --}} {{-- Rating --}} {{-- Alasan Revisi --}} {{-- Score --}} @elseif($segment) {{-- Segment ada, item evaluasi tidak ada --}} @else {{-- Tidak ada segment --}} @endif @endforeach @endforeach
Standar PA {{ $monthLabel }} ({{ ucfirst($restMonth->reason) }}) {{ $monthLabel }} @if (isset($lateMonths[$monthKey]) && $lateMonths[$monthKey]) TERLAMBAT @endif {{ $monthLabel }} (Kosong)
- - - - Bobot (%) Rating Alasan Revisi Score- - - -
{{ $standardItem->name }} Sedang Cuti {{ rtrim(rtrim(number_format($evaluationItem->final_weight ?? ($evaluationItem->item_weight ?? $standardItem->weight), 2), '0'), '.') }}% @if ($evaluationItem->is_revised && $evaluationItem->revision_reason) {{ $evaluationItem->final_rating_score }} ( {{ $evaluationItem->original_rating_score }} ) @else {{ $evaluationItem->final_rating_score }} @endif @if ($evaluationItem->is_revised && $evaluationItem->revision_reason) {{ $evaluationItem->revision_reason }}@else- @endif {{ rtrim(rtrim(number_format($evaluationItem->weighted_score ?? 0, 2), '0'), '.') }} - No Data - - Belum Dinilai
@else
Tidak ada standard item untuk posisi ini.
@endif
@endforeach
@endif
@endsection @push('js') @endpush