fixed segment client case show for archive

This commit is contained in:
Simon Pocrnjič 2025-10-19 09:57:57 +02:00
parent ea00852528
commit abf1676292

View File

@ -1201,13 +1201,6 @@ public function show(ClientCase $clientCase)
if (! empty($segmentId)) { if (! empty($segmentId)) {
// Filter to contracts that are in the provided segment and active on pivot // Filter to contracts that are in the provided segment and active on pivot
if ($archiveSegmentId && $segmentId === $archiveSegmentId) {
// Viewing the archive segment: only archived (inactive) contracts
$contractsQuery->where('active', 0);
} else {
// Any other specific segment: only active contracts
$contractsQuery->where('active', 1);
}
$contractsQuery->whereExists(function ($q) use ($segmentId) { $contractsQuery->whereExists(function ($q) use ($segmentId) {
$q->from('contract_segment') $q->from('contract_segment')
->whereColumn('contract_segment.contract_id', 'contracts.id') ->whereColumn('contract_segment.contract_id', 'contracts.id')