fix(contracts): rustfmt diffs and conditional rsx actions in rate cards #153

Merged
nrupard merged 2 commits from fix/mapps-178-contracts-fmt into main 2026-06-15 18:24:57 +02:00
Owner

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

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<Element>) 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>
feat(contracts): editable rate cards and line items
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 6s
f06b1c988d
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>
fix(contracts): rustfmt diffs and conditional rsx actions in rate cards
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 57s
dadd3d5454
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<Element>) 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>
Merge main into fix/mapps-178-contracts-fmt
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 56s
Create release / Create release from merged PR (pull_request) Has been skipped
c774b0d0f8
Resolve the conflict in src/pages/contracts.rs. PR #152 (MAPPS-160) merged to main with later review-fix commits that rewrote the RateCardFormModal save arm (the create path now returns the new card id via oncreated), so this branch's reformat of the old save arm no longer applies; took main's version there. The still-needed fixes from this branch are preserved: the RateCardItemsCard Card actions are wrapped Some(rsx!)/None (Option<Element>, matching tickets.rs) keeping main's `disabled: !can_add`, and the rustfmt wraps on RateCardItemFormState::after and the item-modal let-else.

#MAPPS-178

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch fix/mapps-178-contracts-fmt 2026-06-15 18:24:57 +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!153
No description provided.