import { HttpStatusCode, TalerError, TalerExchangeApi, TranslatedString, assertUnreachable } from "@gnu-taler/taler-util"; import { ErrorLoading, Loading, createNewForm, useTranslationContext } from "@gnu-taler/web-util/browser"; import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { useCases } from "../hooks/useCases.js"; import { Pages } from "../pages.js"; import { Officer } from "./Officer.js"; import { amlStateConverter } from "../utils/converter.js"; import { AmlExchangeBackend } from "../utils/types.js"; export function CasesUI({ records, filter, onChangeFilter, onFirstPage, onNext }: { onFirstPage?: () => void, onNext?: () => void, filter: AmlExchangeBackend.AmlState, onChangeFilter: (f: AmlExchangeBackend.AmlState) => void, records: TalerExchangeApi.AmlRecord[] }): VNode { const { i18n } = useTranslationContext(); const form = createNewForm<{ state: AmlExchangeBackend.AmlState }>(); return

Cases

A list of all the account with the status

{ onChangeFilter(v.state ?? filter); }} 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}
)}
} export function Cases() { const [stateFilter, setStateFilter] = useState(AmlExchangeBackend.AmlState.pending); const list = useCases(stateFilter); if (!list) { return } if (list instanceof TalerError) { return } if (list.data.type === "fail") { switch (list.data.case) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: case HttpStatusCode.NotFound: case HttpStatusCode.Conflict: return default: assertUnreachable(list.data) } } const { records } = list.data.body return } export const PeopleIcon = () => export const HomeIcon = () => function Pagination({ onFirstPage, onNext }: { onFirstPage?: () => void, onNext?: () => void, }) { const { i18n } = useTranslationContext() return ( ) }