Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue#13 offhours support #14

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 122 additions & 15 deletions src/Views/HealthCareSettings/HealthCareSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "react-bootstrap";
import "./HealthCareSettings.css";
import { store } from "react-notifications-component";
const numberRegex = new RegExp('^\\d+$')
class HealthCareSettings extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -122,6 +123,12 @@ class HealthCareSettings extends Component {
this.state.keystoreAlias =this.selectedHealthCareSettings.backendAuthKeyAlias;
this.state.phaUrl = this.selectedHealthCareSettings.phaUrl;
this.state.ttpUrl = this.selectedHealthCareSettings.trustedThirdParty;
this.state.offhoursEnabled = this.selectedHealthCareSettings.offhoursEnabled; // "hours" lower case typo from HealthCareSettings.java:341
this.state.offHoursStart = this.selectedHealthCareSettings.offHoursStart;
this.state.offHoursStartMin = this.selectedHealthCareSettings.offHoursStartMin;
this.state.offHoursEnd = this.selectedHealthCareSettings.offHoursEnd;
this.state.offHoursEndMin = this.selectedHealthCareSettings.offHoursEndMin;
this.state.offHoursTimezone = this.selectedHealthCareSettings.offHoursTimezone;

if (this.selectedHealthCareSettings.requireAud) {
this.state.isAudRequired = true;
Expand Down Expand Up @@ -276,7 +283,14 @@ class HealthCareSettings extends Component {
});
}

handleSubmitReportToChange(e) {
handleOffHoursChange(e) {
console.log(e.target.value);
this.setState({
offhoursEnabled: e.target.value === "True"
});
}

handleSubmitReportToChange(e) {
console.log(e.target.value);
if (e.target.value === "pha") {
this.state.ttpUrl = "";
Expand Down Expand Up @@ -495,6 +509,12 @@ class HealthCareSettings extends Component {
orgId: this.state.orgId ? this.state.orgId : null,
assigningAuthorityId: this.state.assigningAuthorityId? this.state.assigningAuthorityId: null,
defaultProviderId: this.state.defaultProviderId? this.state.defaultProviderId: null,
offhoursEnabled: this.state.offhoursEnabled === true ? this.state.offhoursEnabled : false,
offHoursStart: this.state.offHoursStart !== undefined ? this.state.offHoursStart : null,
offHoursStartMin: this.state.offHoursStartMin !== undefined ? this.state.offHoursStartMin : null,
offHoursEnd: this.state.offHoursEnd !== undefined ? this.state.offHoursEnd : null,
offHoursEndMin: this.state.offHoursEndMin !== undefined ? this.state.offHoursEndMin : null,
offHoursTimezone: this.state.offHoursTimezone !== undefined ? this.state.offHoursTimezone : null,
};
if (!this.addNewHealthCare && this.selectedHealthCareSettings) {
healthCareSettings["id"] = this.selectedHealthCareSettings.id;
Expand Down Expand Up @@ -1043,7 +1063,7 @@ class HealthCareSettings extends Component {
</Form.Control.Feedback>
</Col>
</Form.Group>
<Form.Group as={Row} controlId="directPwd">
<Form.Group as={Row} controlId="directEndpointCertificateNameOrAlia">
<Form.Label column sm={2}>
Direct Endpoint Certificate Name or Alia:
</Form.Label>
Expand Down Expand Up @@ -1150,10 +1170,10 @@ class HealthCareSettings extends Component {

</Col>
<Col sm={4}>
<Form.Check type="radio" id="smtpAuthEnabled">
<Form.Check type="radio" id="smtpAuthNotEnabled">
<Form.Check.Input
type="radio"
id="smtpAuthEnabled"
id="smtpAuthNotEnabled"
label="False"
name="smtpAuthEnabled"
value="false"
Expand Down Expand Up @@ -1190,7 +1210,7 @@ class HealthCareSettings extends Component {
{this.state.smtpSslEnabled && (
<Row>
<Col sm={6}>
<Form.Check type="radio" >
<Form.Check type="radio" id="tlsv1_1" >
<Form.Check.Input
type="radio"
label="TLSv1.1"
Expand All @@ -1201,7 +1221,7 @@ class HealthCareSettings extends Component {
</Form.Check>
</Col>
<Col sm={6}>
<Form.Check type="radio">
<Form.Check type="radio" id="tlsv1_2">
<Form.Check.Input
type="radio"
label="TLSv1.2"
Expand All @@ -1216,10 +1236,10 @@ class HealthCareSettings extends Component {
</Form.Check>
</Col>
<Col sm={4}>
<Form.Check type="radio" id="smtpSslEnabled">
<Form.Check type="radio" id="smtpSslNotEnabled">
<Form.Check.Input
type="radio"
id="smtpSslEnabled"
id="smtpSslNotEnabled"
label="False"
name="smtpSslEnabled"
value="false"
Expand Down Expand Up @@ -1333,10 +1353,10 @@ class HealthCareSettings extends Component {
</Form.Check>
</Col>
<Col sm={4}>
<Form.Check type="radio"id="imapAuthEnabled" >
<Form.Check type="radio"id="imapAuthNotEnabled" >
<Form.Check.Input
type="radio"
id="imapAuthEnabled"
id="imapAuthNotEnabled"
label="False"
name="imapAuthEnabled"
value="false"
Expand Down Expand Up @@ -1377,10 +1397,10 @@ class HealthCareSettings extends Component {
</Form.Check>
</Col>
<Col sm={4}>
<Form.Check type="radio" id="imapSslEnabled">
<Form.Check type="radio" id="imapSslNotEnabled">
<Form.Check.Input
type="radio"
id="imapSslEnabled"
id="imapSslNotEnabled"
label="False"
name="imapSslEnabled"
value="false"
Expand Down Expand Up @@ -1601,6 +1621,93 @@ class HealthCareSettings extends Component {
</Form.Control.Feedback>
</Col>
</Form.Group>

<Form.Group as={Row} controlId="offhoursEnabled">
<Form.Label column sm={2}>
Off Hours Enabled:
</Form.Label>
<Col sm={10}>
<Row>
<Col sm={4}>
<Form.Check type="radio" id="offhoursTrue">
<Form.Check.Input type="radio" checked={this.state.offhoursEnabled === true} value="True" onChange={e => this.handleOffHoursChange(e)} />
<Form.Check.Label>True</Form.Check.Label>
</Form.Check>
</Col>
<Col sm={4}>
<Form.Check type="radio" id="offhoursFalse">
<Form.Check.Input type="radio" checked={this.state.offhoursEnabled !== true} value="False" onChange={e => this.handleOffHoursChange(e)} />
<Form.Check.Label>False</Form.Check.Label>
</Form.Check>
</Col>
</Row>
</Col>
</Form.Group>

{this.state.offhoursEnabled === true ? (
<div>

<Form.Group as={Row} controlId="offHoursStart">
<Form.Label column sm={2}>
Off Hours Start Hour:
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Off Hours Start Hour" required pattern="\d+" name="offHoursStart" onChange={e => this.handleChange(e)} value={this.state.offHoursStart} isInvalid={this.state.isValidated && !numberRegex.test(this.state.offHoursStart)}/>
<Form.Control.Feedback type="invalid">
Please provide a valid off hours start hour.
</Form.Control.Feedback>
</Col>
</Form.Group>

<Form.Group as={Row} controlId="offHoursStartMin">
<Form.Label column sm={2}>
Off Hours Start Minute:
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Off Hours Start Minute" required pattern="\d+" name="offHoursStartMin" onChange={e => this.handleChange(e)} value={this.state.offHoursStartMin} isInvalid={this.state.isValidated && !numberRegex.test(this.state.offHoursStartMin)}/>
<Form.Control.Feedback type="invalid">
Please provide a valid off hours start minute.
</Form.Control.Feedback>
</Col>
</Form.Group>

<Form.Group as={Row} controlId="offHoursEnd">
<Form.Label column sm={2}>
Off Hours End Hour:
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Off Hours End Hour" required pattern="\d+" name="offHoursEnd" onChange={e => this.handleChange(e)} value={this.state.offHoursEnd} isInvalid={this.state.isValidated && !numberRegex.test(this.state.offHoursEnd)}/>
<Form.Control.Feedback type="invalid">
Please provide a valid off hours end hour.
</Form.Control.Feedback>
</Col>
</Form.Group>

<Form.Group as={Row} controlId="offHoursEndMin">
<Form.Label column sm={2}>
Off Hours End Minute:
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Off Hours End Minute" required pattern="\d+" name="offHoursEndMin" onChange={e => this.handleChange(e)} value={this.state.offHoursEndMin} isInvalid={this.state.isValidated && !numberRegex.test(this.state.offHoursEndMin)}/>
<Form.Control.Feedback type="invalid">
Please provide a valid off hours end minute.
</Form.Control.Feedback>
</Col>
</Form.Group>

<Form.Group as={Row} controlId="offHoursTimezone">
<Form.Label column sm={2}>
Off Hours Timezone:
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Off Hours End Timezone" required name="offHoursTimezone" onChange={e => this.handleChange(e)} value={this.state.offHoursTimezone} isInvalid={this.state.isValidated && (this.state.offHoursTimezone === '' || this.state.offHoursTimezone === undefined)}/>
<Form.Control.Feedback type="invalid">
Please provide a valid off hours timezone (e.g., PST or .
</Form.Control.Feedback>
</Col>
</Form.Group>
</div>
) : ''}
<Form.Group
as={Row}
controlId="formHorizontalReceiveType"
Expand All @@ -1626,10 +1733,10 @@ class HealthCareSettings extends Component {

</Col>
<Col sm={4}>
<Form.Check type="radio" id="debugEnabled">
<Form.Check type="radio" id="debugNotEnabled">
<Form.Check.Input
type="radio"
id="debugEnabled"
id="debugNotEnabled"
label="False"
name="debugEnabled"
value="false"
Expand Down Expand Up @@ -1692,7 +1799,7 @@ class HealthCareSettings extends Component {
</Col>
</Form.Group>

<Form.Group as={Row} controlId="endThreshold">
<Form.Group as={Row} controlId="orgId">
<Form.Label column sm={2}>
Organization Id:
</Form.Label>
Expand Down