Overhaul coach create form: full validation, NID auto-parse, edge cases
Frontend:
- Client-side NID parser (no API call) — extracts DOB, gender, age, governorate
- Shows green badge with parsed info (governorate, gender, age)
- Red highlight + Arabic message on every invalid field
- Validates: code, name, employment_type, payment_model (non-academy),
academy_id (academy), NID length, email format, phone format
- Hides payment/rate fields for academy coaches (not needed)
- Shows note explaining academy coaches follow salary system
- Gender/DOB auto-locked when NID is valid, manual otherwise
- Age displayed under DOB field
Backend:
- Strips non-digits from NID input
- Uppercase code automatically
- Checks NID uniqueness against existing coaches
- Validates email with filter_var
- Academy coach requires academy_id selected
- payment_model defaults to 'salary' for academy, 'per_session' fallback
- max_groups minimum 1
- Success message includes coach name
Co-Authored-By:
Claude Opus 4.6 <noreply@anthropic.com>
Showing
Please register or sign in to comment