@foreach($pages as $page)
Page {{ $page['page_number'] }}
{{-- Height is set to auto initially; JS will fix it to match aspect ratio --}}
{{-- Loop through fields and only show them on this page --}} @foreach($fields as $field) @if($field['page'] == $page['page_number']) @php // Find color from signers if available $recipientId = $field['recipient']['id'] ?? ''; $signer = collect($template_data->signers ?? [])->firstWhere('id', $recipientId); $borderColor = $signer['role_color'] ?? '#3c50e0'; @endphp
@if($field['type'] === 'Signature' || $field['type'] === 'Initials')
{{ $field['type'] }}
@else
{{ $field['placeholder'] ?? '' }}
@endif
@endif @endforeach
@endforeach