@extends('admin.layouts.app') @section('title', 'Approval #' . $approval->id . ' - ' . __('admin.brand.name')) @section('page_title', 'Approval review') @push('styles') @endpush @section('content') @php $run = $approval->agentRun; $clean = static function ($value) { $value = trim((string) $value); return $value === '' || in_array($value, ['-', '—', '—', '—'], true) ? null : $value; }; $readable = static function ($value) use ($clean) { $value = $clean($value); return $value === null ? 'Not set' : \Illuminate\Support\Str::of($value)->replace(['_', '-'], ' ')->headline()->toString(); }; $isInvestor = $approval->investor_id !== null; $subjectName = $isInvestor ? ($approval->investor?->full_name_en ?: $approval->investor?->full_name_ar ?: '#'.$approval->investor_id) : ($approval->startup?->name ?: '#'.$approval->startup_id); $applicationNumber = $isInvestor ? $approval->investorApplication?->application_number : $approval->startupApplication?->round_number; $applicationId = $isInvestor ? $approval->investor_application_id : $approval->startup_investment_round_id; $applicationUrl = $isInvestor && $approval->investorApplication ? route('admin.investors.applications.show', [$approval->investor_id, $approval->investorApplication]) : (! $isInvestor && $approval->startupApplication ? route('admin.startups.investment-rounds.show', [$approval->startup_id, $approval->startupApplication]) : null); $from = $readable($approval->current_group ?: $approval->current_status); $to = $readable($approval->proposed_group ?: $approval->proposed_status ?: $approval->proposed_action); $steps = [ ['title' => 'Agent submitted proposal', 'time' => optional($run?->completed_at ?? $run?->started_at)->format('d M Y, H:i'), 'done' => $run !== null], ['title' => 'Approval request created', 'time' => optional($approval->created_at)->format('d M Y, H:i'), 'done' => true], ['title' => 'Opened by an admin', 'time' => optional($approval->viewed_at)->format('d M Y, H:i'), 'done' => $approval->viewed_at !== null], ['title' => $approval->isPending() ? 'Waiting for your decision' : 'Decision: '.ucfirst($approval->status), 'time' => optional($approval->decided_at)->format('d M Y, H:i'), 'done' => ! $approval->isPending()], ['title' => 'Execution: '.str_replace('_', ' ', $run?->execution_status ?? 'not started'), 'time' => $run && $run->execution_status !== 'not_started' ? optional($run->completed_at)->format('d M Y, H:i') : null, 'done' => in_array($run?->execution_status, ['executed','failed','blocked','cancelled'], true)], ]; @endphp
← Back to approvals @if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if (isset($errors) && $errors->any())
{{ $errors->first() }}
@endif
Human approval request #{{ $approval->id }}

{{ $subjectName }}

{{ $approval->agent?->name ?? $approval->agent_key }} requested an Application workflow change on {{ optional($approval->created_at)->format('d M Y, H:i') }}.

{{ ucfirst($approval->status) }}

Requested change

Review this before deciding
Current state{{ $from }}
→
Proposed state{{ $to }}

Operation {{ $approval->action_key }}@if($approval->proposed_status) · Proposed status {{ $readable($approval->proposed_status) }}@endif

Why the Agent requested this{{ $clean($approval->reason) ?: 'The Agent did not provide a reason.' }}

Request context

Application and audit references
Subject{{ $subjectName }}
Agent{{ $approval->agent?->name ?? $approval->agent_key }}
Agent code{{ $approval->agent?->agent_code ?? $approval->agent_key }}
Risk{{ ucfirst($approval->risk_level) }}
Confidence{{ $approval->confidence_score === null ? 'Not supplied' : number_format($approval->confidence_score * 100, 1).'%' }}
Expires{{ optional($approval->expires_at)->format('d M Y, H:i') ?: 'No expiry' }}
Correlation ID{{ $approval->correlation_id ?: 'Not set' }}
Policy version{{ $approval->policy_version ?? 'Not supplied' }}
@endsection