diff --git a/src/components/Pricing/PricingAddons/index.js b/src/components/Pricing/PricingAddons/index.js index cce908d63ba61..ed0d39797e223 100644 --- a/src/components/Pricing/PricingAddons/index.js +++ b/src/components/Pricing/PricingAddons/index.js @@ -20,7 +20,7 @@ import { TextField, useTheme, SistentThemeProvider -} from "@sistent/sistent"; +} from "@sistent/sistent"; import { Calculate, CheckCircle, Cloud, Group } from "@mui/icons-material"; import { useStyledDarkMode } from "../../../theme/app/useStyledDarkMode"; import { getAddOns } from "./pricingData"; @@ -37,12 +37,13 @@ import { formControlStyles, featureDetailsStyles, getToggleButtonStyle, - getSliderStyle + getSliderStyle, + QANELAS_FONT } from "./styles"; import { formatAndConvertPrice } from "../../../utils/currencies"; -export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterprisePlan }) => { +export const PricingAddons = ({ isYearly = false, setIsYearly, currency, enterprisePlan }) => { const [selectedAddon, setSelectedAddon] = useState(null); // const [quantity, setQuantity] = useState(1); @@ -62,22 +63,22 @@ export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterpri // Helper function to render icons based on type const renderIcon = (iconType) => { switch (iconType) { - case "academy": - return ; - case "cloud": - return ; - case "group": - return ; - default: - return null; + case "academy": + return ; + case "cloud": + return ; + case "group": + return ; + default: + return null; } }; const formatPrice = (price) => { - return formatAndConvertPrice(price, currency); + return formatAndConvertPrice(price, currency); }; useEffect(() => { @@ -466,24 +467,98 @@ export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterpri elevation={1} sx={boxStyles.pricingPaper} > - - - Add-on × Quantity per Subscription Duration - - - SUBTOTAL + `2px dashed ${theme.palette.divider}`, + pb: 2, + mb: 2 + }}> + + PRICING SUMMARY - - - - {selectedAddon?.id === "academy" ? - `Theoretical Learning × ${selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory")?.pricing?.[quantityIndex]?.learners || 0}` : - `${selectedAddon?.name} × ${quantity} x ${selectedAddon?.cadence}` + + `1px solid ${theme.palette.divider}`, + pb: 1, + mb: 2, + fontSize: "0.8rem", + fontWeight: "bold", + color: "text.secondary" + }}> + ADD-ON + QTY + RATE + AMOUNT + + + {/* Main Add-on Item */} + `1px dotted ${theme.palette.divider}`, + fontSize: "0.85rem", + alignItems: "center" + }}> + + + {selectedAddon?.id === "academy" ? "Theoretical Learning" : selectedAddon?.name} + + {selectedAddon?.id !== "academy" && ( + + {selectedAddon?.cadence && `${selectedAddon.cadence} subscription`} + + )} + + + + {selectedAddon?.id === "academy" + ? selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory")?.pricing?.[quantityIndex]?.learners || 0 + : quantity } - + + + {(() => { + if (selectedAddon?.id === "academy") { + const theorySubAddon = selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory"); + if (theorySubAddon?.pricing && theorySubAddon.pricing[quantityIndex]) { + const currentLearnerOption = theorySubAddon.pricing[quantityIndex]; + const perUserCost = isYearly ? currentLearnerOption.yearlyPerUser : currentLearnerOption.monthlyPerUser; + return formatPrice(perUserCost); + } + return formatPrice(0); + } else { + return formatPrice(isYearly ? selectedAddon?.yearlyPrice : selectedAddon?.monthlyPrice); + } + })()} + + + {(() => { if (selectedAddon?.id === "academy") { const theorySubAddon = selectedAddon?.subAddOns?.find(sub => sub.id === "academy-theory"); @@ -506,11 +581,54 @@ export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterpri {selectedAddon?.id === "academy" && selectedAddon.subAddOns?.map((subAddOn) => ( selectedSubAddOns[subAddOn.id] && subAddOn.id !== "academy-theory" && ( - - - {subAddOn.name} × {subAddOn.pricing?.[quantityIndex]?.learners || 0}/{isYearly ? "yearly" : "monthly"} + `1px dotted ${theme.palette.divider}`, + fontSize: "0.85rem", + alignItems: "center" + }}> + + + {subAddOn.name} + + + {isYearly ? "Yearly" : "Monthly"} subscription + + + + + {subAddOn.pricing?.[quantityIndex]?.learners || 0} + + + + {(() => { + const subAddOnPricing = subAddOn.pricing && subAddOn.pricing[quantityIndex]; + if (subAddOnPricing) { + const perUserCost = isYearly ? subAddOnPricing.yearlyPerUser : subAddOnPricing.monthlyPerUser; + return formatPrice(perUserCost); + } + return formatPrice(0); + })()} - + + {formatPrice( (() => { const subAddOnPricing = subAddOn.pricing && subAddOn.pricing[quantityIndex]; @@ -526,48 +644,107 @@ export const PricingAddons = ({ isYearly = false, setIsYearly ,currency,enterpri ) ))} - - - - Enterprise User × + `1px solid ${theme.palette.divider}`, + fontSize: "0.85rem", + alignItems: "center" + }}> + + + Enterprise Users + + + Monthly subscription + + + setEnterpriseUsers(parseInt(e.target.value, 10))} - inputProps={{ min: 1, style: { textAlign: "center" } }} - sx={boxStyles.enterpriseUserInput} + inputProps={{ + min: 1, + style: { + textAlign: "center", + fontSize: "0.85rem", + width: "50px", + padding: "4px", + fontFamily: typographyStyles.qanelasFont.fontFamily, + } + }} + sx={{ + width: "60px", + "& .MuiInputBase-root": { + height: "30px" + }, + }} /> - - {formatPrice((isYearly ? enterprisePlan.yearlyprice : enterprisePlan.monthlyprice) * (enterpriseUsers > 0 ? enterpriseUsers : 1))}/{isYearly ? "monthly" : "yearly"} + + + {formatPrice(isYearly ? enterprisePlan.yearlyprice : enterprisePlan.monthlyprice)} + + + + {formatPrice((isYearly ? enterprisePlan.yearlyprice : enterprisePlan.monthlyprice) * (enterpriseUsers > 0 ? enterpriseUsers : 1))} - - TOTAL - - - - {isYearly ? "Yearly" : "Monthly"} Cost + + + + `2px solid ${theme.palette.divider}`, + pt: 2 + }}> + + TOTAL ({isYearly ? "YEARLY" : "MONTHLY"}) - + {formatPrice(totalPrice)} - - /{isYearly ? "yearly" : "monthly"} - - - - + + - - + *Prices shown are {isYearly ? "annual" : "monthly"} subscription costs. {isYearly ? "Monthly subscriptions are available at standard rates." : "Annual subscriptions receive a 15% discount."} Contact our sales team for enterprise pricing and custom configurations. diff --git a/src/components/Pricing/PricingAddons/styles.js b/src/components/Pricing/PricingAddons/styles.js index b58d253ddbc90..58ead7782bdff 100644 --- a/src/components/Pricing/PricingAddons/styles.js +++ b/src/components/Pricing/PricingAddons/styles.js @@ -53,7 +53,8 @@ export const typographyStyles = { fontSize: "0.8rem", fontStyle: "italic", fontFamily: QANELAS_FONT, - color: "text.secondary" + color: "text.secondary", + marginTop: 0.5, }, pricingItemLeft: { marginLeft: 0.5,