Skip to content

Commit

Permalink
Merge pull request #156 from partio-scout/feature/show-familycamp-det…
Browse files Browse the repository at this point in the history
…ails

Feature/show familycamp details
  • Loading branch information
googol authored Jul 20, 2016
2 parents bc6c3c2 + decf8c1 commit 3664281
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client/actions/ParticipantActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function getParticipantActions(alt, participantResource, errorActions) {
fetchParticipantById(participantId) {
return dispatch => {
dispatch();
participantResource.findById(participantId, `filter=${JSON.stringify({ include: [ { presenceHistory: 'author' }, 'allergies', 'dates' ] })}` )
participantResource.findById(participantId, `filter=${JSON.stringify({ include: [ { presenceHistory: 'author' }, 'allergies', 'dates', 'selections' ] })}` )
.then(participant => this.updateParticipantById(participant))
.catch(err =>errorActions.error(err, 'Osallistujan tietojen lataaminen epäonnistui'));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export function getParticipantDetailsPage(participantStore, participantActions)
childNaps,
dates,
allergies,
selections,
} = this.state.participantDetails;

const participantName = `${firstName} ${lastName}`;
Expand All @@ -104,6 +105,13 @@ export function getParticipantDetailsPage(participantStore, participantActions)

const allergyNames = _.map(allergies, row => row.name);

const familyCampSelections = _.groupBy(selections, row => row.kuksaGroupId);

const renderedFamilyCampSelections = _.map(familyCampSelections, selection => {
const rows = _.map(selection, row => <dd>{ row.selectionName }</dd>);
return <dl className="margin-top-0"><dt>{ _.head(selection).groupName }</dt>{ rows }</dl>;
});

return (
<div>
<Row>
Expand Down Expand Up @@ -177,6 +185,7 @@ export function getParticipantDetailsPage(participantStore, participantActions)
<dt>Päiväunet</dt>
<dd>{ childNaps || '–' }</dd>
</dl>
{ renderedFamilyCampSelections }
</Panel>
</Col>
<Col md={ 9 }>
Expand Down
4 changes: 4 additions & 0 deletions src/client/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ textarea.form-control {

dl {
margin: -1em 0 0;

&.margin-top-0 {
margin-top: 0;
}

dt {
font-weight: 400;
Expand Down

0 comments on commit 3664281

Please sign in to comment.