Dokument popravljeni

This commit is contained in:
Simon 2025-10-08 16:31:23 +02:00
parent b9ca8244ef
commit ee1af56d03

View File

@ -1096,8 +1096,9 @@ public function show(ClientCase $clientCase)
// Merge client case and contract documents into a single array and include contract reference when applicable // Merge client case and contract documents into a single array and include contract reference when applicable
$contractIds = $contracts->pluck('id'); $contractIds = $contracts->pluck('id');
// Include 'uuid' so frontend can build document routes (was causing missing 'document' param error)
$contractDocs = Document::query() $contractDocs = Document::query()
->select(['id', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) ->select(['id', 'uuid', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at'])
->where('documentable_type', Contract::class) ->where('documentable_type', Contract::class)
->when($contractIds->isNotEmpty(), fn ($q) => $q->whereIn('documentable_id', $contractIds)) ->when($contractIds->isNotEmpty(), fn ($q) => $q->whereIn('documentable_id', $contractIds))
->orderByDesc('created_at') ->orderByDesc('created_at')
@ -1112,7 +1113,7 @@ public function show(ClientCase $clientCase)
}); });
$caseDocs = $case->documents() $caseDocs = $case->documents()
->select(['id', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at']) ->select(['id', 'uuid', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at'])
->orderByDesc('created_at') ->orderByDesc('created_at')
->limit(200) ->limit(200)
->get() ->get()