From 98013322db6b912ac50d72353dbd8b5f7fbc0435 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 6 Oct 2023 10:38:09 -0300 Subject: backoffice ui --- .../src/paths/instance/orders/list/ListPage.tsx | 51 +++++--------------- .../src/paths/instance/orders/list/Table.tsx | 6 +-- .../src/paths/instance/orders/list/index.tsx | 31 ++++-------- .../src/paths/instance/products/list/Table.tsx | 5 +- .../src/paths/instance/products/list/index.tsx | 56 +++------------------- .../src/paths/instance/templates/list/ListPage.tsx | 2 - .../src/paths/instance/templates/list/Table.tsx | 8 ++-- .../src/paths/instance/templates/list/index.tsx | 16 +++++-- .../src/paths/instance/transfers/list/ListPage.tsx | 2 +- .../src/paths/instance/transfers/list/Table.tsx | 6 +-- .../src/paths/instance/transfers/list/index.tsx | 11 ++++- .../instance/validators/create/CreatePage.tsx | 1 + .../src/paths/instance/validators/list/Table.tsx | 6 +-- .../src/paths/instance/webhooks/list/Table.tsx | 6 +-- 14 files changed, 66 insertions(+), 141 deletions(-) (limited to 'packages/merchant-backoffice-ui/src/paths/instance') diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx index c29a6fa6e..9f80719a1 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/ListPage.tsx @@ -21,7 +21,7 @@ import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; -import { h, VNode } from "preact"; +import { h, VNode, Fragment } from "preact"; import { useState } from "preact/hooks"; import { DatePicker } from "../../../../components/picker/DatePicker.js"; import { MerchantBackend, WithId } from "../../../../declaration.js"; @@ -29,8 +29,6 @@ import { CardTable } from "./Table.js"; import { dateFormatForSettings, useSettings } from "../../../../hooks/useSettings.js"; export interface ListPageProps { - errorOrderId: string | undefined; - onShowAll: () => void; onShowNotPaid: () => void; onShowPaid: () => void; @@ -56,17 +54,18 @@ export interface ListPageProps { onSelectOrder: (o: MerchantBackend.Orders.OrderHistoryEntry & WithId) => void; onRefundOrder: (o: MerchantBackend.Orders.OrderHistoryEntry & WithId) => void; - onSearchOrderById: (id: string) => void; onCreate: () => void; } export function ListPage({ + hasMoreAfter, + hasMoreBefore, + onLoadMoreAfter, + onLoadMoreBefore, orders, - errorOrderId, isAllActive, onSelectOrder, onRefundOrder, - onSearchOrderById, jumpToDate, onCopyURL, onShowAll, @@ -86,42 +85,10 @@ export function ListPage({ const { i18n } = useTranslationContext(); const dateTooltip = i18n.str`select date to show nearby orders`; const [pickDate, setPickDate] = useState(false); - const [orderId, setOrderId] = useState(""); const [settings] = useSettings(); return ( -
-
-
-
-
-
- setOrderId(e.currentTarget.value)} - placeholder={i18n.str`order id`} - /> - {errorOrderId &&

{errorOrderId}

} -
- - - -
-
-
-
+
@@ -249,7 +216,11 @@ export function ListPage({ onCopyURL={onCopyURL} onSelect={onSelectOrder} onRefund={onRefundOrder} + hasMoreAfter={hasMoreAfter} + hasMoreBefore={hasMoreBefore} + onLoadMoreAfter={onLoadMoreAfter} + onLoadMoreBefore={onLoadMoreBefore} /> -
+ ); } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx index 608c9b20d..b2806bb79 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx @@ -140,10 +140,9 @@ function Table({ const [settings] = useSettings(); return (
- {onLoadMoreBefore && ( + {hasMoreBefore && (
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx index 274a7c2ea..942b5d0ac 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/products/list/index.tsx @@ -37,6 +37,7 @@ import { Notification } from "../../../../utils/types.js"; import { CardTable } from "./Table.js"; import { HttpStatusCode } from "@gnu-taler/taler-util"; import { ConfirmModal, DeleteModal } from "../../../../components/modal/index.js"; +import { JumpToElementById } from "../../../../components/form/JumpToElementById.js"; interface Props { onUnauthorized: () => VNode; @@ -74,60 +75,17 @@ export default function ProductList({ return onNotFound(); return onLoadError(result); } - const [errorId, setErrorId] = useState( - undefined, - ); - - const [productId, setProductId] = useState() - async function testIfProductExistAndSelect(orderId: string | undefined): Promise { - if (!orderId) { - setErrorId(i18n.str`Enter a product id`); - return; - } - try { - await getProduct(orderId); - onSelect(orderId); - setErrorId(undefined); - } catch { - setErrorId(i18n.str`product not found`); - } - } return (
-
-
-
-
-
- setProductId(e.currentTarget.value)} - placeholder={i18n.str`product id`} - /> - {errorId &&

{errorId}

} -
- - - -
-
-
-
+ ({ ...o, @@ -65,6 +64,5 @@ export function ListPage({ onLoadMoreAfter={onLoadMoreAfter} hasMoreAfter={!onLoadMoreAfter} /> -
); } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/list/Table.tsx index 3bea9abe8..9fdf4ead9 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/templates/list/Table.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/templates/list/Table.tsx @@ -136,11 +136,10 @@ function Table({ const { i18n } = useTranslationContext(); return (
- {onLoadMoreBefore && ( + {hasMoreBefore && (