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

Remove broken parts of 360 #611

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
48 changes: 28 additions & 20 deletions src/client/src/pages/DataView360/View/components/Adoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TableBody,
TableRow,
TableCell,
Container
Container,
} from '@material-ui/core';
import LinkIcon from '@material-ui/icons/Link';
import { withStyles } from '@material-ui/core/styles';
Expand All @@ -18,6 +18,7 @@ import Grid from "@material-ui/core/Grid";
import PetsIcon from "@material-ui/icons/Pets";
import DataTableHeader from './DataTableHeader';
import { showAnimalAge } from '../../../../utils/utils'
import NoRecords from './NoRecords';


const customStyles = theme => ({
Expand Down Expand Up @@ -89,27 +90,34 @@ class Adoptions extends Component {
headerText={headerText + headerAddition}
emojiIcon={<PetsIcon color='primary' fontSize='inherit' />}
>
<Grid item>
<IconButton style={{ 'padding': 0, 'paddingLeft': 5 }} color="primary" aria-label="link" href={shelterLuvPersonURL} target="_blank">
<LinkIcon />
</IconButton>
</Grid>
{shelterluvShortId &&
<Grid item>
<IconButton style={{ 'padding': 0, 'paddingLeft': 5 }} color="primary" aria-label="link" href={shelterLuvPersonURL} target="_blank">
<LinkIcon />
</IconButton>
</Grid>
}
Comment on lines +93 to +99
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a link to shelterluv that just gives a 404 if the ID doesn't exist. I figured we didn't want to send people there.

</DataTableHeader>
<TableContainer component={Paper} variant='outlined' style={{ "marginBottom": "1em" }}>
<Table>
<TableHead>
<TableRow>
<TableCell align="center">Name</TableCell>
<TableCell align="center">Animal Type</TableCell>
<TableCell align="center">Adoption Date</TableCell>
<TableCell align="center">Age</TableCell>
<TableCell align="center">Photo</TableCell>
</TableRow>
</TableHead>
<TableBody>
{latestPets && this.createRows(latestPets)}
</TableBody>
</Table>
{latestPets?.length > 0 ? (
<Table>
<TableHead>
<TableRow>
<TableCell align="center">Name</TableCell>
<TableCell align="center">Animal Type</TableCell>
<TableCell align="center">Adoption Date</TableCell>
<TableCell align="center">Age</TableCell>
<TableCell align="center">Photo</TableCell>
</TableRow>
</TableHead>
<TableBody>
{latestPets && this.createRows(latestPets)}
</TableBody>
</Table>
)
: (
<NoRecords recordType="adoption" />
)}
</TableContainer>
</Container>
);
Expand Down
78 changes: 50 additions & 28 deletions src/client/src/pages/DataView360/View/components/ContactInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,58 +43,80 @@ class ContactInfo extends Component {
render() {
let participantArray = _.get(this.props, "participant");
let participantData = this.populate_participant_data(participantArray);
let {
first_name: firstName,
last_name: lastName,
mobile,
email,
city,
state,
zip,
street_and_number: streetAndNumber,
} = participantData

return (
<Paper elevation={2} style={{padding: '2em'}}>
<Grid container direction={'column'} spacing={1}>
<Grid item>
<Box display="flex" justifyContent="center">
<Typography
variant={'h6'}>{participantData.first_name + ' ' + participantData.last_name}
variant={'h6'}>{firstName + ' ' + lastName}
</Typography>
</Box>
<Box pb={2}>
<Divider/>
</Box>
</Grid>
<Grid container item direction={'row'} spacing={1} alignItems="center">
<Grid item>
<PhoneIcon color='primary' fontSize='small'/>
</Grid>
<Grid item>
<Typography variant={'body2'}>{formatPhoneNumber(participantData.mobile)}
</Typography>
</Grid>
</Grid>
<Grid container item direction={'row'} spacing={1} alignItems="center">
<Grid item>
<MailOutlineIcon color='primary' fontSize='small'/>
</Grid>
<Grid item>
<Typography variant={'body2'}>
{participantData.email}
</Typography>
</Grid>
</Grid>
<Grid container item direction={'column'} alignItems="flex-start">
<Grid container item direction="row" alignItems="center" spacing={1}>
{mobile && (
<Grid container item direction={'row'} spacing={1} alignItems="center">
<Grid item>
<HomeIcon color='primary' fontSize='small'/>
<PhoneIcon color='primary' fontSize='small'/>
Comment on lines -82 to +73
Copy link
Collaborator Author

@carrollsa carrollsa Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff is a little misleading here with how it rearranged things. I didn't change the icons. I only messed with whether things render or not depending on what data we have available for the contact.

</Grid>
<Grid item>
<Typography variant={'body2'}>
{participantData.street_and_number}
<Typography variant={'body2'}>{formatPhoneNumber(mobile)}
</Typography>
</Grid>
</Grid>
<Grid container item direction="row" spacing={1} style={{paddingLeft: 37}}>
)}
{email && (
<Grid container item direction={'row'} spacing={1} alignItems="center">
<Grid item>
<MailOutlineIcon color='primary' fontSize='small'/>
</Grid>
<Grid item>
<Typography variant={'body2'}>
{participantData.city + ', ' + participantData.state + ' ' + participantData.zip}
{email}
</Typography>
</Grid>
</Grid>
</Grid>
)}
{(city || state || zip || streetAndNumber) && (
<Grid container item direction={'column'} alignItems="flex-start">
{streetAndNumber && (
<Grid container item direction="row" alignItems="center" spacing={1}>
<Grid item>
<HomeIcon color='primary' fontSize='small'/>
</Grid>
<Grid item>
<Typography variant={'body2'}>
{streetAndNumber}
</Typography>
</Grid>
</Grid>
)}
<Grid container item direction="row" spacing={1} style={{paddingLeft: 37}}>
<Grid item>
<Typography variant={'body2'}>
{`
${city ? city + ", " : ""}
${state ? state + " " : ""}
${zip ? zip : ""}
`}
</Typography>
</Grid>
</Grid>
</Grid>
)}
</Grid>

</Paper>
Expand Down
33 changes: 20 additions & 13 deletions src/client/src/pages/DataView360/View/components/Donations.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import _ from 'lodash';
import moment from 'moment-timezone';
import AttachMoneyIcon from '@material-ui/icons/AttachMoney';
import DataTableHeader from "./DataTableHeader";
import NoRecords from './NoRecords';

const ROWS_TO_SHOW = 3

Expand Down Expand Up @@ -52,19 +53,25 @@ class Donations extends Component {
/>

<TableContainer component={Paper} variant='outlined' style={{"marginBottom": "1em"}}>
<Table>
<TableHead>
<TableRow>
<TableCell>Date of Donation</TableCell>
<TableCell>Amount</TableCell>
<TableCell>Donation Type</TableCell>
<TableCell>Primary Campaign Source</TableCell>
</TableRow>
</TableHead>
<TableBody>
{this.props.donations && this.createRows(this.props.donations)}
</TableBody>
</Table>
{this.props.donations?.length > 0 ? (
<Table>
<TableHead>
<TableRow>
<TableCell>Date of Donation</TableCell>
<TableCell>Amount</TableCell>
<TableCell>Donation Type</TableCell>
<TableCell>Primary Campaign Source</TableCell>
</TableRow>
</TableHead>
<TableBody>
{this.props.donations && this.createRows(this.props.donations)}
</TableBody>
</Table>
)
: (
<NoRecords recordType={"donation"} />
)
}
</TableContainer>
</Container>
);
Expand Down
12 changes: 12 additions & 0 deletions src/client/src/pages/DataView360/View/components/NoRecords.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Container } from "@material-ui/core";
import React from "react"

export default function NoRecords(props) {
const { recordType } = props;

return (
<Container style={{ padding: "16px" }}>
{`No ${recordType} records on file.`}
</Container>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
} from '@material-ui/core';
import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople';
import DataTableHeader from './DataTableHeader';
import _ from 'lodash';
import NoRecords from './NoRecords';


class VolunteerActivity extends Component {
Expand All @@ -23,24 +25,29 @@ class VolunteerActivity extends Component {
emojiIcon={<EmojiPeopleIcon color='primary' fontSize='inherit'/>}
/>
<TableContainer component={Paper} style={{"marginBottom": "1em"}} variant='outlined'>
<Table>
<TableHead>
<TableRow>
<TableCell>Volunteer activity start</TableCell>
<TableCell>Life hours</TableCell>
<TableCell>YTD hours</TableCell>
</TableRow>
</TableHead>
<TableBody>
{ this.props.volunteer && (
<TableRow>
<TableCell>{(this.props.volunteer.start_date) ? this.props.volunteer.start_date : "N/A"}</TableCell>
<TableCell>{(this.props.volunteer.life_hours) ? this.props.volunteer.life_hours.toFixed(2) : 0}</TableCell>
<TableCell>{(this.props.volunteer.ytd_hours) ? this.props.volunteer.ytd_hours.toFixed(2) : 0}</TableCell>
</TableRow>
)}
</TableBody>
</Table>
{!_.isEmpty(this.props.volunteer) ? (
<Table>
<TableHead>
<TableRow>
<TableCell>Volunteer activity start</TableCell>
<TableCell>Life hours</TableCell>
<TableCell>YTD hours</TableCell>
</TableRow>
</TableHead>
<TableBody>
{ this.props.volunteer && (
<TableRow>
<TableCell>{(this.props.volunteer.start_date) ? this.props.volunteer.start_date : "N/A"}</TableCell>
<TableCell>{(this.props.volunteer.life_hours) ? this.props.volunteer.life_hours.toFixed(2) : 0}</TableCell>
<TableCell>{(this.props.volunteer.ytd_hours) ? this.props.volunteer.ytd_hours.toFixed(2) : 0}</TableCell>
</TableRow>
)}
</TableBody>
</Table>
)
: (
<NoRecords recordType="volunteer" />
)}
</TableContainer>
</Container>
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import _ from 'lodash';
import moment from 'moment-timezone';
import TimelineIcon from '@material-ui/icons/Timeline';
import DataTableHeader from './DataTableHeader';
import NoRecords from './NoRecords';


const SHIFTS_TO_SHOW = 3;
Expand Down Expand Up @@ -47,19 +48,24 @@ class VolunteerHistory extends Component {
<DataTableHeader headerText={`Volunteer History (Most Recent ${SHIFTS_TO_SHOW})`}
emojiIcon={<TimelineIcon color='primary' fontSize='inherit'/>}
/>
<TableContainer component={Paper} style={{"marginBottom":"1em"}} variant='outlined'>
<Table>
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Assignment</TableCell>
</TableRow>
</TableHead>
<TableBody>
{ this.props.volunteerShifts && this.createShiftRows(this.props.volunteerShifts) }
</TableBody>
</Table>
</TableContainer>
{!_.isEmpty(this.props.volunteerShifts) ? (
<TableContainer component={Paper} style={{"marginBottom":"1em"}} variant='outlined'>
<Table>
<TableHead>
<TableRow>
<TableCell>Date</TableCell>
<TableCell>Assignment</TableCell>
</TableRow>
</TableHead>
<TableBody>
{ this.props.volunteerShifts && this.createShiftRows(this.props.volunteerShifts) }
</TableBody>
</Table>
</TableContainer>
)
: (
<NoRecords recordType="volunteer" />
)}
</Container>
</React.Fragment>
);
Expand Down