feat(contracts): editable rate cards and line items (MAPPS-160) #152
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-160-editable-rate-cards"
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?
What
MAPPS-160: rate cards and their per-work-type rate lines are now fully editable, wired to the existing mokosh-server CRUD. Edit affordances are finance-gated (
can_manage_billing) to match the server'sRequireFinancewrite guard; non-finance users keep the read-only view. The same pages render under/rate-cardsand/settings/rate-cards, so both gain editing.Cards
POST /rate-cards.PUT /rate-cards/{id}) and deletes (DELETE /rate-cards/{id}, confirm dialog).Line items
work_type_id).POST /rate-cards/{id}/items(upsert),DELETE /rate-card-items/{id}.GET /work-types(were shown raw before).Implementation notes
UpsertRateCardRequest/UpsertRateCardItemRequeststructs, so money serializes as JSON numbers (Decimal). Amounts are parsed and validated client-side (parse::<Decimal>,Uuid::parse_str) before save, so a bad entry shows a message instead of a raw 400.billing.rs(TaxRate) andsettings.rs(lookup editors):crate::components::{Modal, Input, Select, Checkbox}, confirm-on-delete,*_resource.restart()after save.Caveats
cargo clippy --all-targets -- -D warnings) gates. Reviewer pass found no compile/clippy issues.Test plan
MAPPS-160. Makes rate cards and their per-work-type rate lines fully editable, wired to the existing mokosh-server CRUD. Edit affordances are finance-gated (can_manage_billing) to match the server's RequireFinance write guard; everyone else keeps the read-only view. The same pages are surfaced under /rate-cards and /settings/rate-cards, so both gain editing. Cards: a finance-only "New Rate Card" button on the list opens a create modal (name, description, default); the detail page gains an "Edit Card" action whose modal also deletes. POST/PUT /rate-cards, DELETE /rate-cards/{id}. Line items: the detail "Rates" card gains an "Add Rate" button and rows become clickable to edit. The editor picks a work type (locked when editing, since the server upserts by work_type_id; add-mode excludes work types already on the card to avoid silently overwriting one) and sets hourly / after-hours / emergency rates. POST /rate-cards/{id}/items (upsert), DELETE /rate-card-items/{id}. Work-type UUIDs are now resolved to names via GET /work-types instead of shown raw. Bodies use the existing typed UpsertRateCard*Request structs, so money is sent as JSON numbers (Decimal), parsed and validated client-side before save. Not compiled locally (no Rust toolchain in this environment); mirrors the proven billing TaxRate and settings lookup editors and is gated by CI (cargo clippy --all-targets -- -D warnings). #MAPPS-160 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>