import { Link } from 'react-router-dom' import { formatDate, formatDatetime, formatTime, calculateWorkMinutes, formatMinutes, getLeaveTypeName, getLeaveTypeBadgeClass } from '../utils/attendanceHelpers' interface ProjectLog { id?: number project_id?: number project_name?: string started_at?: string ended_at?: string | null hours?: string | number | null minutes?: string | number | null } interface AttendanceRecord { id: number shift_date: string user_name: string leave_type?: string leave_hours?: number arrival_time?: string | null departure_time?: string | null break_start?: string | null break_end?: string | null arrival_lat?: number | string | null arrival_lng?: number | string | null departure_lat?: number | string | null departure_lng?: number | string | null project_name?: string project_logs?: ProjectLog[] notes?: string | null } interface AttendanceShiftTableProps { records: AttendanceRecord[] onEdit: (record: AttendanceRecord) => void onDelete: (record: AttendanceRecord) => void } function formatBreak(record: AttendanceRecord): string { if (record.break_start && record.break_end) { return `${formatTime(record.break_start)} - ${formatTime(record.break_end)}` } if (record.break_start) { return `${formatTime(record.break_start)} - ?` } return '\u2014' } function renderProjectCell(record: AttendanceRecord): React.ReactNode { if (record.project_logs && record.project_logs.length > 0) { return (
Za tento měsíc nejsou žádné záznamy.
| Datum | Zaměstnanec | Typ | Příchod | Pauza | Odchod | Hodiny | Projekt | GPS | Poznámka | Akce |
|---|---|---|---|---|---|---|---|---|---|---|
| {formatDate(record.shift_date)} | {record.user_name} | {getLeaveTypeName(leaveType)} | {isLeave ? '\u2014' : formatDatetime(record.arrival_time)} | {isLeave ? '\u2014' : formatBreak(record)} | {isLeave ? '\u2014' : formatDatetime(record.departure_time)} | {workMinutes > 0 ? `${formatMinutes(workMinutes)} h` : '\u2014'} | {renderProjectCell(record)} | {hasLocation ? ( {'\uD83D\uDCCD'} ) : '\u2014'} | {record.notes || ''} |
|