fix(contracts): rustfmt diffs and conditional rsx actions in rate cards #153
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mapps-178-contracts-fmt"
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?
The check.yml run on PR #152 failed at the rustfmt step: cargo fmt --check reported diffs in src/pages/contracts.rs (the RateCardFormModal save arm, the RateCardItemFormState::after conversion, and the let-else in RateCardItemFormModal). Applying cargo fmt resolves those three diffs.
The same commit also did not compile: RateCardItemsCard set the Card actions attribute (type Option) with a bare if can_edit { rsx! { ... } } else { rsx! {} }, which the dioxus rsx macro rejects with "Expected an expression" and which is the wrong type. Because rustfmt runs before clippy in check.yml, this error was masked by the fmt failure. Wrap the branches as Some(rsx! { ... }) / None to match the working conditional-actions pattern used in tickets.rs, so clippy, the wasm32 check, and cargo test --lib all pass.
#MAPPS-178
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
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>