@extends('layouts.main') @section('title', 'Template: ' . $template->name) @section('container') @if(session('success')) @endif @if(session('error')) @endif

{{ $template->name }}

@if($template->description)
{{ $template->description }}
@endif
@php $sc = ['draft'=>'s-draft','active'=>'s-active','archived'=>'s-archived'][$template->status] ?? 's-draft'; @endphp {{ ucfirst($template->status) }} v{{ $template->current_version }}
{{-- Action buttons --}} @if(Auth::user()->hasActionAccess('ai_report.manage') || Auth::user()->isSuperAdmin())
@csrf
@if($template->status === 'draft')
@csrf
@endif @endif @if(Auth::user()->hasActionAccess('ai_report.delete') || Auth::user()->isSuperAdmin())
@csrf @method('DELETE')
@endif All Templates
{{-- ── JSON Config ──────────────────────────────────────────── --}}
Mapping Configuration (JSON)
v{{ $template->current_version }} — config.json
{{ json_encode($template->config_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
{{-- ── PHP Parser ───────────────────────────────────────────── --}}
@php $latestV = $template->getLatestVersion(); @endphp
Generated PHP Parser
@if($latestV && $latestV->hasParser()) @endif
@if($latestV && $latestV->hasParser())
{{ $latestV->parser_class_name }} v{{ $latestV->version_number }}
{{ $latestV->generated_parser_code }}
@else

No PHP parser generated yet

The parser lets you run this report without calling OpenAI.

@if(Auth::user()->hasActionAccess('ai_report.manage') || Auth::user()->isSuperAdmin())
@csrf
@endif
@endif
{{-- ── Version History ──────────────────────────────────────── --}}
Version History
@foreach($template->versions as $v) @endforeach
Version Changelog PHP Parser Created By Date
v{{ $v->version_number }} @if($v->version_number === $template->current_version) Current @endif {{ $v->changelog ?: '—' }} @if($v->hasParser()) {{ $v->parser_class_name }} @else — @endif {{ $v->creator?->name ?? '—' }} {{ $v->created_at->format('d M Y H:i') }}
@endsection