diff --git a/src/client/actions/ParticipantActions.js b/src/client/actions/ParticipantActions.js
index 3efae9e9..2935ce15 100644
--- a/src/client/actions/ParticipantActions.js
+++ b/src/client/actions/ParticipantActions.js
@@ -3,7 +3,7 @@ export function getParticipantActions(alt, participantResource) {
fetchParticipantById(participantId) {
return dispatch => {
dispatch();
- participantResource.findById(participantId, `filter=${JSON.stringify({ include: { presenceHistory: 'author' } })}` )
+ participantResource.findById(participantId, `filter=${JSON.stringify({ include: [ { presenceHistory: 'author' }, 'allergies' ] })}` )
.then(participant => this.updateParticipantById(participant))
.catch(err => this.loadingParticipantByIdFailed(err));
};
diff --git a/src/client/components/ParticipantDetailsPage/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage/ParticipantDetailsPage.jsx
index eb48ea39..1d646bea 100644
--- a/src/client/components/ParticipantDetailsPage/ParticipantDetailsPage.jsx
+++ b/src/client/components/ParticipantDetailsPage/ParticipantDetailsPage.jsx
@@ -1,5 +1,7 @@
import React from 'react';
-import { Grid, Row, Col, Panel, Button } from 'react-bootstrap';
+import _ from 'lodash';
+import moment from 'moment';
+import { Row, Col, Panel, Button } from 'react-bootstrap';
import { Presence } from '../../components';
import { PresenceHistory } from '../../components';
import { PropertyTextArea } from '../../components';
@@ -55,60 +57,133 @@ export function getParticipantDetailsPage(participantStore, participantActions)
}
render() {
- let participantName = '';
- let nonScout = '';
- let dateOfBirth = '';
- let participantPhone = '';
- let homeCity = '';
- let email = '';
- let presence = '';
- let presenceHistory = '';
-
if (this.state.participantDetails) {
- participantName = `${this.state.participantDetails.firstName} ${this.state.participantDetails.lastName}`;
- nonScout = this.state.participantDetails.nonScout ? 'EVP' : 'Partiolainen';
- const dateOfBirthString = this.state.participantDetails.dateOfBirth;
- const [year, month, time] = dateOfBirthString && dateOfBirthString.split('-') || ['','',''];
- const day = time.substring(0,2);
- dateOfBirth = dateOfBirthString && `${day}.${month}.${year}`;
- presence = this.state.participantDetails.presence;
- presenceHistory = this.state.participantDetails.presenceHistory || [];
-
- participantPhone = this.state.participantDetails.phoneNumber || '-';
- homeCity = this.state.participantDetails.homeCity || '-';
- email = this.state.participantDetails.email || '-';
- }
-
- return (
-
-
+ const {
+ firstName,
+ lastName,
+ dateOfBirth,
+ nonScout,
+ billedDate,
+ paidDate,
+ memberNumber,
+ homeCity,
+ email,
+ phoneNumber,
+ ageGroup,
+ localGroup,
+ subCamp,
+ campGroup,
+ village,
+ internationalGuest,
+ staffPosition,
+ staffPositionInGenerator,
+ swimmingSkill,
+ willOfTheWisp,
+ willOfTheWispWave,
+ guardianOne,
+ guardianTwo,
+ diet,
+ familyCampProgramInfo,
+ childNaps,
+ allergies,
+ } = this.state.participantDetails;
+
+ const participantName = `${firstName} ${lastName}`;
+ const participantStatus = internationalGuest ? 'KV-osallistuja' : ( nonScout ? 'EVP' : `Partiolainen (jäsennumero: ${memberNumber})` );
+
+ const formattedBilledDate = billedDate ? moment(billedDate).format('D.M.YYYY') : '–';
+ const formattedPaidDate = paidDate ? moment(paidDate).format('D.M.YYYY') : '–';
+
+ const presence = this.state.participantDetails.presence;
+ const presenceHistory = this.state.participantDetails.presenceHistory || [];
+
+ const allergyNames = _.map(allergies, row => row.name);
+
+ const familyCampDetails = (program, naps) =>
+
+
+ { program ? - Ohjelma
: '' }
+ { program ? - { program }
: '' }
+ { naps ? - Päiväunet
: '' }
+ { naps ? - { naps }
: '' }
+
+ ;
+
+ return (
+
- { participantName }
- { nonScout }
- Syntymäaika: { dateOfBirth }
+
+ { participantName }
+ (synt. { moment(dateOfBirth).format('D.M.YYYY') })
+
+ { participantStatus }
- Puhelin
- { participantPhone }
- Kotikaupunki
- { homeCity }
- Sähköposti
- { email }
+
+ - Puhelin
+ - { phoneNumber }
+ - Sähköposti
+ - { email }
+ { guardianOne || guardianTwo ? - Huoltajat
: '' }
+ { guardianOne ? - { guardianOne }
: '' }
+ { guardianTwo ? - { guardianTwo }
: '' }
+ { homeCity ? - Kotikunta
: '' }
+ { homeCity ? - { homeCity }
: '' }
+
+
+ { familyCampProgramInfo || childNaps ? familyCampDetails(familyCampProgramInfo, childNaps) : '' }
+
+ { staffPosition || staffPositionInGenerator ? '' : Ei pestiä
}
+
+ { staffPosition ? - Pesti
: '' }
+ { staffPosition ? - { staffPosition }
: '' }
+ { staffPositionInGenerator ? - Pestitieto kehittimestä
: '' }
+ { staffPositionInGenerator ? - { staffPositionInGenerator }
: '' }
+
+
+
+
+ - Ikäkausi
+ - { ageGroup }
+ { swimmingSkill ? - Uimataito
: '' }
+ { swimmingSkill ? - { swimmingSkill }
: '' }
+ - Lippukunta
+ - { localGroup }
+ - Leirilippukunta
+ - { campGroup }
+ - Kylä
+ - { village }
+ - Alaleiri
+ - { subCamp }
+ { willOfTheWisp ? - Virvatuli
: '' }
+ { willOfTheWisp ? - { willOfTheWisp }
: '' }
+ { willOfTheWispWave ? - Virvatuliaalto
: '' }
+ { willOfTheWispWave ? - { willOfTheWispWave }
: '' }
+
+
+
+
+ - Laskutettu
+ - { formattedBilledDate }
+ - Maksettu
+ - { formattedPaidDate }
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+ { allergyNames || diet ? '' : Ei allergioita
}
+ { allergyNames ? { allergyNames.join(', ') }
: '' }
+ { diet ? { diet }
: '' }
+
-
-
- );
+
+ );
+ } else {
+ return (
+
+ );
+ }
}
}
diff --git a/src/client/styles.scss b/src/client/styles.scss
index f5659fae..9e7e4cf7 100644
--- a/src/client/styles.scss
+++ b/src/client/styles.scss
@@ -312,8 +312,25 @@ table .presence {
* ParticipantDetailsPage
*/
+h4.margin-bottom {
+ margin-bottom: 2em;
+}
+
textarea.form-control {
- margin-bottom: 15px;
+ margin-bottom: 1em;
+}
+
+dl {
+ margin: -1em 0 0;
+
+ dt {
+ font-weight: 400;
+ margin-top: 1em;
+ }
+
+ dd {
+ @extend .text-muted;
+ }
}
@media screen and (max-width: $screen-sm) {