@@ -31,8 +31,8 @@ const PaymentModal = ({
|
|||||||
(names, j) => (
|
(names, j) => (
|
||||||
<Row key={`row${j}`}>
|
<Row key={`row${j}`}>
|
||||||
{names.map((name, i) => (
|
{names.map((name, i) => (
|
||||||
<Row key={`${name}${i + fieldsChunkSize * j}`} className="mb-3">
|
<Col key={`${name}${i + fieldsChunkSize * j}`} className="mb-3">
|
||||||
{console.log("paymentdata", paymentData)}
|
{console.log("paymentdata, name", paymentData, name)}
|
||||||
<TextInput
|
<TextInput
|
||||||
name={name}
|
name={name}
|
||||||
value={paymentData[name].value}
|
value={paymentData[name].value}
|
||||||
@@ -48,7 +48,7 @@ const PaymentModal = ({
|
|||||||
values={paymentfields[name].values}
|
values={paymentfields[name].values}
|
||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Col>
|
||||||
))}
|
))}
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
@@ -61,7 +61,7 @@ const PaymentModal = ({
|
|||||||
<Modal.Title>Enter Payment Card Information</Modal.Title>
|
<Modal.Title>Enter Payment Card Information</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<span>{modalText}</span>
|
<div className="payment-modal-text-wrapper">{modalText}</div>
|
||||||
<Form className="payment-form">
|
<Form className="payment-form">
|
||||||
<ModalForm />
|
<ModalForm />
|
||||||
</Form>
|
</Form>
|
||||||
@@ -77,7 +77,7 @@ const PaymentModal = ({
|
|||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
className="primary-button"
|
className="primary-button"
|
||||||
onClick={handleSignup}
|
onClick={handleSignup}
|
||||||
labelText={buttonLabelText}
|
labelText="Signup"
|
||||||
/>
|
/>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const SignupPage = () => {
|
|||||||
getFormDataDefaults(paymentfields)
|
getFormDataDefaults(paymentfields)
|
||||||
);
|
);
|
||||||
const [showPaymentModal, setShowPaymentModal] = useState(false);
|
const [showPaymentModal, setShowPaymentModal] = useState(false);
|
||||||
|
const modalText = "Description of monthly and annual subscriptions";
|
||||||
|
|
||||||
const handleChangeInput = (e, name) => {
|
const handleChangeInput = (e, name) => {
|
||||||
const newData = handleFormDataChange(e, name, data, signupfields);
|
const newData = handleFormDataChange(e, name, data, signupfields);
|
||||||
@@ -41,9 +42,15 @@ const SignupPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChangePaymentInput = (e, name) => {
|
const handleChangePaymentInput = (e, name) => {
|
||||||
const newData = handleFormDataChange(e, name, data, paymentfields);
|
console.log("e, name", e, name);
|
||||||
if (newData !== null) {
|
const newPaymentData = handleFormDataChange(
|
||||||
setPaymentData(newData);
|
e,
|
||||||
|
name,
|
||||||
|
paymentData,
|
||||||
|
paymentfields
|
||||||
|
);
|
||||||
|
if (newPaymentData !== null) {
|
||||||
|
setPaymentData(newPaymentData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -106,6 +113,7 @@ const SignupPage = () => {
|
|||||||
|
|
||||||
const handleProceedToPayment = (e) => {
|
const handleProceedToPayment = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
/*
|
||||||
if (isBusy) {
|
if (isBusy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -113,13 +121,14 @@ const SignupPage = () => {
|
|||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
setShowPaymentModal(true);
|
setShowPaymentModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handleStripeAuthorization(paymentDataValues) {
|
async function handleStripeAuthorization(paymentDataValues) {
|
||||||
//Do calls to Stripe API
|
// Do: calls to Stripe API
|
||||||
// if success, return some truthy value or
|
// if success, return some truthy value or
|
||||||
// handleFailure()
|
// handle failure
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSignUp = async (e) => {
|
const handleSignUp = async (e) => {
|
||||||
@@ -167,6 +176,7 @@ const SignupPage = () => {
|
|||||||
<Row key={`row${j}`}>
|
<Row key={`row${j}`}>
|
||||||
{names.map((name, i) => (
|
{names.map((name, i) => (
|
||||||
<Col key={`${name}${i + fieldsChunkSize * j}`} className="mb-3">
|
<Col key={`${name}${i + fieldsChunkSize * j}`} className="mb-3">
|
||||||
|
{console.log("data, name", data, name)}
|
||||||
<TextInput
|
<TextInput
|
||||||
name={name}
|
name={name}
|
||||||
value={data[name].value}
|
value={data[name].value}
|
||||||
@@ -225,7 +235,7 @@ const SignupPage = () => {
|
|||||||
</Form>
|
</Form>
|
||||||
<div className="signup-button-box">
|
<div className="signup-button-box">
|
||||||
<Button
|
<Button
|
||||||
className="primary-button"
|
className="primary-button signup-proceed"
|
||||||
type="button"
|
type="button"
|
||||||
size="lg"
|
size="lg"
|
||||||
onClick={handleProceedToPayment}
|
onClick={handleProceedToPayment}
|
||||||
@@ -234,7 +244,7 @@ const SignupPage = () => {
|
|||||||
/>
|
/>
|
||||||
<div className="mt-3">
|
<div className="mt-3">
|
||||||
<span>
|
<span>
|
||||||
<Link to="/">Return to login</Link>
|
<Link to="/login">Go to login</Link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -255,6 +265,7 @@ const SignupPage = () => {
|
|||||||
setShowPaymentModal={setShowPaymentModal}
|
setShowPaymentModal={setShowPaymentModal}
|
||||||
handleChangePaymentInput={handleChangePaymentInput}
|
handleChangePaymentInput={handleChangePaymentInput}
|
||||||
handleSignUp={handleSignUp}
|
handleSignUp={handleSignUp}
|
||||||
|
modalText={modalText}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
|
|||||||
@@ -1,16 +1,27 @@
|
|||||||
export const paymentfields = {
|
export const paymentfields = {
|
||||||
cardFirstName: { required: true, label: "Card First Name", maxLength: 45 },
|
cardFirstName: {
|
||||||
cardLastName: { required: true, label: "Card Last Name", maxLength: 45 },
|
required: true,
|
||||||
|
label: "Card First Name",
|
||||||
|
maxLength: 45,
|
||||||
|
type: "cardFirstName",
|
||||||
|
},
|
||||||
|
cardLastName: {
|
||||||
|
required: true,
|
||||||
|
label: "Card Last Name",
|
||||||
|
maxLength: 45,
|
||||||
|
type: "cardLastName",
|
||||||
|
},
|
||||||
cardNumber: {
|
cardNumber: {
|
||||||
required: true,
|
required: true,
|
||||||
label: "Card Number",
|
label: "Card Number",
|
||||||
minLength: 16,
|
minLength: 16,
|
||||||
maxLength: 16,
|
maxLength: 16,
|
||||||
|
type: "cardNumber",
|
||||||
},
|
},
|
||||||
cardCvvCode: {
|
cardCvvCode: {
|
||||||
required: true,
|
required: true,
|
||||||
label: "Card CVV Number",
|
label: "Card CVV Number",
|
||||||
maxLength: 5,
|
maxLength: 5,
|
||||||
type: "cvv",
|
type: "cardCvvCode",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,3 +76,8 @@
|
|||||||
.payment-form {
|
.payment-form {
|
||||||
width: 740px;
|
width: 740px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.payment-modal-text-wrapper {
|
||||||
|
margin: 8px 0px 18px 0px;
|
||||||
|
padding-left: 4px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
.signup-btn {
|
|
||||||
width: 150px;
|
.signup-proceed {
|
||||||
|
width: 160px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user