{{-- Map-style Attachment(s) / Annexure(s) for PC textarea sections. Expects: $filesEdit (bool), $attachmentRows, $annexureRows (arrays of path/title), $attFieldName, $annFieldName, $uid (unique id prefix), $pcForm --}} @php $filesEdit = $filesEdit ?? false; $attachmentRows = $attachmentRows ?? []; $annexureRows = $annexureRows ?? []; $uid = preg_replace('/[^a-zA-Z0-9_-]/', '-', (string) ($uid ?? 'pci-tf')); $attLabelFieldName = preg_replace('/_attachments\[\]$/', '_attachment_labels[]', (string) $attFieldName); $attExistingPathsFieldName = preg_replace('/_attachments\[\]$/', '_existing_attachment_paths[]', (string) $attFieldName); $attExistingTitlesFieldName = preg_replace('/_attachments\[\]$/', '_existing_attachment_titles[]', (string) $attFieldName); $annExistingPathsFieldName = preg_replace('/_annexures\[\]$/', '_existing_annexure_paths[]', (string) $annFieldName); $annExistingTitlesFieldName = preg_replace('/_annexures\[\]$/', '_existing_annexure_titles[]', (string) $annFieldName); $annLabelFieldName = preg_replace('/_annexures\[\]$/', '_annexure_labels[]', (string) $annFieldName); $fieldHint = (string) ($attFieldName ?? ''); $isOtherPcKindFiles = str_contains($fieldHint, 'pc_iii_') || str_contains($fieldHint, 'pc_iv_') || str_contains($fieldHint, 'pci_pc_v_'); $filesAccept = $filesAccept ?? ($isOtherPcKindFiles ? '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.png,.jpg,.jpeg' : '.pdf,.png,.jpg,.jpeg'); $strictDocs = ! $isOtherPcKindFiles; @endphp
Attachment(s) Select File(s) Sr. # Title Actions
@forelse($attachmentRows as $arIdx => $arow) @php $arPath = $arow['path']; $arTitle = $arow['title']; $pciTfAttUrl = '#'; if (\Illuminate\Support\Str::startsWith((string) $arPath, 'pc_forms_drafts/') && preg_match('#^pc_forms_drafts/(\d+)/#', (string) $arPath, $pm)) { $pciTfAttUrl = route('pc-forms.draft-file', ['draft' => (int) $pm[1], 'path' => $arPath, 'name' => $arTitle ?: basename((string) $arPath), 'inline' => 1]); } elseif ($pcForm && $pcForm->id) { $pciTfAttUrl = route('pc-forms.file', ['pc_form' => $pcForm->id, 'path' => $arPath, 'name' => $arTitle ?: basename((string) $arPath), 'inline' => 1]); } @endphp @empty @endforelse
{{ $arIdx + 1 }} {{ $arTitle }} @if($filesEdit) @endif
No attachment
Annexure(s) Select File(s) Sr. # Title Actions
@forelse($annexureRows as $ai => $ar) @php $ap = $ar['path']; $annTitle = $ar['title']; $pciTfAnnUrl = '#'; if (\Illuminate\Support\Str::startsWith((string) $ap, 'pc_forms_drafts/') && preg_match('#^pc_forms_drafts/(\d+)/#', (string) $ap, $am)) { $pciTfAnnUrl = route('pc-forms.draft-file', ['draft' => (int) $am[1], 'path' => $ap, 'name' => $annTitle, 'inline' => 1]); } elseif ($pcForm && $pcForm->id) { $pciTfAnnUrl = route('pc-forms.file', ['pc_form' => $pcForm->id, 'path' => $ap, 'name' => $annTitle, 'inline' => 1]); } @endphp @empty @endforelse
{{ $ai + 1 }} {{ $annTitle }} @if($filesEdit) @endif
No annexure