1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

adjust loan form to disable dates

This commit is contained in:
Tim Daubenschütz 2015-08-26 18:01:50 +02:00
parent e473b4c779
commit 6028812128
2 changed files with 12 additions and 2 deletions

View File

@ -173,6 +173,8 @@ let LoanForm = React.createClass({
<Property
name='startdate'
label={getLangText('Start date')}
editable={!this.props.startdate}
overrideForm={!!this.props.startdate}
hidden={!this.props.showStartDate}>
<InputDate
defaultValue={this.props.startdate}
@ -180,6 +182,8 @@ let LoanForm = React.createClass({
</Property>
<Property
name='enddate'
editable={!this.props.enddate}
overrideForm={!!this.props.enddate}
label={getLangText('End date')}
hidden={!this.props.showEndDate}>
<InputDate

View File

@ -9,7 +9,11 @@ let InputDate = React.createClass({
submitted: React.PropTypes.bool,
placeholderText: React.PropTypes.string,
onChange: React.PropTypes.func,
defaultValue: React.PropTypes.object
defaultValue: React.PropTypes.object,
// DatePicker implements the disabled attribute
// https://github.com/Hacker0x01/react-datepicker/blob/master/src/datepicker.jsx#L30
disabled: React.PropTypes.bool
},
getInitialState() {
@ -41,10 +45,12 @@ let InputDate = React.createClass({
});
},
render: function () {
render() {
console.log(this.props.disabled);
return (
<div>
<DatePicker
disabled={this.props.disabled}
dateFormat="YYYY-MM-DD"
selected={this.state.value_moment}
onChange={this.handleChange}