update admin team table
All checks were successful
deploy / build-and-deploy (/testvaro, /opt/website-test, website-test) (push) Successful in 31s
deploy / build-and-deploy (/varo, /opt/website, website) (push) Successful in 14s

This commit is contained in:
2025-06-21 23:03:16 +02:00
parent e0c91483fb
commit daa1de302b
2 changed files with 12 additions and 5 deletions

View File

@ -27,15 +27,23 @@
{dateFormat.format(new Date(value))} {dateFormat.format(new Date(value))}
{/snippet} {/snippet}
{#snippet status(value: null | 'open' | 'closed')}
{#if value === 'open'}
<p>In Bearbeitung</p>
{:else if value === 'closed'}
<p>Bearbeitet</p>
{/if}
{/snippet}
<DataTable <DataTable
data={reports} data={reports}
count={true} count={true}
keys={[ keys={[
{ 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', transform: date }, { key: 'createdAt', label: 'Datum', transform: date },
{ key: 'report.status?.status', label: 'Bearbeitungsstatus' } { key: 'status.status', label: 'Bearbeitungsstatus', transform: status }
]} ]}
onClick={(report) => (activeReport = report)} onClick={(report) => (activeReport = report)}
/> />

View File

@ -1,9 +1,8 @@
export function getObjectEntryByKey(key: string, data: { [key: string]: any }): any | undefined { export function getObjectEntryByKey(key: string, data: { [key: string]: any }): any | undefined {
let entry = data; let entry = data;
for (const part of key.split('.')) { for (const part of key.split('.')) {
if ((entry = entry[part]) === undefined) { entry = entry[part]
return undefined; if (entry === null || typeof entry !== 'object') return entry;
}
} }
return entry; return entry;
} }