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

Create a confirmation modal. Display status on the applicant profile page

parent 51658286
No related branches found
No related tags found
No related merge requests found
import React, { Component } from 'react';
import { Button, Header, Icon, Modal } from 'semantic-ui-react';
class ConfirmModal extends Component {
constructor(props) {
super(props);
this.state = {
showModal: false,
};
}
close = () => this.setState({ showModal: false })
open = () => this.setState({ showModal: true})
render() {
const { button, text, onAccept } = this.props;
const open = this.state.showModal;
return (
<Modal
open={open}
closeOnDimmerClick
trigger={button}
onOpen={this.open}
onClose={this.close}
size='small'
basic
>
<Header icon='question' content='Confirm' />
<Modal.Content>
<p>
Biztos hogy {text}?
</p>
</Modal.Content>
<Modal.Actions>
<Button
basic
color='red'
inverted
inverted
onClick={() => this.close()}
>
<Icon name='remove' /> No
</Button>
<Button
color='green'
inverted
onClick={() => { onAccept();
this.close();
}
}
>
<Icon name='checkmark' /> Yes
</Button>
</Modal.Actions>
</Modal>
);
}
}
export default ConfirmModal;
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Container, Header, Item, Button } from 'semantic-ui-react'; import { Container, Header, Item, Button, Label } from 'semantic-ui-react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { getSelectedProfile } from '../../actions/statistics'; import { getSelectedProfile, setStatus } from '../../actions/statistics';
import ConfirmModal from '../forms/ConfirmModal';
class ApplicantProfile extends Component { class ApplicantProfile extends Component {
componentWillMount() { componentWillMount() {
...@@ -9,7 +10,7 @@ class ApplicantProfile extends Component { ...@@ -9,7 +10,7 @@ class ApplicantProfile extends Component {
} }
render() { render() {
const { full_name, nick, motivation_about, motivation_exercise, motivation_profession } const { id, signed, 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,26 +29,67 @@ class ApplicantProfile extends Component { ...@@ -28,26 +29,67 @@ class ApplicantProfile extends Component {
<Header as='h3'>Feladatok megoldása:</Header> <Header as='h3'>Feladatok megoldása:</Header>
<p>{motivation_exercise}</p> <p>{motivation_exercise}</p>
</Container> </Container>
<Container textAlign='center' style={{ padding: '20px' }}>
<Header as='h3'>Státusz:</Header>
{ signed ?
<div>
{ role === 'Student' ?
<Label color='green' size='huge'>Elfogadva</Label>
:
null
}
{ role === 'Staff' ?
<Label color='blue' size='huge'>Staff</Label>
:
null
}
{ role === 'Applicant' ?
<Label color='orange' size='huge'>Jelentkezett</Label>
:
null
}
{ role === 'Denied' ?
<Label color='red' size='huge'>Elutasítva</Label>
:
null
}
</div>
:
<Label color='red' size='huge'>Nem jelentkezett</Label>
}
</Container>
</Item.Description> </Item.Description>
</Item.Content> </Item.Content>
</Item> </Item>
<Container textAlign='center'> { signed && role !== 'Staff' ?
<Button <Container textAlign='center'>
color='green' <ConfirmModal
> button={
Jelentkezés elfogadása <Button
</Button> color='green'
<Button >Jelentkezés elfogadása
color='red' </Button>}
> text='elfogadod a jelentkezést'
Jelentkezés elutasítása onAccept={() => this.props.setStatus(id, 'Student')}
</Button> />
</Container> <ConfirmModal
button={
<Button
color='red'
>Jelentkezés elutasítása
</Button>}
text='elutasítod a jelentkezést'
onAccept={() => this.props.setStatus(id, 'Denied')}
/>
</Container>
:
null
}
</Container> </Container>
) );
} }
} }
const mapStateToProps = ({ trainees: { selectedProfile } }) => ({ selectedProfile }); const mapStateToProps = ({ trainees: { selectedProfile } }) => ({ selectedProfile });
export default connect(mapStateToProps, { getSelectedProfile })(ApplicantProfile); export default connect(mapStateToProps, { getSelectedProfile, setStatus })(ApplicantProfile);
...@@ -30,8 +30,8 @@ class Applications extends Component { ...@@ -30,8 +30,8 @@ class Applications extends Component {
: :
null null
} }
{ profile.role === 'Apllicant' ? { profile.role === 'Applicant' ?
<Label color='yellow'>Jelentkezett</Label> <Label color='orange'>Jelentkezett</Label>
: :
null null
} }
......
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