upload sheet according to the tenant

This commit is contained in:
2026-08-29 12:08:38 +05:30
parent 32c3bef3ad
commit 29613e25ee
8 changed files with 1227 additions and 75 deletions

View File

@@ -1,18 +1,21 @@
import { Drawer } from './Drawer';
import { TenantSheetImportPanel } from './TenantSheetImportPanel';
import { SheetImportPanel } from '@/features/nearle-admin/import/SheetImportPanel';
/**
* Upload a product spreadsheet, from the Products tab.
*
* The panel inside is the one already built for Nearle Admin — reused rather
* than rewritten, because the awkward part is not the UI. There is no batch
* create in Fiesta: `POST /products/create` takes ONE product and does not
* return the id it generated, so an import is N creates, then a lookup by SKU
* to resolve the ids, then one batched location call and one batched stock
* call. The panel stages that so a row the server rejects fails alone.
* The same panel the Nearle Admin uses, with one difference that matters: the
* tenant and branch come from the SESSION rather than being asked for. A shop
* signing in has already answered "whose products are these, and which shelf",
* and asking again would offer a choice with one legal answer — plus a chance
* to pick another merchant by mistake.
*
* It is not idempotent and cannot be made so from here — nothing on the server
* dedupes on SKU — so the panel says that before the button rather than after.
* The sheet goes to the catalogue ingest service and waits in its review inbox;
* once an admin releases it, the products are priced and stocked here from the
* sheet's own columns. That replaces the older path through
* `TenantSheetImportPanel`, which ran N creates straight from the browser
* because Fiesta has no batch create — a row the server rejected there failed
* alone and left the import half done.
*/
export function SheetUploadDrawer({
tenantid,
@@ -30,7 +33,7 @@ export function SheetUploadDrawer({
width={560}
onClose={onClose}
>
<TenantSheetImportPanel tenantid={tenantid} locationid={locationid} />
<SheetImportPanel tenantid={tenantid} locationid={locationid} />
</Drawer>
);
}