Add member's training to admin member page
This commit is contained in:
parent
bf6abb8737
commit
9b8102a542
|
@ -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) {
|
|||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export function AdminMemberTraining(props) {
|
||||
const training = props.result.training;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header size='medium'>Member Training</Header>
|
||||
|
||||
{training.length ?
|
||||
<TrainingList training={training} />
|
||||
:
|
||||
<p>None</p>
|
||||
}
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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) {
|
|||
<AdminMemberCards result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>}
|
||||
|
||||
{isAdmin(user) && <Segment padded>
|
||||
<AdminMemberTraining result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>}
|
||||
|
||||
{isAdmin(user) && <Segment padded>
|
||||
<AdminMemberTransactions result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>}
|
||||
|
|
|
@ -6,14 +6,10 @@ import moment from 'moment';
|
|||
import { requester } from './utils.js';
|
||||
import { NotFound, PleaseLogin } from './Misc.js';
|
||||
|
||||
export function Training(props) {
|
||||
const { user } = props;
|
||||
export function TrainingList(props) {
|
||||
const { training } = props;
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Header size='large'>Training</Header>
|
||||
|
||||
{user.training.length ?
|
||||
<Table basic='very'>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
|
@ -25,7 +21,7 @@ export function Training(props) {
|
|||
</Table.Header>
|
||||
|
||||
<Table.Body>
|
||||
{user.training.slice().sort((a, b) => a.session.datetime < b.session.datetime ? 1 : -1).map(x =>
|
||||
{training.slice().sort((a, b) => a.session.datetime < b.session.datetime ? 1 : -1).map(x =>
|
||||
<Table.Row key={x.id}>
|
||||
<Table.Cell>{x.session.course_name}</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
@ -37,6 +33,19 @@ export function Training(props) {
|
|||
)}
|
||||
</Table.Body>
|
||||
</Table>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export function Training(props) {
|
||||
const { user } = props;
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Header size='large'>Training</Header>
|
||||
|
||||
{user.training.length ?
|
||||
<TrainingList training={user.training} />
|
||||
:
|
||||
<p>No training yet! Sign up for a course to take a class.</p>
|
||||
}
|
||||
|
@ -44,4 +53,3 @@ export function Training(props) {
|
|||
</Container>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user