mirror of
https://github.com/ascribe/onion.git
synced 2024-06-25 18:56:28 +02:00
Special white label form settings only defined for consign form for now, but could be added to others as needed.
90 lines
3.0 KiB
JavaScript
90 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
import React from 'react';
|
|
|
|
import Button from 'react-bootstrap/lib/Button';
|
|
|
|
import Form from './form';
|
|
import Property from './property';
|
|
import InputTextAreaToggable from './input_textarea_toggable';
|
|
|
|
import AscribeSpinner from '../ascribe_spinner';
|
|
import { getLangText } from '../../utils/lang_utils.js';
|
|
|
|
import { getSubdomainFormSettings } from '../../utils/form_utils';
|
|
|
|
let ConsignForm = React.createClass({
|
|
propTypes: {
|
|
url: React.PropTypes.string,
|
|
id: React.PropTypes.object,
|
|
message: React.PropTypes.string,
|
|
handleSuccess: React.PropTypes.func
|
|
},
|
|
|
|
getFormData(){
|
|
return this.props.id;
|
|
},
|
|
|
|
render() {
|
|
let envSettings = getSubdomainFormSettings('consign');
|
|
|
|
return (
|
|
<Form
|
|
ref='form'
|
|
url={this.props.url}
|
|
getFormData={this.getFormData}
|
|
handleSuccess={this.props.handleSuccess}
|
|
buttons={
|
|
<div className="modal-footer">
|
|
<p className="pull-right">
|
|
<Button
|
|
className="btn btn-default btn-sm ascribe-margin-1px"
|
|
type="submit">
|
|
{getLangText('CONSIGN')}
|
|
</Button>
|
|
</p>
|
|
</div>}
|
|
spinner={
|
|
<div className="modal-footer">
|
|
<p className="pull-right">
|
|
<AscribeSpinner color='dark-blue' size='md'/>
|
|
</p>
|
|
</div>}>
|
|
<Property
|
|
name='consignee'
|
|
label={getLangText('Email')}
|
|
editable={!envSettings.consigneeDisabled}
|
|
overrideForm={true}>
|
|
<input
|
|
type="email"
|
|
placeholder={getLangText('Email of the consignee')}
|
|
defaultValue={envSettings.consignee}
|
|
required/>
|
|
</Property>
|
|
<Property
|
|
name='consign_message'
|
|
label={getLangText('Personal Message')}
|
|
editable={true}
|
|
overrideForm={true}>
|
|
<InputTextAreaToggable
|
|
rows={1}
|
|
defaultValue={this.props.message}
|
|
placeholder={getLangText('Enter a message...')}
|
|
required="required"/>
|
|
</Property>
|
|
<Property
|
|
name='password'
|
|
label={getLangText('Password')}>
|
|
<input
|
|
type="password"
|
|
placeholder={getLangText('Enter your password')}
|
|
required/>
|
|
</Property>
|
|
<hr />
|
|
</Form>
|
|
);
|
|
}
|
|
});
|
|
|
|
export default ConsignForm;
|