Compare commits
1 Commits
add-contac
...
show-error
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
768afa475b |
@@ -38,61 +38,6 @@ 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,
|
||||||
@@ -453,8 +398,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
},
|
},
|
||||||
return_time: new Date(),
|
return_time: new Date(),
|
||||||
pickupTimeHide: false,
|
pickupTimeHide: false,
|
||||||
showValidationErrors:false,
|
|
||||||
validationErrors:[],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,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
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -850,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();
|
||||||
@@ -919,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}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ const Address = (props) => {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const Main = ({ user, onAddressAdded, onAddressRemoved, onContactAdded, readOnly }) => {
|
const Main = ({ user, onAddressAdded, onAddressRemoved, readOnly }) => {
|
||||||
return (
|
return (
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-xl-12">
|
<div className="col-xl-12">
|
||||||
@@ -158,7 +158,7 @@ const Main = ({ user, onAddressAdded, onAddressRemoved, onContactAdded, readOnly
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-xl-6">
|
<div className="col-xl-6">
|
||||||
<ContactInfo user={user} readOnly={readOnly} onContactAdded={onContactAdded} />
|
<ContactInfo user={user} readOnly={readOnly} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -685,7 +685,6 @@ const ContactInfo = (props) => {
|
|||||||
title={"Member Contact"}
|
title={"Member Contact"}
|
||||||
buttonValue={"Add Contact"}
|
buttonValue={"Add Contact"}
|
||||||
showDescription={false}
|
showDescription={false}
|
||||||
onNewContact={props.onContactAdded}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -824,7 +823,6 @@ class User extends React.Component {
|
|||||||
this.getUser = this.getUser.bind(this);
|
this.getUser = this.getUser.bind(this);
|
||||||
this.handleAddressAdded = this.handleAddressAdded.bind(this);
|
this.handleAddressAdded = this.handleAddressAdded.bind(this);
|
||||||
this.handleAddressRemoved = this.handleAddressRemoved.bind(this);
|
this.handleAddressRemoved = this.handleAddressRemoved.bind(this);
|
||||||
this.handleContactAdded = this.handleContactAdded.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -842,22 +840,6 @@ class User extends React.Component {
|
|||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleContactAdded(contact) {
|
|
||||||
const user_uuid = this.props.params.user_uuid;
|
|
||||||
const self = this;
|
|
||||||
|
|
||||||
var contactObj = {
|
|
||||||
"type": contact.type,
|
|
||||||
"contact": contact.contact,
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance.getRawConn().post(`/v1/nemt/users/portal/${user_uuid}/contact`, contactObj)
|
|
||||||
.then(res => {
|
|
||||||
this.getUser(user_uuid);
|
|
||||||
})
|
|
||||||
.catch(console.error);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleAddressAdded(address) {
|
handleAddressAdded(address) {
|
||||||
const user_uuid = this.props.params.user_uuid;
|
const user_uuid = this.props.params.user_uuid;
|
||||||
const self = this;
|
const self = this;
|
||||||
@@ -908,7 +890,6 @@ class User extends React.Component {
|
|||||||
user={user}
|
user={user}
|
||||||
onAddressAdded={this.handleAddressAdded}
|
onAddressAdded={this.handleAddressAdded}
|
||||||
onAddressRemoved={this.handleAddressRemoved}
|
onAddressRemoved={this.handleAddressRemoved}
|
||||||
onContactAdded={this.handleContactAdded}
|
|
||||||
readOnly={readOnly}
|
readOnly={readOnly}
|
||||||
/>
|
/>
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
|
|||||||
Reference in New Issue
Block a user