Skip to content

Commit

Permalink
Add victimName and victimGender to forms
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaleenaren committed Nov 18, 2023
1 parent c911d9f commit a315c20
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
43 changes: 43 additions & 0 deletions client/src/FormPage/PageTwo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DesktopDatePicker } from '@mui/x-date-pickers/DesktopDatePicker';
import { Theme, useTheme } from '@mui/material/styles';
import IReferral from '../util/types/referral';
import { ChangeEvent } from 'react';
import { genderDropdown } from '../util/dropdown';

function getStyles(val: string, valArr: string[], theme: Theme) {
return {
Expand Down Expand Up @@ -291,6 +292,48 @@ export default function PageTwo({ data, setData }: Props) {
</Select>
</FormControl>

<FormControl required sx={{ m: 1, minWidth: 420 }}>
<TextField
required
value={data?.victimName}
id="outlined-basic"
label="Name of Victim"
variant="outlined"
onChange={(event) =>
setData({
...data,
victimName: event.target.value,
})
}
/>
</FormControl>

<FormControl sx={{ m: 1, minWidth: 420 }} required >
<InputLabel id="demo-simple-select-label" required>
Gender of Victim
</InputLabel>
<Select
required
value={data?.victimGender}
labelId="demo-simple-select-label"
id="demo-simple-select-label"
label="Gender of Victim"
onChange={(event) =>
setData({ ...data, victimGender: event.target.value as string })
}
>
{genderDropdown.map((val) => (
<MenuItem
key={val}
value={val}
style={getStyles(val, genderDropdown, theme)}
>
{val}
</MenuItem>
))}
</Select>
</FormControl>

{homicideFields}

<br />
Expand Down
45 changes: 44 additions & 1 deletion client/src/ReferralView/VictimCrime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { CheckCircleOutline, ErrorOutline } from '@material-ui/icons';
import { green } from '@mui/material/colors';
import { useParams } from 'react-router-dom';
import { putData } from '../util/api';
import { genderDropdown } from '../util/dropdown';

function getStyles(val: string, valArr: string[], theme: Theme) {
return {
Expand Down Expand Up @@ -304,7 +305,7 @@ export default function PageTwo({ referral, setReferral }: Props) {
Police District of Incident
</InputLabel>
<Select
value={data?.crimeDistrict}
value={data?.victimGender}
labelId="demo-simple-select-label"
id="demo-simple-select-label"
label="Police District of Incident"
Expand All @@ -324,6 +325,48 @@ export default function PageTwo({ referral, setReferral }: Props) {
</Select>
</FormControl>

<FormControl required sx={{ m: 1, minWidth: 420 }}>
<TextField
required
value={data?.victimName}
id="outlined-basic"
label="Name of Victim"
variant="outlined"
onChange={(event) =>
setData({
...data,
victimName: event.target.value,
})
}
/>
</FormControl>

<FormControl sx={{ m: 1, minWidth: 420 }} required >
<InputLabel id="demo-simple-select-label" required>
Gender of Victim
</InputLabel>
<Select
required
value={data?.crimeDistrict}
labelId="demo-simple-select-label"
id="demo-simple-select-label"
label="Gender of Victim"
onChange={(event) =>
setData({ ...data, victimGender: event.target.value as string })
}
>
{genderDropdown.map((val) => (
<MenuItem
key={val}
value={val}
style={getStyles(val, genderDropdown, theme)}
>
{val}
</MenuItem>
))}
</Select>
</FormControl>

{homicideFields}

<br />
Expand Down
2 changes: 1 addition & 1 deletion server/src/models/referral.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ interface fileObject {
const addressItemSchema = new mongoose.Schema({
street: {
type: String,
required: true,
required: false,
},
city: {
type: String,
Expand Down

0 comments on commit a315c20

Please sign in to comment.