import { h, VNode } from "preact"; import { useBusinessAccounts } from "../../hooks/circuit.js"; import { handleNotOkResult } from "../HomePage.js"; import { AccountAction } from "./Home.js"; import { Amounts } from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { RenderAmount } from "../PaytoWireTransferForm.js"; interface Props { onAction: (type: AccountAction, account: string) => void; account: string | undefined; onCreateAccount: () => void; } export function AccountList({ account, onAction, onCreateAccount }: Props): VNode { const result = useBusinessAccounts({ account }); const { i18n } = useTranslationContext(); if (result.loading) return
; if (!result.ok) { return handleNotOkResult(i18n)(result); } const { customers } = result.data; return
{i18n.str`Username`} | {i18n.str`Name`} | {i18n.str`Balance`} | {i18n.str`Actions`} |
---|---|---|---|
{ e.preventDefault(); onAction("show-details", item.username) }} > {item.username} | {item.name} |
{!balance ? (
i18n.str`unknown`
) : (
|
{
e.preventDefault();
onAction("update-password", item.username)
}}
>
change password
{ e.preventDefault(); onAction("show-cashout", item.username) }} > cashouts { e.preventDefault(); onAction("remove-account", item.username) }} > remove |