/* This file is part of GNU Taler (C) 2021-2023 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 */ /** * * @author Sebastian Javier Marchano (sebasjm) */ import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { ComponentChildren, Fragment, h, VNode } from "preact"; import { StateUpdater, useState } from "preact/hooks"; import { useEntityContext, useEntityDataContext } from "../../context/entity.js"; interface Props { onSuppress: (id: any) => void; } export function CardTable({onSuppress}: Props): any { const data = useEntityDataContext(); const [rowSelection, rowSelectionHandler] = useState( undefined, ); const { i18n } = useTranslationContext(); const { title, endpoint, entity } = useEntityContext(); return (

{title}

{(data.data[0][endpoint] !== undefined && data.data[0][endpoint].length != 0) ? ( ) : ( )} ); } interface TableProps { data: any; onSuppress: (id: any) => void; } function Table({ data, onSuppress, }: TableProps): VNode { const { i18n } = useTranslationContext(); const { entity } = useEntityContext(); type Entity = typeof entity; let count = 0; return (
{Object.keys(data[0]).map((i: Entity) => { const paramName = i[0].toUpperCase() + i.replace("_", " ").slice(1, i.count); return ( ); })} {data.map((key: Entity, value: string) => { return ( {Object.keys(data[0]).map((i: Entity) => { return ( ); })} ); }) }
{paramName}
{(key[i] == false) ? "false" : key[i]}
); } function EmptyTable(): VNode { const { i18n } = useTranslationContext(); return (

There are no entries yet

); }