-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Development' into issue-525/remove-dob-from-profile
- Loading branch information
Showing
11 changed files
with
393 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,88 @@ | ||
// React Imports | ||
import React from 'react'; | ||
import React, { useState, useEffect } from 'react'; | ||
// MUI Imports | ||
import Typography from '@mui/material/Typography'; | ||
import { TextField, Button } from '@mui/material'; | ||
import { useCivicProfile } from '@hooks'; | ||
|
||
const HousingInfo = () => <Typography>Housing Info</Typography>; | ||
/** | ||
* HousingInfo - A form to fill out with housing security info | ||
* | ||
* @memberof CivicProfileForms | ||
* @name HousingInfo | ||
* @returns {React.JSX.Element} The HousingInfo Component | ||
*/ | ||
const HousingInfo = () => { | ||
const { data, add, isSuccess } = useCivicProfile(); | ||
const [formData, setFormData] = useState({ | ||
lastPermanentStreet: '', | ||
lastPermanentCity: '', | ||
lastPermanentState: '', | ||
lastPermanentZIP: '' | ||
}); | ||
|
||
useEffect(() => { | ||
if (isSuccess) { | ||
setFormData((prevFormData) => ({ ...prevFormData, ...data })); | ||
} | ||
}, [isSuccess, data]); | ||
|
||
const handleChange = (event) => { | ||
const { name, value } = event.target; | ||
setFormData((prevFormData) => ({ ...prevFormData, [name]: value })); | ||
}; | ||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
if (!isSuccess) { | ||
return; | ||
} | ||
add(formData); | ||
}; | ||
|
||
return ( | ||
<form onSubmit={handleSubmit}> | ||
<div | ||
style={{ | ||
padding: '8px', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: '8px', | ||
maxWidth: '360px' | ||
}} | ||
> | ||
<TextField | ||
id="street-input" | ||
name="lastPermanentStreet" | ||
label="Street:" | ||
onChange={handleChange} | ||
value={formData.lastPermanentStreet} | ||
/> | ||
<TextField | ||
id="city-input" | ||
name="lastPermanentCity" | ||
label="City:" | ||
onChange={handleChange} | ||
value={formData.lastPermanentCity} | ||
/> | ||
<TextField | ||
id="state-input" | ||
name="lastPermanentState" | ||
label="State:" | ||
onChange={handleChange} | ||
value={formData.lastPermanentState} | ||
/> | ||
<TextField | ||
id="zip-input" | ||
name="lastPermanentZIP" | ||
label="ZIP Code:" | ||
onChange={handleChange} | ||
value={formData.lastPermanentZIP} | ||
/> | ||
</div> | ||
<Button variant="outlined" disabled={!isSuccess} type="submit" style={{ margin: '8px' }}> | ||
Submit | ||
</Button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default HousingInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
const prefix = 'urn:hud:hmis:owl#'; | ||
|
||
const HMIS_ONTOLOGY_VALUES = { | ||
legalFirstName: 'urn:hud:hmis:owl#FirstName', | ||
legalLastName: 'urn:hud:hmis:owl#LastName', | ||
legalDOB: 'urn:hud:hmis:owl#DOB', | ||
legalGender: 'urn:hud:hmis:owl#Gender' | ||
legalGender: 'urn:hud:hmis:owl#Gender', | ||
lastPermanentCity: `${prefix}LastPermanentCity`, | ||
lastPermanentState: `${prefix}LastPermanentState`, | ||
lastPermanentStreet: `${prefix}LastPermanentStreet`, | ||
lastPermanentZIP: `${prefix}LastPermanentZIP`, | ||
monthsHomeless: `${prefix}MonthsHomelessPast3Years`, | ||
timesHomeless: `${prefix}TimesHomelessPast3Years`, | ||
timeToHousingLoss: `${prefix}TimeToHousingLoss` | ||
}; | ||
|
||
export default HMIS_ONTOLOGY_VALUES; |
Oops, something went wrong.