fix: Correct navigation parameter order in EnrollmentListViewModel (commit: c6440cd) (details)
Attempt to fix intermittent ConcurrentModificationException on server. (commit: 36ca809) (details)
Fix Redeem invitation issue caused by change to handling account scope. Add ServerAccountScopeManager to create a single per-school manager of account scopes. (commit: 5ffce94) (details)
EnrollmentEntity did not store the full uid string of the related class and person, it was relying on a join to the class and person entity. This fails when attempting to create a pending enrollment for a student who profile which is being created as part of a parental registration (on the client). (commit: 8c2c554)
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. (commit: 079da7e)
feat: Navigate to enrollment list from class details
This commit introduces the ability to navigate from the class details screen to a new enrollment list screen for a specific person.
When a user clicks the "Manage enrollments" option in the user action menu, they are now navigated to a view showing all enrollments for that person within the current class.
Key changes: - Added `EnrollmentListScreen` to display a person's enrollments. - Implemented `EnrollmentListViewModel` to fetch and provide enrollment data. - Updated `ClazzDetailViewModel` to handle the navigation to `EnrollmentList`, passing the person's details and class title. - The `EnrollmentList` navigation route now accepts `personGuid`, `personName`, `role`, and `clazzTitle` to construct the new screen. - Added new string resources for the enrollment list title. (commit: 8bb9499)
This commit introduces a "More options" dropdown menu for each item in the enrollment list screen, providing placeholder actions for "Edit" and "Delete."
Additionally, it refactors the hardcoded "More options" content description in the class details screen to use a string resource for better localization and consistency.
Key changes: - Added an `IconButton` with a `MoreVert` icon as the `trailingContent` for each `ListItem` in `EnrollmentListScreen`. - Implemented a `DropdownMenu` with "Edit" and "Delete" options. - Added new string resources for `edit` and `delete`. - Updated `ClazzDetailScreen` to use the `more_options` string resource for the menu's content description. (commit: 7c40d3f)
refactor: Simplify navigation to EnrollmentList screen
This commit refactors the navigation from the class details screen to the enrollment list screen. It simplifies the `EnrollmentList` route parameters by removing `personName` and `clazzTitle`, replacing the latter with `clazzGuid`.
Key changes: - Updated the `EnrollmentList` navigation route to use `clazzGuid` instead of `clazzTitle` and removed the redundant `personName`. - Modified `ClazzDetailViewModel` to pass `person.guid`, `role.name`, and `route.guid` (class GUID) when navigating. - Removed the local `clazzTitle` property from `ClazzDetailViewModel`. - Simplified `EnrollmentListViewModel` by removing the logic that constructed the app bar title and instead passing list parameters directly to the data source. (commit: aed53db)
This commit introduces a new screen for creating and editing enrollments. It includes the `EnrollmentEditScreen` composable, its corresponding `EnrollmentEditViewModel`, and the necessary navigation setup.
The `EnrollmentEdit` screen displays basic enrollment information and includes a "Save" button in the action bar. The ViewModel is initialized to either load an existing enrollment by its UID or prepare a new enrollment based on the navigation parameters.
Key changes: - Created `EnrollmentEditScreen.kt` and its `EnrollmentEditViewModel`. - Added the `EnrollmentEdit` destination to `AppNavHost.kt`. - Updated the `EnrollmentEdit` navigation route in `AppRoutes.kt` to accept parameters (`uid`, `personGuid`, `role`, `clazzGuid`). - In `EnrollmentListScreen`, the "Edit" menu item now navigates to the new `EnrollmentEdit` screen. - Removed the redundant `roleLabel` parameter from the `PersonListItemWithMenu` composable, as it was unused. (commit: b714fc5)
feat: Implement field validation and state restoration in EnrollmentEdit screen
This commit introduces field validation and state restoration on the enrollment edit screen. When creating a new enrollment, the start and end dates are now validated as required fields before saving.
Additionally, the screen's state is now preserved and restored, for instance, after a screen rotation. This is achieved by debouncing entity changes and saving them to the `SavedStateHandle`.
Key changes: - Added `beginDateError` and `endDateError` with validation logic to `EnrollmentEditUiState`. - Implemented `onEntityChanged` in the `EnrollmentEditViewModel` to update the UI state and persist the `Enrollment` entity to the `SavedStateHandle` using a `LaunchDebouncer`. - Simplified the `EnrollmentEdit` navigation route to only require a `uid`. - Passed the `onEntityChanged` callback from the `EnrollmentEditViewModel` to the `EnrollmentEditScreen`. (commit: 9e6cae1)
feat: Implement enrollment start and end date editing
This commit builds out the `EnrollmentEditScreen` to allow editing the start and end dates of an enrollment.
The `EnrollmentEdit` navigation route has been updated to include `role`, `personGuid`, and `clazzGuid`. These parameters are now used to correctly initialize and save enrollment data. When a new enrollment is created, it now correctly pops back to the previous screen upon saving.
Key changes: - `EnrollmentEditScreen` now contains `RespectLocalDateField` inputs for `beginDate` and `endDate`. - The `EnrollmentEdit` route now requires `role`, `personGuid`, and `clazzGuid` parameters. - `EnrollmentListViewModel` now passes the required parameters when navigating to the edit screen. - `EnrollmentEditViewModel` correctly initializes new enrollments using the route parameters. - Successfully saving an enrollment now triggers a `NavCommand.PopUp()` to return to the prior screen. (commit: a4151cb)
refactor: Improve navigation after new enrollment creation
This commit refactors the navigation logic after creating a new enrollment. Instead of just popping the current screen, it now navigates to the `EnrollmentList` screen, replacing the `EnrollmentEdit` screen in the back stack. This ensures a more intuitive user flow when creating multiple enrollments.
For existing enrollments, the behavior remains the same, popping back to the previous screen upon saving.
Minor code formatting and cleanup have also been applied to `EnrollmentEditScreen.kt`, `AppKoinModule.kt`, and `EnrollmentEditViewModel.kt`. (commit: 8e5c14f)
fix: Improve DOB display and enrollment navigation
This commit introduces a few small fixes and improvements related to enrollment management and data display.
In the `ClazzDetailScreen`, the display for a person's date of birth (DOB) now correctly handles null values by showing a dash ("-") instead of crashing.
The `EnrollmentListViewModel` now sets the screen title based on the role from the navigation route.
Finally, the navigation logic in `EnrollmentEditViewModel` has been cleaned up, removing unnecessary parameters when creating a new enrollment, while preserving the pop-up behavior.
Key changes: - `ClazzDetailScreen` now displays "-" for a null date of birth. - `EnrollmentListViewModel` sets the screen title using the role from the route. - Simplified the `Navigate` command in `EnrollmentEditViewModel` for new enrollments. (commit: 4b750d7)
Attempt to fix intermittent ConcurrentModificationException on server.
Koin DI factories can be called concurrently when multiple requests are ongoing. Add ReentrantLock when creating and linking account scope on the server. (commit: 36ca809)
Fix Redeem invitation issue caused by change to handling account scope. Add ServerAccountScopeManager to create a single per-school manager of account scopes. (commit: 5ffce94)
This commit introduces date formatting on the enrollment list screen, changing the display from the `yyyy-MM-dd` format to a localized `dd/MM/yyyy` format.
A new extension function, `toLocalizedDate`, has been created to handle the conversion. The `EnrollmentListViewModel` now provides an `onDateFormatted` function, which is called by the `EnrollmentListScreen` to display the formatted start and end dates for each enrollment.
Key changes: - Added `toLocalizedDate` string extension in `respect-lib-shared`. - Implemented `onDateFormatted` in `EnrollmentListViewModel` to wrap the new extension. - Updated `EnrollmentListScreen` to use the formatted begin and end dates in the `ListItem`. (commit: fa0406a)
refactor: Ensure only one enrollment item's menu can be expanded at a time
This commit refactors the state management for the dropdown menu in the `EnrollmentListScreen`.
Previously, a single boolean `expanded` state was shared across all list items, causing all menus to open simultaneously. This has been replaced with `expandedItemUid`, which stores the UID of the currently expanded item.
This change ensures that clicking the "More" icon on one list item only opens the menu for that specific item. (commit: ddcbfb3)
feat: Add validation for enrollment start and end dates
This commit introduces validation to ensure the start date of an enrollment is not later than the end date.
An error message will now be displayed on the `EnrollmentEditScreen` if the start date is set after the end date.
Key changes: - Added a new string resource `date_later` for the validation error message. - Updated `EnrollmentEditViewModel` to include logic that compares `beginDate` and `endDate`. (commit: 6ba8334)
refactor: Conditionally display gender and DOB in ClazzDetailScreen
This commit refactors the `ClazzDetailScreen` to conditionally display a person's gender and date of birth (DOB) only if these values are not null or blank.
Previously, the labels for "Gender" and "Date of Birth" would always be shown, even if the corresponding data was missing, leading to awkward formatting like "Gender: , Date of Birth:".
The logic has been updated to build a list of details and then join them, ensuring that an item is only added to the display string if its value is present. This prevents empty data points from appearing in the UI. (commit: b2b470a)
feat: Display person and class names in EnrollmentEdit screen
This commit updates the `EnrollmentEditViewModel` to fetch and display the person's full name and the class's title.
Previously, the `init` block only configured the "Save" action bar button. Now, it asynchronously fetches the `Person` and `Clazz` entities using the `personGuid` and `clazzGuid` from the route. Although the fetched names (`personName` and `clazzName`) are stored in local variables, they are not yet used in the UI state. This change prepares the ViewModel for displaying more context on the enrollment editing screen. (commit: 02e0dba)
refactor: Rename person management functions in ClazzDetail screen
This commit renames functions related to person management within the class detail screen for improved clarity and consistency.
The `onClickRemovePerson` and `onClickManagePerson` functions have been renamed to `onClickRemovePersonFromClass` and `onClickManageEnrollments` respectively. This change is reflected in the `ClazzDetailScreen`, `ClazzDetailContent`, and `ClazzDetailViewModel` to more accurately describe their actions.
Key changes: - Renamed `onClickRemovePerson` to `onClickRemovePersonFromClass` in the `ClazzDetailScreen` and `ClazzDetailViewModel`. - Renamed `onClickManagePerson` to `onClickManageEnrollments` in the `ClazzDetailScreen` and `ClazzDetailViewModel`. - Updated the call sites for these functions within the `ClazzDetailContent` composable. - The `onClickManageEnrollments` function now navigates to the `EnrollmentList` screen. (commit: 70ed777)