|
|
|
|
@@ -33,10 +33,8 @@ import Instance from '../../../../../../../components/Connection';
|
|
|
|
|
import Checkbox from 'material-ui/Checkbox';
|
|
|
|
|
import Popover from 'material-ui/Popover';
|
|
|
|
|
|
|
|
|
|
const ADDRESS_TYPE_HOME = "home";
|
|
|
|
|
|
|
|
|
|
let DateTimeFormat;
|
|
|
|
|
|
|
|
|
|
const roundingTime = 1000 * 60 * 5; //5 minutes
|
|
|
|
|
|
|
|
|
|
DateTimeFormat = global.Intl.DateTimeFormat;
|
|
|
|
|
|
|
|
|
|
@@ -46,8 +44,8 @@ export class ValidationErrorsInfoDialog extends React.Component {
|
|
|
|
|
open: this.props.open,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(newProps){
|
|
|
|
|
this.setState({open: newProps.open});
|
|
|
|
|
componentWillReceiveProps(newProps) {
|
|
|
|
|
this.setState({ open: newProps.open });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleOpen = () => {
|
|
|
|
|
@@ -78,13 +76,13 @@ export class ValidationErrorsInfoDialog extends React.Component {
|
|
|
|
|
modal={false}
|
|
|
|
|
open={this.state.open}
|
|
|
|
|
onRequestClose={this.handleClose}
|
|
|
|
|
overlayStyle={{backgroundColor: 'transparent'}}
|
|
|
|
|
overlayStyle={{ backgroundColor: 'transparent' }}
|
|
|
|
|
>
|
|
|
|
|
{this.props.errorMessages.map(errorMessage => {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<a>{errorMessage.message}</a>
|
|
|
|
|
<br/>
|
|
|
|
|
<br />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
@@ -418,16 +416,18 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
let dateNow = new Date();
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
|
stepIndex: 0,
|
|
|
|
|
rideTypeValue: 0,
|
|
|
|
|
providerID: 0,
|
|
|
|
|
providerName: '',
|
|
|
|
|
visitDate: new Date(),
|
|
|
|
|
visitTime: new Date(),
|
|
|
|
|
visitTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
|
|
|
|
pickupLocation: null,
|
|
|
|
|
pickupTime: new Date(),
|
|
|
|
|
pickupTimeReturn: new Date(),
|
|
|
|
|
pickupTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
|
|
|
|
pickupTimeReturn: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
|
|
|
|
pickupTimeReturnDisplayMode: 'none',
|
|
|
|
|
open: false,
|
|
|
|
|
message: 'Booking Ride',
|
|
|
|
|
@@ -455,8 +455,8 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
},
|
|
|
|
|
return_time: new Date(),
|
|
|
|
|
pickupTimeHide: false,
|
|
|
|
|
showValidationErrors:false,
|
|
|
|
|
validationErrors:[],
|
|
|
|
|
showValidationErrors: false,
|
|
|
|
|
validationErrors: [],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -471,16 +471,6 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
if (user.useruuid !== loggedUser.useruuid) {
|
|
|
|
|
Instance.getRawConn().get(`/v1/nemt/users/member/${user.useruuid}`)
|
|
|
|
|
.then(function (res) {
|
|
|
|
|
let userHomeAddress = null;
|
|
|
|
|
res.data.addresses.forEach(address => {
|
|
|
|
|
if (address.address_type === ADDRESS_TYPE_HOME) {
|
|
|
|
|
userHomeAddress = address;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (userHomeAddress != null) {
|
|
|
|
|
userHomeAddress.name = "Home";
|
|
|
|
|
state.handlePickupChanged(userHomeAddress, state);
|
|
|
|
|
}
|
|
|
|
|
state.setState(Object.assign(state.state, { user: res.data, showUserSelection: true, userSelectionText: `${res.data.member} - ${res.data.name}` }));
|
|
|
|
|
})
|
|
|
|
|
.catch(err => {
|
|
|
|
|
@@ -501,10 +491,10 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let visitTime = new Date(new Date().getTime() + (1 * 60 * 60 * 1000));
|
|
|
|
|
let visitDate = visitTime;
|
|
|
|
|
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
|
|
|
|
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
|
|
|
|
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,
|
|
|
|
|
@@ -568,11 +558,11 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
self.handleRequestClose(self);
|
|
|
|
|
window.location.href = '/#/app/page/map/' + res.data.ride_uuid;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
if (error.response.status === 422){
|
|
|
|
|
if (error.response.status === 422) {
|
|
|
|
|
//Unprocessable Entity (validation failed)
|
|
|
|
|
self.setState(Object.assign(self.state, {
|
|
|
|
|
showValidationErrors:true,
|
|
|
|
|
validationErrors:error.response.data.data
|
|
|
|
|
showValidationErrors: true,
|
|
|
|
|
validationErrors: error.response.data.data
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@@ -612,10 +602,10 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
|
|
|
|
|
handleDate(event, date, state) {
|
|
|
|
|
let self = state
|
|
|
|
|
let visitTime = new Date(date.getTime() + (1 * 60 * 60 * 1000));
|
|
|
|
|
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
|
|
|
let visitDate = date;
|
|
|
|
|
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
|
|
|
|
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
|
|
|
|
let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
|
|
|
let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
|
|
|
|
|
|
|
|
|
self.setState(Object.assign(self.state, {
|
|
|
|
|
visitDate: visitDate,
|
|
|
|
|
@@ -862,9 +852,9 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleValidationErrosDialogDismiss(){
|
|
|
|
|
handleValidationErrosDialogDismiss() {
|
|
|
|
|
this.setState(Object.assign(this.state, {
|
|
|
|
|
showValidationErrors:false
|
|
|
|
|
showValidationErrors: false
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -906,17 +896,7 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
|
|
|
|
|
if (this.state.showUserSelection && this.state.users.length > 0) {
|
|
|
|
|
const handleAutocomplete = (u) => {
|
|
|
|
|
let userHomeAddress = null;
|
|
|
|
|
u.addresses.forEach(address => {
|
|
|
|
|
if (address.address_type === ADDRESS_TYPE_HOME) {
|
|
|
|
|
userHomeAddress = address;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (userHomeAddress != null) {
|
|
|
|
|
userHomeAddress.name = "Home";
|
|
|
|
|
state.handlePickupChanged(userHomeAddress,state);
|
|
|
|
|
}
|
|
|
|
|
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
|
|
|
|
state.setState(Object.assign(state.state, { user: u, userSelectionText: u.userdata }));
|
|
|
|
|
}
|
|
|
|
|
const datasourceConfig = { text: 'userdata', value: 'useruuid' }
|
|
|
|
|
userSelection = (
|
|
|
|
|
@@ -941,8 +921,8 @@ class VerticalNonLinear extends React.Component {
|
|
|
|
|
<div className="box-body padding-xs">
|
|
|
|
|
|
|
|
|
|
<div style={{ maxWidth: 380, margin: 'auto' }}>
|
|
|
|
|
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
|
|
|
|
|
|
|
|
|
|
<ValidationErrorsInfoDialog open={this.state.showValidationErrors} errorMessages={this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)} />
|
|
|
|
|
|
|
|
|
|
<Stepper
|
|
|
|
|
activeStep={this.state.stepIndex}
|
|
|
|
|
linear={false}
|
|
|
|
|
|