diff --git a/src/actions/statistics.js b/src/actions/statistics.js index fca39b326e7640d383003cbd0b1b29751193b719..719fad4e38bb0f6b0a1dd2e1534ff4f990385e09 100644 --- a/src/actions/statistics.js +++ b/src/actions/statistics.js @@ -136,12 +136,11 @@ export const getProfiles = () => ( } ); -export const setStaffStatus = id => ( +export const setStatus = (id, status) => ( async (dispatch) => { try { const response = await axios.patch(`/api/v1/profiles/${id}/`, { - signed: true, - role: 'Staff', + role: status, }); if (response.data.id) { } diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js index 0ce391cde1ea8023fe5d2efa16404864b251eee4..3d5a7ae83706ca606eaeb527b791d5b9ea9bbb57 100644 --- a/src/components/pages/Applications.js +++ b/src/components/pages/Applications.js @@ -1,8 +1,8 @@ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; -import { Container, Table, Icon, Button } from 'semantic-ui-react'; +import { Container, Table, Label, Button } from 'semantic-ui-react'; import { connect } from 'react-redux'; -import { getProfiles, setStaffStatus } from '../../actions/statistics'; +import { getProfiles, setStatus } from '../../actions/statistics'; class Applications extends Component { componentWillMount() { @@ -18,19 +18,37 @@ class Applications extends Component { {profile.full_name} </Link> </Table.Cell> - <Table.Cell textAlign='center'> - { profile.role === 'Student' ? - <Icon color='green' name='checkmark' /> - : - profile.role === 'Staff' ? - <strong>Staff</strong> + { profile.signed ? + <Table.Cell textAlign='center'> + { profile.role === 'Student' ? + <Label color='green'>Elfogadva</Label> : - <Icon color='red' name='cancel' /> - } - </Table.Cell> + null + } + { profile.role === 'Staff' ? + <Label color='blue'>Staff</Label> + : + null + } + { profile.role === 'Apllicant' ? + <Label color='yellow'>Jelentkezett</Label> + : + null + } + { profile.role === 'Denied' ? + <Label color='red'>ElutasĂtva</Label> + : + null + } + </Table.Cell> + : + <Table.Cell textAlign='center'> + <Label color='red'>Nem jelentkezett</Label> + </Table.Cell> + } <Table.Cell> <Button - onClick={() => this.props.setStaffStatus(profile.id)} + onClick={() => this.props.setStatus(profile.id, 'Staff')} color='blue' size='tiny' > @@ -70,4 +88,4 @@ class Applications extends Component { const mapStateToProps = ({ trainees: { profiles }, user }) => ({ profiles, user }); -export default connect(mapStateToProps, { getProfiles, setStaffStatus })(Applications); +export default connect(mapStateToProps, { getProfiles, setStatus })(Applications);