Enhance Service Messages by Config & activeUntil
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { MessageSquareWarning } from "lucide-react";
|
||||
import { Check, MessageSquareWarning } from "lucide-react";
|
||||
import { MessageForm } from "./_components/messageForm";
|
||||
import { PaginatedTable } from "_components/PaginatedTable";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
@@ -23,6 +23,7 @@ export default function MessagePage() {
|
||||
</div>
|
||||
<PaginatedTable
|
||||
prismaModel="notam"
|
||||
initialOrderBy={[{ id: "createdAt", desc: true }]}
|
||||
columns={
|
||||
[
|
||||
{
|
||||
@@ -31,19 +32,58 @@ export default function MessagePage() {
|
||||
},
|
||||
{
|
||||
accessorKey: "color",
|
||||
header: "Status",
|
||||
header: "Typ",
|
||||
cell: ({ row }) => {
|
||||
const color = row.getValue("color");
|
||||
return color;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "wartungsmodus",
|
||||
header: "Wartungsmodus",
|
||||
cell: ({ row }) => {
|
||||
const wartungsmodus = row.getValue("wartungsmodus");
|
||||
return wartungsmodus ? <Check /> : "";
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "disableHPG",
|
||||
header: "HPG deaktiviert",
|
||||
cell: ({ row }) => {
|
||||
const disableHPG = row.getValue("disableHPG");
|
||||
return disableHPG ? <Check /> : "";
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "showUntil",
|
||||
header: "Zeitlimit",
|
||||
cell: ({ row, cell }) => {
|
||||
const showUntil = new Date(cell.getValue() as string);
|
||||
const createdAt = new Date(row.getValue("createdAt") as string);
|
||||
if (showUntil > createdAt) {
|
||||
return showUntil.toLocaleDateString("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
}
|
||||
return "";
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "createdAt",
|
||||
header: "Erstellt am",
|
||||
sortDescFirst: false,
|
||||
cell: ({ cell }) => {
|
||||
const date = new Date(cell.getValue() as string);
|
||||
return date.toLocaleDateString();
|
||||
return date.toLocaleDateString("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
},
|
||||
},
|
||||
] as ColumnDef<Notam>[]
|
||||
|
||||
Reference in New Issue
Block a user