Skip to content
Snippets Groups Projects
Commit a65ad842 authored by Bereczki Sandor's avatar Bereczki Sandor
Browse files

You can no longer send expired homeworks.

parent 03812bf7
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { addSolution, writeSolution, writeSolutionFile, addDocument, clearWrite } from '../../actions/homework';
import './Forms.css';
import ConfirmModal from '../forms/ConfirmModal';
import { emptyMessage } from '../pages/Homework';
class AddSolutionForm extends Component {
constructor(props) {
......@@ -22,46 +23,53 @@ class AddSolutionForm extends Component {
const accepted = false;
const sentences = this.props.taskdesc.split('\n');
const note = '';
const disabledText = 'A határidő lejárt, további beadás nem lehetséges.'
return (
<Modal
open={this.state.showModal}
trigger={
<button id='task' onClick={() => { this.setState({ showModal: true }); }}>
<button
id='task'
onClick={() => { this.setState({ showModal: true }); }}
>
<Icon name='external' />
{this.props.tasktitle}
</button>
}
>
<Modal.Header>
{this.props.multiple ? 'Másik' : 'Új'} megoldás beadása a(z) {this.props.tasktitle} nevű feladathoz:
{this.props.multiple ? 'Másik megoldás' : 'Megoldás'} beadása a(z) {this.props.tasktitle} nevű feladathoz:
</Modal.Header>
<Modal.Content>
<Modal.Description style={{ marginBottom: '2em' }}>
<Header as='h5'>Feladat leírása:</Header>
{sentences.map(s => (<p>{s}</p>))}
</Modal.Description>
<Form>
<Form.Field
control={Input}
label='Megoldás címe:'
name='name'
onChange={e => this.props.writeSolution(e)}
value={name}
placeholder='Adj meg egy címet a beadandó megoldásodnak...'
/>
<Form.Field
control={TextArea}
label='Megoldás leírása:'
name='description'
onChange={e => this.props.writeSolution(e)}
value={description}
placeholder='Add meg a megoldás leírását...'
/>
<Form.Field>
<label>Fájl:</label>
<Input type='file' onChange={e => this.props.writeSolutionFile(e)} />
</Form.Field>
</Form>
{this.props.disabled ?
emptyMessage(disabledText, undefined, undefined, this.props.disabled) :
<Form>
<Form.Field
control={Input}
label='Megoldás címe:'
name='name'
onChange={e => this.props.writeSolution(e)}
value={name}
placeholder='Adj meg egy címet a beadandó megoldásodnak...'
/>
<Form.Field
control={TextArea}
label='Megoldás leírása:'
name='description'
onChange={e => this.props.writeSolution(e)}
value={description}
placeholder='Add meg a megoldás leírását...'
/>
<Form.Field>
<label>Fájl:</label>
<Input type='file' onChange={e => this.props.writeSolutionFile(e)} />
</Form.Field>
</Form>
}
</Modal.Content>
<Modal.Actions>
<Button
......
......@@ -120,6 +120,7 @@ class Homework extends Component {
tasktitle={task.title}
taskdesc={task.text}
multiple={this.getTaskDisplayStyle(task) !== 'can_submit'}
disabled={moment().isAfter(task.deadline)}
/>
</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