Compare commits
2 Commits
make-error
...
hide-profi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b86c36e8a | ||
|
|
ef904e4e38 |
@@ -57,9 +57,8 @@
|
|||||||
"react": "^15.5.4",
|
"react": "^15.5.4",
|
||||||
"react-cookie": "^2.1.2",
|
"react-cookie": "^2.1.2",
|
||||||
"react-data-components": "^1.1.1",
|
"react-data-components": "^1.1.1",
|
||||||
"react-dialog": "^1.0.2",
|
|
||||||
"react-dom": "^15.5.4",
|
"react-dom": "^15.5.4",
|
||||||
"react-draggable": "^2.2.6",
|
"react-draggable": "^3.0.5",
|
||||||
"react-geosuggest": "^2.5.0",
|
"react-geosuggest": "^2.5.0",
|
||||||
"react-geosuggest-sw": "^1.4.13",
|
"react-geosuggest-sw": "^1.4.13",
|
||||||
"react-google-maps": "^7.2.0",
|
"react-google-maps": "^7.2.0",
|
||||||
@@ -68,10 +67,8 @@
|
|||||||
"react-imgix": "^7.1.1",
|
"react-imgix": "^7.1.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-places-autocomplete": "^5.4.2",
|
"react-places-autocomplete": "^5.4.2",
|
||||||
"react-redux": "^5.0.5",
|
"react-redux": "^5.0.5",
|
||||||
"react-resizable": "^1.7.1",
|
|
||||||
"react-router": "^3.0.4",
|
"react-router": "^3.0.4",
|
||||||
"react-router-redux": "^4.0.8",
|
"react-router-redux": "^4.0.8",
|
||||||
"react-tap-event-plugin": "^2.0.1",
|
"react-tap-event-plugin": "^2.0.1",
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ const isFunction = (functionToCheck) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const requireAuth = (nextState, replace, next) => {
|
const requireAuth = (nextState, replace, next) => {
|
||||||
if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || nextState.location.pathname === '/selfRegister' || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined)
|
if (nextState.location.pathname === '/login' || nextState.location.pathname === '/sign-up' || (nextState.location.pathname.indexOf('/ride') > -1 && nextState.params.ride_uuid !== undefined && nextState.params.user_uuid !== undefined)
|
||||||
|| (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || nextState.location.pathname === '/selfRegister' || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) {
|
|| (!isFunction(replace) && (replace.location.pathname === '/login' || replace.location.pathname === '/sign-up' || (replace.location.pathname.indexOf('/ride') > -1 && replace.params.ride_uuid !== undefined && replace.params.user_uuid !== undefined)))) {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ import MenuItem from 'material-ui/MenuItem';
|
|||||||
import IconButton from 'material-ui/IconButton/IconButton';
|
import IconButton from 'material-ui/IconButton/IconButton';
|
||||||
import { hashHistory } from 'react-router';
|
import { hashHistory } from 'react-router';
|
||||||
|
|
||||||
|
import {
|
||||||
|
loggedUser,
|
||||||
|
visitReporter,
|
||||||
|
} from 'utils/authorization';
|
||||||
|
|
||||||
|
|
||||||
const ImgIconButtonStyle = {
|
const ImgIconButtonStyle = {
|
||||||
width: '60px',
|
width: '60px',
|
||||||
height: '60px'
|
height: '60px'
|
||||||
@@ -48,20 +54,33 @@ class NavRightList extends React.Component {
|
|||||||
targetOrigin={{ horizontal: 'right', vertical: 'top' }}
|
targetOrigin={{ horizontal: 'right', vertical: 'top' }}
|
||||||
menuStyle={{ minWidth: '150px' }}
|
menuStyle={{ minWidth: '150px' }}
|
||||||
>
|
>
|
||||||
<MenuItem
|
{!loggedUser.anyOf(visitReporter) &&
|
||||||
onTouchTap={(e) => this.handleChange(e, `/app/authorizedusers/${this.state.useruuid}`)}
|
<MenuItem
|
||||||
primaryText="Profile"
|
onTouchTap={(e) => this.handleChange(e, `/app/authorizedusers/${this.state.useruuid}`)}
|
||||||
style={{ fontSize: '14px', lineHeight: '48px' }}
|
primaryText="Profile"
|
||||||
innerDivStyle={listItemStyle}
|
style={{ fontSize: '14px', lineHeight: '48px' }}
|
||||||
leftIcon={<i className="material-icons">account_circle</i>}
|
innerDivStyle={listItemStyle}
|
||||||
/>
|
leftIcon={<i className="material-icons">account_circle</i>}
|
||||||
<MenuItem
|
/>
|
||||||
onTouchTap={(e) => this.handleChange(e, `/app/form/steppers/${this.state.useruuid}`)}
|
}
|
||||||
primaryText="Book Ride"
|
{!loggedUser.anyOf(visitReporter) &&
|
||||||
innerDivStyle={listItemStyle}
|
<MenuItem
|
||||||
style={{ fontSize: '14px', lineHeight: '48px' }}
|
onTouchTap={(e) => this.handleChange(e, `/app/form/steppers/${this.state.useruuid}`)}
|
||||||
leftIcon={<i className="material-icons">mode_edit</i>}
|
primaryText="Book Ride"
|
||||||
/>
|
innerDivStyle={listItemStyle}
|
||||||
|
style={{ fontSize: '14px', lineHeight: '48px' }}
|
||||||
|
leftIcon={<i className="material-icons">mode_edit</i>}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
{loggedUser.anyOf(visitReporter) &&
|
||||||
|
<MenuItem
|
||||||
|
onTouchTap={(e) => this.handleChange(e, `/app/form/visit/${this.state.useruuid}`)}
|
||||||
|
primaryText="Create Visit"
|
||||||
|
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"
|
||||||
|
|||||||
@@ -1,66 +1,62 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import Dialog from 'material-ui/Dialog';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
import Dialog from './draggable-dialog';
|
|
||||||
|
|
||||||
import './draggable-dialog/css/index.css';
|
|
||||||
|
|
||||||
const defaultDialogHeight = 100; //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,
|
||||||
}
|
}
|
||||||
|
|
||||||
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 => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<a>{errorMessage.message}</a>
|
|
||||||
<br/>
|
|
||||||
</div>
|
|
||||||
);})
|
|
||||||
}
|
|
||||||
</Dialog>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ValidationErrorsInfoDialog;
|
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="Errors"
|
||||||
|
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;
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
class DialogBody extends React.Component {
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div className="ui-dialog-content" style={{ "overflowY": "auto" }}>
|
|
||||||
{this.props.children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DialogBody.propTypes = {
|
|
||||||
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DialogBody;
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import cs from "classnames";
|
|
||||||
|
|
||||||
const DialogFooter = (props) => {
|
|
||||||
const buttons = props.buttons;
|
|
||||||
if (!buttons || buttons.length == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dialogButtons = buttons.map(function (button, index) {
|
|
||||||
if (React.isValidElement(button)) {
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { text, onClick, className } = button;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
key={`button-${index}`}
|
|
||||||
type="button"
|
|
||||||
className={cs("button", className)}
|
|
||||||
onClick={onClick}>
|
|
||||||
{text}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="ui-dialog-buttonpane">
|
|
||||||
<div className="ui-dialog-buttonset">
|
|
||||||
{dialogButtons}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DialogFooter.propTypes = {
|
|
||||||
buttons: PropTypes.array,
|
|
||||||
onClose: PropTypes.func.isRequired
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DialogFooter;
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
|
|
||||||
const DialogTitle = ({ title, hasCloseIcon, onClose, allowMinimize, isMinimized, onMinimize, allowMaximize, isMaximized, onMaximize, onRestore }) => {
|
|
||||||
let closeIcon;
|
|
||||||
if (hasCloseIcon !== false) {
|
|
||||||
closeIcon = (
|
|
||||||
<i className="icon icon-close" onClick={onClose}></i>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let minimizeIcon;
|
|
||||||
if (allowMinimize) {
|
|
||||||
if (isMinimized) {
|
|
||||||
minimizeIcon = (
|
|
||||||
<i className="icon icon-restore" onClick={onRestore}></i>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
minimizeIcon = (
|
|
||||||
<i className="icon icon-minimize" onClick={onMinimize}></i>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let maximizeIcon;
|
|
||||||
if (allowMaximize) {
|
|
||||||
if (isMaximized) {
|
|
||||||
maximizeIcon = (
|
|
||||||
<i className="icon icon-restore" onClick={onRestore}></i>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
maximizeIcon = (
|
|
||||||
<i className="icon icon-maximize" onClick={onMaximize}></i>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<header className="ui-dialog-titlebar">
|
|
||||||
<div className="title">
|
|
||||||
{title}
|
|
||||||
</div>
|
|
||||||
<div className="action-items">
|
|
||||||
{minimizeIcon}
|
|
||||||
{maximizeIcon}
|
|
||||||
{closeIcon}
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DialogTitle.propTypes = {
|
|
||||||
hasCloseIcon: PropTypes.bool,
|
|
||||||
allowMinimize: PropTypes.bool,
|
|
||||||
allowMaximize: PropTypes.bool,
|
|
||||||
isMinimized: PropTypes.bool,
|
|
||||||
isMaximized: PropTypes.bool,
|
|
||||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
||||||
onClose: PropTypes.func.isRequired,
|
|
||||||
onMinimize: PropTypes.func,
|
|
||||||
onMaximize: PropTypes.func,
|
|
||||||
onRestore: PropTypes.func
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DialogTitle;
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 403 B |
Binary file not shown.
|
Before Width: | Height: | Size: 310 B |
Binary file not shown.
|
Before Width: | Height: | Size: 156 B |
Binary file not shown.
|
Before Width: | Height: | Size: 300 B |
@@ -1,167 +0,0 @@
|
|||||||
body {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 700px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog-overlay {
|
|
||||||
background: #aaaaaa;
|
|
||||||
opacity: .3;
|
|
||||||
filter: Alpha(Opacity=30);
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog {
|
|
||||||
position: fixed;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
outline: 0 none;
|
|
||||||
padding: 0 !important;;
|
|
||||||
z-index: 101;
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #f6f6f6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog.maximized{
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog.minimized{
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-titlebar {
|
|
||||||
position: relative;
|
|
||||||
font-size: 1em;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 0.5em;
|
|
||||||
height: 35px;
|
|
||||||
/*border-bottom: 1px solid #f6f6f6;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog.react-draggable .ui-dialog-titlebar{
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog.react-draggable .ui-dialog-content{
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog.react-draggable .ui-dialog-buttonpane {
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-titlebar .action-items {
|
|
||||||
float: right;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-titlebar .title {
|
|
||||||
float: left;
|
|
||||||
margin-right: .5em;
|
|
||||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
|
||||||
font-size: 1.3125em;
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 0.2em;
|
|
||||||
padding : 24px 0px 0px 19px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
margin: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.icon-close {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
background-image: url("./img/close.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.icon-minimize {
|
|
||||||
background-image: url("./img/minimize.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.icon-maximize {
|
|
||||||
background-image: url("./img/maximize.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.icon-restore {
|
|
||||||
background-image: url("./img/restore.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-content {
|
|
||||||
background: none repeat scroll 0 0 transparent;
|
|
||||||
border: 0 none;
|
|
||||||
overflow: auto;
|
|
||||||
position: relative;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 400;
|
|
||||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
|
||||||
line-height: 1.5em;
|
|
||||||
color:rgba(0, 0, 0, 0.54);
|
|
||||||
padding : 24px 24px 24px 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
bottom: 0;
|
|
||||||
text-align: right;
|
|
||||||
border-width: 1px 0 0 0;
|
|
||||||
/*border-top: 1px solid #f6f6f6;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane button {
|
|
||||||
margin: 0 .5em 0 .5em;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
padding: 0.5em 1em;
|
|
||||||
outline: none;
|
|
||||||
border: 1px solid #CCCCCC;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .ui-dialog-buttonpane button:hover{
|
|
||||||
background-color: #CCCCCC;
|
|
||||||
border: 1px solid #BBBBBB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui-dialog .react-resizable-handle {
|
|
||||||
position: absolute;
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+');
|
|
||||||
background-position: bottom right;
|
|
||||||
padding: 0 3px 3px 0;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-origin: content-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: se-resize;
|
|
||||||
}
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import cs from "classnames";
|
|
||||||
import Draggable from "react-draggable";
|
|
||||||
import { Resizable } from "react-resizable";
|
|
||||||
import DialogTitle from "./DialogTitle";
|
|
||||||
import DialogBody from "./DialogBody";
|
|
||||||
import DialogFooter from "./DialogFooter";
|
|
||||||
import EventStack from "active-event-stack";
|
|
||||||
|
|
||||||
class Dialog extends React.Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
height: props.height,
|
|
||||||
width: props.width,
|
|
||||||
isMinimized: false,
|
|
||||||
isMaximized: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
/**
|
|
||||||
* This is done in the componentWillMount instead of the componentDidMount
|
|
||||||
* because this way, a modal that is a child of another will have register
|
|
||||||
* for events after its parent
|
|
||||||
*/
|
|
||||||
this.eventToken = EventStack.addListenable([
|
|
||||||
["keydown", this.handleGlobalKeydown]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount = () => {
|
|
||||||
EventStack.removeListenable(this.eventToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleGlobalKeydown = (e) => {
|
|
||||||
if (this.props.closeOnEscape && e.keyCode == 27) {
|
|
||||||
e.stopPropagation();
|
|
||||||
this.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onClose = () => {
|
|
||||||
if (this.props.onClose) {
|
|
||||||
this.props.onClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMinimize = () => {
|
|
||||||
this.setState({ isMinimized: true, isMaximized: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
onMaximize = () => {
|
|
||||||
this.setState({ isMinimized: false, isMaximized: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
onRestore = () => {
|
|
||||||
this.setState({ isMinimized: false, isMaximized: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
onResize = (event, { element, size }) => {
|
|
||||||
this.setState({ width: size.width, height: size.height });
|
|
||||||
}
|
|
||||||
|
|
||||||
getDialogTitle = () => {
|
|
||||||
return (
|
|
||||||
<DialogTitle
|
|
||||||
title={this.props.title}
|
|
||||||
hasCloseIcon={this.props.hasCloseIcon}
|
|
||||||
allowMinimize={this.props.allowMinimize}
|
|
||||||
allowMaximize={this.props.allowMaximize}
|
|
||||||
isMinimized={this.state.isMinimized}
|
|
||||||
isMaximized={this.state.isMaximized}
|
|
||||||
onMinimize={this.onMinimize}
|
|
||||||
onMaximize={this.onMaximize}
|
|
||||||
onRestore={this.onRestore}
|
|
||||||
onClose={this.onClose}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { height, width, isMinimized, isMaximized } = this.state;
|
|
||||||
const { modal, isDraggable, isResizable, buttons, children, position } = this.props;
|
|
||||||
const { x = -width / 2, y = -height / 2 } = position;
|
|
||||||
|
|
||||||
let dialog = (
|
|
||||||
<div style={{ height: height, width, transform: `translate(${x}px, ${y}px)` }} className={cs("ui-dialog", { "minimized": isMinimized, "maximized": isMaximized })}>
|
|
||||||
{this.getDialogTitle()}
|
|
||||||
{
|
|
||||||
!isMinimized && <DialogBody>{children}</DialogBody>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
!isMinimized && <DialogFooter buttons={buttons} onClose={this.onClose}></DialogFooter>
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isMinimized && !isMaximized && isResizable) {
|
|
||||||
dialog = (
|
|
||||||
<Resizable className="box" height={height} width={width} onResize={this.onResize}>
|
|
||||||
{dialog}
|
|
||||||
</Resizable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isMinimized && !isMaximized && isDraggable !== false) {
|
|
||||||
dialog = (
|
|
||||||
<Draggable handle=".ui-dialog" bounds="body" defaultPosition={{ x, y }}>
|
|
||||||
{dialog}
|
|
||||||
</Draggable>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={cs("ui-dialog-container", { "": modal })}>
|
|
||||||
{dialog}
|
|
||||||
{modal && <div className="ui-dialog-overlay"></div>}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Dialog.propTypes = {
|
|
||||||
height: PropTypes.number,
|
|
||||||
width: PropTypes.number,
|
|
||||||
modal: PropTypes.bool,
|
|
||||||
position: PropTypes.shape({
|
|
||||||
x: PropTypes.number,
|
|
||||||
y: PropTypes.number
|
|
||||||
}),
|
|
||||||
hasCloseIcon: PropTypes.bool,
|
|
||||||
allowMinimize: PropTypes.bool,
|
|
||||||
allowMaximize: PropTypes.bool,
|
|
||||||
isResizable: PropTypes.bool,
|
|
||||||
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
||||||
closeOnEscape: PropTypes.bool,
|
|
||||||
onClose: PropTypes.func,
|
|
||||||
children: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.element]).isRequired,
|
|
||||||
buttons: PropTypes.oneOfType([
|
|
||||||
PropTypes.arrayOf(PropTypes.shape({
|
|
||||||
text: PropTypes.string,
|
|
||||||
onClick: PropTypes.func
|
|
||||||
})),
|
|
||||||
PropTypes.arrayOf(PropTypes.element)
|
|
||||||
])
|
|
||||||
};
|
|
||||||
|
|
||||||
Dialog.defaultProps = {
|
|
||||||
height: 200,
|
|
||||||
width: 600,
|
|
||||||
modal: false,
|
|
||||||
closeOnEscape: true,
|
|
||||||
isDraggable: false,
|
|
||||||
isResizable: false,
|
|
||||||
title: '',
|
|
||||||
hasCloseIcon: true,
|
|
||||||
allowMinimize: false,
|
|
||||||
allowMaximize: false,
|
|
||||||
onClose: null,
|
|
||||||
buttons: null,
|
|
||||||
position: { x: -250, y: -150 }
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Dialog;
|
|
||||||
@@ -115,7 +115,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
long: 0
|
long: 0
|
||||||
},
|
},
|
||||||
providers: [],
|
providers: [],
|
||||||
locations: [],
|
|
||||||
currentSelection: {
|
currentSelection: {
|
||||||
id: 0,
|
id: 0,
|
||||||
name: "",
|
name: "",
|
||||||
@@ -126,7 +125,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
saved: false,
|
saved: false,
|
||||||
},
|
},
|
||||||
inputValue: "",
|
inputValue: "",
|
||||||
locationValue: "",
|
|
||||||
addLocation: false,
|
addLocation: false,
|
||||||
searchAddresses: [],
|
searchAddresses: [],
|
||||||
addLocationText: '',
|
addLocationText: '',
|
||||||
@@ -145,12 +143,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
address: '',
|
address: '',
|
||||||
},
|
|
||||||
centerLocation: {
|
|
||||||
lat: 0,
|
|
||||||
long: 0,
|
|
||||||
name: '',
|
|
||||||
address: '',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +164,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
this.updateLocation = this.updateLocation.bind(this);
|
this.updateLocation = this.updateLocation.bind(this);
|
||||||
this.handleGetClosestPlace = this.handleGetClosestPlace.bind(this);
|
this.handleGetClosestPlace = this.handleGetClosestPlace.bind(this);
|
||||||
|
|
||||||
this.updateLocationValue = this.updateLocationValue.bind(this);
|
|
||||||
this.handleAutoCompleteLocation = this.handleAutoCompleteLocation.bind(this);
|
|
||||||
// this.updateLocation().then(console.log);
|
// this.updateLocation().then(console.log);
|
||||||
|
|
||||||
|
|
||||||
@@ -194,71 +184,52 @@ export class NEMTLocation extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
geoSuccess = (position) => {
|
geoSuccess = (position) => {
|
||||||
let lat = 0;
|
|
||||||
let long = 0;
|
|
||||||
if (this.state.centerLocation.lat !== 0 && this.state.centerLocation.long !== 0) {
|
|
||||||
lat = this.state.centerLocation.lat;
|
|
||||||
long = this.state.centerLocation.long;
|
|
||||||
} else {
|
|
||||||
const geo = GeolocationService.GetCoordinates();
|
|
||||||
lat = geo.lat;
|
|
||||||
long = geo.long;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
const geo = GeolocationService.GetCoordinates();
|
||||||
lat = 41.886406;
|
// self.updateLocation().then(p => {
|
||||||
long = -87.624225;
|
let lat = geo.lat;
|
||||||
}
|
let long = geo.long;
|
||||||
|
|
||||||
this.locateNearby(lat, long)
|
this.locateNearby(lat, long)
|
||||||
}
|
}
|
||||||
|
|
||||||
locateNearby = (lat, long) => {
|
locateNearby = (lat, long) => {
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if (lat === 0 || long === 0) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.locationType === 'provider') {
|
if (this.state.locationType === 'provider') {
|
||||||
let url = `/v1/nemt/provider?lat=${lat}&long=${long}&limit=50&sortby=distance`
|
Instance.getRawConn().get(`/v1/nemt/provider/participating?sort=distance&lat=${lat}&long=${long}`).then(res => {
|
||||||
Instance.getRawConn().get(url).then(res => {
|
|
||||||
let nearByPlaces = [];
|
let nearByPlaces = [];
|
||||||
if (res.data.resultStatus === 'SUCCESS') {
|
let providers = res.data.map(p => {
|
||||||
let providers = res.data.providers.map(p => {
|
if (p.address.street_address_1) {
|
||||||
const streetNumber = p.streetName_1.split(' ')[0]
|
const streetNumber = p.address.street_address_1.split(' ')[0]
|
||||||
let clickResult = {
|
let clickResult = {
|
||||||
id: p.mukId,
|
id: p.muk_id,
|
||||||
muk_id: p.mukId,
|
address: `${p.address.street_address_1}, ${p.address.city}, ${p.address.state} (${p.address.zipcode})`,
|
||||||
address: `${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)})`,
|
lat: p.address.lat,
|
||||||
lat: parseFloat(p.latitude),
|
lng: p.address.long,
|
||||||
lng: parseFloat(p.longitude),
|
name: p.name,
|
||||||
name: p.providerName,
|
type: "provider",
|
||||||
type: 'provider',
|
|
||||||
raw: p,
|
raw: p,
|
||||||
street_number: streetNumber,
|
street_number: streetNumber,
|
||||||
street: p.streetName_1.replace(streetNumber, '').trim(),
|
street: p.address.street_address_1.replace(streetNumber, '').trim(),
|
||||||
city: p.cityName,
|
city: p.address.city,
|
||||||
state: p.state,
|
state: p.address.state,
|
||||||
zipcode: p.zipCode.substr(0, 5),
|
zipcode: p.address.zipcode.substring(0, 5),
|
||||||
country: p.country,
|
country: p.address.country,
|
||||||
saved: false,
|
saved: false,
|
||||||
}
|
}
|
||||||
|
clickResult.address = `${clickResult.street_number} ${clickResult.street}, ${clickResult.city}`
|
||||||
|
|
||||||
if (p.fivePartKeyGroups.length > 0) {
|
var listItem = (<ListItem primaryText={p.name} secondaryText={clickResult.address} key={p.muk_id} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handlePlaceChanged(clickResult)} />)
|
||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
var listItem = (<ListItem primaryText={p.providerName} secondaryText={clickResult.address} key={p.mukId} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handlePlaceChanged(clickResult)} />)
|
|
||||||
nearByPlaces.push(listItem);
|
nearByPlaces.push(listItem);
|
||||||
p.providerText = `${p.providerName} - ${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)}) (${p.phoneNumber})`
|
p.providerText = `${p.name} - ${p.address.street_address_1}, ${p.address.city}, ${p.address.state} (${p.address.zipcode}) (${p.address.phone_number})`
|
||||||
p.muk_id = p.mukId
|
}
|
||||||
|
return p;
|
||||||
|
});
|
||||||
|
|
||||||
return p;
|
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers }));
|
||||||
});
|
|
||||||
|
|
||||||
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers }));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var pyrmont = new google.maps.LatLng(lat, long);
|
var pyrmont = new google.maps.LatLng(lat, long);
|
||||||
@@ -524,103 +495,28 @@ export class NEMTLocation extends React.Component {
|
|||||||
this.locateNearby(41.886406, -87.624225);
|
this.locateNearby(41.886406, -87.624225);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLocationValue(searchText, dtSource, params) {
|
|
||||||
let self = this;
|
|
||||||
self.setState(Object.assign(self.state, { locationValue: searchText }));
|
|
||||||
|
|
||||||
if (searchText.length >= 3) {
|
|
||||||
let lat = 0;
|
|
||||||
let long = 0;
|
|
||||||
if (this.state.centerLocation.lat !== 0 && this.state.centerLocation.long !== 0) {
|
|
||||||
lat = this.state.centerLocation.lat;
|
|
||||||
long = this.state.centerLocation.long;
|
|
||||||
} else {
|
|
||||||
const geo = GeolocationService.GetCoordinates();
|
|
||||||
lat = geo.lat;
|
|
||||||
long = geo.long;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
|
||||||
lat = 41.886406;
|
|
||||||
long = -87.624225;
|
|
||||||
}
|
|
||||||
|
|
||||||
var location = new google.maps.LatLng(lat, long);
|
|
||||||
var request = {
|
|
||||||
location: location,
|
|
||||||
radius: '500',
|
|
||||||
input: searchText,
|
|
||||||
componentRestrictions: { country: 'us' },
|
|
||||||
};
|
|
||||||
const callback = (results, status) => {
|
|
||||||
if (status == google.maps.places.PlacesServiceStatus.OK) {
|
|
||||||
var googlePlaces = results.map(place => {
|
|
||||||
place.providerText = place.description;
|
|
||||||
place.muk_id = place.id;
|
|
||||||
place.saved = false;
|
|
||||||
return place;
|
|
||||||
});
|
|
||||||
self.setState(Object.assign(self.state, { locations: googlePlaces }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
service.getPlacePredictions(request, callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTextSearch(searchText, dtSource, params) {
|
updateTextSearch(searchText, dtSource, params) {
|
||||||
let self = this;
|
let self = this;
|
||||||
self.setState(Object.assign(self.state, { inputValue: searchText }));
|
self.setState(Object.assign(self.state, { inputValue: searchText }));
|
||||||
if (searchText.length >= 3) {
|
if (searchText.length >= 3) {
|
||||||
let lat = 0;
|
let lat = self.state.geolocation.lat;
|
||||||
let long = 0;
|
let long = self.state.geolocation.long;
|
||||||
if (this.state.centerLocation.lat !== 0 && this.state.centerLocation.long !== 0) {
|
|
||||||
lat = this.state.centerLocation.lat;
|
|
||||||
long = this.state.centerLocation.long;
|
|
||||||
} else {
|
|
||||||
const geo = GeolocationService.GetCoordinates();
|
|
||||||
lat = geo.lat;
|
|
||||||
long = geo.long;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if (lat === 0 || long === 0) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.state.locationType === 'provider') {
|
if (self.state.locationType === 'provider') {
|
||||||
let url = `/v1/nemt/provider?lat=${lat}&long=${long}&limit=50&name=${searchText}&sortby=distance`
|
//let url = `/v1/nemt/provider?lat=${lat}&long=${long}&limit=20&name=${searchText}&sortby=distance`
|
||||||
|
let url = `/v1/nemt/provider/participating?lat=${lat}&long=${long}&query=${searchText}&sortby=distance`
|
||||||
Instance.getRawConn().get(encodeURI(url)).then(res => {
|
Instance.getRawConn().get(encodeURI(url)).then(res => {
|
||||||
if (res.data.resultStatus === 'SUCCESS') {
|
if (res.data.length > 0) {
|
||||||
let providers = res.data.providers.map(p => {
|
let places = res.data.map(p => {
|
||||||
const streetNumber = p.streetName_1.split(' ')[0]
|
p.providerText = `${p.name} - ${p.address.street_address_1}, ${p.address.city}, ${p.address.state} (${p.address.zipcode}) (${p.address.phone_number})`
|
||||||
p.providerText = `${p.providerName} - ${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)}) (${p.phoneNumber})`
|
p.saved = false
|
||||||
p.muk_id = p.mukId
|
|
||||||
|
|
||||||
let clickResult = {
|
|
||||||
id: p.mukId,
|
|
||||||
muk_id: p.mukId,
|
|
||||||
address: `${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)})`,
|
|
||||||
lat: parseFloat(p.latitude),
|
|
||||||
lng: parseFloat(p.longitude),
|
|
||||||
name: p.providerName,
|
|
||||||
type: 'provider',
|
|
||||||
raw: p,
|
|
||||||
street_number: streetNumber,
|
|
||||||
street: p.streetName_1.replace(streetNumber, '').trim(),
|
|
||||||
city: p.cityName,
|
|
||||||
state: p.state,
|
|
||||||
zipcode: p.zipCode.substr(0, 5),
|
|
||||||
country: p.country,
|
|
||||||
saved: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.fivePartKeyGroups.length > 0) {
|
|
||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
});
|
})
|
||||||
this.setState(Object.assign(this.state, { providers: providers }));
|
self.setState(Object.assign(self.state, { providers: places }));
|
||||||
dtSource = self.state.providers;
|
dtSource = self.state.providers;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -658,59 +554,42 @@ export class NEMTLocation extends React.Component {
|
|||||||
this.setState(Object.assign(this.state, { addLocationTextValue: providerSearch }));
|
this.setState(Object.assign(this.state, { addLocationTextValue: providerSearch }));
|
||||||
if (providerSearch.length >= 3) {
|
if (providerSearch.length >= 3) {
|
||||||
|
|
||||||
|
const geo = GeolocationService.GetCoordinates();
|
||||||
let lat = 0;
|
let lat = geo.lat;
|
||||||
let long = 0;
|
let long = geo.long;
|
||||||
if (this.state.centerLocation.lat !== 0 && this.state.centerLocation.long !== 0) {
|
|
||||||
lat = this.state.centerLocation.lat;
|
|
||||||
long = this.state.centerLocation.long;
|
|
||||||
} else {
|
|
||||||
const geo = GeolocationService.GetCoordinates();
|
|
||||||
lat = geo.lat;
|
|
||||||
long = geo.long;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if (lat === 0 || long === 0) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.locationType === 'provider') {
|
if (this.state.locationType === 'provider') {
|
||||||
let url = `/v1/nemt/provider?lat=${lat}&long=${long}&limit=50&name=${providerSearch}&sortby=distance`
|
let url = `/v1/nemt/provider/participating?lat=${lat}&long=${long}&query=${providerSearch}&sortby=distance`
|
||||||
Instance.getRawConn().get(encodeURI(url)).then(res => {
|
Instance.getRawConn().get(encodeURI(url)).then(res => {
|
||||||
if (res.data.resultStatus === 'SUCCESS') {
|
let places = res.data.map(p => {
|
||||||
let providers = res.data.providers.map(p => {
|
const streetNumber = p.address.street_address_1.split(' ')[0]
|
||||||
const streetNumber = p.streetName_1.split(' ')[0]
|
p.providerText = `${p.name} - ${p.address.street_address_1}, ${p.address.city}, ${p.address.state} (${p.address.zipcode}) (${p.address.phone_number})`
|
||||||
p.providerText = `${p.providerName} - ${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)}) (${p.phoneNumber})`
|
let clickResult = {
|
||||||
p.muk_id = p.mukId
|
id: p.muk_id,
|
||||||
|
address: `${p.address.street_address_1}, ${p.address.city}, ${p.address.state} (${p.address.zipcode})`,
|
||||||
|
lat: p.address.lat,
|
||||||
|
lng: p.address.long,
|
||||||
|
name: p.name,
|
||||||
|
type: "provider",
|
||||||
|
raw: p,
|
||||||
|
street_number: streetNumber,
|
||||||
|
street: p.address.street_address_1.replace(streetNumber, '').trim(),
|
||||||
|
city: p.address.city,
|
||||||
|
state: p.address.state,
|
||||||
|
zipcode: p.address.zipcode.substring(0, 5),
|
||||||
|
country: p.address.country,
|
||||||
|
saved: false,
|
||||||
|
}
|
||||||
|
clickResult.address = `${clickResult.street_number} ${clickResult.street}, ${clickResult.city}`
|
||||||
|
|
||||||
let clickResult = {
|
var listItem = (<ListItem value={p.muk_id} primaryText={p.name} secondaryText={clickResult.address} key={p.muk_id} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handleSaveAddress(clickResult, this)} />)
|
||||||
id: p.mukId,
|
return listItem;
|
||||||
muk_id: p.mukId,
|
});
|
||||||
address: `${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)})`,
|
|
||||||
lat: parseFloat(p.latitude),
|
|
||||||
lng: parseFloat(p.longitude),
|
|
||||||
name: p.providerName,
|
|
||||||
type: 'provider',
|
|
||||||
raw: p,
|
|
||||||
street_number: streetNumber,
|
|
||||||
street: p.streetName_1.replace(streetNumber, '').trim(),
|
|
||||||
city: p.cityName,
|
|
||||||
state: p.state,
|
|
||||||
zipcode: p.zipCode.substr(0, 5),
|
|
||||||
country: p.country,
|
|
||||||
saved: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.fivePartKeyGroups.length > 0) {
|
this.setState(Object.assign(this.state, { searchAddresses: places }));
|
||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
var listItem = (<ListItem primaryText={p.providerName} secondaryText={clickResult.address} key={p.mukId} value={p.mukId} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handleSaveAddress(clickResult)} />)
|
|
||||||
return listItem;
|
|
||||||
});
|
|
||||||
this.setState(Object.assign(this.state, { searchAddresses: providers }));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var location = new google.maps.LatLng(lat, long);
|
var location = new google.maps.LatLng(lat, long);
|
||||||
@@ -837,68 +716,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAutoCompleteLocation = (location) => {
|
|
||||||
const self = this;
|
|
||||||
placeService.getDetails(location, (result, status) => {
|
|
||||||
if (status == google.maps.places.PlacesServiceStatus.OK) {
|
|
||||||
let clickResult = {
|
|
||||||
id: result.place_id,
|
|
||||||
placeId: result.place_id,
|
|
||||||
address: result.formatted_address ? result.formatted_address : result.vicinity,
|
|
||||||
lat: result.geometry.location.lat(),
|
|
||||||
lng: result.geometry.location.lng(),
|
|
||||||
name: result.name,
|
|
||||||
type: "google",
|
|
||||||
raw: result,
|
|
||||||
street_number: '',
|
|
||||||
street: '',
|
|
||||||
city: '',
|
|
||||||
state: '',
|
|
||||||
zipcode: '',
|
|
||||||
country: '',
|
|
||||||
saved: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
result.address_components.forEach(a => {
|
|
||||||
a.types.forEach(c => {
|
|
||||||
switch (c) {
|
|
||||||
case "street_number":
|
|
||||||
clickResult.street_number = a.short_name;
|
|
||||||
break;
|
|
||||||
case "route":
|
|
||||||
clickResult.street = a.short_name;
|
|
||||||
break;
|
|
||||||
case "locality":
|
|
||||||
clickResult.city = a.short_name;
|
|
||||||
break;
|
|
||||||
case "administrative_area_level_1":
|
|
||||||
clickResult.state = a.short_name;
|
|
||||||
break;
|
|
||||||
case "country":
|
|
||||||
clickResult.country = a.short_name;
|
|
||||||
break;
|
|
||||||
case "postal_code":
|
|
||||||
clickResult.zipcode = a.short_name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}, this)
|
|
||||||
}, this);
|
|
||||||
clickResult.address = `${clickResult.street_number} ${clickResult.street}, ${clickResult.city}`
|
|
||||||
|
|
||||||
|
|
||||||
const centerLocation = {
|
|
||||||
lat: clickResult.lat,
|
|
||||||
long: clickResult.lng,
|
|
||||||
name: clickResult.name,
|
|
||||||
address: clickResult.address
|
|
||||||
}
|
|
||||||
|
|
||||||
self.setState(Object.assign(self.state, { centerLocation: centerLocation }));
|
|
||||||
self.locateNearby(clickResult.lat, clickResult.lng);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleAutocomplete = (provider) => {
|
handleAutocomplete = (provider) => {
|
||||||
const sendInfo = (clickResult) => {
|
const sendInfo = (clickResult) => {
|
||||||
this.setState(Object.assign(this.state, { currentSelection: clickResult }));
|
this.setState(Object.assign(this.state, { currentSelection: clickResult }));
|
||||||
@@ -918,32 +735,24 @@ export class NEMTLocation extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.locationType === "provider") {
|
if (this.state.locationType === "provider") {
|
||||||
const p = provider;
|
const streetNumber = provider.address.street_address_1.split(' ')[0]
|
||||||
const streetNumber = p.streetName_1.split(' ')[0]
|
|
||||||
p.providerText = `${p.providerName} - ${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)}) (${p.phoneNumber})`
|
|
||||||
p.muk_id = p.mukId
|
|
||||||
|
|
||||||
let clickResult = {
|
let clickResult = {
|
||||||
id: p.mukId,
|
id: provider.muk_id,
|
||||||
muk_id: p.mukId,
|
address: `${provider.address.street_address_1}, ${provider.address.city}, ${provider.address.state} (${provider.address.zipcode})`,
|
||||||
address: `${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)})`,
|
lat: provider.address.lat,
|
||||||
lat: parseFloat(p.latitude),
|
lng: provider.address.long,
|
||||||
lng: parseFloat(p.longitude),
|
name: provider.name,
|
||||||
name: p.providerName,
|
type: "provider",
|
||||||
type: 'provider',
|
raw: provider,
|
||||||
raw: p,
|
|
||||||
street_number: streetNumber,
|
street_number: streetNumber,
|
||||||
street: p.streetName_1.replace(streetNumber, '').trim(),
|
street: provider.address.street_address_1.replace(streetNumber, '').trim(),
|
||||||
city: p.cityName,
|
city: provider.address.city,
|
||||||
state: p.state,
|
state: provider.address.state,
|
||||||
zipcode: p.zipCode.substr(0, 5),
|
zipcode: provider.address.zipcode.substring(0, 5),
|
||||||
country: p.country,
|
country: provider.address.country,
|
||||||
saved: false,
|
saved: false,
|
||||||
}
|
}
|
||||||
|
clickResult.address = `${clickResult.street_number} ${clickResult.street}, ${clickResult.city}`
|
||||||
if (p.fivePartKeyGroups.length > 0) {
|
|
||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendInfo(clickResult);
|
sendInfo(clickResult);
|
||||||
} else {
|
} else {
|
||||||
@@ -1033,51 +842,42 @@ export class NEMTLocation extends React.Component {
|
|||||||
|
|
||||||
handleCurrentLocation(e) {
|
handleCurrentLocation(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
const geo = GeolocationService.GetCoordinates();
|
||||||
let lat = 0;
|
// self.updateLocation().then(p => {
|
||||||
let long = 0;
|
let lat = geo.lat;
|
||||||
if (this.state.centerLocation.lat !== 0 && this.state.centerLocation.long !== 0) {
|
let long = geo.long;
|
||||||
lat = this.state.centerLocation.lat;
|
|
||||||
long = this.state.centerLocation.long;
|
|
||||||
} else {
|
|
||||||
const geo = GeolocationService.GetCoordinates();
|
|
||||||
lat = geo.lat;
|
|
||||||
long = geo.long;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lat === 0 || long === 0) {
|
if (lat === 0 || long === 0) {
|
||||||
lat = 41.886406;
|
lat = 41.886406;
|
||||||
long = -87.624225;
|
long = -87.624225;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.state.locationType === 'provider') {
|
if (self.state.locationType === 'provider') {
|
||||||
let url = `/v1/nemt/provider?lat=${lat}&long=${long}&limit=50&sortby=distance`
|
Instance.getRawConn().get(`/v1/nemt/provider/participating?sort=distance&lat=${lat}&long=${long}`).then(res => {
|
||||||
Instance.getRawConn().get(url).then(res => {
|
|
||||||
let listItem = (<ListItem primaryText="No location found" key="-1" leftIcon={<MapsNearMe />} onClick={self.handleCurrentLocation} />)
|
let listItem = (<ListItem primaryText="No location found" key="-1" leftIcon={<MapsNearMe />} onClick={self.handleCurrentLocation} />)
|
||||||
if (res.data.resultStatus === 'SUCCESS') {
|
if (res.data.length > 0) {
|
||||||
const p = res.data.providers[0];
|
const result = res.data[0];
|
||||||
const streetNumber = p.streetName_1.split(' ')[0]
|
const streetNumber = result.address.street_address_1.split(' ')[0]
|
||||||
let clickResult = {
|
let clickResult = {
|
||||||
id: p.mukId,
|
id: result.muk_id,
|
||||||
address: `${p.streetName_1}, ${p.cityName}, ${p.state} (${p.zipCode.substr(0, 5)})`,
|
address: `${result.address.street_address_1}, ${result.address.city}, ${result.address.state} (${result.address.zipcode})`,
|
||||||
lat: parseFloat(p.latitude),
|
lat: result.address.lat,
|
||||||
lng: parseFloat(p.longitude),
|
lng: result.address.long,
|
||||||
name: p.providerName,
|
name: result.name,
|
||||||
type: 'provider',
|
type: "provider",
|
||||||
raw: p,
|
raw: result,
|
||||||
street_number: streetNumber,
|
street_number: streetNumber,
|
||||||
street: p.streetName_1.replace(streetNumber, '').trim(),
|
street: result.address.street_address_1.replace(streetNumber, '').trim(),
|
||||||
city: p.cityName,
|
city: result.address.city,
|
||||||
state: p.state,
|
state: result.address.state,
|
||||||
zipcode: p.zipCode.substr(0, 5),
|
zipcode: result.address.zipcode.substring(0, 5),
|
||||||
country: p.country,
|
country: result.address.country,
|
||||||
saved: false,
|
saved: false,
|
||||||
}
|
}
|
||||||
if (p.fivePartKeyGroups.length > 0) {
|
clickResult.address = `${clickResult.street_number} ${clickResult.street}, ${clickResult.city}`
|
||||||
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
|
|
||||||
}
|
|
||||||
self.handlePlaceChanged(clickResult)
|
self.handlePlaceChanged(clickResult)
|
||||||
|
//listItem = (<ListItem primaryText={clickResult.name} secondaryText={clickResult.address} key={clickResult.muk_id} leftIcon={<MapsNearMe />} onClick={(event) => self.handlePlaceChanged(clickResult)} />)
|
||||||
}
|
}
|
||||||
|
//self.setState(Object.assign(self.state, { currentLocation: listItem }));
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
} else {
|
} else {
|
||||||
var location = new google.maps.LatLng(lat, long);
|
var location = new google.maps.LatLng(lat, long);
|
||||||
@@ -1338,7 +1138,6 @@ export class NEMTLocation extends React.Component {
|
|||||||
|
|
||||||
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} />
|
|
||||||
{autosuggest}
|
{autosuggest}
|
||||||
<List>
|
<List>
|
||||||
{this.state.currentLocation}
|
{this.state.currentLocation}
|
||||||
@@ -1396,4 +1195,4 @@ export class NEMTLocation extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,8 +524,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
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -896,8 +896,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 open={this.state.showValidationErrors} errorMessages={this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)} />
|
||||||
|
|
||||||
<Stepper
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
linear={false}
|
linear={false}
|
||||||
|
|||||||
@@ -156,8 +156,14 @@ class SignUp extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePhone = (event) => {
|
handlePhone = (event) => {
|
||||||
|
let phone = event.target.value;
|
||||||
|
if (phone.indexOf("+1") < 0 && phone.length == 10) {
|
||||||
|
phone = "+1" + phone;
|
||||||
|
phone = phone.substring(0, 12);
|
||||||
|
}
|
||||||
|
|
||||||
const user = this.props.user;
|
const user = this.props.user;
|
||||||
user.phonenumber = event.target.value;;
|
user.phonenumber = phone;
|
||||||
if (this.props.onUserChanged) {
|
if (this.props.onUserChanged) {
|
||||||
this.props.onUserChanged(user);
|
this.props.onUserChanged(user);
|
||||||
}
|
}
|
||||||
@@ -668,14 +674,10 @@ class VerticalNonLinear extends React.Component {
|
|||||||
let self = state;
|
let self = state;
|
||||||
const { stepIndex } = self.state;
|
const { stepIndex } = self.state;
|
||||||
|
|
||||||
//console.log('Step Index: ', stepIndex)
|
console.log('Step Index: ', stepIndex)
|
||||||
switch (stepIndex) {
|
switch (stepIndex) {
|
||||||
case 1:
|
case 0:
|
||||||
const eligibility = {
|
const eligibility = {
|
||||||
"provider": {
|
|
||||||
"provider_npi": self.state.destination.raw.fivePartKeyGroups[0].providerNum,
|
|
||||||
"provider_name": self.state.destination.raw.providerName
|
|
||||||
},
|
|
||||||
"subscriber": {
|
"subscriber": {
|
||||||
"patient_type": self.state.user.type,
|
"patient_type": self.state.user.type,
|
||||||
"subscriber_id": self.state.user.member,
|
"subscriber_id": self.state.user.member,
|
||||||
@@ -686,12 +688,10 @@ 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,
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(JSON.stringify(eligibility));
|
|
||||||
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 }));
|
self.setState(Object.assign(self.state, { stepIndex: stepIndex + 1, user: res.data }));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
@@ -1101,18 +1101,6 @@ class VerticalNonLinear extends React.Component {
|
|||||||
>
|
>
|
||||||
<Step>
|
<Step>
|
||||||
<StepButton onClick={() => this.setState({ stepIndex: 0 })}>
|
<StepButton onClick={() => this.setState({ stepIndex: 0 })}>
|
||||||
Provider
|
|
||||||
</StepButton>
|
|
||||||
<StepContent>
|
|
||||||
<form role="form">
|
|
||||||
<NEMTLocation type="flat" data={this.state} title={"Provider"} value={""} buttonvalue={this.state.buttonProviderText} onPlaceChanged={(provider) => this.handleProviderChanged(provider, this)} fontSize={12} locationType="provider" loadSuggestion={true} address={this.state.destination} />
|
|
||||||
{/* <div className="divider" /> */}
|
|
||||||
</form>
|
|
||||||
{this.renderStepActions(1, this)}
|
|
||||||
</StepContent>
|
|
||||||
</Step>
|
|
||||||
<Step>
|
|
||||||
<StepButton onClick={() => this.setState({ stepIndex: 1 })}>
|
|
||||||
Member
|
Member
|
||||||
</StepButton>
|
</StepButton>
|
||||||
<StepContent>
|
<StepContent>
|
||||||
@@ -1125,6 +1113,21 @@ class VerticalNonLinear extends React.Component {
|
|||||||
{this.renderStepActions(0, this)}
|
{this.renderStepActions(0, this)}
|
||||||
</StepContent>
|
</StepContent>
|
||||||
</Step>
|
</Step>
|
||||||
|
|
||||||
|
<Step>
|
||||||
|
<StepButton onClick={() => this.setState({ stepIndex: 1 })}>
|
||||||
|
Provider
|
||||||
|
</StepButton>
|
||||||
|
<StepContent>
|
||||||
|
<form role="form">
|
||||||
|
<NEMTLocation type="flat" data={this.state} title={"Provider"} value={""} buttonvalue={this.state.buttonProviderText} onPlaceChanged={(provider) => this.handleProviderChanged(provider, this)} fontSize={12} locationType="provider" loadSuggestion={true} address={this.state.destination} />
|
||||||
|
{/* <div className="divider" /> */}
|
||||||
|
</form>
|
||||||
|
{this.renderStepActions(1, this)}
|
||||||
|
</StepContent>
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
|
||||||
<Step>
|
<Step>
|
||||||
<StepButton onClick={() => this.setState({ stepIndex: 2 })}>
|
<StepButton onClick={() => this.setState({ stepIndex: 2 })}>
|
||||||
Visit Details
|
Visit Details
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class SignUp extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<form className="">
|
<form className="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} draggable={false} modal={true} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
<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"
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import FloatingActionButton from 'material-ui/FloatingActionButton';
|
|||||||
import ContentAdd from 'material-ui/svg-icons/content/add';
|
import ContentAdd from 'material-ui/svg-icons/content/add';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card';
|
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card';
|
||||||
|
import Draggable, { DraggableCore } from 'react-draggable'; // Both at the same time
|
||||||
import Imgix from 'react-imgix'
|
import Imgix from 'react-imgix'
|
||||||
import Paper from 'material-ui/Paper';
|
import Paper from 'material-ui/Paper';
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ class SignUp extends React.Component {
|
|||||||
this.clickEvent = this.clickEvent.bind(this);
|
this.clickEvent = this.clickEvent.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount = () => { }
|
componentDidMount = () => {
|
||||||
|
}
|
||||||
|
|
||||||
buttonValidated = () => {
|
buttonValidated = () => {
|
||||||
let validated = true;
|
let validated = true;
|
||||||
@@ -127,7 +128,7 @@ class SignUp extends React.Component {
|
|||||||
"pass": this.state.pass,
|
"pass": this.state.pass,
|
||||||
};
|
};
|
||||||
|
|
||||||
Instance.setToken(null).post('/v1/selfregister/', user).then(function (res) {
|
Instance.getRawConn().post('/v1/selfregister/', user).then(function (res) {
|
||||||
localStorage.removeItem('loggedUser');
|
localStorage.removeItem('loggedUser');
|
||||||
location.href = '/#/login';
|
location.href = '/#/login';
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user