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
Branches
Tags
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,6 +52,7 @@ class Applications extends Component { ...@@ -52,6 +52,7 @@ class Applications extends Component {
</Table.Cell> </Table.Cell>
} }
<Table.Cell> <Table.Cell>
{ profile.role !== 'Staff' ?
<ConfirmModal <ConfirmModal
button={<Button button={<Button
color='blue' color='blue'
...@@ -62,6 +63,8 @@ class Applications extends Component { ...@@ -62,6 +63,8 @@ class Applications extends Component {
text='staff jogot adsz neki' text='staff jogot adsz neki'
onAccept={() => this.props.setStatus(profile.id, 'Staff')} 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.
Please register or to comment