@php $mode = $mode ?? 'show'; $layout = $layout ?? 'card'; $attachments = $attachments ?? ($voucher->attachments ?? collect()); $canUpload = isset($voucher) ? app(\App\Services\VoucherAttachmentService::class)->canUpload(auth()->user(), $voucher) : auth()->user()->hasPermission('vouchers', 'create'); $canView = auth()->user()->hasPermission('vouchers', 'view'); $attachmentService = app(\App\Services\VoucherAttachmentService::class); $allowedExtensions = implode(', ', array_map('strtoupper', config('attachments.allowed_extensions', []))); $maxMb = round(((int) config('attachments.max_size_kb', 10240)) / 1024, 1); $isInline = $layout === 'inline'; @endphp @if($canView || $canUpload) @if($isInline)
Attach Documents @if($attachments->count()) {{ $attachments->count() }} @endif
@if($canUpload && in_array($mode, ['create', 'edit'], true))
{{ $allowedExtensions }} up to {{ $maxMb }} MB each. Files upload when you save the voucher.
@endif @if($mode === 'show' && $canUpload && isset($voucher))
@csrf
{{ $allowedExtensions }} up to {{ $maxMb }} MB each.
@endif
@if($attachments->isEmpty())
No documents attached yet.
@else
@foreach($attachments as $attachment) @include('accounting.vouchers._attachment_row', [ 'attachment' => $attachment, 'voucher' => $voucher, 'voucherType' => $voucherType, 'attachmentService' => $attachmentService, ]) @endforeach
File Description Uploaded By Date Actions
@endif
@else
Documents @if($attachments->count()) {{ $attachments->count() }} @endif
@if($canUpload && in_array($mode, ['create', 'edit'], true))
{{ $allowedExtensions }} up to {{ $maxMb }} MB each. Files upload when you save the voucher.
@endif @if($mode === 'show' && $canUpload && isset($voucher))
@csrf
{{ $allowedExtensions }} up to {{ $maxMb }} MB each.
@endif
@if($attachments->isEmpty())
No documents attached yet.
@else
@foreach($attachments as $attachment) @include('accounting.vouchers._attachment_row', [ 'attachment' => $attachment, 'voucher' => $voucher, 'voucherType' => $voucherType, 'attachmentService' => $attachmentService, ]) @endforeach
File Description Uploaded By Date Actions
@endif
@endif @endif @if(in_array($mode, ['create', 'edit', 'show'], true)) @push('scripts') @endpush @endif