Compare commits

..

2 Commits

Author SHA1 Message Date
GotPPay
d2b12e11ee add missing date variable 2018-05-17 19:06:01 +02:00
GotPPay
d6847aae33 set pickup address id to valid uuid 2018-05-17 19:06:01 +02:00
3 changed files with 62 additions and 82 deletions

View File

@@ -1,59 +0,0 @@
import React, { Component } from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
export class ValidationErrorsInfoDialog extends React.Component {
state = {
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}
keyboardFocused={true}
onClick={this.handleClose}
/>,
];
return (
<div>
<Dialog
title="Erors"
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;

View File

@@ -30,7 +30,6 @@ import Close from 'material-ui/svg-icons/navigation/close'
import CommunicationCall from 'material-ui/svg-icons/communication/call'
import Message from 'material-ui/svg-icons/communication/message'
import Instance from '../../../../../../../components/Connection';
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
import Checkbox from 'material-ui/Checkbox';
import Popover from 'material-ui/Popover';
@@ -42,6 +41,60 @@ const roundingTime = 1000 * 60 * 5; //5 minutes
DateTimeFormat = global.Intl.DateTimeFormat;
export class ValidationErrorsInfoDialog extends React.Component {
state = {
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}
keyboardFocused={true}
onClick={this.handleClose}
/>,
];
return (
<div>
<Dialog
title="Erors"
actions={actions}
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>
);
}
}
export class DialogExampleSimple extends React.Component {
state = {
@@ -451,6 +504,8 @@ class VerticalNonLinear extends React.Component {
}
});
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);
@@ -767,7 +822,7 @@ class VerticalNonLinear extends React.Component {
handlePickupChanged = (res, state) => {
let origin = {
id: res.id,
id: res.address_uuid ? res.address_uuid : res.id,
name: res.name,
lat: res.lat,
lng: res.lng,

View File

@@ -14,7 +14,6 @@ import RaisedButton from 'material-ui/RaisedButton';
import SelectField from 'material-ui/SelectField';
import Checkbox from 'material-ui/Checkbox';
import Instance from '../../../../../../../components/Connection';
import ValidationErrorsInfoDialog from '../../../../../../../components/Shared/ValidationErrorsInfoDialog';
class SignUp extends React.Component {
constructor(props) {
@@ -35,9 +34,7 @@ class SignUp extends React.Component {
gender: null,
agreedTerms: false,
validated: false,
memberType:"S",
showValidationErrors: false,
validationErrors:[]
memberType:"S"
}
componentDidMount = () => {
@@ -61,10 +58,7 @@ class SignUp extends React.Component {
"member": this.state.member,
"email": this.state.email,
"phonenumber": this.state.phonenumber,
"birthdate": this.state.birthdate.toISOString(),
"consent" : this.state.agreedTerms,
"type": this.state.memberType
"birthdate": this.state.birthdate.toISOString()
// "eligibility": {
// "tracking_id": "1234567",
// "payer": {
@@ -105,14 +99,9 @@ class SignUp extends React.Component {
// alert('NO benefits found for this member');
// }
}).catch(function (err) {
if (err.response.status === 422){
//Unprocessable Entity (validation failed)
state.setState(Object.assign(state.state, {showValidationErrors:true, validationErrors:err.response.data.data}))
}else{
console.log('Error to get eligibility: ', err);
alert('NO benefits found for this member');
this.handleRequestClose();
}
console.log('Error to get eligibility: ', err);
alert('NO benefits found for this member');
this.handleRequestClose();
});
}
@@ -184,15 +173,10 @@ class SignUp extends React.Component {
this.setState(Object.assign(this.state, { validated: validated }));
}
handleValidationErrosDialogDismiss(){
this.setState(Object.assign(this.state, {showValidationErrors:false}));
}
render() {
return (
<form className="">
<fieldset>
<ValidationErrorsInfoDialog open = {this.state.showValidationErrors} errorMessages = {this.state.validationErrors} modal={true} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)}/>
<div className="form-group">
<TextField
floatingLabelText="First Name"