packages/shared/src/order-status.ts: added canEditOrderItems(status), which returns true only for "pending".
apps/api/src/orders/order-status.ts: now re-exports the shared canEditOrderItems instead of its own copy, which also allowed "processing".
apps/web/src/orders/order-items-panel.tsx: uses canEditOrderItems(order.status) to disable the quantity input and Save button and to show the pending-only note.
apps/web/public/app.css: regenerated Tailwind build. It adds the new disabled: utilities, plus resize-none
How to test
List exact commands and manual checks.
bun test apps/api/src/orders/order-quantity-assignment-3.test.ts
bun run test
bun run build:web
Manual checks:
UI, pending order order_1: the quantity is editable and saving shows "Quantity saved."
UI, processing order order_2 and shipped order order_3: the input and Save are disabled and the pending-only note is shown.
API, logged in as an employee:
POST /api/orders/order_2/items/item_3/quantity with { "quantity": 2 } returns 400 with "Order items cannot be changed for this order status."
POST /api/orders/order_3/items/item_4/quantity with { "quantity": 1 } returns 400.
POST /api/orders/order_1/items/item_1/quantity with { "quantity": 2 } returns 200.
Screenshots or recordings
Risks / follow-ups
Behavior change: staff can no longer adjust quantities on processing orders. Shipping address edits and cancellation still allow processing orders; they weren't part of this ticket.
Stale page: if an order moves out of pending while its page is open, Save stays enabled until the page refreshes. The backend rejects the request and an error toast is shown.
Pre-existing: bun run check:api fails with TS2322 in order-quantity-assignment-3.test.ts:28 and order-search-assignment-1.test.ts:28. It fails the same way on master, and this PR doesn't touch those files.
PR checklist
change is scoped to one ticket or one small reviewable concern
acceptance criteria were checked
code follows CONTRIBUTING.md
no unrelated refactor is mixed in
debug code and temporary logs are removed
relevant automated checks were run locally
changed behavior was manually tested when needed
known risks or follow-ups are called out
## Summary
Item quantities can now only be changed on **pending** orders status
## Ticket / Assignment
- Ticket: #15
## What changed
- `packages/shared/src/order-status.ts`: added `canEditOrderItems(status)`, which returns `true` only for `"pending"`.
- `apps/api/src/orders/order-status.ts`: now re-exports the shared `canEditOrderItems` instead of its own copy, which also allowed `"processing"`.
- `apps/web/src/orders/order-items-panel.tsx`: uses `canEditOrderItems(order.status)` to disable the quantity input and Save button and to show the pending-only note.
- `apps/web/public/app.css`: regenerated Tailwind build. It adds the new `disabled:` utilities, plus `resize-none`
## How to test
List exact commands and manual checks.
```bash
bun test apps/api/src/orders/order-quantity-assignment-3.test.ts
bun run test
bun run build:web
```
Manual checks:
- UI, pending order order_1: the quantity is editable and saving shows "Quantity saved."
- UI, processing order order_2 and shipped order order_3: the input and Save are disabled and the pending-only note is shown.
- API, logged in as an employee:
- POST /api/orders/order_2/items/item_3/quantity with { "quantity": 2 } returns 400 with "Order items cannot be changed for this order status."
- POST /api/orders/order_3/items/item_4/quantity with { "quantity": 1 } returns 400.
- POST /api/orders/order_1/items/item_1/quantity with { "quantity": 2 } returns 200.
## Screenshots or recordings
<video src="attachments/8962f98b-338d-486a-90e9-e067bed62704" title="edit_based_status.mov" controls></video>
## Risks / follow-ups
- Behavior change: staff can no longer adjust quantities on processing orders. Shipping address edits and cancellation still allow processing orders; they weren't part of this ticket.
- Stale page: if an order moves out of pending while its page is open, Save stays enabled until the page refreshes. The backend rejects the request and an error toast is shown.
- Pre-existing: bun run check:api fails with TS2322 in order-quantity-assignment-3.test.ts:28 and order-search-assignment-1.test.ts:28. It fails the same way on master, and this PR doesn't touch those files.
## PR checklist
- [x] change is scoped to one ticket or one small reviewable concern
- [x] acceptance criteria were checked
- [x] code follows CONTRIBUTING.md
- [x] no unrelated refactor is mixed in
- [x] debug code and temporary logs are removed
- [x] relevant automated checks were run locally
- [x] changed behavior was manually tested when needed
- [x] known risks or follow-ups are called out
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Item quantities can now only be changed on pending orders status
Ticket / Assignment
What changed
packages/shared/src/order-status.ts: addedcanEditOrderItems(status), which returnstrueonly for"pending".apps/api/src/orders/order-status.ts: now re-exports the sharedcanEditOrderItemsinstead of its own copy, which also allowed"processing".apps/web/src/orders/order-items-panel.tsx: usescanEditOrderItems(order.status)to disable the quantity input and Save button and to show the pending-only note.apps/web/public/app.css: regenerated Tailwind build. It adds the newdisabled:utilities, plusresize-noneHow to test
List exact commands and manual checks.
Manual checks:
Screenshots or recordings
Risks / follow-ups
PR checklist
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.