Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Today levels 1 and 2 are always on together; the switches come with the builder.

- **Getting started** at `/admin/supplies/setup`: three steps in plain words (your supplies, what you make, a first stock count), with what's done so far. Until all three are done, the overview links to it.
- **Stock count** at `/admin/supplies/count`: type what's really on the shelf; empty boxes are skipped, and you see each difference before saving. Each difference becomes one adjustment ("Stock count") in one transaction. With lots, a shortfall comes off expired lots first, then the first to expire, and extra goes into the newest lot. Also `stockCount(payload, [{ item, counted }])` and `POST /api/kitting/count`, which refuses the whole count if any supply isn't the person's to manage.
- **Today** at the top of the overview: what to buy (supplies below level, by supplier), what to build (with urgent ones marked, and kits waiting for orders), and what to use soon.
- **Today** at the top of the overview: what to buy (supplies below level, by supplier), what to build (with urgent ones marked, and kits waiting for orders), and what to use soon. With Restock installed, it starts with deliveries that arrived and wait for someone to confirm them. Nothing is added to stock until a person does.

Later, not yet: ordering from suppliers when something stays low for a few days (see [docs/roadmap.md](docs/roadmap.md)), and turning till sales into usage.

Expand Down
18 changes: 18 additions & 0 deletions src/rsc/SuppliesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export async function SuppliesView({ initPageResult, params, searchParams }: Adm
ready.push({ status: await readyStatus(req.payload, r), recs: (await recommendReadyStock(req.payload, r.id)).recommendations, waiting })
}
const setup = canManage ? await setupProgress(req.payload, { user: req.user }) : null
// With Restock installed: deliveries waiting for someone to confirm (crossing kitting-restock). Never adds stock.
const restock = req.payload.config.custom?.restock as { arrived?: (args: { payload: typeof req.payload; user?: unknown }) => Promise<{ id: unknown; number: string; supplier: string }[]>; orders?: string } | undefined
const arrivals = canManage && restock?.arrived ? await restock.arrived({ payload: req.payload, user: req.user }).catch(() => []) : []
const toBuild = ready.filter((x) => x.status.state === 'build-more' || x.status.state === 'urgent')
const waitingTotal = ready.reduce((t, x) => t + x.waiting, 0)
const current = rows.filter((r) => !r.retired)
Expand Down Expand Up @@ -154,6 +157,21 @@ export async function SuppliesView({ initPageResult, params, searchParams }: Adm
<section aria-labelledby="supplies-today">
<h2 id="supplies-today" style={{ marginTop: 0 }}>Today</h2>
<ul style={{ margin: 0, paddingInlineStart: 20 }}>
{arrivals.length > 0 && (
<li>
<strong>Arrived, please confirm:</strong>{' '}
{arrivals.map((a, i) => (
<React.Fragment key={String(a.id)}>
{i ? ', ' : ''}
<a href={`${admin}/collections/${restock?.orders ?? 'purchase-orders'}/${String(a.id)}`}>
{a.number}
{a.supplier ? ` from ${a.supplier}` : ''}
</a>
</React.Fragment>
))}
. Nothing is added to stock until someone checks the boxes.
</li>
)}
<li>
{below.length ? (
<a href="#supplies-reorder">
Expand Down
Loading