Management: edit form for store fields in inventory details sheet #27

Open
opened 2026-07-25 14:27:58 +00:00 by yuris · 0 comments
Owner

Problem

The inventory details sheet shows stock/price but has no way to set slug, description, images, or is_published. Staff cannot prepare catalog items for the store without using SQL or the API directly.

Target

  • apps/management/app/(dashboard)/stok/inventory-details-sheet.tsx
  • New file: apps/management/app/(dashboard)/stok/inventory-edit-form.tsx

Change

  • Add a third tab "Toko" (store) to the details sheet beside "Detail" and "Riwayat".
  • The Toko tab contains an edit form using existing FormField/FormInput primitives with:
    • Slug — text input; placeholder nama-produk-singkat; show the validator pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$.
    • Deskripsi — textarea.
    • Gambar — list of URL inputs with add/remove; each entry is a URL string (no file upload — images are hosted externally via R2 and referenced by URL).
    • Tampilkan di toko — checkbox / toggle. Disabled when slug is empty (published requires slug).
  • On submit, call updateInventory server action with the changed fields only.
  • After a successful save, call router.refresh() and show a sonner toast.
  • Extract the form into inventory-edit-form.tsx to keep the sheet file readable.

Patterns to follow

  • AdjustmentModal for form shape (FormDialog, FormField, FormInput, useRouter, sonner toast).
  • DetailsActions already in the sheet footer — keep it.

Acceptance

  • "Toko" tab renders slug/description/images/publish fields.
  • Submit calls updateInventory; success toasts and refreshes; error toasts.
  • Saving is_published: true without a slug is blocked at the UI (button disabled).
  • tsc --noEmit and biome check pass.
## Problem The inventory details sheet shows stock/price but has no way to set `slug`, `description`, `images`, or `is_published`. Staff cannot prepare catalog items for the store without using SQL or the API directly. ## Target - `apps/management/app/(dashboard)/stok/inventory-details-sheet.tsx` - New file: `apps/management/app/(dashboard)/stok/inventory-edit-form.tsx` ## Change - Add a third tab "Toko" (store) to the details sheet beside "Detail" and "Riwayat". - The Toko tab contains an edit form using existing `FormField`/`FormInput` primitives with: - **Slug** — text input; placeholder `nama-produk-singkat`; show the validator pattern `^[a-z0-9]+(?:-[a-z0-9]+)*$`. - **Deskripsi** — textarea. - **Gambar** — list of URL inputs with add/remove; each entry is a URL string (no file upload — images are hosted externally via R2 and referenced by URL). - **Tampilkan di toko** — checkbox / toggle. Disabled when slug is empty (published requires slug). - On submit, call `updateInventory` server action with the changed fields only. - After a successful save, call `router.refresh()` and show a sonner toast. - Extract the form into `inventory-edit-form.tsx` to keep the sheet file readable. ## Patterns to follow - `AdjustmentModal` for form shape (`FormDialog`, `FormField`, `FormInput`, `useRouter`, sonner `toast`). - `DetailsActions` already in the sheet footer — keep it. ## Acceptance - "Toko" tab renders slug/description/images/publish fields. - Submit calls `updateInventory`; success toasts and refreshes; error toasts. - Saving `is_published: true` without a slug is blocked at the UI (button disabled). - `tsc --noEmit` and `biome check` pass.
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#27
No description provided.