show date in admin ui report table
All checks were successful
deploy / build-and-deploy (/testvaro, /opt/website-test, website-test) (push) Successful in 24s
deploy / build-and-deploy (/varo, /opt/website, website) (push) Successful in 14s

This commit is contained in:
2025-06-21 21:25:47 +02:00
parent e0b9850efb
commit eb39cae44c
2 changed files with 16 additions and 3 deletions

View File

@ -4,7 +4,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import DataTable from '@components/admin/table/DataTable.svelte'; import DataTable from '@components/admin/table/DataTable.svelte';
// consts
// consts // consts
const dateFormat = new Intl.DateTimeFormat('de-DE', { const dateFormat = new Intl.DateTimeFormat('de-DE', {
year: 'numeric', year: 'numeric',

View File

@ -4,6 +4,15 @@
import DataTable from '@components/admin/table/DataTable.svelte'; import DataTable from '@components/admin/table/DataTable.svelte';
import { type StrikeReasons, getStrikeReasons, reports } from '@app/admin/reports/reports.ts'; import { type StrikeReasons, getStrikeReasons, reports } from '@app/admin/reports/reports.ts';
// consts
const dateFormat = new Intl.DateTimeFormat('de-DE', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
});
// states // states
let strikeReasons = $state<StrikeReasons>([]); let strikeReasons = $state<StrikeReasons>([]);
let activeReport = $state<Report | null>(null); let activeReport = $state<Report | null>(null);
@ -14,6 +23,10 @@
}); });
</script> </script>
{#snippet date(value: string)}
{dateFormat.format(new Date(value))}
{/snippet}
<DataTable <DataTable
data={reports} data={reports}
count={true} count={true}
@ -21,11 +34,12 @@
{ key: 'reason', label: 'Grund' }, { key: 'reason', label: 'Grund' },
{ key: 'reporter.name', label: 'Report Team' }, { key: 'reporter.name', label: 'Report Team' },
{ key: 'reported?.name', label: 'Reportetes Team' }, { key: 'reported?.name', label: 'Reportetes Team' },
{ key: 'createdAt', label: 'Datum' }, { key: 'createdAt', label: 'Datum', transform: date },
{ key: 'report.status?.status', label: 'Bearbeitungsstatus' } { key: 'report.status?.status', label: 'Bearbeitungsstatus' }
]} ]}
onClick={(report) => (activeReport = report)} onClick={(report) => (activeReport = report)}
/> >
</DataTable>
{#key activeReport} {#key activeReport}
<BottomBar {strikeReasons} report={activeReport} /> <BottomBar {strikeReasons} report={activeReport} />