@if($companySetting?->favicon_url)
@endif
@vite(['resources/css/app.css', 'resources/js/app.js'])
@include('layouts.partials.navbar')
@yield('content')
@include('layouts.partials.archive-modal')
@auth
@php
$isAdminUser = auth()->user()->hasAnyRole(['Super Admin', 'Admin']);
$userFolderIds = $isAdminUser ? collect() : auth()->user()->folders()->pluck('folders.id');
if ($userFolderIds->isNotEmpty()) {
$ackedIds = \App\Models\DocumentAcknowledgement::where('user_id', auth()->id())
->pluck('document_id');
$pendingAckDocs = \App\Models\Document::whereIn('folder_id', $userFolderIds)
->whereNotIn('id', $ackedIds)
->where('status', 'active')
->with('folder:id,name')
->orderBy('document_type')
->orderBy('title')
->get()
->map(fn ($d) => [
'id' => $d->id,
'title' => $d->title,
'doc_number' => $d->doc_number,
'folder_name' => $d->folder?->name ?? '—',
'ack_url' => route('my-documents.acknowledge', $d->id),
])->values();
} else {
$pendingAckDocs = collect();
}
@endphp
@if($pendingAckDocs->isNotEmpty())
@include('layouts.partials.acknowledgement-modal', ['pendingAckDocs' => $pendingAckDocs])
@endif
@endauth