Compare commits

..

3 Commits

Author SHA1 Message Date
GotPPay
21e6759a70 Show validation errors on eligibility check 2018-05-21 17:21:23 +02:00
Senad Uka
adf2ba8232 Upstream sync 2018-05-17 19:02:54 +02:00
Senad Uka
c993a194a6 upstream sync 2018-05-16 18:41:24 +02:00
4 changed files with 106 additions and 80 deletions

View File

@@ -2340,19 +2340,19 @@ html.static.boxed {
@font-face { @font-face {
font-family: 'Lato'; 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-weight: bold;
font-style: normal; } font-style: normal; }
@font-face { @font-face {
font-family: 'Lato'; 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-weight: bold;
font-style: italic; } font-style: italic; }
@font-face { @font-face {
font-family: 'Lato'; 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-weight: normal;
font-style: italic; } font-style: italic; }

View File

@@ -0,0 +1,59 @@
import React, { Component } from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
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={this.props.modal ? this.props.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>
);
}
}
module.exports = ValidationErrorsInfoDialog;

View File

@@ -30,70 +30,18 @@ import Close from 'material-ui/svg-icons/navigation/close'
import CommunicationCall from 'material-ui/svg-icons/communication/call' import CommunicationCall from 'material-ui/svg-icons/communication/call'
import Message from 'material-ui/svg-icons/communication/message' import Message from 'material-ui/svg-icons/communication/message'
import Instance from '../../../../../../../components/Connection'; import Instance from '../../../../../../../components/Connection';
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
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"; const ADDRESS_TYPE_HOME = "home";
let DateTimeFormat; let DateTimeFormat;
const roundingTime = 1000 * 60 * 5; //5 minutes
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 = {
@@ -418,16 +366,18 @@ class VerticalNonLinear extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let dateNow = new Date();
this.state = { this.state = {
stepIndex: 0, stepIndex: 0,
rideTypeValue: 0, rideTypeValue: 0,
providerID: 0, providerID: 0,
providerName: '', providerName: '',
visitDate: new Date(), visitDate: new Date(),
visitTime: new Date(), visitTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupLocation: null, pickupLocation: null,
pickupTime: new Date(), pickupTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupTimeReturn: new Date(), pickupTimeReturn: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
pickupTimeReturnDisplayMode: 'none', pickupTimeReturnDisplayMode: 'none',
open: false, open: false,
message: 'Booking Ride', message: 'Booking Ride',
@@ -501,17 +451,17 @@ class VerticalNonLinear extends React.Component {
} }
}); });
let visitTime = new Date(new Date().getTime() + (1 * 60 * 60 * 1000)); let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let visitDate = visitTime; let visitDate = date;
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
this.setState(Object.assign(this.state, { this.setState(Object.assign(this.state, {
visitDate: visitDate, visitDate: visitDate,
visitTime: visitTime, visitTime: visitTime,
pickupTime: pickupTime, pickupTime: pickupTime,
pickupTimeReturn: pickupTimeReturn, pickupTimeReturn: pickupTimeReturn,
})); }));
} }
//for snackbar //for snackbar
handleTouchTap() { handleTouchTap() {
@@ -535,7 +485,8 @@ class VerticalNonLinear extends React.Component {
if (stepIndex === 3) { if (stepIndex === 3) {
self.handleTouchTap(); self.handleTouchTap();
var requestRide = { var requestRide = {
user_uuid: state.state.user.useruuid, user_uuid: state.state.user ? state.state.user.useruuid : '',
user_consent: state.state.checked,
ride_type: "lyft", ride_type: "lyft",
origin: state.state.origin, origin: state.state.origin,
destination: state.state.destination, destination: state.state.destination,
@@ -612,10 +563,10 @@ class VerticalNonLinear extends React.Component {
handleDate(event, date, state) { handleDate(event, date, state) {
let self = state let self = state
let visitTime = new Date(date.getTime() + (1 * 60 * 60 * 1000)); let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let visitDate = date; let visitDate = date;
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000)); let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
self.setState(Object.assign(self.state, { self.setState(Object.assign(self.state, {
visitDate: visitDate, visitDate: visitDate,

View File

@@ -14,6 +14,7 @@ import RaisedButton from 'material-ui/RaisedButton';
import SelectField from 'material-ui/SelectField'; import SelectField from 'material-ui/SelectField';
import Checkbox from 'material-ui/Checkbox'; import Checkbox from 'material-ui/Checkbox';
import Instance from '../../../../../../../components/Connection'; import Instance from '../../../../../../../components/Connection';
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
class SignUp extends React.Component { class SignUp extends React.Component {
constructor(props) { constructor(props) {
@@ -34,7 +35,9 @@ class SignUp extends React.Component {
gender: null, gender: null,
agreedTerms: false, agreedTerms: false,
validated: false, validated: false,
memberType:"S" memberType:"S",
showValidationErrors: false,
validationErrors:[]
} }
componentDidMount = () => { componentDidMount = () => {
@@ -58,7 +61,10 @@ class SignUp extends React.Component {
"member": this.state.member, "member": this.state.member,
"email": this.state.email, "email": this.state.email,
"phonenumber": this.state.phonenumber, "phonenumber": this.state.phonenumber,
"birthdate": this.state.birthdate.toISOString() "birthdate": this.state.birthdate.toISOString(),
"consent" : this.state.agreedTerms,
"type": this.state.memberType
// "eligibility": { // "eligibility": {
// "tracking_id": "1234567", // "tracking_id": "1234567",
// "payer": { // "payer": {
@@ -99,9 +105,14 @@ class SignUp extends React.Component {
// alert('NO benefits found for this member'); // alert('NO benefits found for this member');
// } // }
}).catch(function (err) { }).catch(function (err) {
console.log('Error to get eligibility: ', err); if (err.response.status === 422){
alert('NO benefits found for this member'); //Unprocessable Entity (validation failed)
this.handleRequestClose(); state.setState(Object.assign(state.state, {showValidationErrors:true, validationErrors:err.response.data.data}))
}else{
console.log('Error to get eligibility: ', err);
alert('NO benefits found for this member');
this.handleRequestClose();
}
}); });
} }
@@ -173,10 +184,15 @@ class SignUp extends React.Component {
this.setState(Object.assign(this.state, { validated: validated })); this.setState(Object.assign(this.state, { validated: validated }));
} }
handleValidationErrosDialogDismiss(){
this.setState(Object.assign(this.state, {showValidationErrors:false}));
}
render() { render() {
return ( return (
<form className=""> <form className="">
<fieldset> <fieldset>
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} modal={true} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
<div className="form-group"> <div className="form-group">
<TextField <TextField
floatingLabelText="First Name" floatingLabelText="First Name"