changes UI
This commit is contained in:
@@ -749,30 +749,12 @@ public function show(ClientCase $clientCase)
|
||||
$perPage = request()->integer('contracts_per_page', 50);
|
||||
$contracts = $contractsQuery->paginate($perPage, ['*'], 'contracts_page')->withQueryString();
|
||||
|
||||
// TEMP DEBUG: log what balances are being sent to Inertia (remove once issue resolved)
|
||||
try {
|
||||
logger()->info('Show contracts balances', [
|
||||
'case_id' => $case->id,
|
||||
'contract_count' => $contracts->count(),
|
||||
'contracts' => $contracts->map(fn ($c) => [
|
||||
'id' => $c->id,
|
||||
'uuid' => $c->uuid,
|
||||
'reference' => $c->reference,
|
||||
'account_id' => optional($c->account)->id,
|
||||
'initial_amount' => optional($c->account)->initial_amount,
|
||||
'balance_amount' => optional($c->account)->balance_amount,
|
||||
'account_updated_at' => optional($c->account)->updated_at,
|
||||
])->toArray(),
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
// swallow
|
||||
}
|
||||
|
||||
// Prepare contract reference and UUID maps from paginated contracts
|
||||
// Prepare contract reference map from paginated contracts
|
||||
$contractItems = $contracts instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
||||
? $contracts->items()
|
||||
: $contracts->all();
|
||||
|
||||
|
||||
$contractRefMap = [];
|
||||
$contractUuidMap = [];
|
||||
foreach ($contractItems as $c) {
|
||||
@@ -791,15 +773,6 @@ public function show(ClientCase $clientCase)
|
||||
// Load initial batch of documents (limit to reduce payload size)
|
||||
$contractDocs = collect();
|
||||
if ($contractIds->isNotEmpty()) {
|
||||
// Build UUID map for all contracts (including trashed) to avoid N+1 queries
|
||||
$allContractUuids = Contract::withTrashed()
|
||||
->whereIn('id', $contractIds->all())
|
||||
->pluck('uuid', 'id')
|
||||
->toArray();
|
||||
|
||||
// Merge with contracts already loaded
|
||||
$contractUuidMap = array_merge($contractUuidMap, $allContractUuids);
|
||||
|
||||
$contractDocs = Document::query()
|
||||
->select(['id', 'uuid', 'documentable_id', 'documentable_type', 'name', 'file_name', 'original_name', 'extension', 'mime_type', 'size', 'created_at', 'is_public'])
|
||||
->where('documentable_type', Contract::class)
|
||||
|
||||
Reference in New Issue
Block a user