Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import React, { Component } from "react";
import Form from 'react-bootstrap/Form';
import Button from "react-bootstrap/esm/Button";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import * as degreeCourseManagementActions from "../../actions/DegreeCourseManagementActions"
const mapStateToProps = state => {
return {
accessToken: state.AuthenticationReducer.accessToken
};
}
class CreateNewUserForm extends Component {
constructor(props) {
super(props);
this.state = {
name: '',
shortName: '',
universityName: '',
universityShortName: '',
departmentName: '',
departmentShortName: ''
}
this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this);
}
handleChange(e) {
const { name, value } = e.target;
this.setState({ [name]: value })
console.log(JSON.stringify(this.state))
}
async handleSubmit(e) {
e.preventDefault();
const { createNewDegreeCourseAction } = this.props;
console.log("degreeCourse sollte angelegt werden")
this.props.goBack()
await createNewDegreeCourseAction(this.state, this.props.accessToken)
}
render() {
return (
<div style={{ display: 'flex', justifyContent: 'center', textAlign: 'left' }}>
<Form style={{ width: '60rem' }}>
<Form.Group className="mb-3">
<Form.Label>Studiengang-Name</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditDegreeCourseName" name='name' type="text" placeholder="Bitte Namen des Studiengangs eingeben" onChange={this.handleChange} required />
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Studiengang-Kurzbezeichnung</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditFirstShortName" name="shortName" type="text" placeholder="Bitte Kurzbezeichnung des Studiengangs eingeben" onChange={this.handleChange} />
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Universität-Name</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditUniversityName" name="universityName" type="text" placeholder="Bitte Namen der Universität eingeben" onChange={this.handleChange} />
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Universität-Kurzbezeichnung</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditUniversityShortName" name="universityShortName" type="text" placeholder="Bitte Kurzbezeichnung der Universität eingeben" onChange={this.handleChange} required />
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Fachbereich-Name</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditDepartmentName" name="departmentName" type="text" placeholder="Bitte Namen des Fachbereichs eingeben" onChange={this.handleChange} />
</Form.Group>
<Form.Group className="mb-3">
<Form.Label>Fachbereich-Kurzbezeichnung</Form.Label>
<Form.Control id="CreateDegreeCourseComponentEditDepartmentShortName" name="departmentShortName" type="text" placeholder="Bitte Kurzbezeichnung des Fachbereichs eingeben" onChange={this.handleChange} />
</Form.Group>
<Button id="CreateDegreeCourseComponentCreateDegreeCourseButton" variant="primary" type="submit" onClick={this.handleSubmit}>
Anlegen
</Button>
<Button id="CreateDegreeCourseComponentCreateDegreeCourseButton" variant="primary" type="submit" onClick={this.props.goBack}>
Studiengang-Liste
</Button>
</Form>
</div >
)
}
}
const mapDispatchToProps = dispatch => bindActionCreators({
createNewDegreeCourseAction: degreeCourseManagementActions.passNewDegreeCourse,
showAllDegreeCourses: degreeCourseManagementActions.displayDegreeCourses
}, dispatch)
const ConnectedUserForm = connect(mapStateToProps, mapDispatchToProps)(CreateNewUserForm)
export default ConnectedUserForm