feat: NAS storage for invoices/offers, code cleanup, date/time fixes
- NAS storage for created invoices (PDF via puppeteer), received invoices, and offers with auto-save on create/edit - Deterministic file paths derived from DB fields (no file_path column needed) - Separate NAS mount points: NAS_FINANCIALS_PATH, NAS_OFFERS_PATH - Invoice language field (cs/en) stored per invoice, replaces lang modal - Invoices list filtered by month/year matching KPI card selection - Centralized date helpers (src/utils/date.ts) replacing all .toISOString() calls that returned UTC instead of local time - Attendance project switching uses exact time (not rounded) - Comment cleanup: removed ~100 unnecessary/Czech comments - Removed as-any casts in orders and attendance - Prisma migrations: add invoice language, drop received_invoices BLOB columns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
* Port of PHP CzechHolidays class.
|
||||
*/
|
||||
|
||||
import { localDateStr } from "./date";
|
||||
|
||||
const holidayCache = new Map<number, string[]>();
|
||||
|
||||
/** Easter Sunday using the Anonymous Gregorian algorithm */
|
||||
@@ -30,17 +32,17 @@ export function getHolidays(year: number): string[] {
|
||||
|
||||
const y = String(year);
|
||||
const holidays = [
|
||||
`${y}-01-01`, // Den obnovy samostatného českého státu
|
||||
`${y}-05-01`, // Svátek práce
|
||||
`${y}-05-08`, // Den vítězství
|
||||
`${y}-07-05`, // Den slovanských věrozvěstů Cyrila a Metoděje
|
||||
`${y}-07-06`, // Den upálení mistra Jana Husa
|
||||
`${y}-09-28`, // Den české státnosti
|
||||
`${y}-10-28`, // Den vzniku samostatného československého státu
|
||||
`${y}-11-17`, // Den boje za svobodu a demokracii
|
||||
`${y}-12-24`, // Štědrý den
|
||||
`${y}-12-25`, // 1. svátek vánoční
|
||||
`${y}-12-26`, // 2. svátek vánoční
|
||||
`${y}-01-01`, // New Year's / Restoration of Czech Independence
|
||||
`${y}-05-01`, // Labour Day
|
||||
`${y}-05-08`, // Victory Day
|
||||
`${y}-07-05`, // Saints Cyril and Methodius Day
|
||||
`${y}-07-06`, // Jan Hus Day
|
||||
`${y}-09-28`, // Czech Statehood Day
|
||||
`${y}-10-28`, // Czechoslovak Independence Day
|
||||
`${y}-11-17`, // Freedom and Democracy Day
|
||||
`${y}-12-24`, // Christmas Eve
|
||||
`${y}-12-25`, // Christmas Day
|
||||
`${y}-12-26`, // St. Stephen's Day
|
||||
];
|
||||
|
||||
// Easter-based
|
||||
@@ -51,10 +53,8 @@ export function getHolidays(year: number): string[] {
|
||||
const easterMonday = new Date(easterDate);
|
||||
easterMonday.setDate(easterMonday.getDate() + 1);
|
||||
|
||||
const fmt = (d: Date) =>
|
||||
`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
||||
holidays.push(fmt(goodFriday)); // Velký pátek
|
||||
holidays.push(fmt(easterMonday)); // Velikonoční pondělí
|
||||
holidays.push(localDateStr(goodFriday)); // Good Friday
|
||||
holidays.push(localDateStr(easterMonday)); // Easter Monday
|
||||
|
||||
holidays.sort();
|
||||
holidayCache.set(year, holidays);
|
||||
|
||||
Reference in New Issue
Block a user