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 { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { statusColor, BasicTable, staticUrl, requester } from './utils.js';
|
import { statusColor, BasicTable, staticUrl, requester } from './utils.js';
|
||||||
|
import { TrainingList } from './Training.js';
|
||||||
import { NotFound } from './Misc.js';
|
import { NotFound } from './Misc.js';
|
||||||
|
|
||||||
function AdminCardDetail(props) {
|
function AdminCardDetail(props) {
|
||||||
|
@ -527,3 +528,20 @@ export function AdminMemberInfo(props) {
|
||||||
</div>
|
</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 { 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 { statusColor, isAdmin, BasicTable, staticUrl, requester } from './utils.js';
|
||||||
import { NotFound, PleaseLogin } from './Misc.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';
|
import { AdminMemberTransactions } from './AdminTransactions.js';
|
||||||
|
|
||||||
export function MembersDropdown(props) {
|
export function MembersDropdown(props) {
|
||||||
|
@ -204,6 +204,10 @@ export function MemberDetail(props) {
|
||||||
<AdminMemberCards result={result} refreshResult={refreshResult} {...props} />
|
<AdminMemberCards result={result} refreshResult={refreshResult} {...props} />
|
||||||
</Segment>}
|
</Segment>}
|
||||||
|
|
||||||
|
{isAdmin(user) && <Segment padded>
|
||||||
|
<AdminMemberTraining result={result} refreshResult={refreshResult} {...props} />
|
||||||
|
</Segment>}
|
||||||
|
|
||||||
{isAdmin(user) && <Segment padded>
|
{isAdmin(user) && <Segment padded>
|
||||||
<AdminMemberTransactions result={result} refreshResult={refreshResult} {...props} />
|
<AdminMemberTransactions result={result} refreshResult={refreshResult} {...props} />
|
||||||
</Segment>}
|
</Segment>}
|
||||||
|
|
|
@ -6,14 +6,10 @@ import moment from 'moment';
|
||||||
import { requester } from './utils.js';
|
import { requester } from './utils.js';
|
||||||
import { NotFound, PleaseLogin } from './Misc.js';
|
import { NotFound, PleaseLogin } from './Misc.js';
|
||||||
|
|
||||||
export function Training(props) {
|
export function TrainingList(props) {
|
||||||
const { user } = props;
|
const { training } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
|
||||||
<Header size='large'>Training</Header>
|
|
||||||
|
|
||||||
{user.training.length ?
|
|
||||||
<Table basic='very'>
|
<Table basic='very'>
|
||||||
<Table.Header>
|
<Table.Header>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
|
@ -25,7 +21,7 @@ export function Training(props) {
|
||||||
</Table.Header>
|
</Table.Header>
|
||||||
|
|
||||||
<Table.Body>
|
<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.Row key={x.id}>
|
||||||
<Table.Cell>{x.session.course_name}</Table.Cell>
|
<Table.Cell>{x.session.course_name}</Table.Cell>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
|
@ -37,6 +33,19 @@ export function Training(props) {
|
||||||
)}
|
)}
|
||||||
</Table.Body>
|
</Table.Body>
|
||||||
</Table>
|
</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>
|
<p>No training yet! Sign up for a course to take a class.</p>
|
||||||
}
|
}
|
||||||
|
@ -44,4 +53,3 @@ export function Training(props) {
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user