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

Use buttons instead of checkbox, get students not all profile in statistics

parent 37430cbd
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ export const getEventById = id => ( ...@@ -59,7 +59,7 @@ export const getEventById = id => (
export const getTrainees = () => ( export const getTrainees = () => (
async (dispatch) => { async (dispatch) => {
try { try {
const response = await axios.get('/api/v1/profiles/'); const response = await axios.get('/api/v1/profiles/', { params: { role: 'Student' } });
dispatch({ dispatch({
type: GET_TRAINEES, type: GET_TRAINEES,
payload: response.data, payload: response.data,
...@@ -82,11 +82,12 @@ export const visitorChange = ({ id, value }) => { ...@@ -82,11 +82,12 @@ export const visitorChange = ({ id, value }) => {
} }
}; };
export const submitVisitors = ({ id, visitors }) => ( export const submitVisitors = ({ id, visitors, absent }) => (
async () => { async () => {
try { try {
const response = await axios.patch(`/api/v1/staff_events/${id}/`, { const response = await axios.patch(`/api/v1/staff_events/${id}/`, {
visitors visitors,
absent,
}); });
} catch (e) { } catch (e) {
console.log(e); console.log(e);
......
...@@ -64,11 +64,23 @@ class TraineeTableRow extends Component { ...@@ -64,11 +64,23 @@ class TraineeTableRow extends Component {
</Table.Cell> </Table.Cell>
: :
<Table.Cell textAlign='center'> <Table.Cell textAlign='center'>
<Dropdown <Button
defaultValue={isVisitor ? 'Visitor' : isAbsent ? 'Absent' : 'No'} compact
selection icon={<Icon color='green' name='checkmark' />}
options={visitStates} color={isVisitor ? 'blue' : 'lightgrey'}
onChange={(_, v) => this.props.visitorChange({ id : trainee.id, value: v.value })} onClick={() => this.props.visitorChange({ id : trainee.id, value: 'Visitor' })}
/>
<Button
compact
icon={<Icon color='orange' name='minus' />}
color={isAbsent ? 'blue' : 'lightgrey'}
onClick={() => this.props.visitorChange({ id : trainee.id, value: 'Absent' })}
/>
<Button
compact
icon={<Icon color='red' name='cancel' />}
color={!isVisitor && !isAbsent ? 'blue' : 'lightgrey'}
onClick={() => this.props.visitorChange({ id : trainee.id, value: 'No' })}
/> />
</Table.Cell> </Table.Cell>
} }
......
...@@ -19,7 +19,11 @@ class Trainees extends Component { ...@@ -19,7 +19,11 @@ class Trainees extends Component {
} }
return ( return (
<Table.Cell textAlign='center'> <Table.Cell textAlign='center'>
<Icon color='red' name='cancel' /> { event.absent.includes(trainee.id) ?
<Icon color='orange' name='minus' />
:
<Icon color='red' name='cancel' />
}
</Table.Cell>); </Table.Cell>);
})); }));
} }
......
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