From 3f04c1eb5b89754c7699f1b2485099dd39758a39 Mon Sep 17 00:00:00 2001 From: rlacko <rlacko@sch.bme.hu> Date: Thu, 6 Feb 2020 21:48:31 +0100 Subject: [PATCH] admin create Task with bits --- src/actions/homework.js | 3 ++- src/components/forms/AddTaskForm.js | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/actions/homework.js b/src/actions/homework.js index 729899e..3d24ed5 100644 --- a/src/actions/homework.js +++ b/src/actions/homework.js @@ -45,13 +45,14 @@ export const getSolutions = taskId => ( } ); -export const addTask = ({ title, text, deadline }) => ( +export const addTask = ({ title, text, deadline, bits }) => ( async (dispatch) => { try { const response = await axios.post('/api/v1/homework/tasks/', { title, text, deadline, + bits, }); if (response.data.id) { dispatch({ diff --git a/src/components/forms/AddTaskForm.js b/src/components/forms/AddTaskForm.js index 6b386a7..46f74bb 100644 --- a/src/components/forms/AddTaskForm.js +++ b/src/components/forms/AddTaskForm.js @@ -14,7 +14,7 @@ class AddTaskForm extends Component { } render() { - const { title, text, deadline } = this.props.newTask; + const { title, text, deadline, bits = 1 } = this.props.newTask; return ( <Modal open={this.state.showModal} @@ -62,6 +62,15 @@ class AddTaskForm extends Component { }} value={deadline} /> + <Form.Field + control={Input} + type='number' + label='Bitek szĂĄma:' + name='bits' + onChange={e => this.props.writeTask(e)} + value={bits} + placeholder='Add meg a feladatĂŠrt kaphatĂł bitek szĂĄmĂĄt ...' + /> </Form> </Modal.Content> <Modal.Actions> @@ -85,7 +94,7 @@ class AddTaskForm extends Component { deadline === '' || moment().isAfter(deadline) } onClick={() => { - this.props.addTask({ title, text, deadline }); + this.props.addTask({ title, text, deadline, bits }); this.setState({ showModal: false }); this.props.clearWrite(); }} -- GitLab