shifts updated for pos
This commit is contained in:
@@ -1701,6 +1701,11 @@ export interface PosStaffUser {
|
||||
role: string;
|
||||
pin?: string;
|
||||
has_password: boolean;
|
||||
/** Resolved shift. Blank on accounts created before shifts existed. */
|
||||
shift_id?: number;
|
||||
shift_name?: string;
|
||||
shift_start?: string;
|
||||
shift_end?: string;
|
||||
/** Present ONLY in the answer to a create or a reset. Never in a listing. */
|
||||
password?: string;
|
||||
location_id: number;
|
||||
@@ -1758,9 +1763,69 @@ export interface CreatePosStaffInput {
|
||||
/** "supervisor" | "cashier" — from getPosRoles, not a hardcoded literal. */
|
||||
role: string;
|
||||
pin: string;
|
||||
/**
|
||||
* The mobile number this person signs in at the till with.
|
||||
*
|
||||
* Normalised to ten digits server-side and required to be unique among a
|
||||
* tenant's till accounts, because the terminal's sign-in matches on it.
|
||||
*/
|
||||
contactno?: string;
|
||||
/** staffshifts.staff_shift_id. Omit or 0 to leave unassigned. */
|
||||
shift_id?: number;
|
||||
/** Optional. Omitted, the server generates one and walks past collisions. */
|
||||
authname?: string;
|
||||
contactno?: string;
|
||||
}
|
||||
|
||||
/** A working window a till account can be assigned to. */
|
||||
export interface PosStaffShift {
|
||||
staff_shift_id: number;
|
||||
tenantid: number;
|
||||
locationid: number;
|
||||
name: string;
|
||||
/** 24-hour `HH:MM`. */
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
/** Seven 0/1 characters from Monday. Empty means every day. */
|
||||
weekdays?: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
/** GET /tenants/getstaffshifts — the windows configured at one outlet. */
|
||||
export async function getStaffShifts(opts: {
|
||||
tenantid: number;
|
||||
locationid: number;
|
||||
}): Promise<PosStaffShift[]> {
|
||||
const json = await fiestaGet<{ details?: { shifts?: PosStaffShift[] } | PosStaffShift[] }>(
|
||||
'tenants/getstaffshifts',
|
||||
{ tenantid: opts.tenantid, locationid: opts.locationid },
|
||||
);
|
||||
const d = json?.details;
|
||||
if (Array.isArray(d)) return d;
|
||||
return d?.shifts ?? [];
|
||||
}
|
||||
|
||||
export async function createStaffShift(input: {
|
||||
tenantid: number;
|
||||
locationid: number;
|
||||
name: string;
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
weekdays?: string;
|
||||
}): Promise<Row> {
|
||||
return fiestaSend<Row>('tenants/createstaffshift', 'POST', input);
|
||||
}
|
||||
|
||||
export async function updateStaffShift(input: {
|
||||
tenantid: number;
|
||||
locationid: number;
|
||||
staff_shift_id: number;
|
||||
name?: string;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
weekdays?: string;
|
||||
status?: string;
|
||||
}): Promise<Row> {
|
||||
return fiestaSend<Row>('tenants/updatestaffshift', 'PUT', input);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1808,6 +1873,8 @@ export async function updatePosStaff(input: {
|
||||
pin?: string;
|
||||
authname?: string;
|
||||
contactno?: string;
|
||||
/** staffshifts.staff_shift_id. Zero or omitted leaves the shift unchanged. */
|
||||
shift_id?: number;
|
||||
password?: string;
|
||||
status?: string;
|
||||
}): Promise<Row> {
|
||||
|
||||
Reference in New Issue
Block a user