diff options
author | Sebastian <sebasjm@gmail.com> | 2024-03-22 13:56:16 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-03-26 16:57:58 -0300 |
commit | e2bfbced7ab027c901913e83ff7dd82240661990 (patch) | |
tree | 33752605ccaf19498f8c2a64e0117db16f22ce26 /packages/merchant-backoffice-ui/src/paths/instance/orders/list | |
parent | 0c265558c4b7b78a13272abf1c4c84e3cf93c987 (diff) | |
download | wallet-core-e2bfbced7ab027c901913e83ff7dd82240661990.tar.xz |
work in progress, new api being used. merchant now should move into using the full API
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders/list')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/list/Table.tsx | 35 |
1 files changed, 17 insertions, 18 deletions
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 87e84945c..cebc4afe6 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 @@ -20,7 +20,10 @@ */ import { Amounts } from "@gnu-taler/taler-util"; -import { useTranslationContext } from "@gnu-taler/web-util/browser"; +import { + useMerchantApiContext, + useTranslationContext, +} from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { h, VNode } from "preact"; import { StateUpdater, useState } from "preact/hooks"; @@ -33,10 +36,12 @@ import { InputCurrency } from "../../../../components/form/InputCurrency.js"; import { InputGroup } from "../../../../components/form/InputGroup.js"; import { InputSelector } from "../../../../components/form/InputSelector.js"; import { ConfirmModal } from "../../../../components/modal/index.js"; -import { useConfigContext } from "../../../../context/config.js"; import { MerchantBackend, WithId } from "../../../../declaration.js"; import { mergeRefunds } from "../../../../utils/amount.js"; -import { datetimeFormatForSettings, usePreference } from "../../../../hooks/preference.js"; +import { + datetimeFormatForSettings, + usePreference, +} from "../../../../hooks/preference.js"; type Entity = MerchantBackend.Orders.OrderHistoryEntry & WithId; interface Props { @@ -141,10 +146,7 @@ function Table({ return ( <div class="table-container"> {hasMoreBefore && ( - <button - class="button is-fullwidth" - onClick={onLoadMoreBefore} - > + <button class="button is-fullwidth" onClick={onLoadMoreBefore}> <i18n.Translate>load newer orders</i18n.Translate> </button> )} @@ -174,9 +176,9 @@ function Table({ {i.timestamp.t_s === "never" ? "never" : format( - new Date(i.timestamp.t_s * 1000), - datetimeFormatForSettings(settings), - )} + new Date(i.timestamp.t_s * 1000), + datetimeFormatForSettings(settings), + )} </td> <td onClick={(): void => onSelect(i)} @@ -218,10 +220,7 @@ function Table({ </tbody> </table> {hasMoreAfter && ( - <button - class="button is-fullwidth" - onClick={onLoadMoreAfter} - > + <button class="button is-fullwidth" onClick={onLoadMoreAfter}> <i18n.Translate>load older orders</i18n.Translate> </button> )} @@ -268,7 +267,7 @@ export function RefundModal({ order.order_status === "paid" ? order.refund_details : [] ).reduce(mergeRefunds, []); - const config = useConfigContext(); + const { config } = useMerchantApiContext(); const totalRefunded = refunds .map((r) => r.amount) .reduce( @@ -362,9 +361,9 @@ export function RefundModal({ {r.timestamp.t_s === "never" ? "never" : format( - new Date(r.timestamp.t_s * 1000), - datetimeFormatForSettings(settings), - )} + new Date(r.timestamp.t_s * 1000), + datetimeFormatForSettings(settings), + )} </td> <td>{r.amount}</td> <td>{r.reason}</td> |