forked from hack4impact-upenn/boilerplate-s2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from hack4impact-upenn/program-outcomes-form-p…
…olish Program outcomes form polish
- Loading branch information
Showing
16 changed files
with
1,106 additions
and
239 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import React, { useState } from 'react'; | ||
import { | ||
TextField, | ||
Button, | ||
FormControl, | ||
InputLabel, | ||
Select, | ||
MenuItem, | ||
Grid, | ||
Typography, | ||
} from '@mui/material'; | ||
import { textAlign } from '@mui/system'; | ||
import { postData } from '../util/api'; | ||
|
||
export default function AddOrganization() { | ||
type FormState = { | ||
organizationName: string; | ||
status: string; | ||
street: string; | ||
city: string; | ||
state: string; | ||
zip: string; | ||
}; | ||
|
||
const defaultState: FormState = { | ||
organizationName: '', | ||
status: 'Member', | ||
street: '', | ||
city: '', | ||
state: '', | ||
zip: '', | ||
}; | ||
|
||
const [newOrg, setNewOrg] = useState<FormState>(defaultState); | ||
const validateInputs = () => { | ||
return ( | ||
newOrg.state.length > 0 && | ||
newOrg.city.length > 0 && | ||
newOrg.zip.length === 5 && | ||
newOrg.organizationName.length > 0 | ||
); | ||
}; | ||
const handleSubmit = async () => { | ||
if (validateInputs()) { | ||
try { | ||
console.log(newOrg); | ||
const response = await postData('organization/new', newOrg); | ||
console.log('Organization Submitted Successfully: ', response); | ||
setNewOrg(defaultState); | ||
} catch (error) { | ||
console.error('Error submitting program outcome:', error); | ||
} | ||
} | ||
}; | ||
|
||
return ( | ||
<div style={{ maxWidth: '600px', margin: '0 auto' }}> | ||
<Grid | ||
container | ||
spacing={2} | ||
alignItems="center" | ||
justifyContent="center" | ||
style={{ marginTop: '20px' }} | ||
> | ||
<Grid item xs={12}> | ||
<h1 style={{ textAlign: 'center' }}>Add New Organization</h1> | ||
</Grid> | ||
|
||
<Grid item xs={12} sm={6}> | ||
<TextField | ||
fullWidth | ||
label="Organization Name" | ||
name="organizationName" | ||
value={newOrg.organizationName} | ||
onChange={(e) => { | ||
setNewOrg({ ...newOrg, organizationName: e.target.value }); | ||
}} | ||
/> | ||
</Grid> | ||
|
||
<Grid item xs={12} sm={6}> | ||
<TextField | ||
fullWidth | ||
label="Street" | ||
name="street" | ||
value={newOrg.street} | ||
onChange={(e) => { | ||
setNewOrg({ ...newOrg, street: e.target.value }); | ||
}} | ||
/> | ||
</Grid> | ||
|
||
<Grid item xs={12} sm={6}> | ||
<TextField | ||
fullWidth | ||
label="City" | ||
name="city" | ||
value={newOrg.city} | ||
onChange={(e) => { | ||
setNewOrg({ ...newOrg, city: e.target.value }); | ||
}} | ||
/> | ||
</Grid> | ||
|
||
<Grid item xs={12} sm={6}> | ||
<TextField | ||
fullWidth | ||
label="State" | ||
name="state" | ||
value={newOrg.state} | ||
onChange={(e) => { | ||
setNewOrg({ ...newOrg, state: e.target.value }); | ||
}} | ||
/> | ||
</Grid> | ||
|
||
<Grid item xs={12} sm={6}> | ||
<TextField | ||
fullWidth | ||
label="ZIP Code" | ||
name="zip" | ||
value={newOrg.zip} | ||
onChange={(e) => { | ||
setNewOrg({ ...newOrg, zip: e.target.value }); | ||
}} | ||
/> | ||
</Grid> | ||
|
||
<Grid item xs={12}> | ||
<Button | ||
fullWidth | ||
variant="contained" | ||
onClick={handleSubmit} | ||
style={{ | ||
backgroundColor: 'black', | ||
color: 'white', | ||
}} | ||
> | ||
Submit | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import { | ||
Button, | ||
Link, | ||
Card, | ||
CardContent, | ||
Typography, | ||
Grid, | ||
Box, | ||
} from '@mui/material'; | ||
|
||
export default function VisualizationHome() { | ||
return ( | ||
<Box | ||
sx={{ | ||
minHeight: '100vh', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: 'white', | ||
}} | ||
> | ||
<Grid container spacing={4} justifyContent="center"> | ||
{/* Card for Submit Kitchen Data */} | ||
<Grid item> | ||
<Card sx={{ maxWidth: 300, boxShadow: 3 }}> | ||
<CardContent> | ||
<Typography variant="h5" component="div" gutterBottom> | ||
Submit Kitchen Data | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary" paragraph> | ||
Submit data for kitchen outcomes to aid in performance tracking | ||
and recordkeeping | ||
</Typography> | ||
<Link href="/kitchen-outcomes" underline="none"> | ||
<Button | ||
fullWidth | ||
variant="contained" | ||
sx={{ | ||
backgroundColor: 'black', | ||
color: 'white', | ||
marginTop: '50px', | ||
}} | ||
> | ||
Kitchen Outcomes Form | ||
</Button> | ||
</Link> | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
|
||
{/* Card for Program Outcomes Form */} | ||
<Grid item> | ||
<Card sx={{ maxWidth: 300, boxShadow: 3 }}> | ||
<CardContent> | ||
<Typography variant="h5" component="div" gutterBottom> | ||
Submit Program Data | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary" paragraph> | ||
Submit data for program outcomes to aid in performance tracking | ||
and recordkeeping | ||
</Typography> | ||
<Link href="/program-outcomes" underline="none"> | ||
<Button | ||
fullWidth | ||
variant="contained" | ||
sx={{ | ||
backgroundColor: 'black', | ||
color: 'white', | ||
marginTop: '50px', | ||
}} | ||
> | ||
Program Outcomes Form | ||
</Button> | ||
</Link> | ||
</CardContent> | ||
</Card> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
); | ||
} |
Oops, something went wrong.