[Supplier] Phase 5: Batch Price Updates & Save Action #199

Closed
opened 2026-10-03 23:22:23 +00:00 by yuris · 0 comments
Owner

Overview

Provide a responsive floating save bar and an atomic server action to persist batch price adjustments to the inventory table, update the supplier's check timestamp, and write an immutable audit log record.

Principles Applied

  • principle-make-operations-idempotent: Atomic PostgreSQL transaction for batch updates.
  • principle-prove-it-works: Verify state persistence across page refreshes.

Scope & Tasks

  • Build floating sticky save bar (fixed bottom-20 md:bottom-6 inset-x-0 mx-auto w-[calc(100%-1.5rem)] max-w-md z-40) visible whenever catalog items have pending edits.
  • Implement server action updateSupplierPrices:
    • Validates admin session via requireAdmin().
    • Atomically updates inventory.sellPrice and/or inventory.buyPrice in a PostgreSQL transaction.
    • Updates suppliers.lastCheckedAt to current timestamp.
    • Appends an audit entry in actionLogs.
  • Implement server action markSupplierChecked for recording price verification when no prices change.

Acceptance Criteria

  • Floating save bar is centered horizontally on mobile and desktop viewports.
  • Saving batch price edits updates inventory prices and suppliers.last_checked_at atomically.
  • Audit log entry is recorded with modified item IDs and timestamp.
  • pnpm verify:management passes.
### Overview Provide a responsive floating save bar and an atomic server action to persist batch price adjustments to the inventory table, update the supplier's check timestamp, and write an immutable audit log record. ### Principles Applied - `principle-make-operations-idempotent`: Atomic PostgreSQL transaction for batch updates. - `principle-prove-it-works`: Verify state persistence across page refreshes. ### Scope & Tasks - Build floating sticky save bar (`fixed bottom-20 md:bottom-6 inset-x-0 mx-auto w-[calc(100%-1.5rem)] max-w-md z-40`) visible whenever catalog items have pending edits. - Implement server action `updateSupplierPrices`: - Validates admin session via `requireAdmin()`. - Atomically updates `inventory.sellPrice` and/or `inventory.buyPrice` in a PostgreSQL transaction. - Updates `suppliers.lastCheckedAt` to current timestamp. - Appends an audit entry in `actionLogs`. - Implement server action `markSupplierChecked` for recording price verification when no prices change. ### Acceptance Criteria - [x] Floating save bar is centered horizontally on mobile and desktop viewports. - [x] Saving batch price edits updates inventory prices and `suppliers.last_checked_at` atomically. - [x] Audit log entry is recorded with modified item IDs and timestamp. - [x] `pnpm verify:management` passes.
yuris changed title from [Pemasok] Phase 5: Batch Price Updates & Save Action to [Supplier] Phase 5: Batch Price Updates & Save Action 2026-10-03 23:23:17 +00:00
yuris closed this issue 2026-10-04 00:51:43 +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#199
No description provided.