Commit 27766de3 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(registration): resume the right action after the membership-id warning

confirmMembershipSibling() always called nextStep(). With a single-child
wizard that was the only thing it could have been resuming, but the warning is
now reachable from "add another sibling" too — and answering it there jumped
the desk to step 2, throwing away the child they were half way through adding.
It now resumes whichever action raised it.
Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
parent 190c0ccf
...@@ -88,6 +88,14 @@ class NewRegistrationWizard extends Component ...@@ -88,6 +88,14 @@ class NewRegistrationWizard extends Component
public string $membership_id = ''; public string $membership_id = '';
public bool $membershipIdSiblingConfirmed = false; public bool $membershipIdSiblingConfirmed = false;
public array $membershipIdSiblings = []; public array $membershipIdSiblings = [];
/**
* What the desk was doing when the membership-id warning interrupted them
* — 'add' for "add another sibling", null for "next". Locked: this decides
* which handler runs on confirm, and it is set by this component only.
*/
#[Locked]
public ?string $membershipSiblingPendingAction = null;
public string $participant_governorate = ''; public string $participant_governorate = '';
public bool $participant_is_foreign = false; public bool $participant_is_foreign = false;
public bool $participant_nid_decoded = false; public bool $participant_nid_decoded = false;
...@@ -333,10 +341,28 @@ private function autoFillGuardianName(): void ...@@ -333,10 +341,28 @@ private function autoFillGuardianName(): void
} }
} }
/**
* The desk has seen the "this membership id already has players on it"
* warning and wants to carry on.
*
* It resumes whatever was interrupted rather than always advancing:
* with a roster, that warning can be raised by "add another sibling" just
* as easily as by "next", and forcing the desk on to step 2 would throw
* away the child they were half way through adding.
*/
public function confirmMembershipSibling(): void public function confirmMembershipSibling(): void
{ {
$this->membershipIdSiblingConfirmed = true; $this->membershipIdSiblingConfirmed = true;
$this->membershipIdSiblings = []; $this->membershipIdSiblings = [];
if ($this->membershipSiblingPendingAction === 'add') {
$this->membershipSiblingPendingAction = null;
$this->addPlayer();
return;
}
$this->membershipSiblingPendingAction = null;
$this->nextStep(); $this->nextStep();
} }
...@@ -493,7 +519,11 @@ private function membershipSiblingCheckPassed(): bool ...@@ -493,7 +519,11 @@ private function membershipSiblingCheckPassed(): bool
/** Add the child in the draft form and leave the sheet ready for another. */ /** Add the child in the draft form and leave the sheet ready for another. */
public function addPlayer(): void public function addPlayer(): void
{ {
$this->commitDraft(); $this->membershipSiblingPendingAction = 'add';
if ($this->commitDraft()) {
$this->membershipSiblingPendingAction = null;
}
} }
public function editPlayer(int $index): void public function editPlayer(int $index): void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment