Skip to content

Commit 6b26352

Browse files
authored
Merge pull request #6844 from Namanv0509/addon-bug
addon bug fix
2 parents fc6922c + 8ba1cae commit 6b26352

1 file changed

Lines changed: 35 additions & 26 deletions

File tree

  • src/components/Pricing/PricingAddons

src/components/Pricing/PricingAddons/index.js

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -486,32 +486,41 @@ export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterpri
486486

487487
<Box sx={{ ...boxStyles.flexColumn, ...boxStyles.pricingItems }}>
488488
<Box sx={boxStyles.flexBetween}>
489-
<Typography variant="body1" sx={typographyStyles.pricingItemLeft}>
490-
{selectedAddon?.id === "academy" ?
491-
`Theoretical Learning × ${selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory")?.pricing?.[quantityIndex]?.learners || 0}` :
492-
`${selectedAddon?.name} × ${quantity} x ${selectedAddon?.cadence}`
493-
}
494-
</Typography>
495-
<Typography variant="body1" fontWeight="500" sx={typographyStyles.pricingItemRight}>
496-
{(() => {
497-
if (selectedAddon?.id === "academy") {
498-
const theorySubAddon = selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory");
499-
if (theorySubAddon?.pricing && theorySubAddon.pricing[quantityIndex]) {
500-
const currentLearnerOption = theorySubAddon.pricing[quantityIndex];
501-
const monthlyPerUserCost = currentLearnerOption.monthlyPerUser;
502-
const yearlyPerUserCost = currentLearnerOption.yearlyPerUser;
503-
const totalCost = isYearly
504-
? yearlyPerUserCost * currentLearnerOption.learners
505-
: monthlyPerUserCost * currentLearnerOption.learners;
506-
return formatPrice(totalCost);
507-
}
508-
return formatPrice(0);
509-
} else {
510-
return formatPrice((isYearly ? selectedAddon?.yearlyPrice : selectedAddon?.monthlyPrice) * quantity);
511-
}
512-
})()}
513-
</Typography>
514-
</Box>
489+
<Typography variant="body1" sx={typographyStyles.pricingItemLeft}>
490+
{selectedAddon?.id === "academy" ?
491+
`Theoretical Learning × ${selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory")?.pricing?.[quantityIndex]?.learners || 0}` :
492+
`${selectedAddon?.name} × ${selectedAddon?.pricing?.[quantityIndex]?.units || 0}`
493+
}
494+
</Typography>
495+
<Typography variant="body1" fontWeight="500" sx={typographyStyles.pricingItemRight}>
496+
{(() => {
497+
if (selectedAddon?.id === "academy") {
498+
const theorySubAddon = selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory");
499+
if (theorySubAddon?.pricing && theorySubAddon.pricing[quantityIndex]) {
500+
const currentLearnerOption = theorySubAddon.pricing[quantityIndex];
501+
const monthlyPerUserCost = currentLearnerOption.monthlyPerUser;
502+
const yearlyPerUserCost = currentLearnerOption.yearlyPerUser;
503+
const totalCost = isYearly
504+
? yearlyPerUserCost * currentLearnerOption.learners
505+
: monthlyPerUserCost * currentLearnerOption.learners;
506+
return formatPrice(totalCost);
507+
}
508+
return formatPrice(0);
509+
} else {
510+
if (selectedAddon?.pricing && selectedAddon.pricing[quantityIndex]) {
511+
const currentOption = selectedAddon.pricing[quantityIndex];
512+
const monthlyPerUnitCost = currentOption.monthlyPerUnit;
513+
const yearlyPerUnitCost = currentOption.yearlyPerUnit;
514+
const totalCost = isYearly
515+
? yearlyPerUnitCost * currentOption.units
516+
: monthlyPerUnitCost * currentOption.units;
517+
return formatPrice(totalCost);
518+
}
519+
return formatPrice(0);
520+
}
521+
})()} /{isYearly ? "yearly" : "monthly"}
522+
</Typography>
523+
</Box>
515524

516525
{selectedAddon?.id === "academy" && selectedAddon.subAddOns?.map((subAddOn) => (
517526
selectedSubAddOns[subAddOn.id] && subAddOn.id !== "academy-theory" && (

0 commit comments

Comments
 (0)