Skip to content

Commit

Permalink
Merge branch 'develop' into rithviknishad/improve-live-feed
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Dec 6, 2023
2 parents 377ce25 + a6ed2bc commit a815eae
Show file tree
Hide file tree
Showing 25 changed files with 575 additions and 599 deletions.
3 changes: 3 additions & 0 deletions public/External-Results-Template.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
District,srf id,name,age,age in,gender,mobile number,address,ward,local body,local body type,source,Sample Collection Date,result date,test type,lab name,sample type,patient status,Is Repeat,patient category,result
Ernakulam,00/EKM/0000,Bodhi CSN,24,years,m,8888888888,"CSN HQ
Kochi, Kerala ",7,Poothrikka,grama panchayath,Secondary contact aparna,2020-10-14,2020-10-14,Antigen,Karothukuzhi Laboratory,Ag-SD_Biosensor_Standard_Q_COVID-19_Ag_detection_kit,Asymptomatic,NO,Cat 17: All individuals who wish to get themselves tested,Negative
2 changes: 1 addition & 1 deletion public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"kasp_string": "KASP",
"kasp_full_string": "Karunya Arogya Suraksha Padhathi",
"sample_format_asset_import": "https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=11JaEhNHdyCHth4YQs_44YaRlP77Rrqe81VSEfg1glko&exportFormat=xlsx",
"sample_format_external_result_import": "https://docs.google.com/spreadsheets/d/17VfgryA6OYSYgtQZeXU9mp7kNvLySeEawvnLBO_1nuE/export?format=csv&id=17VfgryA6OYSYgtQZeXU9mp7kNvLySeEawvnLBO_1nuE",
"sample_format_external_result_import": "/External-Results-Template.csv",
"enable_abdm": true
}
14 changes: 11 additions & 3 deletions src/CAREUI/display/RecordMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface Props {
time?: string;
prefix?: ReactNode;
className?: string;
inlineClassName?: string;
user?: {
first_name: string;
last_name: string;
Expand All @@ -23,7 +24,14 @@ interface Props {
* A generic component to display relative time along with a tooltip and a user
* if provided.
*/
const RecordMeta = ({ time, user, prefix, className, inlineUser }: Props) => {
const RecordMeta = ({
time,
user,
prefix,
className,
inlineClassName,
inlineUser,
}: Props) => {
const isOnline = user && isUserOnline(user);

let child = (
Expand All @@ -47,11 +55,11 @@ const RecordMeta = ({ time, user, prefix, className, inlineUser }: Props) => {

if (prefix || user) {
child = (
<div className="flex items-center gap-1">
<div className={`flex items-center gap-1 ${inlineClassName}`}>
{prefix}
{child}
{user && inlineUser && <span>by</span>}
{user && <CareIcon className="care-l-user" />}
{user && !inlineUser && <CareIcon className="care-l-user" />}
{user && inlineUser && (
<span className="font-medium">{formatName(user)}</span>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/BedSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const BedSelect = (props: BedSelectProps) => {
optionLabel={(option: any) => {
if (Object.keys(option).length === 0) return "";
return (
`${option.name} ${option?.location_object?.name || t("unknown")}` ||
`${option.name}, ${option?.location_object?.name || t("unknown")}` ||
option?.location_object?.name
);
}}
Expand Down
21 changes: 9 additions & 12 deletions src/Components/Common/SkillSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback } from "react";
import { useDispatch } from "react-redux";
import { getAllSkills, getUserListSkills } from "../../Redux/actions";
import { getAllSkills } from "../../Redux/actions";
import AutoCompleteAsync from "../Form/AutoCompleteAsync";
import { SkillObjectModel } from "../Users/models";
import { SkillModel, SkillObjectModel } from "../Users/models";

interface SkillSelectProps {
id?: string;
Expand All @@ -17,6 +17,7 @@ interface SkillSelectProps {
selected: SkillObjectModel | SkillObjectModel[] | null;
setSelected: (selected: SkillObjectModel) => void;
username?: string;
userSkills?: SkillModel[];
}

export const SkillSelect = (props: SkillSelectProps) => {
Expand All @@ -32,7 +33,8 @@ export const SkillSelect = (props: SkillSelectProps) => {
disabled = false,
className = "",
errors = "",
username,
//username,
userSkills,
} = props;

const dispatchAction: any = useDispatch();
Expand All @@ -47,21 +49,16 @@ export const SkillSelect = (props: SkillSelectProps) => {
};

const res = await dispatchAction(getAllSkills(params));

const linkedSkills = await dispatchAction(
getUserListSkills({ username: username })
);

const skillsList = linkedSkills?.data?.results;
const skillsID: string[] = [];
skillsList.map((skill: any) => skillsID.push(skill.skill_object.id));
userSkills?.map((skill: SkillModel) =>
skillsID.push(skill.skill_object.id)
);
const skills = res?.data?.results.filter(
(skill: any) => !skillsID.includes(skill.id)
);

return skills;
},
[dispatchAction, searchAll, showAll]
[dispatchAction, searchAll, userSkills, showAll]
);

return (
Expand Down
2 changes: 2 additions & 0 deletions src/Components/ExternalResult/ExternalResultUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export default function ExternalResultUpload() {
<a
className="focus:ring-blue mx-auto mt-4 max-w-xs items-center rounded-md border border-primary-500 bg-white px-3 py-2 text-sm font-medium leading-4 text-primary-700 transition duration-150 ease-in-out hover:text-primary-500 hover:shadow focus:border-primary-300 focus:outline-none active:bg-gray-50 active:text-primary-800"
href={sample_format_external_result_import}
target="_blank"
download
>
<i className="fa fa-download mr-1" aria-hidden="true"></i>{" "}
<span>{t("sample_format")}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import PrescriptionsTable from "../../Medicine/PrescriptionsTable";
import Chip from "../../../CAREUI/display/Chip";
import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils";
import ReadMore from "../../Common/components/Readmore";
import { DailyRoundsList } from "../Consultations/DailyRoundsList";
import DailyRoundsList from "../Consultations/DailyRoundsList";

const PageTitle = lazy(() => import("../../Common/PageTitle"));

export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
const dispatch: any = useDispatch();
const [showAutomatedRounds, setShowAutomatedRounds] = useState(true);
const [hl7SocketUrl, setHL7SocketUrl] = useState<string>();
const [ventilatorSocketUrl, setVentilatorSocketUrl] = useState<string>();
const [monitorBedData, setMonitorBedData] = useState<AssetBedModel>();
Expand Down Expand Up @@ -674,31 +673,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</div>
</div>
<div className="w-full pl-4 xl:w-1/3">
<div className="flex flex-col md:flex-row md:items-center md:justify-between">
<PageTitle title="Update Log" hideBack breadcrumbs={false} />
<div className="mb-[2rem] pl-[1.5rem] md:mb-[0.125rem]">
<input
className="relative float-left ml-[-1.5rem] mr-[6px] mt-[0.15rem] h-[1.125rem] w-[1.125rem] appearance-none rounded-[0.25rem] border-[0.125rem] border-solid border-[rgba(0,0,0,0.25)] bg-white outline-none before:pointer-events-none before:absolute before:h-[0.875rem] before:w-[0.875rem] before:scale-0 before:rounded-full before:bg-transparent before:opacity-0 before:shadow-[0px_0px_0px_13px_transparent] before:content-[''] checked:border-primary checked:bg-primary checked:before:opacity-[0.16] checked:after:absolute checked:after:-mt-px checked:after:ml-[0.25rem] checked:after:block checked:after:h-[0.8125rem] checked:after:w-[0.375rem] checked:after:rotate-45 checked:after:border-[0.125rem] checked:after:border-l-0 checked:after:border-t-0 checked:after:border-solid checked:after:border-white checked:after:bg-transparent checked:after:content-[''] hover:cursor-pointer hover:before:opacity-[0.04] hover:before:shadow-[0px_0px_0px_13px_rgba(0,0,0,0.6)] focus:shadow-none focus:transition-[border-color_0.2s] focus:before:scale-100 focus:before:opacity-[0.12] focus:before:shadow-[0px_0px_0px_13px_rgba(0,0,0,0.6)] focus:before:transition-[box-shadow_0.2s,transform_0.2s] focus:after:absolute focus:after:z-[1] focus:after:block focus:after:h-[0.875rem] focus:after:w-[0.875rem] focus:after:rounded-[0.125rem] focus:after:bg-white focus:after:content-[''] checked:focus:border-primary checked:focus:bg-primary checked:focus:before:scale-100 checked:focus:before:shadow-[0px_0px_0px_13px_#3b71ca] checked:focus:before:transition-[box-shadow_0.2s,transform_0.2s] checked:focus:after:-mt-px checked:focus:after:ml-[0.25rem] checked:focus:after:h-[0.8125rem] checked:focus:after:w-[0.375rem] checked:focus:after:rotate-45 checked:focus:after:rounded-none checked:focus:after:border-[0.125rem] checked:focus:after:border-l-0 checked:focus:after:border-t-0 checked:focus:after:border-solid checked:focus:after:border-white checked:focus:after:bg-transparent"
type="checkbox"
id="automated-rounds-visible-checkbox"
checked={showAutomatedRounds}
onChange={() => setShowAutomatedRounds((s) => !s)}
/>
<label
className="inline-block pl-[0.15rem] hover:cursor-pointer"
htmlFor="automated-rounds-visible-checkbox"
>
Show Automated Rounds
</label>
</div>
</div>
<DailyRoundsList
facilityId={props.facilityId}
patientId={props.patientId}
consultationId={props.consultationId}
consultationData={props.consultationData}
showAutomatedRounds={showAutomatedRounds}
/>
<DailyRoundsList consultation={props.consultationData} />
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import CareIcon from "../../../../CAREUI/icons/CareIcon";
import ButtonV2 from "../../../Common/components/ButtonV2";
import { DailyRoundsModel } from "../../../Patient/models";
import LogUpdateCardAttribute from "./LogUpdateCardAttribute";
import { ConsultationModel } from "../../models";

interface Props {
round: DailyRoundsModel;
consultationData: any;
consultationData: ConsultationModel;
onViewDetails: () => void;
onUpdateLog?: () => void;
}
Expand Down
115 changes: 115 additions & 0 deletions src/Components/Facility/Consultations/DailyRoundsFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { Popover, Transition } from "@headlessui/react";
import ButtonV2 from "../../Common/components/ButtonV2";
import { Fragment } from "react";
import { SelectFormField } from "../../Form/FormFields/SelectFormField";
import TextFormField from "../../Form/FormFields/TextFormField";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import dayjs from "dayjs";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { DailyRoundTypes, DailyRoundsModel } from "../../Patient/models";
import { FieldChangeEvent } from "../../Form/FormFields/Utils";

type FilterState = {
rounds_type?: DailyRoundsModel["rounds_type"];
taken_at_after?: string;
taken_at_before?: string;
};

interface Props {
onApply: (filter: FilterState) => void;
}

export default function DailyRoundsFilter(props: Props) {
const { t } = useTranslation();
const [filter, setFilter] = useState<FilterState>({});

const field = (name: keyof FilterState) => ({
name,
value: filter[name],
onChange: (e: FieldChangeEvent<unknown>) =>
setFilter({ ...filter, [e.name]: e.value }),
labelClassName: "text-sm",
errorClassName: "hidden",
});

return (
<div className="flex flex-row-reverse items-center gap-4 md:flex-row">
<Popover className="relative ">
<Popover.Button>
<ButtonV2 variant="secondary" className="mr-5 border">
<CareIcon className="care-l-filter" />
{t("filter")}
</ButtonV2>
</Popover.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute right-0 z-30 mt-1 w-80 px-4 sm:px-0 md:w-96 lg:max-w-3xl">
<div className="rounded-lg shadow-lg ring-1 ring-gray-400">
<div className="rounded-t-lg bg-gray-100 px-6 py-4">
<div className="flow-root rounded-md">
<span className="block text-sm text-gray-800">
{t("filter_by")}
</span>
</div>
</div>
<div className="relative flex flex-col gap-4 rounded-b-lg bg-white p-6">
<SelectFormField
{...field("rounds_type")}
label={t("Round Type")}
options={DailyRoundTypes}
placeholder={t("show_all")}
optionLabel={(o) => t(o)}
optionValue={(o) => o}
/>
<TextFormField
{...field("taken_at_after")}
label="Measured after"
type="datetime-local"
max={dayjs().format("YYYY-MM-DDTHH:mm")}
/>
<TextFormField
{...field("taken_at_before")}
label="Measured before"
type="datetime-local"
max={dayjs().format("YYYY-MM-DDTHH:mm")}
/>

<Popover.Button>
<ButtonV2
variant="secondary"
onClick={() => {
setFilter({});
props.onApply({});
}}
border
className="w-full"
>
{t("clear")}
</ButtonV2>
</Popover.Button>
<Popover.Button>
<ButtonV2
variant="primary"
onClick={() => props.onApply(filter)}
border
className="w-full"
>
{t("apply")}
</ButtonV2>
</Popover.Button>
</div>
</div>
</Popover.Panel>
</Transition>
</Popover>
</div>
);
}
Loading

0 comments on commit a815eae

Please sign in to comment.