Fix TypeError: unit_price.toFixed is not a function in SupplierProductManager

- Convert unit_price to Number before calling toFixed() on line 239
- Handles cases where unit_price may be a string, null, or undefined
- Uses fallback to 0 for invalid values to prevent runtime errors

This fixes the error that occurred when displaying supplier product prices in the onboarding supplier step.
This commit is contained in:
Claude
2025-11-07 10:12:19 +00:00
parent 75916adfee
commit e2a326d90f

View File

@@ -236,7 +236,7 @@ export const SupplierProductManager: React.FC<SupplierProductManagerProps> = ({
{getProductName(priceList.inventory_product_id)}
</span>
<span className="text-[var(--text-secondary)] ml-2">
{priceList.unit_price.toFixed(2)}/{priceList.unit_of_measure}
{Number(priceList.unit_price || 0).toFixed(2)}/{priceList.unit_of_measure}
</span>
{priceList.minimum_order_quantity && priceList.minimum_order_quantity > 1 && (
<span className="text-xs text-[var(--text-secondary)] ml-2">