// Component con hiển thị thông tin chính của sản phẩm const ProductPrimaryInfo = ({ product, lang, minPromotionPrice }) => { // Helper function to check if a value is truthy and not just whitespace const hasValue = (value) => value && String(value).trim() !== ''; const itemCodeValue = product?.item_code; const brandValue = lang === 'vi' ? product?.brand_vi : product?.brand_en; const originValue = lang === 'vi' ? product?.country_vi : product?.country_en; const stockOnHandValue = parseInt(product?.stock_on_hand); const showItemCode = hasValue(itemCodeValue); const showBrand = hasValue(brandValue); const showOrigin = hasValue(originValue); const showStockOnHand = stockOnHandValue > 0; return ( <>

{lang === 'vi' ? product?.Short_Description_VI : product?.Short_Description_EN || product?.description}

{/* Dòng Mã hàng và Thương hiệu */} {(showItemCode || showBrand) && (
{showItemCode && ( {lang === 'vi' ? "Mã Hàng:" : "Item Code:"} {itemCodeValue} )} {showBrand && ( {lang === 'vi' ? "Thương hiệu:" : "Brand:"} {brandValue} )}
)} {/* Dòng Xuất xứ và Tồn kho */} {(showOrigin || showStockOnHand) && (
{showOrigin && ( {lang === 'vi' ? "Xuất xứ:" : "Origin:"} {originValue} )} {showStockOnHand && ( {lang === 'vi' ? "Tồn kho:" : "On hand:"} {commonFunc.formatNumber(stockOnHandValue)} )}
)}
{minPromotionPrice && minPromotionPrice < product?.price ? (
{commonFunc.formatNumber(parseInt(product?.price))}đ {commonFunc.formatNumber(parseInt(minPromotionPrice))}đ
) : ( {commonFunc.formatNumber(parseInt(product?.price))}đ )}
); };