import { TalerError, TranslatedString, assertUnreachable } from "@gnu-taler/taler-util"; import { ErrorLoading, Loading, useTranslationContext } from "@gnu-taler/web-util/browser"; import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { createNewForm } from "../handlers/forms.js"; import { useCases } from "../hooks/useCases.js"; import { Pages } from "../pages.js"; import { AmlExchangeBackend } from "../types.js"; import { amlStateConverter } from "./CaseDetails.js"; import { Officer } from "./Officer.js"; export function Cases() { const { i18n } = useTranslationContext(); const form = createNewForm<{ state: AmlExchangeBackend.AmlState }>(); const initial = AmlExchangeBackend.AmlState.pending; const [stateFilter, setStateFilter] = useState(initial); const list = useCases(stateFilter); if (!list) { return } if (list instanceof TalerError) { return } if (list.data.type === "fail") { switch (list.data.case) { case "unauthorized": return case "officer-not-found": return case "officer-disabled": return default: assertUnreachable(list.data) } } const { records } = list.data.body return (

Cases

A list of all the account with the status

{ setStateFilter(v.state ?? initial); }} onSubmit={(v) => { }} >
{!records.length ? (
empty result
) : (
{records.map((r) => { return ( ); })}
Account Id Status Threshold
{((state: AmlExchangeBackend.AmlState): VNode => { switch (state) { case AmlExchangeBackend.AmlState.normal: { return ( Normal ); } case AmlExchangeBackend.AmlState.pending: { return ( Pending ); } case AmlExchangeBackend.AmlState.frozen: { return ( Frozen ); } } })(r.current_state)} {r.threshold}
)}
); } function Pagination() { return ( ); }