fix(audit): correct + unify entity_type label map to match server values

Audit Log + dashboard feed used legacy keys (invoices_invoice, offers_quotation, trips, vehicles) that never matched the server's entity_type (invoice, quotation, trip, vehicle, ...) and omitted all warehouse_* entities, so many audit rows showed raw English. Single source of truth in lib/entityTypeLabels.ts, keyed to the actual EntityType values, with Czech labels for every type the server writes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-06 02:19:10 +02:00
parent 379725a096
commit c5f986adc1
3 changed files with 43 additions and 41 deletions

View File

@@ -11,6 +11,7 @@ import AdminDatePicker from "../components/AdminDatePicker";
import { czechPlural } from "../utils/formatters";
import apiFetch from "../utils/api";
import { useApiMutation } from "../lib/queries/mutations";
import { ENTITY_TYPE_LABELS } from "../lib/entityTypeLabels";
const API_BASE = "/api/admin";
@@ -44,27 +45,6 @@ const ACTION_BADGE_CLASS: Record<string, string> = {
access_denied: "admin-badge-danger",
};
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",
work_plan_entry: "Plán prací záznam",
work_plan_override: "Plán prací přepsání dne",
plan_category: "Plán prací kategorie",
};
const ACTION_OPTIONS = Object.entries(ACTION_LABELS).map(([value, label]) => ({
value,
label,