Skip to content

Commit

Permalink
Merge branch 'develop' into issue/8006/TypeError_in_NotificationsList…
Browse files Browse the repository at this point in the history
…_Component
  • Loading branch information
AdityaJ2305 authored Nov 2, 2024
2 parents 5c577ef + 764cfe3 commit 8a48d66
Show file tree
Hide file tree
Showing 76 changed files with 1,143 additions and 2,917 deletions.
11 changes: 6 additions & 5 deletions src/CAREUI/display/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -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<TType = string> {
type: TType;
timestamp: string;
by: PerformedByModel | undefined;
by: UserBareMinimum | undefined;
icon: IconName;
iconStyle?: string;
iconWrapperStyle?: string;
Expand Down
1 change: 1 addition & 0 deletions src/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
"to_be_conducted": "To be conducted",
"total_amount": "Total Amount",
"total_beds": "Total Beds",
"total_staff": "Total Staff",
"total_users": "Total Users",
"transfer_in_progress": "TRANSFER IN PROGRESS",
"transfer_to_receiving_facility": "Transfer to receiving facility",
Expand Down
39 changes: 21 additions & 18 deletions src/PluginEngine.tsx
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -27,25 +27,28 @@ export default function PluginEngine({
);
}

export function PLUGIN_DoctorConnectButtons({
user,
}: {
user: UserAssignedModel;
}) {
type PluginProps<K extends keyof SupportedPluginComponents> =
React.ComponentProps<SupportedPluginComponents[K]>;

export function PLUGIN_Component<K extends keyof SupportedPluginComponents>({
__name,
...props
}: { __name: K } & PluginProps<K>) {
const plugins = useCareApps();

return (
<div>
{plugins.map((plugin, index) => {
const DoctorConnectButtons = plugin.components.DoctorConnectButtons;
if (!DoctorConnectButtons) {
<>
{plugins.map((plugin) => {
const Component = plugin.components[
__name
] as React.ComponentType<unknown>;

if (!Component) {
return null;
}
return (
<div key={index}>
<DoctorConnectButtons user={user} />
</div>
);

return <Component {...props} key={plugin.plugin} />;
})}
</div>
</>
);
}
159 changes: 22 additions & 137 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import {
BedModel,
CapacityModal,
CommentModel,
ConsultationModel,
CreateBedBody,
CurrentBed,
Expand All @@ -41,6 +42,8 @@ import {
PatientNotesModel,
PatientStatsModel,
PatientTransferResponse,
ResourceModel,
ShiftingModel,
StateModel,
WardModel,
} from "@/components/Facility/models";
Expand All @@ -50,7 +53,6 @@ import {
SampleReportModel,
SampleTestModel,
} from "@/components/Patient/models";
import { IComment, IResource } from "@/components/Resource/models";
import {
IDeleteBedCapacity,
ILocalBodies,
Expand All @@ -70,13 +72,8 @@ 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 { IShift } from "@/components/Shifting/models";
import { Investigation } from "@/components/Facility/Investigations/Reports/types";
import { PaginatedResponse } from "../Utils/request/types";
import {
Expand All @@ -103,7 +100,6 @@ import {
IHealthFacility,
IpartialUpdateHealthFacilityTBody,
} from "@/components/ABDM/types/health-facility";
import { PMJAYPackageItem } from "@/components/Common/PMJAYProcedurePackageAutocomplete";
import { InsurerOptionModel } from "@/components/HCX/InsurerAutocomplete";

/**
Expand Down Expand Up @@ -1059,14 +1055,14 @@ const routes = {
createShift: {
path: "/api/v1/shift/",
method: "POST",
TBody: Type<Partial<IShift>>(),
TBody: Type<Partial<ShiftingModel>>(),
TRes: Type<PatientModel>(),
},
updateShift: {
path: "/api/v1/shift/{id}/",
method: "PUT",
TBody: Type<IShift>(),
TRes: Type<IShift>(),
TBody: Type<ShiftingModel>(),
TRes: Type<ShiftingModel>(),
},
deleteShiftRecord: {
path: "/api/v1/shift/{id}/",
Expand All @@ -1076,17 +1072,17 @@ const routes = {
listShiftRequests: {
path: "/api/v1/shift/",
method: "GET",
TRes: Type<PaginatedResponse<IShift>>(),
TRes: Type<PaginatedResponse<ShiftingModel>>(),
},
getShiftDetails: {
path: "/api/v1/shift/{id}/",
method: "GET",
TRes: Type<IShift>(),
TRes: Type<ShiftingModel>(),
},
completeTransfer: {
path: "/api/v1/shift/{externalId}/transfer/",
method: "POST",
TBody: Type<IShift>(),
TBody: Type<ShiftingModel>(),
TRes: Type<Partial<PatientModel>>(),
},
downloadShiftRequests: {
Expand All @@ -1097,13 +1093,13 @@ const routes = {
getShiftComments: {
path: "/api/v1/shift/{id}/comment/",
method: "GET",
TRes: Type<PaginatedResponse<IComment>>(),
TRes: Type<PaginatedResponse<CommentModel>>(),
},
addShiftComments: {
path: "/api/v1/shift/{id}/comment/",
method: "POST",
TBody: Type<Partial<IComment>>(),
TRes: Type<IComment>(),
TBody: Type<Partial<CommentModel>>(),
TRes: Type<CommentModel>(),
},

// Notifications
Expand Down Expand Up @@ -1235,14 +1231,14 @@ const routes = {
createResource: {
path: "/api/v1/resource/",
method: "POST",
TRes: Type<IResource>(),
TBody: Type<Partial<IResource>>(),
TRes: Type<ResourceModel>(),
TBody: Type<Partial<ResourceModel>>(),
},
updateResource: {
path: "/api/v1/resource/{id}/",
method: "PUT",
TRes: Type<IResource>(),
TBody: Type<Partial<IResource>>(),
TRes: Type<ResourceModel>(),
TBody: Type<Partial<ResourceModel>>(),
},
deleteResourceRecord: {
path: "/api/v1/resource/{id}/",
Expand All @@ -1254,12 +1250,12 @@ const routes = {
listResourceRequests: {
path: "/api/v1/resource/",
method: "GET",
TRes: Type<PaginatedResponse<IResource>>(),
TRes: Type<PaginatedResponse<ResourceModel>>(),
},
getResourceDetails: {
path: "/api/v1/resource/{id}/",
method: "GET",
TRes: Type<IResource>(),
TRes: Type<ResourceModel>(),
},
downloadResourceRequests: {
path: "/api/v1/resource/",
Expand All @@ -1269,13 +1265,13 @@ const routes = {
getResourceComments: {
path: "/api/v1/resource/{id}/comment/",
method: "GET",
TRes: Type<PaginatedResponse<IComment>>(),
TRes: Type<PaginatedResponse<CommentModel>>(),
},
addResourceComments: {
path: "/api/v1/resource/{id}/comment/",
method: "POST",
TRes: Type<IComment>(),
TBody: Type<Partial<IComment>>(),
TRes: Type<CommentModel>(),
TBody: Type<Partial<CommentModel>>(),
},

// Assets endpoints
Expand Down Expand Up @@ -1695,117 +1691,6 @@ const routes = {
TRes: Type<HCXPolicyModel>(),
},
},

claims: {
list: {
path: "/api/hcx/claim/",
method: "GET",
TRes: Type<PaginatedResponse<HCXClaimModel>>(),
},

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<HCXClaimModel>(),
},

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<PMJAYPackageItem[]>(),
},

makeClaim: {
path: "/api/hcx/make_claim/",
method: "POST",
TBody: Type<{ claim: string }>(),
TRes: Type<unknown>(),
},
},

communications: {
list: {
path: "/api/hcx/communication/",
method: "GET",
TRes: Type<PaginatedResponse<HCXCommunicationModel>>(),
},

create: {
path: "/api/hcx/communication/",
method: "POST",
TRes: Type<HCXCommunicationModel>(),
TBody: Type<{
claim: string;
content: {
type: string;
data: string;
}[];
}>(),
},

get: {
path: "/api/hcx/communication/{external_id}/",
method: "GET",
TRes: Type<HCXCommunicationModel>(),
},

update: {
path: "/api/hcx/communication/{external_id}/",
method: "PUT",
TRes: Type<HCXCommunicationModel>(),
},

partialUpdate: {
path: "/api/hcx/communication/{external_id}/",
method: "PATCH",
TRes: Type<HCXCommunicationModel>(),
},

delete: {
path: "/api/hcx/communication/{external_id}/",
method: "DELETE",
},

send: {
path: "/api/hcx/send_communication/",
method: "POST",
TRes: Type<void>(),
TBody: Type<{
communication: string;
}>(),
},
},
},
} as const;

Expand Down
Loading

0 comments on commit 8a48d66

Please sign in to comment.