Files
EmployeeManagementSystem/src/types/index.ts

169 lines
3.8 KiB
TypeScript

export interface User {
id: number;
username: string;
name: string;
email: string;
role: "SuperAdmin" | "Supervisor" | "Contractor" | "Employee";
department_id?: number;
contractor_id?: number;
is_active: boolean;
created_at: string;
department_name?: string;
contractor_name?: string;
sub_department_id?: number;
sub_department_name?: string;
primary_activity?: string;
phone_number?: string;
aadhar_number?: string;
bank_account_number?: string;
bank_name?: string;
bank_ifsc?: string;
contractor_agreement_number?: string;
pf_number?: string;
esic_number?: string;
}
export interface Department {
id: number;
name: string;
created_at: string;
updated_at: string;
}
export interface SubDepartment {
id: number;
department_id: number;
name: string;
created_at: string;
updated_at: string;
department_name?: string;
}
export interface Activity {
id: number;
sub_department_id: number;
name: string;
unit_of_measurement: "Per Bag" | "Fixed Rate-Per Person";
created_at: string;
sub_department_name?: string;
department_id?: number;
department_name?: string;
}
export interface WorkAllocation {
id: number;
employee_id: number;
supervisor_id: number;
contractor_id: number;
sub_department_id?: number;
description?: string;
assigned_date: string;
status: "Pending" | "InProgress" | "Completed" | "Cancelled";
completion_date?: string;
rate?: number;
created_at: string;
updated_at: string;
employee_name?: string;
employee_username?: string;
supervisor_name?: string;
contractor_name?: string;
sub_department_name?: string;
department_name?: string;
}
export type AttendanceStatus =
| "CheckedIn"
| "CheckedOut"
| "Absent"
| "HalfDay"
| "Late";
export interface Attendance {
id: number;
employee_id: number;
supervisor_id: number;
check_in_time: string;
check_out_time?: string;
work_date: string;
status: AttendanceStatus;
remark?: string;
created_at: string;
updated_at: string;
employee_name?: string;
employee_username?: string;
supervisor_name?: string;
department_name?: string;
contractor_name?: string;
}
export type SwapReason = "LeftWork" | "Sick" | "FinishedEarly" | "Other";
export type SwapStatus = "Active" | "Completed" | "Cancelled";
export interface EmployeeSwap {
id: number;
employee_id: number;
original_department_id: number;
target_department_id: number;
original_contractor_id?: number;
target_contractor_id?: number;
swap_reason: SwapReason;
reason_details?: string;
work_completion_percentage: number;
swap_date: string;
swapped_by: number;
status: SwapStatus;
created_at: string;
completed_at?: string;
// Joined fields
employee_name?: string;
original_department_name?: string;
target_department_name?: string;
original_contractor_name?: string;
target_contractor_name?: string;
swapped_by_name?: string;
}
export interface ContractorRate {
id: number;
contractor_id: number;
sub_department_id?: number;
activity?: string;
rate: number;
effective_date: string;
created_at: string;
updated_at: string;
contractor_name?: string;
contractor_username?: string;
sub_department_name?: string;
department_name?: string;
}
export interface StandardRate {
id: number;
sub_department_id?: number;
activity?: string;
rate: number;
effective_date: string;
created_by: number;
created_at: string;
sub_department_name?: string;
department_name?: string;
department_id?: number;
created_by_name?: string;
}
export interface RateComparison {
id: number;
contractor_id: number;
contractor_name: string;
sub_department_id?: number;
sub_department_name?: string;
activity?: string;
rate: number;
standard_rate: number;
difference: number;
percentage_difference: string | null;
is_above_standard: boolean;
is_below_standard: boolean;
}