@extends('layouts.app') @section('title', __('Review Detail')) @section('content')
@include('partials.messages') @php $currentUser = auth()->user(); $canManage = $currentUser->hasPermission('performance.manage'); $isAppraisee = $review->isAppraisee($currentUser); $isAppraisor = $review->isAppraisor($currentUser); @endphp

{{ __('Review #:n - :name', ['n' => $review->review_number, 'name' => trim($review->user->first_name . ' ' . $review->user->last_name)]) }}

{{ __('Back to Reviews') }}
{{ __('Contract') }}
{{ $review->performance->contract->title ?? '—' }}
{{ __('Due Date') }}
{{ $review->due_date->format('M j, Y') }}
{{ __('Status') }}
{{ ucfirst(str_replace('_', ' ', $review->status)) }}
{{ __('Overall Score') }}
@if($review->overall_score !== null) @include('performance.partials.score-badge', ['score' => $review->overall_score]) @else {{ __('Not finalized yet') }} @endif
{{-- Stage actions --}}
@if($isAppraisee && $review->status === 'scheduled') {{ __('Submit Self-Assessment') }} @endif @if($isAppraisor && $review->status === 'appraisee_submitted') {{ __('Submit Appraisor Review') }} @endif @if(( $isAppraisor || $canManage) && $review->status === 'appraisor_submitted') {{ __('Enter Final Review') }} @endif
{{ __('KPI Scores') }}
@foreach($review->performance->components as $component) @foreach($component->kpis as $kpi) @foreach(['appraisee', 'appraisor', 'final'] as $stage) @endforeach @endforeach @endforeach
{{ __('Component / KPI') }} {{ __('Appraisee') }} {{ __('Appraisor') }} {{ __('Final') }}
{{ $component->title }} ({{ __('weight :w', ['w' => $component->weight]) }})
{{ $kpi->title }} ({{ __('weight :w', ['w' => $kpi->weight]) }}) @php $score = $stages[$stage]->get($kpi->id); @endphp @if($score) {{ number_format($score->score, 1) }}/5 @if($score->justification) @endif @if($score->attachments->isNotEmpty())
@foreach($score->attachments as $attachment) {{ $attachment->original_name }}
@endforeach
@endif @if($score->justification)
{!! $score->justification !!}
@endif @else @endif
{{ __('Sign-off') }}

{{ __('Available once the final review is complete. Appraisee and appraisor each confirm they agree with the final verdict, then the admin/manager signs as final authority.') }}

@include('performance.reviews._signature-block', [ 'role' => 'appraisee', 'label' => __('Appraisee'), 'signedAt' => $review->appraisee_signed_at, 'canSign' => $isAppraisee && !$review->appraisee_signed_at && in_array($review->status, ['final_pending', 'completed']), ])
@include('performance.reviews._signature-block', [ 'role' => 'appraisor', 'label' => __('Appraisor'), 'signedAt' => $review->appraisor_signed_at, 'canSign' => $isAppraisor && !$review->appraisor_signed_at && in_array($review->status, ['final_pending', 'completed']), ])
@include('performance.reviews._signature-block', [ 'role' => 'authority', 'label' => __('Authority (Admin/Manager)'), 'signedAt' => $review->authority_signed_at, 'canSign' => $canManage && !$review->authority_signed_at && in_array($review->status, ['final_pending', 'completed']), ])
@endsection