@extends('admin.layout')
@section('title', __('admin.pilot.title').' · '.__('admin.brand'))
@section('content')
@php
$latestMode = $latestReport['mode'] ?? 'missing';
$latestStatus = $latestReport['status'] ?? 'missing';
$latestStatusClass = match ($latestStatus) {
'verified', 'cleaned' => 'status-success',
'warning' => 'status-degraded',
'failed' => 'status-critical',
default => 'status-unknown',
};
$records = [];
foreach ((array) ($latestReport['operations'] ?? []) as $operation) {
foreach ((array) ($operation['records'] ?? []) as $record) {
$records[] = [
'target' => $operation['target'] ?? '—',
'phase' => $operation['phase'] ?? '—',
'entity_type' => $record['entity_type'] ?? '—',
'external_id' => $record['external_id'] ?? '—',
'name' => $record['name'] ?? '—',
'field_count' => $record['field_count'] ?? 0,
];
}
}
$visibleRecords = array_slice($records, 0, 150);
$latestTargets = array_values((array) ($latestReport['targets'] ?? []));
$stageGateHealthy = $readyForPilot && $stagingSafe && $snapshotCoversPreview;
$proposalTotal = (int) ($proposalSummary['total'] ?? 0);
$proposalPending = (int) ($proposalSummary['pending'] ?? 0);
$proposalAccepted = (int) ($proposalSummary['accepted'] ?? 0);
$proposalRejected = (int) ($proposalSummary['rejected'] ?? 0);
$proposalConflicts = (int) ($proposalSummary['conflicts'] ?? 0);
$proposalVisible = (array) ($proposalSummary['visible'] ?? []);
$proposalReviewDone = $proposalTotal > 0 && $proposalPending === 0;
@endphp
COASTER WORLD DATA · {{ $platformVersion }}
{{ __('admin.pilot.title') }}
{{ __('admin.pilot.subtitle') }}
✓
{{ $readyForPilot ? __('admin.yes') : __('admin.no') }}{{ __('admin.pilot.ready_audit') }}
◒
{{ $lockStates['provider_staging'] ? __('admin.pilot.enabled') : __('admin.pilot.locked') }}{{ __('admin.pilot.provider_staging') }}
⚡
{{ $webStagingArmed ? __('admin.pilot.armed_state') : __('admin.pilot.disarmed_state') }}{{ __('admin.pilot.web_arm') }}
⛨
{{ $snapshotReady ? __('admin.pilot.verified') : __('admin.pilot.missing') }}{{ __('admin.pilot.safety_snapshot') }}
{{ count($latestTargets) }}
{{ data_get($latestReport, 'summary.records_received', 0) }}{{ __('admin.pilot.latest_records') }}
{{ __('admin.pilot.safety_title') }}
{{ __('admin.pilot.safety_hint') }}
@foreach ([
'population' => __('admin.pilot.lock_population'),
'provider_schedules' => __('admin.pilot.lock_schedules'),
'provider_staging' => __('admin.pilot.lock_staging'),
'canonical_auto_apply' => __('admin.pilot.lock_canonical'),
'ai_agents' => __('admin.pilot.lock_ai'),
'research_execution' => __('admin.pilot.lock_research'),
] as $key => $label)
@php
$expectedOpen = $key === 'provider_staging';
$isEnabled = (bool) ($lockStates[$key] ?? false);
$isCorrect = $expectedOpen ? $isEnabled : ! $isEnabled;
@endphp
{{ $label }}{{ $expectedOpen ? __('admin.pilot.expected_enabled') : __('admin.pilot.expected_locked') }}
{{ $isEnabled ? __('admin.pilot.enabled') : __('admin.pilot.locked') }}
@endforeach
{{ $webStagingArmed ? __('admin.pilot.arm_active_title') : __('admin.pilot.arm_inactive_title') }}
{{ $webStagingArmed ? __('admin.pilot.arm_active_hint') : __('admin.pilot.arm_inactive_hint') }}
@if ($webStagingArmed)
@else
@endif
{{ __('admin.pilot.master_lock_note') }}
{{ __('admin.pilot.snapshot_title') }}
{{ __('admin.pilot.snapshot_hint') }}
{{ $snapshotReady ? __('admin.pilot.verified') : __('admin.pilot.action_required') }}
@if ($latestSnapshot)
{{ __('admin.pilot.snapshot_id') }}{{ $latestSnapshot['created_at'] ?? '—' }}{{ $latestSnapshot['snapshot_id'] ?? '—' }}
{{ __('admin.pilot.snapshot_verification') }}{{ data_get($latestSnapshot, 'verification.status', 'missing') }}
{{ __('admin.pilot.snapshot_replica') }}{{ data_get($latestSnapshot, 'replica.status', 'missing') }}
@else
{{ __('admin.pilot.no_snapshot') }}
@endif
{{ __('admin.pilot.workflow_title') }}
{{ __('admin.pilot.workflow_hint') }}
@foreach ([
['1', __('admin.pilot.workflow_search'), $query !== '' || $discovery !== []],
['2', __('admin.pilot.workflow_preview'), $latestMode === 'preview' || $latestMode === 'stage'],
['3', __('admin.pilot.workflow_snapshot'), $snapshotCoversPreview],
['4', __('admin.pilot.workflow_arm'), $webStagingArmed],
['5', __('admin.pilot.workflow_stage'), $latestMode === 'stage'],
['6', __('admin.pilot.workflow_proposals'), $proposalTotal > 0],
['7', __('admin.pilot.workflow_review'), $proposalReviewDone],
] as [$number, $label, $done])
{{ $number }}{{ $label }}
@endforeach
{{ __('admin.pilot.discovery_title') }}
{{ __('admin.pilot.discovery_hint', ['max' => $maxTargets]) }}
@if ($discoveryError)
{{ __('admin.pilot.discovery_failed', ['reason' => $discoveryError]) }}
@elseif ($query !== '' && $discovery === [])
{{ __('admin.pilot.discovery_empty') }}
@elseif ($discovery !== [])
@endif
{{ __('admin.pilot.latest_title') }}
{{ __('admin.pilot.latest_hint') }}
@if ($latestReport)
@if ($latestMode === 'preview')
@elseif ($latestMode === 'stage' && $latestStatus !== 'cleaned' && $proposalTotal === 0)
@elseif ($latestMode === 'stage' && $latestStatus !== 'cleaned')
@endif
@endif
@if (! $latestReport)
{{ __('admin.pilot.no_run') }}
@else
{{ __('admin.pilot.pilot_id') }}{{ $latestReport['pilot_id'] ?? '—' }}
{{ __('admin.pilot.mode') }}{{ strtoupper((string) $latestMode) }}
{{ __('admin.status') }}{{ strtoupper((string) $latestStatus) }}
{{ __('admin.pilot.records_received') }}{{ data_get($latestReport, 'summary.records_received', 0) }}
{{ __('admin.pilot.records_created') }}{{ data_get($latestReport, 'summary.records_created', 0) }}
{{ __('admin.pilot.records_reused') }}{{ data_get($latestReport, 'summary.records_reused', 0) }}
@if ($latestMode === 'preview' && ! $canStageLatestPreview)
{{ __('admin.pilot.stage_gate_hint') }}
@endif
@foreach ((array) ($latestReport['safety_guard'] ?? []) as $guard => $passed)
{{ __('admin.pilot.guards.'.$guard) }}{{ $passed ? 'PASS' : 'FAIL' }}
@endforeach
@if ($records !== [])
| {{ __('admin.pilot.phase') }} | {{ __('admin.type') }} | {{ __('admin.pilot.external_id') }} | {{ __('admin.name') }} | {{ __('admin.pilot.fields') }} |
@foreach ($visibleRecords as $record)
| {{ $record['phase'] }} |
{{ $record['entity_type'] }} |
{{ $record['external_id'] }} |
{{ $record['name'] }} |
{{ $record['field_count'] }} |
@endforeach
@if (count($records) > count($visibleRecords))
{{ __('admin.pilot.records_truncated', ['shown' => count($visibleRecords), 'total' => count($records)]) }}
@endif
@endif
@endif
@if ($latestReport && $latestMode === 'stage' && $latestStatus !== 'cleaned')
{{ __('admin.pilot.proposals_title') }}
{{ __('admin.pilot.proposals_hint') }}
{{ __('admin.pilot.proposals_total') }}{{ $proposalTotal }}
{{ __('admin.pilot.proposals_pending') }}{{ $proposalPending }}
{{ __('admin.pilot.proposals_accepted') }}{{ $proposalAccepted }}
{{ __('admin.pilot.proposals_rejected') }}{{ $proposalRejected }}
{{ __('admin.pilot.proposals_conflicts') }}{{ $proposalConflicts }}
{{ __('admin.pilot.proposals_safety_note') }}
@if ($proposalTotal === 0)
{{ __('admin.pilot.proposals_empty') }}
@else
@if ($proposalPending > 0)
@endif
|
{{ __('admin.status') }} |
{{ __('admin.type') }} |
{{ __('admin.name') }} |
{{ __('admin.pilot.source') }} |
{{ __('admin.pilot.confidence') }} |
{{ __('admin.pilot.evidence') }} |
{{ __('admin.actions') }} |
@foreach ($proposalVisible as $proposal)
@php
$proposalStatusClass = match ($proposal['status']) {
'accepted', 'approved' => 'status-success',
'rejected' => 'status-critical',
'pending' => 'status-degraded',
default => 'status-unknown',
};
@endphp
|
@if ($proposal['status'] === 'pending')
@else
—
@endif
|
{{ strtoupper((string) $proposal['status']) }}
@if (!empty($proposal['has_conflict']))
{{ __('admin.pilot.conflict') }}
@endif
|
{{ $proposal['entity_type'] }}
{{ $proposal['proposal_type'] }}
|
{{ $proposal['name'] }}
{{ $proposal['external_id'] ?? '—' }}
|
{{ $proposal['source_name'] }}
@if (!empty($proposal['source_url']))
{{ __('admin.pilot.open_source') }}
@endif
|
{{ $proposal['confidence'] !== null ? number_format($proposal['confidence'] * 100, 0).' %' : '—' }} |
{{ trans_choice('admin.pilot.evidence_count', $proposal['field_count'], ['count' => $proposal['field_count']]) }}
@foreach ($proposal['fields'] as $field)
{{ $field['field_key'] ?? '—' }}
{{ is_scalar($field['value'] ?? null) || ($field['value'] ?? null) === null ? (string) ($field['value'] ?? '—') : json_encode($field['value'], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }}
{{ $field['source_path'] ?? '—' }}@if(is_numeric($field['confidence'] ?? null)) · {{ number_format((float) $field['confidence'] * 100, 0) }} %@endif
@endforeach
|
@if ($proposal['status'] === 'pending')
@else
{{ $proposal['reviewed_by'] ?? '—' }}
@endif
|
@endforeach
@if (($proposalSummary['truncated'] ?? 0) > 0)
{{ __('admin.pilot.proposals_truncated', ['count' => $proposalSummary['truncated']]) }}
@endif
{{ __('admin.pilot.cleanup_proposals_note') }}
@endif
@endif
{{ __('admin.pilot.history_title') }}
{{ __('admin.pilot.history_hint') }}
@if ($recentReports === [])
{{ __('admin.pilot.history_empty') }}
@else
| {{ __('admin.pilot.pilot_id') }} | {{ __('admin.pilot.generated_at') }} | {{ __('admin.pilot.mode') }} | {{ __('admin.status') }} | {{ __('admin.pilot.targets') }} | {{ __('admin.pilot.records_created') }} |
@foreach ($recentReports as $report)
@php
$rowStatus = $report['status'] ?? 'missing';
$rowClass = match ($rowStatus) {
'verified', 'cleaned' => 'status-success',
'warning' => 'status-degraded',
'failed' => 'status-critical',
default => 'status-unknown',
};
@endphp
{{ $report['pilot_id'] ?? '—' }} |
{{ $report['generated_at'] ?? '—' }} |
{{ strtoupper((string) ($report['mode'] ?? '—')) }} |
{{ strtoupper((string) $rowStatus) }} |
{{ implode(', ', (array) ($report['targets'] ?? [])) }} |
{{ data_get($report, 'summary.records_created', 0) }} |
@endforeach
@endif
@endsection