Compare commits
3 Commits
password-v
...
eligibilit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21e6759a70 | ||
|
|
adf2ba8232 | ||
|
|
c993a194a6 |
@@ -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; }
|
||||||
|
|
||||||
|
|||||||
59
src/components/Shared/ValidationErrorsInfoDialog.js
Normal file
59
src/components/Shared/ValidationErrorsInfoDialog.js
Normal 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;
|
||||||
@@ -30,68 +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";
|
||||||
|
|
||||||
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 = {
|
||||||
@@ -416,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',
|
||||||
@@ -469,6 +421,16 @@ 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 => {
|
||||||
@@ -489,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() {
|
||||||
@@ -523,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,
|
||||||
@@ -600,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,
|
||||||
@@ -894,7 +857,17 @@ 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) => {
|
||||||
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
let userHomeAddress = null;
|
||||||
|
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 = (
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ 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);
|
||||||
@@ -226,12 +228,42 @@ class SignUp extends React.Component {
|
|||||||
localStorage.removeItem('loggedUser');
|
localStorage.removeItem('loggedUser');
|
||||||
location.href = '/#/login';
|
location.href = '/#/login';
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
alert('Error to log in: ' + err.message);
|
if (err.response.status === 422){
|
||||||
|
//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">
|
||||||
|
|
||||||
@@ -334,6 +366,10 @@ 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