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

minor fixes on oder referal page #635

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
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
39 changes: 28 additions & 11 deletions frontend/src/components/addOrder/OrderReferralRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,38 @@ const OrderReferralRequest = ({
function handleSentDatePicker(date, index) {
if (date != null) {
const update = [...referralRequests];
update[index].sentDate = date;
if (update[index]) {
update[index].sentDate = date;
}
setReferralRequests(update);
}
}

const header = [
{ key: "reason", header: requiredSymbol(intl.formatMessage({ id: "referral.label.reason"})) },
{ key: "referrer", header: intl.formatMessage({ id: "referrer.label" })},
{
key: "reason",
header: requiredSymbol(
intl.formatMessage({ id: "referral.label.reason" }),
),
},
{ key: "referrer", header: intl.formatMessage({ id: "referrer.label" }) },
{
key: "institute",
header: requiredSymbol(intl.formatMessage({ id: "referral.label.institute"})),
header: requiredSymbol(
intl.formatMessage({ id: "referral.label.institute" }),
),
},
{
key: "",
header:
intl.formatMessage({ id: "referral.label.sentdate" }) +
"\n" +
"(dd/mm/yyyy)",
},
{
key: "name",
header: requiredSymbol(intl.formatMessage({ id: "search.label.test" })),
},
{ key: "", header:intl.formatMessage({ id: "referral.label.sentdate"}) + "\n" + "(dd/mm/yyyy)" },
{ key: "name", header: requiredSymbol(intl.formatMessage({ id: "search.label.test" })) },

];

const updateUIRender = () => {
Expand Down Expand Up @@ -105,7 +122,7 @@ const OrderReferralRequest = ({
id={"referralReasonId_" + id}
options={referralReasons}
value={
referralRequests[i].reasonForReferral
referralRequests[i]?.reasonForReferral
? referralRequests[i].reasonForReferral
: null
}
Expand All @@ -116,7 +133,7 @@ const OrderReferralRequest = ({
<CustomTextInput
id={"referrer_" + id}
defaultValue={
referralRequests[i].referrer
referralRequests[i]?.referrer
? referralRequests[i].referrer
: obj.referrer
}
Expand All @@ -129,7 +146,7 @@ const OrderReferralRequest = ({
id={"referredInstituteId_" + id}
options={referralOrganizations}
value={
referralRequests[i].institute
referralRequests[i]?.institute
? referralRequests[i].institute
: null
}
Expand All @@ -143,7 +160,7 @@ const OrderReferralRequest = ({
autofillDate={true}
className="orderReferralSentDate"
value={
referralRequests[i].sentDate
referralRequests[i]?.sentDate
? referralRequests[i].sentDate
: null
}
Expand Down
27 changes: 19 additions & 8 deletions frontend/src/components/addOrder/SampleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import CustomSelect from "../common/CustomSelect";
import CustomDatePicker from "../common/CustomDatePicker";
import CustomTimePicker from "../common/CustomTimePicker";
import { NotificationKinds } from "../common/CustomNotification";
import { FormattedMessage } from "react-intl";
import { FormattedMessage, useIntl } from "react-intl";
import { getFromOpenElisServer } from "../utils/Utils";
import { NotificationContext, ConfigurationContext } from "../layout/Layout";
import { sampleTypeTestsStructure } from "../data/SampleEntryTestsForTypeProvider";
Expand Down Expand Up @@ -63,6 +63,7 @@ const SampleType = (props) => {
collectionTime: "",
});
const [loading, setLoading] = useState(true);
const intl = useIntl();

const defaultSelect = { id: "", value: "Choose Rejection Reason" };

Expand Down Expand Up @@ -528,8 +529,12 @@ const SampleType = (props) => {
<Search
size="lg"
id={`panels_search_` + index}
labelText={<FormattedMessage id="label.search.availablepanel"/>}
placeholder={<FormattedMessage id="choose.availablepanel"/>}
labelText={
<FormattedMessage id="label.search.availablepanel" />
}
placeholder={intl.formatMessage({
id: "choose.availablepanel",
})}
onChange={handlePanelSearchChange}
value={(() => {
if (panelSearchTerm) {
Expand Down Expand Up @@ -612,12 +617,18 @@ const SampleType = (props) => {
<></>
)}
</div>
<FormGroup legendText={<FormattedMessage id="legend.search.availabletests"/>}>
<FormGroup
legendText={<FormattedMessage id="legend.search.availabletests" />}
>
<Search
size="lg"
id={`tests_search_` + index}
labelText={<FormattedMessage id="label.search.available.targetest"/>}
placeholder={<FormattedMessage id="holder.choose.availabletest"/>}
labelText={
<FormattedMessage id="label.search.available.targetest" />
}
placeholder={intl.formatMessage({
id: "holder.choose.availabletest",
})}
onChange={handleTestSearchChange}
value={(() => {
if (testSearchTerm) {
Expand Down Expand Up @@ -650,7 +661,7 @@ const SampleType = (props) => {
<Layer>
<Tile className={"emptyFilterTests"}>
<span>
<FormattedMessage id="title.notestfoundmatching"/>
<FormattedMessage id="title.notestfoundmatching" />
<strong> "{testSearchTerm}"</strong>{" "}
</span>
</Tile>
Expand Down Expand Up @@ -679,7 +690,7 @@ const SampleType = (props) => {
<div className="requestTestReferral">
<Checkbox
id={`useReferral_` + index}
labelText={<FormattedMessage id="label.refertest.referencelab"/>}
labelText={<FormattedMessage id="label.refertest.referencelab" />}
onChange={handleReferralRequest}
/>
{requestTestReferral === true && (
Expand Down