Compare commits
1 Commits
round-up-d
...
add-contac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b329b4eeb6 |
@@ -34,7 +34,7 @@ import Checkbox from 'material-ui/Checkbox';
|
||||
import Popover from 'material-ui/Popover';
|
||||
|
||||
let DateTimeFormat;
|
||||
const roundingTime = 1000 * 60 * 5; //5 minutes
|
||||
|
||||
|
||||
DateTimeFormat = global.Intl.DateTimeFormat;
|
||||
|
||||
@@ -44,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 = () => {
|
||||
@@ -76,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>
|
||||
);
|
||||
})}
|
||||
@@ -416,18 +416,16 @@ 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(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||
visitTime: new Date(),
|
||||
pickupLocation: null,
|
||||
pickupTime: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||
pickupTimeReturn: new Date(Math.round(dateNow.getTime() / roundingTime) * roundingTime),
|
||||
pickupTime: new Date(),
|
||||
pickupTimeReturn: new Date(),
|
||||
pickupTimeReturnDisplayMode: 'none',
|
||||
open: false,
|
||||
message: 'Booking Ride',
|
||||
@@ -455,8 +453,8 @@ class VerticalNonLinear extends React.Component {
|
||||
},
|
||||
return_time: new Date(),
|
||||
pickupTimeHide: false,
|
||||
showValidationErrors: false,
|
||||
validationErrors: [],
|
||||
showValidationErrors:false,
|
||||
validationErrors:[],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -491,10 +489,10 @@ class VerticalNonLinear extends React.Component {
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
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));
|
||||
|
||||
this.setState(Object.assign(this.state, {
|
||||
visitDate: visitDate,
|
||||
@@ -558,11 +556,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
|
||||
}));
|
||||
}
|
||||
});
|
||||
@@ -602,10 +600,10 @@ class VerticalNonLinear extends React.Component {
|
||||
|
||||
handleDate(event, date, state) {
|
||||
let self = state
|
||||
let visitTime = new Date(Math.round((date.getTime() + (1 * 60 * 60 * 1000)) / roundingTime) * roundingTime);
|
||||
let visitTime = new Date(date.getTime() + (1 * 60 * 60 * 1000));
|
||||
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);
|
||||
let pickupTime = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
||||
let pickupTimeReturn = new Date(visitTime.getTime() - (0.5 * 60 * 60 * 1000));
|
||||
|
||||
self.setState(Object.assign(self.state, {
|
||||
visitDate: visitDate,
|
||||
@@ -852,9 +850,9 @@ class VerticalNonLinear extends React.Component {
|
||||
|
||||
}
|
||||
|
||||
handleValidationErrosDialogDismiss() {
|
||||
handleValidationErrosDialogDismiss(){
|
||||
this.setState(Object.assign(this.state, {
|
||||
showValidationErrors: false
|
||||
showValidationErrors:false
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -921,8 +919,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}
|
||||
|
||||
@@ -143,7 +143,7 @@ const Address = (props) => {
|
||||
)
|
||||
};
|
||||
|
||||
const Main = ({ user, onAddressAdded, onAddressRemoved, readOnly }) => {
|
||||
const Main = ({ user, onAddressAdded, onAddressRemoved, onContactAdded, readOnly }) => {
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col-xl-12">
|
||||
@@ -158,7 +158,7 @@ const Main = ({ user, onAddressAdded, onAddressRemoved, readOnly }) => {
|
||||
/>
|
||||
</div>
|
||||
<div className="col-xl-6">
|
||||
<ContactInfo user={user} readOnly={readOnly} />
|
||||
<ContactInfo user={user} readOnly={readOnly} onContactAdded={onContactAdded} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -685,6 +685,7 @@ const ContactInfo = (props) => {
|
||||
title={"Member Contact"}
|
||||
buttonValue={"Add Contact"}
|
||||
showDescription={false}
|
||||
onNewContact={props.onContactAdded}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
@@ -823,6 +824,7 @@ class User extends React.Component {
|
||||
this.getUser = this.getUser.bind(this);
|
||||
this.handleAddressAdded = this.handleAddressAdded.bind(this);
|
||||
this.handleAddressRemoved = this.handleAddressRemoved.bind(this);
|
||||
this.handleContactAdded = this.handleContactAdded.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -840,6 +842,22 @@ class User extends React.Component {
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
handleContactAdded(contact) {
|
||||
const user_uuid = this.props.params.user_uuid;
|
||||
const self = this;
|
||||
|
||||
var contactObj = {
|
||||
"type": contact.type,
|
||||
"contact": contact.contact,
|
||||
}
|
||||
|
||||
Instance.getRawConn().post(`/v1/nemt/users/portal/${user_uuid}/contact`, contactObj)
|
||||
.then(res => {
|
||||
this.getUser(user_uuid);
|
||||
})
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
handleAddressAdded(address) {
|
||||
const user_uuid = this.props.params.user_uuid;
|
||||
const self = this;
|
||||
@@ -890,6 +908,7 @@ class User extends React.Component {
|
||||
user={user}
|
||||
onAddressAdded={this.handleAddressAdded}
|
||||
onAddressRemoved={this.handleAddressRemoved}
|
||||
onContactAdded={this.handleContactAdded}
|
||||
readOnly={readOnly}
|
||||
/>
|
||||
</QueueAnim>
|
||||
|
||||
Reference in New Issue
Block a user