Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh0602 authored Feb 29, 2024
2 parents e67e034 + 3acb38e commit 2f4500a
Show file tree
Hide file tree
Showing 46 changed files with 1,039 additions and 923 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/thank-you.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/[email protected]
with:
script: |
const thankyouNote = 'We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us :1st_place_medal:. We always welcome your contribution :slightly_smiling_face:, so feel free to contribute to anything anytime, and never lose that spirit of innovation :raised_hands:.'
const thankyouNote = 'Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:'
const options = {
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Corona Safe
Copyright (c) 2024 Open Healthcare Network

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 32 additions & 0 deletions cypress/e2e/auth_spec/redirect.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { cy, describe, it, beforeEach, Cypress } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("redirect", () => {
const loginPage = new LoginPage();

beforeEach(() => {
cy.log("Logging in the user devdistrictadmin");
});

it("Check if login redirects to the right url", () => {
cy.awaitUrl("/resource/board", true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/resource/board");
});

it("Check if the redirect param works", () => {
const baseUrl = Cypress.config("baseUrl");
cy.awaitUrl(`login?redirect=${baseUrl}/resource/board`, true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/resource/board");
});

it("Check to ensure that redirect is the same origin", () => {
cy.awaitUrl("login?redirect=https://google.com", true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/facility");
});
});
5 changes: 5 additions & 0 deletions cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ describe("Facility Homepage Function", () => {

it("Verify the Facility card button redirection", () => {
// view cns button
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewCnsButton();
facilityHome.verifyCnsUrl();
facilityHome.navigateBack();
Expand Down Expand Up @@ -121,6 +124,8 @@ describe("Facility Homepage Function", () => {
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
// go to cns page in the facility details page
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewFacilityDetails();
facilityHome.clickFacilityCnsButton();
Expand Down
14 changes: 14 additions & 0 deletions cypress/pageobject/Login/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@ class LoginPage {
cy.loginByApi("devdoctor", "Coronasafe@123");
}

loginAsStaff(): void {
cy.loginByApi("staffdev", "Coronasafe@123");
}

loginManuallyAsDistrictAdmin(): void {
cy.get("input[id='username']").type("devdistrictadmin");
cy.get("input[id='password']").type("Coronasafe@123");
cy.get("button").contains("Login").click();
}

login(username: string, password: string): void {
cy.loginByApi(username, password);
}

ensureLoggedIn(): void {
cy.get("p").contains("Sign Out").should("exist");
}
}

export default LoginPage;
10 changes: 5 additions & 5 deletions src/CAREUI/interactive/LegendInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CareIcon from "../icons/CareIcon";
import { classNames } from "../../Utils/utils";
import { RefObject, useRef, useState, useEffect } from "react";

import { useTranslation } from "react-i18next";
type InputProps = {
id?: string;
name: string;
Expand All @@ -19,7 +19,7 @@ type InputProps = {
onKeyDown?: (e: any) => void;
onKeyPress?: (e: any) => void;
disabled?: boolean;
error?: boolean;
error?: string;
className?: string;
outerClassName?: string;
size?: "small" | "medium" | "large";
Expand All @@ -30,6 +30,7 @@ export default function LegendInput(props: InputProps) {
/**
* Useful for small input forms. Should only be used in special cases.
*/
const { t } = useTranslation();
const [showPassword, setShowPassword] = useState(false);
const inputRef = useRef<HTMLInputElement>(null);
const ref = props.ref || inputRef;
Expand Down Expand Up @@ -66,7 +67,6 @@ export default function LegendInput(props: InputProps) {
useEffect(() => {
ref.current && testAutoFill(ref.current);
}, [ref.current]);

return (
<div className={props.outerClassName}>
{props.label && (
Expand Down Expand Up @@ -149,8 +149,8 @@ export default function LegendInput(props: InputProps) {
</button>
)}
</div>
{props.error && (
<div className="mt-1 text-xs text-red-500">{props.error}</div>
{!!props.error && (
<div className="mt-1 text-xs text-red-500">{t(props.error)}</div>
)}
</div>
);
Expand Down
10 changes: 0 additions & 10 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,6 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [
text: "Patient Updated",
icon: "l-edit",
},
{
id: "PATIENT_DELETED",
text: "Patient Deleted",
icon: "l-user-minus",
},
{
id: "PATIENT_CONSULTATION_CREATED",
text: "Patient Consultation Created",
Expand All @@ -580,11 +575,6 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [
text: "Patient Consultation Updated",
icon: "l-heart-medical",
},
{
id: "PATIENT_CONSULTATION_DELETED",
text: "Patient Consultation Deleted",
icon: "l-heartbeat",
},
{
id: "INVESTIGATION_SESSION_CREATED",
text: "Investigation Session Created",
Expand Down
12 changes: 2 additions & 10 deletions src/Common/static/countryPhoneAndFlags.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@
"DJ": { "flag": "🇩🇯", "name": "Djibouti", "code": "253" },
"DK": { "flag": "🇩🇰", "name": "Denmark", "code": "45" },
"DM": { "flag": "🇩🇲", "name": "Dominica", "code": "1-767" },
"DO": {
"flag": "🇩🇴",
"name": "Dominican Republic",
"code": "1"
},
"DO": { "flag": "🇩🇴", "name": "Dominican Republic", "code": "1" },
"DZ": { "flag": "🇩🇿", "name": "Algeria", "code": "213" },
"EC": { "flag": "🇪🇨", "name": "Ecuador", "code": "593" },
"EE": { "flag": "🇪🇪", "name": "Estonia", "code": "372" },
Expand Down Expand Up @@ -105,11 +101,7 @@
"IL": { "flag": "🇮🇱", "name": "Israel", "code": "972" },
"IM": { "flag": "🇮🇲", "name": "Isle of Man", "code": "44-1624" },
"IN": { "flag": "🇮🇳", "name": "India", "code": "91" },
"IO": {
"flag": "🇮🇴",
"name": "British Indian Ocean Territory",
"code": "246"
},
"IO": { "flag": "🇮🇴", "name": "British Indian Ocean Territory", "code": "246" },
"IQ": { "flag": "🇮🇶", "name": "Iraq", "code": "964" },
"IR": { "flag": "🇮🇷", "name": "Iran", "code": "98" },
"IS": { "flag": "🇮🇸", "name": "Iceland", "code": "354" },
Expand Down
4 changes: 4 additions & 0 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ const AssetManage = (props: AssetManageProps) => {
<Uptime
route={routes.listAssetAvailability}
params={{ external_id: asset.id }}
header={
<div className="text-xl font-semibold">Availability History</div>
}
parentClassNames="mt-8 flex w-full flex-col bg-white p-4 shadow-sm sm:rounded-lg"
/>
)}
<div className="mb-4 mt-8 text-xl font-semibold">Service History</div>
Expand Down
9 changes: 8 additions & 1 deletion src/Components/Assets/AssetType/HL7Monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ const HL7Monitor = (props: HL7MonitorProps) => {
)}

{assetType === "HL7MONITOR" && (
<HL7PatientVitalsMonitor key={socketUrl} socketUrl={socketUrl} />
<HL7PatientVitalsMonitor
key={socketUrl}
socketUrl={socketUrl}
hideHeader={true}
hideFooter={true}
/>
)}
{assetType === "VENTILATOR" && (
<VentilatorPatientVitalsMonitor
key={socketUrl}
socketUrl={socketUrl}
hideHeader={true}
hideFooter={true}
/>
)}
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/Components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ export const Login = (props: { forgot?: boolean }) => {
) {
if (!form[key].match(/\w/)) {
hasError = true;
err[key] = t("field_required");
err[key] = "field_required";
}
}
if (!form[key]) {
hasError = true;
err[key] = t("field_required");
err[key] = "field_required";
}
});
if (hasError) {
setErrors(err);
return false;
}

return form;
};

Expand All @@ -92,6 +93,7 @@ export const Login = (props: { forgot?: boolean }) => {

const handleSubmit = async (e: any) => {
e.preventDefault();

setLoading(true);
FiltersCache.invaldiateAll();
const validated = validateData();
Expand All @@ -111,12 +113,12 @@ export const Login = (props: { forgot?: boolean }) => {
if (typeof form.username === "string") {
if (!form.username.match(/\w/)) {
hasError = true;
err.username = t("field_required");
err.username = "field_required";
}
}
if (!form.username) {
hasError = true;
err.username = t("field_required");
err.username = "field_required";
}

if (hasError) {
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Common/LanguageSelectorLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { LANGUAGE_NAMES } from "../../Locale/config";
import { classNames } from "../../Utils/utils";

export const LanguageSelectorLogin = () => {
const { i18n } = useTranslation();

const { i18n, t } = useTranslation();
useEffect(() => {
document.documentElement.setAttribute("lang", i18n.language);
}, [i18n]);
Expand All @@ -20,7 +19,7 @@ export const LanguageSelectorLogin = () => {

return (
<div className="mt-8 flex flex-col items-center text-sm text-gray-800">
Available in:
{t("available_in")}
<br />
<div className="inline-flex flex-wrap gap-3">
{Object.keys(LANGUAGE_NAMES).map((e: string) => (
Expand Down
29 changes: 16 additions & 13 deletions src/Components/Common/Uptime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export default function Uptime(
props: Readonly<{
route: QueryRoute<PaginatedResponse<AvailabilityRecord>>;
params?: Record<string, string | number>;
header?: React.ReactNode;
parentClassNames?: string;
centerInfoPanel?: boolean;
}>
) {
const [summary, setSummary] = useState<{
Expand All @@ -191,6 +194,8 @@ export default function Uptime(
setNumDays(Math.min(newNumDays, 100));
};

const centerInfoPanel = props.centerInfoPanel ?? false;

const setUptimeRecord = (records: AvailabilityRecord[]): void => {
const recordsByDayBefore: { [key: number]: AvailabilityRecord[] } = {};

Expand Down Expand Up @@ -361,10 +366,10 @@ export default function Uptime(
);
} else if (summary) {
return (
<div className="mt-8 flex w-full flex-col bg-white p-4 shadow-sm sm:rounded-lg">
<div className="mx-2 w-full">
<div className={props.parentClassNames}>
<div className="w-full">
<div className="grid grid-cols-1">
<div className="text-xl font-semibold">Availability History</div>
{props.header}
<div>
<div className="mt-2 overflow-x-clip px-5">
<div className="mb-1 mt-2 flex justify-center text-xs text-gray-700 opacity-70">
Expand Down Expand Up @@ -407,15 +412,13 @@ export default function Uptime(
}`}
></div>
</span>
{hoveredDay === index && (
<>
<UptimeInfoPopover
records={summary[index]}
day={index}
date={formatDateBeforeDays[index]}
numDays={numDays}
/>
</>
{hoveredDay === index && !centerInfoPanel && (
<UptimeInfoPopover
records={summary[index]}
day={index}
date={formatDateBeforeDays[index]}
numDays={numDays}
/>
)}
</>
);
Expand All @@ -432,7 +435,7 @@ export default function Uptime(
</div>
</div>
{hoveredDay !== -1 && (
<div className="relative sm:hidden">
<div className={`relative ${!centerInfoPanel && "sm:hidden"}`}>
<UptimeInfo
records={summary[hoveredDay]}
date={formatDateBeforeDays[hoveredDay]}
Expand Down
23 changes: 23 additions & 0 deletions src/Components/Common/UserDetailsComponet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import UserDetails from "./UserDetails";

const UserDetailComponent = ({
id,
title,
value,
}: {
id: string;
title: string;
value: string;
}) => (
<div className="col-span-1">
<UserDetails id={id} title={title}>
<div className="overflow-hidden">
<div className="truncate font-semibold" title={value}>
{value}
</div>
</div>
</UserDetails>
</div>
);

export default UserDetailComponent;
3 changes: 3 additions & 0 deletions src/Components/ExternalResult/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export interface IExternalResult {
sample_collection_date: string;
patient_category: string;
srf_id: string;
permanent_address: string;
test_id: string;
village: string;
district_object: {
id: number;
name: string;
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ export default function CentralNursingStation({ facilityId }: Props) {
?.start_date
}
key={`${props.patientAssetBed?.bed.id}-${hash}`}
{...props}
patientAssetBed={props.patientAssetBed}
socketUrl={props.socketUrl || ""}
config={config}
/>
</div>
Expand Down
Loading

0 comments on commit 2f4500a

Please sign in to comment.