#3887 Material Autocomplete#3977
Conversation
wavehassman
left a comment
There was a problem hiding this comment.
Looks awesome! Just a small change
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
…-Electric-Racing/FinishLine into #3887-Material-Autocomplete
|
Made a quick mistake with commit name and then made it worse! The code should work however. Sorry about the confusion. |
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds a project-specific material autocomplete to the Reimbursement Request “Purchased Items” workflow so that when a project (WBS) is selected, the product description is chosen from that project’s BOM materials.
Changes:
- Updated reimbursement product validation copy to “Material / Description is required”.
- Introduced a
MaterialAutocompletethat fetches materials for a selected WBS element and uses it in the Purchased Items table for project-based items. - Kept the free-text “Product Name/Description” input for non-project (“Other Category”) items.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx |
Updates validation error text for reimbursement product name. |
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx |
Adds BOM-driven material autocomplete and switches project items from free-text to dropdown selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Show resolved
Hide resolved
src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementProductTable.tsx
Outdated
Show resolved
Hide resolved
|
The reason why we were getting the bug when creating a new request but not when editing was because they have two different endpoints; create forces the body to include a materialId whereas edit allows either the name or the materialId to be passed. Since materialId was not being passed as a property when the code built the WBS reimbursement product objects, the backend ended up rejecting the requests every time when creating new reimbursement requests but not when editing them. Is it intended for the two endpoints to have different requirements? Shouldn't we enforce the edit to include a materialId? It's probably not possible to make this change since we would have to modify all existing data but I just wanted to point out this fact. |
Yes, the endpoints needs two different requirements because we only want reimbursement requests to be created with a materialId when it is on a project from this point forward. But, there are reimbursement requests that exist in the db that still just hold the name as a string, so we need to be able to handle both cases. You should make the create endpoint and edit endpoint work under these conditions. I have changed the schema to include materialId optionally, so you should only need to change the endpoints and potentially frontend types that I missed. For this ticket, you need to make sure the edit and view modals work for both string and material based data, but create only needs to work for material based data when creating a reimbursement request on a project. |
Changes
When you create a reimbursement request, for "Purchased Products", when you select a project, rather than it being a vague description, there is an autocomplete dropdown that contains all materials linked to that project. The other categories still just do the basic description variant with no drop down.
Screenshots
Closes #3887