feat(SaleResource): redirect to client after sale creation

When a client is associated with the sale, redirect to the client's view page with the sales relation manager active instead of the default list page. This improves the user workflow by keeping the context focused on the client.
This commit is contained in:
Jp
2026-02-16 02:06:59 +08:00
parent 8c6fa6cb08
commit 9ddb71f03d

View File

@@ -89,8 +89,12 @@ class CreateSale extends CreateRecord
return $record; return $record;
} }
protected function afterCreate(): void protected function getRedirectUrl(): string
{ {
$branch = Branch::find($this->data['branch_id']); $client = $this->getClient();
if (! $client) {
return parent::getRedirectUrl();
}
return ClientResource::getUrl('view', ['record' => $client->id]).'?activeRelationManager=3';
} }
} }