Skip to content

Commit

Permalink
null should not be sliced
Browse files Browse the repository at this point in the history
  • Loading branch information
DeMarcus Kennedy committed May 6, 2024
1 parent 17edf05 commit 0d46332
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 144 deletions.
10 changes: 5 additions & 5 deletions client/src/components/Forms/AdmissionAssessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class AdmissionAssessment extends Component {
...this.state,
loadingClients: true,
});

this.submit(save);
};

Expand Down Expand Up @@ -603,12 +603,12 @@ class AdmissionAssessment extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
</div>

<Row>
<Col md={3} className="print-column">
<div className="form-group logInInputField">
Expand Down Expand Up @@ -2364,12 +2364,12 @@ class AdmissionAssessment extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
</div>

<Row>
<Col md={3} className="print-column">
<div className="form-group logInInputField">
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Forms/BodyCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class BodyCheck extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -1501,7 +1501,7 @@ class BodyCheck extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down
156 changes: 78 additions & 78 deletions client/src/components/Forms/DailyProgressAndActivity.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/src/components/Forms/FormSubmitterListContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class FormSubmitterListContainer extends Component {
</th>
{(this.state.formType === "Incident Report" || this.state.formType === "Serious Incident Report" || this.state.formType === "Restraint Report") && (
<th>
Occured
Occurred
</th>
)}
</tr>
Expand All @@ -213,7 +213,7 @@ class FormSubmitterListContainer extends Component {
<tr>
<td>
{/* display status as "IN PROGRESS" if form created before status attribute was added */}
{(form.status === "" || !form.status) ? "IN PROGRESS" : "SUBMITTED"}
{(form.status === "" || !form.status) ? "IN PROGRESS" : form.status === 'COMPLETED' ? "SUBMITTED" : form.status}
</td>
<td>
{new Date(form.createDate).toLocaleDateString('en-US', { month: '2-digit', day: '2-digit', year: 'numeric' })}
Expand Down
36 changes: 18 additions & 18 deletions client/src/components/Forms/IllnessInjury.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ class IllnessInjury extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
</div>

<Row>
<Col md={4} className="print-column">
<div className="form-group logInInputField">
Expand Down Expand Up @@ -668,7 +668,7 @@ class IllnessInjury extends Component {
</div>
) : (
<Container className="print-container">
<div className="form-group logInInputField">
<div className="form-group logInInputField">
{" "}
<label className="control-label">Child's Name</label>{" "}
<input
Expand All @@ -686,7 +686,7 @@ class IllnessInjury extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -897,10 +897,10 @@ class IllnessInjury extends Component {
<>
<FormError errorId={this.props.id + "-error"} />
<Row className="save-submit-row">
<div style={{ display: "flex", width: "46%" }}>
<div style={{ display: "flex", width: "46%" }}>
<button
className="lightBtn hide hide-on-print save-submit-btn"
style={{
style={{
width: "100%",
display: this.state.status === 'COMPLETED' ? "none" : "block"
}}
Expand All @@ -912,18 +912,18 @@ class IllnessInjury extends Component {
</button>
</div>

<div style={{ display: "flex", width: "46%" }}>
<button
className="darkBtn hide hide-on-print save-submit-btn"
style={{ width: "100%" }}
onClick={() => {
this.validateForm(false);
}}
>
Submit
</button>
</div>
</Row>
<div style={{ display: "flex", width: "46%" }}>
<button
className="darkBtn hide hide-on-print save-submit-btn"
style={{ width: "100%" }}
onClick={() => {
this.validateForm(false);
}}
>
Submit
</button>
</div>
</Row>
</>
)}
</div>
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/Forms/IncidentReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ class IncidentReport extends Component {
) : (
<Container className="print-container">
<Row>
<Col xs={12} className="print-column">
<Col xs={12} className="print-column">
<div className="form-group logInInputField">
{" "}
<label className="control-label">Child's Name</label>{" "}
Expand All @@ -483,7 +483,7 @@ class IncidentReport extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -1027,7 +1027,7 @@ class IncidentReport extends Component {
) : (
<Container className="print-container">
<Row>
<Col xs={12} className="print-column">
<Col xs={12} className="print-column">
<div className="form-group logInInputField">
{" "}
<label className="control-label">Child's Name</label>{" "}
Expand All @@ -1050,7 +1050,7 @@ class IncidentReport extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down
32 changes: 16 additions & 16 deletions client/src/components/Forms/NightMonitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class NightMonitoring extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -448,7 +448,7 @@ class NightMonitoring extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -492,20 +492,20 @@ maxHeight:"170",
<>
<FormError errorId={this.props.id + "-error"} />
<Row style={{ display: "flex", justifyContent: "space-between", paddingRight: "0px", marginLeft: "1px", marginRight: "1px" }}>
<div style={{ display: "flex", width: "46%" }}>
<button
className="lightBtn hide hide-on-print save-submit-btn"
style={{
width: "100%",
display: this.state.status === 'COMPLETED' ? "none" : "block",
}}
onClick={() => {
this.validateForm(true);
}}
>
Finish Later
</button>
</div>
<div style={{ display: "flex", width: "46%" }}>
<button
className="lightBtn hide hide-on-print save-submit-btn"
style={{
width: "100%",
display: this.state.status === 'COMPLETED' ? "none" : "block",
}}
onClick={() => {
this.validateForm(true);
}}
>
Finish Later
</button>
</div>

<div style={{ display: "flex", width: "46%" }}>
<button
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Forms/RestraintReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class RestraintReport extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -1234,7 +1234,7 @@ class RestraintReport extends Component {
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down
30 changes: 15 additions & 15 deletions client/src/components/Forms/SeriousIncidentReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class SeriousIncidentReport extends Component {
</div>
) : (
<Container className="print-container">
<div className="form-group logInInputField">
<div className="form-group logInInputField">
{" "}
<label className="control-label">Child's Name</label>{" "}
<Form.Control
Expand All @@ -503,7 +503,7 @@ class SeriousIncidentReport extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -1002,31 +1002,31 @@ class SeriousIncidentReport extends Component {
) : (
<Container>
<div className="form-group logInInputField">
{" "}
<label className="control-label">Child's Name</label>{" "}
<input
onChange={this.handleFieldInput}
value={this.state.childMeta_name}
id={"childMeta_name"}
className="form-control"
type="text"
disabled
/>{" "}
</div>
{" "}
<label className="control-label">Child's Name</label>{" "}
<input
onChange={this.handleFieldInput}
value={this.state.childMeta_name}
id={"childMeta_name"}
className="form-control"
type="text"
disabled
/>{" "}
</div>
<div className="form-group logInInputField">
<label className="control-label hide-on-print">
Create Date
</label>{" "}
<input
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control hide-on-print"
type="datetime-local"
/>{" "}
</div>
<Row>
<Col md={4} className="print-column">

<div className="form-group logInInputField">
{" "}
<label className="control-label">
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Forms/TreatmentPlan72.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ class TreatmentPlan72 extends Component {
<input
onChange={this.handleFieldInputDate}
id="createDate"
value={this.state.createDate.slice(0, -8)}
value={this.state.createDate ? this.state.createDate.slice(0, -8) : null}
className="form-control"
type="datetime-local"
/>{" "}
Expand Down Expand Up @@ -2795,7 +2795,7 @@ class TreatmentPlan72 extends Component {
<input
onChange={this.handleFieldInput}
id="createDate"
value={this.state.createDate !== null ? this.state.createDate.slice(0, -8) : ""}
value={this.state.createDate !== null ? this.state.createDate ? this.state.createDate.slice(0, -8) : null : ""}
className="form-control"
type="datetime-local"
/>{" "}
Expand Down

0 comments on commit 0d46332

Please sign in to comment.