Commit db04d624 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix duplicate membership_id error in receptionist registration wizard

Add uniqueness check for membership_id per branch in step 1 validation,
preventing the DB unique constraint violation when a membership_id is reused.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 0cfe5e09
......@@ -251,6 +251,17 @@ public function nextStep(): void
$this->validate($rules, $this->messages());
}
// Membership ID uniqueness check on step 1
if ($this->currentStep === 1 && $this->membership_type === 'member' && $this->membership_id) {
$exists = Participant::where('branch_id', $this->branchId)
->where('membership_id', $this->membership_id)
->exists();
if ($exists) {
$this->addError('membership_id', 'رقم العضوية مستخدم بالفعل لمشترك آخر في هذا الفرع');
return;
}
}
// Duplicate check on step 2 (guardian) — if duplicates found, stay on step 2
if ($this->currentStep === 2 && !$this->duplicateCheckDone) {
$this->checkDuplicates();
......
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