'use strict'; import React from 'react'; import LoanContractListActions from '../../actions/loan_contract_list_actions'; import LoanContractListStore from '../../stores/loan_contract_list_store'; import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationActions from '../../actions/global_notification_actions'; import Form from './form'; import Property from './property'; import PropertyCollapsible from './property_collapsible'; import InputTextAreaToggable from './input_textarea_toggable'; import ApiUrls from '../../constants/api_urls'; import { getLangText } from '../../utils/lang_utils'; import { mergeOptions } from '../../utils/general_utils'; let ContractForm = React.createClass({ propTypes: { handleSuccess: React.PropTypes.func }, getInitialState() { return mergeOptions( LoanContractListStore.getState(), { selectedContract: 0 } ); }, componentDidMount() { LoanContractListStore.listen(this.onChange); LoanContractListActions.fetchLoanContractList(); }, componentWillUnmount() { LoanContractListStore.unlisten(this.onChange); }, onChange(state) { this.setState(state); }, onContractChange(event){ this.setState({selectedContract: event.target.selectedIndex}); }, handleSubmitSuccess(response) { let notification = new GlobalNotificationModel(response.notification, 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, getContracts() { if (this.state.contractList && this.state.contractList.length > 0) { return ( {getLangText('Learn more')} }> ); } return null; }, render() { return (
{getLangText('Send loan request')} } spinner={ }>

{getLangText('Contract form')}

{this.getContracts()} {getLangText('Appendix')}
); } }); export default ContractForm;