Skip to content

Commit

Permalink
Merge branch 'Development' into issue-525/remove-dob-from-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
leekahung authored Nov 16, 2023
2 parents 43d0a23 + eb887a6 commit c8cf336
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 25 deletions.
168 changes: 168 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.10.0",
"description": "",
"scripts": {
"start": "concurrently --kill-others \"npm run dev\" \"npm run podserver\"",
"dev": "vite --host",
"build": "vite build",
"test": "vitest",
Expand Down Expand Up @@ -65,6 +66,7 @@
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^0.34.6",
"buffer": "^5.7.1",
"concurrently": "^8.2.2",
"css-mediaquery": "^0.1.2",
"eslint": "^8.35.0",
"eslint-config-airbnb": "^19.0.4",
Expand Down
86 changes: 83 additions & 3 deletions src/components/CivicProfileForms/HousingInfo.jsx
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;
11 changes: 10 additions & 1 deletion src/constants/HMIS_ONTOLOGY_VALUES.js
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;
Loading

0 comments on commit c8cf336

Please sign in to comment.