@@ -26,15 +26,20 @@ const PaymentModal = ({
|
|||||||
const monthlySubscriptionPriceToday = selectedPlan[0].pricing[0].amount;
|
const monthlySubscriptionPriceToday = selectedPlan[0].pricing[0].amount;
|
||||||
const annualSubscriptionPriceToday = selectedPlan[0].pricing[1].amount * 12;
|
const annualSubscriptionPriceToday = selectedPlan[0].pricing[1].amount * 12;
|
||||||
|
|
||||||
const additionalAccountsMonthlyPriceToday =
|
const additionalAccountsMonthlyPriceToday = selectedPlan[0].pricing[2].amount
|
||||||
selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd;
|
? selectedPlan[0].pricing[2].amount * numberOfAccountsToAdd
|
||||||
|
: null;
|
||||||
|
|
||||||
const additionalAccountsAnnualPriceToday =
|
const additionalAccountsAnnualPriceToday =
|
||||||
additionalAccountsMonthlyPriceToday * 12;
|
additionalAccountsMonthlyPriceToday * 12;
|
||||||
|
|
||||||
const extraAccountsPrice = isAnnual
|
const extraAccountsPrice = isAnnual
|
||||||
? additionalAccountsAnnualPriceToday
|
? additionalAccountsAnnualPriceToday
|
||||||
: additionalAccountsMonthlyPriceToday;
|
? additionalAccountsAnnualPriceToday
|
||||||
|
: 0
|
||||||
|
: additionalAccountsMonthlyPriceToday
|
||||||
|
? additionalAccountsMonthlyPriceToday
|
||||||
|
: 0;
|
||||||
|
|
||||||
const showAdditionaLAccountsView =
|
const showAdditionaLAccountsView =
|
||||||
(selectedPlan[0]?.value === "partner" && numberOfAccountsToAdd > 0) ||
|
(selectedPlan[0]?.value === "partner" && numberOfAccountsToAdd > 0) ||
|
||||||
@@ -45,6 +50,7 @@ const PaymentModal = ({
|
|||||||
const amountToday = isAnnual
|
const amountToday = isAnnual
|
||||||
? annualSubscriptionPriceToday
|
? annualSubscriptionPriceToday
|
||||||
: monthlySubscriptionPriceToday;
|
: monthlySubscriptionPriceToday;
|
||||||
|
|
||||||
const totalToday = amountToday + extraAccountsPrice;
|
const totalToday = amountToday + extraAccountsPrice;
|
||||||
|
|
||||||
function handleValidateAndPay() {
|
function handleValidateAndPay() {
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const SignupPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const collecRef = collection(db, "incompleteSignups");
|
const collecRef = collection(db, "signupLeads");
|
||||||
await setDoc(doc(collecRef, `${signupId}`), userData);
|
await setDoc(doc(collecRef, `${signupId}`), userData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Error saving new user to db: ${error}`);
|
console.log(`Error saving new user to db: ${error}`);
|
||||||
@@ -216,28 +216,14 @@ const SignupPage = () => {
|
|||||||
if (isBusy) {
|
if (isBusy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const userDataValues = validateUserData();
|
const dataValues = validateUserData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
const userDataValues = {
|
saveLeadData(dataValues);
|
||||||
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);
|
|
||||||
setShowSelectPlan(!showSelectPlan);
|
setShowSelectPlan(!showSelectPlan);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -259,6 +245,9 @@ const SignupPage = () => {
|
|||||||
paymentDataValues,
|
paymentDataValues,
|
||||||
customerDataValues
|
customerDataValues
|
||||||
) {
|
) {
|
||||||
|
console.log(
|
||||||
|
"~~~~~~~~~~~~~~~~~~~~_______-~~~~handleStripeAuthorization fired"
|
||||||
|
);
|
||||||
const additionalAccounts = numberOfAccountsToAdd
|
const additionalAccounts = numberOfAccountsToAdd
|
||||||
? numberOfAccountsToAdd
|
? numberOfAccountsToAdd
|
||||||
: 0;
|
: 0;
|
||||||
@@ -278,7 +267,7 @@ const SignupPage = () => {
|
|||||||
paymentDataValues.cardLastName,
|
paymentDataValues.cardLastName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const type = selectedPlan[0].value ? selectedPlan[0].value : null;
|
||||||
try {
|
try {
|
||||||
let response = await fetch(`${apiUrl}/create-subscription`, {
|
let response = await fetch(`${apiUrl}/create-subscription`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -286,7 +275,7 @@ const SignupPage = () => {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
type: selectedPlan,
|
planType: type,
|
||||||
additionalAccounts: additionalAccounts,
|
additionalAccounts: additionalAccounts,
|
||||||
isAnnual: isAnnual,
|
isAnnual: isAnnual,
|
||||||
customerData: {
|
customerData: {
|
||||||
@@ -323,18 +312,37 @@ const SignupPage = () => {
|
|||||||
|
|
||||||
const handleSignup = async (totalDue) => {
|
const handleSignup = async (totalDue) => {
|
||||||
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
|
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>handleSignup fired");
|
||||||
console.log("totalDue", totalDue);
|
|
||||||
const paymentDataValues = validatePaymentData();
|
const paymentDataValues = validatePaymentData();
|
||||||
if (paymentDataValues === null) {
|
if (paymentDataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dataValues = validateUserData();
|
/* let dataValues = validateUserData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
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);
|
const planType = determinePlan(isAnnual, activeRadioOption);
|
||||||
|
console.log(planType);
|
||||||
setIsBusy(true);
|
setIsBusy(true);
|
||||||
|
|
||||||
if (paymentDataValues && dataValues) {
|
if (paymentDataValues && dataValues) {
|
||||||
@@ -367,6 +375,7 @@ const SignupPage = () => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsBusy(false);
|
setIsBusy(false);
|
||||||
|
console.log("-------->error", error);
|
||||||
setNotice(
|
setNotice(
|
||||||
error.message || "Sorry, something went wrong. Please try again."
|
error.message || "Sorry, something went wrong. Please try again."
|
||||||
);
|
);
|
||||||
@@ -623,4 +632,24 @@ const SignupPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default 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: [
|
pricing: [
|
||||||
{ type: "monthly", amount: 69 },
|
{ type: "monthly", amount: 69 },
|
||||||
{ type: "annDiscount", amount: 52 },
|
{ type: "annDiscount", amount: 52 },
|
||||||
|
{ type: "additionalAccount", amount: 0 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export const getValidatedFormData = (data, fields) =>
|
|||||||
}, data);
|
}, data);
|
||||||
|
|
||||||
export const handleFormDataChange = (e, name, data, fields) => {
|
export const handleFormDataChange = (e, name, data, fields) => {
|
||||||
console.log("fields", fields);
|
|
||||||
if (!fields) {
|
if (!fields) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -102,7 +101,6 @@ export const handleFormDataChange = (e, name, data, fields) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isFormDataHasErrors = (data) => {
|
export const isFormDataHasErrors = (data) => {
|
||||||
console.log("data", data);
|
|
||||||
return Object.values(data).reduce(
|
return Object.values(data).reduce(
|
||||||
(hasErrors, { error }) => hasErrors || error,
|
(hasErrors, { error }) => hasErrors || error,
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user