feat(contracts): manage line items from the contract detail page #209
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-196-contract-line-item-management"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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