Skip to content

Commit

Permalink
Merge pull request #15 from hack4impact-upenn/program-outcomes-form-p…
Browse files Browse the repository at this point in the history
…olish

Program outcomes form polish
  • Loading branch information
roshanbellary authored Dec 2, 2024
2 parents 274ee45 + 99b945a commit 732f926
Show file tree
Hide file tree
Showing 16 changed files with 1,106 additions and 239 deletions.
145 changes: 145 additions & 0 deletions client/src/AddOrganization/AddOrganization.tsx
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>
);
}
19 changes: 18 additions & 1 deletion client/src/AdminDashboard/OrgAdminPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Typography, Grid } from '@mui/material';
import { Typography, Grid, Button } from '@mui/material';
import { useNavigate } from 'react-router-dom';
import ScreenGrid from '../components/ScreenGrid.tsx';
import OrgTable from './OrgTable.tsx';
import InviteUserButton from '../components/buttons/InviteUserButton.tsx';
Expand All @@ -9,6 +10,7 @@ import InviteUserButton from '../components/buttons/InviteUserButton.tsx';
* Admin to delete users from admin and promote users to admin.
*/
function OrgAdminPage() {
const navigate = useNavigate();
return (
<ScreenGrid>
<Grid item>
Expand All @@ -21,6 +23,21 @@ function OrgAdminPage() {
<OrgTable />
</div>
</Grid>
<Grid item>
<Button
fullWidth
variant="contained"
onClick={() => {
navigate('/organizations-add');
}}
style={{
backgroundColor: 'black',
color: 'white',
}}
>
Add Organization
</Button>
</Grid>
</ScreenGrid>
);
}
Expand Down
28 changes: 17 additions & 11 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ import ResetPasswordPage from './Authentication/ResetPasswordPage.tsx';
import AlertPopup from './components/AlertPopup.tsx';
import InviteRegisterPage from './Authentication/InviteRegisterPage.tsx';
import SignUpPage from './SignUp/SignUpPage.tsx';
import KitchenOutcome from './components/forms/KitchenOutcome.tsx';
import KitchenOutcomeViz from './components/KitchenOutcomeViz.tsx';
import ProgramOutcome from './components/forms/ProgramOutcome.tsx';
import KitchenOutcome from './SubmissionForms/KitchenOutcome.tsx';
import KitchenOutcomeViz from './Visualizations/KitchenOutcomeViz.tsx';
import ProgramOutcome from './SubmissionForms/ProgramOutcome.tsx';
import OrgAdminPage from './AdminDashboard/OrgAdminPage.tsx';
import ProgramOutcomesVisualization from './components/ProgramOutcomesViz';
import ProgramOutcomesVisualization from './Visualizations/ProgramOutcomesViz.tsx';
import SubmissionsHome from './Intermediate/Submissions.tsx';
import VisualizationHome from './Intermediate/Visualizations.tsx';
import AddOrganization from './AddOrganization/AddOrganization.tsx';

// Router Configuration
const router = createBrowserRouter([
Expand All @@ -40,12 +43,6 @@ const router = createBrowserRouter([
element: <UnauthenticatedRoutesWrapper />, // Wrapper for unauthenticated routes
children: [
{ path: 'signup', element: <SignUpPage /> },
{ path: 'kitchen-outcome-viz-test', element: <KitchenOutcomeViz /> },
{
path: 'program-outcomes-viz-test',
element: <ProgramOutcomesVisualization />,
},
{ path: 'program-outcome-test', element: <ProgramOutcome /> },
{ path: 'login', element: <LoginPage /> },
{ path: 'verify-account/:token', element: <VerifyAccountPage /> },
{ path: 'email-reset', element: <EmailResetPasswordPage /> },
Expand All @@ -57,7 +54,15 @@ const router = createBrowserRouter([
element: <ProtectedRoutesWrapper />, // Wrapper for authenticated routes
children: [
{ path: 'home', element: <HomePage /> },
{ path: 'kitchen-outcome-test', element: <KitchenOutcome /> },
{ path: 'kitchen-outcomes', element: <KitchenOutcome /> },
{ path: 'program-outcomes', element: <ProgramOutcome /> },
{ path: 'outcome-form', element: <SubmissionsHome /> },
{ path: 'outcome-viz', element: <VisualizationHome /> },
{ path: 'kitchen-outcomes-viz', element: <KitchenOutcomeViz /> },
{
path: 'program-outcomes-viz',
element: <ProgramOutcomesVisualization />,
},
],
},
{
Expand All @@ -66,6 +71,7 @@ const router = createBrowserRouter([
children: [
{ path: 'users', element: <AdminDashboardPage /> },
{ path: 'organizations', element: <OrgAdminPage /> },
{ path: 'organizations-add', element: <AddOrganization /> },
],
},
{
Expand Down
82 changes: 82 additions & 0 deletions client/src/Intermediate/Submissions.tsx
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>
);
}
Loading

0 comments on commit 732f926

Please sign in to comment.