2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
2015-05-29 15:16:42 +02:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import ApiUrls from '../../constants/api_urls';
|
|
|
|
import FormMixin from '../../mixins/form_mixin';
|
|
|
|
import InputText from './input_text';
|
|
|
|
import InputTextArea from './input_textarea';
|
2015-06-03 10:27:11 +02:00
|
|
|
import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
|
2015-05-29 15:16:42 +02:00
|
|
|
|
|
|
|
let ConsignForm = React.createClass({
|
|
|
|
mixins: [FormMixin],
|
|
|
|
|
2015-06-09 16:10:38 +02:00
|
|
|
|
2015-05-29 15:16:42 +02:00
|
|
|
url() {
|
2015-06-05 11:06:36 +02:00
|
|
|
return ApiUrls.ownership_consigns;
|
2015-05-29 15:16:42 +02:00
|
|
|
},
|
2015-06-05 11:06:36 +02:00
|
|
|
|
2015-05-29 15:16:42 +02:00
|
|
|
getFormData() {
|
|
|
|
return {
|
2015-06-02 11:38:18 +02:00
|
|
|
bitcoin_id: this.getBitcoinIds().join(),
|
2015-05-29 15:16:42 +02:00
|
|
|
consignee: this.refs.consignee.state.value,
|
|
|
|
consign_message: this.refs.consign_message.state.value,
|
|
|
|
password: this.refs.password.state.value
|
2015-06-05 11:06:36 +02:00
|
|
|
};
|
2015-05-29 15:16:42 +02:00
|
|
|
},
|
2015-06-02 11:38:18 +02:00
|
|
|
|
2015-05-29 15:16:42 +02:00
|
|
|
renderForm() {
|
2015-06-05 11:06:36 +02:00
|
|
|
let title = this.getTitlesString().join('');
|
2015-05-29 15:16:42 +02:00
|
|
|
let username = this.props.currentUser.username;
|
|
|
|
let message =
|
|
|
|
`Hi,
|
|
|
|
|
2015-06-02 11:38:18 +02:00
|
|
|
I consign :
|
|
|
|
${title}to you.
|
2015-05-29 15:16:42 +02:00
|
|
|
|
|
|
|
Truly yours,
|
|
|
|
${username}`;
|
|
|
|
|
|
|
|
return (
|
2015-05-29 16:53:30 +02:00
|
|
|
<form id="consign_modal_content" role="form" onSubmit={this.submit}>
|
2015-05-29 15:16:42 +02:00
|
|
|
<input className="invisible" type="email" name="fake_consignee"/>
|
|
|
|
<input className="invisible" type="password" name="fake_password"/>
|
|
|
|
<InputText
|
|
|
|
ref="consignee"
|
|
|
|
placeHolder="Consignee email"
|
|
|
|
required="required"
|
|
|
|
type="email"
|
|
|
|
submitted={this.state.submitted}/>
|
|
|
|
<InputTextArea
|
|
|
|
ref="consign_message"
|
|
|
|
defaultValue={message}
|
|
|
|
required=""
|
|
|
|
/>
|
|
|
|
<InputText
|
|
|
|
ref="password"
|
|
|
|
placeHolder="Password"
|
|
|
|
required="required"
|
|
|
|
type="password"
|
|
|
|
submitted={this.state.submitted}/>
|
|
|
|
<ButtonSubmitOrClose
|
|
|
|
text="CONSIGN"
|
|
|
|
onClose={this.props.onRequestHide}
|
|
|
|
submitted={this.state.submitted} />
|
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default ConsignForm;
|