Refactor AccountForm with 2D code toggle and conditional validation

- Refactor AccountForm to use toggle for showing/hiding profile fields
- Add show2dCodeInMonthlyStatement field to UserProfile database schema
- Implement conditional validation: all fields mandatory when 2D code is enabled
- Update FormSchema with .refine() methods for firstName, lastName, address, and IBAN
- IBAN validation includes both presence check and format validation when required
- Add validation error messages to English and Croatian localization files
- Initialize toggle state from persisted database value
- Form fields conditionally displayed based on toggle state

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-18 12:24:11 +01:00
parent 5d1b7fd6b4
commit 9e3d49c74f
6 changed files with 182 additions and 106 deletions

View File

@@ -26,6 +26,8 @@ export interface UserProfile {
address?: string | null;
/** IBAN */
iban?: string | null;
/** whether to show 2D code in monthly statement */
show2dCodeInMonthlyStatement?: boolean | null;
};
/** bill object in the form returned by MongoDB */