Update profit-analysis-modal.tsx
This commit is contained in:
@@ -208,6 +208,10 @@ export const ProfitAnalysisModal: React.FC<ProfitAnalysisModalProps> = ({
|
|||||||
{profitData.profitMargins.map((tier, index) => {
|
{profitData.profitMargins.map((tier, index) => {
|
||||||
const ProfitIcon = getProfitIcon(tier.profit);
|
const ProfitIcon = getProfitIcon(tier.profit);
|
||||||
|
|
||||||
|
const totalProfitForMinQty = tier.profit !== null ? tier.profit * tier.minQuantity : null;
|
||||||
|
const totalRevenueForMinQty = tier.pricePerUnit * tier.minQuantity;
|
||||||
|
const totalCostForMinQty = profitData.costPerUnit * tier.minQuantity;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
@@ -220,14 +224,20 @@ export const ProfitAnalysisModal: React.FC<ProfitAnalysisModalProps> = ({
|
|||||||
{tier.minQuantity}+ units @ {formatCurrency(tier.pricePerUnit)}
|
{tier.minQuantity}+ units @ {formatCurrency(tier.pricePerUnit)}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Minimum quantity: {tier.minQuantity}
|
Revenue for {tier.minQuantity} units: {formatCurrency(totalRevenueForMinQty)}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
Cost for {tier.minQuantity} units: {formatCurrency(totalCostForMinQty)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="text-right space-y-1">
|
<div className="text-right space-y-1">
|
||||||
<div className={`font-medium ${getProfitColor(tier.profit)}`}>
|
<div className={`font-medium ${getProfitColor(totalProfitForMinQty)}`}>
|
||||||
Profit: {formatCurrency(tier.profit)}
|
Total Profit: {formatCurrency(totalProfitForMinQty)}
|
||||||
|
</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
Per unit: {formatCurrency(tier.profit)}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm text-muted-foreground">
|
<div className="text-sm text-muted-foreground">
|
||||||
Margin: {formatPercentage(tier.profitMargin)} |
|
Margin: {formatPercentage(tier.profitMargin)} |
|
||||||
|
|||||||
Reference in New Issue
Block a user