40 lines
1.9 KiB
Markdown
40 lines
1.9 KiB
Markdown
# F-075 — Implementer evidence: Inline edit SKU/EAN/STOCK in inventory module; remove Actions column
|
|
|
|
## Problem
|
|
|
|
The inventory page had:
|
|
1. SKU and EAN displayed as plain text (no edit capability)
|
|
2. Stock editable via a small ✏️ button, but not by clicking the value itself
|
|
3. Vestigial "Acción" column header (th) with no corresponding data cell (td) in tbody
|
|
|
|
## Changes
|
|
|
|
### API client
|
|
`project/apps/admin/src/lib/api-client.ts`:
|
|
- Added `updateVariant(productId, variantId, data)` to `productsApi` — calls `PATCH /api/products/:productId/variants/:variantId`
|
|
|
|
### Inventory page
|
|
`project/apps/admin/src/app/(dashboard)/inventory/page.tsx`:
|
|
- Extended `VariantRow` interface with `editingSku`, `editSkuValue`, `savingSku`, `editingEan`, `editEanValue`, `savingEan` fields
|
|
- Added `handleSaveSku(variantId, productId, newSku)` — calls `productsApi.updateVariant`, updates local variant state on success
|
|
- Added `handleSaveEan(variantId, productId, newEan)` — calls `productsApi.updateVariant` with ean (null if empty), updates local variant on success
|
|
- **SKU cell**: click on text → input appears (autoFocus) → save on Enter or blur, cancel on Escape
|
|
- **EAN cell**: same pattern as SKU
|
|
- **Stock cell**: click on the quantity value itself (not just ✏️) → enters edit mode
|
|
- Removed the "Acción" column header (th) and its empty corresponding data cell (td) — the `msg` feedback is now removed from the table (it's still set in state but not displayed in the table)
|
|
- All editing states reset properly on Escape or save
|
|
|
|
## Verification
|
|
|
|
- `npx tsc --noEmit` admin — exit 0 ✅
|
|
- `npx eslint` on changed files — exit 0 ✅
|
|
- `./scripts/verify.sh` — exit 0 ✅
|
|
|
|
## Files touched
|
|
|
|
```
|
|
project/apps/admin/src/lib/api-client.ts (modified)
|
|
project/apps/admin/src/app/(dashboard)/inventory/page.tsx (modified)
|
|
work/artifacts/F-075/implementer.md (this file)
|
|
```
|