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

Enhancement of Shift patient Tab #9434

Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d2d5ceb
updated shift details page
Mahendar0701 Dec 13, 2024
50c3ef1
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 13, 2024
c3fc321
updated list layout
Mahendar0701 Dec 14, 2024
98d39b0
made responsive shift details
Mahendar0701 Dec 14, 2024
0ec3124
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 14, 2024
4b2deb0
referall letter updated
Mahendar0701 Dec 15, 2024
b65802f
fixing tests
Mahendar0701 Dec 15, 2024
0b1212a
test case
Mahendar0701 Dec 15, 2024
9bc39ca
updated slideover of update shift form
Mahendar0701 Dec 15, 2024
17a96b1
test cases
Mahendar0701 Dec 15, 2024
3ec979f
test cases
Mahendar0701 Dec 15, 2024
034fd4b
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 16, 2024
6f36c6c
resolved merge conflicts
Mahendar0701 Dec 17, 2024
86a9478
added changes
Mahendar0701 Dec 17, 2024
2dd1536
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 17, 2024
1de80d1
adjusted comment section
Mahendar0701 Dec 17, 2024
1b96fde
removed duplicate calls
Mahendar0701 Dec 18, 2024
0925a7f
referral letter routing
Mahendar0701 Dec 18, 2024
2587f6c
cleaned up code and added translations
Mahendar0701 Dec 18, 2024
71eb0d9
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 18, 2024
9c25a28
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 18, 2024
0fb42ee
err
Mahendar0701 Dec 18, 2024
ee891a6
added coderabbit suggestions
Mahendar0701 Dec 18, 2024
54b6539
add
Mahendar0701 Dec 18, 2024
01a8afe
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 19, 2024
1be3159
adjusted badges and comment box size
Mahendar0701 Dec 19, 2024
8a2d36f
Merge branch 'develop' into shift-details-tab-enhancement
nihal467 Dec 20, 2024
208351f
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 20, 2024
6a27045
added some changes
Mahendar0701 Dec 22, 2024
f6e4fe7
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 22, 2024
2b5b39c
Merge branch 'shift-details-tab-enhancement' of https://github.com/Ma…
Mahendar0701 Dec 22, 2024
49ee75f
adjusted buttons in forms
Mahendar0701 Dec 22, 2024
23c3cc9
adjusted buttons in forms
Mahendar0701 Dec 22, 2024
3ffba4d
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 23, 2024
9d26214
resolved conflicts
Mahendar0701 Dec 23, 2024
3b8ac88
Delete vite.config.mts.timestamp-1734609501325-e8cedd0506568.mjs
Mahendar0701 Dec 23, 2024
7c92694
resolved conflicts
Mahendar0701 Dec 23, 2024
14ab311
Merge branch 'shift-details-tab-enhancement' of https://github.com/Ma…
Mahendar0701 Dec 23, 2024
c41876a
updated badges and preview
Mahendar0701 Dec 23, 2024
40a2f1b
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 26, 2024
b47bc71
used useQuery an duseMutation instead
Mahendar0701 Dec 26, 2024
e89cb56
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 26, 2024
78b7dbd
used Button
Mahendar0701 Dec 26, 2024
9859c6f
used Button
Mahendar0701 Dec 26, 2024
c89c6b5
update usequery
Mahendar0701 Dec 28, 2024
3a8a119
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 28, 2024
04852b4
update usequery
Mahendar0701 Dec 28, 2024
9ebd3f3
add shadcn form to shiftcreate
Mahendar0701 Dec 30, 2024
a45707f
Merge branch 'develop' into shift-details-tab-enhancement
Mahendar0701 Dec 30, 2024
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
5 changes: 5 additions & 0 deletions cypress/e2e/patient_spec/PatientConsultationCreation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ describe("Patient Consultation in multiple combination", () => {
cy.clickSubmitButton("Create Consultation");
// Create a shifting request
cy.closeNotification();
// cy.clickSubmitButton("Shift Patient");
cy.get("#shift_create_button", { timeout: 10000 })
.should("be.visible")
.click();

shiftCreation.typeCurrentFacilityPerson("Current Facility Person");
shiftCreation.typeCurrentFacilityPhone("9999999999");
shiftCreation.typeShiftReason("reason for shift");
Expand Down
6 changes: 6 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
"allow_transfer": "Allow Transfer",
"allowed_formats_are": "Allowed formats are",
"already_a_member": "Already a member?",
"ambulance_details": "Ambulance Details",
"ambulance_driver_name": "Name of ambulance driver",
"ambulance_number": "Ambulance No",
"ambulance_phone_number": "Phone number of Ambulance",
Expand Down Expand Up @@ -575,6 +576,7 @@
"csv_file_in_the_specified_format": "Select a CSV file in the specified format",
"current_address": "Current Address",
"current_password": "Current Password",
"current_shifting": "Current Shifting",
"customer_support_email": "Customer Support Email",
"customer_support_name": "Customer Support Name",
"customer_support_number": "Customer support number",
Expand Down Expand Up @@ -773,6 +775,7 @@
"forget_password": "Forgot password?",
"forget_password_instruction": "Enter your username, and if it exists, we will send you a link to reset your password.",
"frequency": "Frequency",
"from": "From",
"from_user": "from User",
"full_name": "Full Name",
"full_screen": "Full Screen",
Expand Down Expand Up @@ -1005,6 +1008,7 @@
"no_beds_available": "No beds available",
"no_changes": "No changes",
"no_changes_made": "No changes made",
"no_comments_available": "No comments available",
"no_consultation_filed": "No consultation filed",
"no_consultation_history": "No consultation history available",
"no_consultation_updates": "No consultation updates",
Expand Down Expand Up @@ -1196,6 +1200,7 @@
"preset_name_placeholder": "Specify an identifiable name for the new preset",
"preset_updated": "Preset updated",
"prev_sessions": "Prev Sessions",
"previous_shifting": "Previous Shifting",
"principal": "Principal",
"principal_diagnosis": "Principal diagnosis",
"print": "Print",
Expand Down Expand Up @@ -1413,6 +1418,7 @@
"third_party_software_licenses": "Third Party Software Licenses",
"title_of_request": "Title of Request",
"titrate_dosage": "Titrate Dosage",
"to": "To",
"to_be_conducted": "To be conducted",
"total_amount": "Total Amount",
"total_beds": "Total Beds",
Expand Down
6 changes: 3 additions & 3 deletions src/CAREUI/interactive/SlideOver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ export default function SlideOver({
className={classNames(
"pointer-events-auto fixed",
directionClasses[slideFrom].stick,
!onlyChild && "md:p-2",
!onlyChild && "md:p-2 ",
)}
>
{onlyChild ? (
children
) : (
<div
className={classNames(
"flex flex-col bg-white md:rounded-xl",
"flex flex-col bg-secondary-100 md:rounded-xl",
directionClasses[slideFrom].proportions,
dialogClass,
)}
Expand All @@ -127,7 +127,7 @@ export default function SlideOver({
</div>
</div>
<div
className="flex-1 overflow-auto p-4"
className="flex-1 overflow-auto p-4 bg-secondary-100"
data-test-id="slide-over-container"
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/CAREUI/misc/PrintPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function PrintPreview(props: Props) {

return (
<Page title={props.title}>
<div className="mx-auto my-8 w-[50rem]">
<div className="mx-auto my-8 max-w-[50rem]">
<div className="top-0 z-20 flex gap-2 bg-secondary-100 px-2 py-4 xl:absolute xl:right-6 xl:top-8 xl:justify-end">
<Button variant="primary" disabled={props.disabled} onClick={print}>
<CareIcon icon="l-print" className="text-lg" />
Expand Down
4 changes: 4 additions & 0 deletions src/Routers/routes/PatientRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { patientTabs } from "@/components/Patient/PatientDetailsTab";
import { PatientHome } from "@/components/Patient/PatientHome";
import PatientNotes from "@/components/Patient/PatientNotes";
import { PatientRegister } from "@/components/Patient/PatientRegister";
import ShiftDetails from "@/components/Shifting/ShiftDetails";

import { AppRoutes } from "@/Routers/AppRouter";

Expand Down Expand Up @@ -39,6 +40,9 @@ const PatientRoutes: AppRoutes = {
facilityId,
patientId,
}) => <PatientNotes patientId={patientId} facilityId={facilityId} />,
"/facility/:facilityId/patient/:patientId/shifting/:shiftId": ({
shiftId,
}) => <ShiftDetails id={shiftId} />,
"/facility/:facilityId/patient/:patientId/files": ({
facilityId,
patientId,
Expand Down
9 changes: 2 additions & 7 deletions src/Routers/routes/ShiftingRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Redirect } from "raviger";

import { ShiftCreate } from "@/components/Patient/ShiftCreate";
import { ReferralLetter } from "@/components/Shifting/ReferralLetter";
import ShiftDetails from "@/components/Shifting/ShiftDetails";
import { ShiftDetailsUpdate } from "@/components/Shifting/ShiftDetailsUpdate";
import BoardView from "@/components/Shifting/ShiftingBoard";
import ListView from "@/components/Shifting/ShiftingList";

Expand All @@ -16,11 +15,7 @@ const ShiftingRoutes: AppRoutes = {
"/shifting/board": () => <BoardView />,
"/shifting/list": () => <ListView />,
"/shifting/:id": ({ id }) => <ShiftDetails id={id} />,
"/shifting/:id/update": ({ id }) => <ShiftDetailsUpdate id={id} />,
"/facility/:facilityId/patient/:patientId/shift/new": ({
facilityId,
patientId,
}) => <ShiftCreate facilityId={facilityId} patientId={patientId} />,
"/shifting/:id/referral-letter": ({ id }) => <ReferralLetter id={id} />,
};

export default ShiftingRoutes;
4 changes: 3 additions & 1 deletion src/components/Common/AuthorizedButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Button, ButtonProps } from "@headlessui/react";
import * as React from "react";

import AuthorizedChild from "@/CAREUI/misc/AuthorizedChild";

import { Button, ButtonProps } from "@/components/ui/button";

import { AuthorizedElementProps } from "@/Utils/AuthorizeFor";

export const AuthorizedButton: React.FC<
Expand Down
2 changes: 1 addition & 1 deletion src/components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
);

if (data.suggestion === "R") {
navigate(`/facility/${facilityId}/patient/${patientId}/shift/new`);
navigate(`/facility/${facilityId}/patient/${patientId}/shifting/`);
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
return;
} else if (!id && data.suggestion === "A") {
navigate(
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/FormFields/PhoneNumberFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const PhoneNumberFormField = React.forwardRef<HTMLInputElement, Props>(
return (
<>
<PopoverButton className="absolute h-full">
<div className="hover:border-1 absolute inset-y-0 left-0 flex cursor-pointer items-center justify-around border-gray-200 hover:border hover:bg-gray-50">
<div className="hover:border-1 absolute border-l rounded bg-secondary-200 border-y inset-y-0 left-0 flex cursor-pointer items-center justify-around border-gray-200 hover:border hover:bg-secondary-300">
<span className="rounded-md pl-2">{country?.flag}</span>
<CareIcon
icon="l-angle-down"
Expand Down
73 changes: 59 additions & 14 deletions src/components/Patient/PatientDetailsTab/ShiftingHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { navigate } from "raviger";
import { useState } from "react";
import { useTranslation } from "react-i18next";

import CareIcon from "@/CAREUI/icons/CareIcon";

import ButtonV2 from "@/components/Common/ButtonV2";
import { AuthorizedButton } from "@/components/Common/AuthorizedButton";
import { PatientProps } from "@/components/Patient/PatientDetailsTab";
import { ShiftCreate } from "@/components/Patient/ShiftCreate";
import { PatientModel } from "@/components/Patient/models";
import { formatFilter } from "@/components/Resource/ResourceCommons";
import ShiftingTable from "@/components/Shifting/ShiftingTable";
Expand All @@ -18,6 +19,8 @@ import useTanStackQueryInstead from "@/Utils/request/useQuery";
const ShiftingHistory = (props: PatientProps) => {
const { patientData, facilityId, id } = props;
const { t } = useTranslation();
const [isSlideOverOpen, setIsSlideOverOpen] = useState(false);
const [activeTab, setActiveTab] = useState("current");
const { qParams, Pagination, resultsPerPage } = useFilters({
cacheBlacklist: ["patient_name"],
});
Expand All @@ -43,31 +46,73 @@ const ShiftingHistory = (props: PatientProps) => {
},
);

const CURRENT_STATUSES = [
"APPROVED",
"DESTINATION APPROVED",
"PATIENT TO BE PICKED UP",
"TRANSFER IN PROGRESS",
];
const PREVIOUS_STATUSES = ["COMPLETED", "PATIENT EXPIRED", "CANCELLED"];

const filteredShiftData = shiftData?.results
? activeTab === "current"
? shiftData.results.filter((shift) =>
CURRENT_STATUSES.includes(shift.status),
)
: shiftData.results.filter((shift) =>
PREVIOUS_STATUSES.includes(shift.status),
)
: [];
return (
<section className="mt-4">
<div className="flex justify-between items-center">
<h2 className="my-4 ml-0 text-2xl font-semibold leading-tight">
{t("shifting_history")}
</h2>
<ButtonV2
className=""
<div className="flex mb-4 bg-gray-100 text-sm w-fit rounded-lg px-1 py-1">
<button
className={`px-3 py-2 ${
activeTab === "current"
? "bg-white rounded-lg font-semibold shadow"
: ""
}`}
onClick={() => setActiveTab("current")}
>
{t("current_shifting")}
</button>
<button
className={`px-3 py-2 ${
activeTab === "previous"
? "bg-white rounded-lg font-semibold shadow"
: ""
}`}
onClick={() => setActiveTab("previous")}
>
{t("previous_shifting")}
</button>
</div>
<AuthorizedButton
Mahendar0701 marked this conversation as resolved.
Show resolved Hide resolved
id="shift_create_button"
variant="outline_primary"
disabled={isPatientInactive(patientData, facilityId)}
size="default"
onClick={() =>
navigate(`/facility/${facilityId}/patient/${id}/shift/new`)
}
onClick={() => setIsSlideOverOpen(true)}
authorizeFor={NonReadOnlyUsers}
>
<span className="flex w-full items-center justify-start gap-2">
<CareIcon icon="l-ambulance" className="text-xl" />
{t("shift")}
</span>
</ButtonV2>
</AuthorizedButton>
<ShiftCreate
facilityId={facilityId}
patientId={id}
open={isSlideOverOpen}
setOpen={setIsSlideOverOpen}
/>
</div>
<ShiftingTable hidePatient data={shiftData?.results} loading={loading} />

<ShiftingTable hidePatient data={filteredShiftData} loading={loading} />
<div>
<Pagination totalCount={shiftData?.count || 0} />
</div>{" "}
<Pagination totalCount={filteredShiftData?.length || 0} />
</div>
</section>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientDetailsTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const patientTabs = [
component: ImmunisationRecords,
},
{
route: "shift",
route: "shifting",
component: ShiftingHistory,
},
{
Expand Down
Loading
Loading