Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POS fixes #2067

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions views/Order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,13 @@ export default class OrderView extends React.Component<OrderProps, OrderState> {
let unitDisplayValue, totalDisplayValue;
if (fiatPriced) {
unitDisplayValue = UnitsStore.getFormattedAmount(
unitPrice,
new BigNumber(unitPrice).toFixed(2),
'fiat'
);
totalDisplayValue = UnitsStore.getFormattedAmount(
unitPrice * item.quantity,
new BigNumber(unitPrice)
.multipliedBy(item.quantity)
.toFixed(2),
'fiat'
);
} else {
Expand All @@ -544,7 +546,9 @@ export default class OrderView extends React.Component<OrderProps, OrderState> {
'sats'
);
totalDisplayValue = UnitsStore.getFormattedAmount(
unitPrice * item.quantity,
new BigNumber(unitPrice)
.multipliedBy(item.quantity)
.toString(),
'sats'
);
}
Expand Down
17 changes: 11 additions & 6 deletions views/POS/ProductDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ export default class ProductDetails extends React.Component<
isValid = () => {
const { product } = this.state;

return product && product?.name !== '' && product.price > 0;
return (
product &&
product?.name !== '' &&
product?.price &&
Number(product?.price.toString().replace(',', '.')) > 0
);
};

render() {
Expand Down Expand Up @@ -342,11 +347,11 @@ export default class ProductDetails extends React.Component<
/>
</View>
<AmountInput
amount={String(
product?.price == 0
? ''
: product?.price
)}
amount={
product?.price
? String(product?.price)
: ''
}
title={localeString(
'views.Settings.POS.Product.price'
)}
Expand Down
Loading