@php $docTitle = $docTitle ?? 'Document'; $indexRoute = $indexRoute ?? ''; $updateRoute = $updateRoute ?? ''; $tab = $tab ?? 'options'; $labelGroups = [ 'headers' => ['title' => 'Document labels', 'desc' => 'Titles, addresses, and header text', 'icon' => 'ri-file-text-line', 'keys' => []], 'columns' => ['title' => 'Table columns', 'desc' => 'Headings for line items on the document', 'icon' => 'ri-table-line', 'keys' => []], 'copies' => ['title' => 'Copy labels', 'desc' => 'Wording on duplicate & triplicate copies', 'icon' => 'ri-file-copy-line', 'keys' => []], 'custom' => ['title' => 'Custom fields', 'desc' => 'Optional extra fields on the document', 'icon' => 'ri-edit-box-line', 'keys' => []], ]; foreach (array_keys($labelDefs ?? []) as $key) { if (str_starts_with($key, 'col_')) { $labelGroups['columns']['keys'][] = $key; } elseif (str_starts_with($key, 'custom_field')) { $labelGroups['custom']['keys'][] = $key; } elseif (str_starts_with($key, 'copy_')) { $labelGroups['copies']['keys'][] = $key; } else { $labelGroups['headers']['keys'][] = $key; } } $labelGroups = array_values(array_filter($labelGroups, fn ($g) => count($g['keys']) > 0)); $optionGroupMeta = [ 'layout' => ['title' => 'Layout & addresses', 'icon' => 'ri-layout-masonry-line'], 'totals' => ['title' => 'Totals & amounts', 'icon' => 'ri-money-rupee-circle-line'], 'parties' => ['title' => 'Customer & vendor', 'icon' => 'ri-user-line'], 'signatures' => ['title' => 'Signatures', 'icon' => 'ri-quill-pen-line'], 'content' => ['title' => 'Content', 'icon' => 'ri-article-line'], 'general' => ['title' => 'General', 'icon' => 'ri-settings-3-line'], ]; $optionGroups = []; foreach ($optionDefs ?? [] as $key => $def) { $group = 'general'; if (str_contains($key, 'signature')) { $group = 'signatures'; } elseif (str_contains($key, 'shipping') || str_contains($key, 'header')) { $group = 'layout'; } elseif (str_contains($key, 'contact') || str_contains($key, 'bill_to') || str_contains($key, 'quote_to') || str_contains($key, 'vendor')) { $group = 'parties'; } elseif (str_contains($key, 'terms')) { $group = 'content'; } elseif (preg_match('/(total|amount|due|net|tax|words|received|paid)/', $key)) { $group = 'totals'; } $optionGroups[$group][$key] = $def; } @endphp
{{ $docTitle }}

Control PDF/print layout and customize field labels for your company.

Options What to show Labels & columns Wording on document
@if($tab === 'labels')
@csrf @method('PUT')
Tip: Edit any label below. Text appears on PDFs and printouts. Use Reset on a field to restore the default.
@foreach($labelGroups as $groupIndex => $group)
{{ $group['title'] }}

{{ $group['desc'] }}

@foreach($group['keys'] as $key) @php $def = $labelDefs[$key]; $value = old('labels.'.$key, $labels[$key] ?? $def['default']); $isModified = trim((string) $value) !== trim((string) $def['default']); @endphp
@if($isModified) Custom @endif Default: {{ $def['default'] }} @error('labels.'.$key)
{{ $message }}
@enderror
@endforeach
@endforeach @include('admin.preferences.partials.document-settings-footer')
@else
@csrf @method('PUT')
Choose what appears when this document is printed or saved as PDF. Changes apply to all {{ strtolower($docTitle) }} for your company.
Quick actions
@forelse($optionGroups as $groupKey => $groupOptions) @php $meta = $optionGroupMeta[$groupKey] ?? $optionGroupMeta['general']; @endphp
{{ $meta['title'] }}
    @foreach($groupOptions as $key => $def)
  • @endforeach
@empty

No options configured for this document type.

@endforelse @include('admin.preferences.partials.document-settings-footer')
@endif
@push('scripts') @endpush