a2n-seattle / a2n-seattle/rms-app

Web redesign Phase 7/8: Batched return-by-reservation with item condition notes

Aperta
#339 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
idea priority-medium
Lingua principale
TypeScript
Stelle
1
Fork
1
Merge medio
27m
PR unite (30g)
4

Descrizione

# Why?

**As a** user returning items I borrowed together in one batch
**I want** a single "Return" action that pulls up everything from that batch for confirmation (with the ability to deselect items I'm not returning yet) and lets me note each item's condition
**So that** returning a group of items doesn't require repeating single-item returns, and item damage/condition gets tracked in history instead of being lost.

# What?

Phase 7 of an 8-phase redesign of `web/` modeled after our internal Retool RMS app (`https://a2nseattle.retool.com/p/rms-alpha/main`). Depends on Phase 3 (#335, History tab) and Phase 4/5 (#336, #337, return UI) existing to extend.

# Design decisions (resolved during planning)

- **Grouping**: preserve which items were borrowed together via a new field on `ItemsSchema` (e.g. `borrowGroupId`, set to the consuming schedule's id when `BorrowFromSchedule` runs) rather than reconstructing groups from `HistorySchema` — history is an append-only log, not a queryable "currently open group," so this can't be derived after the fact.
- **Condition notes**: new optional `condition?: string` field on `HistorySchema`, populated on `"return"` actions from the new confirmation page. Surfaces directly in the existing History tab/table (Phase 3) — no new table needed.

Scope:
- Backend: add `borrowGroupId?: string` to `ItemsSchema`, set by `BorrowFromSchedule` when it consumes a reservation. Add `condition?: string` to `HistorySchema`. New read API (e.g. `GetReturnGroup`) returning all items sharing a `borrowGroupId`.
- Frontend: replace single-item "Return" with a flow that, on click, fetches the group, shows a confirmation page listing every item in it (pre-selected, individually deselectable) plus a per-item condition-notes field, and submits a batched `returnItem` call for the selected subset only.
- History tab (Phase 3) updated to display the new `condition` value per row.

# Testing

Per this repo's testing policy: unit tests for `borrowGroupId` population on borrow, the new `GetReturnGroup` API, and `condition` persistence on return. Jest/RTL for the confirmation page's deselect + condition-note UI. Playwright e2e covering: borrow a multi-item group → return flow shows the full group pre-selected → deselect one item → confirm return with a condition note on another → verify History reflects both the partial return and the condition note.

# Additional context

Part of an 8-phase `web/` redesign series (#333-#338). This phase reworks/extends Phase 5's (#337) single return flow — expect Phase 5's implementation to be simple/composable specifically so this phase can build on it rather than replace it wholesale.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.