inventory page

This commit is contained in:
2026-07-23 16:05:38 +05:30
parent c6649c9c8f
commit 92165b986c
9 changed files with 150 additions and 71 deletions

View File

@@ -957,6 +957,7 @@ export function useFiestaCreateProductLocation() {
qc.invalidateQueries({ queryKey: ['catalogue', 'imported'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'productLocations'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'productStocks'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'stockStatement'] });
},
onError: (error: any) => {
alert(`Error adding product: ${error.message}`);

View File

@@ -37,10 +37,10 @@ export interface StoreCatalogueItem {
* Live view of the store catalogue + curation helpers. Re-renders whenever the
* catalogue changes via React Query invalidation.
*/
export function useStoreCatalogue() {
export function useStoreCatalogue(tenantid: number = FIESTA_TENANT_ID, locationid: number = FIESTA_PRIMARY_LOCATION_ID) {
const q = useFiestaProductLocations({
tenantid: FIESTA_TENANT_ID,
locationid: FIESTA_PRIMARY_LOCATION_ID,
tenantid,
locationid,
pagesize: 500,
});
@@ -64,8 +64,8 @@ export function useStoreCatalogue() {
const add = (item: StoreCatalogueItem) => {
mutation.mutate({
tenantid: FIESTA_TENANT_ID,
locationid: FIESTA_PRIMARY_LOCATION_ID,
tenantid,
locationid,
productid: Number(item.productid),
qty: item.qty,
price: item.price,
@@ -77,8 +77,8 @@ export function useStoreCatalogue() {
const item = items.find(i => i.productid === id);
if (!item) return;
deleteMutation.mutate({
tenantid: FIESTA_TENANT_ID,
locationid: FIESTA_PRIMARY_LOCATION_ID,
tenantid,
locationid,
productid: Number(id)
});
};
@@ -88,8 +88,8 @@ export function useStoreCatalogue() {
if (!item) return;
const safeQty = Math.max(1, Math.round(qty) || 1);
mutation.mutate({
tenantid: FIESTA_TENANT_ID,
locationid: FIESTA_PRIMARY_LOCATION_ID,
tenantid,
locationid,
productid: Number(id),
qty: safeQty,
price: item.price,
@@ -101,8 +101,8 @@ export function useStoreCatalogue() {
const item = items.find(i => i.productid === id);
if (!item) return;
mutation.mutate({
tenantid: FIESTA_TENANT_ID,
locationid: FIESTA_PRIMARY_LOCATION_ID,
tenantid,
locationid,
productid: Number(id),
qty: item.qty || 0,
price: price,