{{ __('Admin') }} {{ __('Support') }} {{ __('Playbooks') }}
{{ __('Admin · Support · Playbooks') }}

{{ __('Reply') }} {{ __('playbooks') }}

{{ __('Reusable sequences of actions — apply with one click from any ticket. Each playbook runs its steps in order (set status, send reply, assign agent, etc.).') }}

@if (session('success'))
{{ session('success') }}
@endif
{{ __('Total') }}
{{ $kpi['total'] }}
{{ __('Active') }}
{{ $kpi['active'] }}
{{ __('Runs (all-time)') }}
{{ $kpi['uses'] }}

{{ __('Playbook library') }}

@forelse ($playbooks as $p)

{{ $p->name }}

{{ $p->is_active ? 'active' : 'paused' }} {{ $p->trigger_type }}{{ $p->trigger_value ? ': ' . $p->trigger_value : '' }}
{{ count((array) $p->steps) }} steps · used {{ $p->use_count }}× · {{ $p->slug }}
@if (!empty($p->steps))
@foreach ((array) $p->steps as $s) {{ $actions[$s['action'] ?? '']['label'] ?? ($s['action'] ?? '?') }}{{ !empty($s['value']) ? ': ' . Str::limit($s['value'], 24) : '' }} @endforeach
@endif
@csrf
@csrf @method('DELETE')
@empty {{-- Helpful empty state: explains what playbooks are, shows two common starter examples, balances the layout against the tall builder card on the right. --}}

{{ __('No playbooks yet') }}

{{ __("A playbook bundles a few actions you'd normally do one-by-one — apply with one click from any ticket.") }}

{{ __('Common starters') }}
{{ __('Refund · standard') }}
{{ __('Send refund template → Mark resolved → Tag "refund"') }}
{{ __('Escalate · urgent') }}
{{ __('Set priority urgent → Assign on-call agent → Internal note') }}
{{ __('Pause · awaiting customer') }}
{{ __('Set status pending → Send "we need more info" reply') }}

{{ __('Build any of these on the right →') }}

@endforelse