targo-frontend/src/modules/timesheets/models/shift.models.ts

50 lines
1.3 KiB
TypeScript

import type { QSelectOption } from "quasar";
export const SHIFT_TYPES: ShiftType[] = [
'REGULAR',
'EVENING',
'EMERGENCY',
'HOLIDAY',
'VACATION',
'SICK',
// 'BANKING',
'WITHDRAW_BANKED',
];
export type ShiftType = 'REGULAR' | 'EVENING' | 'EMERGENCY' | 'HOLIDAY' | 'VACATION' | 'SICK' | /*'BANKING'|*/ 'WITHDRAW_BANKED';
export type ShiftErrorCode = 'SHIFT_OVERLAP' | 'MISSING_START_TIME' | 'MISSING_END_TIME' | 'COMMENT_LENGTH_EXCEEDED' | 'APPROVAL_LOCK' | 'INVALID_DATE' | 'INVALID TYPE' | 'INVALID_TIMESHEET';
export class Shift {
id: number;
timesheet_id: number;
date: string; //YYYY-MM-DD
type: ShiftType;
start_time: string; //HH:mm:ss
end_time: string; //HH:mm:ss
comment: string | undefined;
is_approved: boolean;
is_remote: boolean;
has_error: boolean;
constructor(date?: string) {
this.id = -1;
this.timesheet_id = -1;
this.date = date ?? '';
this.type = 'REGULAR';
this.start_time = '';
this.end_time = '';
this.comment = undefined;
this.is_approved = false;
this.is_remote = false;
this.has_error = false;
}
}
export interface ShiftOption extends QSelectOption {
label: string;
value: ShiftType;
icon: string;
icon_color: string;
disable?: boolean;
}