diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 0f588568bbc..1104d7f480d 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -1,8 +1,6 @@ name: Cypress Tests on: - schedule: - - cron: "30 22 * * *" pull_request: branches: - develop @@ -17,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - containers: [1, 2, 3, 4, 5, 6, 7, 8] + containers: [1, 2, 3, 4] env: REACT_CARE_API_URL: http://localhost:9000 steps: @@ -136,4 +134,4 @@ jobs: if: steps.pr_origin.outputs.is_forked == 'true' with: name: cypress-videos - path: cypress/videos + path: cypress/videos \ No newline at end of file diff --git a/cypress/pageobject/Users/UserSearch.ts b/cypress/pageobject/Users/UserSearch.ts index d72c00c0de7..1292395fce3 100644 --- a/cypress/pageobject/Users/UserSearch.ts +++ b/cypress/pageobject/Users/UserSearch.ts @@ -23,7 +23,7 @@ export class UserPage { } checkUsernameText(username: string) { - cy.get(this.usernameText).should("have.text", username); + cy.get(this.usernameText).should("contain.text", username); } checkUsernameBadgeVisibility(shouldBeVisible: boolean) { diff --git a/src/CAREUI/display/Timeline.tsx b/src/CAREUI/display/Timeline.tsx index eb5f4c56ae5..aa3fd06e7de 100644 --- a/src/CAREUI/display/Timeline.tsx +++ b/src/CAREUI/display/Timeline.tsx @@ -1,14 +1,15 @@ -import { createContext, useContext } from "react"; -import { useTranslation } from "react-i18next"; -import { PerformedByModel } from "@/components/HCX/misc"; -import { classNames, formatName } from "../../Utils/utils"; import CareIcon, { IconName } from "../icons/CareIcon"; +import { classNames, formatName } from "../../Utils/utils"; +import { createContext, useContext } from "react"; + import RecordMeta from "./RecordMeta"; +import { UserBareMinimum } from "@/components/Users/models"; +import { useTranslation } from "react-i18next"; export interface TimelineEvent { type: TType; timestamp: string; - by: PerformedByModel | undefined; + by: UserBareMinimum | undefined; icon: IconName; iconStyle?: string; iconWrapperStyle?: string; diff --git a/src/PluginEngine.tsx b/src/PluginEngine.tsx index 43b8e558f8f..a56fe21b5b8 100644 --- a/src/PluginEngine.tsx +++ b/src/PluginEngine.tsx @@ -1,8 +1,8 @@ +import { CareAppsContext, useCareApps } from "@/common/hooks/useCareApps"; /* eslint-disable i18next/no-literal-string */ import React, { Suspense } from "react"; -import { CareAppsContext, useCareApps } from "@/common/hooks/useCareApps"; -import { pluginMap } from "./pluginTypes"; -import { UserAssignedModel } from "@/components/Users/models"; +import { SupportedPluginComponents, pluginMap } from "./pluginTypes"; + import ErrorBoundary from "@/components/Common/ErrorBoundary"; export default function PluginEngine({ @@ -27,25 +27,28 @@ export default function PluginEngine({ ); } -export function PLUGIN_DoctorConnectButtons({ - user, -}: { - user: UserAssignedModel; -}) { +type PluginProps = + React.ComponentProps; + +export function PLUGIN_Component({ + __name, + ...props +}: { __name: K } & PluginProps) { const plugins = useCareApps(); + return ( -
- {plugins.map((plugin, index) => { - const DoctorConnectButtons = plugin.components.DoctorConnectButtons; - if (!DoctorConnectButtons) { + <> + {plugins.map((plugin) => { + const Component = plugin.components[ + __name + ] as React.ComponentType; + + if (!Component) { return null; } - return ( -
- -
- ); + + return ; })} -
+ ); } diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index adb0f98a7b2..a2794e35203 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -72,11 +72,7 @@ import { NotificationData, PNconfigData, } from "@/components/Notifications/models"; -import { - HCXClaimModel, - HCXCommunicationModel, - HCXPolicyModel, -} from "@/components/HCX/models"; +import { HCXPolicyModel } from "@/components/HCX/models"; import { ICD11DiagnosisModel } from "@/components/Diagnosis/types"; import { Investigation } from "@/components/Facility/Investigations/Reports/types"; import { PaginatedResponse } from "../Utils/request/types"; @@ -104,7 +100,6 @@ import { IHealthFacility, IpartialUpdateHealthFacilityTBody, } from "@/components/ABDM/types/health-facility"; -import { PMJAYPackageItem } from "@/components/Common/PMJAYProcedurePackageAutocomplete"; import { InsurerOptionModel } from "@/components/HCX/InsurerAutocomplete"; /** @@ -1696,117 +1691,6 @@ const routes = { TRes: Type(), }, }, - - claims: { - list: { - path: "/api/hcx/claim/", - method: "GET", - TRes: Type>(), - }, - - create: { - path: "/api/hcx/claim/", - method: "POST", - TBody: Type<{ - policy: string; - items: { - id: string; - price: number; - category?: string; - name: string; - }[]; - consultation: string; - use: "preauthorization" | "claim"; - }>(), - TRes: Type(), - }, - - get: { - path: "/api/hcx/claim/{external_id}/", - method: "GET", - }, - - update: { - path: "/api/hcx/claim/{external_id}/", - method: "PUT", - }, - - partialUpdate: { - path: "/api/hcx/claim/{external_id}/", - method: "PATCH", - }, - - delete: { - path: "/api/hcx/claim/{external_id}/", - method: "DELETE", - }, - - listPMJYPackages: { - path: "/api/hcx/pmjy_packages/", - method: "GET", - TRes: Type(), - }, - - makeClaim: { - path: "/api/hcx/make_claim/", - method: "POST", - TBody: Type<{ claim: string }>(), - TRes: Type(), - }, - }, - - communications: { - list: { - path: "/api/hcx/communication/", - method: "GET", - TRes: Type>(), - }, - - create: { - path: "/api/hcx/communication/", - method: "POST", - TRes: Type(), - TBody: Type<{ - claim: string; - content: { - type: string; - data: string; - }[]; - }>(), - }, - - get: { - path: "/api/hcx/communication/{external_id}/", - method: "GET", - TRes: Type(), - }, - - update: { - path: "/api/hcx/communication/{external_id}/", - method: "PUT", - TRes: Type(), - }, - - partialUpdate: { - path: "/api/hcx/communication/{external_id}/", - method: "PATCH", - TRes: Type(), - }, - - delete: { - path: "/api/hcx/communication/{external_id}/", - method: "DELETE", - }, - - send: { - path: "/api/hcx/send_communication/", - method: "POST", - TRes: Type(), - TBody: Type<{ - communication: string; - }>(), - }, - }, }, } as const; diff --git a/src/Routers/AppRouter.tsx b/src/Routers/AppRouter.tsx index 5a7b2cbb312..7275c7c2860 100644 --- a/src/Routers/AppRouter.tsx +++ b/src/Routers/AppRouter.tsx @@ -1,32 +1,30 @@ -import { useRedirect, useRoutes, usePath, Redirect } from "raviger"; -import { useState, useEffect } from "react"; - -import ShowPushNotification from "@/components/Notifications/ShowPushNotification"; -import { NoticeBoard } from "@/components/Notifications/NoticeBoard"; -import Error404 from "@/components/ErrorPages/404"; import { DesktopSidebar, MobileSidebar, SIDEBAR_SHRINK_PREFERENCE_KEY, SidebarShrinkContext, } from "@/components/Common/Sidebar/Sidebar"; +import { Redirect, usePath, useRedirect, useRoutes } from "raviger"; +import { useEffect, useState } from "react"; + +import ABDMFacilityRecords from "@/components/ABDM/ABDMFacilityRecords"; +import AssetRoutes from "./routes/AssetRoutes"; import { BLACKLISTED_PATHS } from "@/common/constants"; -import SessionExpired from "@/components/ErrorPages/SessionExpired"; +import ConsultationRoutes from "./routes/ConsultationRoutes"; +import Error404 from "@/components/ErrorPages/404"; +import FacilityRoutes from "./routes/FacilityRoutes"; import HealthInformation from "@/components/ABDM/HealthInformation"; -import ABDMFacilityRecords from "@/components/ABDM/ABDMFacilityRecords"; - -import UserRoutes from "./routes/UserRoutes"; +import IconIndex from "../CAREUI/icons/Index"; +import { NoticeBoard } from "@/components/Notifications/NoticeBoard"; import PatientRoutes from "./routes/PatientRoutes"; +import ResourceRoutes from "./routes/ResourceRoutes"; import SampleRoutes from "./routes/SampleRoutes"; -import FacilityRoutes from "./routes/FacilityRoutes"; -import ConsultationRoutes from "./routes/ConsultationRoutes"; -import HCXRoutes from "./routes/HCXRoutes"; +import SessionExpired from "@/components/ErrorPages/SessionExpired"; import ShiftingRoutes from "./routes/ShiftingRoutes"; -import AssetRoutes from "./routes/AssetRoutes"; -import ResourceRoutes from "./routes/ResourceRoutes"; -import { usePluginRoutes } from "@/common/hooks/useCareApps"; +import ShowPushNotification from "@/components/Notifications/ShowPushNotification"; +import UserRoutes from "./routes/UserRoutes"; import careConfig from "@careConfig"; -import IconIndex from "../CAREUI/icons/Index"; +import { usePluginRoutes } from "@/common/hooks/useCareApps"; export type RouteParams = T extends `${string}:${infer Param}/${infer Rest}` @@ -78,16 +76,12 @@ export default function AppRouter() { let routes = Routes; - if (careConfig.hcx.enabled) { - routes = { ...HCXRoutes, ...routes }; - } - useRedirect("/user", "/users"); // Merge in Plugin Routes routes = { - ...routes, ...pluginRoutes, + ...routes, }; const pages = useRoutes(routes) || ; diff --git a/src/Routers/routes/HCXRoutes.tsx b/src/Routers/routes/HCXRoutes.tsx deleted file mode 100644 index 00339161a24..00000000000 --- a/src/Routers/routes/HCXRoutes.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import ConsultationClaims from "@/components/Facility/ConsultationClaims"; -import { AppRoutes } from "../AppRouter"; - -const HCXRoutes: AppRoutes = { - "/facility/:facilityId/patient/:patientId/consultation/:consultationId/claims": - ({ facilityId, patientId, consultationId }) => ( - - ), -}; - -export default HCXRoutes; diff --git a/src/Utils/types.ts b/src/Utils/types.ts index 5ac29c5862c..71ddd41330e 100644 --- a/src/Utils/types.ts +++ b/src/Utils/types.ts @@ -1,11 +1,11 @@ -import { PerformedByModel } from "@/components/HCX/misc"; +import { UserBareMinimum } from "@/components/Users/models"; export interface BaseModel { readonly id: string; readonly modified_date: string; readonly created_date: string; - readonly created_by: PerformedByModel; - readonly updated_by: PerformedByModel; + readonly created_by: UserBareMinimum; + readonly updated_by: UserBareMinimum; } export type Writable = { diff --git a/src/components/Assets/AssetManage.tsx b/src/components/Assets/AssetManage.tsx index 05eab3a4dec..0ee4f107d40 100644 --- a/src/components/Assets/AssetManage.tsx +++ b/src/components/Assets/AssetManage.tsx @@ -432,7 +432,7 @@ const AssetManage = (props: AssetManageProps) => { data-testid="asset-update-button" authorizeFor={NonReadOnlyUsers} > - + {t("update")} {asset?.asset_class && @@ -449,7 +449,7 @@ const AssetManage = (props: AssetManageProps) => { id="configure-asset" data-testid="asset-configure-button" > - + {t("configure")} )} @@ -459,10 +459,9 @@ const AssetManage = (props: AssetManageProps) => { onClick={() => setShowDeleteDialog(true)} variant="danger" data-testid="asset-delete-button" - className="inline-flex" > - - {t("delete")} + + {t("delete")} )} diff --git a/src/components/Assets/AssetTypes.tsx b/src/components/Assets/AssetTypes.tsx index 2f8e086a813..24f3f3e9352 100644 --- a/src/components/Assets/AssetTypes.tsx +++ b/src/components/Assets/AssetTypes.tsx @@ -1,7 +1,7 @@ -import { IconName } from "../../CAREUI/icons/CareIcon"; import { BedModel } from "../Facility/models"; -import { PerformedByModel } from "../HCX/misc"; +import { IconName } from "../../CAREUI/icons/CareIcon"; import { PatientModel } from "../Patient/models"; +import { UserBareMinimum } from "@/components/Users/models"; export enum AssetLocationType { OTHER = "OTHER", @@ -169,7 +169,7 @@ export interface AssetServiceEdit { serviced_on: string; note: string; edited_on: string; - edited_by: PerformedByModel; + edited_by: UserBareMinimum; } export interface AssetService { id: string; diff --git a/src/components/CameraFeed/ConfigureCamera.tsx b/src/components/CameraFeed/ConfigureCamera.tsx index 03b627d48ce..c0cb19e6a23 100644 --- a/src/components/CameraFeed/ConfigureCamera.tsx +++ b/src/components/CameraFeed/ConfigureCamera.tsx @@ -391,14 +391,22 @@ export default function ConfigureCamera(props: Props) { > setPresetName(value)} errorClassName="hidden" placeholder={t("preset_name_placeholder")} suggestions={presetNameSuggestions} + clearable={true} /> +
+ { + setCreatePreset(undefined); + setPresetName(""); + }} + /> { const { res } = await request(FeedRoutes.createPreset, { diff --git a/src/components/CameraFeed/routes.ts b/src/components/CameraFeed/routes.ts index db983d6a383..bffcb0fc9b0 100644 --- a/src/components/CameraFeed/routes.ts +++ b/src/components/CameraFeed/routes.ts @@ -1,9 +1,10 @@ -import { Type } from "../../Redux/api"; +import { OperationAction, PTZPayload } from "./useOperateCamera"; + +import { AssetBedModel } from "../Assets/AssetTypes"; import { PaginatedResponse } from "../../Utils/request/types"; +import { Type } from "../../Redux/api"; +import { UserBareMinimum } from "@/components/Users/models"; import { WritableOnly } from "../../Utils/types"; -import { AssetBedModel } from "../Assets/AssetTypes"; -import { PerformedByModel } from "../HCX/misc"; -import { OperationAction, PTZPayload } from "./useOperateCamera"; export type GetStatusResponse = { result: { @@ -32,8 +33,8 @@ export type CameraPreset = { name: string; readonly asset_bed: AssetBedModel; position: PTZPayload; - readonly created_by: PerformedByModel; - readonly updated_by: PerformedByModel; + readonly created_by: UserBareMinimum; + readonly updated_by: UserBareMinimum; readonly created_date: string; readonly modified_date: string; readonly is_migrated: boolean; diff --git a/src/components/Common/Avatar.tsx b/src/components/Common/Avatar.tsx index 1d20c3ad18f..7a7ded17265 100644 --- a/src/components/Common/Avatar.tsx +++ b/src/components/Common/Avatar.tsx @@ -78,6 +78,7 @@ const Avatar: React.FC = ({ xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" + className="aspect-square h-full w-full object-cover" > ; - -export default function PMJAYProcedurePackageAutocomplete(props: Props) { - const field = useFormFieldPropsResolver(props); - - const [query, setQuery] = useState(""); - - const { data, loading } = useQuery(routes.hcx.claims.listPMJYPackages, { - query: { query, limit: 10 }, - }); - - return ( - - ({ - ...o, - price: - o.price && parseFloat(o.price?.toString().replaceAll(",", "")), - })), - data ?? [], - (obj) => obj.code, - )} - optionLabel={optionLabel} - optionDescription={optionDescription} - optionValue={(option) => option} - onQuery={setQuery} - isLoading={loading} - /> - - ); -} - -const optionLabel = (option: PMJAYPackageItem) => { - if (option.name) return option.name; - if (option.package_name) return `${option.package_name} (Package)`; - return "Unknown"; -}; - -const optionDescription = (option: PMJAYPackageItem) => { - const code = option.code || "Unknown"; - const packageName = option.package_name || "Unknown"; - return `Package: ${packageName} (${code})`; -}; diff --git a/src/components/Common/RelativeDateUserMention.tsx b/src/components/Common/RelativeDateUserMention.tsx index b2fc8b2e241..f68f002eee5 100644 --- a/src/components/Common/RelativeDateUserMention.tsx +++ b/src/components/Common/RelativeDateUserMention.tsx @@ -1,10 +1,11 @@ -import CareIcon from "../../CAREUI/icons/CareIcon"; import { formatDateTime, formatName, relativeDate } from "../../Utils/utils"; -import { PerformedByModel } from "../HCX/misc"; + +import CareIcon from "../../CAREUI/icons/CareIcon"; +import { UserBareMinimum } from "@/components/Users/models"; function RelativeDateUserMention(props: { actionDate?: string; - user?: PerformedByModel; + user?: UserBareMinimum; tooltipPosition?: "top" | "bottom" | "left" | "right"; withoutSuffix?: boolean; }) { diff --git a/src/components/Diagnosis/types.ts b/src/components/Diagnosis/types.ts index 694e7a482d6..4a67e28efab 100644 --- a/src/components/Diagnosis/types.ts +++ b/src/components/Diagnosis/types.ts @@ -1,4 +1,4 @@ -import { PerformedByModel } from "../HCX/misc"; +import { UserBareMinimum } from "@/components/Users/models"; export type ICD11DiagnosisModel = { id: string; @@ -33,7 +33,7 @@ export interface ConsultationDiagnosis { verification_status: ConditionVerificationStatus; is_principal: boolean; readonly is_migrated: boolean; - readonly created_by: PerformedByModel; + readonly created_by: UserBareMinimum; readonly created_date: string; readonly modified_date: string; } diff --git a/src/components/Facility/ConsultationClaims.tsx b/src/components/Facility/ConsultationClaims.tsx deleted file mode 100644 index a449f4c18f1..00000000000 --- a/src/components/Facility/ConsultationClaims.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import * as Notification from "../../Utils/Notifications"; - -import ClaimCard from "../HCX/ClaimCard"; -import CreateClaimCard from "../HCX/CreateClaimCard"; -import PageTitle from "@/components/Common/PageTitle"; -import { navigate } from "raviger"; -import routes from "../../Redux/api"; -import { useMessageListener } from "@/common/hooks/useMessageListener"; -import useQuery from "../../Utils/request/useQuery"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - -export interface IConsultationClaimsProps { - facilityId: string; - patientId: string; - consultationId: string; -} - -export default function ConsultationClaims({ - facilityId, - consultationId, - patientId, -}: IConsultationClaimsProps) { - const { t } = useTranslation(); - - const [isCreateLoading, setIsCreateLoading] = useState(false); - - const { data: claimsResult, refetch: refetchClaims } = useQuery( - routes.hcx.claims.list, - { - query: { - ordering: "-modified_date", - consultation: consultationId, - }, - onResponse: (res) => { - if (!isCreateLoading) return; - - if (res.data?.results) { - Notification.Success({ - msg: t("claim__fetched_claim_approval_results"), - }); - return; - } - - Notification.Error({ - msg: t("claim__error_fetching_claim_approval_results"), - }); - }, - }, - ); - - useMessageListener((data) => { - if ( - data.type === "MESSAGE" && - (data.from === "claim/on_submit" || data.from === "preauth/on_submit") && - data.message === "success" - ) { - refetchClaims(); - } - }); - - return ( -
- { - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, - ); - return false; - }} - /> - -
-
- -
- -
- {claimsResult?.results.map((claim) => ( -
- -
- ))} -
-
-
- ); -} diff --git a/src/components/Facility/ConsultationDoctorNotes/index.tsx b/src/components/Facility/ConsultationDoctorNotes/index.tsx index f422eca2763..517c3eca619 100644 --- a/src/components/Facility/ConsultationDoctorNotes/index.tsx +++ b/src/components/Facility/ConsultationDoctorNotes/index.tsx @@ -128,7 +128,7 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => { backUrl={`/facility/${facilityId}/patient/${patientId}`} >
-
+
{keysOf(PATIENT_NOTES_THREADS).map((current) => (
); } diff --git a/src/components/Facility/SpokeFacilityEditor.tsx b/src/components/Facility/SpokeFacilityEditor.tsx index a6dfe9e00aa..bf07ec4e9bb 100644 --- a/src/components/Facility/SpokeFacilityEditor.tsx +++ b/src/components/Facility/SpokeFacilityEditor.tsx @@ -78,7 +78,8 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { setItem: (item: FacilitySpokeModel | FacilitySpokeRequest) => void, processing: boolean, ) => { - const [selectedFacility, setSelectedFacility] = useState(); + const [selectedFacility, setSelectedFacility] = + useState(null); useEffect(() => { setItem({ ...item, spoke: selectedFacility?.id }); @@ -99,7 +100,7 @@ export default function SpokeFacilityEditor(props: SpokeFacilityEditorProps) { showNOptions={8} selected={selectedFacility} setSelected={(v) => - v && !Array.isArray(v) && setSelectedFacility(v) + (v === null || !Array.isArray(v)) && setSelectedFacility(v) } errors="" className="w-full" diff --git a/src/components/Facility/models.tsx b/src/components/Facility/models.tsx index 37461b056e8..84617e35ed7 100644 --- a/src/components/Facility/models.tsx +++ b/src/components/Facility/models.tsx @@ -23,7 +23,6 @@ import { UserBareMinimum } from "../Users/models"; import { InvestigationType } from "@/components/Common/prescription-builder/InvestigationBuilder"; import { ProcedureType } from "@/components/Common/prescription-builder/ProcedureBuilder"; import { RouteToFacility } from "@/components/Common/RouteToFacilitySelect"; -import { PerformedByModel } from "../HCX/misc"; export interface LocalBodyModel { id: number; @@ -713,8 +712,8 @@ export interface ShiftingModel { ambulance_number: string; comments: string; created_date: string; - created_by_object: PerformedByModel; - last_edited_by_object: PerformedByModel; + created_by_object: UserBareMinimum; + last_edited_by_object: UserBareMinimum; is_assigned_to_user: boolean; created_by: number; last_edited_by: number; @@ -746,15 +745,15 @@ export interface ResourceModel { status: string; sub_category: string; title: string; - assigned_to_object: PerformedByModel | null; - created_by_object: PerformedByModel | null; + assigned_to_object: UserBareMinimum | null; + created_by_object: UserBareMinimum | null; created_date: string; - last_edited_by_object: PerformedByModel; + last_edited_by_object: UserBareMinimum; } export interface CommentModel { id: string; - created_by_object: PerformedByModel; + created_by_object: UserBareMinimum; created_date: string; modified_date: string; comment: string; diff --git a/src/components/Form/AutoCompleteAsync.tsx b/src/components/Form/AutoCompleteAsync.tsx index ddec1503042..839a74c880c 100644 --- a/src/components/Form/AutoCompleteAsync.tsx +++ b/src/components/Form/AutoCompleteAsync.tsx @@ -100,7 +100,7 @@ const AutoCompleteAsync = (props: Props) => { immediate >
-
+
{ /> {!disabled && ( -
+
{hasSelection && !loading && !required && (
{ e.preventDefault(); onChange(null); @@ -142,16 +142,9 @@ const AutoCompleteAsync = (props: Props) => {
)} {loading ? ( - + ) : ( - + )}
diff --git a/src/components/Form/FormFields/TextFormField.tsx b/src/components/Form/FormFields/TextFormField.tsx index a3663358a56..81e1edea9d0 100644 --- a/src/components/Form/FormFields/TextFormField.tsx +++ b/src/components/Form/FormFields/TextFormField.tsx @@ -24,6 +24,7 @@ export type TextFormFieldProps = FormFieldBaseProps & trailingPadding?: string | undefined; leadingPadding?: string | undefined; suggestions?: string[]; + clearable?: boolean | undefined; }; const TextFormField = forwardRef((props: TextFormFieldProps, ref) => { @@ -41,24 +42,36 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => { }; let child = ( - } - id={field.id} - className={classNames( - "cui-input-base peer", - hasLeading && (props.leadingPadding || "pl-10"), - hasTrailing && (props.trailingPadding || "pr-10"), - field.error && "border-danger-500", - props.inputClassName, +
+ } + id={field.id} + className={classNames( + "cui-input-base peer", + hasLeading && (props.leadingPadding || "pl-10"), + hasTrailing && (props.trailingPadding || "pr-10"), + field.error && "border-danger-500", + props.inputClassName, + )} + disabled={field.disabled} + type={props.type === "password" ? getPasswordFieldType() : props.type} + name={field.name} + value={field.value} + required={field.required} + onChange={(e) => field.handleChange(e.target.value)} + /> + {props.clearable && field.value && ( + )} - disabled={field.disabled} - type={props.type === "password" ? getPasswordFieldType() : props.type} - name={field.name} - value={field.value} - required={field.required} - onChange={(e) => field.handleChange(e.target.value)} - /> +
); if (props.type === "password") { diff --git a/src/components/HCX/ClaimCard.tsx b/src/components/HCX/ClaimCard.tsx deleted file mode 100644 index b45e7b3d503..00000000000 --- a/src/components/HCX/ClaimCard.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { useLayoutEffect, useRef, useState } from "react"; - -import CareIcon from "../../CAREUI/icons/CareIcon"; -import ClaimCardCommunication from "./ClaimCardCommunication"; -import ClaimCardInfo from "./ClaimCardInfo"; -import { HCXClaimModel } from "./models"; - -interface IProps { - claim: HCXClaimModel; -} - -export default function ClaimCard({ claim }: IProps) { - const [showMessages, setShowMessages] = useState(false); - const [containerDimensions, setContainerDimensions] = useState({ - width: 0, - height: 0, - }); - const cardContainerRef = useRef(null); - - useLayoutEffect(() => { - if (cardContainerRef.current) { - setContainerDimensions({ - width: cardContainerRef.current.offsetWidth, - height: cardContainerRef.current.offsetHeight, - }); - } - }, [cardContainerRef]); - - return ( - <> -
- setShowMessages((prev) => !prev)} - /> -
- {showMessages ? ( -
- -
- ) : ( -
- -
- )} - - ); -} diff --git a/src/components/HCX/ClaimCardCommunication.tsx b/src/components/HCX/ClaimCardCommunication.tsx deleted file mode 100644 index 39edd63ce62..00000000000 --- a/src/components/HCX/ClaimCardCommunication.tsx +++ /dev/null @@ -1,300 +0,0 @@ -import * as Notification from "../../Utils/Notifications"; - -import { HCXClaimModel, HCXCommunicationModel } from "./models"; - -import ButtonV2 from "@/components/Common/components/ButtonV2"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import { FileUploadModel } from "../Patient/models"; -import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; -import { classNames } from "../../Utils/utils"; -import request from "../../Utils/request/request"; -import routes from "../../Redux/api"; -import useFileUpload from "../../Utils/useFileUpload"; -import useQuery from "../../Utils/request/useQuery"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - -interface IProps { - claim: HCXClaimModel; -} - -export default function ClaimCardCommunication({ claim }: IProps) { - const { t } = useTranslation(); - const [inputText, setInputText] = useState(""); - const [isSendingCommunication, setIsSendingCommunication] = useState(false); - - const { - Input, - files, - error, - removeFile, - clearFiles, - handleFileUpload, - validateFiles, - } = useFileUpload({ - multiple: true, - type: "COMMUNICATION", - allowedExtensions: [".pdf", ".jpg", ".jpeg", ".png"], - }); - - const { data: communicationsResult, refetch: refetchCommunications } = - useQuery(routes.hcx.communications.list, { - query: { - claim: claim.id, - ordering: "-created_date", - }, - }); - - const handleSubmit = async () => { - if (!claim.id) return; - - if (!validateFiles()) return; - - setIsSendingCommunication(true); - - const { res, data } = await request(routes.hcx.communications.create, { - body: { - claim: claim.id, - content: [ - { - type: "text", - data: inputText, - }, - ], - }, - }); - - if (res?.status === 201 && data) { - await handleFileUpload(data.id as string); - - const { res } = await request(routes.hcx.communications.send, { - body: { - communication: data.id, - }, - }); - - if (res?.ok) { - Notification.Success({ msg: t("communication__sent_to_hcx") }); - - await refetchCommunications(); - - setInputText(""); - clearFiles(); - } - } - - setIsSendingCommunication(false); - }; - - return ( -
- - -
-
-
- {files.map((file, i) => ( -
-
- {file.type.includes("image") ? ( - {file.name} - ) : ( -
- -
- )} -
-
-

{file.name}

-
-

- {(file.size / 1024).toFixed(2)} KB -

- -
-
-
- ))} -
- setInputText(e.value)} - placeholder={t("enter_message")} - rows={1} - className="-mb-3 flex-1" - /> -
-
- -
- - {t("send_message")} - -
- {error && ( -

{error}

- )} -
- ); -} - -interface ICommunicationChatInterfaceProps { - communications: HCXCommunicationModel[]; -} - -function CommunicationChatInterface({ - communications, -}: ICommunicationChatInterfaceProps) { - return ( -
- {communications?.map((communication) => ( - - ))} -
- ); -} - -interface ICommunicationChatMessageProps { - communication: HCXCommunicationModel; -} - -function CommunicationChatMessage({ - communication, -}: ICommunicationChatMessageProps) { - const { t } = useTranslation(); - const [attachments, setAttachments] = useState( - null, - ); - const [isFetchingAttachments, setIsFetchingAttachments] = useState(false); - const [isDownloadingAttachment, setIsDownloadingAttachment] = useState(false); - - return ( -
- {communication.content?.map((message) => ( -

- {message.data} -

- ))} - {attachments ? ( -
- {attachments.length === 0 ? ( -

- {t("no_attachments_found")} -

- ) : ( - attachments.map((attachment) => ( -
-
-
- -
-
-
-

{attachment.name}

- -
-
- )) - )} -
- ) : ( - - )} -
- ); -} diff --git a/src/components/HCX/ClaimCardInfo.tsx b/src/components/HCX/ClaimCardInfo.tsx deleted file mode 100644 index 1b348a28f4f..00000000000 --- a/src/components/HCX/ClaimCardInfo.tsx +++ /dev/null @@ -1,168 +0,0 @@ -import { classNames, formatCurrency, formatDateTime } from "../../Utils/utils"; - -import { HCXClaimModel } from "./models"; -import { useTranslation } from "react-i18next"; - -interface IProps { - claim: HCXClaimModel; -} - -const claimStatus = { - PENDING: "pending", - APPROVED: "approved", - REJECTED: "rejected", -}; - -export default function ClaimCardInfo({ claim }: IProps) { - const { t } = useTranslation(); - - const status = - claim.outcome === "Complete" - ? claim.error_text - ? claimStatus.REJECTED - : claimStatus.APPROVED - : claimStatus.PENDING; - - return ( - <> -
-
-

- #{claim.id?.slice(0, 5)} -

- -

- {t("created_on")}{" "} - - . -

-
-
- {claim.use && ( - - {claim.use} - - )} - - {t(`claim__status__${status}`)} - -
-
-
-
-

- {claim.policy_object?.policy_id || "NA"} -

-

{t("policy__policy_id")}

-
-
-

- {claim.policy_object?.subscriber_id || "NA"} -

-

- {t("policy__subscriber_id")} -

-
-
-

- {claim.policy_object?.insurer_id?.split("@").shift() || "NA"} -

-

- {t("policy__insurer_id")} -

-
-
-

- {claim.policy_object?.insurer_name || "NA"} -

-

- {t("policy__insurer_name")} -

-
-
-
- - - - - - - - - - - {claim.items?.map((item) => ( - - - - - - - ))} - - - - - - - - - - - - -
- {t("claim__items")} - - {t("claim__item__price")} -
-
- {item.name} -
-
{item.id}
-
- {formatCurrency(item.price)} -
- {t("claim__total_claim_amount")} - - {claim.total_claim_amount && - formatCurrency(claim.total_claim_amount)} -
- {t("claim__total_approved_amount")} - - {claim.total_amount_approved - ? formatCurrency(claim.total_amount_approved) - : "NA"} -
-
- {claim.error_text && ( -
- {claim.error_text} -
- )} - - ); -} diff --git a/src/components/HCX/ClaimCreatedModal.tsx b/src/components/HCX/ClaimCreatedModal.tsx deleted file mode 100644 index 4edd4fb11f8..00000000000 --- a/src/components/HCX/ClaimCreatedModal.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import * as Notification from "../../Utils/Notifications"; - -import CareIcon from "../../CAREUI/icons/CareIcon"; -import DialogModal from "@/components/Common/Dialog"; -import { FileUpload } from "../Files/FileUpload"; -import { HCXClaimModel } from "./models"; -import { Submit } from "@/components/Common/components/ButtonV2"; -import request from "../../Utils/request/request"; -import routes from "../../Redux/api"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - -interface Props { - claim: HCXClaimModel; - show: boolean; - onClose: () => void; -} - -export default function ClaimCreatedModal({ claim, ...props }: Props) { - const { t } = useTranslation(); - - const [isMakingClaim, setIsMakingClaim] = useState(false); - - const { use } = claim; - - const handleSubmit = async () => { - setIsMakingClaim(true); - - const { res } = await request(routes.hcx.claims.makeClaim, { - body: { claim: claim.id }, - }); - - if (res?.ok) { - Notification.Success({ msg: `${use} requested` }); - props.onClose(); - } - - setIsMakingClaim(false); - }; - return ( - - {isMakingClaim && ( - - )} - {isMakingClaim - ? t("claim__requesting_claim") - : t("claim__request_claim")} - - } - > -
- -
-
- ); -} diff --git a/src/components/HCX/ClaimsItemsBuilder.tsx b/src/components/HCX/ClaimsItemsBuilder.tsx deleted file mode 100644 index b4158c4443b..00000000000 --- a/src/components/HCX/ClaimsItemsBuilder.tsx +++ /dev/null @@ -1,163 +0,0 @@ -import { - FieldChangeEvent, - FormFieldBaseProps, - useFormFieldPropsResolver, -} from "../Form/FormFields/Utils"; -import FormField, { FieldLabel } from "../Form/FormFields/FormField"; - -import AutocompleteFormField from "../Form/FormFields/Autocomplete"; -import ButtonV2 from "@/components/Common/components/ButtonV2"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import { HCXItemModel } from "./models"; -import { ITEM_CATEGORIES } from "./constants"; -import PMJAYProcedurePackageAutocomplete from "@/components/Common/PMJAYProcedurePackageAutocomplete"; -import TextFormField from "../Form/FormFields/TextFormField"; -import { useTranslation } from "react-i18next"; - -type Props = FormFieldBaseProps; - -export default function ClaimsItemsBuilder(props: Props) { - const { t } = useTranslation(); - - const field = useFormFieldPropsResolver(props); - - const handleUpdate = (index: number) => { - return (event: FieldChangeEvent) => { - if (event.name === "hbp") { - field.handleChange( - (props.value || [])?.map((obj, i) => - i === index - ? { - ...obj, - id: event.value.code, - name: event.value.name, - price: event.value.price, - } - : obj, - ), - ); - } else { - field.handleChange( - (props.value || [])?.map((obj, i) => - i === index ? { ...obj, [event.name]: event.value } : obj, - ), - ); - } - }; - }; - - const handleRemove = (index: number) => { - return () => { - field.handleChange((props.value || [])?.filter((obj, i) => i !== index)); - }; - }; - - return ( - -
- {props.value?.map((obj, index) => { - return ( -
-
- - {t("claim__item")} {index + 1} - - {!props.disabled && ( - - {t("remove")} - - - )} -
- -
- o.display} - optionValue={(o) => o.code} - value={obj.category} - onChange={handleUpdate(index)} - disabled={props.disabled} - errorClassName="hidden" - /> - -
- {obj.category === "HBP" && !obj.id ? ( - <> - - - ) : ( - <> - - - - handleUpdate(index)({ - name: event.name, - value: parseFloat(event.value), - }) - } - disabled={props.disabled} - errorClassName="hidden" - /> - - )} -
-
-
- ); - })} -
-
- ); -} diff --git a/src/components/HCX/CreateClaimCard.tsx b/src/components/HCX/CreateClaimCard.tsx deleted file mode 100644 index 7d4b7d3edb0..00000000000 --- a/src/components/HCX/CreateClaimCard.tsx +++ /dev/null @@ -1,262 +0,0 @@ -import * as Notification from "../../Utils/Notifications"; - -import ButtonV2, { Submit } from "@/components/Common/components/ButtonV2"; -import { HCXClaimModel, HCXItemModel, HCXPolicyModel } from "./models"; -import { classNames, formatCurrency } from "../../Utils/utils"; - -import CareIcon from "../../CAREUI/icons/CareIcon"; -import ClaimCreatedModal from "./ClaimCreatedModal"; -import ClaimsItemsBuilder from "./ClaimsItemsBuilder"; -import DialogModal from "@/components/Common/Dialog"; -import HCXPolicyEligibilityCheck from "./PolicyEligibilityCheck"; -import PatientInsuranceDetailsEditor from "./PatientInsuranceDetailsEditor"; -import { ProcedureType } from "@/components/Common/prescription-builder/ProcedureBuilder"; -import { SelectFormField } from "../Form/FormFields/SelectFormField"; -import request from "../../Utils/request/request"; -import routes from "../../Redux/api"; -import useQuery from "../../Utils/request/useQuery"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; - -interface Props { - consultationId: string; - patientId: string; - setIsCreating: (creating: boolean) => void; - isCreating: boolean; - use?: "preauthorization" | "claim"; -} - -export default function CreateClaimCard({ - consultationId, - patientId, - setIsCreating, - isCreating, - use = "preauthorization", -}: Props) { - const { t } = useTranslation(); - - const [showAddPolicy, setShowAddPolicy] = useState(false); - const [policy, setPolicy] = useState(); - const [items, setItems] = useState(); - const [itemsError, setItemsError] = useState(); - const [createdClaim, setCreatedClaim] = useState(); - const [use_, setUse_] = useState(use); - - const { res: consultationRes, data: consultationData } = useQuery( - routes.getConsultation, - { pathParams: { id: consultationId }, prefetch: !!consultationId }, - ); - - const autoFill = async (policy?: HCXPolicyModel) => { - if (!policy) { - setItems([]); - return; - } - - const { res, data: latestApprovedPreAuth } = await request( - routes.hcx.claims.list, - { - query: { - consultation: consultationId, - policy: policy.id, - ordering: "-modified_date", - use: "preauthorization", - outcome: "complete", - limit: 1, - }, - }, - ); - - if (res?.ok && latestApprovedPreAuth?.results.length !== 0) { - setItems(latestApprovedPreAuth?.results[0].items ?? []); - return; - } - if (consultationRes?.ok && Array.isArray(consultationData?.procedure)) { - setItems( - consultationData.procedure.map((obj: ProcedureType) => { - return { - id: obj.procedure ?? "", - name: obj.procedure ?? "", - price: 0.0, - category: "900000", // provider's packages - }; - }), - ); - } else { - setItems([]); - } - }; - - const validate = () => { - if (!policy) { - Notification.Error({ msg: t("select_policy") }); - return false; - } - if (policy?.outcome !== "Complete") { - Notification.Error({ msg: t("select_eligible_policy") }); - return false; - } - if (!items || items.length === 0) { - setItemsError(t("claim__item__add_at_least_one")); - return false; - } - if (items?.some((p) => !p.id || !p.name || p.price === 0 || !p.category)) { - setItemsError(t("claim__item__fill_all_details")); - return false; - } - - return true; - }; - - const handleSubmit = async () => { - if (!validate()) return; - - setIsCreating(true); - - const { res, data } = await request(routes.hcx.claims.create, { - body: { - policy: policy?.id, - items, - consultation: consultationId, - use: use_, - }, - silent: true, - }); - - if (res?.ok && data) { - setItems([]); - setItemsError(undefined); - setPolicy(undefined); - setCreatedClaim(data); - } else { - Notification.Error({ msg: t(`claim__failed_to_create_${use_}`) }); - } - - setIsCreating(false); - }; - - return ( -
- {createdClaim && ( - setCreatedClaim(undefined)} - /> - )} - setShowAddPolicy(false)} - description={t("edit_policy_description")} - className="w-full max-w-screen-md" - > - setShowAddPolicy(false)} - /> - - - {/* Check Insurance Policy Eligibility */} -
-
-

{t("check_policy_eligibility")}

- setShowAddPolicy(true)} - ghost - border - > - - {t("edit_policy")} - -
- { - setPolicy(policy); - autoFill(policy); - }} - /> -
- - {/* Procedures */} -
-
-

{t("claim__items")}

- - setItems([...(items ?? []), { name: "", id: "", price: 0 }]) - } - > - - {t("claim__add_item")} - -
- - {t("select_policy_to_add_items")} - - setItems(value)} - error={itemsError} - /> -
- {t("total_amount")} :{" "} - {items ? ( - - {formatCurrency( - items.map((p) => p.price).reduce((a, b) => a + b, 0.0), - )} - - ) : ( - "--" - )} -
-
- -
- setUse_(value)} - position="below" - className="w-52 max-sm:w-full" - optionLabel={(value) => value.label} - optionValue={(value) => value.id as "preauthorization" | "claim"} - /> - - {isCreating && } - {isCreating - ? t(`claim__creating_${use_}`) - : t(`claim__create_${use_}`)} - -
-
- ); -} diff --git a/src/components/HCX/InsuranceDetailsBuilder.tsx b/src/components/HCX/InsuranceDetailsBuilder.tsx index 1d963200ee3..ca7473c9dc1 100644 --- a/src/components/HCX/InsuranceDetailsBuilder.tsx +++ b/src/components/HCX/InsuranceDetailsBuilder.tsx @@ -10,11 +10,11 @@ import CareIcon from "../../CAREUI/icons/CareIcon"; import { HCXPolicyModel } from "./models"; import InsurerAutocomplete from "./InsurerAutocomplete"; import TextFormField from "../Form/FormFields/TextFormField"; +import careConfig from "@careConfig"; import { classNames } from "../../Utils/utils"; import request from "../../Utils/request/request"; import routes from "../../Redux/api"; import { useTranslation } from "react-i18next"; -import careConfig from "@careConfig"; type Props = FormFieldBaseProps & { gridView?: boolean }; diff --git a/src/components/HCX/constants.ts b/src/components/HCX/constants.ts deleted file mode 100644 index ed4235a3386..00000000000 --- a/src/components/HCX/constants.ts +++ /dev/null @@ -1,58 +0,0 @@ -interface ItemCategory { - code: string; - system: string; - display: string; -} - -export const ITEM_CATEGORIES: ItemCategory[] = [ - { - code: "100000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Room & Nursing Charges", - }, - { - code: "200000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "ICU Charges", - }, - { - code: "300000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "OT Charges", - }, - { - code: "400000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Medicine & Consumables Charges", - }, - { - code: "500000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Professional Fees Charges", - }, - { - code: "600000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Investigation Charges", - }, - { - code: "700000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Ambulance Charges", - }, - { - code: "800000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Miscellaneous Charges", - }, - { - code: "900000", - system: "https://irdai.gov.in/benefit-billing-group-code", - display: "Provider Package Charges", - }, - { - code: "HBP", - system: "https://pmjay.gov.in/benefit-billing-group-code", - display: "NHA Package Charges", - }, -]; diff --git a/src/components/HCX/misc.ts b/src/components/HCX/misc.ts deleted file mode 100644 index dba0a290b85..00000000000 --- a/src/components/HCX/misc.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { UserBareMinimum } from "../Users/models"; - -export type PerformedByModel = UserBareMinimum; diff --git a/src/components/HCX/models.ts b/src/components/HCX/models.ts index e75fc28214d..416b3ec6abe 100644 --- a/src/components/HCX/models.ts +++ b/src/components/HCX/models.ts @@ -1,9 +1,6 @@ -import { ConsultationModel } from "../Facility/models"; -import { PatientModel } from "../Patient/models"; -import { PerformedByModel } from "./misc"; - -export type HCXPriority = "Immediate" | "Normal" | "Deferred"; +import { PatientModel } from "@/components/Patient/models"; +export type HCXPolicyPriority = "Immediate" | "Normal" | "Deferred"; export type HCXPolicyStatus = | "Active" | "Cancelled" @@ -29,60 +26,10 @@ export interface HCXPolicyModel { insurer_id?: string; insurer_name?: string; status?: HCXPolicyStatus; - priority?: HCXPriority; + priority?: HCXPolicyPriority; purpose?: HCXPolicyPurpose; outcome?: HCXPolicyOutcome; error_text?: string; created_date?: string; modified_date?: string; } - -export interface HCXCommunicationModel { - id?: string; - identifier?: string; - claim?: string; - claim_object?: HCXClaimModel; - content?: { type: string; data: string }[]; - created_by?: string | null; - last_modified_by?: string | null; - created_date?: string; - modified_date?: string; -} - -export interface HCXItemModel { - id: string; - name: string; - price: number; - category?: string; -} - -export type HCXClaimUse = "Claim" | "Pre Authorization" | "Pre Determination"; -export type HCXClaimStatus = HCXPolicyStatus; -export type HCXClaimType = - | "Institutional" - | "Oral" - | "Pharmacy" - | "Professional" - | "Vision"; -export type HCXClaimOutcome = HCXPolicyOutcome; - -export interface HCXClaimModel { - id?: string; - consultation: string; - consultation_object?: ConsultationModel; - policy: string; - policy_object?: HCXPolicyModel; - items?: HCXItemModel[]; - total_claim_amount?: number; - total_amount_approved?: number; - use?: HCXClaimUse; - status?: HCXClaimStatus; - priority?: HCXPriority; - type?: HCXClaimType; - outcome?: HCXClaimOutcome; - error_text?: string; - created_by?: PerformedByModel; - last_modified_by?: PerformedByModel; - created_date?: string; - modified_date?: string; -} diff --git a/src/components/HCX/validators.ts b/src/components/HCX/validators.ts index 5d5c979a405..3f10ac156d1 100644 --- a/src/components/HCX/validators.ts +++ b/src/components/HCX/validators.ts @@ -1,6 +1,6 @@ -import { t } from "i18next"; import { FieldValidator } from "../Form/FieldValidators"; import { HCXPolicyModel } from "./models"; +import { t } from "i18next"; const HCXPolicyValidator: FieldValidator = ( value, diff --git a/src/components/Medicine/models.ts b/src/components/Medicine/models.ts index bb596e88b3e..68e34d09798 100644 --- a/src/components/Medicine/models.ts +++ b/src/components/Medicine/models.ts @@ -1,5 +1,5 @@ -import { PerformedByModel } from "../HCX/misc"; import { PRESCRIPTION_ROUTES } from "./CreatePrescriptionForm"; +import { UserBareMinimum } from "@/components/Users/models"; export const DOSAGE_UNITS = [ "mg", @@ -29,7 +29,7 @@ interface BasePrescription { readonly prescription_type?: "DISCHARGE" | "REGULAR"; readonly discontinued: boolean; discontinued_reason?: string; - readonly prescribed_by: PerformedByModel; + readonly prescribed_by: UserBareMinimum; readonly discontinued_date: string; readonly last_administration?: MedicineAdministrationRecord; readonly is_migrated: boolean; @@ -72,8 +72,8 @@ export type MedicineAdministrationRecord = { notes: string; dosage?: DosageValue; administered_date?: string; - readonly administered_by: PerformedByModel; - readonly archived_by: PerformedByModel | undefined; + readonly administered_by: UserBareMinimum; + readonly archived_by: UserBareMinimum | undefined; readonly archived_on: string | undefined; readonly created_date: string; readonly modified_date: string; diff --git a/src/components/Patient/InsuranceDetails.tsx b/src/components/Patient/InsuranceDetails.tsx index 58efe498712..d90c5dbcd27 100644 --- a/src/components/Patient/InsuranceDetails.tsx +++ b/src/components/Patient/InsuranceDetails.tsx @@ -1,10 +1,10 @@ import { HCXPolicyModel } from "../HCX/models"; import { InsuranceDetialsCard } from "./InsuranceDetailsCard"; +import Loading from "@/components/Common/Loading"; import Page from "@/components/Common/components/Page"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; -import Loading from "@/components/Common/Loading"; interface IProps { facilityId: string; id: string; diff --git a/src/components/Patient/PatientConsentRecords.tsx b/src/components/Patient/PatientConsentRecords.tsx index 9850cfe0b2c..aa6f45b761c 100644 --- a/src/components/Patient/PatientConsentRecords.tsx +++ b/src/components/Patient/PatientConsentRecords.tsx @@ -219,7 +219,8 @@ export default function PatientConsentRecords(props: { onClick={fileUpload.clearFiles} disabled={fileUpload.uploading} > - + + {t("delete")} ) : ( diff --git a/src/components/Patient/PatientHome.tsx b/src/components/Patient/PatientHome.tsx index d95c6d1df21..fe91bc4e17d 100644 --- a/src/components/Patient/PatientHome.tsx +++ b/src/components/Patient/PatientHome.tsx @@ -591,7 +591,7 @@ export const PatientHome = (props: any) => {

)} -
+
diff --git a/src/components/Patient/PatientInfoCard.tsx b/src/components/Patient/PatientInfoCard.tsx index bdc8b0e672d..f5bae4aba54 100644 --- a/src/components/Patient/PatientInfoCard.tsx +++ b/src/components/Patient/PatientInfoCard.tsx @@ -1,10 +1,5 @@ import * as Notification from "../../Utils/Notifications"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip"; + import { CONSULTATION_SUGGESTION, DISCHARGE_REASONS, @@ -13,11 +8,14 @@ import { TELEMEDICINE_ACTIONS, } from "@/common/constants"; import { ConsultationModel, PatientCategory } from "../Facility/models"; -import { Switch, MenuItem, Field, Label } from "@headlessui/react"; +import { Field, Label, MenuItem, Switch } from "@headlessui/react"; import { Link, navigate } from "raviger"; -import { useState } from "react"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import dayjs from "../../Utils/dayjs"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { classNames, formatDate, @@ -26,29 +24,33 @@ import { formatPatientAge, humanizeStrings, } from "../../Utils/utils"; + import ABHAProfileModal from "../ABDM/ABHAProfileModal"; -import DialogModal from "@/components/Common/Dialog"; -import ButtonV2 from "@/components/Common/components/ButtonV2"; +import { AbhaNumberModel } from "../ABDM/types/abha"; +import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild"; import Beds from "../Facility/Consultations/Beds"; +import ButtonV2 from "@/components/Common/components/ButtonV2"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import DialogModal from "@/components/Common/Dialog"; +import DischargeModal from "../Facility/DischargeModal"; +import DischargeSummaryModal from "../Facility/DischargeSummaryModal"; +import DropdownMenu from "@/components/Common/components/Menu"; +import FetchRecordsModal from "../ABDM/FetchRecordsModal"; +import LinkAbhaNumber from "../ABDM/LinkAbhaNumber/index"; +import { Mews } from "../Facility/Consultations/Mews"; +import { PLUGIN_Component } from "@/PluginEngine"; import { PatientModel } from "./models"; +import { SkillModel } from "../Users/models"; +import careConfig from "@careConfig"; +import { cn } from "@/lib/utils.js"; +import dayjs from "../../Utils/dayjs"; import request from "../../Utils/request/request"; import routes from "../../Redux/api"; -import DropdownMenu from "@/components/Common/components/Menu"; import { triggerGoal } from "../../Integrations/Plausible"; - import useAuthUser from "@/common/hooks/useAuthUser"; -import { Mews } from "../Facility/Consultations/Mews"; -import DischargeSummaryModal from "../Facility/DischargeSummaryModal"; -import DischargeModal from "../Facility/DischargeModal"; -import { useTranslation } from "react-i18next"; import useQuery from "../../Utils/request/useQuery"; -import FetchRecordsModal from "../ABDM/FetchRecordsModal"; -import { AbhaNumberModel } from "../ABDM/types/abha"; -import { SkillModel } from "../Users/models"; -import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild"; -import LinkAbhaNumber from "../ABDM/LinkAbhaNumber/index"; -import careConfig from "@careConfig"; -import { cn } from "@/lib/utils.js"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; const formatSkills = (arr: SkillModel[]) => { const skills = arr.map((skill) => skill.skill_object.name); @@ -673,27 +675,25 @@ export default function PatientInfoCard(props: { "l-file-medical", consultation?.id, ], - ] - .concat( - careConfig.hcx.enabled - ? [ - [ - `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`, - "Claims", - "l-copy-landscape", - consultation?.id, - ], - ] - : [], - ) - .map( - (action: any, i) => - action[3] && ( -
- + action[3] && ( +
+ { + if ( ![ "Treatment Summary", "Consent Records", @@ -701,47 +701,35 @@ export default function PatientInfoCard(props: { consultation?.admitted && !consultation?.current_bed && i === 1 - ? "" - : `${action[0]}` - } - onClick={() => { - if ( - ![ - "Treatment Summary", - "Consent Records", - ].includes(action[1]) && - consultation?.admitted && - !consultation?.current_bed && - i === 1 - ) { - Notification.Error({ - msg: "Please assign a bed to the patient", - }); - setOpen(true); - } - triggerGoal("Patient Card Button Clicked", { - buttonName: action[1], - consultationId: consultation?.id, - userId: authUser?.id, + ) { + Notification.Error({ + msg: "Please assign a bed to the patient", }); - }} - > - - {action[1]} - - {action?.[4]?.[0] && ( - <> -

- {action[4][1]} -

- - )} -
- ), - )} + setOpen(true); + } + triggerGoal("Patient Card Button Clicked", { + buttonName: action[1], + consultationId: consultation?.id, + userId: authUser?.id, + }); + }} + > + + {action[1]} + + {action?.[4]?.[0] && ( + <> +

+ {action[4][1]} +

+ + )} +
+ ), + )}
@@ -926,6 +914,13 @@ export default function PatientInfoCard(props: { )}
+ + +
{ backUrl={`/facility/${facilityId}/patient/${patientId}`} >
-
+
{keysOf(PATIENT_NOTES_THREADS).map((current) => (