@extends('admin.layouts.app') @section('title', get_setting('site_name').' | '.__('Instance #').$instance->id) @section('content') @php $paperWorkflow = \App\Models\PerformanceAppraisalSetting::settings()->paperFormWorkflow(); $stages = \App\Support\PerformanceAppraisal\AppraisalStages::ordered(); $currentStageIdx = \App\Support\PerformanceAppraisal\AppraisalStages::index($instance->current_stage); if ($currentStageIdx === false) { $currentStageIdx = 0; } $workflowStopped = ! $instance->isActive(); $workflowComplete = in_array($instance->status, [ \App\Models\AppraisalInstance::STATUS_FINALIZED, \App\Models\AppraisalInstance::STATUS_CLOSED, ], true); $canClose = $workflowStopped === false; @endphp
@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif {{-- Hero header --}}

{{ __('Appraisal instance') }} #{{ $instance->id }}

@include('partials.appraisal_status_badge', [ 'label' => $instance->listDisplayStatus($paperWorkflow), 'variant' => $instance->listDisplayStatusVariant(), 'title' => $instance->isActive() ? \App\Models\AppraisalInstance::statusLabel($instance->status) : null, 'class' => 'lg', ])

{{ $instance->staff?->user?->name ?? '—' }} · {{ $instance->cycle?->name ?? '—' }} · {{ __('User ID') }} {{ $instance->staff?->user_id ?? '—' }}

@include('partials.appraisal_eval_form_banner', ['title' => $instance->evaluationForm?->title])
{{ __('Final score') }}
{{ $instance->final_total_score !== null ? number_format((float) $instance->final_total_score, 2).'%' : '—' }}
{{ __('Back') }}
{{-- Stage progress --}}
@foreach($stages as $idx => $stageKey) @php $isDone = $workflowComplete || ($workflowStopped && $idx < $currentStageIdx) || (! $workflowStopped && ! $workflowComplete && $idx < $currentStageIdx); $isActive = ! $workflowStopped && ! $workflowComplete && $idx === $currentStageIdx; @endphp
@if($isDone)@else{{ $idx + 1 }}@endif
{{ \App\Support\PerformanceAppraisal\AppraisalStages::label($stageKey, $paperWorkflow) }}
@endforeach
{{-- Summary meta --}}
{{ __('Overview') }}
{{ __('Status') }}

{{ $instance->listDisplayStatus($paperWorkflow) }}

{{ __('Evaluation period') }}

{{ $instance->evaluation_period_from?->format('d/m/Y') ?? '—' }} – {{ $instance->evaluation_period_to?->format('d/m/Y') ?? '—' }}

{{ __('Period label') }}

{{ $instance->period_label ?? '—' }}

{{ __('Due date') }}

{{ $instance->due_at?->format('d/m/Y') ?? '—' }}

@if($paperWorkflow)
{{ __('Org. join date') }}

{{ $instance->organization_join_date?->format('d/m/Y') ?? '—' }}

{{ __('Schedule join date') }}

{{ $instance->schedule_join_date?->format('d/m/Y') ?? '—' }}

{{ __('Branch join date') }}

{{ $instance->branch_join_date?->format('d/m/Y') ?? '—' }}

@endif
{{ __('Evaluation form') }}

{{ $instance->evaluationForm?->title ?? '—' }}

@if($instance->evaluationForm?->description) {{ $instance->evaluationForm->description }} @endif
@if(! empty($evaluatorWarnings))
{{ __('Evaluator configuration warnings') }}
    @foreach($evaluatorWarnings as $warn)
  • {{ $warn }}
  • @endforeach

{{ __('Assign evaluators when creating a new instance, or use “Suggest from supervisor chain” on the create form as a starting point.') }}

@endif
{{ __('Evaluator chain (by stage)') }}
@foreach($evaluatorChain as $row) @endforeach
{{ __('Stage') }} {{ __('Evaluator') }} {{ __('Note') }}
{{ $row['label'] }} {{ $row['evaluator_name'] ?? '—' }} ID: {{ $row['evaluator_user_id'] ?? '—' }} {{ $row['warning'] ?? '' }}
@php $chainUserIds = $instance->meta['supervisor_chain_user_ids'] ?? []; @endphp @if(! empty($chainUserIds))

{{ __('Supervisor chain (user IDs, nearest first)') }}: {{ implode(' → ', $chainUserIds) }}

@endif
{{ __('Submission history') }} {{ __('Print full history') }}
@include('admin.performance_appraisal.partials.submission_history_block', ['submissionRows' => $submissionRows])
@if(! empty($showProbationDecision)) {{ __('HR data & employment decision') }} @else {{ __('HR recommendation & notes') }} @endif {{ __('Print form copy') }}
@if(! empty($showProbationDecision)) @include('admin.performance_appraisal.partials.probation_outcome_block', [ 'instance' => $instance, 'leaveGroups' => $leaveGroups, 'probationMinExtensionDate' => $probationMinExtensionDate, 'pfFeatureOn' => $pfFeatureOn ?? false, 'gfFeatureOn' => $gfFeatureOn ?? false, 'swfFeatureOn' => $swfFeatureOn ?? false, 'pfAccount' => $pfAccount ?? null, 'pfSettings' => $pfSettings ?? null, 'gfAccount' => $gfAccount ?? null, 'gfSettings' => $gfSettings ?? null, 'swfAccount' => $swfAccount ?? null, 'swfSettings' => $swfSettings ?? null, ])
@endif
@csrf
{{ __('Appraisal notes & dates') }}

{{ __('Update evaluation period, join dates used on the paper form, and qualitative notes.') }}

@if(empty($showProbationDecision))

{{ __('Select one recommendation (same as paper form).') }}

@foreach($decisionOptions as $opt)
probation_recommendation) === $opt->code) required>
@endforeach {{ __('Manage checklist options') }}
@endif
@foreach(['strength_1', 'strength_2', 'strength_3', 'weakness_1', 'weakness_2', 'weakness_3'] as $field)
@endforeach
{{ __('360° feedback') }} @if($instance->peerFeedback->whereNotNull('submitted_at')->isNotEmpty()) {{ $instance->peerFeedback->whereNotNull('submitted_at')->count() }}/{{ $instance->peerFeedback->count() }} {{ __('submitted') }} @endif
@csrf
@if($instance->peerFeedback->isEmpty())

{{ __('No 360° reviewers assigned yet.') }}

@else @foreach($instance->peerFeedback as $p) @php $relLabel = \App\Support\PerformanceAppraisal\AppraisalPeerRelationships::label($p->relationship); $collapseId = 'peer-feedback-'.$p->id; @endphp
{{ $p->reviewer?->user?->name ?? '—' }} {{ $relLabel }}
@if($p->submitted_at) {{ __('Submitted') }} {{ $p->submitted_at->format('d/m/Y H:i') }} @if($p->score !== null) {{ number_format((float) $p->score, 2) }}% @endif @if(is_array($p->responses) && $p->responses !== []) @endif @else {{ __('Pending') }} @endif
@if($p->submitted_at && is_array($p->responses) && $p->responses !== [])
@include('partials.appraisal_peer_responses_table', [ 'form' => $instance->evaluationForm, 'responses' => $p->responses, 'compact' => true, ])
@endif
@endforeach @endif
@if($instance->pips->isNotEmpty())
{{ __('PIP') }}
@foreach($instance->pips as $pip)

{{ $pip->status }} — {{ $pip->notes }}

@endforeach
@endif
@endsection @section('script') @include('admin.performance_appraisal.partials.instance_delete_confirm_script') @endsection