diff --git a/src/actions/statistics.js b/src/actions/statistics.js index 72581c73ee9e3f141f11b9fd7b15358253b3889a..6fadb492f01432326c3631cd9261d6c3e7d21a69 100644 --- a/src/actions/statistics.js +++ b/src/actions/statistics.js @@ -10,10 +10,10 @@ import { GET_TRAINEE_BY_ID, } from './types'; -export const getEvents = () => ( +export const getStaffEvents = () => ( async (dispatch) => { try { - const response = await axios.get('/api/v1/events/'); + const response = await axios.get('/api/v1/staff_events/'); dispatch({ type: GET_EVENTS, payload: response.data, @@ -41,7 +41,7 @@ export const getStudentEvents = () => ( export const getEventById = id => ( async (dispatch) => { try { - const response = await axios.get(`/api/v1/events/${id}`); + const response = await axios.get(`/api/v1/staff_events/${id}`); dispatch({ type: GET_EVENT_BY_ID, payload: response.data, diff --git a/src/components/pages/ApplicantProfile.js b/src/components/pages/ApplicantProfile.js new file mode 100644 index 0000000000000000000000000000000000000000..535617c75f03d53c51b485bdf0578051c346a6df --- /dev/null +++ b/src/components/pages/ApplicantProfile.js @@ -0,0 +1,95 @@ +import React, { Component } from 'react'; +import { Container, Header, Item, Button, Label } from 'semantic-ui-react'; +import { connect } from 'react-redux'; +import { getSelectedProfile, setStatus } from '../../actions/statistics'; +import ConfirmModal from '../forms/ConfirmModal'; + +class ApplicantProfile extends Component { + componentWillMount() { + this.props.getSelectedProfile(this.props.match.params.id); + } + + render() { + const { id, signed, role, full_name, nick, motivation_about, motivation_exercise, motivation_profession } + = this.props.selectedProfile; + return ( + <Container style={{ padding: '60px' }}> + <Item> + <Item.Content> + <Container textAlign='center'> + <Header as='h2'>{full_name}</Header> + <Item.Meta>{nick}</Item.Meta> + </Container> + <Item.Description> + <Container textAlign='justified' style={{ padding: '30px' }}> + <Header as='h3'>MagamrĂłl, eddigi tevĂŠkenysĂŠgem:</Header> + <p>{motivation_about}</p> + <Header as='h3'>Szakmai motivĂĄciĂł:</Header> + <p>{motivation_profession}</p> + <Header as='h3'>Feladatok megoldĂĄsa:</Header> + <p>{motivation_exercise}</p> + </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.Content> + </Item> + { signed && role !== 'Staff' ? + <Container textAlign='center'> + <ConfirmModal + button={ + <Button + color='green' + >JelentkezĂŠs elfogadĂĄsa + </Button>} + text='elfogadod a jelentkezĂŠst' + onAccept={() => this.props.setStatus(id, 'Student')} + /> + <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> + ); + } +} + +const mapStateToProps = ({ trainees: { selectedProfile } }) => ({ selectedProfile }); + +export default connect(mapStateToProps, { getSelectedProfile, setStatus })(ApplicantProfile); diff --git a/src/components/pages/Events.js b/src/components/pages/Events.js index ea287f7faa6ff66b0220f53c1cef391cdfd478b9..3d5c8fca3566e71690424e84075a51c52c0a0130 100644 --- a/src/components/pages/Events.js +++ b/src/components/pages/Events.js @@ -3,12 +3,12 @@ import moment from 'moment'; import { Link } from 'react-router-dom'; import { Container, Table, Button } from 'semantic-ui-react'; import { connect } from 'react-redux'; -import { getEvents, deleteEvent } from '../../actions/statistics'; +import { getStaffEvents, deleteEvent } from '../../actions/statistics'; import AddEventForm from '../forms/AddEventForm'; class Events extends Component { componentWillMount() { - this.props.getEvents(); + this.props.getStaffEvents(); } renderEvents() { @@ -62,4 +62,4 @@ class Events extends Component { const mapStateToProps = ({ events: { events }, user }) => ({ events, user }); -export default connect(mapStateToProps, { getEvents, deleteEvent })(Events); +export default connect(mapStateToProps, { getStaffEvents, deleteEvent })(Events); diff --git a/src/components/pages/Trainees.js b/src/components/pages/Trainees.js index b8b3c5dd28b45f27c8661f70e534d8e08e9a84dc..804c801a8b82f25d8b33da7d5c8732dd15399413 100644 --- a/src/components/pages/Trainees.js +++ b/src/components/pages/Trainees.js @@ -1,12 +1,12 @@ import React, { Component } from 'react'; import { Container, Table, Icon } from 'semantic-ui-react'; import { connect } from 'react-redux'; -import { getTrainees, getEvents } from '../../actions/statistics'; +import { getTrainees, getStaffEvents } from '../../actions/statistics'; class Trainees extends Component { componentWillMount() { this.props.getTrainees(); - this.props.getEvents(); + this.props.getStaffEvents(); } renderVisitedStatus(trainee) { @@ -66,4 +66,4 @@ class Trainees extends Component { const mapStateToProps = ({ trainees: { trainees }, events: { events }, user }) => ({ trainees, events, user }); -export default connect(mapStateToProps, { getTrainees, getEvents })(Trainees); +export default connect(mapStateToProps, { getTrainees, getStaffEvents })(Trainees);