@@ -26,15 +26,20 @@ const PaymentModal = ({
|
||||
const monthlySubscriptionPriceToday = selectedPlan[0].pricing[0].amount;
|
||||
const annualSubscriptionPriceToday = selectedPlan[0].pricing[1].amount * 12;
|
||||
|
||||
const additionalAccountsMonthlyPriceToday =
|
||||
selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd;
|
||||
const additionalAccountsMonthlyPriceToday = selectedPlan[0].pricing[2].amount
|
||||
? selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd
|
||||
: null;
|
||||
|
||||
const additionalAccountsAnnualPriceToday =
|
||||
additionalAccountsMonthlyPriceToday * 12;
|
||||
|
||||
const extraAccountsPrice = isAnnual
|
||||
? additionalAccountsAnnualPriceToday
|
||||
: additionalAccountsMonthlyPriceToday;
|
||||
? additionalAccountsAnnualPriceToday
|
||||
: 0
|
||||
: additionalAccountsMonthlyPriceToday
|
||||
? additionalAccountsMonthlyPriceToday
|
||||
: 0;
|
||||
|
||||
const showAdditionaLAccountsView =
|
||||
(selectedPlan[0]?.value === "partner" && numberOfAccountsToAdd > 0) ||
|
||||
@@ -45,6 +50,7 @@ const PaymentModal = ({
|
||||
const amountToday = isAnnual
|
||||
? annualSubscriptionPriceToday
|
||||
: monthlySubscriptionPriceToday;
|
||||
|
||||
const totalToday = amountToday + extraAccountsPrice;
|
||||
|
||||
function handleValidateAndPay() {
|
||||
|
||||
@@ -139,7 +139,7 @@ const SignupPage = () => {
|
||||
};
|
||||
|
||||
try {
|
||||
const collecRef = collection(db, "incompleteSignups");
|
||||
const collecRef = collection(db, "signupLeads");
|
||||
await setDoc(doc(collecRef, `${signupId}`), userData);
|
||||
} catch (error) {
|
||||
console.log(`Error saving new user to db: ${error}`);
|
||||
@@ -216,28 +216,14 @@ const SignupPage = () => {
|
||||
if (isBusy) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
const userDataValues = validateUserData();
|
||||
const dataValues = validateUserData();
|
||||
if (dataValues === null) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
const userDataValues = {
|
||||
barNumber: "232323",
|
||||
city: "broolyn",
|
||||
email: "j@s.com",
|
||||
firm: "asdf",
|
||||
firstName: "ghghg",
|
||||
lastName: "hhhhh",
|
||||
password: "123344556",
|
||||
practiceArea: "dfdfdf",
|
||||
state: "New York",
|
||||
streetAddress: "123 Main",
|
||||
telephone: "(313) 555-5555",
|
||||
zipCode: "12345",
|
||||
};
|
||||
saveLeadData(userDataValues);
|
||||
|
||||
saveLeadData(dataValues);
|
||||
*/
|
||||
setShowSelectPlan(!showSelectPlan);
|
||||
};
|
||||
|
||||
@@ -259,6 +245,9 @@ const SignupPage = () => {
|
||||
paymentDataValues,
|
||||
customerDataValues
|
||||
) {
|
||||
console.log(
|
||||
"~~~~~~~~~~~~~~~~~~~~_______-~~~~handleStripeAuthorization fired"
|
||||
);
|
||||
const additionalAccounts = numberOfAccountsToAdd
|
||||
? numberOfAccountsToAdd
|
||||
: 0;
|
||||
@@ -278,7 +267,7 @@ const SignupPage = () => {
|
||||
paymentDataValues.cardLastName,
|
||||
},
|
||||
});
|
||||
|
||||
const type = selectedPlan[0].value ? selectedPlan[0].value : null;
|
||||
try {
|
||||
let response = await fetch(`${apiUrl}/create-subscription`, {
|
||||
method: "POST",
|
||||
@@ -286,7 +275,7 @@ const SignupPage = () => {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
type: selectedPlan,
|
||||
planType: type,
|
||||
additionalAccounts: additionalAccounts,
|
||||
isAnnual: isAnnual,
|
||||
customerData: {
|
||||
@@ -323,18 +312,37 @@ const SignupPage = () => {
|
||||
|
||||
const handleSignup = async (totalDue) => {
|
||||
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
|
||||
console.log("totalDue", totalDue);
|
||||
|
||||
const paymentDataValues = validatePaymentData();
|
||||
if (paymentDataValues === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let dataValues = validateUserData();
|
||||
/* let dataValues = validateUserData();
|
||||
if (dataValues === null) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
const id = uuidv4();
|
||||
const email = `${id}@jim.com`;
|
||||
let dataValues = {
|
||||
firstName: "fffff",
|
||||
lastName: "ffff",
|
||||
firm: "form",
|
||||
telephone: "(313) 333-3333",
|
||||
streetAddress: "123 main",
|
||||
city: "new york",
|
||||
state: "New York",
|
||||
zipCode: "10122",
|
||||
barNumber: "2343434",
|
||||
practiceArea: "3df",
|
||||
email: email,
|
||||
password: "stingPrug1",
|
||||
confirmPassword: "stingPrug1",
|
||||
};
|
||||
|
||||
const planType = determinePlan(isAnnual, activeRadioOption);
|
||||
console.log(planType);
|
||||
setIsBusy(true);
|
||||
|
||||
if (paymentDataValues && dataValues) {
|
||||
@@ -367,6 +375,7 @@ const SignupPage = () => {
|
||||
}
|
||||
} catch (error) {
|
||||
setIsBusy(false);
|
||||
console.log("-------->error", error);
|
||||
setNotice(
|
||||
error.message || "Sorry, something went wrong. Please try again."
|
||||
);
|
||||
@@ -623,4 +632,24 @@ const SignupPage = () => {
|
||||
};
|
||||
|
||||
export default SignupPage;
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
|
||||
const userDataValues = {
|
||||
barNumber: "232323",
|
||||
city: "broolyn",
|
||||
email: "j@s.com",
|
||||
firm: "asdf",
|
||||
firstName: "ghghg",
|
||||
lastName: "hhhhh",
|
||||
password: "123344556",
|
||||
practiceArea: "dfdfdf",
|
||||
state: "New York",
|
||||
streetAddress: "123 Main",
|
||||
telephone: "(313) 555-5555",
|
||||
zipCode: "12345",
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ export const signupRadioFields = [
|
||||
pricing: [
|
||||
{ type: "monthly", amount: 69 },
|
||||
{ type: "annDiscount", amount: 52 },
|
||||
{ type: "additionalAccount", amount: 0 },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -84,7 +84,6 @@ export const getValidatedFormData = (data, fields) =>
|
||||
}, data);
|
||||
|
||||
export const handleFormDataChange = (e, name, data, fields) => {
|
||||
console.log("fields", fields);
|
||||
if (!fields) {
|
||||
return;
|
||||
}
|
||||
@@ -102,7 +101,6 @@ export const handleFormDataChange = (e, name, data, fields) => {
|
||||
};
|
||||
|
||||
export const isFormDataHasErrors = (data) => {
|
||||
console.log("data", data);
|
||||
return Object.values(data).reduce(
|
||||
(hasErrors, { error }) => hasErrors || error,
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user