password fix, overlay dialog fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import FlatButton from 'material-ui/FlatButton';
|
import FlatButton from 'material-ui/FlatButton';
|
||||||
|
import MaterialDialog from 'material-ui/Dialog';
|
||||||
import Dialog from './draggable-dialog';
|
import Dialog from './draggable-dialog';
|
||||||
|
|
||||||
import './draggable-dialog/css/index.css';
|
import './draggable-dialog/css/index.css';
|
||||||
@@ -45,30 +46,49 @@ export class ValidationErrorsInfoDialog extends React.Component {
|
|||||||
/>,
|
/>,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const dialogContent = (
|
||||||
|
this.props.errorMessages.map(errorMessage => {
|
||||||
|
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
|
||||||
|
const oneValidationMessageWithTab = (<span><li style={{ marginLeft: 2 + "em" }}>{errorMessage.message}</li></span>);
|
||||||
|
|
||||||
|
if (errorMessage.field_name === "password-tab") {
|
||||||
|
return oneValidationMessageWithTab;
|
||||||
|
} else {
|
||||||
|
return oneValidationMessage;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
const draggableDialog =
|
||||||
|
(<Dialog
|
||||||
|
title={this.props.title ? this.props.title : 'Error'}
|
||||||
|
isDraggable={true}
|
||||||
|
buttons={actions}
|
||||||
|
hasCloseIcon={false}
|
||||||
|
modal={this.props.modal ? this.props.modal : false}
|
||||||
|
height={defaultDialogHeight + this.props.errorMessages.length * dialogHeightPerLine}>
|
||||||
|
|
||||||
|
{dialogContent}
|
||||||
|
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
|
||||||
|
const normalDialog =
|
||||||
|
(<MaterialDialog
|
||||||
|
open={this.state.open}
|
||||||
|
title={this.props.title ? this.props.title : 'Error'}
|
||||||
|
onBackdropClick={()=>{console.log("Backdrop")}}
|
||||||
|
actions={actions}>
|
||||||
|
|
||||||
|
{dialogContent}
|
||||||
|
|
||||||
|
</MaterialDialog>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
{
|
{this.state.open && this.props.draggable && draggableDialog }
|
||||||
this.state.open &&
|
{this.state.open && !this.props.draggable && normalDialog}
|
||||||
<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 => {
|
|
||||||
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
|
|
||||||
const oneValidationMessageWithTab = (<span><li style={{ marginLeft: 2 + "em" }}>{errorMessage.message}</li></span>);
|
|
||||||
|
|
||||||
if (errorMessage.field_name === "password-tab") {
|
|
||||||
return oneValidationMessageWithTab;
|
|
||||||
} else {
|
|
||||||
return oneValidationMessage;
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</Dialog>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1281,7 +1281,7 @@ 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} draggable={true} errorMessages={this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)} />
|
||||||
<Stepper
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
linear={false}
|
linear={false}
|
||||||
|
|||||||
@@ -830,7 +830,7 @@ 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} draggable={true} errorMessages={this.state.validationErrors} onDismiss={this.handleValidationErrosDialogDismiss.bind(this)} />
|
||||||
|
|
||||||
<Stepper
|
<Stepper
|
||||||
activeStep={this.state.stepIndex}
|
activeStep={this.state.stepIndex}
|
||||||
|
|||||||
@@ -61,15 +61,28 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
componentDidMount = () => { }
|
componentDidMount = () => { }
|
||||||
|
|
||||||
|
getFormattedPhoneNumber(){
|
||||||
|
if(this.state.phone_number && this.state.phone_number.length > 0) {
|
||||||
|
return this.state.phone_number.replace('+1','').replace('(','').replace(')','').replace('-','').replace(' ','').trim()
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
isPhoneNumberFormatValid() {
|
||||||
|
let formattedNumber = this.getFormattedPhoneNumber();
|
||||||
|
return !isNaN(formattedNumber) && (formattedNumber.toString().length === 10);
|
||||||
|
}
|
||||||
|
|
||||||
buttonValidated = () => {
|
buttonValidated = () => {
|
||||||
let validated = true;
|
let validated = true;
|
||||||
if (!this.state.provider_name || this.state.provider_name === null || this.state.provider_name === "") validated = false;
|
if (!this.state.provider_name || this.state.provider_name === null || this.state.provider_name === "") validated = false;
|
||||||
if (!this.state.provider_npi || this.state.provider_npi === null || this.state.provider_npi === "") validated = false;
|
if (!this.state.provider_npi || this.state.provider_npi === null || this.state.provider_npi === "") validated = false;
|
||||||
if (!this.state.email || this.state.email === null || this.state.email === "") validated = false;
|
if (!this.state.email || this.state.email === null || this.state.email === "") validated = false;
|
||||||
if (!this.state.phone_number || this.state.phone_number === null || this.state.phone_number === "") validated = false;
|
if (!this.state.phone_number || this.state.phone_number === null || this.state.phone_number === "" || !this.isPhoneNumberFormatValid()) validated = false;
|
||||||
if (!this.state.first || this.state.first === null || this.state.first === "") validated = false;
|
if (!this.state.first || this.state.first === null || this.state.first === "") validated = false;
|
||||||
if (!this.state.last || this.state.last === null || this.state.last === "") validated = false;
|
if (!this.state.last || this.state.last === null || this.state.last === "") validated = false;
|
||||||
if (!this.state.password_validated || !this.state.pass || this.state.pass === null || this.state.pass === "") validated = false;
|
if (!this.state.pass || this.state.pass === null || this.state.pass === "") validated = false;
|
||||||
|
if (!this.state.passConfirmation || this.state.passConfirmation === null || this.state.passConfirmation === "") validated = false;
|
||||||
if (!this.state.agreedTerms) validated = false;
|
if (!this.state.agreedTerms) validated = false;
|
||||||
this.setState(Object.assign(this.state, { validated: validated }));
|
this.setState(Object.assign(this.state, { validated: validated }));
|
||||||
}
|
}
|
||||||
@@ -106,12 +119,10 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
handlePass = (event) => {
|
handlePass = (event) => {
|
||||||
this.setState(Object.assign(this.state, { pass: btoa(event.target.value) }));
|
this.setState(Object.assign(this.state, { pass: btoa(event.target.value) }));
|
||||||
this.setState(Object.assign(this.state, { password_validated: this.state.pass === this.state.passConfirmation }));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleConfirmationPass = (event) => {
|
handleConfirmationPass = (event) => {
|
||||||
this.setState(Object.assign(this.state, { passConfirmation: btoa(event.target.value) }));
|
this.setState(Object.assign(this.state, { passConfirmation: btoa(event.target.value) }));
|
||||||
this.setState(Object.assign(this.state, { password_validated: this.state.pass === this.state.passConfirmation }));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleChecked = (event, checked) => {
|
handleChecked = (event, checked) => {
|
||||||
@@ -121,6 +132,17 @@ class SignUp extends React.Component {
|
|||||||
|
|
||||||
clickEvent = (event) => {
|
clickEvent = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (this.state.passConfirmation !== this.state.pass){
|
||||||
|
this.setState(Object.assign(this.state, {
|
||||||
|
showValidationErrors: true,
|
||||||
|
validationErrors: [{message:'Confirmed password does not match password'}]
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const state = this;
|
const state = this;
|
||||||
|
|
||||||
let user = {
|
let user = {
|
||||||
|
|||||||
Reference in New Issue
Block a user