2015-02-23 21:30:06 +01:00
|
|
|
|
var React = require("react/addons"),
|
|
|
|
|
|
UserRegistration = require('../../models/userRegistration'),
|
2015-03-01 16:06:11 +01:00
|
|
|
|
RibicaValidationMixin = require('../../components/shared/mixins/ribicaValidationMixin'),
|
|
|
|
|
|
UserStore = require('../../stores/userStore'),
|
|
|
|
|
|
NavigationActions = require('../../actions/navigationActions'),
|
2015-03-02 07:49:36 +01:00
|
|
|
|
UserActions = require('../../actions/userActions'),
|
|
|
|
|
|
ValidationUtils = require('../../utils/validation');
|
2015-03-01 16:06:11 +01:00
|
|
|
|
|
2015-02-17 21:58:39 +01:00
|
|
|
|
|
2015-02-21 14:00:43 +01:00
|
|
|
|
|
2015-02-23 21:30:06 +01:00
|
|
|
|
var Register = React.createClass({
|
|
|
|
|
|
mixins: [React.addons.LinkedStateMixin, RibicaValidationMixin],
|
2015-02-21 14:00:43 +01:00
|
|
|
|
getInitialState: function() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
myBabyDetailsVisible: false,
|
|
|
|
|
|
firstName: '',
|
|
|
|
|
|
lastName: '',
|
|
|
|
|
|
email: '',
|
|
|
|
|
|
password: '',
|
2015-02-23 21:30:06 +01:00
|
|
|
|
passwordConfirmation: '',
|
2015-03-19 22:29:16 +01:00
|
|
|
|
registration: UserStore.getRegistrationState(),
|
|
|
|
|
|
myBabyDOBDay: -1,
|
|
|
|
|
|
myBabyDOBMonth: -1,
|
|
|
|
|
|
myBabyDOBYear: -1,
|
2015-04-19 15:00:06 +02:00
|
|
|
|
myBabyOnTheWay: true,
|
2015-03-19 22:29:16 +01:00
|
|
|
|
loginState : UserStore.getLoginState()
|
2015-02-21 14:00:43 +01:00
|
|
|
|
};
|
|
|
|
|
|
},
|
2015-03-19 22:29:16 +01:00
|
|
|
|
myBabyChange: function(e) {
|
2015-02-21 14:00:43 +01:00
|
|
|
|
this.setState({
|
2015-03-19 22:29:16 +01:00
|
|
|
|
myBabyDetailsVisible: true,
|
|
|
|
|
|
myBabyOnTheWay: (e.currentTarget.value === "1" ? true: false)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
});
|
|
|
|
|
|
},
|
2015-03-28 14:10:56 +01:00
|
|
|
|
onKeyPress: function(e) {
|
|
|
|
|
|
var enterKeyCode = 13;
|
|
|
|
|
|
if(e.which == enterKeyCode) {
|
|
|
|
|
|
this.doRegister();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2015-02-21 14:00:43 +01:00
|
|
|
|
renderMonthSelector: function() {
|
|
|
|
|
|
var months = ['Januar', 'Februar', 'Mart', 'April', 'Maj', 'Juni',
|
|
|
|
|
|
'Juli','August','Septembar', 'Oktobar','Novembar','Decembar'];
|
|
|
|
|
|
|
2015-03-19 22:29:16 +01:00
|
|
|
|
var monthsSelect = [<option value='-1'>Mjesec</option>];
|
|
|
|
|
|
for(var i = 1; i <= months.length; i++) {
|
|
|
|
|
|
monthsSelect.push(<option value={i}>{months[i - 1]}</option>)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-04-19 15:00:06 +02:00
|
|
|
|
return (<select className="form-control " onChange={this.onBabyDOBMonthChange}>{monthsSelect}</select>)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
},
|
|
|
|
|
|
renderYearSelector: function() {
|
|
|
|
|
|
var currentYear = (new Date().getFullYear());
|
|
|
|
|
|
var years = [];
|
2015-03-19 22:29:16 +01:00
|
|
|
|
years.push(<option value='-1'>Godina</option>)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
|
|
|
|
|
|
for(var i = 0; i < 12; i++) {
|
|
|
|
|
|
years.push(<option value={currentYear - i}>{currentYear - i}</option>)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-04-19 15:00:06 +02:00
|
|
|
|
return (<select className="form-control " onChange={this.onBabyDOBYearChange}> {years} </select>)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
},
|
|
|
|
|
|
renderDaySelector: function() {
|
|
|
|
|
|
var days = [];
|
2015-03-19 22:29:16 +01:00
|
|
|
|
days.push(<option value='-1'>Dan</option>)
|
2015-02-21 14:00:43 +01:00
|
|
|
|
for(var i = 1; i <= 31; i++) {
|
|
|
|
|
|
days.push(<option value={i}>{i}</option>)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2015-04-19 15:00:06 +02:00
|
|
|
|
return (<select className="form-control " onChange={this.onBabyDOBDayChange}> {days} </select>)
|
2015-03-19 22:29:16 +01:00
|
|
|
|
},
|
|
|
|
|
|
onBabyDOBDayChange: function(e) {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
myBabyDOBDay: e.currentTarget.value
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
onBabyDOBMonthChange: function(e) {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
myBabyDOBMonth: e.currentTarget.value
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
onBabyDOBYearChange: function(e) {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
myBabyDOBYear: e.currentTarget.value
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
myBabyNameChange: function(e) {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
babyName: e.currentTarget.value
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
myBabyGenderChange: function(e) {
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
babyGender: e.currentTarget.value
|
|
|
|
|
|
});
|
2015-02-21 14:00:43 +01:00
|
|
|
|
},
|
|
|
|
|
|
|
2015-02-23 21:30:06 +01:00
|
|
|
|
validations: {
|
|
|
|
|
|
firstName: function(value) {
|
2015-03-02 07:49:36 +01:00
|
|
|
|
if (!ValidationUtils.isValidRequired(value)) {
|
2015-02-26 07:28:27 +01:00
|
|
|
|
return ["Ime je obavezno."];
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
password: function(value, callback) {
|
2015-03-02 07:49:36 +01:00
|
|
|
|
if(!ValidationUtils.isValidRequired(value)) {
|
2015-02-26 07:28:27 +01:00
|
|
|
|
return ["Šifra je obavezna."];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (value.length < 6) {
|
|
|
|
|
|
return ["Šifra mora sadržavati minimalno 6 karaktera."]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (callback) {
|
|
|
|
|
|
callback([], ["passwordConfirmation"]);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
passwordConfirmation: function(value) {
|
|
|
|
|
|
if (this.getState().password !== value) {
|
|
|
|
|
|
return ["Šifre se ne podudaraju."];
|
2015-02-23 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
lastName : function(value) {
|
2015-03-02 07:49:36 +01:00
|
|
|
|
if (!ValidationUtils.isValidRequired(value)) {
|
2015-02-26 07:28:27 +01:00
|
|
|
|
return ["Prezime je obavezno."];
|
2015-02-23 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
_emailTimeoutId: null,
|
|
|
|
|
|
email: function(value, callback) {
|
|
|
|
|
|
|
2015-03-02 07:49:36 +01:00
|
|
|
|
if (ValidationUtils.isValidEmail(value)) {
|
2015-02-23 21:30:06 +01:00
|
|
|
|
//clearTimeout(this._emailTimeoutId);
|
|
|
|
|
|
//this._emailTimeoutId = setTimeout(function(){
|
|
|
|
|
|
|
|
|
|
|
|
//// TODO: check if email exists
|
|
|
|
|
|
//if (value === 'edin@edin.com') {
|
|
|
|
|
|
//if(callback) {
|
|
|
|
|
|
//var errors= ['Email is already taken'];
|
|
|
|
|
|
//callback(errors);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//} else {
|
|
|
|
|
|
//if(callback) {
|
|
|
|
|
|
//callback([]);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//}.bind(this), 1000);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return ['Neispravna email adresa.'];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2015-04-19 15:00:06 +02:00
|
|
|
|
renderGenderImage: function() {
|
|
|
|
|
|
if(this.state.babyGender === "boy") {
|
|
|
|
|
|
return <img id="imgImage" name="imgImage" src="https://res.cloudinary.com/du5pdibul/image/upload/v1428813559/baby-blue_trmmbp.png" alt="baby" />
|
|
|
|
|
|
} else if (this.state.babyGender === "girl") {
|
|
|
|
|
|
return <img id="imgImage" name="imgImage" src="https://res.cloudinary.com/du5pdibul/image/upload/v1428813559/baby-pink_j0eis4.png" alt="baby" />
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <img id="imgImage" name="imgImage" src="https://res.cloudinary.com/du5pdibul/image/upload/v1428813559/baby-gray_mijkax.png" alt="baby" />
|
|
|
|
|
|
},
|
2015-02-23 21:30:06 +01:00
|
|
|
|
renderErrorMessage: function(message){
|
|
|
|
|
|
return (<div className='error-message'>{message}</div>)
|
|
|
|
|
|
},
|
2015-03-01 16:06:11 +01:00
|
|
|
|
componentDidMount: function() {
|
|
|
|
|
|
UserStore.addChangeListener(this.onUserStoreChange);
|
|
|
|
|
|
},
|
|
|
|
|
|
componentWillUnmount: function() {
|
|
|
|
|
|
UserStore.removeChangeListener(this.onUserStoreChange);
|
|
|
|
|
|
},
|
|
|
|
|
|
onUserStoreChange: function() {
|
|
|
|
|
|
this.setState({
|
2015-03-19 22:29:16 +01:00
|
|
|
|
registration: UserStore.getRegistrationState(),
|
|
|
|
|
|
loginState : UserStore.getLoginState()
|
2015-03-01 16:06:11 +01:00
|
|
|
|
});
|
|
|
|
|
|
},
|
2015-03-28 14:10:56 +01:00
|
|
|
|
onRegisterClick: function(e) {
|
|
|
|
|
|
this.doRegister();
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
},
|
|
|
|
|
|
doRegister: function() {
|
2015-02-23 21:30:06 +01:00
|
|
|
|
if(this.validate()) {
|
2015-03-19 14:27:04 +01:00
|
|
|
|
var children = [];
|
|
|
|
|
|
if (this.state.myBabyDetailsVisible) {
|
2015-03-19 22:29:16 +01:00
|
|
|
|
|
|
|
|
|
|
var dobOk = this.state.myBabyDOBDay !== -1 && this.state.myBabyDOBMonth !== -1 && this.state.myBabyDOBYear !== -1;
|
2015-04-19 15:00:06 +02:00
|
|
|
|
|
2015-03-19 22:29:16 +01:00
|
|
|
|
if (dobOk || this.state.babyName !== undefined || this.state.babyGender !== undefined) {
|
|
|
|
|
|
var childInfo = {
|
|
|
|
|
|
name: this.state.babyName,
|
2015-04-19 15:00:06 +02:00
|
|
|
|
gender: this.state.babyGender === "boy" ? 1 : 2,
|
2015-03-19 22:29:16 +01:00
|
|
|
|
on_the_way: this.state.myBabyOnTheWay
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(dobOk) {
|
|
|
|
|
|
var dob = this.state.myBabyDOBDay + '/' + this.state.myBabyDOBMonth + '/' + this.state.myBabyDOBYear;
|
|
|
|
|
|
childInfo.date_of_birth = dob;
|
|
|
|
|
|
}
|
|
|
|
|
|
children.push(childInfo);
|
|
|
|
|
|
}
|
2015-03-19 14:27:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-02-23 21:30:06 +01:00
|
|
|
|
var user = new UserRegistration({
|
|
|
|
|
|
first_name: this.state.firstName,
|
|
|
|
|
|
last_name: this.state.lastName,
|
|
|
|
|
|
email: this.state.email,
|
|
|
|
|
|
password: this.state.password,
|
2015-03-19 14:27:04 +01:00
|
|
|
|
password_confirmation: this.state.passwordConfirmation,
|
|
|
|
|
|
children_attributes : children
|
|
|
|
|
|
|
2015-02-23 21:30:06 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
2015-03-19 14:27:04 +01:00
|
|
|
|
// need to add info about child
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-01 16:06:11 +01:00
|
|
|
|
UserActions.registerUser(user);
|
2015-02-23 21:30:06 +01:00
|
|
|
|
}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
},
|
2015-03-01 16:06:11 +01:00
|
|
|
|
successContinue: function(e) {
|
|
|
|
|
|
NavigationActions.goToHome();
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
},
|
2015-03-19 22:29:16 +01:00
|
|
|
|
prettyPrintError: function(err) {
|
|
|
|
|
|
var errorInfo = [];
|
|
|
|
|
|
for(var key in err) {
|
|
|
|
|
|
if (err.hasOwnProperty(key)) {
|
|
|
|
|
|
errorInfo.push(<li>{err[key]}</li>);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return (<ul>
|
|
|
|
|
|
{errorInfo}
|
|
|
|
|
|
</ul>)
|
|
|
|
|
|
},
|
2015-03-01 16:06:11 +01:00
|
|
|
|
renderRegistrationState: function() {
|
2015-03-02 07:49:36 +01:00
|
|
|
|
var rs = this.state.registration;
|
2015-03-01 16:06:11 +01:00
|
|
|
|
if (!rs.performed) {
|
|
|
|
|
|
|
|
|
|
|
|
return (<div></div>)
|
|
|
|
|
|
} else if(rs.performed && !rs.success){
|
|
|
|
|
|
return (<div>
|
2015-03-02 07:49:36 +01:00
|
|
|
|
Desila se pogreška pri registraciji. Detalji greške su:
|
2015-03-19 22:29:16 +01:00
|
|
|
|
{this.prettyPrintError(rs.error)}
|
2015-03-01 16:06:11 +01:00
|
|
|
|
</div>)
|
|
|
|
|
|
} else if (rs.performed && rs.success) {
|
|
|
|
|
|
return (<div>
|
2015-04-19 15:00:06 +02:00
|
|
|
|
Uspješno ste se registrovali na Ribicu. Kliknite <a onClick={this.successContinue}>ovdje</a> za nastavak.
|
2015-03-01 16:06:11 +01:00
|
|
|
|
</div>)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2015-02-17 21:58:39 +01:00
|
|
|
|
render : function() {
|
2015-03-01 16:06:11 +01:00
|
|
|
|
var cx = React.addons.classSet;
|
2015-03-02 07:49:36 +01:00
|
|
|
|
var regSuccess = this.state.registration.performed && this.state.registration.success;
|
2015-03-01 16:06:11 +01:00
|
|
|
|
var classes = cx({
|
2015-04-19 15:00:06 +02:00
|
|
|
|
'hide': regSuccess
|
2015-03-01 16:06:11 +01:00
|
|
|
|
});
|
2015-03-20 00:40:03 +01:00
|
|
|
|
if (!this.state.registration.performed && this.state.loginState.loggedIn) {
|
2015-03-19 22:29:16 +01:00
|
|
|
|
return (<div>Vi ste već registrovani. Uživajte u kupovini.</div>)
|
|
|
|
|
|
}
|
2015-04-19 15:00:06 +02:00
|
|
|
|
|
|
|
|
|
|
return (<div>
|
|
|
|
|
|
{this.renderRegistrationState()}
|
|
|
|
|
|
<div className={classes}>
|
|
|
|
|
|
<div className="col-lg-6 col-md-6 col-sm-8 col-xs-12 col-centered" style={{height: 500}}>
|
|
|
|
|
|
<div className="reglogo">
|
|
|
|
|
|
<h1 style={{paddingTop: 40}} className="text-center">Registracija</h1>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<form className>
|
|
|
|
|
|
<div className="form-group col-lg-6 col-md-6 ">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('firstName')} className="form-control" placeholder="Ime" />
|
|
|
|
|
|
{this.getValidationMessages('firstName').map(this.renderErrorMessage)}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-6 col-md-6 ">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('lastName')} className="form-control" placeholder="Prezime" />
|
|
|
|
|
|
{this.getValidationMessages('lastName').map(this.renderErrorMessage)}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-12 col-md-12">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('email')} className="form-control" placeholder="Email adresa" />
|
|
|
|
|
|
{this.getValidationMessages('email').map(this.renderErrorMessage)}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-12 col-md-12">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="password" onKeyPress={this.onKeyPress} onChange={this.handleChange('password')} className="form-control" placeholder="Šifra" />
|
|
|
|
|
|
{this.getValidationMessages('password').map(this.renderErrorMessage)}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-12 col-md-12">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="password" onKeyPress={this.onKeyPress} onChange={this.handleChange('passwordConfirmation')} className="form-control" placeholder="Potvrda šifre" />
|
|
|
|
|
|
{this.getValidationMessages('passwordConfirmation').map(this.renderErrorMessage)}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
|
|
|
|
|
{this.renderGenderImage()}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="radio col-lg-6 col-md-6 ">
|
|
|
|
|
|
<h4>Moja beba (po izboru) </h4>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<label><input className name="option1" value="1" type="radio" id="opone" onChange={this.myBabyChange} /> Na putu</label>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<label><input className name="option1" type="radio" id="optwo" onChange={this.myBabyChange} /> Već rođena</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="gender" className={this.state.myBabyOnTheWay ? "radio col-lg-6 hide": "radio col-lg-6 "}>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<label><input className name="gender" type="radio" id="chkImg" value="boy" onChange={this.myBabyGenderChange} /> Dječak</label>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<label><input className name="gender" type="radio" id="chkImg2" value="girl" onChange={this.myBabyGenderChange} /> Djevojčica</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="babydetails" className={this.state.myBabyDetailsVisible ? "" :"hide"}>
|
|
|
|
|
|
<div className="radio col-lg-12 col-md-12">
|
|
|
|
|
|
<input style={{marginBottom: 8}} type="text" className="form-control" onChange={this.myBabyNameChange} placeholder="Ime bebe" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className=" text-center col-lg-12 col-md-12">
|
|
|
|
|
|
Datum rođenja
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group col-lg-12 col-md-12">
|
|
|
|
|
|
<div className=" col-lg-3 col-md-3">
|
|
|
|
|
|
{this.renderDaySelector()}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="col-lg-5 col-md-5">
|
|
|
|
|
|
{this.renderMonthSelector()}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className=" col-lg-4 col-md-4">
|
|
|
|
|
|
{this.renderYearSelector()}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<input style={{color: 'white', fontWeight: 'bold', height: 44}} type="submit" onClick={this.onRegisterClick} className=" mybutton center-block col-md-8 col-sm-8 col-xs-8 col-sm-push-2 col-xs-push-2 col-md-push-2" defaultValue="REGISTRUJ ME" />
|
|
|
|
|
|
</form>
|
|
|
|
|
|
<div className="text-center col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
|
|
|
|
|
<h4>Već imate profil? <a href="Prijava.html"><span> Prijavite se</span></a></h4>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
/*
|
2015-02-17 21:58:39 +01:00
|
|
|
|
return (<div>
|
2015-02-21 14:00:43 +01:00
|
|
|
|
<span className="h3">Registracija</span>
|
2015-03-01 16:06:11 +01:00
|
|
|
|
{this.renderRegistrationState()}
|
|
|
|
|
|
<div className="center" className={classes}>
|
2015-02-21 14:00:43 +01:00
|
|
|
|
<form className="form-horizontal">
|
|
|
|
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
|
<label for="firstName" className="col-md-4 control-label">Ime</label>
|
|
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<input type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('firstName')} className="form-control" id="firstName" placeholder="Ime"/>
|
2015-02-23 21:30:06 +01:00
|
|
|
|
{this.getValidationMessages('firstName').map(this.renderErrorMessage)}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
|
<label for="lastName" className="col-md-4 control-label">Prezime</label>
|
|
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<input type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('lastName')} className="form-control" id="lastName" placeholder="Prezime"/>
|
2015-02-23 21:30:06 +01:00
|
|
|
|
{this.getValidationMessages('lastName').map(this.renderErrorMessage)}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
|
<label for="email" className="col-md-4 control-label">Email</label>
|
|
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<input type="text" onKeyPress={this.onKeyPress} onChange={this.handleChange('email')} className="form-control" id="email" placeholder="Email Adresa"/>
|
2015-02-23 21:30:06 +01:00
|
|
|
|
{this.getValidationMessages('email').map(this.renderErrorMessage)}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group">
|
2015-02-23 21:30:06 +01:00
|
|
|
|
<label for="password" className="col-md-4 control-label">Šifra</label>
|
2015-02-21 14:00:43 +01:00
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<input type="password" onKeyPress={this.onKeyPress} onChange={this.handleChange('password')} className="form-control" id="password" placeholder="Šifra"/>
|
2015-02-26 07:28:27 +01:00
|
|
|
|
{this.getValidationMessages('password').map(this.renderErrorMessage)}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="form-group">
|
2015-02-23 21:30:06 +01:00
|
|
|
|
<label for="password_confirmation" className="col-md-4 control-label">Potvrda šifre</label>
|
2015-02-21 14:00:43 +01:00
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<input type="password" onKeyPress={this.onKeyPress} onChange={this.handleChange('passwordConfirmation')} className="form-control" id="password_confirmation" placeholder="Podvrda šifre"/>
|
2015-02-26 07:28:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{this.getValidationMessages('passwordConfirmation').map(this.renderErrorMessage)}
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
|
<label for="my_baby" className="col-md-4 control-label">Moja beba</label>
|
|
|
|
|
|
<div className="col-md-4">
|
2015-03-19 22:29:16 +01:00
|
|
|
|
<input type="radio" onChange={this.myBabyChange} name="my_baby" id="already_born" /> Vec rođena
|
|
|
|
|
|
<input type="radio" onChange={this.myBabyChange} value="1" id="on_the_way" name="my_baby" />Na putu
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{this.renderBabyDetails()}
|
|
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
|
<div className="col-md-4">
|
2015-02-26 07:28:27 +01:00
|
|
|
|
|
2015-03-19 22:36:32 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
<div className="col-md-4">
|
2015-03-28 14:10:56 +01:00
|
|
|
|
<button onClick={this.onRegisterClick} type="button" className="btn btn-success btn-lg">
|
2015-03-19 14:27:04 +01:00
|
|
|
|
Registruj me
|
|
|
|
|
|
</button>
|
2015-02-21 14:00:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
2015-04-19 15:00:06 +02:00
|
|
|
|
</div>); */
|
2015-02-17 21:58:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
module.exports = Register;
|