- Refactor Profile and Login screens to use AuthContext for user data

- 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
This commit is contained in:
2025-12-10 18:21:08 +01:00
parent 49b6ecadb2
commit b9807f6cc2
13 changed files with 503 additions and 343 deletions

View File

@ -1,5 +1,7 @@
// --- TYPES & export INTERFACES (File: types.ts) ---
import { DateType } from "react-native-ui-datepicker";
export interface UserData {
name: string;
surname: string;
@ -35,16 +37,24 @@ export interface OfficeItem {
power: number;
}
export type ScreenName = 'home' | 'attendance' | 'documents' | 'smart-office' | 'profile';
export type PermitType = 'Ferie' | 'Permesso' | 'Malattia';
export interface PermitRecord {
export interface TimeOffRequestType {
id: number;
type: PermitType;
startDate: string;
endDate?: string; // Opzionale per permessi giornalieri
startTime?: string; // Solo per permessi
endTime?: string; // Solo per permessi
status: 'Approvato' | 'In Attesa' | 'Rifiutato';
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;
}