Make order search, device results and decisions visible in the WebUI

This commit is contained in:
2026-11-18 09:14:42 +01:00
parent 5b6e9c9cdb
commit 14a271f61a
8 changed files with 155 additions and 45 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { page, record, request, objectId, tenant, type Tenant } from './api';
import { page, record, request, objectId, tenant } from './api';
import { ErrorBox, useResource } from './resource';
import { OrderRows, PageButtons } from './order-presentation';
@@ -15,7 +15,7 @@ export function usePendingApprovals(enabled: boolean, revision = 0) {
}, [enabled, revision], enabled);
return resource.error ? null : resource.data;
}
export function ApprovalInbox({ open }: { customers?: Tenant[]; open: (tenantId: string, planId: string) => void }) {
export function ApprovalInbox({ open, ownId }: { ownId: string; open: (tenantId: string, planId: string) => void }) {
const [view, setView] = useState<'pending'|'history'>('pending');
const [customer, setCustomer] = useState('');
const [pages, setPages] = useState<string[]>([]);
@@ -44,7 +44,8 @@ export function ApprovalInbox({ open }: { customers?: Tenant[]; open: (tenantId:
<ErrorBox error={list.error}/>
{!list.data && !list.error && <p className="list-message">Anträge werden geladen …</p>}
{list.data && (!!list.data.items.length
? <OrderRows items={list.data.items} decisionList open={row => open(objectId(row,'tenant'), objectId(row,'plan'))}/>
? <OrderRows items={list.data.items} decisionList decisionHistory={view === 'history'} ownId={ownId}
open={row => open(objectId(row,'tenant'), objectId(row,'plan'))}/>
: <p className="list-message">{view === 'pending' ? 'Keine offenen Genehmigungen.' : 'Keine abgeschlossenen Anträge.'}</p>)}
{list.data && <PageButtons pages={pages} next={list.data.next_cursor} change={setPages}/>}
</section>;