Highlights: - Warehouse module: receipts, issues, reservations, inventory, reports, dashboard, master data (categories, suppliers, locations), FIFO service, integration tests - Docházka: mzda PDF counting model (Odpracováno / Vč. svátků / Přesčas / Svátek / So/Ne / Noc) with Czech weekday names and decimal hours - AttendanceAdmin/AttendanceHistory KPI cards unified to mzda formula with fund bar colored by delta, badges for Práce/Dov/Nem/Sv/Nep - Remove leave_type=holiday entirely (auto-computed from Czech public holidays) - Allow multiple work shifts per day (overlap detection only) - Pre-flight refresh in api.ts eliminates spurious 401s on fresh page loads - Prisma: company_settings gets 6 nullable columns for warehouse numbering (PRI/VYD/INV prefixes, default patterns); migration seeds defaults
114 lines
2.8 KiB
TypeScript
114 lines
2.8 KiB
TypeScript
export const LEAVE_TYPE_LABELS: Record<string, string> = {
|
|
vacation: "Dovolená",
|
|
sick: "Nemoc",
|
|
unpaid: "Neplacené volno",
|
|
};
|
|
|
|
export const STATUS_DOT_CLASS: Record<string, string> = {
|
|
in: "dash-status-in",
|
|
away: "dash-status-away",
|
|
out: "dash-status-out",
|
|
leave: "dash-status-leave",
|
|
};
|
|
|
|
export const STATUS_LABELS: Record<string, string> = {
|
|
in: "Přítomen",
|
|
away: "Přestávka",
|
|
out: "Nepřihlášen",
|
|
leave: "Nepřítomen",
|
|
};
|
|
|
|
export const ENTITY_TYPE_LABELS: Record<string, string> = {
|
|
user: "Uživatel",
|
|
attendance: "Docházka",
|
|
leave_request: "Žádost o nepřítomnost",
|
|
offers_quotation: "Nabídka",
|
|
offers_customer: "Zákazník",
|
|
offers_item_template: "Šablona položky",
|
|
offers_scope_template: "Šablona rozsahu",
|
|
offers_settings: "Nastavení nabídek",
|
|
orders_order: "Objednávka",
|
|
invoices_invoice: "Faktura",
|
|
projects_project: "Projekt",
|
|
role: "Role",
|
|
trips: "Jízda",
|
|
vehicles: "Vozidlo",
|
|
bank_account: "Bankovní účet",
|
|
};
|
|
|
|
export const ACTION_LABELS: Record<string, string> = {
|
|
create: "Vytvořil",
|
|
update: "Upravil",
|
|
delete: "Smazal",
|
|
login: "Přihlášení",
|
|
};
|
|
|
|
export function getCzechDate(): string {
|
|
const now = new Date();
|
|
const days = [
|
|
"Neděle",
|
|
"Pondělí",
|
|
"Úterý",
|
|
"Středa",
|
|
"Čtvrtek",
|
|
"Pátek",
|
|
"Sobota",
|
|
];
|
|
const months = [
|
|
"ledna",
|
|
"února",
|
|
"března",
|
|
"dubna",
|
|
"května",
|
|
"června",
|
|
"července",
|
|
"srpna",
|
|
"září",
|
|
"října",
|
|
"listopadu",
|
|
"prosince",
|
|
];
|
|
const day = days[now.getDay()];
|
|
const oneJan = new Date(now.getFullYear(), 0, 1);
|
|
const week = Math.ceil(
|
|
((now.getTime() - oneJan.getTime()) / 86400000 + oneJan.getDay() + 1) / 7,
|
|
);
|
|
return `${day}, ${now.getDate()}. ${months[now.getMonth()]} ${now.getFullYear()} · Týden ${week}`;
|
|
}
|
|
|
|
export function getActivityIconClass(action: string): string {
|
|
const map: Record<string, string> = {
|
|
create: "success",
|
|
update: "info",
|
|
delete: "danger",
|
|
login: "accent",
|
|
};
|
|
return map[action] || "muted";
|
|
}
|
|
|
|
export function formatActivityTime(dateString: string): string {
|
|
const date = new Date(dateString);
|
|
const now = new Date();
|
|
const diff = now.getTime() - date.getTime();
|
|
if (diff < 60000) return "Právě teď";
|
|
if (diff < 3600000) return `${Math.floor(diff / 60000)} min`;
|
|
if (date.toDateString() === now.toDateString()) {
|
|
return date.toLocaleTimeString("cs-CZ", {
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
});
|
|
}
|
|
return date.toLocaleDateString("cs-CZ", { day: "2-digit", month: "2-digit" });
|
|
}
|
|
|
|
export function formatSessionDate(dateString: string): string {
|
|
const date = new Date(dateString);
|
|
return date.toLocaleDateString("cs-CZ", {
|
|
day: "2-digit",
|
|
month: "2-digit",
|
|
year: "numeric",
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
});
|
|
}
|