This commit is contained in:
2026-09-15 20:51:01 +05:30
parent b2104d21b0
commit 98398894a5
14 changed files with 1688 additions and 619 deletions

View File

@@ -546,11 +546,23 @@ export function useStaff(tenantid: number | undefined) {
* Fanned out because `getposusers` takes a single `locationid` — the same
* constraint as every other POS read.
*/
export function usePosUsersByBranch(tenantid: number | undefined, locationIds: readonly number[]) {
/**
* Till accounts, per branch.
*
* `includeInactive` is opt-in and part of the cache key, so a page that wants
* to keep a switched-off cashier on screen gets them without changing what
* every other caller sees — see `posUsersApi.list` for why the default stayed
* as it was.
*/
export function usePosUsersByBranch(
tenantid: number | undefined,
locationIds: readonly number[],
includeInactive = false,
) {
return useQueries({
queries: locationIds.map((locationid) => ({
queryKey: queryKeys.people.posUsers(tenantid ?? 0, locationid),
queryFn: () => posUsersApi.list(tenantid as number, locationid),
queryKey: [...queryKeys.people.posUsers(tenantid ?? 0, locationid), includeInactive] as const,
queryFn: () => posUsersApi.list(tenantid as number, locationid, includeInactive),
enabled: Boolean(tenantid),
...stable,
})),