mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(bug) product limit stock error
This commit is contained in:
parent
9834faf120
commit
e462079754
@ -76,7 +76,7 @@ export const StoreProductItem: React.FC<StoreProductItemProps> = ({ product, car
|
||||
<FabStateLabel status={statusColor(product)}>
|
||||
<span>{t(ProductLib.stockStatusTrKey(product))}</span>
|
||||
</FabStateLabel>
|
||||
{product.stock.external > (product.quantity_min || 1) &&
|
||||
{product.stock.external >= (product.quantity_min || 1) &&
|
||||
<FabButton icon={<i className="fas fa-cart-arrow-down" />} className="main-action-btn" onClick={addProductToCart}>
|
||||
{t('app.public.store_product_item.add')}
|
||||
</FabButton>
|
||||
|
@ -74,6 +74,7 @@ export const StoreProduct: React.FC<StoreProductProps> = ({ productSlug, current
|
||||
if (product.low_stock_threshold && product.stock.external < product.low_stock_threshold) {
|
||||
return 'low';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
/**
|
||||
@ -115,7 +116,7 @@ export const StoreProduct: React.FC<StoreProductProps> = ({ productSlug, current
|
||||
|
||||
if (product) {
|
||||
return (
|
||||
<div className={`store-product ${statusColor(product) || ''}`}>
|
||||
<div className={`store-product ${statusColor(product)}`}>
|
||||
{product.sku && <span className='ref'>{t('app.public.store_product.ref', { REF: product.sku })}</span>}
|
||||
<h2 className='name'>{product.name}</h2>
|
||||
<div className='gallery'>
|
||||
@ -167,7 +168,7 @@ export const StoreProduct: React.FC<StoreProductProps> = ({ productSlug, current
|
||||
<span>{t(ProductLib.stockStatusTrKey(product))}</span>
|
||||
</FabStateLabel>
|
||||
<ProductPrice product={product} className="price" />
|
||||
{product.stock.external > (product.quantity_min || 1) &&
|
||||
{product.stock.external >= (product.quantity_min || 1) &&
|
||||
<div className='to-cart'>
|
||||
{product.quantity_min > 1 &&
|
||||
<span className='min'>{t('app.public.store_product.minimum_purchase')}{product.quantity_min}</span>
|
||||
|
@ -41,7 +41,7 @@ export default class ProductLib {
|
||||
};
|
||||
|
||||
static stockStatusTrKey = (product: Product): string => {
|
||||
if (product.stock.external <= (product.quantity_min || 0)) {
|
||||
if (product.stock.external < (product.quantity_min || 1)) {
|
||||
return 'app.public.stock_status.out_of_stock';
|
||||
}
|
||||
if (product.low_stock_threshold && product.stock.external < product.low_stock_threshold) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user