Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added dropdown in gender selection #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions frontend/app/register/driver/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,13 @@ const DriverRegistration = ({ data }) => {

const handleSubmit = (e) => {
e.preventDefault();
// localStorage.setItem('formData', JSON.stringify(formData));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

router.push({
pathname: '/create-ride',
});
};

// const handleSubmit = (e) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep these comments as they were...
dont remove them

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

// e.preventDefault();
// console.log(formData);

// localStorage.setItem('formData', JSON.stringify(formData));
// window.location.href = '/create-ride';
// };

const handleCarChange = (event, newValue) => {
setSelectedCar(newValue);
// const { carName, value } = event.target;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

setFormData({
...formData,
['carName']: newValue.Combined_Name,
Expand Down Expand Up @@ -119,13 +109,17 @@ const DriverRegistration = ({ data }) => {
</div>
<div className={styles.formGroup}>
<label className={styles.label}>Gender:</label>
<input
type="text"
<select
id="gender"
name="gender"
onChange={handleChange}
className={styles.inputField}
/>
>
<option value="">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
<div className={styles.formGroup}>
<label className={styles.label}>Phone:</label>
Expand Down Expand Up @@ -160,13 +154,11 @@ const DriverRegistration = ({ data }) => {
defaultValue={selectedCar.Combined_Name}
onChange={handleCarChange}
renderInput={(params) => <TextField {...params} label="Select Car" variant="outlined" />}
// className={styles.inputField}
sx={{width: '83%'}}
/>

</div>
<div className={styles.formGroup}>

<label className={styles.label} >Car Capacity(Max. Num of Passengers):</label>
<input
type="text"
Expand Down
23 changes: 15 additions & 8 deletions frontend/app/register/passenger/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ const PassengerRegistration = () => {
e.preventDefault();
console.log(formData);
};
return (

return (
<div className={styles.container}>
<h1>Register as Passenger</h1>
<form onSubmit={handleSubmit}>

<fieldset>
<legend>Your details:</legend>

<div className={styles.formGroup}>
<label className={styles.label} >Name:</label>
<label className={styles.label}>Name:</label>
<input
type="text"
id="name"
Expand All @@ -64,14 +63,18 @@ const PassengerRegistration = () => {
</div>
<div className={styles.formGroup}>
<label className={styles.label} htmlFor="gender">Gender:</label>
<input
type="text"
<select
id="gender"
name="gender"
value={formData.gender}
onChange={handleChange}
className={styles.inputField}
/>
>
<option value="">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
<div className={styles.formGroup}>
<label className={styles.label} htmlFor="phone">Phone:</label>
Expand Down Expand Up @@ -107,7 +110,12 @@ const PassengerRegistration = () => {
}}
style={{ marginTop: "auto" }}
>
<button type="submit" className={`${styles.submitButton} ${styles.center__relative}`}>Submit</button>
<button
type="submit"
className={`${styles.submitButton} ${styles.center__relative}`}
>
Submit
</button>
</Link>
</fieldset>
{/* <div className={styles.formGroup}>
Expand Down Expand Up @@ -183,4 +191,3 @@ const PassengerRegistration = () => {
};

export default PassengerRegistration;