management: edit item name and sell price from the dashboard #43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 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 onlyslug,description,images,category,brand,part_number,weight_grams,install_service,shippable,is_published.itemNameandsellPriceare editable only throughPATCH /api/v1/inventory/:idor theupdate_inventory_itemMCP tool.stockmoves throughadjustment-modal.tsxand should stay that way — it belongs to the FIFO ledger.Change
Add
itemNameandsellPriceto the edit form.lib/inventory/actions.ts#updateInventoryandUpdateInventorySchemaalready accept both, so this is form and UI work, not a new server path. Keep theitemNameuniqueness error frominventory_item_name_uniqlegible — the create modal already surfaces it, reuse that handling rather than inventing a second message.sellPriceof0must keep meaning "belum ditentukan" (price: nullin 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 inSTOREFRONT_COLUMNS). A duplicate name shows the existing readable error, not a raw Postgres constraint dump. Existinglib/inventorytests still pass; add a case only if the zero/null price path is not already covered.