Skip to content

Commit

Permalink
Merge pull request #128 from partio-scout/feature/nickname-and-country
Browse files Browse the repository at this point in the history
Import country & nickname from Kuksa & add fields to UI
  • Loading branch information
emilvirkki authored Jul 17, 2016
2 parents 552d13a + 32381a9 commit 6902b1e
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ export function getParticipantDetailsPage(participantStore, participantActions)
const {
firstName,
lastName,
nickname,
dateOfBirth,
nonScout,
billedDate,
paidDate,
memberNumber,
homeCity,
country,
email,
phoneNumber,
ageGroup,
Expand All @@ -89,7 +91,7 @@ export function getParticipantDetailsPage(participantStore, participantActions)
} = this.state.participantDetails;

const participantName = `${firstName} ${lastName}`;
const participantStatus = internationalGuest ? 'KV-osallistuja' : ( nonScout ? 'EVP' : `Partiolainen (jäsennumero: ${memberNumber})` );
const participantStatus = internationalGuest ? `KV-osallistuja, ${country}` : ( nonScout ? 'EVP' : `Partiolainen (jäsennumero: ${memberNumber})` );

const formattedBilledDate = billedDate ? moment(billedDate).format('D.M.YYYY') : '–';
const formattedPaidDate = paidDate ? moment(paidDate).format('D.M.YYYY') : '–';
Expand All @@ -115,6 +117,7 @@ export function getParticipantDetailsPage(participantStore, participantActions)
<Col md={ 12 }>
<h2>
{ participantName }
<small> { nickname || '' } </small>
<small> (synt. { moment(dateOfBirth).format('D.M.YYYY') })</small>
</h2>
<h4 className="text-muted margin-bottom">{ participantStatus }</h4>
Expand Down Expand Up @@ -152,7 +155,7 @@ export function getParticipantDetailsPage(participantStore, participantActions)
{ swimmingSkill ? <dt>Uimataito</dt> : '' }
{ swimmingSkill ? <dd>{ swimmingSkill }</dd> : '' }
<dt>Lippukunta</dt>
<dd>{ localGroup }</dd>
<dd>{ `${localGroup}, ${country}` }</dd>
<dt>Leirilippukunta</dt>
<dd>{ campGroup }</dd>
<dt>Kylä</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ export function getParticipantListPage(participantStore, participantActions, sea
email: 'Sähköposti',
phoneNumber: 'Puhelinnumero',
ageGroup: 'Ikäkausi',
accommodation: 'Majoittuminen',
localGroup: 'Lippukunta',
village: 'Kylä',
subCamp: 'Alaleiri',
campGroup: 'Leirilippukunta',
};
Expand Down
4 changes: 4 additions & 0 deletions src/client/components/ParticipantListPage/ParticipantRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class ParticipantRow extends React.Component {
localGroup,
subCamp,
campGroup,
village,
accommodation,
presence,
} = this.props.participant;

Expand Down Expand Up @@ -87,7 +89,9 @@ export class ParticipantRow extends React.Component {
<td>{ formatNullableString(email) }</td>
<td>{ formatNullableString(phoneNumber) }</td>
<td>{ ageGroup }</td>
<td>{ formatNullableString(accommodation) }</td>
<td>{ localGroup }</td>
<td>{ village }</td>
<td>{ subCamp }</td>
<td>{ campGroup }</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getQuickFilterContainer(participantStore, participantActions, se
}

function QuickFilterContainer(props, context) {
const currentSelection = getCurrentSelection(['textSearch', 'ageGroup', 'subCamp', 'localGroup', 'campGroup', 'presence'], props.filter);
const currentSelection = getCurrentSelection(['textSearch', 'ageGroup', 'subCamp', 'localGroup', 'campGroup', 'presence', 'village'], props.filter);

function resetFilters(event) {
event.preventDefault();
Expand Down Expand Up @@ -66,6 +66,12 @@ export function getQuickFilterContainer(participantStore, participantActions, se
label="Alaleiri"
property="subCamp"
/>
<PropertyFilterContainer
onChange={ handleChange }
currentSelection={ currentSelection }
label="Kylä"
property="village"
/>
<PropertyFilterContainer
onChange={ handleChange }
currentSelection={ currentSelection }
Expand Down
12 changes: 12 additions & 0 deletions src/common/models/kuksa-participant.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
"nullable": "YES"
}
},
"nickname": {
"type": "string",
"required": false,
"postgresql": {
"columnName": "nickname",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"dateOfBirth": {
"type": "date",
"postgresql": {
Expand Down
24 changes: 24 additions & 0 deletions src/common/models/participant.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
"nullable": "NO"
}
},
"nickname": {
"type": "string",
"required": false,
"postgresql": {
"columnName": "nickname",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"nonScout": {
"type": "boolean",
"required": true,
Expand Down Expand Up @@ -148,6 +160,18 @@
"nullable": "YES"
}
},
"country": {
"type": "string",
"required": false,
"postgresql": {
"columnName": "country",
"dataType": "character varying",
"dataLength": 255,
"dataPrecision": null,
"dataScale": null,
"nullable": "YES"
}
},
"staffPosition": {
"type": "string",
"postgresql": {
Expand Down
1 change: 1 addition & 0 deletions src/kuksa-integration/fetch-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function transferParticipants(eventApi) {
id: participant.id,
firstName: participant.firstName || 'x',
lastName: participant.lastName || 'x',
nickname: participant.nickname,
memberNumber: participant.memberNumber,
dateOfBirth: new Date(participant.birthDate),
phoneNumber: participant.phoneNumber,
Expand Down
2 changes: 2 additions & 0 deletions src/kuksa-integration/rebuild-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function rebuildParticipantsTable() {
participantId: participant.id,
firstName: participant.firstName,
lastName: participant.lastName,
nickname: participant.nickname,
memberNumber: participant.memberNumber,
dateOfBirth: participant.dateOfBirth,
billedDate: getPaymentStatus(participant.paymentStatus, 'billed'),
Expand All @@ -101,6 +102,7 @@ function rebuildParticipantsTable() {
campGroup: _.get(participant, 'campGroup.name') || 'Muu',
subCamp: getSubCamp(participant),
village: _.get(participant, 'village.name') || 'Muu',
country: _.get(participant, 'localGroup.country') || 'Suomi',
ageGroup: getSelectionForGroup(participant, 'Osallistun seuraavan ikäkauden ohjelmaan:') || 'Muu',
// Not a scout if a) no finnish member number 2) not part of international group ("local group")
nonScout: !participant.memberNumber && !_.get(participant, 'localGroup.name'),
Expand Down

0 comments on commit 6902b1e

Please sign in to comment.