Spaces:
Runtime error
Runtime error
Greg
Claude Opus 4.7 (1M context)
fix(checkin): el modo facial/manual reacciona al cambio de config (sin re-login)
c513bff Download frontend/src/services/attendanceService.ts from Talosware/talos-access: direct link, hf CLI and curl.
- Browser
- Download file 3.47 kB
-
https://huggingface.co/spaces/Talosware/talos-access/resolve/main/frontend/src/services/attendanceService.ts
- Command line
-
hf download hf://spaces/Talosware/talos-access/frontend/src/services/attendanceService.ts
-
curl -L -o attendanceService.ts https://huggingface.co/spaces/Talosware/talos-access/resolve/main/frontend/src/services/attendanceService.ts
3.47 kB
| import api from './api'; | |
| import type { PaginatedResponse } from '../types'; | |
| export interface Attendance { | |
| id: number; | |
| account_id: number; | |
| user_id: number; | |
| section_id: number | null; | |
| time_log: string; | |
| checkout_time: string | null; | |
| coordinates: Record<string, number> | null; | |
| note: string | null; | |
| action?: string | null; | |
| user_name?: string; | |
| user_lastname?: string; | |
| role?: string | null; | |
| card_id?: string | null; | |
| section_name?: string; | |
| is_late?: boolean; | |
| late_reason?: string | null; | |
| late_authorized_by?: string | null; | |
| } | |
| export interface TodayCheckIn { | |
| id: number; | |
| user_id: number; | |
| card_id?: string; | |
| user_name: string; | |
| user_lastname: string; | |
| role?: string | null; | |
| section_name: string | null; | |
| time_log: string; | |
| checkout_time: string | null; | |
| note?: string | null; | |
| is_late?: boolean; | |
| late_reason?: string | null; | |
| late_authorized_by?: string | null; | |
| } | |
| export interface HeatmapEntry { | |
| date: string; | |
| count: number; | |
| } | |
| export interface AttendanceFilters { | |
| page?: number; | |
| per_page?: number; | |
| user_id?: number; | |
| section_id?: number; | |
| role?: string; | |
| date_from?: string; | |
| date_to?: string; | |
| type?: string; | |
| } | |
| export async function downloadReportCSV(filters: { role?: string; date_from?: string; date_to?: string; user_id?: number } = {}): Promise<void> { | |
| const params = new URLSearchParams(); | |
| Object.entries(filters).forEach(([k, v]) => { if (v !== undefined && v !== '') params.set(k, String(v)); }); | |
| const { data } = await api.get(`/attendances/report-export?${params}`, { responseType: 'blob' }); | |
| const url = URL.createObjectURL(data); | |
| const a = document.createElement('a'); a.href = url; a.download = 'reporte_asistencia.csv'; a.click(); | |
| URL.revokeObjectURL(url); | |
| } | |
| export async function listAttendances(filters: AttendanceFilters = {}): Promise<PaginatedResponse<Attendance>> { | |
| const params = new URLSearchParams(); | |
| Object.entries(filters).forEach(([k, v]) => { if (v !== undefined && v !== '') params.set(k, String(v)); }); | |
| const { data } = await api.get(`/attendances?${params}`); | |
| return data; | |
| } | |
| export async function checkin(payload: { card_id: string; section_id?: number; note?: string; late_note?: string }): Promise<Attendance> { | |
| const { data } = await api.post('/attendances/checkin', payload); | |
| return data; | |
| } | |
| export async function checkout(card_id: string, late_note?: string): Promise<Attendance> { | |
| const { data } = await api.post('/attendances/checkout', { card_id, late_note }); | |
| return data; | |
| } | |
| export async function getTodayCheckins(): Promise<TodayCheckIn[]> { | |
| const { data } = await api.get('/attendances/today'); | |
| return data; | |
| } | |
| export async function getHeatmap(student_id: number, year?: number): Promise<HeatmapEntry[]> { | |
| const params = year ? `?year=${year}` : ''; | |
| const { data } = await api.get(`/attendances/heatmap/${student_id}${params}`); | |
| return data; | |
| } | |
| export interface CurrentMode { | |
| mode: string; | |
| schedule: { entry: string; exit: string } | null; | |
| today: string; | |
| locked: boolean; | |
| message: string; | |
| tolerance?: number; | |
| active?: boolean; | |
| checkin_mode?: string; | |
| } | |
| export async function getCurrentMode(): Promise<CurrentMode> { | |
| const { data } = await api.get('/attendances/current-mode'); | |
| return data; | |
| } | |
| export async function adminEarlyCheckout(userId: number, reason: string): Promise<Attendance> { | |
| const { data } = await api.post('/attendances/admin-early-checkout', { user_id: userId, reason }); | |
| return data; | |
| } | |