Skip to content
Snippets Groups Projects
Commit 51658286 authored by Chif Gergő's avatar Chif Gergő
Browse files

Add more status label based on the profiles role

parent ff083543
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
}
......
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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment