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

Display groups in Applicant detail, remove add staff button when user is staff

parent b49e7f9a
No related branches found
No related tags found
No related merge requests found
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container, Header, Item, Button, Label } from 'semantic-ui-react'; import { Container, Header, Item, Button, Label, List } from 'semantic-ui-react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { getSelectedProfile, setStatus } from '../../actions/statistics'; import { getSelectedProfile, setStatus } from '../../actions/statistics';
import ConfirmModal from '../forms/ConfirmModal'; import ConfirmModal from '../forms/ConfirmModal';
const options = [
{ key: 'DT', text: 'DevTeam' },
{ key: 'NET', text: 'NETeam' },
{ key: 'ST', text: 'SecurITeam' },
{ key: 'SYS', text: 'SysAdmin' },
{ key: 'HAT', text: 'Hallgatói Tudásbázis' },
];
class ApplicantProfile extends Component { class ApplicantProfile extends Component {
componentWillMount() { componentWillMount() {
this.props.getSelectedProfile(this.props.match.params.id); this.props.getSelectedProfile(this.props.match.params.id);
} }
renderGroups() {
const { groups } = this.props.selectedProfile;
const groupNames = options.map(item => (groups.includes(item.key) ? item.text : null));
return groupNames.map(item => (
<List.Item>
<List.Content>
<List.Header>{item}</List.Header>
</List.Content>
</List.Item>
));
}
render() { render() {
const { id, signed, role, full_name, nick, motivation_about, motivation_exercise, motivation_profession } const { id, signed, groups, role, full_name, nick, motivation_about, motivation_exercise, motivation_profession }
= this.props.selectedProfile; = this.props.selectedProfile;
return ( return (
<Container style={{ padding: '60px' }}> <Container style={{ padding: '60px' }}>
...@@ -28,6 +48,14 @@ class ApplicantProfile extends Component { ...@@ -28,6 +48,14 @@ class ApplicantProfile extends Component {
<p>{motivation_profession}</p> <p>{motivation_profession}</p>
<Header as='h3'>Feladatok megoldása:</Header> <Header as='h3'>Feladatok megoldása:</Header>
<p>{motivation_exercise}</p> <p>{motivation_exercise}</p>
<Header as='h3'>Érdeklődés:</Header>
{ groups ?
<List horizontal>
{this.renderGroups()}
</List>
:
null
}
</Container> </Container>
<Container textAlign='center' style={{ padding: '20px' }}> <Container textAlign='center' style={{ padding: '20px' }}>
<Header as='h3'>Státusz:</Header> <Header as='h3'>Státusz:</Header>
......
...@@ -52,16 +52,19 @@ class Applications extends Component { ...@@ -52,16 +52,19 @@ class Applications extends Component {
</Table.Cell> </Table.Cell>
} }
<Table.Cell> <Table.Cell>
<ConfirmModal { profile.role !== 'Staff' ?
button = {<Button <ConfirmModal
color='blue' button={<Button
size='tiny' color='blue'
> size='tiny'
Staff jog adás >
</Button>} Staff jog adás
text='staff jogot adsz neki' </Button>}
onAccept={() => this.props.setStatus(profile.id, 'Staff')} text='staff jogot adsz neki'
/> onAccept={() => this.props.setStatus(profile.id, 'Staff')}
/>
:
null }
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
); );
......
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