Skip to content

Commit b82a8ff

Browse files
committed
add shelterluv person link
1 parent 4768326 commit b82a8ff

File tree

5 files changed

+41
-21
lines changed

5 files changed

+41
-21
lines changed

src/client/src/pages/DataView360/Search/Search.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ class Search360 extends Component {
186186

187187
return (
188188
<Container>
189+
<Grid container direction={"row"} justify={"center"}>
190+
<Grid item style={{"padding": "1em"}}>
191+
<Typography variant={"h4"}>PAWS Contact Search</Typography>
192+
</Grid>
193+
</Grid>
189194
<SearchBar participant={this.state.participant}
190195
handleParticipantChange={this.onRowClick}
191196
handleSearchChange={this.handleSearchChange}/>

src/client/src/pages/DataView360/Search/components/SearchBar.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,6 @@ class SearchBar extends Component {
8686

8787
return (
8888
<Grid container direction={"column"}>
89-
<Grid container direction={"row"} justify={"center"}>
90-
<Grid item>
91-
<h1>PAWS Contact Search</h1>
92-
</Grid>
93-
</Grid>
9489
<Grid container direction={"row"} justify={"center"}>
9590
<Grid item xs={8}>
9691
<Paper className={classes.paper}>

src/client/src/pages/DataView360/View/View.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Button,
99
Grid,
1010
Backdrop,
11-
CircularProgress
11+
CircularProgress, Box, Typography
1212
} from '@material-ui/core';
1313

1414
import _ from 'lodash';
@@ -20,15 +20,15 @@ import Adoptions from './components/Adoptions';
2020
import {matchPath} from "react-router";
2121

2222

23-
2423
const customStyles = theme => ({
2524
backdrop: {
2625
zIndex: theme.zIndex.drawer + 1,
2726
color: '#fff',
2827
},
2928
stickyContainer: {
3029
position: 'fixed',
31-
paddingTop: 25
30+
paddingTop: 25,
31+
left: '-25em'
3232
}
3333
});
3434

@@ -61,6 +61,7 @@ class View360 extends Component {
6161
participantData: response.result,
6262
isDataBusy: false
6363
});
64+
6465
}
6566

6667
extractVolunteerActivity() {
@@ -95,26 +96,32 @@ class View360 extends Component {
9596
{(_.isEmpty(this.state.participantData) !== true &&
9697
this.state.isDataBusy !== true && (
9798
<Paper elevation={1} style={{"padding": "2em"}}>
98-
<Grid container justify={"center"}>
99+
<Grid container direction={"row"} justify={"center"}>
100+
<Grid item>
101+
<Typography variant={"h4"}>Person 360 View</Typography>
102+
</Grid>
103+
</Grid>
104+
<Grid container direction={"row"} spacing={3}>
99105
<Grid item sm={4}>
100-
<Grid sm={2} className={classes.stickyContainer} container direction="column"
101-
alignItems={"center"}>
106+
<Grid className={classes.stickyContainer} container direction={"column"} alignItems={"center"}>
102107
<Grid item>
103108
<ContactInfo
104109
participant={_.get(this.state, 'participantData.contact_details')}/>
105110
</Grid>
106111
<Grid item style={{"padding": "1em"}}>
107112
<Button elevation={2} variant="contained" color="primary"
108-
onClick={() => {this.onBackClick()}}>Back to Results
113+
onClick={() => {
114+
this.onBackClick()
115+
}}>Back to Results
109116
</Button>
110117
</Grid>
111118
</Grid>
112-
113119
</Grid>
114120
<Grid item sm>
115121
<Grid container direction="column" style={{"marginTop": "1em"}}>
116122
<Donations donations={_.get(this.state, 'participantData.donations')}/>
117-
<Adoptions adoptions={_.get(this.state, 'participantData.adoptions')}/>
123+
<Adoptions adoptions={_.get(this.state, 'participantData.adoptions')}
124+
adoption_person_id={_.get(this.state, 'participantData.adoptions_person_id')}/>
118125
<Volunteer volunteer={this.extractVolunteerActivity()}
119126
volunteerShifts={_.get(this.state, 'participantData.shifts')}/>
120127
</Grid>
@@ -131,4 +138,11 @@ class View360 extends Component {
131138
}
132139
}
133140

134-
export default withRouter(withStyles(customStyles)(View360));
141+
export default withRouter(withStyles
142+
143+
(
144+
customStyles
145+
)(
146+
View360
147+
))
148+
;

src/client/src/pages/DataView360/View/components/Adoptions.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Adoptions extends Component {
5252
const {classes} = this.props;
5353
const numOfPets = _.size(this.props.adoptions);
5454
const latestPets = this.getLatestPets(this.props.adoptions);
55+
const shelterLuvPersonURL = `https://www.shelterluv.com/phlp-p-${this.props.adoption_person_id}`
5556

5657
return (<Container component={Paper} style={{"marginTop": "1em"}}>
5758
<Typography variant='h5'>
@@ -62,11 +63,15 @@ class Adoptions extends Component {
6263
<Grid item>
6364
Adoption/Foster Records {(numOfPets > 3) && "(Showing 3 Pets out of " + numOfPets + ")"}
6465
</Grid>
65-
<Grid item>
66-
<IconButton style={{'padding': 0, 'paddingLeft': 5}} color="primary" aria-label="link" component="span">
67-
<LinkIcon />
68-
</IconButton>
69-
</Grid>
66+
{
67+
this.props.adoption_person_id &&
68+
<Grid item>
69+
<IconButton style={{'padding': 0, 'paddingLeft': 5}} color="primary" aria-label="link" href={shelterLuvPersonURL}>
70+
<LinkIcon />
71+
</IconButton>
72+
</Grid>
73+
}
74+
7075
</Grid>
7176
</Typography>
7277

src/server/api/common_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def get_360(matching_id):
7878

7979
result['shifts'] = volgisticsshifts_results
8080

81+
8182
if row["source_type"] == "shelterluvpeople":
8283
adoptions = []
8384
person = requests.get("http://shelterluv.com/api/v1/people/{}".format(row["source_id"]),
@@ -94,5 +95,5 @@ def get_360(matching_id):
9495
adoptions.append(animal_details_json)
9596

9697
result['adoptions'] = adoptions
97-
98+
result['adoptions_person_id'] = person_json["ID"]
9899
return jsonify({'result': result})

0 commit comments

Comments
 (0)