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:
39
src/admin/lib/entityTypeLabels.ts
Normal file
39
src/admin/lib/entityTypeLabels.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// Single source of truth for audit-log entity_type → Czech label, used by
|
||||
// the Audit Log page and the dashboard activity feed.
|
||||
//
|
||||
// IMPORTANT: keys MUST match the `entityType` values the server actually
|
||||
// writes via logAudit() (see src/types/index.ts `EntityType` and the
|
||||
// `entityType:` args in src/routes/**). The previous maps used legacy keys
|
||||
// (e.g. "invoices_invoice", "offers_quotation", "trips") that never matched
|
||||
// what the server writes, and omitted every warehouse_* entity, so those
|
||||
// audit rows rendered the raw English entity_type instead of a Czech label.
|
||||
export const ENTITY_TYPE_LABELS: Record<string, string> = {
|
||||
user: "Uživatel",
|
||||
role: "Role",
|
||||
attendance: "Docházka",
|
||||
leave_request: "Žádost o nepřítomnost",
|
||||
leave_balance: "Saldo nepřítomnosti",
|
||||
invoice: "Faktura",
|
||||
quotation: "Nabídka",
|
||||
order: "Objednávka",
|
||||
project: "Projekt",
|
||||
project_file: "Soubor projektu",
|
||||
customer: "Zákazník",
|
||||
trip: "Jízda",
|
||||
vehicle: "Vozidlo",
|
||||
bank_account: "Bankovní účet",
|
||||
company_settings: "Nastavení firmy",
|
||||
audit_logs: "Audit log",
|
||||
warehouse_item: "Skladová položka",
|
||||
warehouse_receipt: "Příjemka",
|
||||
warehouse_issue: "Výdejka",
|
||||
warehouse_reservation: "Rezervace",
|
||||
warehouse_inventory: "Inventura",
|
||||
warehouse_supplier: "Dodavatel",
|
||||
warehouse_category: "Kategorie skladu",
|
||||
warehouse_location: "Skladová lokace",
|
||||
warehouse_receipt_attachment: "Příloha příjemky",
|
||||
work_plan_entry: "Plán prací – záznam",
|
||||
work_plan_override: "Plán prací – přepsání dne",
|
||||
plan_category: "Plán prací – kategorie",
|
||||
};
|
||||
Reference in New Issue
Block a user