diff --git a/src/Components/Modals/PaymentModal.js b/src/Components/Modals/PaymentModal.js index e4b236f..8c494b0 100644 --- a/src/Components/Modals/PaymentModal.js +++ b/src/Components/Modals/PaymentModal.js @@ -1,3 +1,4 @@ +import { useMemo } from "react"; import Button from "../../pageElements/Button"; import Modal from "react-bootstrap/Modal"; import TextInput from "../../pageElements/TextInput"; @@ -31,9 +32,13 @@ const PaymentModal = ({ const additionalAccountsAnnualPriceToday = additionalAccountsMonthlyPriceToday * 12; - const extraAccountsPrice = isAnnual + const tempExtraAccountsPrice = isAnnual ? additionalAccountsAnnualPriceToday : additionalAccountsMonthlyPriceToday; + const extraAccountsPrice = + tempExtraAccountsPrice === NaN || tempExtraAccountsPrice === undefined + ? 0 + : 0; const showAdditionaLAccountsView = (selectedPlan[0]?.value === "partner" && numberOfAccountsToAdd > 0) || (selectedPlan[0]?.value === "seniorPartner" && numberOfAccountsToAdd > 0); @@ -44,6 +49,12 @@ const PaymentModal = ({ ? annualSubscriptionPriceToday : monthlySubscriptionPriceToday; const totalToday = amountToday + extraAccountsPrice; + console.log("amoutnToday", amountToday); + console.log("extraAccountsPrice", extraAccountsPrice); + + function handleValidateAndPay() { + handleSignup(totalToday); + } return ( @@ -65,17 +76,20 @@ const PaymentModal = ({ {billingPeriod} - ${amountToday} - -
-
- {numberOfAccountsToAdd} Addiitonal{" "} - {numberOfAccountsToAdd > 1 ? `accounts` : `account`} + {numberOfAccountsToAdd !== undefined && + numberOfAccountsToAdd > 0 ? ( +
+
+ {numberOfAccountsToAdd} Addiitonal{" "} + {numberOfAccountsToAdd > 1 ? `accounts` : `account`} +
+
+ {billingPeriod} - ${extraAccountsPrice} +
-
- {billingPeriod} - ${extraAccountsPrice} -
-
- + ) : ( + <> + )}
Total today:
${totalToday}
@@ -135,7 +149,7 @@ const PaymentModal = ({