54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import ReactDOM from 'react-dom';
|
|
import InfiniteCalendar from 'react-infinite-calendar';
|
|
import { DB } from '../static/storage';
|
|
//import 'react-infinite-calendar/styles.css'; // only needs to be imported once
|
|
|
|
const moment = require('moment');
|
|
|
|
export class Settings extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
name:"",
|
|
start:0
|
|
}
|
|
this.onChangeName = this.onChangeName.bind(this);
|
|
this.onChangeStart = this.onChangeStart.bind(this);
|
|
this.save = this.save.bind(this);
|
|
}
|
|
componentDidMount(){
|
|
this.setState({name:DB.loadSettings('name').val,start:DB.loadSettings('start').val});
|
|
|
|
}
|
|
onChangeName(e){
|
|
this.setState({name:e.target.value})
|
|
}
|
|
onChangeStart(e){
|
|
this.setState({start:e.target.value});
|
|
}
|
|
save(){
|
|
DB.saveSettings(this.state);
|
|
}
|
|
render() {
|
|
console.log(this.state)
|
|
return (
|
|
<div id="settings-frame">
|
|
Einstellungen
|
|
<div class="form-group ">
|
|
<label class="control-label " for="name">
|
|
Name
|
|
</label>
|
|
<input class="form-control" id="name" name="name" type="text" value={this.state.name} onChange={this.onChangeName}/>
|
|
</div>
|
|
<div class="form-group ">
|
|
<label class="control-label " for="name">
|
|
Anfangsdatum
|
|
</label>
|
|
<input class="form-control" id="name" name="name" type="date" onChange={this.onChangeStart} value={this.state.start} />
|
|
</div>
|
|
<button onClick={this.save}>Speichern</button>
|
|
</div>);
|
|
}
|
|
}
|