'use strict'; import React from 'react'; import classnames from 'classnames'; import Button from 'react-bootstrap/lib/Button'; import ContractAgreementProperty from './property_contract_agreement'; import Form from './form'; import InputTextAreaToggable from './input_textarea_toggable'; import InputDate from './input_date'; import Property from './property'; import AscribeSpinner from '../ascribe_spinner'; import AclInformation from '../ascribe_buttons/acl_information'; import { mergeOptions } from '../../utils/general_utils'; import { getLangText } from '../../utils/lang_utils'; let LoanForm = React.createClass({ propTypes: { loanHeading: React.PropTypes.string, email: React.PropTypes.string, gallery: React.PropTypes.string, startDate: React.PropTypes.object, endDate: React.PropTypes.object, showPersonalMessage: React.PropTypes.bool, showEndDate: React.PropTypes.bool, showStartDate: React.PropTypes.bool, showPassword: React.PropTypes.bool, url: React.PropTypes.string, id: React.PropTypes.object, message: React.PropTypes.string, createPublicContractAgreement: React.PropTypes.bool, handleSuccess: React.PropTypes.func, children: React.PropTypes.oneOfType([ React.PropTypes.object, React.PropTypes.array ]) }, getDefaultProps() { return { loanHeading: '', showPersonalMessage: true, showEndDate: true, showStartDate: true, showPassword: true }; }, getInitialState() { return { email: this.props.email || '' }; }, getFormData() { return mergeOptions( this.props.id, this.refs.contractAgreement.getFormDataForProperty() ); }, handleEmailOnChange(event) { // event.target.value is the submitted email of the loanee this.setState({ email: event && event.target && event.target.value || '' }); }, handleReset(event) { this.handleEmailOnChange(); }, getButtons() { if(this.props.loanHeading) { return ( ); } else { return (

); } }, render() { const { email } = this.state; const { children, createPublicContractAgreement, email: defaultEmail, handleSuccess, gallery, loanHeading, message, showPersonalMessage, endDate, startDate, showEndDate, showStartDate, showPassword, url } = this.props; return (

}>

{loanHeading}

{children} ); } }); export default LoanForm;