Commit 3b3eff80 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Show server validation errors as individual flash alerts, not one blob

Each missing field shows as its own red error banner at the top of the page
instead of one long string with invisible newlines.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent b2627921
......@@ -49,8 +49,16 @@ class RetroactiveWizardController extends Controller
$result = RetroactiveMembershipService::createRetroactiveMember($data);
if (!$result['success']) {
return $this->redirect('/members/retroactive-wizard')
->withError('فشل إنشاء العضوية: ' . ($result['error'] ?? 'خطأ غير معروف'));
$errorMsg = $result['error'] ?? 'خطأ غير معروف';
$errorLines = array_filter(explode("\n", $errorMsg));
$session = App::getInstance()->session();
$alerts = [];
foreach ($errorLines as $line) {
$alerts[] = ['type' => 'error', 'message' => trim($line)];
}
$session->flash('_alerts', $alerts);
$session->flash('_old_input', $_POST);
return $this->redirect('/members/retroactive-wizard');
}
$memberId = $result['data']['member_id'];
......
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