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:
@@ -89,8 +89,12 @@ class CreateSale extends CreateRecord
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user