Compare commits
No commits in common. "4b9e0627be5e62001afdff5b0933805273046ca9" and "059265098573f4c75a526a95c90fe6de904b2c03" have entirely different histories.
4b9e0627be
...
0592650985
4 changed files with 693 additions and 257 deletions
891
package-lock.json
generated
891
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -3,8 +3,8 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"html-react-parser": "^5.2.5",
|
"html-react-parser": "^5.2.5"
|
||||||
"react-imask": "^7.6.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { useState, useRef } from 'react';
|
import { useState, useRef } from 'react';
|
||||||
import { IMaskInput } from 'react-imask';
|
|
||||||
|
|
||||||
const CentsInADollar = 100;
|
const CentsInADollar = 100;
|
||||||
const DefaultTotal = 0;
|
const DefaultTotal = 0;
|
||||||
|
@ -22,11 +21,12 @@ function BandForm({ band }) {
|
||||||
const formData = new FormData(formRef.current);
|
const formData = new FormData(formRef.current);
|
||||||
const ticketQuantities = formData.getAll('ticketQuantity');
|
const ticketQuantities = formData.getAll('ticketQuantity');
|
||||||
|
|
||||||
const total = ticketQuantities.reduce((total, quantity, index) => {
|
|
||||||
return total += (band.ticketTypes[index].cost * quantity);
|
|
||||||
}, 0)
|
|
||||||
|
|
||||||
setTotal(total > 0 ? total : 0)
|
setTotal(
|
||||||
|
ticketQuantities.reduce((total, quantity, index) => {
|
||||||
|
return total += (band.ticketTypes[index].cost * quantity);
|
||||||
|
}, 0)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -50,7 +50,6 @@ function BandForm({ band }) {
|
||||||
id={name}
|
id={name}
|
||||||
type="number"
|
type="number"
|
||||||
step="1"
|
step="1"
|
||||||
min="0"
|
|
||||||
onChange={ticketQuantityChanged}
|
onChange={ticketQuantityChanged}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,14 +66,12 @@ function BandForm({ band }) {
|
||||||
<div className="information">
|
<div className="information">
|
||||||
<div className="form-row">
|
<div className="form-row">
|
||||||
<input
|
<input
|
||||||
required
|
|
||||||
name="first_name"
|
name="first_name"
|
||||||
label="First Name"
|
label="First Name"
|
||||||
placeholder="First Name"
|
placeholder="First Name"
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
required
|
|
||||||
name="last_name"
|
name="last_name"
|
||||||
label="Last Name"
|
label="Last Name"
|
||||||
placeholder="Last Name"
|
placeholder="Last Name"
|
||||||
|
@ -82,8 +79,6 @@ function BandForm({ band }) {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
required
|
|
||||||
{/* TODO: third party library address verification */}
|
|
||||||
name="address"
|
name="address"
|
||||||
label="Address"
|
label="Address"
|
||||||
placeholder="Address"
|
placeholder="Address"
|
||||||
|
@ -93,39 +88,6 @@ function BandForm({ band }) {
|
||||||
|
|
||||||
<fieldset className="payment">
|
<fieldset className="payment">
|
||||||
<legend>Payment Details</legend>
|
<legend>Payment Details</legend>
|
||||||
|
|
||||||
<IMaskInput
|
|
||||||
required
|
|
||||||
mask="0000 0000 0000 0000"
|
|
||||||
{/* TODO: regex pattern */}
|
|
||||||
name="cardNumber"
|
|
||||||
label="Card Number"
|
|
||||||
placeholder="0000 0000 0000 0000"
|
|
||||||
type="text"
|
|
||||||
></IMaskInput>
|
|
||||||
|
|
||||||
<div className="form-row">
|
|
||||||
<IMaskInput
|
|
||||||
required
|
|
||||||
{/* TODO: regex pattern */}
|
|
||||||
mask="00 / 00"
|
|
||||||
pattern="\d*"
|
|
||||||
name="cardExpiration"
|
|
||||||
label="Card Expiration (MM/YY)"
|
|
||||||
placeholder="MM / YY"
|
|
||||||
type="text"
|
|
||||||
></IMaskInput>
|
|
||||||
|
|
||||||
<IMaskInput
|
|
||||||
required
|
|
||||||
{/* TODO: regex pattern */}
|
|
||||||
mask={Number}
|
|
||||||
name="cardCVV"
|
|
||||||
label="Card CVV"
|
|
||||||
placeholder="CVV"
|
|
||||||
type="text"
|
|
||||||
></IMaskInput>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<button type="submit" disabled={formIsPending}>Get Tickets</button>
|
<button type="submit" disabled={formIsPending}>Get Tickets</button>
|
||||||
|
|
|
@ -112,9 +112,5 @@ h4 {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--spacing-md);
|
gap: var(--spacing-md);
|
||||||
|
|
||||||
legend {
|
|
||||||
margin-bottom: var(--spacing-md);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue