@extends('employee.layouts.app') @section('title', get_setting('site_name').' | '.__('Appraisal #').$record->id) @section('content') @php $cycleLabels = [ \App\Models\StaffAppraisalRecord::CYCLE_THREE_MONTH => __('3-month probation review'), \App\Models\StaffAppraisalRecord::CYCLE_SIX_MONTH => __('6-month review'), \App\Models\StaffAppraisalRecord::CYCLE_ANNUAL => __('Annual appraisal'), ]; $tpl = $record->template; $kpis = $tpl?->kpi_schema ?? []; $evals = $tpl?->evaluation_schema ?? []; $kpiResp = old('kpi', $record->kpi_response ?? []); $evalResp = old('eval', $record->evaluation_response ?? []); if (! is_array($kpiResp)) { $kpiResp = []; } if (! is_array($evalResp)) { $evalResp = []; } @endphp
{{ __('Appraisal') }} #{{ $record->id }}
{{ __('Back to list') }}
{{ __('Template') }}
{{ $tpl?->name ?? '—' }}
{{ __('Cycle') }}
{{ $cycleLabels[$record->cycle_type] ?? $record->cycle_type }}
{{ __('Status') }}
{{ $record->status }}
@if($record->due_date)
{{ __('Due date') }}
{{ $record->due_date->format('Y-m-d') }}
@endif
@if($record->status === \App\Models\StaffAppraisalRecord::STATUS_DRAFT && $tpl)
@csrf @if(count($kpis))
{{ __('KPIs') }}
@foreach($kpis as $k) @php $kid = $k['id'] ?? null; $label = $k['label'] ?? $kid; $input = $k['input'] ?? 'text'; $val = $kpiResp[$kid] ?? ''; @endphp @continue(!$kid)
@if($input === 'rating_1_5') @elseif($input === 'number') @else @endif
@endforeach
@endif @if(count($evals))
{{ __('Evaluation') }}
@foreach($evals as $e) @php $eid = $e['id'] ?? null; $label = $e['label'] ?? $eid; $input = $e['input'] ?? 'text'; $val = $evalResp[$eid] ?? ''; @endphp @continue(!$eid)
@if($input === 'rating_1_5') @elseif($input === 'number') @else @endif
@endforeach
@endif
@elseif($record->status !== \App\Models\StaffAppraisalRecord::STATUS_DRAFT)
{{ __('Your responses') }}
@if(count($kpis))
{{ __('KPIs') }}
@foreach($kpis as $k) @php $kid = $k['id'] ?? null; @endphp @if($kid)
{{ $k['label'] ?? $kid }}
{{ is_scalar($kpiResp[$kid] ?? null) ? ($kpiResp[$kid] ?? '—') : json_encode($kpiResp[$kid] ?? null) }}
@endif @endforeach
@endif @if(count($evals))
{{ __('Evaluation') }}
@foreach($evals as $e) @php $eid = $e['id'] ?? null; @endphp @if($eid)
{{ $e['label'] ?? $eid }}
{{ is_scalar($evalResp[$eid] ?? null) ? ($evalResp[$eid] ?? '—') : json_encode($evalResp[$eid] ?? null) }}
@endif @endforeach
@endif
@else
{{ __('This appraisal has no template configured. Contact HR.') }}
@endif
@endsection