Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

displaying incoming donations for the organization side #25

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 90 additions & 3 deletions src/components/Alerts/OrganizationAlerts.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,95 @@
import {
Box,
Typography,
Card,
CardContent,
List,
ListItem,
ListItemText,
} from '@mui/material';
import dayjs from 'dayjs';

import { useUser } from '@/hooks';

const OrganizationAlerts = () => {
const { events } = useUser();

return (
<div>
<h1>Organization Alerts</h1>
</div>
<Box sx={{ padding: 3 }}>
<Typography
variant='h4'
sx={{ fontWeight: 'bold', mb: 3 }}
>
Incoming Donations
</Typography>
{events.length > 0 ? (
events.map((event) => (
<Card
key={event.eventId}
sx={{
mb: 3,
border: '1px solid',
borderColor: 'divider',
borderRadius: 2,
boxShadow: 1,
}}
>
<CardContent>
<Typography
variant='body2'
sx={{ mb: 1 }}
>
<strong>Donor:</strong>{' '}
{event.title.split('from')[1].trim() || 'Loading...'}{' '}
{/* Display donor name */}
</Typography>
<Typography
variant='body2'
sx={{ mb: 1 }}
>
<strong>Description:</strong> {event.description}
</Typography>
<Typography
variant='body2'
sx={{ mb: 1 }}
>
<strong>Drop Off Date & Time:</strong>{' '}
{dayjs(event.date).format('MMMM D, YYYY, h:mm A')}
</Typography>
<Typography
variant='body2'
sx={{ mb: 2 }}
>
<strong>Supplies:</strong>
</Typography>
<List>
{event.supplies.map((supply, index) => (
<ListItem
key={index}
sx={{ py: 0 }}
>
<ListItemText
primary={`${supply.itemName} - ${supply.quantityProvided} provided`}
primaryTypographyProps={{
variant: 'body2',
}}
/>
</ListItem>
))}
</List>
</CardContent>
</Card>
))
) : (
<Typography
variant='body1'
color='text.secondary'
textAlign='center'
>
No incoming donations at the moment.
</Typography>
)}
</Box>
);
};

Expand Down
Loading