inventory page
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user