Skip to content

Commit

Permalink
Merge pull request #565 from mozzy11/2.8
Browse files Browse the repository at this point in the history
More fixes on the program
  • Loading branch information
mozzy11 authored Sep 26, 2023
2 parents 89f8b42 + 339d652 commit 33cf5fa
Show file tree
Hide file tree
Showing 8 changed files with 1,125 additions and 638 deletions.
93 changes: 64 additions & 29 deletions frontend/src/components/cytology/CytologyCaseView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
import UserSessionDetailsContext from "../../UserSessionDetailsContext";
import { NotificationContext } from "../layout/Layout";
import { AlertDialog, NotificationKinds } from "../common/CustomNotification";
import { FormattedMessage ,useIntl} from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";
import "../pathology/PathologyDashboard.css";

export const QuestionnaireResponse = ({ questionnaireResponse }) => {
Expand All @@ -39,11 +39,17 @@ export const QuestionnaireResponse = ({ questionnaireResponse }) => {
return (
<>
<div className="questionnaireResponseItem">
{item.text}:
{item.answer &&
item.answer.map((answer, index) => {
return <span key={index}>{renderAnswer(answer)}</span>;
})}
<Grid>
<Column lg={6} md={8} sm={4}>
<h6> {item.text}:</h6>
</Column>
<Column lg={10} md={8} sm={4}>
{item.answer &&
item.answer.map((answer, index) => {
return <Tag key={index}>{renderAnswer(answer)}</Tag>;
})}
</Column>
</Grid>
</div>
</>
);
Expand Down Expand Up @@ -130,7 +136,8 @@ function CytologyCaseView() {
const [pathologistUsers, setPathologistUsers] = useState([]);
const [loading, setLoading] = useState(true);
const [reportTypes, setReportTypes] = useState([]);
const intl = useIntl()
const intl = useIntl();
const [slidesToAdd, setSlidesToAdd] = useState(1);

async function displayStatus(response) {
var body = await response.json();
Expand Down Expand Up @@ -349,10 +356,18 @@ function CytologyCaseView() {

return (
<>
<Breadcrumb>
<BreadcrumbItem href="/">{intl.formatMessage({ id: "home.label" })}</BreadcrumbItem>
<BreadcrumbItem href="/CytologyDashboard">{intl.formatMessage({ id: "cytology.label.dashboard" })}</BreadcrumbItem>
</Breadcrumb>
<Grid fullWidth={true}>
<Column lg={16}>
<Breadcrumb>
<BreadcrumbItem href="/">
{intl.formatMessage({ id: "home.label" })}
</BreadcrumbItem>
<BreadcrumbItem href="/CytologyDashboard">
{intl.formatMessage({ id: "cytology.label.dashboard" })}
</BreadcrumbItem>
</Breadcrumb>
</Column>
</Grid>

<Grid fullWidth={true}>
<Column lg={16}>
Expand Down Expand Up @@ -454,7 +469,7 @@ function CytologyCaseView() {
save(e);
}}
>
Save
<FormattedMessage id="label.button.save" />
</Button>
</Column>
<Column lg={16} md={8} sm={4}>
Expand Down Expand Up @@ -544,7 +559,7 @@ function CytologyCaseView() {
<>
<Column lg={2} md={8} sm={4}>
<IconButton
label="remove slide"
label={intl.formatMessage({ id: "label.button.remove.slide" })}
onClick={() => {
var info = { ...pathologySampleInfo };
info["slides"].splice(index, 1);
Expand All @@ -564,9 +579,7 @@ function CytologyCaseView() {
<FormattedMessage id="pathology.label.slide.number" />
}
hideLabel={true}
placeholder={
<FormattedMessage id="pathology.label.slide.number" />
}
placeholder={intl.formatMessage({ id: "pathology.label.slide.number" })}
value={slide.slideNumber}
type="number"
onChange={(e) => {
Expand All @@ -586,9 +599,7 @@ function CytologyCaseView() {
<FormattedMessage id="pathology.label.location" />
}
hideLabel={true}
placeholder={
<FormattedMessage id="pathology.label.location" />
}
placeholder={intl.formatMessage({ id: "pathology.label.location" })}
value={slide.location}
onChange={(e) => {
var newSlides = [...pathologySampleInfo.slides];
Expand Down Expand Up @@ -671,15 +682,41 @@ function CytologyCaseView() {
);
})}

<Column lg={16} md={8} sm={4}>
<Column lg={2} md={8} sm={4}>
<TextInput
id="slidesToAdd"
labelText={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
hideLabel={true}
placeholder={intl.formatMessage({ id: "pathology.label.slide.add.number" })}
value={slidesToAdd}
type="number"
onChange={(e) => {
setSlidesToAdd(e.target.value);
}}
/>
</Column>
<Column lg={14} md={8} sm={4}>
<Button
onClick={() => {
const maxSlideNumber = pathologySampleInfo.slides.reduce(
(max, slide) => {
const slideNumber = slide.slideNumber || 0;
return Math.ceil(Math.max(max, slideNumber));
},
0,
);

var allSlides = pathologySampleInfo.slides || [];
Array.from({ length: slidesToAdd }, (_, index) => {
allSlides.push({
id: "",
slideNumber: maxSlideNumber + 1 + index,
});
})

setPathologySampleInfo({
...pathologySampleInfo,
slides: [
...(pathologySampleInfo.slides || []),
{ id: "", slideNumber: "" },
],
slides: allSlides
});
}}
>
Expand Down Expand Up @@ -711,9 +748,7 @@ function CytologyCaseView() {
<SelectItem
disabled
value="ADD"
text={
<FormattedMessage id="immunohistochemistry.label.addreport" />
}
text={intl.formatMessage({ id: "immunohistochemistry.label.addreport" })}
/>
{reportTypes.map((report, index) => {
return (
Expand Down Expand Up @@ -741,7 +776,7 @@ function CytologyCaseView() {
<>
<Column lg={2} md={8} sm={4}>
<IconButton
label="Remove Report"
label={intl.formatMessage({ id: "label.button.remove.report" })}
onClick={() => {
var info = { ...pathologySampleInfo };
info["reports"].splice(index, 1);
Expand Down Expand Up @@ -1637,7 +1672,7 @@ function CytologyCaseView() {
save(e);
}}
>
Save
<FormattedMessage id="label.button.save" />
</Button>
</Column>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import UserSessionDetailsContext from "../../UserSessionDetailsContext";
import { NotificationContext } from "../layout/Layout";
import { AlertDialog, NotificationKinds } from "../common/CustomNotification";
import { SearchResults } from "../resultPage/SearchResultForm";
import { FormattedMessage ,useIntl} from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";
import "./../pathology/PathologyDashboard.css";

export const QuestionnaireResponse = ({ questionnaireResponse }) => {
Expand All @@ -38,11 +38,15 @@ export const QuestionnaireResponse = ({ questionnaireResponse }) => {
return (
<>
<div className="questionnaireResponseItem">
{item.text}:
{item.answer &&
item.answer.map((answer, index) => {
return <span key={index}>{renderAnswer(answer)}</span>;
})}
<Grid>
<Column lg={6} md={8} sm={4}><h6>{item.text}:</h6> </Column>
<Column lg={10} md={8} sm={4}>
{item.answer &&
item.answer.map((answer, index) => {
return <Tag key={index}>{renderAnswer(answer)}</Tag>;
})}
</Column>
</Grid>
</div>
</>
);
Expand Down Expand Up @@ -103,7 +107,7 @@ function ImmunohistochemistryCaseView() {
const [results, setResults] = useState({ testResult: [] });
const [loading, setLoading] = useState(true);
const [resultsLoading, setResultsLoading] = useState(true);
const intl = useIntl()
const intl = useIntl();
async function displayStatus(response) {
var body = await response.json();
console.log(body);
Expand Down Expand Up @@ -246,10 +250,20 @@ function ImmunohistochemistryCaseView() {

return (
<>
<Breadcrumb>
<BreadcrumbItem href="/">{intl.formatMessage({ id: "home.label" })}</BreadcrumbItem>
<BreadcrumbItem href="/ImmunohistochemistryDashboard">{intl.formatMessage({ id: "immunohistochemistry.label.dashboard" })}</BreadcrumbItem>
</Breadcrumb>
<Grid fullWidth={true}>
<Column lg={16}>
<Breadcrumb>
<BreadcrumbItem href="/">
{intl.formatMessage({ id: "home.label" })}
</BreadcrumbItem>
<BreadcrumbItem href="/ImmunohistochemistryDashboard">
{intl.formatMessage({
id: "immunohistochemistry.label.dashboard",
})}
</BreadcrumbItem>
</Breadcrumb>
</Column>
</Grid>

<Grid fullWidth={true}>
<Column lg={16}>
Expand Down Expand Up @@ -355,7 +369,7 @@ function ImmunohistochemistryCaseView() {
save(e);
}}
>
Save
<FormattedMessage id="label.button.save" />
</Button>
</Column>
<Column lg={16} md={8} sm={4}>
Expand Down Expand Up @@ -455,7 +469,7 @@ function ImmunohistochemistryCaseView() {
<Select
id="report"
name="report"
labelText="Add Report"
labelText={intl.formatMessage({ id: "immunohistochemistry.label.addreport" })}
onChange={(event) => {
setImmunohistochemistrySampleInfo({
...immunohistochemistrySampleInfo,
Expand All @@ -466,7 +480,7 @@ function ImmunohistochemistryCaseView() {
});
}}
>
<SelectItem disabled value="ADD" text="Add Report" />
<SelectItem disabled value="ADD" text={intl.formatMessage({ id: "immunohistochemistry.label.addreport" })} />
{reportTypes.map((report, index) => {
return (
<SelectItem
Expand Down Expand Up @@ -495,7 +509,7 @@ function ImmunohistochemistryCaseView() {
<>
<Column lg={2} md={8} sm={4}>
<IconButton
label="Remove Report"
label={intl.formatMessage({ id: "label.button.remove.report" })}
onClick={() => {
var info = { ...immunohistochemistrySampleInfo };
info["reports"].splice(index, 1);
Expand Down Expand Up @@ -605,19 +619,19 @@ function ImmunohistochemistryCaseView() {
<Column lg={2} md={2} sm={1} key={index}>
<TextInput
id="blockNumber"
labelText="block number"
labelText={intl.formatMessage({ id: "pathology.label.block.number" })}
hideLabel={true}
placeholder="Block Number"
placeholder={intl.formatMessage({ id: "pathology.label.block.number" })}
value={block.blockNumber}
disabled={true}
/>
</Column>
<Column lg={2} md={2} sm={1}>
<TextInput
id="location"
labelText="location"
labelText={intl.formatMessage({ id: "pathology.label.location" })}
hideLabel={true}
placeholder="Location"
placeholder={intl.formatMessage({ id: "pathology.label.location" })}
value={block.location}
disabled={true}
/>
Expand Down Expand Up @@ -670,19 +684,19 @@ function ImmunohistochemistryCaseView() {
<Column lg={2} md={2} sm={1} key={index}>
<TextInput
id="slideNumber"
labelText="slide number"
labelText={intl.formatMessage({ id: "pathology.label.slide.number" })}
hideLabel={true}
disabled={true}
placeholder="Slide Number"
placeholder={intl.formatMessage({ id: "pathology.label.slide.number" })}
value={slide.slideNumber}
/>
</Column>
<Column lg={2} md={2} sm={1}>
<TextInput
id="location"
labelText="location"
labelText={intl.formatMessage({ id: "pathology.label.location" })}
hideLabel={true}
placeholder="Location"
placeholder={intl.formatMessage({ id: "pathology.label.location" })}
value={slide.location}
disabled={true}
/>
Expand Down Expand Up @@ -848,7 +862,7 @@ function ImmunohistochemistryCaseView() {
save(e);
}}
>
Save
<FormattedMessage id="label.button.save" />
</Button>
</Column>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SelectItem,
TextInput,
Stack,
InlineLoading
InlineLoading,
} from "@carbon/react";
import { FormattedMessage } from "react-intl";
import "../../index.css";
Expand Down Expand Up @@ -314,6 +314,11 @@ const EditOrderEntryAdditionalQuestions = ({
setDefaultAdditionalQuestions,
);
}
if (orderFormValues?.sampleOrderItems?.labNo) {
if (!orderFormValues.sampleOrderItems.programId) {
setLoading(false);
}
}
}, [orderFormValues]);

const handleProgramSelection = (event) => {
Expand Down Expand Up @@ -498,7 +503,9 @@ const EditOrderEntryAdditionalQuestions = ({
<>
<Stack gap={10}>
<div className="orderLegendBody">
<h3><FormattedMessage id="label.program" /></h3>
<h3>
<FormattedMessage id="label.program" />
</h3>
<ProgramSelect
orderFormValues={orderFormValues}
programChange={handleProgramSelection}
Expand All @@ -515,7 +522,7 @@ const EditOrderEntryAdditionalQuestions = ({
value={questionnaireResponse}
/>
)}
{loading && <InlineLoading/>}
{loading && <InlineLoading />}
</div>
</Stack>
</>
Expand Down
Loading

0 comments on commit 33cf5fa

Please sign in to comment.