@if(isset($documentRequirements) && $documentRequirements->count() > 0)
@foreach($documentRequirements as $index => $docReq)
@php
$fieldName = 'document_' . $docReq->id;
$acceptFormats = '';
if ($docReq->allowed_formats) {
$formats = array_map('trim', explode(',', $docReq->allowed_formats));
$acceptFormats = implode(',', array_map(function($format) {
$format = str_replace('.', '', $format);
$mimeTypes = [
'pdf' => 'application/pdf',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'png' => 'image/png',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
];
return $mimeTypes[$format] ?? '.' . $format;
}, $formats));
}
@endphp
is_required) required @endif
>
@if($docReq->description)
{{ $docReq->description }}
@endif
@if($docReq->allowed_formats)
Format: {{ strtoupper($docReq->allowed_formats) }}
@endif
@if($docReq->max_size_kb)
| Max: {{ $docReq->max_size_mb }}MB
@endif
@error($fieldName)
{{ $message }}
@enderror
@if(($index + 1) % 2 == 0 && ($index + 1) < $documentRequirements->count())
@endif
@endforeach