feat(berths): link prospect on status change + reason chips from vocabulary
When status moves to under_offer or sold, the dialog now surfaces an interest selector below the reason textarea. Picking an interest passes interestId on the PATCH, which the service uses to call setPrimaryBerth — auto-creates a primary interest_berths row if not present, demoting any prior primary in the same transaction so the unique partial index never fires. Cross-port leakage is blocked inside the existing interest-berths helper. Reasons are now offered as quick-pick chips above the textarea, sourced from the new berth_status_change_reasons vocabulary (Wave 5). Clicking a chip fills the textarea so reps stay on the keyboard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -299,6 +299,14 @@ export async function updateBerthStatus(
|
||||
}),
|
||||
);
|
||||
|
||||
// Optional: link the chosen interest as the primary holder of this
|
||||
// berth. Cross-port checks live inside the helper so a malicious
|
||||
// interestId from another port can't slip past the status PATCH.
|
||||
if (data.interestId) {
|
||||
const { setPrimaryBerth } = await import('@/lib/services/interest-berths.service');
|
||||
await setPrimaryBerth(data.interestId, id);
|
||||
}
|
||||
|
||||
return updated!;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user