Compare commits
1 Commits
make-error
...
round-up-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
591d7be308 |
@@ -34,7 +34,7 @@ import Checkbox from 'material-ui/Checkbox';
|
|||||||
import Popover from 'material-ui/Popover';
|
import Popover from 'material-ui/Popover';
|
||||||
|
|
||||||
let DateTimeFormat;
|
let DateTimeFormat;
|
||||||
|
const roundingTime = 1000 * 60 * 5; //5 minutes
|
||||||
|
|
||||||
DateTimeFormat = global.Intl.DateTimeFormat;
|
DateTimeFormat = global.Intl.DateTimeFormat;
|
||||||
|
|
||||||
@@ -44,8 +44,8 @@ export class ValidationErrorsInfoDialog extends React.Component {
|
|||||||
open: this.props.open,
|
open: this.props.open,
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(newProps){
|
componentWillReceiveProps(newProps) {
|
||||||
this.setState({open: newProps.open});
|
this.setState({ open: newProps.open });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOpen = () => {
|
handleOpen = () => {
|
||||||
@@ -76,13 +76,13 @@ export class ValidationErrorsInfoDialog extends React.Component {
|
|||||||
modal={false}
|
modal={false}
|
||||||
open={this.state.open}
|
open={this.state.open}
|
||||||
onRequestClose={this.handleClose}
|
onRequestClose={this.handleClose}
|
||||||
overlayStyle={{backgroundColor: 'transparent'}}
|
overlayStyle={{ backgroundColor: 'transparent' }}
|
||||||
>
|
>
|
||||||
{this.props.errorMessages.map(errorMessage => {
|
{this.props.errorMessages.map(errorMessage => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<a>{errorMessage.message}</a>
|
<a>{errorMessage.message}</a>
|
||||||
<br/>
|
<br />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -416,16 +416,18 @@ class VerticalNonLinear extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
let dateNow = new Date();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
stepIndex: 0,
|
stepIndex: 0,
|
||||||
rideTypeValue: 0,
|
rideTypeValue: 0,
|
||||||
providerID: 0,
|
providerID: 0,
|
||||||
providerName: '',
|
providerName: '',
|
||||||
visitDate: new Date(),
|
visitDate: new Date(),
|
||||||
visitTime: new Date(),
|
visitTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||||
pickupLocation: null,
|
pickupLocation: null,
|
||||||
pickupTime: new Date(),
|
pickupTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||||
pickupTimeReturn: new Date(),
|
pickupTimeReturn: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||||
pickupTimeReturnDisplayMode: 'none',
|
pickupTimeReturnDisplayMode: 'none',
|
||||||
open: false,
|
open: false,
|
||||||
message: 'Booking Ride',
|
message: 'Booking Ride',
|
||||||
@@ -453,8 +455,8 @@ class VerticalNonLinear extends React.Component {
|
|||||||
},
|
},
|
||||||
return_time: new Date(),
|
return_time: new Date(),
|
||||||
pickupTimeHide: false,
|
pickupTimeHide: false,
|
||||||
showValidationErrors:false,
|
showValidationErrors: false,
|
||||||
validationErrors:[],
|
validationErrors: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,10 +491,10 @@ class VerticalNonLinear extends React.Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let visitTime = new Date(new Date().getTime() + (1 * 60 * 60 * 1000));
|
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
let visitDate = visitTime;
|
let visitDate = date;
|
||||||
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
|
|
||||||
this.setState(Object.assign(this.state, {
|
this.setState(Object.assign(this.state, {
|
||||||
visitDate: visitDate,
|
visitDate: visitDate,
|
||||||
@@ -556,11 +558,11 @@ class VerticalNonLinear extends React.Component {
|
|||||||
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;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
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
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -600,10 +602,10 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
handleDate(event, date, state) {
|
handleDate(event, date, state) {
|
||||||
let self = state
|
let self = state
|
||||||
let visitTime = new Date(date.getTime() + (1 * 60 * 60 * 1000));
|
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
let visitDate = date;
|
let visitDate = date;
|
||||||
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
let pickupTime = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
let pickupTimeReturn = new Date(Math.round((visitTime.getTime() - (0.5 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||||
|
|
||||||
self.setState(Object.assign(self.state, {
|
self.setState(Object.assign(self.state, {
|
||||||
visitDate: visitDate,
|
visitDate: visitDate,
|
||||||
@@ -850,9 +852,9 @@ class VerticalNonLinear extends React.Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleValidationErrosDialogDismiss(){
|
handleValidationErrosDialogDismiss() {
|
||||||
this.setState(Object.assign(this.state, {
|
this.setState(Object.assign(this.state, {
|
||||||
showValidationErrors:false
|
showValidationErrors: false
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,8 +921,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 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
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
linear={false}
|
linear={false}
|
||||||
|
|||||||
Reference in New Issue
Block a user