This commit is contained in:
Kenneth Jannette
2024-01-19 15:56:08 -06:00
parent 0f8a7cd61e
commit b80732725f
4 changed files with 52 additions and 37 deletions

View File

@@ -2,8 +2,6 @@ import { useState } from "react";
import Button from "../../pageElements/Button"; import Button from "../../pageElements/Button";
import Modal from "react-bootstrap/Modal"; import Modal from "react-bootstrap/Modal";
import TextInput from "../../pageElements/TextInput"; import TextInput from "../../pageElements/TextInput";
import { db } from "../../firebase";
import { splitEvery } from "../../Utils/Array"; import { splitEvery } from "../../Utils/Array";
import Col from "react-bootstrap/Col"; import Col from "react-bootstrap/Col";
import Form from "react-bootstrap/Form"; import Form from "react-bootstrap/Form";
@@ -14,6 +12,7 @@ import {
handleFormDataChange, handleFormDataChange,
isFormDataHasErrors, isFormDataHasErrors,
} from "../../Utils/Form"; } from "../../Utils/Form";
import "../../styles/modals.scss";
const PaymentModal = ({ const PaymentModal = ({
onCancel, onCancel,
@@ -29,13 +28,11 @@ const PaymentModal = ({
const fieldsChunkSize = 2; const fieldsChunkSize = 2;
const ModalForm = () => { const ModalForm = () => {
return splitEvery( return splitEvery(Object.keys(paymentfields), fieldsChunkSize).map(
Object.keys(paymentfields).slice(0, -2), (names, j) => (
fieldsChunkSize
).map((names, j) => (
<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"> <Row key={`${name}${i + fieldsChunkSize * j}`} className="mb-3">
{console.log("paymentdata", paymentdata)} {console.log("paymentdata", paymentdata)}
<TextInput <TextInput
name={name} name={name}
@@ -52,10 +49,11 @@ const PaymentModal = ({
values={paymentfields[name].values} values={paymentfields[name].values}
disabled={isBusy} disabled={isBusy}
/> />
</Col> </Row>
))} ))}
</Row> </Row>
)); )
);
}; };
return ( return (
@@ -65,7 +63,7 @@ const PaymentModal = ({
</Modal.Header> </Modal.Header>
<Modal.Body> <Modal.Body>
<span>{modalText}</span> <span>{modalText}</span>
<Form className="signup-form"> <Form className="payment-form">
<ModalForm /> <ModalForm />
</Form> </Form>
</Modal.Body> </Modal.Body>

View File

@@ -110,7 +110,9 @@ const SignupPage = () => {
async function handleStripePaymentAuthorization(paymentDataValues) { async function handleStripePaymentAuthorization(paymentDataValues) {
console.log(paymentDataValues); console.log(paymentDataValues);
// Stripe API calls, etc
} }
const handleSignup = async (e) => { const handleSignup = async (e) => {
e.preventDefault(); e.preventDefault();
const paymentDataValues = validatePaymentData(); const paymentDataValues = validatePaymentData();
@@ -145,12 +147,13 @@ const SignupPage = () => {
*/ */
}; };
const handleProceedToPayent = () => { const handleProceedToPayment = () => {
/*
const dataValues = validateData(); const dataValues = validateData();
if (dataValues === null) { if (dataValues === null) {
return; return;
} }
*/
setShowPaymentModal(true); setShowPaymentModal(true);
}; };
@@ -266,7 +269,7 @@ const SignupPage = () => {
className="primary-button signup-proceed-button" className="primary-button signup-proceed-button"
type="button" type="button"
size="lg" size="lg"
onClick={handleProceedToPayent} onClick={handleProceedToPayment}
disabled={isBusy} disabled={isBusy}
labelText="Proceed to Payment" labelText="Proceed to Payment"
/> />

View File

@@ -1,6 +1,16 @@
export const paymentfields = { export const paymentfields = {
cardFirstName: { required: true, label: "First Name", maxLength: 45 }, cardFirstName: { required: true, label: "Card - First Name", maxLength: 45 },
cardLastName: { required: true, label: "Last Name", maxLength: 45 }, cardLastName: { required: true, label: "Card - Last Name", maxLength: 45 },
cardNumber: { required: true, label: "Firm", minLength: 2, maxLength: 45 }, cardNumber: {
cardSecNumber: { required: true, label: "Firm", minLength: 2, maxLength: 45 }, required: true,
label: "Card Number",
minLength: 16,
maxLength: 16,
},
cardSecNumber: {
required: true,
label: "Card CVV Number",
minLength: 3,
maxLength: 6,
},
}; };

View File

@@ -72,3 +72,7 @@
.create-modal-input { .create-modal-input {
font-weight: 400; font-weight: 400;
} }
.payment-form {
width: 740px;
}