From b2325a624c6510a5a2b971c6a6c6fdc0cdc1dbeb Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:20:11 +0300 Subject: [PATCH 1/7] More fields to participantDetailsPage --- .../components/ParticipantDetailsPage.jsx | 152 ++++++++++++------ 1 file changed, 103 insertions(+), 49 deletions(-) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index 29bf02ec..8c0163f6 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import moment from 'moment'; import { Grid, Row, Col, Panel } from 'react-bootstrap'; import { Presence } from '../components'; import { PresenceHistory } from '../components'; @@ -29,61 +30,114 @@ 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 || []; + const { + participantId, + firstName, + lastName, + dateOfBirth, + nonScout, + billedDate, + paidDate, + memberNumber, + homeCity, + email, + phoneNumber, + ageGroup, + localGroup, + subCamp, + campGroup, + village, + dates, + internationalGuest, + staffPosition, + staffPositionInGenerator, + swimmingSkill, + willOfTheWisp, + willOfTheWispWave, + guardianOne, + guardianTwo, + diet, + familyCampProgramInfo, + childNaps, + } = this.state.participantDetails; - participantPhone = this.state.participantDetails.phoneNumber || '-'; - homeCity = this.state.participantDetails.homeCity || '-'; - email = this.state.participantDetails.email || '-'; - } + 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') : '–'; - return ( -
- - - -

{ participantName }

-

{ nonScout }

-

Syntymäaika: { dateOfBirth }

- -
- - - -

Puhelin

-

{ participantPhone }

-

Kotikaupunki

-

{ homeCity }

-

Sähköposti

-

{ email }

-
- - + const presence = this.state.participantDetails.presence; + const presenceHistory = this.state.participantDetails.presenceHistory || []; + + return ( +
+ + + +

{ participantName }

+

{ participantStatus }

+

Syntymäaika: { moment(dateOfBirth).format('D.M.YYYY') }

+ +
+ + + +
+
Puhelin
+
{ phoneNumber }
+
Sähköposti
+
{ email }
+ { guardianOne || guardianTwo ?
Huoltajat
: '' } + { guardianOne ?
{ guardianOne }
: '' } + { guardianTwo ?
{ guardianTwo }
: '' } +
+
+ +
+
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 }
+
+
+ + - - + + -
-
-
- ); +
+
+
+ ); + } else { + return ( +
+ ); + } } } From a41a6d876c78d1183c2d0df4e257c0719831205c Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:32:23 +0300 Subject: [PATCH 2/7] Allergies --- src/client/actions/ParticipantActions.js | 2 +- src/client/components/ParticipantDetailsPage.jsx | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/client/actions/ParticipantActions.js b/src/client/actions/ParticipantActions.js index 6c39ebfa..c1e11542 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.jsx b/src/client/components/ParticipantDetailsPage.jsx index 8c0163f6..12b5abde 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -60,6 +60,7 @@ export function getParticipantDetailsPage(participantStore, participantActions) diet, familyCampProgramInfo, childNaps, + allergies, } = this.state.participantDetails; const participantName = `${firstName} ${lastName}`; @@ -71,6 +72,10 @@ export function getParticipantDetailsPage(participantStore, participantActions) const presence = this.state.participantDetails.presence; const presenceHistory = this.state.participantDetails.presenceHistory || []; + const allergyNames = _.map(allergies, row => row.name); + + console.log(this.state.participantDetails); + return (
@@ -128,6 +133,11 @@ export function getParticipantDetailsPage(participantStore, participantActions) + + { allergyNames || diet ? '' :

Ei allergioita

} + { allergyNames ?

{ allergyNames.join(', ') }

: '' } + { diet ?

{ diet }

: '' } +
From e63a557dc9ccd70cc59647a1a61c32285dc49841 Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:39:35 +0300 Subject: [PATCH 3/7] Styles for participantDetailsPage --- .../components/ParticipantDetailsPage.jsx | 8 +++++--- src/client/styles.scss | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index c41126c8..4a1a5a46 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -107,9 +107,11 @@ export function getParticipantDetailsPage(participantStore, participantActions) -

{ participantName }

-

{ participantStatus }

-

Syntymäaika: { moment(dateOfBirth).format('D.M.YYYY') }

+

+ { participantName } + (synt. { moment(dateOfBirth).format('D.M.YYYY') }) +

+

{ participantStatus }

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) { From a60039b4af39f7d13ba56e630c6c9eca78961778 Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:41:12 +0300 Subject: [PATCH 4/7] Added homeCity --- src/client/components/ParticipantDetailsPage.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index 4a1a5a46..69fbb067 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -125,6 +125,8 @@ export function getParticipantDetailsPage(participantStore, participantActions) { guardianOne || guardianTwo ?
Huoltajat
: '' } { guardianOne ?
{ guardianOne }
: '' } { guardianTwo ?
{ guardianTwo }
: '' } + { homeCity ?
Kotikunta
: '' } + { homeCity ?
{ homeCity }
: '' } From 27863c35c63c7bd3bab2a54b921b95db226ed71e Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:43:34 +0300 Subject: [PATCH 5/7] Added staffPosition --- src/client/components/ParticipantDetailsPage.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index 69fbb067..53647006 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -129,6 +129,16 @@ export function getParticipantDetailsPage(participantStore, participantActions) { homeCity ?
{ homeCity }
: '' }
+ {} + + { staffPosition || staffPositionInGenerator ? '' :

Ei pestiä

} +
+ { staffPosition ?
Pesti
: '' } + { staffPosition ?
{ staffPosition }
: '' } + { staffPositionInGenerator ?
Pestitieto kehittimestä
: '' } + { staffPositionInGenerator ?
{ staffPositionInGenerator }
: '' } +
+
Ikäkausi
From acb2fdf0e0c7d15bbef2f324bd737b7ec0b270bb Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:49:19 +0300 Subject: [PATCH 6/7] Familycamp details --- src/client/components/ParticipantDetailsPage.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index 53647006..ec1e6bf0 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -100,7 +100,15 @@ export function getParticipantDetailsPage(participantStore, participantActions) const allergyNames = _.map(allergies, row => row.name); - console.log(this.state.participantDetails); + const familyCampDetails = (program, naps) => + +
+ { program ?
Ohjelma
: '' } + { program ?
{ program }
: '' } + { naps ?
Päiväunet
: '' } + { naps ?
{ naps }
: '' } +
+
; return (
@@ -129,7 +137,7 @@ export function getParticipantDetailsPage(participantStore, participantActions) { homeCity ?
{ homeCity }
: '' }
- {} + { familyCampProgramInfo || childNaps ? familyCampDetails(familyCampProgramInfo, childNaps) : '' } { staffPosition || staffPositionInGenerator ? '' :

Ei pestiä

}
From d9eb123fcd00d10956d49d77a94edf8845cea4c2 Mon Sep 17 00:00:00 2001 From: Ville Vuorenmaa Date: Sun, 17 Jul 2016 12:55:55 +0300 Subject: [PATCH 7/7] Fixed grid, removed unused constants --- .../components/ParticipantDetailsPage.jsx | 203 +++++++++--------- 1 file changed, 100 insertions(+), 103 deletions(-) diff --git a/src/client/components/ParticipantDetailsPage.jsx b/src/client/components/ParticipantDetailsPage.jsx index ec1e6bf0..d3d9fa95 100644 --- a/src/client/components/ParticipantDetailsPage.jsx +++ b/src/client/components/ParticipantDetailsPage.jsx @@ -1,6 +1,7 @@ import React from 'react'; +import _ from 'lodash'; import moment from 'moment'; -import { Grid, Row, Col, Panel, Button } from 'react-bootstrap'; +import { Row, Col, Panel, Button } from 'react-bootstrap'; import { Presence } from '../components'; import { PresenceHistory } from '../components'; import { PropertyTextArea } from '../components'; @@ -58,7 +59,6 @@ export function getParticipantDetailsPage(participantStore, participantActions) render() { if (this.state.participantDetails) { const { - participantId, firstName, lastName, dateOfBirth, @@ -74,7 +74,6 @@ export function getParticipantDetailsPage(participantStore, participantActions) subCamp, campGroup, village, - dates, internationalGuest, staffPosition, staffPositionInGenerator, @@ -100,7 +99,7 @@ export function getParticipantDetailsPage(participantStore, participantActions) const allergyNames = _.map(allergies, row => row.name); - const familyCampDetails = (program, naps) => + const familyCampDetails = (program, naps) =>
{ program ?
Ohjelma
: '' } @@ -112,105 +111,103 @@ export function getParticipantDetailsPage(participantStore, participantActions) return (
- - - -

- { participantName } - (synt. { moment(dateOfBirth).format('D.M.YYYY') }) -

-

{ participantStatus }

- -
- - - -
-
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 }

: '' } -
- - - - - - - - - -
-
+ + +

+ { participantName } + (synt. { moment(dateOfBirth).format('D.M.YYYY') }) +

+

{ participantStatus }

+ +
+ + + +
+
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 {