Procházet zdrojové kódy

RHL-012 feat(ui): add user role labels and options in German with date formatting and branch ID normalization functions

codeUWE před 1 měsícem
rodič
revize
2fc5b9a6cf
1 změnil soubory, kde provedl 28 přidání a 0 odebrání
  1. 28 0
      components/admin/users/usersUi.js

+ 28 - 0
components/admin/users/usersUi.js

@@ -0,0 +1,28 @@
+export const ROLE_LABELS_DE = Object.freeze({
+	branch: "Niederlassung",
+	admin: "Admin",
+	superadmin: "Superadmin",
+	dev: "Entwicklung",
+});
+
+export const ROLE_OPTIONS_DE = Object.freeze([
+	{ value: "", label: "Alle Rollen" },
+	{ value: "branch", label: ROLE_LABELS_DE.branch },
+	{ value: "admin", label: ROLE_LABELS_DE.admin },
+	{ value: "superadmin", label: ROLE_LABELS_DE.superadmin },
+	{ value: "dev", label: ROLE_LABELS_DE.dev },
+]);
+
+export function formatDateTimeDe(iso) {
+	if (!iso) return "—";
+	try {
+		return new Date(iso).toLocaleString("de-DE");
+	} catch {
+		return "—";
+	}
+}
+
+export function normalizeBranchIdDraft(value) {
+	if (typeof value !== "string") return "";
+	return value.trim().toUpperCase();
+}