2016-06-02 16:21:14 -04:00
|
|
|
var React = require('react');
|
|
|
|
|
2016-06-14 17:26:29 -04:00
|
|
|
var api = require('../../lib/api');
|
2016-06-03 12:00:00 -04:00
|
|
|
var countryData = require('../../lib/country-data');
|
2016-06-07 18:04:18 -04:00
|
|
|
var intl = require('../../lib/intl.jsx');
|
2016-06-06 10:10:27 -04:00
|
|
|
var log = require('../../lib/log');
|
|
|
|
var smartyStreets = require('../../lib/smarty-streets');
|
2016-06-03 11:27:59 -04:00
|
|
|
|
2016-06-02 16:21:14 -04:00
|
|
|
var Button = require('../../components/forms/button.jsx');
|
2016-06-15 15:08:56 -04:00
|
|
|
var Card = require('../../components/card/card.jsx');
|
2016-06-02 16:21:14 -04:00
|
|
|
var Checkbox = require('../../components/forms/checkbox.jsx');
|
|
|
|
var CheckboxGroup = require('../../components/forms/checkbox-group.jsx');
|
|
|
|
var Form = require('../../components/forms/form.jsx');
|
|
|
|
var Input = require('../../components/forms/input.jsx');
|
|
|
|
var PhoneInput = require('../../components/forms/phone-input.jsx');
|
|
|
|
var RadioGroup = require('../../components/forms/radio-group.jsx');
|
|
|
|
var Select = require('../../components/forms/select.jsx');
|
2016-06-15 15:08:56 -04:00
|
|
|
var Slide = require('../../components/slide/slide.jsx');
|
2016-06-06 10:10:27 -04:00
|
|
|
var Spinner = require('../../components/spinner/spinner.jsx');
|
2016-06-16 10:54:36 -04:00
|
|
|
var StepNavigation = require('../../components/stepnavigation/stepnavigation.jsx');
|
2016-06-02 16:21:14 -04:00
|
|
|
var TextArea = require('../../components/forms/textarea.jsx');
|
|
|
|
|
2016-06-03 11:27:59 -04:00
|
|
|
var DEFAULT_COUNTRY = 'us';
|
2016-06-02 16:21:14 -04:00
|
|
|
|
|
|
|
module.exports = {
|
2016-06-07 18:04:18 -04:00
|
|
|
UsernameStep: intl.injectIntl(React.createClass({
|
2016-06-07 09:57:05 -04:00
|
|
|
getInitialState: function () {
|
2016-06-14 17:26:29 -04:00
|
|
|
return {
|
|
|
|
showPassword: false,
|
|
|
|
waiting: false
|
|
|
|
};
|
2016-06-07 09:57:05 -04:00
|
|
|
},
|
|
|
|
onChangeShowPassword: function (field, value) {
|
|
|
|
this.setState({showPassword: value});
|
|
|
|
},
|
2016-06-14 17:26:29 -04:00
|
|
|
onValidSubmit: function (formData, reset, invalidate) {
|
|
|
|
this.setState({waiting: true});
|
|
|
|
api({
|
|
|
|
host: '',
|
|
|
|
uri: '/accounts/check_username/' + formData.user.username + '/'
|
|
|
|
}, function (err, res) {
|
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
|
|
|
this.setState({waiting: false});
|
|
|
|
if (err) return invalidate({all: err});
|
|
|
|
res = res[0];
|
|
|
|
switch (res.msg) {
|
|
|
|
case 'valid username':
|
|
|
|
return this.props.onNextStep();
|
|
|
|
case 'username exists':
|
|
|
|
return invalidate({
|
|
|
|
'user.username': formatMessage({id: 'general.validationUsernameExists'})
|
|
|
|
});
|
|
|
|
case 'bad username':
|
|
|
|
return invalidate({
|
|
|
|
'user.username': formatMessage({id: 'general.validationUsernameVulgar'})
|
|
|
|
});
|
|
|
|
case 'invalid username':
|
|
|
|
default:
|
|
|
|
return invalidate({
|
|
|
|
'user.username': formatMessage({id: 'general.validationUsernameInvalid'})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}.bind(this));
|
|
|
|
},
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-07 18:04:18 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1><intl.FormattedMessage id="teacherRegistration.usernameStepTitle" /></h1>
|
|
|
|
<p className="description">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.usernameStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.onValidSubmit}>
|
|
|
|
<Input label={formatMessage({id: 'general.username'})}
|
|
|
|
type="text"
|
|
|
|
name="user.username"
|
|
|
|
validations={{
|
|
|
|
matchRegexp: /^[\w-]*$/,
|
|
|
|
minLength: 3,
|
|
|
|
maxLength: 20
|
|
|
|
}}
|
|
|
|
validationErrors={{
|
|
|
|
matchRegexp: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationUsernameRegexp'
|
|
|
|
}),
|
|
|
|
minLength: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationUsernameMinLength'
|
|
|
|
}),
|
|
|
|
maxLength: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationUsernameMaxLength'
|
|
|
|
})
|
|
|
|
}}
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'general.password'})}
|
|
|
|
type={this.state.showPassword ? 'text' : 'password'}
|
|
|
|
name="user.password"
|
|
|
|
validations={{
|
|
|
|
minLength: 6,
|
|
|
|
notEquals: 'password',
|
|
|
|
notEqualsField: 'user.username'
|
|
|
|
}}
|
|
|
|
validationErrors={{
|
|
|
|
minLength: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationPasswordLength'
|
|
|
|
}),
|
|
|
|
notEquals: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationPasswordNotEquals'
|
|
|
|
}),
|
|
|
|
notEqualsField: formatMessage({
|
|
|
|
id: 'teacherRegistration.validationPasswordNotUsername'
|
|
|
|
})
|
|
|
|
}}
|
|
|
|
required />
|
|
|
|
<Checkbox label={formatMessage({id: 'teacherRegistration.showPassword'})}
|
|
|
|
value={this.state.showPassword}
|
|
|
|
onChange={this.onChangeShowPassword}
|
|
|
|
help={null}
|
|
|
|
name="showPassword" />
|
|
|
|
<Button type="submit" disabled={this.state.waiting} className="card-button">
|
|
|
|
{this.state.waiting ?
|
|
|
|
<Spinner /> :
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
}
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-07 18:04:18 -04:00
|
|
|
})),
|
|
|
|
DemographicsStep: intl.injectIntl(React.createClass({
|
2016-06-03 11:27:59 -04:00
|
|
|
getDefaultProps: function () {
|
|
|
|
return {defaultCountry: DEFAULT_COUNTRY};
|
|
|
|
},
|
2016-06-02 16:21:14 -04:00
|
|
|
getInitialState: function () {
|
|
|
|
return {otherDisabled: true};
|
|
|
|
},
|
2016-06-07 18:04:18 -04:00
|
|
|
getMonthOptions: function () {
|
|
|
|
return [
|
2016-06-02 16:21:14 -04:00
|
|
|
'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
|
|
|
'August', 'September', 'October', 'November', 'December'
|
|
|
|
].map(function (label, id) {
|
2016-06-07 18:04:18 -04:00
|
|
|
return {
|
|
|
|
value: id+1,
|
|
|
|
label: this.props.intl.formatMessage({id: 'general.month' + label})};
|
|
|
|
}.bind(this));
|
|
|
|
},
|
|
|
|
getYearOptions: function () {
|
|
|
|
return Array.apply(null, Array(100)).map(function (v, id) {
|
2016-06-02 16:21:14 -04:00
|
|
|
var year = 2016 - id;
|
|
|
|
return {value: year, label: year};
|
|
|
|
});
|
2016-06-07 18:04:18 -04:00
|
|
|
},
|
|
|
|
onChooseGender: function (name, gender) {
|
|
|
|
this.setState({otherDisabled: gender !== 'other'});
|
|
|
|
},
|
|
|
|
render: function () {
|
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.personalStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p className="description">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.personalStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<Select label={formatMessage({id: 'general.birthMonth'})}
|
|
|
|
name="user.birth.month"
|
|
|
|
options={this.getMonthOptions()}
|
|
|
|
required />
|
|
|
|
<Select label={formatMessage({id: 'general.birthYear'})}
|
|
|
|
name="user.birth.year"
|
|
|
|
options={this.getYearOptions()} required />
|
|
|
|
<RadioGroup label={formatMessage({id: 'general.gender'})}
|
|
|
|
name="user.gender"
|
|
|
|
onChange={this.onChooseGender}
|
|
|
|
options={[
|
|
|
|
{value: 'female', label: formatMessage({id: 'general.female'})},
|
|
|
|
{value: 'male', label: formatMessage({id: 'general.male'})},
|
|
|
|
{value: 'other', label: formatMessage({id: 'general.other'})}
|
|
|
|
]}
|
|
|
|
required />
|
|
|
|
<Input name="user.genderOther"
|
|
|
|
type="text"
|
|
|
|
disabled={this.state.otherDisabled}
|
|
|
|
required={!this.state.otherDisabled}
|
|
|
|
help={null} />
|
|
|
|
<Select label={formatMessage({id: 'general.country'})}
|
|
|
|
name="user.country"
|
|
|
|
options={countryData.countryOptions}
|
|
|
|
value={this.props.defaultCountry}
|
2016-06-02 16:21:14 -04:00
|
|
|
required />
|
2016-06-15 15:08:56 -04:00
|
|
|
<Checkbox className="demographics-checkbox-is-robot"
|
|
|
|
label="I'm a robot!"
|
|
|
|
name="user.isRobot" />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-07 18:04:18 -04:00
|
|
|
})),
|
|
|
|
NameStep: intl.injectIntl(React.createClass({
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-07 18:04:18 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nameStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p className="description">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nameStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.firstName'})}
|
|
|
|
type="text"
|
|
|
|
name="user.name.first"
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.lastName'})}
|
|
|
|
type="text"
|
|
|
|
name="user.name.last"
|
|
|
|
required />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-07 18:04:18 -04:00
|
|
|
})),
|
|
|
|
PhoneNumberStep: intl.injectIntl(React.createClass({
|
2016-06-03 11:27:59 -04:00
|
|
|
getDefaultProps: function () {
|
|
|
|
return {defaultCountry: DEFAULT_COUNTRY};
|
|
|
|
},
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-07 18:04:18 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.phoneStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.phoneStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<PhoneInput label={formatMessage({id: 'teacherRegistration.phoneNumber'})}
|
|
|
|
name="phone"
|
|
|
|
defaultCountry={
|
|
|
|
(this.props.formData.user && this.props.formData.user.country) ||
|
|
|
|
this.props.defaultCountry
|
|
|
|
}
|
|
|
|
required />
|
|
|
|
<Checkbox label={formatMessage({id: 'teacherRegistration.phoneConsent'})}
|
|
|
|
name="phoneConsent"
|
|
|
|
required="isFalse"
|
|
|
|
validationErrors={{
|
|
|
|
isFalse: formatMessage({id: 'teacherRegistration.validationPhoneConsent'})
|
|
|
|
}} />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-07 18:04:18 -04:00
|
|
|
})),
|
|
|
|
OrganizationStep: intl.injectIntl(React.createClass({
|
2016-06-02 16:21:14 -04:00
|
|
|
getInitialState: function () {
|
|
|
|
return {
|
|
|
|
otherDisabled: true
|
|
|
|
};
|
|
|
|
},
|
2016-06-07 18:04:18 -04:00
|
|
|
getOrganizationOptions: function () {
|
2016-06-13 13:29:37 -04:00
|
|
|
return [
|
|
|
|
'orgChoiceElementarySchool',
|
|
|
|
'orgChoiceMiddleSchool',
|
|
|
|
'orgChoiceHighSchool',
|
|
|
|
'orgChoiceUniversity',
|
|
|
|
'orgChoiceAfterschool',
|
|
|
|
'orgChoiceMuseum',
|
|
|
|
'orgChoiceLibrary',
|
|
|
|
'orgChoiceCamp',
|
|
|
|
'orgChoiceOther'
|
|
|
|
].map(function (choice, id) {
|
2016-06-07 18:04:18 -04:00
|
|
|
return {
|
2016-06-13 13:29:37 -04:00
|
|
|
value: id,
|
2016-06-07 18:04:18 -04:00
|
|
|
label: this.props.intl.formatMessage({
|
2016-06-13 13:29:37 -04:00
|
|
|
id: 'teacherRegistration.' + choice
|
2016-06-07 18:04:18 -04:00
|
|
|
})
|
|
|
|
};
|
|
|
|
}.bind(this));
|
|
|
|
},
|
2016-06-02 16:21:14 -04:00
|
|
|
onChooseOrganization: function (name, values) {
|
|
|
|
this.setState({otherDisabled: values.indexOf('Other') === -1});
|
|
|
|
},
|
|
|
|
render: function () {
|
2016-06-13 13:29:37 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.orgStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.orgStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.organization'})}
|
|
|
|
type="text"
|
|
|
|
name="organization.name"
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.orgTitle'})}
|
|
|
|
type="text"
|
|
|
|
name="organization.title"
|
|
|
|
required />
|
|
|
|
<CheckboxGroup label={formatMessage({id: 'teacherRegistration.orgType'})}
|
|
|
|
help={formatMessage({id: 'teacherRegistration.checkAll'})}
|
|
|
|
name="organization.type"
|
|
|
|
value={[]}
|
|
|
|
options={this.getOrganizationOptions()}
|
|
|
|
onChange={this.onChooseOrganization}
|
|
|
|
required />
|
|
|
|
<Input type="text"
|
|
|
|
name="organization.other"
|
|
|
|
disabled={this.state.otherDisabled}
|
|
|
|
required={!this.state.otherDisabled} />
|
|
|
|
<Input label={formatMessage({id: 'general.website'})}
|
|
|
|
help={formatMessage({id: 'general.notRequired'})}
|
|
|
|
type="url"
|
|
|
|
name="organization.url" />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-07 18:04:18 -04:00
|
|
|
})),
|
2016-06-13 13:29:37 -04:00
|
|
|
AddressStep: intl.injectIntl(React.createClass({
|
2016-06-03 11:27:59 -04:00
|
|
|
getDefaultProps: function () {
|
|
|
|
return {defaultCountry: DEFAULT_COUNTRY};
|
|
|
|
},
|
2016-06-03 12:00:00 -04:00
|
|
|
getInitialState: function () {
|
|
|
|
return {
|
|
|
|
countryChoice: (
|
|
|
|
(this.props.formData.user && this.props.formData.user.country) ||
|
|
|
|
this.props.defaultCountry
|
2016-06-06 10:10:27 -04:00
|
|
|
),
|
|
|
|
waiting: false
|
2016-06-03 12:00:00 -04:00
|
|
|
};
|
|
|
|
},
|
|
|
|
onChangeCountry: function (field, choice) {
|
|
|
|
this.setState({countryChoice: choice});
|
|
|
|
},
|
2016-06-06 10:10:27 -04:00
|
|
|
onValidSubmit: function (formData, reset, invalidate) {
|
|
|
|
if (formData.address.country !== 'us') {
|
|
|
|
return this.props.onNextStep(formData);
|
|
|
|
}
|
|
|
|
this.setState({waiting: true});
|
|
|
|
var address = {
|
|
|
|
street: formData.address.line1,
|
|
|
|
secondary: formData.address.line2 || '',
|
|
|
|
city: formData.address.city,
|
|
|
|
state: formData.address.state,
|
|
|
|
zipcode: formData.address.zip
|
|
|
|
};
|
|
|
|
smartyStreets(address, function (err, res) {
|
|
|
|
this.setState({waiting: false});
|
|
|
|
if (err) {
|
|
|
|
// We don't want to prevent registration because
|
|
|
|
// address validation isn't working. Log it and
|
|
|
|
// move on.
|
|
|
|
log.error(err);
|
|
|
|
return this.props.onNextStep(formData);
|
|
|
|
}
|
|
|
|
if (res && res.length > 0) {
|
|
|
|
return this.props.onNextStep(formData);
|
|
|
|
} else {
|
|
|
|
return invalidate({
|
2016-06-13 13:29:37 -04:00
|
|
|
'all': <FormattedMessage id="teacherRegistration.addressValidationError" />
|
2016-06-06 10:10:27 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}.bind(this));
|
|
|
|
},
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-13 13:29:37 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-03 12:00:00 -04:00
|
|
|
var stateOptions = countryData.subdivisionOptions[this.state.countryChoice];
|
2016-06-13 13:29:37 -04:00
|
|
|
stateOptions = [{}].concat(stateOptions);
|
|
|
|
var countryOptions = countryData.countryOptions.concat({
|
|
|
|
label: formatMessage({id: 'teacherRegistration.selectCountry'}),
|
|
|
|
disabled: true,
|
|
|
|
selected: true
|
|
|
|
}).sort(function (a, b) {
|
|
|
|
if (a.disabled) return -1;
|
|
|
|
if (b.disabled) return 1;
|
|
|
|
if (a.value === this.props.defaultCountry) return -1;
|
|
|
|
if (b.value === this.props.defaultCountry) return 1;
|
|
|
|
return 0;
|
|
|
|
}.bind(this));
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.addressStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p className="description">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.addressStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.onValidSubmit}>
|
|
|
|
<Select label={formatMessage({id: 'general.country'})}
|
|
|
|
name="address.country"
|
|
|
|
options={countryOptions}
|
|
|
|
onChange={this.onChangeCountry}
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.addressLine1'})}
|
|
|
|
type="text"
|
|
|
|
name="address.line1"
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.addressLine2'})}
|
|
|
|
type="text"
|
|
|
|
name="address.line2" />
|
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.city'})}
|
|
|
|
type="text"
|
|
|
|
name="address.city"
|
|
|
|
required />
|
|
|
|
{stateOptions.length > 2 ?
|
|
|
|
<Select label={formatMessage({id: 'teacherRegistration.stateProvince'})}
|
|
|
|
name="address.state"
|
|
|
|
options={stateOptions}
|
|
|
|
required /> :
|
|
|
|
[]
|
2016-06-06 10:10:27 -04:00
|
|
|
}
|
2016-06-15 15:08:56 -04:00
|
|
|
<Input label={formatMessage({id: 'teacherRegistration.zipCode'})}
|
|
|
|
type="text"
|
|
|
|
name="address.zip"
|
|
|
|
required />
|
|
|
|
<Button type="submit" disabled={this.state.waiting} className="card-button">
|
|
|
|
{this.state.waiting ?
|
|
|
|
<Spinner /> :
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
}
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-13 13:29:37 -04:00
|
|
|
})),
|
|
|
|
UseScratchStep: intl.injectIntl(React.createClass({
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-13 13:29:37 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.useScratchStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p className="description">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.useScratchStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<TextArea label={formatMessage({id: 'teacherRegistration.howUseScratch'})}
|
|
|
|
name="useScratch"
|
|
|
|
required />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-13 13:29:37 -04:00
|
|
|
})),
|
|
|
|
EmailStep: intl.injectIntl(React.createClass({
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
2016-06-13 13:29:37 -04:00
|
|
|
var formatMessage = this.props.intl.formatMessage;
|
2016-06-02 16:21:14 -04:00
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.emailStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.emailStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card>
|
|
|
|
<Form onValidSubmit={this.props.onNextStep}>
|
|
|
|
<Input label={formatMessage({id: 'general.emailAddress'})}
|
|
|
|
type="text"
|
|
|
|
name="user.email"
|
|
|
|
validations="isEmail"
|
|
|
|
validationError={formatMessage({id: 'general.validationEmail'})}
|
|
|
|
required />
|
|
|
|
<Input label={formatMessage({id: 'general.confirmEmail'})}
|
|
|
|
type="text"
|
|
|
|
name="confirmEmail"
|
|
|
|
validations="equalsField:user.email"
|
|
|
|
validationErrors={{
|
|
|
|
equalsField: formatMessage({id: 'general.validationEmailMatch'})
|
|
|
|
}}
|
|
|
|
required />
|
|
|
|
<Button type="submit" className="card-button">
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.nextStep" />
|
|
|
|
</Button>
|
|
|
|
</Form>
|
|
|
|
</Card>
|
2016-06-16 10:54:36 -04:00
|
|
|
<StepNavigation steps={this.props.totalSteps - 1} active={this.props.activeStep} />
|
2016-06-15 15:08:56 -04:00
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-13 13:29:37 -04:00
|
|
|
})),
|
|
|
|
LastStep: intl.injectIntl(React.createClass({
|
2016-06-02 16:21:14 -04:00
|
|
|
render: function () {
|
|
|
|
return (
|
2016-06-15 15:08:56 -04:00
|
|
|
<Slide>
|
|
|
|
<h1>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.lastStepTitle" />
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.lastStepDescription" />
|
|
|
|
</p>
|
|
|
|
<Card className="confirm">
|
2016-06-13 13:29:37 -04:00
|
|
|
<h2><intl.FormattedMessage id="teacherRegistration.confirmYourEmail" /></h2>
|
2016-06-02 16:21:14 -04:00
|
|
|
<p>
|
2016-06-13 13:29:37 -04:00
|
|
|
<intl.FormattedMessage id="teacherRegistration.confirmYourEmailDescription" /><br />
|
|
|
|
<strong>{this.props.formData.user && this.props.formData.user.email}</strong>
|
2016-06-02 16:21:14 -04:00
|
|
|
</p>
|
2016-06-15 15:08:56 -04:00
|
|
|
</Card>
|
|
|
|
<Card className="wait">
|
2016-06-13 13:29:37 -04:00
|
|
|
<h2><intl.FormattedMessage id="teacherRegistration.waitForApproval" /></h2>
|
|
|
|
<p>
|
|
|
|
<intl.FormattedMessage id="teacherRegistration.waitForApprovalDescription" />
|
|
|
|
</p>
|
2016-06-15 15:08:56 -04:00
|
|
|
</Card>
|
|
|
|
<Card className="resources">
|
2016-06-13 13:29:37 -04:00
|
|
|
<h2><intl.FormattedMessage id="teacherRegistration.checkOutResources" /></h2>
|
2016-06-02 16:21:14 -04:00
|
|
|
<p>
|
2016-06-13 13:29:37 -04:00
|
|
|
<intl.FormattedHTMLMessage id="teacherRegistration.checkOutResourcesDescription" />
|
2016-06-02 16:21:14 -04:00
|
|
|
</p>
|
2016-06-15 15:08:56 -04:00
|
|
|
</Card>
|
|
|
|
</Slide>
|
2016-06-02 16:21:14 -04:00
|
|
|
);
|
|
|
|
}
|
2016-06-13 13:29:37 -04:00
|
|
|
}))
|
2016-06-02 16:21:14 -04:00
|
|
|
};
|