@php $defaultAllowedExtensions = 'jpg,jpeg,png,pdf,webp'; $documentTypeOptions = $documentTypes->mapWithKeys(function ($documentType) use ($defaultMaxFileSizeKb, $defaultAllowedExtensions) { return [ $documentType->id => [ 'label' => $documentType->name, 'max' => $documentType->max_file_size_kb ?: $defaultMaxFileSizeKb, 'extensions' => $documentType->allowed_extensions ?: $defaultAllowedExtensions, ], ]; }); $selectedDocumentTypeId = old('document_type_id', $document->document_type_id ?? null); $selectedMaxSizeKb = $selectedDocumentTypeId && $documentTypeOptions->has((int) $selectedDocumentTypeId) ? $documentTypeOptions[(int) $selectedDocumentTypeId]['max'] : $defaultMaxFileSizeKb; $selectedExtensions = $selectedDocumentTypeId && $documentTypeOptions->has((int) $selectedDocumentTypeId) ? $documentTypeOptions[(int) $selectedDocumentTypeId]['extensions'] : $defaultAllowedExtensions; @endphp
Format diizinkan: {{ strtoupper(str_replace(',', ', ', $selectedExtensions)) }}.
Maksimal ukuran file untuk jenis dokumen ini: {{ number_format($selectedMaxSizeKb / 1024, 2) }} MB
@if(isset($document) && $document->file_name)File saat ini: {{ $document->file_name }}
@endif