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

Fix: Form submission #24

Merged
merged 3 commits into from
Oct 13, 2024
Merged
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
98 changes: 49 additions & 49 deletions src/components/JobApplicationDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,48 +108,48 @@ export default function JobApplicationDialog({jobApplication, handleClose, open,
aria-describedby="modal-modal-description"
>
<DialogTitle>{dialogTitle}</DialogTitle>
<DialogContent dividers>
<TextField
required
id="companyName"
name="companyName"
label="Company Name"
fullWidth
autoComplete="given-name"
variant="standard"
onChange={(e) => {
setCompanyName(e.target.value);
}}
defaultValue={jobApplication.companyName}
/>
<form onSubmit={() => isNew?handleAddJobApplication():handleUpdateJobApplication(jobApplication.id)}>
<DialogContent dividers>
<TextField
required
id="companyName"
name="companyName"
label="Company Name"
fullWidth
autoComplete="given-name"
variant="standard"
onChange={(e) => {
setCompanyName(e.target.value);
}}
defaultValue={jobApplication.companyName}
/>

<TextField
required
id="jobTitle"
name="jobTitle"
label="Job Title"
fullWidth
autoComplete="family-name"
variant="standard"
onChange={(e) => {
setJobTitle(e.target.value);
}}
defaultValue={jobApplication.jobTitle}
/>
<TextField
required
id="jobTitle"
name="jobTitle"
label="Job Title"
fullWidth
autoComplete="family-name"
variant="standard"
onChange={(e) => {
setJobTitle(e.target.value);
}}
defaultValue={jobApplication.jobTitle}
/>

<TextField
required
id="salaryRange"
name="salaryRange"
label="Salary Range"
fullWidth
autoComplete="shipping address-level2"
variant="standard"
onChange={(e) => {
setSalaryRange(e.target.value);
}}
defaultValue={jobApplication.salaryRange}
/>
<TextField
id="salaryRange"
Copy link
Owner

Choose a reason for hiding this comment

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

Good call to make salary range not a hard requirement

name="salaryRange"
label="Salary Range"
fullWidth
autoComplete="shipping address-level2"
variant="standard"
onChange={(e) => {
setSalaryRange(e.target.value);
}}
defaultValue={jobApplication.salaryRange}
/>
<DialogContent />

<LocalizationProvider dateAdapter={AdapterDayjs}>
Expand All @@ -161,13 +161,12 @@ export default function JobApplicationDialog({jobApplication, handleClose, open,
value={appliedDate}
onChange={(e) => {
setAppliedDate(dayjs(e).format('YYYY-MM-DD'))
} }
} }
renderInput={(params) => <TextField {...params} />}
/>
/>
</LocalizationProvider>

<TextField
required
id="description"
Copy link
Owner

Choose a reason for hiding this comment

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

similarly, good call

name="description"
label="Description"
Expand All @@ -194,13 +193,13 @@ export default function JobApplicationDialog({jobApplication, handleClose, open,
setJobUrl(e.target.value);
}}
defaultValue={jobApplication.jobUrl}

/>

<DialogContent />
<FormControl sx={{ minWidth: 120 }} variant="standard" size="small">
<InputLabel id="status-label">Status</InputLabel>
<Select
disabled={isNew}
Copy link
Owner

Choose a reason for hiding this comment

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

um....now I see what you meant by setting it default do open. I think this makes over 90% of the use case. I like that.

labelId="status-label"
id="status"
name="status"
Expand All @@ -216,11 +215,12 @@ export default function JobApplicationDialog({jobApplication, handleClose, open,
</Select>
</FormControl>

<DialogActions>
<Button color="info" variant="outlined" startIcon={<CancelIcon />} onClick={handleClose}>Cancel</Button>
<Button color="info" variant="contained" startIcon={<SaveIcon />} onClick={() => isNew?handleAddJobApplication():handleUpdateJobApplication(jobApplication.id)} >Save</Button>
</DialogActions>
</DialogContent>
<DialogActions>
<Button color="info" variant="outlined" startIcon={<CancelIcon />} onClick={handleClose}>Cancel</Button>
<Button color="info" variant="contained" startIcon={<SaveIcon />} type="submit" >Save</Button>
</DialogActions>
</DialogContent>
</form>
</Dialog>
</>
);
Expand Down
Loading
Loading