Upstream sync
This commit is contained in:
59
package-lock.json
generated
59
package-lock.json
generated
@@ -8795,46 +8795,6 @@
|
|||||||
"prop-types": "15.5.10"
|
"prop-types": "15.5.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-draggable": {
|
|
||||||
"version": "3.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-draggable/-/react-draggable-3.0.5.tgz",
|
|
||||||
"integrity": "sha512-qo76q6+pafyGllbmfc+CgWfOkwY9v3UoJa3jp6xG2vdsRY8uJTN1kqNievLj0uVNjEqCvZ0OFiEBxlAJNj3OTg==",
|
|
||||||
"requires": {
|
|
||||||
"classnames": "2.2.5",
|
|
||||||
"prop-types": "15.6.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"core-js": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
|
|
||||||
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
|
|
||||||
},
|
|
||||||
"fbjs": {
|
|
||||||
"version": "0.8.16",
|
|
||||||
"resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz",
|
|
||||||
"integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=",
|
|
||||||
"requires": {
|
|
||||||
"core-js": "1.2.7",
|
|
||||||
"isomorphic-fetch": "2.2.1",
|
|
||||||
"loose-envify": "1.3.1",
|
|
||||||
"object-assign": "4.1.1",
|
|
||||||
"promise": "7.3.1",
|
|
||||||
"setimmediate": "1.0.5",
|
|
||||||
"ua-parser-js": "0.7.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"prop-types": {
|
|
||||||
"version": "15.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.0.tgz",
|
|
||||||
"integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=",
|
|
||||||
"requires": {
|
|
||||||
"fbjs": "0.8.16",
|
|
||||||
"loose-envify": "1.3.1",
|
|
||||||
"object-assign": "4.1.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-event-listener": {
|
"react-event-listener": {
|
||||||
"version": "0.4.5",
|
"version": "0.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-event-listener/-/react-event-listener-0.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-event-listener/-/react-event-listener-0.4.5.tgz",
|
||||||
@@ -8875,6 +8835,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"react-input-mask": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-input-mask/-/react-input-mask-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-HTy+j+tpMMf1ygaoR9xODCgwYm6DkdCl1kr2yPDn05SOEQTTKXMrvCeBj7h316DJ9d7q8q5Ti4jSaq68E14tJA==",
|
||||||
|
"requires": {
|
||||||
|
"invariant": "2.2.4",
|
||||||
|
"warning": "3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"invariant": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
|
||||||
|
"requires": {
|
||||||
|
"loose-envify": "1.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-motion": {
|
"react-motion": {
|
||||||
"version": "0.4.8",
|
"version": "0.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/react-motion/-/react-motion-0.4.8.tgz",
|
"resolved": "https://registry.npmjs.org/react-motion/-/react-motion-0.4.8.tgz",
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"react-helmet": "^5.1.3",
|
"react-helmet": "^5.1.3",
|
||||||
"react-hot-loader": "^3.0.0-beta.6",
|
"react-hot-loader": "^3.0.0-beta.6",
|
||||||
"react-imgix": "^7.1.1",
|
"react-imgix": "^7.1.1",
|
||||||
|
"react-input-mask": "^2.0.1",
|
||||||
"react-jquery-datatables": "^0.7.1",
|
"react-jquery-datatables": "^0.7.1",
|
||||||
"react-materialui-notifications": "^0.5.1",
|
"react-materialui-notifications": "^0.5.1",
|
||||||
"react-onclickoutside": "^5.10.0",
|
"react-onclickoutside": "^5.10.0",
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { Router, hashHistory, browserHistory } from 'react-router';
|
|||||||
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';
|
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';
|
||||||
import reducers from './reducers';
|
import reducers from './reducers';
|
||||||
import Instance from './components/Connection';
|
import Instance from './components/Connection';
|
||||||
|
import {
|
||||||
|
loggedUser,
|
||||||
|
visitReporter,
|
||||||
|
} from 'utils/authorization';
|
||||||
|
|
||||||
const middleware = routerMiddleware(hashHistory);
|
const middleware = routerMiddleware(hashHistory);
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
@@ -55,7 +59,15 @@ const rootRoute = {
|
|||||||
onChange: requireAuth,
|
onChange: requireAuth,
|
||||||
onEnter: requireAuth,
|
onEnter: requireAuth,
|
||||||
component: require('./containers/App'),
|
component: require('./containers/App'),
|
||||||
indexRoute: { onEnter: (nextState, replace) => replace('/app/table/rides') },
|
indexRoute: {
|
||||||
|
onEnter: (nextState, replace) => {
|
||||||
|
if (loggedUser.anyOf(visitReporter)) {
|
||||||
|
replace('/app/form/visit/' + loggedUser.useruuid)
|
||||||
|
} else {
|
||||||
|
replace('/app/table/rides');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
childRoutes: [
|
childRoutes: [
|
||||||
require('./routes/app'),
|
require('./routes/app'),
|
||||||
require('./routes/404'),
|
require('./routes/404'),
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ const Instance = () => {
|
|||||||
const apiUrl = process.env.NODE_ENV === 'production'
|
const apiUrl = process.env.NODE_ENV === 'production'
|
||||||
? 'https://portal-api.bcbsinstitute.com'
|
? 'https://portal-api.bcbsinstitute.com'
|
||||||
: 'https://portal-api.dev.bcbsinstitute.com';
|
: 'https://portal-api.dev.bcbsinstitute.com';
|
||||||
|
|
||||||
|
// const apiUrl = 'http://localhost:5100';
|
||||||
|
|
||||||
window.localStorage.setItem('App', '8a266a40-ed2e-4be2-bdfc-459a507bf02e');
|
window.localStorage.setItem('App', '8a266a40-ed2e-4be2-bdfc-459a507bf02e');
|
||||||
|
|
||||||
let instance = axios.create({
|
let instance = axios.create({
|
||||||
@@ -61,11 +64,25 @@ const Instance = () => {
|
|||||||
return setToken(token);
|
return setToken(token);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getAPIUrl = (url) => {
|
||||||
|
if (!url) {
|
||||||
|
return instance;
|
||||||
|
} else {
|
||||||
|
const token = getCookie('token');
|
||||||
|
return axios.create({
|
||||||
|
baseURL: url,
|
||||||
|
timeout: 60000,
|
||||||
|
headers: { App: window.localStorage.getItem('App'), Token: `Bearer ${token}`, Token: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getRawConn = () => {
|
const getRawConn = () => {
|
||||||
const token = getCookie('token');
|
const token = getCookie('token');
|
||||||
if (token && token !== null && token !== '') {
|
if (token && token !== null && token !== '') {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = '/#/login';
|
window.location.href = '/#/login';
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
@@ -80,6 +97,7 @@ const Instance = () => {
|
|||||||
getConnection,
|
getConnection,
|
||||||
setToken,
|
setToken,
|
||||||
getRawConn,
|
getRawConn,
|
||||||
|
getAPIUrl,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ import { hashHistory } from 'react-router';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
loggedUser,
|
loggedUser,
|
||||||
|
planScheduler,
|
||||||
|
providerScheduler,
|
||||||
visitReporter,
|
visitReporter,
|
||||||
} from 'utils/authorization';
|
} from 'utils/authorization';
|
||||||
|
|
||||||
|
|
||||||
const ImgIconButtonStyle = {
|
const ImgIconButtonStyle = {
|
||||||
width: '60px',
|
width: '60px',
|
||||||
height: '60px'
|
height: '60px'
|
||||||
@@ -34,6 +35,7 @@ class NavRightList extends React.Component {
|
|||||||
handleChange = (event, value) => {
|
handleChange = (event, value) => {
|
||||||
hashHistory.push(value);
|
hashHistory.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const user = JSON.parse(localStorage.getItem('loggedUser'));
|
const user = JSON.parse(localStorage.getItem('loggedUser'));
|
||||||
if (user) {
|
if (user) {
|
||||||
@@ -46,6 +48,8 @@ class NavRightList extends React.Component {
|
|||||||
<ul className="list-unstyled float-right">
|
<ul className="list-unstyled float-right">
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<IconMenu
|
<IconMenu
|
||||||
|
|
||||||
iconButtonElement={<IconButton style={ImgIconButtonStyle}><img src="assets/images/ic_account_circle_white_48dp_1x.png" alt="" className="rounded-circle img30_30" /></IconButton>}
|
iconButtonElement={<IconButton style={ImgIconButtonStyle}><img src="assets/images/ic_account_circle_white_48dp_1x.png" alt="" className="rounded-circle img30_30" /></IconButton>}
|
||||||
@@ -63,15 +67,6 @@ class NavRightList extends React.Component {
|
|||||||
leftIcon={<i className="material-icons">account_circle</i>}
|
leftIcon={<i className="material-icons">account_circle</i>}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{!loggedUser.anyOf(visitReporter) &&
|
|
||||||
<MenuItem
|
|
||||||
onTouchTap={(e) => this.handleChange(e, `/app/form/steppers/${this.state.useruuid}`)}
|
|
||||||
primaryText="Book Ride"
|
|
||||||
innerDivStyle={listItemStyle}
|
|
||||||
style={{ fontSize: '14px', lineHeight: '48px' }}
|
|
||||||
leftIcon={<i className="material-icons">mode_edit</i>}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
{loggedUser.anyOf(visitReporter) &&
|
{loggedUser.anyOf(visitReporter) &&
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onTouchTap={(e) => this.handleChange(e, `/app/form/visit/${this.state.useruuid}`)}
|
onTouchTap={(e) => this.handleChange(e, `/app/form/visit/${this.state.useruuid}`)}
|
||||||
@@ -81,6 +76,17 @@ class NavRightList extends React.Component {
|
|||||||
leftIcon={<i className="material-icons">mode_edit</i>}
|
leftIcon={<i className="material-icons">mode_edit</i>}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{!loggedUser.anyOf(visitReporter) &&
|
||||||
|
<MenuItem
|
||||||
|
onTouchTap={(e) => this.handleChange(e, `/app/form/steppers/${this.state.useruuid}`)}
|
||||||
|
primaryText="Book Ride"
|
||||||
|
innerDivStyle={listItemStyle}
|
||||||
|
style={{ fontSize: '14px', lineHeight: '48px' }}
|
||||||
|
leftIcon={<i className="material-icons">mode_edit</i>}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onTouchTap={(e) => this.handleChange(e, `/login`)}
|
onTouchTap={(e) => this.handleChange(e, `/login`)}
|
||||||
primaryText="Log Out"
|
primaryText="Log Out"
|
||||||
|
|||||||
@@ -8,61 +8,70 @@ const defaultDialogHeight = 100; //px
|
|||||||
const dialogHeightPerLine = 25; //px
|
const dialogHeightPerLine = 25; //px
|
||||||
|
|
||||||
export class ValidationErrorsInfoDialog extends React.Component {
|
export class ValidationErrorsInfoDialog extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
state = {
|
super(props)
|
||||||
|
this.props = props;
|
||||||
|
this.state = {
|
||||||
open: this.props.open,
|
open: this.props.open,
|
||||||
}
|
title: "Errors",
|
||||||
|
|
||||||
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}
|
|
||||||
onClick={this.handleClose}
|
|
||||||
/>,
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="container">
|
|
||||||
{
|
|
||||||
this.state.open &&
|
|
||||||
<Dialog
|
|
||||||
title={this.props.title ? this.props.title : 'Error'}
|
|
||||||
isDraggable={this.props.draggable ? this.props.draggable : false}
|
|
||||||
buttons={actions}
|
|
||||||
hasCloseIcon={false}
|
|
||||||
modal={this.props.modal ? this.props.modal : false}
|
|
||||||
height={defaultDialogHeight + this.props.errorMessages.length * dialogHeightPerLine}
|
|
||||||
>
|
|
||||||
{this.props.errorMessages.map(errorMessage=>{
|
|
||||||
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
|
|
||||||
const oneValidationMessageWithTab = (<span><li style={{marginLeft:2 + "em"}}>{errorMessage.message}</li></span>);
|
|
||||||
|
|
||||||
if (errorMessage.field_name === "password-tab"){
|
|
||||||
return oneValidationMessageWithTab;
|
|
||||||
} else{
|
|
||||||
return oneValidationMessage;
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</Dialog>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ValidationErrorsInfoDialog;
|
componentWillReceiveProps(newProps) {
|
||||||
|
let title = this.state.title;
|
||||||
|
if (newProps.errorTitle) {
|
||||||
|
title = newProps.errorTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ open: newProps.open, title: title });
|
||||||
|
}
|
||||||
|
|
||||||
|
handleOpen = () => {
|
||||||
|
this.setState({ open: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
handleClose = () => {
|
||||||
|
this.setState({ open: false });
|
||||||
|
this.props.onDismiss();
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const actions = [
|
||||||
|
<FlatButton
|
||||||
|
label="Dismiss"
|
||||||
|
primary={true}
|
||||||
|
onClick={this.handleClose}
|
||||||
|
/>,
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="container">
|
||||||
|
{
|
||||||
|
this.state.open &&
|
||||||
|
<Dialog
|
||||||
|
title={this.props.title ? this.props.title : 'Error'}
|
||||||
|
isDraggable={this.props.draggable ? this.props.draggable : false}
|
||||||
|
buttons={actions}
|
||||||
|
hasCloseIcon={false}
|
||||||
|
modal={this.props.modal ? this.props.modal : false}
|
||||||
|
height={defaultDialogHeight + this.props.errorMessages.length * dialogHeightPerLine}
|
||||||
|
>
|
||||||
|
{this.props.errorMessages.map(errorMessage => {
|
||||||
|
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
|
||||||
|
const oneValidationMessageWithTab = (<span><li style={{ marginLeft: 2 + "em" }}>{errorMessage.message}</li></span>);
|
||||||
|
|
||||||
|
if (errorMessage.field_name === "password-tab") {
|
||||||
|
return oneValidationMessageWithTab;
|
||||||
|
} else {
|
||||||
|
return oneValidationMessage;
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</Dialog>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ValidationErrorsInfoDialog;
|
||||||
|
|||||||
@@ -102,9 +102,17 @@ class SidebarContent extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<ul className="nav" ref={(c) => { this.nav = c; }}>
|
<ul className="nav" ref={(c) => { this.nav = c; }}>
|
||||||
{loggedUser.anyOf(visitReporter) &&
|
{loggedUser.anyOf(visitReporter) &&
|
||||||
<li><FlatButton className="prepend-icon" href={"#/app/form/visit/" + this.state.user.useruuid}><span>Create Visit</span></FlatButton></li>
|
<li>
|
||||||
|
<FlatButton href="#/app/chart"><i className="nav-icon material-icons">schedule</i><span className="nav-text">Visits</span></FlatButton>
|
||||||
|
<ul>
|
||||||
|
<li><FlatButton className="prepend-icon" href={"#/app/form/visit/" + this.state.user.useruuid}><span>Add Visit</span></FlatButton></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{!loggedUser.anyOf(visitReporter) &&
|
{!loggedUser.anyOf(visitReporter) &&
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<FlatButton href="#/app/form"><i className="nav-icon material-icons cyan-text text-lighter-4">directions_car</i><span className="nav-text">Rides</span></FlatButton>
|
<FlatButton href="#/app/form"><i className="nav-icon material-icons cyan-text text-lighter-4">directions_car</i><span className="nav-text">Rides</span></FlatButton>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -158,6 +166,8 @@ class SidebarContent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
<li className="nav-divider" />
|
<li className="nav-divider" />
|
||||||
|
<li><FlatButton className="prepend-icon" href={"#/login"}><span>Log Out</span></FlatButton></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import Footer from 'components/Footer';
|
|||||||
import Notifications from 'components/Notifications';
|
import Notifications from 'components/Notifications';
|
||||||
import Notification from 'components/Shared/Notification';
|
import Notification from 'components/Shared/Notification';
|
||||||
import GeolocationService from './Geolocation';
|
import GeolocationService from './Geolocation';
|
||||||
|
import {
|
||||||
|
loggedUser,
|
||||||
|
visitReporter,
|
||||||
|
} from 'utils/authorization';
|
||||||
|
|
||||||
class MainApp extends React.Component {
|
class MainApp extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -53,8 +57,9 @@ class MainApp extends React.Component {
|
|||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<Notifications user={this.state.user} onRideUpdate={this.handleRide} />
|
{!loggedUser.anyOf(visitReporter) &&
|
||||||
{/* <Notification user={this.state.user} onRideUpdate={this.handleRide} /> */}
|
<Notifications user={this.state.user} onRideUpdate={this.handleRide} />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,9 @@ export class NEMTLocation extends React.Component {
|
|||||||
long: 0,
|
long: 0,
|
||||||
name: '',
|
name: '',
|
||||||
address: '',
|
address: '',
|
||||||
}
|
},
|
||||||
|
searchingProvider: false,
|
||||||
|
providerList: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addCustomLabel = this.addCustomLabel.bind(this);
|
this.addCustomLabel = this.addCustomLabel.bind(this);
|
||||||
@@ -205,7 +207,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
long = geo.long;
|
long = geo.long;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -214,8 +216,8 @@ export class NEMTLocation extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locateNearby = (lat, long) => {
|
locateNearby = (lat, long) => {
|
||||||
|
this.setState(Object.assign(this.state, { nearbyPlaces: [], providers: [], providerList: [] }));
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -257,7 +259,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
return p;
|
return p;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers }));
|
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers, providerList: nearByPlaces }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -336,14 +338,14 @@ export class NEMTLocation extends React.Component {
|
|||||||
self.props.onPlaceChanged(name);
|
self.props.onPlaceChanged(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.locateNearby(name.lat, name.lng);
|
//self.locateNearby(name.lat, name.lng);
|
||||||
|
|
||||||
let buttonText = name.name;
|
let buttonText = name.name;
|
||||||
if (buttonText.length > self.state.textSize) {
|
if (buttonText.length > self.state.textSize) {
|
||||||
buttonText = buttonText.substring(0, self.state.textSize);
|
buttonText = buttonText.substring(0, self.state.textSize);
|
||||||
buttonText += '...';
|
buttonText += '...';
|
||||||
}
|
}
|
||||||
self.setState(Object.assign(self.state, { buttonValue: buttonText, inputValue: name.address }));
|
self.setState(Object.assign(self.state, { buttonValue: buttonText, inputValue: name.name, searchingProvider: false, providerList: [] }));
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +404,16 @@ export class NEMTLocation extends React.Component {
|
|||||||
objConf.currentSelection = objConf.address
|
objConf.currentSelection = objConf.address
|
||||||
objConf.buttonValue = objConf.address.name
|
objConf.buttonValue = objConf.address.name
|
||||||
objConf.inputValue = objConf.address.name
|
objConf.inputValue = objConf.address.name
|
||||||
|
|
||||||
|
// let centerLocation = this.state.centerLocation;
|
||||||
|
// if ((centerLocation.lat === undefined || centerLocation.long === undefined) || (centerLocation.lat === 0 || centerLocation.long === 0)) {
|
||||||
|
// objConf.centerLocation = objConf.address
|
||||||
|
// objConf.locationValue = objConf.address.name
|
||||||
|
|
||||||
|
// if (objConf.address.lat !== 0 && objConf.address.lng !== 0) {
|
||||||
|
// this.locateNearby(objConf.address.lat, objConf.address.lng)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!objConf.buttonValue) {
|
if (!objConf.buttonValue) {
|
||||||
@@ -413,16 +425,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
objConf.buttonValue += '...';
|
objConf.buttonValue += '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (self.state.user.useruuid === '') {
|
|
||||||
// if (objConf.data.user && objConf.data.user !== null && objConf.data.user.useruuid !== '') {
|
|
||||||
// let url = `/v1/nemt/users/member/` + objConf.data.user.useruuid
|
|
||||||
// instance.get(url).then(res => {
|
|
||||||
// let user = res.data;
|
|
||||||
// self.setState(Object.assign(self.state, { user: user }));
|
|
||||||
// }).catch(console.error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.setState(Object.assign(this.state, objConf));
|
this.setState(Object.assign(this.state, objConf));
|
||||||
|
|
||||||
if (this.state.type === "flat") {
|
if (this.state.type === "flat") {
|
||||||
@@ -465,13 +467,13 @@ export class NEMTLocation extends React.Component {
|
|||||||
objConf.buttonValue += '...';
|
objConf.buttonValue += '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (self.state.user.useruuid === '' || self.state.user.useruuid !== objConf.data.user.useruuid) {
|
// if (nextProps.address) {
|
||||||
// if (objConf.data.user && objConf.data.user !== null && objConf.data.user.useruuid !== '') {
|
// let centerLocation = this.state.centerLocation;
|
||||||
// let url = `/v1/nemt/users/member/` + objConf.data.user.useruuid
|
// if ((centerLocation.lat === undefined || centerLocation.long === undefined) || (centerLocation.lat === 0 || centerLocation.long === 0)) {
|
||||||
// instance.get(url).then(res => {
|
// objConf.centerLocation = nextProps.address
|
||||||
// let user = res.data;
|
// objConf.locationValue = nextProps.address.name
|
||||||
// self.setState(Object.assign(self.state, { user: user }));
|
|
||||||
// }).catch(console.error);
|
// this.locateNearby(nextProps.address.lat, nextProps.address.lng)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -540,7 +542,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
long = geo.long;
|
long = geo.long;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -567,9 +569,15 @@ export class NEMTLocation extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTextSearch(searchText, dtSource, params) {
|
updateTextSearch(event) {
|
||||||
|
const searchText = event.target.value;
|
||||||
let self = this;
|
let self = this;
|
||||||
self.setState(Object.assign(self.state, { inputValue: searchText }));
|
self.setState(Object.assign(self.state, { inputValue: searchText, searchingProvider: true }));
|
||||||
|
|
||||||
|
if (searchText.length === 0) {
|
||||||
|
self.setState(Object.assign(self.state, { searchingProvider: false }));
|
||||||
|
}
|
||||||
|
|
||||||
if (searchText.length >= 3) {
|
if (searchText.length >= 3) {
|
||||||
let lat = 0;
|
let lat = 0;
|
||||||
let long = 0;
|
let long = 0;
|
||||||
@@ -582,7 +590,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
long = geo.long;
|
long = geo.long;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -618,10 +626,11 @@ export class NEMTLocation extends React.Component {
|
|||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
var listItem = (<ListItem primaryText={p.providerName} secondaryText={clickResult.address} key={p.mukId} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handlePlaceChanged(clickResult)} />)
|
||||||
|
return listItem;
|
||||||
});
|
});
|
||||||
this.setState(Object.assign(this.state, { providers: providers }));
|
|
||||||
dtSource = self.state.providers;
|
this.setState(Object.assign(this.state, { providerList: providers }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -670,7 +679,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
long = geo.long;
|
long = geo.long;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -1045,7 +1054,7 @@ export class NEMTLocation extends React.Component {
|
|||||||
long = geo.long;
|
long = geo.long;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if ((lat === undefined || long === undefined) || (lat === 0 || long === 0)) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
@@ -1331,14 +1340,16 @@ export class NEMTLocation extends React.Component {
|
|||||||
{customAddresses}
|
{customAddresses}
|
||||||
<ListItem primaryText="Add Custom Shortcut" rightIcon={<ArrowDropRight />} leftIcon={<MapsLocalHospital />} onClick={(e) => this.handleAddAddress(e, 'custom')} />
|
<ListItem primaryText="Add Custom Shortcut" rightIcon={<ArrowDropRight />} leftIcon={<MapsLocalHospital />} onClick={(e) => this.handleAddAddress(e, 'custom')} />
|
||||||
</List>)
|
</List>)
|
||||||
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Provider's name or address" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
|
autosuggest = (<TextField fullWidth={true} onChange={this.updateTextSearch} floatingLabelText={"Enter the Provider's name or address"} value={this.state.inputValue} />)
|
||||||
|
//autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Provider's name or address" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
|
||||||
} else {
|
} else {
|
||||||
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Member's address or a nearby intersection or public place" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
|
autosuggest = (<TextField fullWidth={true} onChange={this.updateTextSearch} floatingLabelText={"Enter the Member's address or a nearby intersection or public place"} value={this.state.inputValue} />)
|
||||||
|
//autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Member's address or a nearby intersection or public place" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
|
||||||
}
|
}
|
||||||
|
|
||||||
let listItem = (
|
let listItem = (
|
||||||
<div className="" id="container">
|
<div className="" id="container">
|
||||||
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
|
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
|
||||||
{autosuggest}
|
{autosuggest}
|
||||||
<List>
|
<List>
|
||||||
{this.state.currentLocation}
|
{this.state.currentLocation}
|
||||||
@@ -1352,8 +1363,21 @@ export class NEMTLocation extends React.Component {
|
|||||||
<List style={customListStyle}>
|
<List style={customListStyle}>
|
||||||
{this.state.nearbyPlaces}
|
{this.state.nearbyPlaces}
|
||||||
</List>
|
</List>
|
||||||
</div >
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (this.state.searchingProvider) {
|
||||||
|
listItem = (
|
||||||
|
<div className="" id="container">
|
||||||
|
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
|
||||||
|
{autosuggest}
|
||||||
|
<List style={customListStyle}>
|
||||||
|
{this.state.providerList}
|
||||||
|
</List>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state.addLocation) {
|
if (this.state.addLocation) {
|
||||||
listItem = (
|
listItem = (
|
||||||
<div className="" id="container">
|
<div className="" id="container">
|
||||||
|
|||||||
@@ -405,8 +405,8 @@ class VerticalNonLinear extends React.Component {
|
|||||||
},
|
},
|
||||||
return_time: new Date(),
|
return_time: new Date(),
|
||||||
pickupTimeHide: false,
|
pickupTimeHide: false,
|
||||||
showValidationErrors:false,
|
showValidationErrors: false,
|
||||||
validationErrors:[]
|
validationErrors: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,6 +502,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
eta: 0,
|
eta: 0,
|
||||||
trip_type: state.state.trip_type,
|
trip_type: state.state.trip_type,
|
||||||
return_time: state.state.return_time,
|
return_time: state.state.return_time,
|
||||||
|
raw_provider: state.state.destination.raw,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (self.state.eta.distance_miles) requestRide.distance = self.state.eta.distance_miles;
|
if (self.state.eta.distance_miles) requestRide.distance = self.state.eta.distance_miles;
|
||||||
@@ -517,6 +518,9 @@ class VerticalNonLinear extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(JSON.stringify(requestRide));
|
||||||
|
return false;
|
||||||
|
|
||||||
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;
|
||||||
@@ -524,8 +528,8 @@ class VerticalNonLinear extends React.Component {
|
|||||||
if (error.response.status === 422) {
|
if (error.response.status === 422) {
|
||||||
//Unprocessable Entity (validation failed)
|
//Unprocessable Entity (validation failed)
|
||||||
self.setState(Object.assign(self.state, {
|
self.setState(Object.assign(self.state, {
|
||||||
showValidationErrors:true,
|
showValidationErrors: true,
|
||||||
validationErrors:error.response.data.data
|
validationErrors: error.response.data.data
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -715,8 +719,10 @@ class VerticalNonLinear extends React.Component {
|
|||||||
name: res.name,
|
name: res.name,
|
||||||
lat: res.lat,
|
lat: res.lat,
|
||||||
lng: res.lng,
|
lng: res.lng,
|
||||||
address: res.address
|
address: res.address,
|
||||||
|
raw: res.raw,
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = res.name;
|
const name = res.name;
|
||||||
|
|
||||||
if (self.state.origin && self.state.origin.lat && self.state.origin.lng) {
|
if (self.state.origin && self.state.origin.lat && self.state.origin.lng) {
|
||||||
@@ -896,8 +902,8 @@ 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 title={'Errors'} open = {this.state.showValidationErrors} draggable={true} modal={false} errorMessages = {this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
<ValidationErrorsInfoDialog title={'Errors'} open={this.state.showValidationErrors} draggable={true} modal={false} errorMessages={this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)} />
|
||||||
|
|
||||||
<Stepper
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
linear={false}
|
linear={false}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ 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';
|
||||||
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
|
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
|
||||||
|
import InputMask from 'react-input-mask';
|
||||||
|
|
||||||
let DateTimeFormat;
|
let DateTimeFormat;
|
||||||
const roundingTime = 1000 * 60 * 5; //5 minutes
|
const roundingTime = 1000 * 60 * 5; //5 minutes
|
||||||
@@ -44,6 +45,10 @@ class SignUp extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.props = props;
|
this.props = props;
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
birthdate: null,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps = (nextProps) => {
|
componentWillReceiveProps = (nextProps) => {
|
||||||
@@ -102,6 +107,8 @@ class SignUp extends React.Component {
|
|||||||
handleDate = (event, date) => {
|
handleDate = (event, date) => {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
user.birthdate = date;
|
user.birthdate = date;
|
||||||
|
|
||||||
|
this.setState(Object.assign(this.state, { birthdate: date }));
|
||||||
if (this.props.onUserChanged) {
|
if (this.props.onUserChanged) {
|
||||||
this.props.onUserChanged(user);
|
this.props.onUserChanged(user);
|
||||||
}
|
}
|
||||||
@@ -157,7 +164,7 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
handlePhone = (event) => {
|
handlePhone = (event) => {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
user.phonenumber = event.target.value;;
|
user.phonenumber = event.target.value;
|
||||||
if (this.props.onUserChanged) {
|
if (this.props.onUserChanged) {
|
||||||
this.props.onUserChanged(user);
|
this.props.onUserChanged(user);
|
||||||
}
|
}
|
||||||
@@ -219,16 +226,19 @@ class SignUp extends React.Component {
|
|||||||
onChange={this.handleMember}
|
onChange={this.handleMember}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DatePicker width="115" hintText="Birth Date" container="inline" style={{ width: 115 }}
|
<DatePicker width="115" hintText="Member Birth Date" container="inline" style={{ width: 115 }}
|
||||||
value={this.props.user.birthdate} onChange={this.handleDate} />
|
value={this.state.birthdate} onChange={this.handleDate} />
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
style={{ maxWidth: 115 }}
|
style={{ maxWidth: 115 }}
|
||||||
floatingLabelText="Mobile Phone"
|
ref="phone"
|
||||||
type="telephone"
|
type="telephone"
|
||||||
value={this.props.user.phonenumber}
|
value={this.props.user.phonenumber}
|
||||||
onChange={this.handlePhone}
|
onChange={this.handlePhone}
|
||||||
/>
|
floatingLabelText="Mobile Phone"
|
||||||
|
>
|
||||||
|
<InputMask mask="(999) 999-9999" maskChar={null} value={this.props.user.phonenumber} />
|
||||||
|
</TextField>
|
||||||
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="Member has consented to terms"
|
label="Member has consented to terms"
|
||||||
@@ -594,6 +604,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
email: "",
|
email: "",
|
||||||
phonenumber: "",
|
phonenumber: "",
|
||||||
type: "",
|
type: "",
|
||||||
|
agreedTerms: false,
|
||||||
},
|
},
|
||||||
showUserSelection: true,
|
showUserSelection: true,
|
||||||
userSelectionText: '',
|
userSelectionText: '',
|
||||||
@@ -615,44 +626,17 @@ class VerticalNonLinear extends React.Component {
|
|||||||
pickupTimeHide: false,
|
pickupTimeHide: false,
|
||||||
validationErrors: [],
|
validationErrors: [],
|
||||||
showValidationErrors: false,
|
showValidationErrors: false,
|
||||||
|
userValidated: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleUser = this.handleUser.bind(this);
|
this.handleUser = this.handleUser.bind(this);
|
||||||
|
this.validateUser = this.validateUser.bind(this);
|
||||||
|
this.lastStep = this.lastStep.bind(this);
|
||||||
|
this.handleReset = this.handleReset.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const loggedUser = JSON.parse(localStorage.getItem("loggedUser"));
|
this.handleReset()
|
||||||
let state = this;
|
|
||||||
|
|
||||||
let user = {
|
|
||||||
useruuid: this.props.params.uuid
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user.useruuid !== loggedUser.useruuid) {
|
|
||||||
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
|
||||||
.then(function (res) {
|
|
||||||
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
if (err.response.status !== 422) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let date = new Date();
|
|
||||||
|
|
||||||
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
||||||
let visitDate = date;
|
|
||||||
let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
||||||
let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
||||||
|
|
||||||
this.setState(Object.assign(this.state, {
|
|
||||||
visitDate: visitDate,
|
|
||||||
visitTime: visitTime,
|
|
||||||
pickupTime: pickupTime,
|
|
||||||
pickupTimeReturn: pickupTimeReturn,
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
//for snackbar
|
//for snackbar
|
||||||
handleTouchTap() {
|
handleTouchTap() {
|
||||||
@@ -672,9 +656,13 @@ class VerticalNonLinear extends React.Component {
|
|||||||
let self = state;
|
let self = state;
|
||||||
const { stepIndex } = self.state;
|
const { stepIndex } = self.state;
|
||||||
|
|
||||||
//console.log('Step Index: ', stepIndex)
|
|
||||||
switch (stepIndex) {
|
switch (stepIndex) {
|
||||||
case 1:
|
case 1:
|
||||||
|
self.setState(Object.assign(self.state, {
|
||||||
|
message: ('Verifying Member\'s Eligibility'),
|
||||||
|
open: true,
|
||||||
|
}));
|
||||||
|
|
||||||
const eligibility = {
|
const eligibility = {
|
||||||
"provider": {
|
"provider": {
|
||||||
"provider_npi": self.state.destination.raw.fivePartKeyGroups[0].providerNum,
|
"provider_npi": self.state.destination.raw.fivePartKeyGroups[0].providerNum,
|
||||||
@@ -690,22 +678,50 @@ class VerticalNonLinear extends React.Component {
|
|||||||
"demographic_info": {
|
"demographic_info": {
|
||||||
"date_of_birth": self.state.user.birthdate,
|
"date_of_birth": self.state.user.birthdate,
|
||||||
"gender": self.state.user.gender
|
"gender": self.state.user.gender
|
||||||
},
|
}
|
||||||
"user": self.state.user,
|
},
|
||||||
}
|
"user": {
|
||||||
|
"name": `${self.state.user.first} ${self.state.user.last}`,
|
||||||
|
"first": self.state.user.first,
|
||||||
|
"last": self.state.user.last,
|
||||||
|
"gender": self.state.user.gender,
|
||||||
|
"member": self.state.user.member,
|
||||||
|
"birthdate": self.state.user.birthdate,
|
||||||
|
"type": self.state.user.type,
|
||||||
|
"email": self.state.user.email,
|
||||||
|
"phonenumber": self.state.user.phonenumber,
|
||||||
|
"consent": self.state.user.agreedTerms,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(JSON.stringify(eligibility));
|
if(self.state.user.phonenumber && self.state.user.phonenumber.length > 0) {
|
||||||
|
eligibility.user.phonenumber = eligibility.user.phonenumber.replace('(','').replace(')','').replace('-','').replace(' ','').trim()
|
||||||
|
}
|
||||||
|
|
||||||
Instance.getRawConn().post('/v1/nemt/eligibility', eligibility).then(function (res) {
|
Instance.getRawConn().post('/v1/nemt/eligibility', eligibility).then(function (res) {
|
||||||
self.setState(Object.assign(self.state, { stepIndex: stepIndex + 1, user: res.data }));
|
res.data.agreedTerms = true;
|
||||||
}).catch(err => {
|
self.setState(Object.assign(self.state, { stepIndex: stepIndex + 1, user: res.data, message: '', open: false }));
|
||||||
if (err.response.status === 403) {
|
}).catch(error => {
|
||||||
|
|
||||||
|
self.setState(Object.assign(self.state, {
|
||||||
|
message: '',
|
||||||
|
open: false,
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (error.response.status === 422 && error.response.data.data) {
|
||||||
self.setState(Object.assign(self.state, {
|
self.setState(Object.assign(self.state, {
|
||||||
showValidationErrors: true,
|
showValidationErrors: true,
|
||||||
validationErrors: [err.response.data],
|
validationErrors: error.response.data.data,
|
||||||
|
message: '',
|
||||||
|
open: false
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
console.error(err);
|
self.setState(Object.assign(self.state, {
|
||||||
|
showValidationErrors: true,
|
||||||
|
validationErrors: [error.response.data],
|
||||||
|
message: '',
|
||||||
|
open: false
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -721,17 +737,59 @@ class VerticalNonLinear extends React.Component {
|
|||||||
"birthdate": self.state.user.birthdate,
|
"birthdate": self.state.user.birthdate,
|
||||||
"type": self.state.user.type,
|
"type": self.state.user.type,
|
||||||
"email": self.state.user.email,
|
"email": self.state.user.email,
|
||||||
"phonenumber": self.state.user.phonenumber
|
"phonenumber": self.state.user.phonenumber,
|
||||||
|
"consent": self.state.user.agreedTerms,
|
||||||
},
|
},
|
||||||
"visit_datetime": self.state.visitTime,
|
"visit_datetime": self.state.visitTime,
|
||||||
"pickup_datetime": self.state.pickupTime,
|
"pickup_datetime": self.state.pickupTime,
|
||||||
"external_id": self.state.visit_external_id,
|
"external_id": self.state.visit_external_id,
|
||||||
"provider": self.state.destination.raw
|
"raw_provider": self.state.destination.raw
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(self.state.user.phonenumber && self.state.user.phonenumber.length > 0) {
|
||||||
|
visit.user.phonenumber = visit.user.phonenumber.replace('(','').replace(')','').replace('-','').replace(' ','').trim()
|
||||||
|
}
|
||||||
|
|
||||||
Instance.getRawConn().post('/v1/nemt/visits/', visit).then(function (res) {
|
Instance.getRawConn().post('/v1/nemt/visits/', visit).then(function (res) {
|
||||||
window.location.href = '/#/app/table/visits';
|
const returnMessage = [
|
||||||
}).catch(console.error);
|
{
|
||||||
|
message: `Member: ${res.data.user.name} (${res.data.user.member})`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: `Gender: ${res.data.user.gender}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: `Birth date: ${visit.user.type}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: `Member Type: ${res.data.user.birthdate}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: `Provider: ${res.data.provider.name}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
message: `Date: ${res.data.visit_datetime}`
|
||||||
|
}]
|
||||||
|
|
||||||
|
self.setState(Object.assign(self.state, {
|
||||||
|
showValidationErrors: true,
|
||||||
|
validationErrors: returnMessage,
|
||||||
|
errorTitle: "Visit Added"
|
||||||
|
}));
|
||||||
|
self.handleReset();
|
||||||
|
}).catch(error => {
|
||||||
|
if (error.response.status === 422 && error.response.data.data) {
|
||||||
|
self.setState(Object.assign(self.state, {
|
||||||
|
showValidationErrors: true,
|
||||||
|
validationErrors: error.response.data.data
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
self.setState(Object.assign(self.state, {
|
||||||
|
showValidationErrors: true,
|
||||||
|
validationErrors: [error.response.data]
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (stepIndex < 3) {
|
if (stepIndex < 3) {
|
||||||
@@ -840,19 +898,75 @@ class VerticalNonLinear extends React.Component {
|
|||||||
let trip_type = {
|
let trip_type = {
|
||||||
key: value.selectField,
|
key: value.selectField,
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(event, index, value, state);
|
|
||||||
// console.log(trip_type);
|
|
||||||
|
|
||||||
|
|
||||||
self.setState(Object.assign(self.state, { pickupTimeReturnDisplayMode: value.pickupTimeReturnDisplayMode, trip_type: trip_type, pickupTimeHide: value.pickupTimeHide }));
|
self.setState(Object.assign(self.state, { pickupTimeReturnDisplayMode: value.pickupTimeReturnDisplayMode, trip_type: trip_type, pickupTimeHide: value.pickupTimeHide }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleReset() {
|
||||||
|
const loggedUser = JSON.parse(localStorage.getItem("loggedUser"));
|
||||||
|
let state = this;
|
||||||
|
|
||||||
|
let user = {
|
||||||
|
useruuid: this.props.params.uuid
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user.useruuid !== loggedUser.useruuid) {
|
||||||
|
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
||||||
|
.then(function (res) {
|
||||||
|
res.data.agreedTerms = false;
|
||||||
|
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (err.response.status !== 422) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
|
||||||
|
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
|
let visitDate = date;
|
||||||
|
let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
|
let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
|
|
||||||
|
this.setState(Object.assign(this.state, {
|
||||||
|
visitDate: visitDate,
|
||||||
|
visitTime: visitTime,
|
||||||
|
pickupTime: pickupTime,
|
||||||
|
pickupTimeReturn: pickupTimeReturn,
|
||||||
|
stepIndex: 0,
|
||||||
|
providerID: '',
|
||||||
|
providerName: '',
|
||||||
|
visit_external_id: '',
|
||||||
|
buttonProviderText: 'Choose Provider',
|
||||||
|
destination: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
lat: 0,
|
||||||
|
lng: 0,
|
||||||
|
address: '',
|
||||||
|
raw: null
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
name: "",
|
||||||
|
first: "",
|
||||||
|
last: "",
|
||||||
|
gender: "",
|
||||||
|
member: "",
|
||||||
|
birthdate: new Date(),
|
||||||
|
email: "",
|
||||||
|
phonenumber: "",
|
||||||
|
type: "",
|
||||||
|
agreedTerms: false,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
renderStepActions(step, state) {
|
renderStepActions(step, state) {
|
||||||
let self = state;
|
let self = state;
|
||||||
return (
|
return (
|
||||||
<div style={{ margin: '12px 0' }}>
|
<div style={{ margin: '12px 0' }}>
|
||||||
{step !== 2 && (
|
{step === 1 && (
|
||||||
<RaisedButton
|
<RaisedButton
|
||||||
label="Next"
|
label="Next"
|
||||||
disableTouchRipple
|
disableTouchRipple
|
||||||
@@ -862,23 +976,43 @@ class VerticalNonLinear extends React.Component {
|
|||||||
style={{ marginRight: 12 }}
|
style={{ marginRight: 12 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{step === 0 && (
|
||||||
|
<RaisedButton
|
||||||
|
label="Next"
|
||||||
|
disableTouchRipple
|
||||||
|
disableFocusRipple
|
||||||
|
primary
|
||||||
|
onTouchTap={() => self.handleNext(self)}
|
||||||
|
style={{ marginRight: 12 }}
|
||||||
|
disabled={!this.state.userValidated}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{step !== 1 && (
|
||||||
|
<FlatButton
|
||||||
|
label="Back"
|
||||||
|
disableTouchRipple
|
||||||
|
disableFocusRipple
|
||||||
|
onTouchTap={() => self.handlePrev(self)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{step === 2 && (
|
{step === 2 && (
|
||||||
<RaisedButton
|
<RaisedButton
|
||||||
label="Confirm"
|
label="Add Visit"
|
||||||
disableTouchRipple
|
disableTouchRipple
|
||||||
disableFocusRipple
|
disableFocusRipple
|
||||||
primary
|
primary
|
||||||
onTouchTap={() => self.handleNext(self)}
|
onTouchTap={() => self.handleNext(self)}
|
||||||
style={{ marginRight: 12 }}
|
style={{ marginRight: 12 }}
|
||||||
href=""
|
href=""
|
||||||
|
disabled={!this.state.userValidated}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{step > 0 && (
|
{step === 2 && (
|
||||||
<FlatButton
|
<FlatButton
|
||||||
label="Back"
|
label="Reset"
|
||||||
disableTouchRipple
|
disableTouchRipple
|
||||||
disableFocusRipple
|
disableFocusRipple
|
||||||
onTouchTap={() => self.handlePrev(self)}
|
onTouchTap={() => self.handleReset()}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1026,6 +1160,52 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
handleUser(user) {
|
handleUser(user) {
|
||||||
this.setState(Object.assign(this.state, { user: user }));
|
this.setState(Object.assign(this.state, { user: user }));
|
||||||
|
this.validateUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
validateUser() {
|
||||||
|
let userValidated = true;
|
||||||
|
const genderList = ["M", "F", "U"]
|
||||||
|
const memberTypeList = ["S", "D", "U"]
|
||||||
|
|
||||||
|
userValidated = !(!this.state.user.first || this.state.user.first.trim().length === 0);
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.last || this.state.user.last.trim().length === 0);
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.member || this.state.user.member.trim().length === 0);
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.gender || genderList.indexOf(this.state.user.gender) === -1);
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.type || memberTypeList.indexOf(this.state.user.type) === -1);
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.birthdate || this.state.user.birthdate === null || isNaN(this.state.user.birthdate.getTime()))
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
userValidated = !(!this.state.user.agreedTerms)
|
||||||
|
if (!userValidated) {
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState(Object.assign(this.state, { userValidated: userValidated }));
|
||||||
|
return userValidated
|
||||||
}
|
}
|
||||||
|
|
||||||
handleValidationErrosDialogDismiss() {
|
handleValidationErrosDialogDismiss() {
|
||||||
@@ -1034,6 +1214,10 @@ class VerticalNonLinear extends React.Component {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastStep = () => {
|
||||||
|
if (this.state.userValidated) this.setState({ stepIndex: 2 });
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
// const { stepIndex } = this.state;
|
// const { stepIndex } = this.state;
|
||||||
this.getLocation();
|
this.getLocation();
|
||||||
@@ -1130,7 +1314,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
</StepContent>
|
</StepContent>
|
||||||
</Step>
|
</Step>
|
||||||
<Step>
|
<Step>
|
||||||
<StepButton onClick={() => this.setState({ stepIndex: 2 })}>
|
<StepButton onClick={() => this.lastStep()}>
|
||||||
Visit Details
|
Visit Details
|
||||||
</StepButton>
|
</StepButton>
|
||||||
<StepContent>
|
<StepContent>
|
||||||
@@ -1160,7 +1344,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
|
|
||||||
{/* <TabsSection /> */}
|
{/* <TabsSection /> */}
|
||||||
{this.renderStepActions(1, this)}
|
{this.renderStepActions(2, this)}
|
||||||
</StepContent>
|
</StepContent>
|
||||||
</Step>
|
</Step>
|
||||||
|
|
||||||
@@ -1187,7 +1371,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import Instance from '../../../../../../../components/Connection';
|
|||||||
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
|
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';
|
||||||
|
import InputMask from 'react-input-mask';
|
||||||
|
|
||||||
let DateTimeFormat;
|
let DateTimeFormat;
|
||||||
const roundingTime = 1000 * 60 * 5; //5 minutes
|
const roundingTime = 1000 * 60 * 5; //5 minutes
|
||||||
@@ -70,6 +71,7 @@ class SignUp extends React.Component {
|
|||||||
if (this.props.onUserChanged) {
|
if (this.props.onUserChanged) {
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
user.phonenumber = event.target.value;
|
user.phonenumber = event.target.value;
|
||||||
|
user.phonenumber = user.phonenumber.replace('(','').replace(')','').replace('-','').replace(' ','').trim();
|
||||||
this.props.onUserChanged(user);
|
this.props.onUserChanged(user);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -134,11 +136,14 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
style={{ maxWidth: 115 }}
|
style={{ maxWidth: 115 }}
|
||||||
floatingLabelText="Mobile Phone"
|
ref="phone"
|
||||||
type="telephone"
|
type="telephone"
|
||||||
|
floatingLabelText="Mobile Phone"
|
||||||
value={this.props.user.phonenumber}
|
value={this.props.user.phonenumber}
|
||||||
onChange={this.handlePhone}
|
onChange={this.handlePhone}
|
||||||
/>
|
>
|
||||||
|
<InputMask mask="(999) 999-9999" maskChar={null} value={this.props.user.phonenumber} />
|
||||||
|
</TextField>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
@@ -505,6 +510,7 @@ class VerticalNonLinear extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.handleUser = this.handleUser.bind(this);
|
this.handleUser = this.handleUser.bind(this);
|
||||||
|
this.handlePickupChanged = this.handlePickupChanged.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -518,7 +524,28 @@ class VerticalNonLinear extends React.Component {
|
|||||||
const visit = res.data;
|
const visit = res.data;
|
||||||
visit.user.birthdate = new Date(visit.user.birthdate);
|
visit.user.birthdate = new Date(visit.user.birthdate);
|
||||||
visit.visit_datetime = new Date(visit.visit_datetime);
|
visit.visit_datetime = new Date(visit.visit_datetime);
|
||||||
self.setState(Object.assign(self.state, { visit: visit }));
|
|
||||||
|
if(visit.user.phonenumber && visit.user.phonenumber.length > 9) {
|
||||||
|
visit.user.phonenumber = visit.user.phonenumber.replace('+1', '').replace(' ', '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visit.user.addresses) {
|
||||||
|
visit.user.addresses.forEach(a => {
|
||||||
|
if (a.address_type === 'home') {
|
||||||
|
const origin = {
|
||||||
|
id: a.address_uuid,
|
||||||
|
name: a.address_type_name,
|
||||||
|
lat: a.lat,
|
||||||
|
lng: a.lng,
|
||||||
|
address: a.address
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setState(Object.assign(self.state, { origin: origin, buttonPickupText: a.address_type_name }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
self.setState(Object.assign(self.state, { visit: visit, user: visit.user }));
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.response.status !== 422) {
|
if (err.response.status !== 422) {
|
||||||
@@ -555,6 +582,8 @@ class VerticalNonLinear extends React.Component {
|
|||||||
pickup_time: self.state.pickupTime,
|
pickup_time: self.state.pickupTime,
|
||||||
return_time: self.state.return_time,
|
return_time: self.state.return_time,
|
||||||
notes: self.state.notes,
|
notes: self.state.notes,
|
||||||
|
origin: self.state.origin,
|
||||||
|
user: self.state.visit.user,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (self.diffMinutes(self.state.pickupTime, new Date()) > 10) {
|
if (self.diffMinutes(self.state.pickupTime, new Date()) > 10) {
|
||||||
@@ -713,8 +742,22 @@ class VerticalNonLinear extends React.Component {
|
|||||||
const visit = this.state.visit;
|
const visit = this.state.visit;
|
||||||
visit.user = user;
|
visit.user = user;
|
||||||
this.setState(Object.assign(this.state, { visit: visit }));
|
this.setState(Object.assign(this.state, { visit: visit }));
|
||||||
|
}
|
||||||
|
|
||||||
console.log(user);
|
handlePickupChanged = (res) => {
|
||||||
|
let origin = {
|
||||||
|
id: res.address_uuid ? res.address_uuid : res.id,
|
||||||
|
name: res.name,
|
||||||
|
lat: res.lat,
|
||||||
|
lng: res.lng,
|
||||||
|
address: res.address
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = res.name;
|
||||||
|
this.setState(Object.assign(this.state, {
|
||||||
|
buttonPickupText: name,
|
||||||
|
origin: origin
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -801,6 +844,8 @@ class VerticalNonLinear extends React.Component {
|
|||||||
<StepContent>
|
<StepContent>
|
||||||
<form role="form">
|
<form role="form">
|
||||||
<SignUp user={this.state.visit.user} onUserChanged={this.handleUser} />
|
<SignUp user={this.state.visit.user} onUserChanged={this.handleUser} />
|
||||||
|
<div className="divider" />
|
||||||
|
<NEMTLocation type="flat" floatingLabelText='Choose Member Location' hintText="Choose Member Location" data={this.state} title={"Member Address"} value={""} buttonvalue={this.state.buttonPickupText} onPlaceChanged={(provider) => this.handlePickupChanged(provider, this)} fontSize={12} loadSuggestion={true} address={this.state.origin} />
|
||||||
</form>
|
</form>
|
||||||
{this.renderStepActions(0, this)}
|
{this.renderStepActions(0, this)}
|
||||||
</StepContent>
|
</StepContent>
|
||||||
|
|||||||
@@ -79,18 +79,15 @@ class Login extends React.Component {
|
|||||||
}).then(function (res) {
|
}).then(function (res) {
|
||||||
let auth = res.data;
|
let auth = res.data;
|
||||||
state.setCookie('token', auth.token, auth.valid_time);
|
state.setCookie('token', auth.token, auth.valid_time);
|
||||||
|
Instance.setToken(auth.token);
|
||||||
localStorage.setItem('loggedUser', JSON.stringify(auth.user));
|
localStorage.setItem('loggedUser', JSON.stringify(auth.user));
|
||||||
|
loggedUser.update();
|
||||||
|
|
||||||
console.log("....");
|
if (loggedUser.anyOf(visitReporter)) {
|
||||||
console.log(loggedUser.anyOf(visitReporter));
|
|
||||||
|
|
||||||
if (loggedUser.anyOf(visitReporter)){
|
|
||||||
location.href = '/#/app/form/visit/' + auth.user.useruuid;
|
location.href = '/#/app/form/visit/' + auth.user.useruuid;
|
||||||
}else{
|
} else {
|
||||||
location.href = '/#/app/table/rides';
|
location.href = '/#/app/table/rides';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
state.setState(Object.assign(state.state, {
|
state.setState(Object.assign(state.state, {
|
||||||
message: (err.response.data.message),
|
message: (err.response.data.message),
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import { contains } from 'ramda';
|
|||||||
|
|
||||||
import normalizeRoles from './normalizeRoles';
|
import normalizeRoles from './normalizeRoles';
|
||||||
|
|
||||||
const loggedUser = JSON.parse(window.localStorage.getItem('loggedUser'));
|
const loggedUser = () => {
|
||||||
|
let user = JSON.parse(window.localStorage.getItem('loggedUser'));
|
||||||
|
|
||||||
if (loggedUser) {
|
const anyOf = (...profiles) => {
|
||||||
loggedUser.anyOf = (...profiles) => {
|
const userRole = user.profiles[0];
|
||||||
const userRole = loggedUser.profiles[0];
|
|
||||||
const userOrgType = userRole.organization.type.key;
|
const userOrgType = userRole.organization.type.key;
|
||||||
const roles = normalizeRoles(profiles);
|
const roles = normalizeRoles(profiles);
|
||||||
|
|
||||||
@@ -22,7 +22,18 @@ if (loggedUser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
const update = () => {
|
||||||
|
user = JSON.parse(window.localStorage.getItem('loggedUser'));
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
user,
|
||||||
|
anyOf: anyOf,
|
||||||
|
update: update,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default loggedUser;
|
export default loggedUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user