166 lines
5.3 KiB
TypeScript
166 lines
5.3 KiB
TypeScript
import dayjs from "dayjs";
|
|
|
|
type ValueResolver = (
|
|
oldVal: any,
|
|
newVal: any,
|
|
ctx?: Record<string, any>
|
|
) => { oldVal: any; newVal: any };
|
|
|
|
export const diffTranslations: Record<
|
|
string,
|
|
{ label: string; resolve?: ValueResolver }
|
|
> = {
|
|
project: {
|
|
label: "Projekt",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.projects?.find((i: any) => i.id === o)?.name ?? "-" : "-",
|
|
newVal: n ? ctx?.projects?.find((i: any) => i.id === n)?.name ?? "-" : "-",
|
|
}),
|
|
},
|
|
title: { label: "Titel" },
|
|
type: { label: "Typ" },
|
|
notes: { label: "Notizen" },
|
|
link: { label: "Link" },
|
|
|
|
start: {
|
|
label: "Start",
|
|
resolve: (o, n) => ({
|
|
oldVal: o ? dayjs(o).format("DD.MM.YYYY HH:mm") : "-",
|
|
newVal: n ? dayjs(n).format("DD.MM.YYYY HH:mm") : "-",
|
|
}),
|
|
},
|
|
end: {
|
|
label: "Ende",
|
|
resolve: (o, n) => ({
|
|
oldVal: o ? dayjs(o).format("DD.MM.YYYY HH:mm") : "-",
|
|
newVal: n ? dayjs(n).format("DD.MM.YYYY HH:mm") : "-",
|
|
}),
|
|
},
|
|
birthday: {
|
|
label: "Geburtstag",
|
|
resolve: (o, n) => ({
|
|
oldVal: o ? dayjs(o).format("DD.MM.YYYY") : "-",
|
|
newVal: n ? dayjs(n).format("DD.MM.YYYY") : "-",
|
|
}),
|
|
},
|
|
resources: {
|
|
label: "Resourcen",
|
|
resolve: (o, n) => ({
|
|
oldVal: Array.isArray(o) ? o.map((i: any) => i.title).join(", ") : "-",
|
|
newVal: Array.isArray(n) ? n.map((i: any) => i.title).join(", ") : "-",
|
|
}),
|
|
},
|
|
|
|
customerNumber: { label: "Kundennummer" },
|
|
active: {
|
|
label: "Aktiv",
|
|
resolve: (o, n) => ({
|
|
oldVal: o === true ? "Aktiv" : "Gesperrt",
|
|
newVal: n === true ? "Aktiv" : "Gesperrt",
|
|
}),
|
|
},
|
|
isCompany: {
|
|
label: "Firmenkunde",
|
|
resolve: (o, n) => ({
|
|
oldVal: o === true ? "Firma" : "Privatkunde",
|
|
newVal: n === true ? "Firma" : "Privatkunde",
|
|
}),
|
|
},
|
|
special: { label: "Adresszusatz" },
|
|
street: { label: "Straße & Hausnummer" },
|
|
city: { label: "Ort" },
|
|
zip: { label: "Postleitzahl" },
|
|
country: { label: "Land" },
|
|
web: { label: "Webseite" },
|
|
email: { label: "E-Mail" },
|
|
tel: { label: "Telefon" },
|
|
ustid: { label: "USt-ID" },
|
|
role: { label: "Rolle" },
|
|
phoneHome: { label: "Festnetz" },
|
|
phoneMobile: { label: "Mobiltelefon" },
|
|
salutation: { label: "Anrede" },
|
|
firstName: { label: "Vorname" },
|
|
lastName: { label: "Nachname" },
|
|
name: { label: "Name" },
|
|
nameAddition: { label: "Name Zusatz" },
|
|
approved: { label: "Genehmigt" },
|
|
manufacturer: { label: "Hersteller" },
|
|
purchasePrice: { label: "Kaufpreis" },
|
|
purchaseDate: { label: "Kaufdatum" },
|
|
serialNumber: { label: "Seriennummer" },
|
|
usePlanning: { label: "In Plantafel verwenden" },
|
|
currentSpace: { label: "Lagerplatz" },
|
|
|
|
customer: {
|
|
label: "Kunde",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.customers?.find((i: any) => i.id === o)?.name ?? "-" : "-",
|
|
newVal: n ? ctx?.customers?.find((i: any) => i.id === n)?.name ?? "-" : "-",
|
|
}),
|
|
},
|
|
vendor: {
|
|
label: "Lieferant",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.vendors?.find((i: any) => i.id === o)?.name ?? "-" : "-",
|
|
newVal: n ? ctx?.vendors?.find((i: any) => i.id === n)?.name ?? "-" : "-",
|
|
}),
|
|
},
|
|
|
|
description: { label: "Beschreibung" },
|
|
categorie: { label: "Kategorie" },
|
|
|
|
profile: {
|
|
label: "Mitarbeiter",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.profiles?.find((i: any) => i.id === o)?.fullName ?? "-" : "-",
|
|
newVal: n ? ctx?.profiles?.find((i: any) => i.id === n)?.fullName ?? "-" : "-",
|
|
}),
|
|
},
|
|
plant: {
|
|
label: "Objekt",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.plants?.find((i: any) => i.id === o)?.name ?? "-" : "-",
|
|
newVal: n ? ctx?.plants?.find((i: any) => i.id === n)?.name ?? "-" : "-",
|
|
}),
|
|
},
|
|
|
|
annualPaidLeaveDays: { label: "Urlaubstage" },
|
|
employeeNumber: { label: "Mitarbeiternummer" },
|
|
weeklyWorkingDays: { label: "Wöchentliche Arbeitstage" },
|
|
weeklyWorkingHours: { label: "Wöchentliche Arbeitszeit" },
|
|
customerRef: { label: "Referenz des Kunden" },
|
|
|
|
licensePlate: { label: "Kennzeichen" },
|
|
tankSize: { label: "Tankvolumen" },
|
|
towingCapacity: { label: "Anhängelast" },
|
|
color: { label: "Farbe" },
|
|
customPaymentDays: { label: "Zahlungsziel in Tagen" },
|
|
customSurchargePercentage: { label: "Individueller Aufschlag" },
|
|
powerInKW: { label: "Leistung" },
|
|
|
|
driver: {
|
|
label: "Fahrer",
|
|
resolve: (o, n, ctx) => ({
|
|
oldVal: o ? ctx?.profiles?.find((i: any) => i.id === o)?.fullName ?? "-" : "-",
|
|
newVal: n ? ctx?.profiles?.find((i: any) => i.id === n)?.fullName ?? "-" : "-",
|
|
}),
|
|
},
|
|
|
|
projecttype: { label: "Projekttyp" },
|
|
|
|
fixed: {
|
|
label: "Festgeschrieben",
|
|
resolve: (o, n) => ({
|
|
oldVal: o === true ? "Ja" : "Nein",
|
|
newVal: n === true ? "Ja" : "Nein",
|
|
}),
|
|
},
|
|
archived: {
|
|
label: "Archiviert",
|
|
resolve: (o, n) => ({
|
|
oldVal: o === true ? "Ja" : "Nein",
|
|
newVal: n === true ? "Ja" : "Nein",
|
|
}),
|
|
},
|
|
};
|