-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Insurance Details Page (#6595)
* Implemented Insurance Details Page * implemented insurace details card
- Loading branch information
1 parent
91af0d6
commit db03a61
Showing
6 changed files
with
167 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { lazy } from "react"; | ||
|
||
import Page from "../Common/components/Page"; | ||
|
||
import useQuery from "../../Utils/request/useQuery"; | ||
import routes from "../../Redux/api"; | ||
import { HCXPolicyModel } from "../HCX/models"; | ||
import { InsuranceDetialsCard } from "./InsuranceDetailsCard"; | ||
|
||
const Loading = lazy(() => import("../Common/Loading")); | ||
|
||
interface IProps { | ||
facilityId: string; | ||
id: string; | ||
} | ||
|
||
export const InsuranceDetails = (props: IProps) => { | ||
const { facilityId, id } = props; | ||
|
||
const { data: insuranceDetials, loading } = useQuery(routes.listHCXPolicies, { | ||
query: { | ||
patient: id, | ||
}, | ||
}); | ||
|
||
if (loading) { | ||
return <Loading />; | ||
} | ||
|
||
return ( | ||
<Page | ||
title="Insurance Details" | ||
crumbsReplacements={{ | ||
[facilityId]: { | ||
name: insuranceDetials?.results[0]?.patient_object?.facility_object | ||
?.name, | ||
}, | ||
[id]: { | ||
name: insuranceDetials?.results[0]?.patient_object?.name, | ||
}, | ||
}} | ||
className="w-full overflow-x-hidden" | ||
> | ||
{loading ? ( | ||
<Loading /> | ||
) : insuranceDetials?.count === 0 ? ( | ||
<div className="mt-5 flex w-full items-center justify-center text-xl font-bold text-gray-500"> | ||
No Insurance Details Available | ||
</div> | ||
) : ( | ||
<section | ||
className="mt-5 grid grid-cols-1 gap-6 lg:grid-cols-3" | ||
data-testid="patient-details" | ||
> | ||
{insuranceDetials?.results.map((data: HCXPolicyModel) => ( | ||
<InsuranceDetialsCard data={data} /> | ||
))} | ||
</section> | ||
)} | ||
</Page> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import ButtonV2 from "../Common/components/ButtonV2"; | ||
import { HCXPolicyModel } from "../HCX/models"; | ||
import { navigate } from "raviger"; | ||
|
||
interface InsuranceDetails { | ||
data?: HCXPolicyModel; | ||
showViewAllDetails?: boolean; | ||
} | ||
|
||
export const InsuranceDetialsCard = (props: InsuranceDetails) => { | ||
const { data, showViewAllDetails } = props; | ||
|
||
return ( | ||
<div className="w-full"> | ||
<div className="h-full space-y-2 rounded-lg bg-white p-7 shadow"> | ||
<div className="border-b border-dashed pb-2 text-xl font-bold text-gray-900"> | ||
Policy Details | ||
</div> | ||
{data ? ( | ||
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-2"> | ||
<div className=" "> | ||
<div className="text-sm font-semibold leading-5 text-zinc-400"> | ||
Member ID | ||
</div> | ||
<div className="mt-1 whitespace-normal break-words text-sm font-medium leading-5"> | ||
{data.subscriber_id || ""} | ||
</div> | ||
</div> | ||
<div className=" "> | ||
<div className="text-sm font-semibold leading-5 text-zinc-400"> | ||
Policy ID / Policy Name | ||
</div> | ||
<div className="mt-1 whitespace-normal break-words text-sm font-medium leading-5"> | ||
{data.policy_id || ""} | ||
</div> | ||
</div> | ||
<div className="sm:col-span-1"> | ||
<div className="text-sm font-semibold leading-5 text-zinc-400"> | ||
Insurer ID | ||
</div> | ||
<div className="mt-1 whitespace-normal break-words text-sm font-medium leading-5"> | ||
{data.insurer_id || ""} | ||
</div> | ||
</div> | ||
<div className="sm:col-span-1"> | ||
<div className="text-sm font-semibold leading-5 text-zinc-400"> | ||
Insurer Name | ||
</div> | ||
<div className="mt-1 whitespace-normal break-words text-sm font-medium leading-5"> | ||
{data.insurer_name || ""} | ||
</div> | ||
</div> | ||
{showViewAllDetails && ( | ||
<div className=" first-letter: sm:col-span-2 md:ml-auto md:mt-10 "> | ||
<div className=" mt-1 whitespace-normal break-words text-sm font-medium leading-5"> | ||
<ButtonV2 | ||
onClick={() => { | ||
navigate( | ||
`/facility/${data.patient_object?.facility_object?.id}/patient/${data.patient_object?.id}/insurance` | ||
); | ||
}} | ||
className="h-auto whitespace-pre-wrap border border-gray-500 bg-white text-black hover:bg-gray-300" | ||
> | ||
View All Details | ||
</ButtonV2> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
) : ( | ||
<div className="flex w-full items-center justify-center text-xl font-bold text-gray-500"> | ||
No Insurance Details Available | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters