From 9b8102a54280450f04a7315f2b63f7d92de27adb Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 8 Aug 2020 22:49:03 +0000 Subject: [PATCH] Add member's training to admin member page --- webclient/src/AdminMembers.js | 18 +++++++++++ webclient/src/Members.js | 6 +++- webclient/src/Training.js | 56 ++++++++++++++++++++--------------- 3 files changed, 55 insertions(+), 25 deletions(-) diff --git a/webclient/src/AdminMembers.js b/webclient/src/AdminMembers.js index d542ae8..d8af2fb 100644 --- a/webclient/src/AdminMembers.js +++ b/webclient/src/AdminMembers.js @@ -4,6 +4,7 @@ import './light.css'; import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; import moment from 'moment'; import { statusColor, BasicTable, staticUrl, requester } from './utils.js'; +import { TrainingList } from './Training.js'; import { NotFound } from './Misc.js'; function AdminCardDetail(props) { @@ -527,3 +528,20 @@ export function AdminMemberInfo(props) { ); }; + +export function AdminMemberTraining(props) { + const training = props.result.training; + + return ( +
+
Member Training
+ + {training.length ? + + : +

None

+ } + +
+ ); +}; diff --git a/webclient/src/Members.js b/webclient/src/Members.js index 08f8910..2c6442c 100644 --- a/webclient/src/Members.js +++ b/webclient/src/Members.js @@ -4,7 +4,7 @@ import './light.css'; import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Input, Item, Menu, Message, Segment, Table } from 'semantic-ui-react'; import { statusColor, isAdmin, BasicTable, staticUrl, requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; -import { AdminMemberInfo, AdminMemberPause, AdminMemberForm, AdminMemberCards } from './AdminMembers.js'; +import { AdminMemberInfo, AdminMemberPause, AdminMemberForm, AdminMemberCards, AdminMemberTraining } from './AdminMembers.js'; import { AdminMemberTransactions } from './AdminTransactions.js'; export function MembersDropdown(props) { @@ -204,6 +204,10 @@ export function MemberDetail(props) { } + {isAdmin(user) && + + } + {isAdmin(user) && } diff --git a/webclient/src/Training.js b/webclient/src/Training.js index 96f5894..2439999 100644 --- a/webclient/src/Training.js +++ b/webclient/src/Training.js @@ -6,6 +6,37 @@ import moment from 'moment'; import { requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; +export function TrainingList(props) { + const { training } = props; + + return ( + + + + Course / Event Name + Class Date + Status + Instructor + + + + + {training.slice().sort((a, b) => a.session.datetime < b.session.datetime ? 1 : -1).map(x => + + {x.session.course_name} + + {moment(x.session.datetime).format('MMMM Do YYYY')} + + {x.attendance_status} + {x.session.instructor_name} + + )} + +
+ ); +}; + + export function Training(props) { const { user } = props; @@ -14,29 +45,7 @@ export function Training(props) {
Training
{user.training.length ? - - - - Course / Event Name - Class Date - Status - Instructor - - - - - {user.training.slice().sort((a, b) => a.session.datetime < b.session.datetime ? 1 : -1).map(x => - - {x.session.course_name} - - {moment(x.session.datetime).format('MMMM Do YYYY')} - - {x.attendance_status} - {x.session.instructor_name} - - )} - -
+ :

No training yet! Sign up for a course to take a class.

} @@ -44,4 +53,3 @@ export function Training(props) { ); }; -