/* This file is part of GNU Taler (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ import { HttpStatusCode, TalerError, TalerExchangeApi, assertUnreachable, } from "@gnu-taler/taler-util"; import { Attention, ErrorLoading, InputChoiceHorizontal, Loading, UIHandlerId, amlStateConverter, useTranslationContext, } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useCurrentDecisions } from "../hooks/decisions.js"; import { privatePages } from "../Routing.js"; import { FormErrors, RecursivePartial, useFormState } from "../hooks/form.js"; import { undefinedIfEmpty } from "./CreateAccount.js"; import { Officer } from "./Officer.js"; type FormType = { // state: TalerExchangeApi.AmlState; }; export function CasesUI({ records, // filter, // onChangeFilter, onFirstPage, onNext, }: { onFirstPage?: () => void; onNext?: () => void; // filter: TalerExchangeApi.AmlState; // onChangeFilter: (f: TalerExchangeApi.AmlState) => void; records: TalerExchangeApi.AmlDecision[]; }): VNode { const { i18n } = useTranslationContext(); // const [form, status] = useFormState( // [".state"] as Array, // { // // state: filter, // }, // (state) => { // const errors = undefinedIfEmpty>({ // state: state.state === undefined ? i18n.str`required` : undefined, // }); // if (errors === undefined) { // const result: FormType = { // state: state.state!, // }; // return { // status: "ok", // result, // errors, // }; // } // const result: RecursivePartial = { // state: state.state, // }; // return { // status: "fail", // result, // errors, // }; // }, // ); // useEffect(() => { // if (status.status === "ok" && filter !== status.result.state) { // onChangeFilter(status.result.state); // } // }, [form?.state?.value]); return (

Cases

A list of all the account with the status

{/* name="state" label={i18n.str`Filter`} handler={form.state} converter={amlStateConverter} choices={[ { label: i18n.str`Pending`, value: "pending", }, { label: i18n.str`Frozen`, value: "frozen", }, { label: i18n.str`Normal`, value: "normal", }, ]} /> */}
{!records.length ? (
empty result
) : (
{records.map((r) => { return ( ); })}
Account Id Status Threshold
{r.rowid} ???
)}
); } export function Cases() { // const [stateFilter, setStateFilter] = useState( // TalerExchangeApi.AmlState.pending, // ); const list = useCurrentDecisions(); const { i18n } = useTranslationContext(); if (!list) { return ; } if (list instanceof TalerError) { return ; } if (list.type === "fail") { switch (list.case) { case HttpStatusCode.Forbidden: { return ( This account signature is wrong, contact administrator or create a new one. ); } case HttpStatusCode.NotFound: { return ( This account is not known. ); } case HttpStatusCode.Conflict: { return ( This account doesn't have access. Request account activation sending your public key. ); } return ; default: assertUnreachable(list); } } return ( { // setStateFilter(d); // }} /> ); } export const PeopleIcon = () => ( ); export const HomeIcon = () => ( ); function Pagination({ onFirstPage, onNext, }: { onFirstPage?: () => void; onNext?: () => void; }) { const { i18n } = useTranslationContext(); return ( ); }