management: edit item name and sell price from the dashboard #43

Closed
opened 2026-08-27 06:35:51 +00:00 by yuris · 0 comments
Owner

The mockups make price the loudest element on every card, and the spec is blunt that "a stale price is worse than no price". Today a price cannot be corrected in the dashboard: app/(dashboard)/stok/inventory-edit-form.tsx (the "Toko" tab) exposes only slug, description, images, category, brand, part_number, weight_grams, install_service, shippable, is_published. itemName and sellPrice are editable only through PATCH /api/v1/inventory/:id or the update_inventory_item MCP tool. stock moves through adjustment-modal.tsx and should stay that way — it belongs to the FIFO ledger.

Change

Add itemName and sellPrice to the edit form. lib/inventory/actions.ts#updateInventory and UpdateInventorySchema already accept both, so this is form and UI work, not a new server path. Keep the itemName uniqueness error from inventory_item_name_uniq legible — the create modal already surfaces it, reuse that handling rather than inventing a second message. sellPrice of 0 must keep meaning "belum ditentukan" (price: null in the export), so the field needs to allow clearing back to zero, not just raising a number.

Acceptance

An operator can fix a wrong name and a stale price entirely in the dashboard. Saving either triggers requestStoreDeploy (both are already in STOREFRONT_COLUMNS). A duplicate name shows the existing readable error, not a raw Postgres constraint dump. Existing lib/inventory tests still pass; add a case only if the zero/null price path is not already covered.

The mockups make price the loudest element on every card, and the spec is blunt that *"a stale price is worse than no price"*. Today a price cannot be corrected in the dashboard: `app/(dashboard)/stok/inventory-edit-form.tsx` (the "Toko" tab) exposes only `slug`, `description`, `images`, `category`, `brand`, `part_number`, `weight_grams`, `install_service`, `shippable`, `is_published`. `itemName` and `sellPrice` are editable **only** through `PATCH /api/v1/inventory/:id` or the `update_inventory_item` MCP tool. `stock` moves through `adjustment-modal.tsx` and should stay that way — it belongs to the FIFO ledger. ### Change Add `itemName` and `sellPrice` to the edit form. `lib/inventory/actions.ts#updateInventory` and `UpdateInventorySchema` already accept both, so this is form and UI work, not a new server path. Keep the `itemName` uniqueness error from `inventory_item_name_uniq` legible — the create modal already surfaces it, reuse that handling rather than inventing a second message. `sellPrice` of `0` must keep meaning "belum ditentukan" (`price: null` in the export), so the field needs to allow clearing back to zero, not just raising a number. ### Acceptance An operator can fix a wrong name and a stale price entirely in the dashboard. Saving either triggers `requestStoreDeploy` (both are already in `STOREFRONT_COLUMNS`). A duplicate name shows the existing readable error, not a raw Postgres constraint dump. Existing `lib/inventory` tests still pass; add a case only if the zero/null price path is not already covered.
yuris closed this issue 2026-08-27 16:34:03 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
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
yuris/garage#43
No description provided.