[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: do not break when pri
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: do not break when price is zero |
Date: |
Tue, 19 Oct 2021 17:32:16 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 1437cf7 do not break when price is zero
1437cf7 is described below
commit 1437cf7c97514621001f9a4becad03a9b5ef6056
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Tue Oct 19 12:32:06 2021 -0300
do not break when price is zero
---
packages/frontend/src/components/product/ProductList.tsx | 9 ++++++---
packages/frontend/src/declaration.d.ts | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/packages/frontend/src/components/product/ProductList.tsx
b/packages/frontend/src/components/product/ProductList.tsx
index c343b75..8b1d63e 100644
--- a/packages/frontend/src/components/product/ProductList.tsx
+++ b/packages/frontend/src/components/product/ProductList.tsx
@@ -15,7 +15,7 @@
*/
import { h, VNode } from "preact"
import { MerchantBackend } from "../../declaration"
-import { Amounts } from "@gnu-taler/taler-util";
+import { AmountJson, Amounts } from "@gnu-taler/taler-util";
import emptyImage from "../../assets/empty.png";
import { Translate } from "../../i18n";
@@ -42,6 +42,9 @@ export function ProductList({ list, actions = [] }: Props):
VNode {
</thead>
<tbody>
{list.map((entry, index) => {
+ const unitPrice = !entry.price ? '0' : entry.price;
+ const totalPrice = !entry.price ? '0' :
Amounts.stringify(Amounts.mult(Amounts.parseOrThrow(entry.price),
entry.quantity).amount);
+
return <tr key={index}>
<td>
<img style={{ height: 32, width: 32 }} src={entry.image ?
entry.image : emptyImage} />
@@ -50,8 +53,8 @@ export function ProductList({ list, actions = [] }: Props):
VNode {
<td >
{entry.quantity === 0 ? '--' : `${entry.quantity} ${entry.unit}`}
</td>
- <td >{entry.price}</td>
- <td
>{Amounts.stringify(Amounts.mult(Amounts.parseOrThrow(entry.price),
entry.quantity).amount)}</td>
+ <td >{unitPrice}</td>
+ <td >{totalPrice}</td>
<td class="is-actions-cell right-sticky">
{actions.map((a, i) => {
return <div key={i} class="buttons is-right">
diff --git a/packages/frontend/src/declaration.d.ts
b/packages/frontend/src/declaration.d.ts
index 1722a3d..e5486de 100644
--- a/packages/frontend/src/declaration.d.ts
+++ b/packages/frontend/src/declaration.d.ts
@@ -181,7 +181,7 @@ export namespace MerchantBackend {
unit: string;
// The price of the product; this is the total price for quantity
times unit of this product.
- price: Amount;
+ price?: Amount;
// An optional base64-encoded product image
image: ImageDataUrl;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant-backoffice] branch master updated: do not break when price is zero,
gnunet <=