Compare commits

...

4 Commits

Author SHA1 Message Date
GotPPay
830313d9e3 changed font path to point on existing font 2018-05-15 12:13:14 +02:00
Senad Uka
961a9f1448 Merge pull request #1 from senaduka/add-child-error-dialog-fix
fix typo with error message
2018-05-11 11:49:18 +02:00
GotPPay
0cff9ccae9 fix typo with error message 2018-05-11 11:45:06 +02:00
Senad Uka
1fdce51b72 Upstream sync 2018-05-11 09:10:18 +02:00
3 changed files with 117 additions and 9 deletions

View File

@@ -2340,19 +2340,19 @@ html.static.boxed {
@font-face {
font-family: 'Lato';
src: url(/assets/./fonts/646474e48f4c1ea783f43ac5e41fd111.woff2) format("woff2"), url(/assets/./fonts/374df2a818582454b6e6832804e52f86.woff) format("woff");
src: url(/fonts/lato/lato-regular-webfont.woff2) format("woff2"), url(/fonts/lato/lato-regular-webfont.woff) format("woff");
font-weight: bold;
font-style: normal; }
@font-face {
font-family: 'Lato';
src: url(/assets/./fonts/5fa6d7ddc0a0d53311752343d7176d70.woff2) format("woff2"), url(/assets/./fonts/c53136193516ed2d4fac337d1dc6965a.woff) format("woff");
src: url(/assets/./fonts/lato/lato-bolditalic-webfont.woff2) format("woff2"), url(/assets/./fonts/lato/lato-bolditalic-webfont.woff) format("woff");
font-weight: bold;
font-style: italic; }
@font-face {
font-family: 'Lato';
src: url(/assets/./fonts/9bcf055a732c0b22d2279ba79e20c577.woff2) format("woff2"), url(/assets/./fonts/c8eef482ac448a91ecca9d008634c044.woff) format("woff");
src: url(/assets/./fonts/lato/lato-italic-webfont.woff2) format("woff2"), url(/assets/./fonts/lato/lato-italic-webfont.woff) format("woff");
font-weight: normal;
font-style: italic; }

View File

@@ -38,6 +38,61 @@ let 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 {
state = {
open: true,
@@ -398,6 +453,8 @@ class VerticalNonLinear extends React.Component {
},
return_time: new Date(),
pickupTimeHide: false,
showValidationErrors:false,
validationErrors:[],
};
}
@@ -498,7 +555,15 @@ class VerticalNonLinear extends React.Component {
Instance.getRawConn().post('/v1/nemt/rides', requestRide).then(function (res) {
self.handleRequestClose(self);
window.location.href = '/#/app/page/map/' + res.data.ride_uuid;
}).catch(console.error);
}).catch(error => {
if (error.response.status === 422){
//Unprocessable Entity (validation failed)
self.setState(Object.assign(self.state, {
showValidationErrors:true,
validationErrors:error.response.data.data
}));
}
});
}
}
};
@@ -785,6 +850,12 @@ class VerticalNonLinear extends React.Component {
}
handleValidationErrosDialogDismiss(){
this.setState(Object.assign(this.state, {
showValidationErrors:false
}));
}
render() {
// const { stepIndex } = this.state;
this.getLocation();
@@ -848,6 +919,8 @@ class VerticalNonLinear extends React.Component {
<div className="box-body padding-xs">
<div style={{ maxWidth: 380, margin: 'auto' }}>
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
<Stepper
activeStep={this.state.stepIndex}
linear={false}

View File

@@ -11,6 +11,8 @@ import {
import moment from 'moment';
import Delete from 'material-ui/svg-icons/action/delete';
import IconButton from 'material-ui/IconButton';
import FlatButton from 'material-ui/FlatButton';
import Dialog from 'material-ui/Dialog';
import GoogleAddressComponent from './GoogleAddressComponent';
import ContactComponent from './ContactComponent';
@@ -463,7 +465,9 @@ class Organization extends React.Component {
"useruuid": "",
"name": "",
}
}
},
showErrorMessage : false,
errorMessage : ''
}
componentDidMount() {
@@ -597,11 +601,20 @@ class Organization extends React.Component {
self.setState(Object.assign(self.state, { organization: res.data }));
})
.catch(err => {
if (err.response.status === 422) {
location.href = '/#/app/table/organizations';
} else {
console.error(err);
let errorMessage = '';
switch(err.response.status){
case 403:
errorMessage = 'Not authorized to add child organization';
break;
case 422:
location.href = '/#/app/table/organizations';
break;
default:
errorMessage = 'Error adding child organization';
console.error(err);
}
this.setState(Object.assign(this.state, { showErrorMessage:true, errorMessage:errorMessage }));
});
}
@@ -613,10 +626,32 @@ class Organization extends React.Component {
this.getOrganization(organization.id);
}
handleDialogDismiss(){
this.setState(Object.assign(this.state, { showErrorMessage:false }));
}
render() {
const actions = [
<FlatButton
label="Dismiss"
primary={true}
onClick={this.handleDialogDismiss.bind(this)}
/>,
];
return (
<div className="container-fluid no-breadcrumbs page-dashboard">
<QueueAnim type="bottom" className="ui-animate">
<Dialog
title="Error"
actions={actions}
modal={false}
open={this.state.showErrorMessage}
onRequestClose={this.handleDialogDismiss.bind(this)}
>
{this.state.errorMessage}
</Dialog>
<Main organization={this.state.organization}
onAddressAdded={this.handleAddressAdded} onAddressRemoved={this.handleAddressRemoved}
onContactAdded={this.handleContactAdded} onContactRemoved={this.handleContactRemoved}