changes to UI mostly
This commit is contained in:
@@ -24,7 +24,7 @@ public function index(Request $request)
|
||||
])->filter()->unique()->values();
|
||||
|
||||
$contracts = Contract::query()
|
||||
->with(['clientCase.person', 'type', 'account'])
|
||||
->with(['clientCase.person', 'clientCase.client.person', 'type', 'account'])
|
||||
->when($segmentIds->isNotEmpty(), function ($q) use ($segmentIds) {
|
||||
$q->whereHas('segments', function ($sq) use ($segmentIds) {
|
||||
// Relation already filters on active pivots
|
||||
@@ -38,6 +38,13 @@ public function index(Request $request)
|
||||
->limit(50)
|
||||
->get();
|
||||
|
||||
// Mirror client onto the contract for simpler frontend access: c.client.person.full_name
|
||||
$contracts->each(function (Contract $contract): void {
|
||||
if ($contract->relationLoaded('clientCase') && $contract->clientCase) {
|
||||
$contract->setRelation('client', $contract->clientCase->client);
|
||||
}
|
||||
});
|
||||
|
||||
// Build active assignment map keyed by contract uuid for quicker UI checks
|
||||
$assignments = collect();
|
||||
if ($contracts->isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user