/* 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, Loading, useTranslationContext, } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useCurrentDecisions, useCurrentDecisionsUnderInvestigation, } from "../hooks/decisions.js"; import { privatePages } from "../Routing.js"; import { ErrorLoadingWithDebug } from "../components/ErrorLoadingWithDebug.js"; import { Officer } from "./Officer.js"; type FormType = { // state: TalerExchangeApi.AmlState; }; export function CasesUI({ records, onFirstPage, onNext, filtered, }: { filtered: boolean; onFirstPage?: () => void; onNext?: () => 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 (
{filtered ? (

Cases under investigation

A list of all the accounts which are waiting for a deicison to be made.

) : (

Cases

A list of all the known account by the exchange.

)}
{!records.length ? (
empty result
) : (
{records.map((r) => { return ( ); })}
Account Id Status
{r.to_investigate ? ( ) : undefined}
)}
); } export function Cases() { 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 function CasesUnderInvestigation() { const list = useCurrentDecisionsUnderInvestigation(); 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); // }} /> ); } // function ToInvestigateIcon(): VNode { // return // // // } export const ToInvestigateIcon = () => ( ); export const PeopleIcon = () => ( ); export const HomeIcon = () => ( ); export const SearchIcon = () => ( ); export function Pagination({ onFirstPage, onNext, }: { onFirstPage?: () => void; onNext?: () => void; }) { const { i18n } = useTranslationContext(); return ( ); }