aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx19
1 files changed, 9 insertions, 10 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
index 2526e4d33..265146c01 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/products/list/Table.tsx
@@ -19,10 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { Amounts } from "@gnu-taler/taler-util";
+import { AmountString, Amounts, TalerMerchantApi } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { format } from "date-fns";
-import { ComponentChildren, Fragment, h, VNode } from "preact";
+import { ComponentChildren, Fragment, VNode, h } from "preact";
import { StateUpdater, useState } from "preact/hooks";
import emptyImage from "../../../../assets/empty.png";
import {
@@ -31,10 +31,9 @@ import {
} from "../../../../components/form/FormProvider.js";
import { InputCurrency } from "../../../../components/form/InputCurrency.js";
import { InputNumber } from "../../../../components/form/InputNumber.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
import { dateFormatForSettings, usePreference } from "../../../../hooks/preference.js";
-type Entity = MerchantBackend.Products.ProductDetail & WithId;
+type Entity = TalerMerchantApi.ProductDetail & WithId;
interface Props {
instances: Entity[];
@@ -42,7 +41,7 @@ interface Props {
onSelect: (product: Entity) => void;
onUpdate: (
id: string,
- data: MerchantBackend.Products.ProductPatchDetail,
+ data: TalerMerchantApi.ProductPatchDetail,
) => Promise<void>;
onCreate: () => void;
selected?: boolean;
@@ -108,7 +107,7 @@ interface TableProps {
onSelect: (id: Entity) => void;
onUpdate: (
id: string,
- data: MerchantBackend.Products.ProductPatchDetail,
+ data: TalerMerchantApi.ProductPatchDetail,
) => Promise<void>;
onDelete: (id: Entity) => void;
rowSelectionHandler: StateUpdater<string | undefined>;
@@ -305,7 +304,7 @@ function Table({
interface FastProductUpdateFormProps {
product: Entity;
onUpdate: (
- data: MerchantBackend.Products.ProductPatchDetail,
+ data: TalerMerchantApi.ProductPatchDetail,
) => Promise<void>;
onCancel: () => void;
}
@@ -361,7 +360,7 @@ function FastProductWithInfiniteStockUpdateForm({
onClick={() =>
onUpdate({
...product,
- price: value.price,
+ price: value.price as AmountString,
})
}
>
@@ -446,7 +445,7 @@ function FastProductWithManagedStockUpdateForm({
...product,
total_stock: product.total_stock + value.incoming,
total_lost: product.total_lost + value.lost,
- price: value.price,
+ price: value.price as AmountString,
})
}
>
@@ -491,6 +490,6 @@ function difference(price: string, tax: number) {
ps[1] = `${p - tax}`;
return ps.join(":");
}
-function sum(taxes: MerchantBackend.Tax[]) {
+function sum(taxes: TalerMerchantApi.Tax[]) {
return taxes.reduce((p, c) => p + parseInt(c.tax.split(":")[1], 10), 0);
}