@extends('admin::layouts.app') @section('title', "{$template->name} — Admin") @section('content')

{{ $template->name }}

{{ $template->business->name ?? 'Unknown Business' }} · {{ $template->category }} · {{ $template->language }}

{{ $template->status }}
@if ($errors->any())
@foreach ($errors->all() as $error)
{{ $error }}
@endforeach
@endif @if(session('success')) @endif @if(session('error')) @endif
{{-- Left: Edit form --}}
@if($template->status === 'REJECTED' && $template->rejection_reason)
Rejected by Meta: {{ $template->rejection_reason }}
@endif @if($template->meta_error)
Last Meta API Error

"{{ $template->meta_error['message'] ?? 'Unknown error' }}"

@if(!empty($template->meta_error['type']))
Type: {{ $template->meta_error['type'] }}
@endif @if(!empty($template->meta_error['code']))
Code: {{ $template->meta_error['code'] }}{{ !empty($template->meta_error['error_subcode']) ? ' / ' . $template->meta_error['error_subcode'] : '' }}
@endif @if(!empty($template->meta_error['fbtrace_id']))
Trace ID: {{ $template->meta_error['fbtrace_id'] }}
@endif @if(!empty($template->meta_error['error_user_msg']))
Detail: {{ $template->meta_error['error_user_msg'] }}
@endif
Show full response
{{ json_encode($template->meta_error, JSON_PRETTY_PRINT) }}
@endif
@csrf @method('PUT') {{-- Basic Info --}}
Basic Info
@error('name')
{{ $message }}
@enderror
@error('category')
{{ $message }}
@enderror
@error('language')
{{ $message }}
@enderror
{{-- Header --}}
Header — optional TEXT
@error('header_text')
{{ $message }}
@enderror @if(!empty($template->header_examples))
@endif
{{-- Body --}}
Body *
@error('body')
{{ $message }}
@enderror @if(!empty($template->body_examples))

Variable examples:

@foreach($template->body_examples as $i => $ex)
@endforeach
@endif
{{-- Footer --}}
Footer — optional
@error('footer')
{{ $message }}
@enderror
{{-- Buttons --}}
Buttons — optional, max 3
@forelse($template->buttons ?? [] as $i => $btn)
Button {{ $i + 1 }}
@error("buttons.$i.url")
{{ $message }}
@enderror
Include country code, e.g. +919876543210
@error("buttons.$i.phone_number")
{{ $message }}
@enderror
@empty

No buttons on this template.

@endforelse
{{-- Template for new button rows (hidden) --}}
{{-- Admin Notes --}}
Admin Notes
Cancel
{{-- Right: Preview + Actions + Meta info --}}
{{-- WhatsApp Preview --}}
Preview
@if($template->header_text)
{{ $template->header_text }}
@endif
{{ $template->body }}
@if($template->footer)
{{ $template->footer }}
@endif
@if(!empty($template->buttons))
@foreach($template->buttons as $button)
@if($button['type'] === 'QUICK_REPLY') @else @endif {{ $button['text'] }}
@endforeach
@endif
{{-- Submit to Meta --}} @if($template->status === 'DRAFT')
Submit to Meta

Once you're satisfied with this template, submit it to Meta's WhatsApp Cloud API using the business's credentials. The status will change to PENDING.

@csrf
@endif {{-- Refresh status --}} @if($template->status !== 'DRAFT')
Sync Status

Fetch the latest approval status from Meta.

@csrf
@endif {{-- Meta Details --}}
Details
Business
{{ $template->business->name ?? '—' }}
Category
{{ $template->category }}
Language
{{ $template->language }}
@if($template->meta_template_id)
Meta ID
{{ $template->meta_template_id }}
@endif @if($template->submitted_at)
Submitted
{{ $template->submitted_at->format('d M Y, H:i') }}
@endif
Created
{{ $template->created_at->format('d M Y') }}
@endsection