From 425ce698f9c6e7735fef55efab3ef1f1a74d39a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chif=20Gerg=C5=91?= <chifgeri97@gmail.com> Date: Wed, 23 Jan 2019 17:50:32 +0100 Subject: [PATCH] Add confirm to staff status --- src/components/pages/Applications.js | 10 +++++++--- src/reducers/TraineeReducer.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js index 93761d8..6fac333 100644 --- a/src/components/pages/Applications.js +++ b/src/components/pages/Applications.js @@ -3,6 +3,7 @@ import { Link } from 'react-router-dom'; import { Container, Table, Label, Button } from 'semantic-ui-react'; import { connect } from 'react-redux'; import { getProfiles, setStatus } from '../../actions/statistics'; +import ConfirmModal from '../forms/ConfirmModal'; class Applications extends Component { componentWillMount() { @@ -47,13 +48,16 @@ class Applications extends Component { </Table.Cell> } <Table.Cell> - <Button - onClick={() => this.props.setStatus(profile.id, 'Staff')} + <ConfirmModal + button = {<Button color='blue' size='tiny' > ADD STAFF STATUS - </Button> + </Button>} + text='staff jogot adsz neki' + onAccept={() => this.props.setStatus(profile.id, 'Staff')} + /> </Table.Cell> </Table.Row> ); diff --git a/src/reducers/TraineeReducer.js b/src/reducers/TraineeReducer.js index 06f01ec..526cd7a 100644 --- a/src/reducers/TraineeReducer.js +++ b/src/reducers/TraineeReducer.js @@ -14,7 +14,7 @@ export default (state = INITIAL_STATE, action) => { const index = state.profiles.findIndex(item => item.id === action.payload.id); state.profiles.splice(index, 1, action.payload); if (action.payload.id === state.selectedProfile.id) { - return { ...state, selectedProfile: action.payload }; + return { ...state, profiles: [...state.profiles], selectedProfile: action.payload }; } return { ...state, profiles: [...state.profiles] } default: -- GitLab