From 5d499101c8e9cc9b34d983ed332d7b233b27f541 Mon Sep 17 00:00:00 2001 From: Ajoy10 Date: Sun, 7 Apr 2024 22:11:16 +0530 Subject: [PATCH 1/2] Certificate eligible --- src/components/Certificates/index.jsx | 7 +++++-- src/components/CollegeTeams/Edit.jsx | 24 +++++++++++++++++++++++- src/services/participants.js | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/Certificates/index.jsx b/src/components/Certificates/index.jsx index b84cf1ae..3ff24e03 100644 --- a/src/components/Certificates/index.jsx +++ b/src/components/Certificates/index.jsx @@ -27,7 +27,7 @@ export default class Certificates extends React.Component { let sortedTeams = {}; collegesService.getParticipants(user.college).then(participants => { for (let team of teams) { - let members = participants.filter(member => team.members.includes(member.id)); + let members = participants.filter(member => team.members.includes(member.id) && member.certificateEligible); team.members = members; } @@ -144,7 +144,10 @@ export default class Certificates extends React.Component { { this.state.events.map((event, i) => ( this.state.teams[event].map((team, j) => ( - team.members.map((member, k) => ( + team.members.filter((member)=>{ + console.log(member) + return true; + }).map((member, k) => ( {member.registrationID} {member.name} {event} diff --git a/src/components/CollegeTeams/Edit.jsx b/src/components/CollegeTeams/Edit.jsx index f01a291f..f242c169 100644 --- a/src/components/CollegeTeams/Edit.jsx +++ b/src/components/CollegeTeams/Edit.jsx @@ -42,7 +42,6 @@ export default class EditMember extends React.Component { componentWillMount() { participantsService.get(this.props.member).then(participant => { - this.setState({ participant: participant || {} }) }); @@ -90,6 +89,29 @@ export default class EditMember extends React.Component { /> +
+
Eligible for certification
+ { + const val = e.target.checked; + this.setState((prev)=>{ + return { + participant: { + ...prev.participant, + certificateEligible: val, + } + } + }); + }} + autoComplete="off" + name="certificateEligible" + type="checkbox" + checked={this.state.participant.certificateEligible} + placeholder="Eligible for certificate" + css={{ width: 50 }} + /> +
+