@extends('layouts.app') @section('title', 'Letter Templates') @section('breadcrumbs') @endsection @section('content')
{{-- Header --}}

Letter Templates

Manage letter templates for document generation

New Template
@if(auth()->user()->role !== 'super_admin') {{-- Tabs: All / Global / Company --}}
@foreach(['all' => 'All Templates', 'global' => 'Global', 'company' => 'Company-Specific'] as $key => $label) @endforeach
@endif {{-- Category Filter --}}
All Categories @foreach($categories as $key => $label) {{ $label }} @endforeach
{{-- Templates Grid --}} @if($templates->isEmpty())

No templates found

Create your first letter template to start generating documents.

@else
@foreach($templates as $template)
{{ $template->is_global ? 'Global' : 'Company' }} {{ $template->category_label }}
@if(!$template->is_active) Inactive @endif

{{ $template->name }}

Created by {{ $template->creator?->name ?? 'System' }} ยท {{ $template->created_at->format('d M Y') }}

@if($template->variables_used && count($template->variables_used) > 0)

{{ count($template->variables_used) }} variable(s) used

@endif
@php $editRoute = auth()->user()->role === 'super_admin' ? route('admin.letter-templates.edit', $template->id) : route('letters.templates.edit', $template->id); $deleteRoute = auth()->user()->role === 'super_admin' ? route('admin.letter-templates.destroy', $template->id) : route('letters.templates.destroy', $template->id); @endphp Edit @if(!$template->is_global || auth()->user()->role === 'super_admin')
@csrf @method('DELETE')
@endif
@endforeach
{{ $templates->withQueryString()->links() }}
@endif
@endsection