targo-frontend/src/modules/timesheet-approval/models/timesheet-overview.models.ts

211 lines
6.0 KiB
TypeScript

import type { QTableColumn } from "quasar";
export class TimesheetApprovalOverview {
email: string;
employee_first_name: string;
employee_last_name: string;
supervisor: {
first_name: string;
last_name: string;
email: string;
} | null;
is_active: boolean;
regular_hours: number;
other_hours: {
evening_hours: number;
emergency_hours: number;
overtime_hours: number;
sick_hours: number;
holiday_hours: number;
vacation_hours: number;
};
weekly_hours: number[];
total_hours: number;
expenses: number;
mileage: number;
is_approved: boolean;
constructor() {
this.email = '';
this.employee_first_name = 'Unknown';
this.employee_last_name = 'Unknown';
this.supervisor = null;
this.is_active = true;
this.regular_hours = 0;
this.other_hours = {
evening_hours: 0,
emergency_hours: 0,
overtime_hours: 0,
sick_hours: 0,
holiday_hours: 0,
vacation_hours: 0,
}
this.weekly_hours = [0];
this.total_hours = 0;
this.expenses = 0;
this.mileage = 0;
this.is_approved = false;
};
}
export interface PayPeriodOverviewResponse {
pay_period_no: number;
pay_year: number;
period_start: string;
period_end: string;
payday: string;
label: string;
employees_overview: TimesheetApprovalOverview[];
}
export interface PayPeriodOverviewFilters {
is_showing_inactive: boolean;
is_showing_team_only: boolean;
supervisors: string[];
name_search_string: string;
}
export type OverviewColumns = 'employee_first_name' | 'employee_last_name' | 'email' | 'REGULAR' | 'EVENING' | 'EMERGENCY' | 'SICK' | 'HOLIDAY' | 'VACATION' | 'OVERTIME' | 'expenses' | 'mileage' | 'total_hours' | 'weekly_hours_1' | 'weekly_hours_2' | 'is_approved' | 'is_active'
export const overview_column_names = {
FIRST_NAME: 'employee_first_name',
LAST_NAME: 'employee_last_name',
EMAIL: 'email',
REGULAR: 'REGULAR',
EVENING: 'EVENING',
EMERGENCY: 'EMERGENCY',
SICK: 'SICK',
HOLIDAY: 'HOLIDAY',
VACATION: 'VACATION',
OVERTIME: 'OVERTIME',
EXPENSES: 'expenses',
MILEAGE: 'mileage',
WEEKLY_HOURS_1: 'weekly_hours_1',
WEEKLY_HOURS_2: 'weekly_hours_2',
TOTAL_HOURS: 'total_hours',
IS_APPROVED: 'is_approved',
IS_ACTIVE: 'is_active',
}
export const pay_period_overview_columns: QTableColumn[] = [
{
name: overview_column_names.FIRST_NAME,
label: 'timesheet_approvals.table.full_name',
align: 'left',
field: overview_column_names.FIRST_NAME,
sortable: true,
required: true,
style: 'width: 10vw;'
},
{
name: overview_column_names.LAST_NAME,
label: 'timesheet_approvals.table.full_name',
align: 'left',
field: '',
sortable: true,
},
{
name: overview_column_names.EMAIL,
label: 'timesheet_approvals.table.email',
align: 'left',
field: overview_column_names.EMAIL,
sortable: true,
style: 'width: 10vw;'
},
{
name: overview_column_names.REGULAR,
label: 'shared.shift_type.regular',
align: 'left',
field: 'regular_hours',
sortable: true,
},
{
name: overview_column_names.EVENING,
label: 'shared.shift_type.evening',
align: 'left',
field: row => row.other_hours.evening_hours,
sortable: true,
},
{
name: overview_column_names.EMERGENCY,
label: 'shared.shift_type.emergency',
align: 'left',
field: row => row.other_hours.emergency_hours,
sortable: true,
},
{
name: overview_column_names.SICK,
label: 'shared.shift_type.sick',
align: 'left',
field: row => row.other_hours.sick_hours,
sortable: true,
},
{
name: overview_column_names.HOLIDAY,
label: 'shared.shift_type.holiday',
align: 'left',
field: row => row.other_hours.holiday_hours,
sortable: true,
},
{
name: overview_column_names.VACATION,
label: 'shared.shift_type.vacation',
align: 'left',
field: row => row.other_hours.vacation_hours,
sortable: true,
},
{
name: overview_column_names.OVERTIME,
label: 'shared.shift_type.overtime',
align: 'left',
field: row => row.other_hours.overtime_hours,
sortable: true,
},
{
name: overview_column_names.EXPENSES,
label: 'timesheet_approvals.table.expenses',
align: 'left',
field: 'expenses',
sortable: true,
},
{
name: overview_column_names.MILEAGE,
label: 'timesheet_approvals.table.mileage',
align: 'left',
field: 'mileage',
sortable: true,
},
{
name: overview_column_names.WEEKLY_HOURS_1,
label: 'timesheet.week',
align: 'left',
field: 'weekly_hours',
sortable: true,
},
{
name: overview_column_names.WEEKLY_HOURS_2,
label: 'timesheet.week',
align: 'left',
field: 'weekly_hours',
sortable: true,
},
{
name: overview_column_names.TOTAL_HOURS,
label: 'timesheet_approvals.table.total_hours',
align: 'left',
field: 'total_hours',
sortable: true,
},
{
name: overview_column_names.IS_APPROVED,
label: 'timesheet_approvals.table.is_approved',
field: 'is_approved',
sortable: true,
},
{
name: overview_column_names.IS_ACTIVE,
label: 'timesheet_approvals.table.is_active',
field: 'is_active',
sortable: true,
}
]