main stocks update
This commit is contained in:
@@ -49,7 +49,7 @@ import {
|
||||
} from '../services/fiestaQueries';
|
||||
import { FIESTA_TENANT_ID, FIESTA_PRIMARY_LOCATION_ID, str as fstr } from '../services/fiestaApi';
|
||||
import { stockRowToProduct, stockRowToInventory } from '../services/fiestaMappers';
|
||||
import { useStoreCatalogue } from '../services/storeCatalogue';
|
||||
import { useStoreCatalogue, isPublishedItem } from '../services/storeCatalogue';
|
||||
import BulkCartDrawer from './BulkCartDrawer';
|
||||
import AwaitingApi from './AwaitingApi';
|
||||
import { SlideDrawer, Skeleton, TH_STYLE, SURFACE_ALT, TEXT, TEXT_2, TEXT_3, BORDER, BRAND, tint, edge, StatusChip } from './consoleUi';
|
||||
@@ -169,13 +169,17 @@ export default function InventoryView({
|
||||
stockStatus: 'Healthy',
|
||||
trend: 'flat',
|
||||
exposure: 'All Outlets',
|
||||
verified: item.status === 'Active', // Active means it's fully published with price
|
||||
// "Fully published with price" — tested on the price itself, not on
|
||||
// status. Status is not a publish flag: the backend overwrites our
|
||||
// 'Active' with an availability value, which used to flip published
|
||||
// products back to unverified. See storeCatalogue.isPublishedItem.
|
||||
verified: item.price > 0,
|
||||
});
|
||||
} else {
|
||||
// If it exists but we have curated price in storeCat, we could apply it here if needed
|
||||
const existing = byId.get(id)!;
|
||||
existing.price = item.price || existing.price;
|
||||
existing.verified = existing.verified || item.status === 'Active';
|
||||
existing.verified = existing.verified || item.price > 0;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -557,7 +561,10 @@ export default function InventoryView({
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className={`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 ${!isLocalSidebarOpen ? (!isSidebarOpen ? 'xl:grid-cols-5 2xl:grid-cols-6' : 'xl:grid-cols-4 2xl:grid-cols-5') : (!isSidebarOpen ? 'xl:grid-cols-4 2xl:grid-cols-5' : 'xl:grid-cols-3 2xl:grid-cols-4')} gap-4`}>
|
||||
{filteredProducts.map((prod) => {
|
||||
const isPublished = storeCat.has(prod.id) && storeCat.items.find(i => i.productid === prod.id)?.status === 'Active';
|
||||
// Presence in the store catalogue IS publication — the row
|
||||
// stays until the admin removes it. Don't gate on status;
|
||||
// the backend rewrites it to 'available'/'outofstock'.
|
||||
const isPublished = isPublishedItem(storeCat.items.find(i => i.productid === prod.id));
|
||||
|
||||
return (
|
||||
<div key={prod.id} onClick={() => setSelectedAdminProduct(prod)} className="bg-white/80 backdrop-blur-md border border-[#e2e8f0] rounded-none flex flex-col shadow-sm hover:shadow-[0_12px_24px_rgba(99,102,241,0.06)] hover:border-[#662582]/40 hover:-translate-y-1 transition-all duration-300 relative group overflow-hidden cursor-pointer">
|
||||
|
||||
Reference in New Issue
Block a user