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:
BOHA
2026-03-26 10:36:39 +01:00
parent 0317ba3168
commit baceb88347
60 changed files with 2475 additions and 563 deletions

View File

@@ -479,7 +479,8 @@ export default function useAttendanceAdmin({ alert }: AlertContext) {
// ---- Create modal ----
const [showCreateModal, setShowCreateModal] = useState(false);
const today = new Date().toISOString().split("T")[0];
const now = new Date();
const today = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
const [createForm, setCreateForm] = useState<ShiftFormData>({
user_id: "",
shift_date: today,
@@ -589,11 +590,9 @@ export default function useAttendanceAdmin({ alert }: AlertContext) {
try {
const [yearStr, monthStr] = month.split("-");
// Build records URL
let recordsUrl = `${API_BASE}/attendance?year=${yearStr}&month=${monthStr}&limit=1000`;
if (filterUserId) recordsUrl += `&user_id=${filterUserId}`;
// Fetch records and balances in parallel
const [recordsResponse, balancesResponse] = await Promise.all([
apiFetch(recordsUrl),
apiFetch(`${API_BASE}/attendance?action=balances&year=${yearStr}`),
@@ -614,7 +613,6 @@ export default function useAttendanceAdmin({ alert }: AlertContext) {
const leaveBalances: Record<string, LeaveBalance> =
balancesObj?.balances ?? balancesObj ?? {};
// Compute user_totals client-side
const userTotals = computeUserTotals(records, usersRef.current, month);
setData((prev) => ({
@@ -670,7 +668,8 @@ export default function useAttendanceAdmin({ alert }: AlertContext) {
// Create modal
// =========================================================================
const openCreateModal = () => {
const todayDate = new Date().toISOString().split("T")[0];
const d = new Date();
const todayDate = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
setCreateForm({
user_id: "",
shift_date: todayDate,