Skip to content

Commit

Permalink
POS: Bug Fix - Leading zero in product price
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed Jun 17, 2024
1 parent b524aad commit b90ebc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion models/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Product extends BaseModel {
@observable public name: string;
@observable public sku: string;
@observable public pricedIn: PricedIn;
@observable public price: number;
@observable public price: string;
@observable public category: string;
@observable public status: ProductStatus;

Expand Down
11 changes: 4 additions & 7 deletions views/POS/ProductDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default class ProductDetails extends React.Component<
name: '',
sku: '',
pricedIn: PricedIn.Fiat,
price: 0,
price: '',
category: '',
status: ProductStatus.Active
}),
Expand Down Expand Up @@ -159,10 +159,11 @@ export default class ProductDetails extends React.Component<
case 'price':
if (
value === '' ||
value === '0' ||
value === null ||
isNaN(parseFloat(value))
) {
value = 0;
value = '';
}
value = value;
break;
Expand Down Expand Up @@ -318,11 +319,7 @@ export default class ProductDetails extends React.Component<
/>
</View>
<AmountInput
amount={
product?.price
? String(product?.price)
: ''
}
amount={product?.price}
title={localeString(
'views.Settings.POS.Product.price'
)}
Expand Down

0 comments on commit b90ebc4

Please sign in to comment.