feat(contracts): manage line items from the contract detail page #209

Merged
David merged 3 commits from feat/mapps-196-contract-line-item-management into main 2026-06-17 12:09:30 +02:00
Owner

Contract line items had full backend CRUD (POST /contracts/{id}/items, PUT/DELETE /contract-items/{id}) but the detail page's Line Items card was read-only: no Add, Edit, or Delete affordance. Combined with the edit form intentionally hiding its own item editor, there was no way to add, correct, or remove a contract's line items after creation, and the derived contract Value could not be adjusted.

Add an "Add Item" action to the Line Items card header and make each row clickable, both opening a shared ContractItemFormModal that mirrors the create form's fields (name, type, quantity, unit price). New items POST to /contracts/{id}/items; editing an existing row PUTs to /contract-items/{id}; the modal retains the unexposed fields of the original row (description, included hours, rollover settings, sort_order) so a full-replace PUT does not wipe them. Delete uses the in-app ConfirmDialog (MAPPS-189), not window.confirm. On save or delete both the items table and the contract resource refresh so per-row totals and the Summary Value reflect the change.

item_type options now come from a shared contract_item_type_options() helper used by both the create form and the detail modal so they stay in sync with the server's item_type CHECK set (MAPPS-190). The stale "edit flow manages items from the detail page" comment on ContractFormValues.items is corrected to describe the now-real detail-page management.

#MAPPS-196

Contract line items had full backend CRUD (POST /contracts/{id}/items, PUT/DELETE /contract-items/{id}) but the detail page's Line Items card was read-only: no Add, Edit, or Delete affordance. Combined with the edit form intentionally hiding its own item editor, there was no way to add, correct, or remove a contract's line items after creation, and the derived contract Value could not be adjusted. Add an "Add Item" action to the Line Items card header and make each row clickable, both opening a shared ContractItemFormModal that mirrors the create form's fields (name, type, quantity, unit price). New items POST to /contracts/{id}/items; editing an existing row PUTs to /contract-items/{id}; the modal retains the unexposed fields of the original row (description, included hours, rollover settings, sort_order) so a full-replace PUT does not wipe them. Delete uses the in-app ConfirmDialog (MAPPS-189), not window.confirm. On save or delete both the items table and the contract resource refresh so per-row totals and the Summary Value reflect the change. item_type options now come from a shared contract_item_type_options() helper used by both the create form and the detail modal so they stay in sync with the server's item_type CHECK set (MAPPS-190). The stale "edit flow manages items from the detail page" comment on ContractFormValues.items is corrected to describe the now-real detail-page management. #MAPPS-196
feat(contracts): manage line items from the contract detail page
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m1s
7d55c7572b
Contract line items had full backend CRUD (POST /contracts/{id}/items, PUT/DELETE /contract-items/{id}) but the detail page's Line Items card was read-only: no Add, Edit, or Delete affordance. Combined with the edit form intentionally hiding its own item editor, there was no way to add, correct, or remove a contract's line items after creation, and the derived contract Value could not be adjusted.

Add an "Add Item" action to the Line Items card header and make each row clickable, both opening a shared ContractItemFormModal that mirrors the create form's fields (name, type, quantity, unit price). New items POST to /contracts/{id}/items; editing an existing row PUTs to /contract-items/{id}; the modal retains the unexposed fields of the original row (description, included hours, rollover settings, sort_order) so a full-replace PUT does not wipe them. Delete uses the in-app ConfirmDialog (MAPPS-189), not window.confirm. On save or delete both the items table and the contract resource refresh so per-row totals and the Summary Value reflect the change.

item_type options now come from a shared contract_item_type_options() helper used by both the create form and the detail modal so they stay in sync with the server's item_type CHECK set (MAPPS-190). The stale "edit flow manages items from the detail page" comment on ContractFormValues.items is corrected to describe the now-real detail-page management.

#MAPPS-196
Merge main into feat/mapps-196-contract-line-item-management
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 59s
31b1188a0e
Resolve src/pages/contracts.rs: keep both signal decls - editing_item (MAPPS-196 line-item edit state) and confirming_delete (MAPPS-189 styled ConfirmDialog for the contract delete) that landed on main via #198.

#MAPPS-196

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merge branch 'main' into feat/mapps-196-contract-line-item-management
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 2m26s
ce2a05843e
David merged commit f4e36e9157 into main 2026-06-17 12:09:30 +02:00
David deleted branch feat/mapps-196-contract-line-item-management 2026-06-17 12:09:30 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!209
No description provided.