diff --git a/src/actions/statistics.js b/src/actions/statistics.js index 5f715ae0e0ce683a571b00b3c36f69aa43f76009..7d546bc6cecdd6f6970ed7cd03fe367899d1d9b2 100644 --- a/src/actions/statistics.js +++ b/src/actions/statistics.js @@ -9,6 +9,7 @@ import { DELETE_EVENT, GET_TRAINEE_BY_ID, GET_PROFILES, + SET_STAFF, } from './types'; export const getEvents = () => ( @@ -149,3 +150,18 @@ export const getProfiles = () => ( } } ); + +export const setStaffStatus = id => ( + async (dispatch) => { + try { + const response = await axios.patch(`/api/v1/profiles/${id}/`, { + signed: true, + role: 'Staff', + }); + if (response.data.id) { + } + } catch (e) { + console.log(e); + } + } +); diff --git a/src/actions/types.js b/src/actions/types.js index e3986ff5c7a373828f64f91050f7622453a7dc50..01474815cc79abdf021d92fc75f132f2d31f6386 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -28,3 +28,4 @@ export const CLEAR_NOTE = 'clear_note'; export const ADD_EVENT_NOTE = 'add_note'; export const GET_PROFILES = 'get_profiles'; +export const SET_STAFF = 'set_staff'; diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js index b6ae6007d20eda175d0ac6b322034fcf50332bf4..47b12b72c55c22a517a1ddef8c220c3451afc89d 100644 --- a/src/components/pages/Applications.js +++ b/src/components/pages/Applications.js @@ -1,9 +1,9 @@ import React, { Component } from 'react'; import moment from 'moment'; import { Link } from 'react-router-dom'; -import { Container, Table, Icon } from 'semantic-ui-react'; +import { Container, Table, Icon, Button } from 'semantic-ui-react'; import { connect } from 'react-redux'; -import { getProfiles } from '../../actions/statistics'; +import { getProfiles, setStaffStatus } from '../../actions/statistics'; class Applications extends Component { componentWillMount() { @@ -29,6 +29,15 @@ class Applications extends Component { <Icon color='red' name='cancel' /> } </Table.Cell> + <Table.Cell> + <Button + onClick={() => this.props.setStaffStatus(profile.id)} + color='blue' + size='tiny' + > + ADD STAFF STATUS + </Button> + </Table.Cell> </Table.Row> ); }); @@ -47,6 +56,7 @@ class Applications extends Component { <Table.Row> <Table.HeaderCell>Jelentkezettek</Table.HeaderCell> <Table.HeaderCell>JelentkezĂŠs elfogadva:</Table.HeaderCell> + <Table.HeaderCell /> </Table.Row> </Table.Header> @@ -61,4 +71,4 @@ class Applications extends Component { const mapStateToProps = ({ trainees: { profiles }, user }) => ({ profiles, user }); -export default connect(mapStateToProps, { getProfiles })(Applications); +export default connect(mapStateToProps, { getProfiles, setStaffStatus })(Applications);