1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-30 13:41:57 +02: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 <Property
name='startdate' name='startdate'
label={getLangText('Start date')} label={getLangText('Start date')}
editable={!this.props.startdate}
overrideForm={!!this.props.startdate}
hidden={!this.props.showStartDate}> hidden={!this.props.showStartDate}>
<InputDate <InputDate
defaultValue={this.props.startdate} defaultValue={this.props.startdate}
@ -180,6 +182,8 @@ let LoanForm = React.createClass({
</Property> </Property>
<Property <Property
name='enddate' name='enddate'
editable={!this.props.enddate}
overrideForm={!!this.props.enddate}
label={getLangText('End date')} label={getLangText('End date')}
hidden={!this.props.showEndDate}> hidden={!this.props.showEndDate}>
<InputDate <InputDate

View File

@ -9,7 +9,11 @@ let InputDate = React.createClass({
submitted: React.PropTypes.bool, submitted: React.PropTypes.bool,
placeholderText: React.PropTypes.string, placeholderText: React.PropTypes.string,
onChange: React.PropTypes.func, 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() { getInitialState() {
@ -41,10 +45,12 @@ let InputDate = React.createClass({
}); });
}, },
render: function () { render() {
console.log(this.props.disabled);
return ( return (
<div> <div>
<DatePicker <DatePicker
disabled={this.props.disabled}
dateFormat="YYYY-MM-DD" dateFormat="YYYY-MM-DD"
selected={this.state.value_moment} selected={this.state.value_moment}
onChange={this.handleChange} onChange={this.handleChange}