pricing update

This commit is contained in:
2026-08-06 10:58:34 +05:30
parent 13db63e219
commit ac6dbd7671
9 changed files with 304 additions and 107 deletions

View File

@@ -47,6 +47,7 @@ import {
getProductsCount,
getProductStocks,
getProductLocations,
createProductLocations,
getMasterCatalog,
getProductCategories,
getProductSubcategories,
@@ -1024,6 +1025,25 @@ export function useFiestaCreateProductLocation() {
});
}
/**
* Publish/reprice one product across many outlets in a single request. Used by
* the admin catalogue, where a price the admin sets is meant to apply to every
* store under the tenant — not just whichever outlet happened to load first.
*/
export function useFiestaCreateProductLocations() {
const qc = useQueryClient();
return useMutation({
mutationFn: (inputs: Array<{ tenantid: number; locationid: number; productid: number; price?: number; status?: string }>) =>
createProductLocations(inputs),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['catalogue', 'imported'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'productLocations'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'productStocks'] });
qc.invalidateQueries({ queryKey: ['fiesta', 'stockStatement'] });
},
});
}
export function useFiestaDeleteProductLocation() {
const qc = useQueryClient();
return useMutation({