Skip to content

Commit

Permalink
Merge pull request #8269 from coronasafe/develop
Browse files Browse the repository at this point in the history
Merge Develop to Staging v24.33.0
  • Loading branch information
khavinshankar authored Aug 8, 2024
2 parents 94c877c + caa411d commit b4502f7
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
stale-issue-message: "Hi, @coronasafe/care-frontend-maintainers, This issue has been automatically marked as stale because it has not had any recent activity."
stale-pr-message: "Hi, This pr has been automatically marked as stale because it has not had any recent activity. It will be automatically closed if no further activity occurs for 7 more days. Thank you for your contributions."
close-pr-message: "Hi, @coronasafe/care-frontend-maintainers, This PR has been automatically closed due to inactivity. Thank you for your contributions. Feel free to re-open the PR."
exempt-issue-labels: "blocked,waiting for related PR,waiting for back end,help wanted,work-in-progress,In Progress,wishlist,EPIC"
exempt-pr-labels: "tested,needs testing,need Review,waiting for related PR,waiting for back end,help wanted,blocked,work-in-progress,In Progress"
exempt-issue-labels: "blocked,waiting for related PR,waiting for back end,help wanted,work-in-progress,In Progress,wishlist,EPIC,backlog"
exempt-pr-labels: "tested,needs testing,need Review,waiting for related PR,waiting for back end,help wanted,blocked,work-in-progress,In Progress,backlog"
days-before-issue-stale: 14
days-before-pr-stale: 7
days-before-issue-close: -1
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PatientLogupdate {
}

selectPatientCategory(category: string) {
cy.clickAndSelectOption("#patient_category", category);
cy.clickAndSelectOption("#patientCategory", category);
}

typePhysicalExamination(examination: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/DateInputV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const DateInputV2: React.FC<Props> = ({
type="text"
readOnly
disabled={disabled}
className={`cui-input-base cursor-pointer !px-2 disabled:cursor-not-allowed ${className}`}
className={`cui-input-base cursor-pointer disabled:cursor-not-allowed ${className}`}
placeholder={placeholder ?? t("select_date")}
value={value && dayjs(value).format("DD/MM/YYYY")}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
return;
}

const preset = data.results.find(
const presets = data.results.filter(
(obj) =>
obj.asset_object.meta?.asset_type === "CAMERA" &&
obj.meta.type !== "boundary",
);

const lastPresetId = sessionStorage.getItem(
getFeedPresetKey(props.consultationId),
);
const preset =
presets.find((obj) => obj.id === lastPresetId) ?? presets[0];

if (preset) {
setPreset(preset);
setAsset(preset.asset_object);
Expand Down Expand Up @@ -105,6 +111,13 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
}
}, [!!bed, loading, !!asset, divRef.current]);

useEffect(() => {
const feedPresetKey = getFeedPresetKey(props.consultationId);
if (preset) {
sessionStorage.setItem(feedPresetKey, preset.id);
}
}, [preset, props.consultationId]);

if (loading) {
return <Loading />;
}
Expand Down Expand Up @@ -167,7 +180,14 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
result: "success",
});
setHasMoved(false);
setPreset(value);
// Voluntarily copying to trigger change of reference of the position attribute, so that the useEffect of CameraFeed that handles the moves gets triggered.
setPreset({
...value,
meta: {
...value.meta,
position: { ...value.meta.position },
},
});
}}
/>
{isUpdatingPreset ? (
Expand Down Expand Up @@ -205,3 +225,7 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
</>
);
};

const getFeedPresetKey = (consultationId: string) => {
return `encounterFeedPreset[${consultationId}]`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -555,24 +555,35 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
<div id="patient-weight">
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
{props.consultationData.weight
? `${props.consultationData.weight} kg`
: "Unspecified"}
</span>
</div>
<div id="patient-height">
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
{props.consultationData.height
? `${props.consultationData.height} cm`
: "Unspecified"}
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600,
).toFixed(2)}{" "}
m<sup>2</sup>
<span className="font-semibold ">
{props.consultationData.weight &&
props.consultationData.height ? (
<>
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
</>
) : (
"Unspecified"
)}
</span>
</div>
<div>
Expand Down
22 changes: 14 additions & 8 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
admitted: data.admitted ? String(data.admitted) : "false",
admitted_to: data.admitted_to ? data.admitted_to : "",
category: data.category
? (PATIENT_CATEGORIES.find((i) => i.text === data.category)?.id ??
"")
? PATIENT_CATEGORIES.find((i) => i.text === data.category)?.id ??
""
: "",
patient_no: data.patient_no ?? "",
OPconsultation: data.consultation_notes,
Expand Down Expand Up @@ -1084,12 +1084,18 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
<div className="flex items-center justify-between">
<FieldLabel>Body Surface Area</FieldLabel>
<span className="mb-2 text-sm font-medium text-black">
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
{state.form.weight && state.form.height ? (
<>
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600,
).toFixed(2)}
m<sup>2</sup>
</>
) : (
"Not specified"
)}
</span>
</div>

Expand Down
13 changes: 9 additions & 4 deletions src/Components/Facility/DoctorVideoSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SlideOver from "../../CAREUI/interactive/SlideOver";
import { UserAssignedModel } from "../Users/models";
import { SkillObjectModel } from "../Users/models";
import CareIcon, { IconName } from "../../CAREUI/icons/CareIcon";
import { classNames, relativeTime } from "../../Utils/utils";
import { classNames, isUserOnline, relativeTime } from "../../Utils/utils";
import useAuthUser from "../../Common/hooks/useAuthUser";
import { triggerGoal } from "../../Integrations/Plausible";
import { Warn } from "../../Utils/Notifications";
Expand Down Expand Up @@ -241,9 +241,14 @@ function UserListItem({ user }: { user: UserAnnotatedWithGroup }) {
<div className="flex flex-none items-center justify-center sm:h-6 sm:w-6 md:h-10 md:w-10">
{
// Show online icon based on last_login
user.last_login &&
Number(new Date()) - Number(new Date(user.last_login)) < 60000 ? (
<CareIcon icon={icon} className="text-xl text-green-600" />
user.last_login && isUserOnline(user) ? (
<>
<CareIcon icon={icon} className="text-xl text-green-600" />
<span
className="relative top-2 h-3 w-3 rounded-full bg-primary-500"
aria-label="Online"
/>
</>
) : (
<CareIcon icon={icon} className="text-2xl text-secondary-600" />
)
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Facility/DuplicatePatientDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ interface Props {
patientList: Array<DupPatientModel>;
handleOk: (action: string) => void;
handleCancel: () => void;
isNew: boolean;
}

const tdClass = "border border-secondary-400 p-2 text-left";

const DuplicatePatientDialog = (props: Props) => {
const { patientList, handleOk, handleCancel, isNew } = props;
const { patientList, handleOk, handleCancel } = props;
const [action, setAction] = useState("");

return (
Expand Down Expand Up @@ -118,7 +117,7 @@ const DuplicatePatientDialog = (props: Props) => {
<Cancel
onClick={handleCancel}
className="mb-2 sm:mb-0"
label={`Cancel ${isNew ? "Registration" : "Update"}`}
label={"Close"}
/>
<Submit
id="submit-continue-button"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Medicine/ManagePrescriptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ManagePrescriptions() {
return (
<Page title={t("manage_prescriptions")}>
<div
className="mx-auto flex w-full max-w-4xl flex-col gap-10 rounded bg-white p-6 transition-all sm:rounded-xl sm:p-12"
className="mx-auto flex w-full max-w-5xl flex-col gap-10 rounded bg-white p-6 transition-all sm:rounded-xl sm:p-12"
id="medicine-preview"
>
<div className="flex flex-col gap-10 divide-y-2 divide-dashed divide-secondary-600">
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Medicine/PrescriptionDetailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,19 +178,19 @@ export default function PrescriptionDetailCard({
{prescription.dosage_type === "PRN" ? (
<>
<Detail
className="col-span-10 md:col-span-6"
className="col-span-10 md:col-span-4"
label={t("indicator")}
>
{prescription.indicator}
</Detail>
<Detail
className="col-span-10 md:col-span-2"
className="col-span-10 md:col-span-3"
label={t("max_dosage_24_hrs")}
>
{prescription.max_dosage}
</Detail>
<Detail
className="col-span-10 md:col-span-2"
className="col-span-10 md:col-span-3"
label={t("min_time_bw_doses")}
>
{prescription.min_hours_between_doses &&
Expand Down
6 changes: 5 additions & 1 deletion src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { EncounterSymptomsBuilder } from "../Symptoms/SymptomsBuilder";
import { FieldLabel } from "../Form/FormFields/FormField";
import useAuthUser from "../../Common/hooks/useAuthUser";
import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
import { scrollTo } from "../../Utils/utils";

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

Expand Down Expand Up @@ -231,13 +232,15 @@ export const DailyRounds = (props: any) => {
if (!state.form[field]) {
errors[field] = "Please select a category";
invalidForm = true;
scrollTo("patientCategory");
}
return;
case "bp": {
const error = BloodPressureValidator(state.form.bp);
if (error) {
errors.bp = error;
invalidForm = true;
scrollTo("bloodPressure");
}
return;
}
Expand Down Expand Up @@ -524,6 +527,7 @@ export const DailyRounds = (props: any) => {
{...field("patient_category")}
required
label="Category"
id="patientCategory"
/>
</div>
</div>
Expand Down Expand Up @@ -589,7 +593,7 @@ export const DailyRounds = (props: any) => {
<>
<h3 className="mb-6 md:col-span-2">Vitals</h3>

<BloodPressureFormField {...field("bp")} label="Blood Pressure" />
<BloodPressureFormField {...field("bp")} label="Blood Pressure" id="bloodPressure" />

<RangeAutocompleteFormField
{...field("pulse")}
Expand Down
24 changes: 20 additions & 4 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
});
const [careExtId, setCareExtId] = useState("");
const [formField, setFormField] = useState<any>();
const [resetNum, setResetNum] = useState(false);
const [isDistrictLoading, setIsDistrictLoading] = useState(false);
const [isLocalbodyLoading, setIsLocalbodyLoading] = useState(false);
const [isWardLoading, setIsWardLoading] = useState(false);
Expand Down Expand Up @@ -1003,21 +1004,29 @@ export const PatientRegister = (props: PatientRegisterProps) => {
<DuplicatePatientDialog
patientList={statusDialog.patientList}
handleOk={handleDialogClose}
handleCancel={goBack}
isNew={!id}
handleCancel={() => {
handleDialogClose("close");
setResetNum(true);
}}
/>
)}
{statusDialog.transfer && (
<DialogModal
show={statusDialog.transfer}
onClose={() => handleDialogClose("back")}
onClose={() => {
setResetNum(true);
handleDialogClose("close");
}}
title="Patient Transfer Form"
className="max-w-md md:min-w-[600px]"
>
<TransferPatientDialog
patientList={statusDialog.patientList}
handleOk={() => handleDialogClose("close")}
handleCancel={() => handleDialogClose("back")}
handleCancel={() => {
setResetNum(true);
handleDialogClose("close");
}}
facilityId={facilityId}
/>
</DialogModal>
Expand Down Expand Up @@ -1134,6 +1143,13 @@ export const PatientRegister = (props: PatientRegisterProps) => {
>
{(field) => {
if (!formField) setFormField(field);
if (resetNum) {
field("phone_number").onChange({
name: "phone_number",
value: "+91",
});
setResetNum(false);
}
return (
<>
<div className="mb-2 overflow-visible rounded border border-secondary-200 p-4">
Expand Down

0 comments on commit b4502f7

Please sign in to comment.