From 9ccc57f770424c2524ffbd3df00aa8ea072e089f Mon Sep 17 00:00:00 2001 From: Scrum4Me Agent <30029041+madhura68@users.noreply.github.com> Date: Thu, 7 May 2026 15:19:54 +0200 Subject: [PATCH] feat(ST-cmovhvej7): add PBI_HAS_ACTIVE_TASKS alongside-dialoog in materialize handler When materializeIdeaPlanAction returns code 409 with PBI_HAS_ACTIVE_TASKS:, a confirm dialog offers the user a choice: create new PBI alongside the existing one or cancel. Alongside=true retries the action; cancel leaves the idea in PLAN_READY. --- components/ideas/idea-row-actions.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/ideas/idea-row-actions.tsx b/components/ideas/idea-row-actions.tsx index 2b443a7..769a6cd 100644 --- a/components/ideas/idea-row-actions.tsx +++ b/components/ideas/idea-row-actions.tsx @@ -107,15 +107,24 @@ export function IdeaRowActions({ idea, isDemo, onArchive }: IdeaRowActionsProps) function handleMaterialize() { if (!confirm('Plan materialiseren? Dit maakt PBI + stories + taken aan.')) return startTransition(async () => { - const r = await materializeIdeaPlanAction(idea.id) + let r = await materializeIdeaPlanAction(idea.id) + + if ('error' in r && r.code === 409 && r.error.startsWith('PBI_HAS_ACTIVE_TASKS:')) { + const pbiCode = r.error.split(':')[1] + const alongside = confirm( + `De bestaande PBI (${pbiCode}) heeft uitgevoerde taken.\n` + + `OK = nieuwe PBI naast bestaande aanmaken.\n` + + `Annuleren = stoppen.` + ) + if (!alongside) return + r = await materializeIdeaPlanAction(idea.id, { allowAlongside: true }) + } + if ('error' in r) { toast.error(r.error) return } toast.success(`Gematerialiseerd als ${r.data?.pbi_code}`) - // Navigeer naar de product-backlog. Anchor-scrolling per-PBI bestaat - // (nog) niet in pbi-list, dus gewoon naar de overview-pagina; de nieuwe - // PBI is de meest recente. if (idea.product_id) { router.push(`/products/${idea.product_id}`) } else {