From b90ebc40a05663576bc19b18374e620de3fb110a Mon Sep 17 00:00:00 2001 From: shubham Date: Mon, 17 Jun 2024 18:15:15 +0530 Subject: [PATCH] POS: Bug Fix - Leading zero in product price --- models/Product.ts | 2 +- views/POS/ProductDetails.tsx | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/models/Product.ts b/models/Product.ts index 67575c6e2..120ceabdd 100644 --- a/models/Product.ts +++ b/models/Product.ts @@ -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; diff --git a/views/POS/ProductDetails.tsx b/views/POS/ProductDetails.tsx index eada834d8..274366d01 100644 --- a/views/POS/ProductDetails.tsx +++ b/views/POS/ProductDetails.tsx @@ -106,7 +106,7 @@ export default class ProductDetails extends React.Component< name: '', sku: '', pricedIn: PricedIn.Fiat, - price: 0, + price: '', category: '', status: ProductStatus.Active }), @@ -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; @@ -318,11 +319,7 @@ export default class ProductDetails extends React.Component< />