@extends('layouts.admin') @section('content')
@if (in_array(auth()->user()->role, ['operator']))
(Max File Size 5 MB)
@csrf
@endif
📁 Uploaded Documents
@if (isset($documents) && $documents->count() > 0) @php $categoryName = strtolower($category->name ?? ''); @endphp
@foreach ($documents as $doc) @php $show_doc = false; $status = $doc->status_of_audit ?? $doc->status ?? 'pending'; if (auth()->user()->role == 'admin') { $show_doc = true; } elseif (auth()->user()->role == 'accounts') { $show_doc = in_array($status, ['pending', 'reupload']); } elseif (auth()->user()->role == 'operator') { $show_doc = $status == 'pending'; } elseif (auth()->user()->role == 'ca') { $show_doc = ($status == 'approved' || $status == 'audited'); } @endphp @if ($show_doc) @php // File path from DB $filePath = $doc->bill_path ?? $doc->file_path ?? null; $fname = $filePath ? basename($filePath) : 'No File'; $status = $doc->status_of_audit ?? $doc->status ?? 'pending'; $fileUrl = $filePath ? asset($filePath) : '#'; @endphp
{{-- 🔗 FILE LINK --}} @if (auth()->user()->role == 'admin' && $status == 'pending') @else @endif {{ $fname }} ({{ strtolower(pathinfo($fname, PATHINFO_EXTENSION)) }}) {{-- 🔁 ACCOUNTS ACTION --}} @php $isExpense = isset($doc->sub_category_id); $auditRoute = $isExpense ? 'uploader.audit_expense' : 'uploader.audit_purchase'; @endphp @if (auth()->user()->role == 'accounts' && in_array($status, ['pending', 'reupload']))
@csrf
@else
Status: {{ ucfirst($status) }}
@endif {{-- 📦 MOVE --}} @if (in_array(auth()->user()->role, ['admin', 'accounts'])) @endif
@endif @endforeach
@else

No documents uploaded yet.

@endif
@endsection