Skip to content

ELCC-94: Add Per-Center Per-Month Building Expense Customization - #108

Merged
klondikemarlen merged 29 commits into
mainfrom
elcc-94/add-per-center-per-month-building-expense-customization
Mar 16, 2026
Merged

klondikemarlen merged 29 commits into
mainfrom
elcc-94/add-per-center-per-month-building-expense-customization

Conversation

@klondikemarlen

@klondikemarlen klondikemarlen commented Mar 16, 2026

Copy link
Copy Markdown
Member

Fixes https://yg-hpw.atlassian.net/browse/ELCC-94

Context

End users reported that building expenses are fairly informal and need to be customized on a per-month, per-center basis. The existing interface only supported bulk management at the category level, with no way to add, remove, or individually adjust expenses for specific centres and fiscal periods.

Implementation

  1. Rename the building expense category foreign key to categoryId and update the related API, model, serializer, and migration layers.
  2. Add inline monthly worksheet controls to create, edit, and delete building expenses directly in the Building Expenses section.
  3. Expose building expense policy actions through the API so the worksheet can show the right actions per row.
  4. Scope building expense category selection by funding region and exclude categories already used for the same centre and fiscal period.
  5. Add bulk-forward creation services so new building expense categories and optionally new building expenses can be copied into later fiscal periods.
  6. Allow building expenses to be edited across fiscal periods, while still limiting subsidy rate edits to system admins.
  7. Tighten supporting backend and test infrastructure, including the BaseModel.withScope typing fix needed for scoped findEach calls.

Screenshots

New Building Expense table with add/remove options.
http://localhost:8080/child-care-centres/1/2025-26/worksheets/march
image

Building expense form open.
http://localhost:8080/child-care-centres/1/2025-26/worksheets/march?showBuildingExpenseCreateForm=true
image

Category selector open with no category found and a link to create a category for admins.
http://localhost:8080/child-care-centres/1/2025-26/worksheets/march?showBuildingExpenseCreateForm=true
image

Expense category creation page with the apply-forward option.
http://localhost:8080/administration/building-expense-categories/new
image

Testing Instructions

  1. Run the test suite via dev test.
  2. Boot the app via dev up.
  3. Log in to the app at http://localhost:8080.

Test Case 1: User can add a building expense from a monthly worksheet

  1. Open any child care centre worksheet and click any month tab to load the Monthly Worksheet page.
  2. Scroll to the Building Expenses section.
  3. Verify the table displays an Actions column.
  4. Click the Add Building Expense button.
  5. In the Add Building Expense form, click the Category autocomplete.
  6. Verify the autocomplete hint reads Search for a building expense category..
  7. Select a category and enter values in Estimated Cost and Actual Cost.
  8. Optionally enter text in Notes.
  9. Leave Apply to current and future fiscal periods for this centre unchecked.
  10. Click Create.
  11. Verify the success message Building expense created successfully appears.
  12. Verify the new row appears in the Building Expenses table.

Test Case 2: User can apply a building expense to later fiscal periods

  1. In the same Monthly Worksheet page, click Add Building Expense again.
  2. Select a different value in Category.
  3. Enter values in Estimated Cost and Actual Cost.
  4. Check Apply to current and future fiscal periods for this centre.
  5. Click Create.
  6. Verify the success message Building expense created successfully appears.
  7. Click a later month tab in the worksheet.
  8. Verify the newly created building expense appears in that later month's Building Expenses table.

Test Case 3: User can edit and delete a building expense

  1. On any worksheet month that has building expenses, edit Estimated Cost, Actual Cost, or Notes in the Building Expenses table.
  2. Verify the success message Building expense saved! appears.
  3. Refresh the page.
  4. Verify the edited values persist.
  5. Click Delete on a building expense row.
  6. In the confirmation prompt, confirm the deletion.
  7. Verify the success message Building expense deleted! appears.
  8. Verify the deleted row is removed from the Building Expenses table.

Test Case 4: Past months remain editable

  1. Navigate to a past worksheet month by clicking an earlier month tab.
  2. Verify the Building Expenses section still shows the Add Building Expense button.
  3. Verify the table still shows the Actions column.
  4. Edit a value in an existing building expense row.
  5. Verify the success message Building expense saved! appears.
  6. Delete a building expense row.
  7. Verify the success message Building expense deleted! appears.

Test Case 5: System admins can manage subsidy rate and create categories

  1. Log in as a system admin.
  2. Open any Monthly Worksheet page with building expenses.
  3. Edit the Subsidy Rate / $ field for a building expense row.
  4. Verify the success message Building expense saved! appears.
  5. Open the profile menu and navigate to AdministrationBuilding Expense Categories.
  6. Click New Building Expense Category.
  7. Fill in Funding Region, Category Name, and **Subsidy Rate ***.
  8. Optionally check Apply to all current and future centre funding periods.
  9. Click Create Building Expense Category.
  10. Verify the success message Building expense category created successfully! appears.
  11. Return to a Monthly Worksheet page for a centre in the same funding region.
  12. Click Add Building Expense.
  13. Verify the new category can be selected from Category.

Test Case 6: Empty category search offers the admin create flow

  1. While logged in as a system admin, open Add Building Expense on a Monthly Worksheet page.
  2. In Category, search for a value that does not exist.
  3. Verify the empty state shows Can't find what you're looking for?.
  4. Verify the Create Category button appears in that empty state.
  5. Click Create Category.
  6. Verify the app navigates to AdministrationBuilding Expense CategoriesNew Building Expense Category.

Why? Simplify code by removing redundant prefix.
Why? Simplify code by removing redundant prefix.
Also testing out OpenAI Codex with GPT-5.4; good test!
…e and fiscal period.

NOTE: back-end logic does not exist yet.
Why? Because it generally looks better (and we use this in other projects).
Why? Keeps the AGENTS file from growing to large and makes documentation at least potentially
useful to developers, rather than just AI agents.
… building expense category.

Why? To make it easier to add new categories to existing centres expense list.
…default.

Why? Because it's not possible to remove building expenses categories once they are created this way.
Also fix expense display to show max entries rather than just a single page of data.
NOTE: we still need to restrict base on fiscal period end date.
@klondikemarlen klondikemarlen self-assigned this Mar 16, 2026
@klondikemarlen klondikemarlen added the enhancement New feature or request label Mar 16, 2026
@klondikemarlen
klondikemarlen force-pushed the elcc-94/add-per-center-per-month-building-expense-customization branch from fc1e006 to 84032bc Compare March 16, 2026 01:00
@klondikemarlen
klondikemarlen force-pushed the elcc-94/add-per-center-per-month-building-expense-customization branch from 84032bc to 4c9a9df Compare March 16, 2026 01:07
Why? UI does not explain why editing is not allowed, so defering till
the concept is better handled in the UI.
Why? UI does not explain why editing is not allowed, so defering till
the concept is better handled in the UI.
@klondikemarlen
klondikemarlen marked this pull request as ready for review March 16, 2026 16:04
@klondikemarlen
klondikemarlen merged commit f7aabd0 into main Mar 16, 2026
4 checks passed
@klondikemarlen
klondikemarlen deleted the elcc-94/add-per-center-per-month-building-expense-customization branch March 16, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant