This commit introduces validation to prevent the date of birth from being in the future. The validation is now handled in the `PersonEditViewModel` when the save button is clicked, rather than restricting the date selection in the UI.
Key changes: - Removed the future date restriction from the `RespectLocalDateField` date picker, allowing users to select any date. - Added a new string resource `date_of_birth_in_future` for the error message. - Updated `PersonEditViewModel` to validate the date of birth upon saving. If the selected date is in the future, an error message is displayed and the save is aborted. - Modified `PersonEditScreen` to display the date of birth validation error message below the input field.
refactor: Improve `fullName` generation in `PersonExt`
This commit refactors the `fullName` extension function for the `Person` model to more robustly handle whitespace and optional name parts.
The function now trims leading/trailing whitespace from `givenName`, `middleName`, and `familyName`. It also ensures that spaces are only added between name parts if the preceding part is not empty, preventing extra spaces in the final output.
This commit clears the email validation error message in the `PersonEditViewModel` when the user modifies the email address. The phone number error handling already had similar logic, and this change makes the email field consistent.
feat: Enhance ClazzDetailScreen with more information
This commit updates the class details screen to provide more comprehensive information about the class and its pending members.
Key changes: - Displays the class description in the `TopAppBar`. - Shows a count of pending teacher and student requests in the "Pending requests" section header. - For pending teachers and students, the list now shows their role (teacher or student), gender, and date of birth. - In the class edit screen, the `*` indicating a required field has been removed from the "Class Name" label to simplify the UI.
refactor: Use fullName for person display and internationalize labels
This commit updates the `ClazzDetailScreen` to use the `person.fullName()` extension function for displaying user names, ensuring a consistent format. It also replaces hardcoded text labels for "Gender" and "DOB" with internationalized string resources.
This commit addresses several Kotlin linting errors by removing unnecessary whitespace. The changes include: - Removing space before `else` keywords. - Fixing spacing around commas. - Removing space before `if` conditions.
This commit updates the test function names in `ValidateEmailUseCaseTest.kt` to follow the camelCase convention, removing backticks and descriptive phrases.
refactor: Standardize required field validation message
This commit replaces the generic `required` string resource with a more specific `required_field` resource for consistency in validation error messages.
Key changes: - In `PersonEditViewModel`, the validation logic for first name, last name, and gender now uses `Res.string.required_field`. - The `PersonEditScreen` and `RespectGenderExposedDropDownMenuField` have been updated to display the specific validation error message from the view model state, falling back to a default required text. - The gender dropdown component now accepts and displays a `UiText` error message, improving how validation feedback is presented to the user on both the Person Edit and Sign Up screens.
This commit updates the class name validation to use `UiText` instead of a plain `String`. This allows for more flexible and localized error messages.
Key changes: - `ClazzEditUiState.clazzNameError` is now of type `UiText?`. - The `ClazzEditViewModel` now sets `clazzNameError` to a `UiText` from string resources. - `ClazzEditScreen` has been updated to use `uiTextStringResource` to display the localized validation message. - The resource string for the class name label was changed from `class_name` to `name` for consistency.
This commit applies minor code formatting changes to improve consistency across the codebase. Specifically, it adjusts spacing around operators and in conditional statements.
Minor tidy changes: 1) Remove personedit padding on column - each field has its own padding 2) Remove "dob" as a string - this is short, but not clear.