shift fix
This commit is contained in:
@@ -185,11 +185,19 @@ export const posUsersApi = {
|
||||
*
|
||||
* Wrapped the same way — `{location_id, shifts}` (`posController.go:934-936`).
|
||||
*/
|
||||
shifts: (tenantid: number, locationid: number) =>
|
||||
/**
|
||||
* The tenant's shift windows.
|
||||
*
|
||||
* `locationid` is optional and usually omitted. A shift belongs to the
|
||||
* business, so the tenant's set is what every picker in the console should
|
||||
* offer; naming a branch narrows to the tenant's plus that branch's own, for
|
||||
* the outlet that genuinely runs different hours.
|
||||
*/
|
||||
shifts: (tenantid: number, locationid?: number) =>
|
||||
api
|
||||
.get<{ location_id?: number; shifts?: StaffShift[] }>(`${WEB}/tenants/getstaffshifts`, {
|
||||
tenantid,
|
||||
locationid,
|
||||
...(locationid ? { locationid } : {}),
|
||||
})
|
||||
.then((page) => (Array.isArray(page?.shifts) ? page.shifts : [])),
|
||||
|
||||
@@ -207,9 +215,16 @@ export const posUsersApi = {
|
||||
*/
|
||||
createShift: (
|
||||
tenantid: number,
|
||||
locationid: number,
|
||||
shift: { name: string; start_time: string; end_time: string; weekdays?: string },
|
||||
) => api.post<StaffShift>(`${WEB}/tenants/createstaffshift`, { tenantid, locationid, ...shift }),
|
||||
/** Only for a shop that genuinely runs different hours from the business. */
|
||||
locationid?: number,
|
||||
) =>
|
||||
api.post<StaffShift>(`${WEB}/tenants/createstaffshift`, {
|
||||
tenantid,
|
||||
// Zero means the whole tenant, which is the ordinary case.
|
||||
locationid: locationid ?? 0,
|
||||
...shift,
|
||||
}),
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user