Compare commits
1 Commits
password-v
...
show-error
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
768afa475b |
@@ -33,68 +33,11 @@ import Instance from '../../../../../../../components/Connection';
|
|||||||
import Checkbox from 'material-ui/Checkbox';
|
import Checkbox from 'material-ui/Checkbox';
|
||||||
import Popover from 'material-ui/Popover';
|
import Popover from 'material-ui/Popover';
|
||||||
|
|
||||||
const ADDRESS_TYPE_HOME = "home";
|
|
||||||
|
|
||||||
let DateTimeFormat;
|
let DateTimeFormat;
|
||||||
|
|
||||||
|
|
||||||
DateTimeFormat = global.Intl.DateTimeFormat;
|
DateTimeFormat = global.Intl.DateTimeFormat;
|
||||||
|
|
||||||
export class ValidationErrorsInfoDialog extends React.Component {
|
|
||||||
|
|
||||||
state = {
|
|
||||||
open: this.props.open,
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(newProps){
|
|
||||||
this.setState({open: newProps.open});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleOpen = () => {
|
|
||||||
this.setState({ open: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
handleClose = () => {
|
|
||||||
this.setState({ open: false });
|
|
||||||
this.props.onDismiss();
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
|
|
||||||
const actions = [
|
|
||||||
<FlatButton
|
|
||||||
label="Dismiss"
|
|
||||||
primary={true}
|
|
||||||
keyboardFocused={true}
|
|
||||||
onClick={this.handleClose}
|
|
||||||
/>,
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Dialog
|
|
||||||
title="Erors"
|
|
||||||
actions={actions}
|
|
||||||
modal={false}
|
|
||||||
open={this.state.open}
|
|
||||||
onRequestClose={this.handleClose}
|
|
||||||
overlayStyle={{backgroundColor: 'transparent'}}
|
|
||||||
>
|
|
||||||
{this.props.errorMessages.map(errorMessage => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<a>{errorMessage.message}</a>
|
|
||||||
<br/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class DialogExampleSimple extends React.Component {
|
export class DialogExampleSimple extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
open: true,
|
open: true,
|
||||||
@@ -455,8 +398,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
},
|
},
|
||||||
return_time: new Date(),
|
return_time: new Date(),
|
||||||
pickupTimeHide: false,
|
pickupTimeHide: false,
|
||||||
showValidationErrors:false,
|
|
||||||
validationErrors:[],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,16 +412,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
if (user.useruuid !== loggedUser.useruuid) {
|
if (user.useruuid !== loggedUser.useruuid) {
|
||||||
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
let userHomeAddress = null;
|
|
||||||
res.data.addresses.forEach(address => {
|
|
||||||
if (address.address_type === ADDRESS_TYPE_HOME) {
|
|
||||||
userHomeAddress = address;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (userHomeAddress != null) {
|
|
||||||
userHomeAddress.name = "Home";
|
|
||||||
state.handlePickupChanged(userHomeAddress, state);
|
|
||||||
}
|
|
||||||
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -567,15 +498,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
Instance.getRawConn().post('/v1/nemt/rides', requestRide).then(function (res) {
|
Instance.getRawConn().post('/v1/nemt/rides', requestRide).then(function (res) {
|
||||||
self.handleRequestClose(self);
|
self.handleRequestClose(self);
|
||||||
window.location.href = '/#/app/page/map/' + res.data.ride_uuid;
|
window.location.href = '/#/app/page/map/' + res.data.ride_uuid;
|
||||||
}).catch(error => {
|
}).catch(console.error);
|
||||||
if (error.response.status === 422){
|
|
||||||
//Unprocessable Entity (validation failed)
|
|
||||||
self.setState(Object.assign(self.state, {
|
|
||||||
showValidationErrors:true,
|
|
||||||
validationErrors:error.response.data.data
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -862,12 +785,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleValidationErrosDialogDismiss(){
|
|
||||||
this.setState(Object.assign(this.state, {
|
|
||||||
showValidationErrors:false
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
// const { stepIndex } = this.state;
|
// const { stepIndex } = this.state;
|
||||||
this.getLocation();
|
this.getLocation();
|
||||||
@@ -906,17 +823,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
if (this.state.showUserSelection && this.state.users.length > 0) {
|
if (this.state.showUserSelection && this.state.users.length > 0) {
|
||||||
const handleAutocomplete = (u) => {
|
const handleAutocomplete = (u) => {
|
||||||
let userHomeAddress = null;
|
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
||||||
u.addresses.forEach(address => {
|
|
||||||
if (address.address_type === ADDRESS_TYPE_HOME) {
|
|
||||||
userHomeAddress = address;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (userHomeAddress != null) {
|
|
||||||
userHomeAddress.name = "Home";
|
|
||||||
state.handlePickupChanged(userHomeAddress,state);
|
|
||||||
}
|
|
||||||
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
|
||||||
}
|
}
|
||||||
const datasourceConfig = { text: 'userdata', value: 'useruuid' }
|
const datasourceConfig = { text: 'userdata', value: 'useruuid' }
|
||||||
userSelection = (
|
userSelection = (
|
||||||
@@ -941,8 +848,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
<div className="box-body padding-xs">
|
<div className="box-body padding-xs">
|
||||||
|
|
||||||
<div style={{ maxWidth: 380, margin: 'auto' }}>
|
<div style={{ maxWidth: 380, margin: 'auto' }}>
|
||||||
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
|
||||||
|
|
||||||
<Stepper
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
linear={false}
|
linear={false}
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ class Organization extends React.Component {
|
|||||||
open={this.state.showErrorMessage}
|
open={this.state.showErrorMessage}
|
||||||
onRequestClose={this.handleDialogDismiss.bind(this)}
|
onRequestClose={this.handleDialogDismiss.bind(this)}
|
||||||
>
|
>
|
||||||
{this.state.errorMessage}
|
{this.state.message}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<Main organization={this.state.organization}
|
<Main organization={this.state.organization}
|
||||||
onAddressAdded={this.handleAddressAdded} onAddressRemoved={this.handleAddressRemoved}
|
onAddressAdded={this.handleAddressAdded} onAddressRemoved={this.handleAddressRemoved}
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ class SignUp extends React.Component {
|
|||||||
"role": { name: "", key: "SP", desc: "" },
|
"role": { name: "", key: "SP", desc: "" },
|
||||||
"profiles": [],
|
"profiles": [],
|
||||||
"types": [],
|
"types": [],
|
||||||
"organizations": [],
|
"organizations": []
|
||||||
showValidationErrors : false,
|
|
||||||
validationErrors: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buttonValidated = this.buttonValidated.bind(this);
|
this.buttonValidated = this.buttonValidated.bind(this);
|
||||||
@@ -228,42 +226,12 @@ class SignUp extends React.Component {
|
|||||||
localStorage.removeItem('loggedUser');
|
localStorage.removeItem('loggedUser');
|
||||||
location.href = '/#/login';
|
location.href = '/#/login';
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
if (err.response.status === 422){
|
alert('Error to log in: ' + err.message);
|
||||||
//Unprocessable Entity (validation failed)
|
|
||||||
state.setState(Object.assign(state.state, {
|
|
||||||
showValidationErrors:true,
|
|
||||||
validationErrors:err.response.data.data
|
|
||||||
}));
|
|
||||||
}else{
|
|
||||||
alert('Error to log in: ' + err.message);
|
|
||||||
}
|
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDismiss(){
|
|
||||||
this.setState(Object.assign(this.state, { showErrorMessage: false }));
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let validationErrors = null;
|
|
||||||
if (this.state.showValidationErrors){
|
|
||||||
validationErrors = (
|
|
||||||
<ul>
|
|
||||||
{this.state.validationErrors.map(errorMessage=>{
|
|
||||||
const oneValidationMessage = (<li>{errorMessage.message}</li>);
|
|
||||||
const oneValidationMessageWithTab = (<span><li style={{marginLeft:2 + "em"}}>{errorMessage.message}</li></span>);
|
|
||||||
|
|
||||||
if (errorMessage.field_name === "password-tab"){
|
|
||||||
return oneValidationMessageWithTab;
|
|
||||||
} else{
|
|
||||||
return oneValidationMessage;
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="body-inner">
|
<div className="body-inner">
|
||||||
|
|
||||||
@@ -366,10 +334,6 @@ class SignUp extends React.Component {
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<p className="text-small">By clicking on sign up, you agree to <a href="javascript:;"><i>terms</i></a> and <a href="javascript:;"><i>privacy policy</i></a></p>
|
<p className="text-small">By clicking on sign up, you agree to <a href="javascript:;"><i>terms</i></a> and <a href="javascript:;"><i>privacy policy</i></a></p>
|
||||||
</div>
|
</div>
|
||||||
<div className="divider" />
|
|
||||||
<div className="form-group">
|
|
||||||
{validationErrors}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user