@php /** @var \App\Models\DocumentBrandingVersion|null $active */ /** @var \App\Models\DocumentBrandingVersion|null $draft */ use App\Support\Navigation\WorkspaceEmbed; $cfg = (array) ($draft?->configuration_json ?? []); $wmOpacity = $cfg['watermark_opacity'] ?? 0.05; $wmScale = $cfg['watermark_scale'] ?? 'medium'; $wmText = $cfg['watermark_text'] ?? ''; $brandingEmbedded = WorkspaceEmbed::inWorkspaceContext(); $brandingTurboFrame = WorkspaceEmbed::formTurboFrame(); $headerLabels = [ 'system' => 'System generated', 'uploaded_banner' => 'Uploaded banner', 'logo_compact' => 'Compact logo', ]; $footerLabels = [ 'system' => 'System generated', 'uploaded_artwork' => 'Uploaded artwork', ]; $wmLabels = [ 'none' => 'None', 'logo' => 'Logo', 'confidential' => 'Confidential', 'draft' => 'Draft', 'copy' => 'Copy', 'custom_text' => 'Custom text', ]; $headerMode = old('header_mode', $draft->header_mode ?? 'system'); $footerMode = old('footer_mode', $draft->footer_mode ?? 'system'); $watermarkMode = old('watermark_mode', $draft->watermark_mode ?? 'none'); $hasHeaderAsset = is_array($draft->header_asset_json ?? null) && ! empty($draft->header_asset_json['path']); $hasFooterAsset = is_array($draft->footer_asset_json ?? null) && ! empty($draft->footer_asset_json['path']); @endphp System setup Company settings @include('loan.accounting.partials.flash') @if (isset($errors) && $errors->any()) @endif
How to use: @if ($canManage) Upload header/footer/stamp artwork (header and footer modes switch automatically) → save colours/text → preview → activate when satisfied. @else You can review branding settings @if ($canPreview) and generate a preview PDF @endif . Changes require manage permission. @endif Preview always uses the draft; live loan PDFs use the active version only. Disbursed or finalized application PDFs keep the branding that was active when they were issued.
@if ($headerMode === 'uploaded_banner' && ! $hasHeaderAsset)
Header mode is “Uploaded banner” but no header file is on this draft. Upload artwork or switch mode to System generated.
@endif @if ($footerMode === 'uploaded_artwork' && ! $hasFooterAsset)
Footer mode is “Uploaded artwork” but no footer file is on this draft. Upload artwork or switch mode to System generated.
@endif
Active
{{ $active ? 'v'.$active->version_number : 'None' }}
Draft
{{ $draft ? 'v'.$draft->version_number : '—' }}
Last activated
{{ $active?->activated_at?->format('d-M-Y H:i') ?? '—' }}
Activated by
{{ $active?->activatedByUser?->name ?? '—' }}
Header
{{ $headerLabels[$headerMode] ?? $headerMode }}
Footer
{{ $footerLabels[$footerMode] ?? $footerMode }}
Watermark
{{ $wmLabels[$watermarkMode] ?? $watermarkMode }}

Institution identity

Edit in Company Settings

Logo and legal identity are owned by Company Settings. Document branding does not duplicate logo upload.

Name
{{ $institution['display_name'] ?? $institution['name'] ?? '—' }}
Legal / company
{{ $institution['name'] ?? '—' }}
Address
{{ $institution['address'] ?: '—' }}
Phone
{{ $institution['phone'] ?: '—' }}
Email
{{ $institution['email'] ?: '—' }}
Website
{{ $institution['website'] ?: '—' }}
Company logo
@if (! empty($institution['logo_url'])) Company logo @else No logo uploaded @endif
@csrf

Header configuration

Choose “Uploaded banner” only after a header image is uploaded (upload does this for you).

Footer configuration

Watermark

Brand colours

Primary must be dark enough for white backgrounds (avoid near-white / pastel).

Text

@include('loan.system.setup.partials.document-branding-asset', [ 'role' => 'header', 'label' => 'Header banner artwork', 'asset' => $draft->header_asset_json ?? null, 'canManage' => $canManage, 'hint' => 'Recommended ~1400×160 px. Used when header mode is Uploaded banner.', ]) @include('loan.system.setup.partials.document-branding-asset', [ 'role' => 'footer', 'label' => 'Footer artwork', 'asset' => $draft->footer_asset_json ?? null, 'canManage' => $canManage, 'hint' => 'Recommended width ≥1200 px. Used when footer mode is Uploaded artwork.', ]) @include('loan.system.setup.partials.document-branding-asset', [ 'role' => 'watermark', 'label' => 'Watermark image', 'asset' => $draft->watermark_asset_json ?? null, 'canManage' => $canManage, 'hint' => 'Optional for Logo watermark mode. Otherwise the company logo is used.', ]) @include('loan.system.setup.partials.document-branding-asset', [ 'role' => 'stamp', 'label' => 'HR stamp', 'asset' => $draft->stamp_asset_json ?? null, 'canManage' => $canManage, 'hint' => 'Printed on payslips under Human Resource Manager. The stamp date is confirmed when HR opens a payroll period.', ])
@if ($canManage) @endif @if ($canPreview) @endif @if ($canManage && $draft) @endif

Save draft → preview → activate. Preview opens in a new browser tab. Pending and approved (not yet disbursed) application PDFs pick up the active version on download.

@if ($canPreview) @endif @if ($canManage && $draft)