- Enhance RequestPermitModal with multiple time-off types and validation - Implement CalendarWidget for visualizing time-off requests - Improve API error handling and token management - Add utility functions for consistent date and time formatting - Clean up unused mock data and update types
60 lines
1.1 KiB
TypeScript
60 lines
1.1 KiB
TypeScript
// --- TYPES & export INTERFACES (File: types.ts) ---
|
|
|
|
import { DateType } from "react-native-ui-datepicker";
|
|
|
|
export interface UserData {
|
|
name: string;
|
|
surname: string;
|
|
username: string;
|
|
role?: string;
|
|
email?: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface AttendanceRecord {
|
|
id: number;
|
|
site: string;
|
|
date: string;
|
|
in: string;
|
|
out: string | null;
|
|
status: 'complete' | 'incomplete';
|
|
}
|
|
|
|
export interface DocumentItem {
|
|
id: number;
|
|
name: string;
|
|
type: string;
|
|
site: string;
|
|
date: string;
|
|
}
|
|
|
|
export interface OfficeItem {
|
|
id: number;
|
|
name: string;
|
|
status: 'online' | 'offline';
|
|
temp: number;
|
|
lights: boolean;
|
|
power: number;
|
|
}
|
|
|
|
export interface TimeOffRequestType {
|
|
id: number;
|
|
name: string;
|
|
color: string;
|
|
abbreviation: string;
|
|
time_required: number; // backend usa 0/1
|
|
deleted: number; // backend usa 0/1
|
|
}
|
|
|
|
export interface TimeOffRequest {
|
|
id: number;
|
|
id_type: number;
|
|
id_user: number;
|
|
start_date: DateType;
|
|
end_date?: DateType | null;
|
|
start_time?: string | null;
|
|
end_time?: string | null;
|
|
message?: string | null;
|
|
status: number;
|
|
timeOffRequestType: TimeOffRequestType;
|
|
} |