From 4f5ca89a850719637c75e616db3417f79eec7ed4 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 11 May 2023 11:24:28 +0530 Subject: [PATCH 01/20] added support for hcx communication --- package-lock.json | 14 +- src/CAREUI/icons/CareIcon.tsx | 9 +- src/Common/hooks/useConfig.ts | 2 +- .../Facility/ConsultationClaims.tsx | 16 +- src/Components/Facility/DischargeModal.tsx | 4 +- src/Components/HCX/ClaimCard.tsx | 42 +++++ src/Components/HCX/ClaimCardCommunication.tsx | 171 ++++++++++++++++++ ...{ClaimDetailCard.tsx => ClaimCardInfo.tsx} | 18 +- src/Components/HCX/SendCommunicationModal.tsx | 60 ++++++ src/Components/HCX/models.ts | 12 ++ src/Components/Patient/FileUpload.tsx | 54 +++--- src/Redux/actions.tsx | 35 +++- src/Redux/api.tsx | 35 ++++ vite.config.ts | 17 +- 14 files changed, 431 insertions(+), 58 deletions(-) create mode 100644 src/Components/HCX/ClaimCard.tsx create mode 100644 src/Components/HCX/ClaimCardCommunication.tsx rename src/Components/HCX/{ClaimDetailCard.tsx => ClaimCardInfo.tsx} (91%) create mode 100644 src/Components/HCX/SendCommunicationModal.tsx diff --git a/package-lock.json b/package-lock.json index 2e5afff360d..c1f9527279c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "raviger": "^4.1.2", "react": "18.2.0", "react-copy-to-clipboard": "^5.0.3", - "react-csv": "^2.1.9", + "react-csv": "^2.2.2", "react-csv-reader": "^3.5.2", "react-dates": "^21.8.0", "react-dnd": "^16.0.1", @@ -14348,9 +14348,9 @@ } }, "node_modules/react-csv": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.1.9.tgz", - "integrity": "sha512-p/2TakszTfa1qDCkcyGKa+3L+K5sARyNnE4pQ01p206WsD1qugcWfnM22MoUgFzVK2CPGzJPtiWpfPiM2OlJWw==" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" }, "node_modules/react-csv-reader": { "version": "3.5.2", @@ -27949,9 +27949,9 @@ } }, "react-csv": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.1.9.tgz", - "integrity": "sha512-p/2TakszTfa1qDCkcyGKa+3L+K5sARyNnE4pQ01p206WsD1qugcWfnM22MoUgFzVK2CPGzJPtiWpfPiM2OlJWw==" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" }, "react-csv-reader": { "version": "3.5.2", diff --git a/src/CAREUI/icons/CareIcon.tsx b/src/CAREUI/icons/CareIcon.tsx index a09a78162a7..dabe386965f 100644 --- a/src/CAREUI/icons/CareIcon.tsx +++ b/src/CAREUI/icons/CareIcon.tsx @@ -1,5 +1,5 @@ -import { useEffect } from "react"; import { transformIcons } from "./icon"; +import { useEffect } from "react"; export interface CareIconProps { className?: string | undefined; @@ -13,10 +13,13 @@ export interface CareIconProps { * * @see [icon library](https://iconscout.com/unicons/) */ -export default function CareIcon({ className }: CareIconProps) { +export default function CareIcon({ + className, + ...rest +}: CareIconProps & React.HTMLAttributes) { useEffect(() => transformIcons(), [className]); return ( - + ); diff --git a/src/Common/hooks/useConfig.ts b/src/Common/hooks/useConfig.ts index df0ce512912..ccd36557387 100644 --- a/src/Common/hooks/useConfig.ts +++ b/src/Common/hooks/useConfig.ts @@ -64,7 +64,7 @@ export interface IConfig { const useConfig = () => { const state: any = useSelector((state) => state); const { config } = state; - return config.data as IConfig; + return { ...config.data, enable_hcx: true } as IConfig; }; export default useConfig; diff --git a/src/Components/Facility/ConsultationClaims.tsx b/src/Components/Facility/ConsultationClaims.tsx index 77bf7e8410d..1df4f3288ac 100644 --- a/src/Components/Facility/ConsultationClaims.tsx +++ b/src/Components/Facility/ConsultationClaims.tsx @@ -1,13 +1,15 @@ +import * as Notification from "../../Utils/Notifications"; + import { useCallback, useEffect, useState } from "react"; -import { useDispatch } from "react-redux"; -import { HCXActions } from "../../Redux/actions"; -import PageTitle from "../Common/PageTitle"; -import ClaimDetailCard from "../HCX/ClaimDetailCard"; + +import ClaimCard from "../HCX/ClaimCard"; import CreateClaimCard from "../HCX/CreateClaimCard"; +import { HCXActions } from "../../Redux/actions"; import { HCXClaimModel } from "../HCX/models"; -import { useMessageListener } from "../../Common/hooks/useMessageListener"; +import PageTitle from "../Common/PageTitle"; import { navigate } from "raviger"; -import * as Notification from "../../Utils/Notifications"; +import { useDispatch } from "react-redux"; +import { useMessageListener } from "../../Common/hooks/useMessageListener"; interface Props { facilityId: string; @@ -83,7 +85,7 @@ export default function ConsultationClaims({
{claims?.map((claim) => (
- +
))}
diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 133895656a0..a96b3197160 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -11,7 +11,7 @@ import { useCallback, useEffect, useState } from "react"; import CareIcon from "../../CAREUI/icons/CareIcon"; import { CircularProgress } from "@material-ui/core"; -import ClaimDetailCard from "../HCX/ClaimDetailCard"; +import ClaimCard from "../HCX/ClaimCard"; import { ConsultationModel } from "./models"; import CreateClaimCard from "../HCX/CreateClaimCard"; import { DISCHARGE_REASONS } from "../../Common/constants"; @@ -329,7 +329,7 @@ const DischargeModal = ({

Claim Insurance

{latestClaim ? ( - + ) : ( (null); + + useLayoutEffect(() => { + if (cardContainerRef.current) { + setContainerDimensions({ + width: cardContainerRef.current.offsetWidth, + height: cardContainerRef.current.offsetHeight, + }); + } + }, [cardContainerRef]); + + console.log(containerDimensions); + + return showMessages ? ( +
+ +
+ ) : ( +
+ +
+ ); +} diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx new file mode 100644 index 00000000000..8644659d9f0 --- /dev/null +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -0,0 +1,171 @@ +import { HCXClaimModel, HCXCommunicationModel } from "./models"; +import { useCallback, useEffect, useRef, useState } from "react"; + +import ButtonV2 from "../Common/components/ButtonV2"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import { HCXActions } from "../../Redux/actions"; +import SendCommunicationModal from "./SendCommunicationModal"; +import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; +import { classNames } from "../../Utils/utils"; +import { useDispatch } from "react-redux"; + +interface IProps { + claim: HCXClaimModel; + setShowMessages: (show: boolean) => void; +} + +interface IMessage { + type?: string; + data?: string; + user?: string | null; + index?: number; +} + +export default function ClaimCardCommunication({ + claim, + setShowMessages, +}: IProps) { + const dispatch = useDispatch(); + const [messages, setMessages] = useState([]); + const [responses, setResponses] = useState([]); + const [inputText, setInputText] = useState(""); + const [createdCommunication, setCreatedCommunication] = + useState(); + const bottomRef = useRef(null); + + const fetchCommunications = useCallback(async () => { + const response = await dispatch( + HCXActions.communications.list({ + claim: claim.id, + ordering: "created_date", + }) + ); + + if (response.status === 200 && response.data) { + response.data.results?.forEach( + (communication: HCXCommunicationModel, i: number) => { + communication.content?.forEach((content) => + setMessages((prev) => [ + ...prev, + { ...content, user: communication.created_by, index: i }, + ]) + ); + } + ); + } + }, [claim.id, dispatch]); + + const handleSubmit = async () => { + const response = await dispatch( + HCXActions.communications.create({ + claim: claim.id, + content: responses.map((response) => ({ + type: response.type as string, + data: response.data as string, + })), + }) + ); + + console.log(response, response.status); + if (response.status === 201) { + setCreatedCommunication(response.data); //TODO: check if this is correct + } + }; + + useEffect(() => { + fetchCommunications(); + }, [fetchCommunications, createdCommunication]); + + useEffect(() => { + bottomRef.current?.scrollIntoView({ behavior: "smooth" }); + }, [responses]); + + return ( +
+ {createdCommunication && ( + { + setCreatedCommunication(undefined); + setResponses([]); + }} + /> + )} +
+ setShowMessages(false)} + className="care-l-info-circle w-7 h-7 text-gray-600 cursor-pointer hover:text-gray-800" + /> +
+ +
+ {messages.map((message) => ( +
+

+ {message.data} +

+
+ ))} + + {responses.map((message, i) => ( +
+

+ setResponses((prev) => prev.filter((_, j) => i !== j)) + } + className="group relative flex items-center justify-center gap-2 ml-2 py-3 px-4 text-white bg-blue-400 rounded-bl-3xl rounded-tl-3xl rounded-tr-xl hover:bg-red-400" + > + + {message.data} + + +

+
+ ))} + +
+
+
+ setInputText(e.value)} + placeholder="Enter a message" + rows={1} + className="w-full -mb-3" + /> + {inputText.length || !responses.length ? ( + { + setResponses((prev) => [ + ...prev, + { type: "text", data: inputText }, + ]); + setInputText(""); + }} + disabled={!inputText.length} + > + Add + + ) : ( + + Submit + + )} +
+
+ ); +} diff --git a/src/Components/HCX/ClaimDetailCard.tsx b/src/Components/HCX/ClaimCardInfo.tsx similarity index 91% rename from src/Components/HCX/ClaimDetailCard.tsx rename to src/Components/HCX/ClaimCardInfo.tsx index f44215b83e4..46a7be95f61 100644 --- a/src/Components/HCX/ClaimDetailCard.tsx +++ b/src/Components/HCX/ClaimCardInfo.tsx @@ -1,11 +1,14 @@ import { classNames, formatCurrency, formatDate } from "../../Utils/utils"; -import { HCXClaimModel } from "../HCX/models"; + +import CareIcon from "../../CAREUI/icons/CareIcon"; +import { HCXClaimModel } from "./models"; interface IProps { claim: HCXClaimModel; + setShowMessages: (show: boolean) => void; } -export default function ClaimDetailCard({ claim }: IProps) { +export default function ClaimCardInfo({ claim, setShowMessages }: IProps) { const status = claim.outcome === "Processing Complete" ? claim.error_text @@ -14,7 +17,7 @@ export default function ClaimDetailCard({ claim }: IProps) { : "Pending"; return ( -
+ <>

@@ -29,7 +32,12 @@ export default function ClaimDetailCard({ claim }: IProps) { .

-
+
+ setShowMessages(true)} + className="care-l-comment-alt-message w-7 h-7 text-gray-600 cursor-pointer hover:text-gray-800" + /> + {claim.use && ( {claim.use} @@ -157,6 +165,6 @@ export default function ClaimDetailCard({ claim }: IProps) { {claim.error_text}
)} -
+ ); } diff --git a/src/Components/HCX/SendCommunicationModal.tsx b/src/Components/HCX/SendCommunicationModal.tsx new file mode 100644 index 00000000000..16e5b570d2f --- /dev/null +++ b/src/Components/HCX/SendCommunicationModal.tsx @@ -0,0 +1,60 @@ +import * as Notification from "../../Utils/Notifications"; + +import CareIcon from "../../CAREUI/icons/CareIcon"; +import DialogModal from "../Common/Dialog"; +import { FileUpload } from "../Patient/FileUpload"; +import { HCXActions } from "../../Redux/actions"; +import { HCXCommunicationModel } from "./models"; +import { Submit } from "../Common/components/ButtonV2"; +import { useDispatch } from "react-redux"; +import { useState } from "react"; + +interface Props { + communication: HCXCommunicationModel; + show: boolean; + onClose: () => void; +} + +export default function SendCommunicationModal({ + communication, + ...props +}: Props) { + const dispatch = useDispatch(); + const [isLoading, setIsLoading] = useState(false); + + const handleSubmit = async () => { + setIsLoading(true); + + const res = await dispatch(HCXActions.sendCommunication(communication.id!)); + if (res.data) { + Notification.Success({ msg: "Message Sent" }); + props.onClose(); + } + + setIsLoading(false); + }; + + return ( + + {isLoading && } + {isLoading ? "Sending Message" : "Send Message"} + + } + > +
+ +
+
+ ); +} diff --git a/src/Components/HCX/models.ts b/src/Components/HCX/models.ts index 7e624c474d7..0b08a26b6ca 100644 --- a/src/Components/HCX/models.ts +++ b/src/Components/HCX/models.ts @@ -37,6 +37,18 @@ export interface HCXPolicyModel { 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; diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index 24550090819..f00f7d6792b 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -1,40 +1,42 @@ -import axios from "axios"; +import * as Notification from "../../Utils/Notifications.js"; + +import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2"; import { CircularProgress, InputLabel } from "@material-ui/core"; -import loadable from "@loadable/component"; -import React, { useCallback, useState, useEffect, useRef } from "react"; -import { useDispatch, useSelector } from "react-redux"; -import { statusType, useAbortableEffect } from "../../Common/utils"; +import React, { useCallback, useEffect, useRef, useState } from "react"; import { - viewUpload, - retrieveUpload, createUpload, - getPatient, editUpload, + getPatient, + retrieveUpload, + viewUpload, } from "../../Redux/actions"; +import { statusType, useAbortableEffect } from "../../Common/utils"; +import { useDispatch, useSelector } from "react-redux"; + +import AuthorizedChild from "../../CAREUI/misc/AuthorizedChild"; +import Box from "@material-ui/core/Box"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import DialogModal from "../Common/Dialog"; import { FileUploadModel } from "./models"; +import HeadedTabs from "../Common/HeadedTabs"; import { LegacyTextInputField } from "../Common/HelperInputFields"; import LinearProgress from "@material-ui/core/LinearProgress"; -import Typography from "@material-ui/core/Typography"; -import Box from "@material-ui/core/Box"; -import * as Notification from "../../Utils/Notifications.js"; -import { VoiceRecorder } from "../../Utils/VoiceRecorder"; import Modal from "@material-ui/core/Modal"; +import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; import Pagination from "../Common/Pagination"; import { RESULTS_PER_PAGE_LIMIT } from "../../Common/constants"; -import imageCompression from "browser-image-compression"; -import { formatDate } from "../../Utils/utils"; -import { useTranslation } from "react-i18next"; -import HeadedTabs from "../Common/HeadedTabs"; -import ButtonV2, { Cancel, Submit } from "../Common/components/ButtonV2"; -import DialogModal from "../Common/Dialog"; -import CareIcon from "../../CAREUI/icons/CareIcon"; -import TextFormField from "../Form/FormFields/TextFormField"; -import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; import RecordMeta from "../../CAREUI/display/RecordMeta"; +import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; +import TextFormField from "../Form/FormFields/TextFormField"; +import Typography from "@material-ui/core/Typography"; +import { VoiceRecorder } from "../../Utils/VoiceRecorder"; import Webcam from "react-webcam"; +import axios from "axios"; +import { formatDate } from "../../Utils/utils"; +import imageCompression from "browser-image-compression"; +import loadable from "@loadable/component"; +import { useTranslation } from "react-i18next"; import useWindowDimensions from "../../Common/hooks/useWindowDimensions"; -import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; -import AuthorizedChild from "../../CAREUI/misc/AuthorizedChild"; const Loading = loadable(() => import("../Common/Loading")); const PageTitle = loadable(() => import("../Common/PageTitle")); @@ -96,6 +98,7 @@ interface FileUploadProps { unspecified: boolean; sampleId?: number; claimId?: string; + communicationId?: string; } interface URLS { @@ -137,6 +140,7 @@ export const FileUpload = (props: FileUploadProps) => { unspecified, sampleId, claimId, + communicationId, } = props; const id = patientId; const dispatch: any = useDispatch(); @@ -286,12 +290,14 @@ export const FileUpload = (props: FileUploadProps) => { CONSULTATION: "Upload Consultation Files", SAMPLE_MANAGEMENT: "Upload Sample Report", CLAIM: "Upload Supporting Info", + COMMUNICATION: "Upload Supporting Info", }; const VIEW_HEADING: { [index: string]: string } = { PATIENT: "View Patient Files", CONSULTATION: "View Consultation Files", SAMPLE_MANAGEMENT: "View Sample Report", CLAIM: "Supporting Info", + COMMUNICATION: "Supporting Info", }; const handleClose = () => { @@ -315,6 +321,8 @@ export const FileUpload = (props: FileUploadProps) => { return sampleId; case "CLAIM": return claimId; + case "COMMUNICATION": + return communicationId; } }; diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx index ffe68356d8e..31011625dc4 100644 --- a/src/Redux/actions.tsx +++ b/src/Redux/actions.tsx @@ -1,4 +1,8 @@ -import { HCXClaimModel, HCXPolicyModel } from "../Components/HCX/models"; +import { + HCXClaimModel, + HCXCommunicationModel, + HCXPolicyModel, +} from "../Components/HCX/models"; import { fireRequest, fireRequestForFiles } from "./fireRequest"; export const getConfig = () => { @@ -891,6 +895,31 @@ export const HCXActions = { }, }, + communications: { + list(params: object) { + return fireRequest("listHCXCommunications", [], params); + }, + create(obj: HCXCommunicationModel) { + return fireRequest("createHCXCommunication", [], obj); + }, + read(id: string) { + return fireRequest("getHCXCommunication", [], {}, { external_id: id }); + }, + update(id: string, obj: HCXCommunicationModel) { + return fireRequest("updateHCXCommunication", [], obj, { + external_id: id, + }); + }, + partialUpdate(id: string, obj: Partial) { + return fireRequest("partialUpdateHCXCommunication", [], obj, { + external_id: id, + }); + }, + delete(id: string) { + return fireRequest("deleteHCXCommunication", [], {}, { external_id: id }); + }, + }, + preauths: { list(consultation: string) { return fireRequest( @@ -910,4 +939,8 @@ export const HCXActions = { makeClaim(claim: string) { return fireRequest("hcxMakeClaim", [], { claim }); }, + + sendCommunication(communication: string) { + return fireRequest("hcxSendCommunication", [], { communication }); + }, }; diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 1278a51ea6d..be71ea59426 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -880,6 +880,41 @@ const routes: Routes = { path: "/api/v1/hcx/make_claim/", method: "POST", }, + + listHCXCommunications: { + path: "/api/v1/hcx/communication/", + method: "GET", + }, + + createHCXCommunication: { + path: "/api/v1/hcx/communication/", + method: "POST", + }, + + getHCXCommunication: { + path: "/api/v1/hcx/communication/{external_id}/", + method: "GET", + }, + + updateHCXCommunication: { + path: "/api/v1/hcx/communication/{external_id}/", + method: "PUT", + }, + + partialUpdateHCXCommunication: { + path: "/api/v1/hcx/communication/{external_id}/", + method: "PATCH", + }, + + deleteHCXCommunication: { + path: "/api/v1/hcx/communication/{external_id}/", + method: "DELETE", + }, + + hcxSendCommunication: { + path: "/api/v1/hcx/send_communication/", + method: "POST", + }, }; export default routes; diff --git a/vite.config.ts b/vite.config.ts index c0bc2b91dcc..022070b9d92 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,21 +1,20 @@ +import { VitePWA } from "vite-plugin-pwa"; import { defineConfig } from "vite"; +import { promises as fs } from "fs"; import react from "@vitejs/plugin-react-swc"; -import { VitePWA } from "vite-plugin-pwa"; import { resolve } from "path"; -import { promises as fs } from "fs"; - export default defineConfig({ envPrefix: "REACT_", plugins: [ react(), VitePWA({ - strategies: 'injectManifest', - srcDir: 'src', - filename: 'service-worker.ts', + strategies: "injectManifest", + srcDir: "src", + filename: "service-worker.ts", injectRegister: null, injectManifest: { - maximumFileSizeToCacheInBytes: 7000000 + maximumFileSizeToCacheInBytes: 7000000, }, manifest: { name: "Care", @@ -38,7 +37,7 @@ export default defineConfig({ src: "https://cdn.coronasafe.network/care-manifest/images/icons/icon-512x512.png", sizes: "512x512", type: "image/png", - } + }, ], }, }), @@ -74,7 +73,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: "https://careapi.coronasafe.in", + target: "https://local.kha.vin", changeOrigin: true, }, }, From 6c8c618aca3115c6ee735b68f609e4f16c1750f2 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Thu, 15 Jun 2023 12:53:47 +0530 Subject: [PATCH 02/20] update proxy to carehcx-preview --- netlify.toml | 2 +- vercel.json | 2 +- vite.config.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index 56163a01ddc..372fdc60632 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,7 +9,7 @@ NODE_OPTIONS = "--max_old_space_size=4096" [[redirects]] from = "/api/*" -to = "https://careapi.coronasafe.in/api/:splat" +to = "https://carehcx-preview.ohc.network/api/:splat" status = 200 force = true diff --git a/vercel.json b/vercel.json index 7fe2608dbfe..456d3d07c3d 100644 --- a/vercel.json +++ b/vercel.json @@ -2,7 +2,7 @@ "rewrites": [ { "source": "/api/(.*)", - "destination": "https://careapi.coronasafe.in/api/$1" + "destination": "https://carehcx-preview.ohc.network/api/$1" }, { "source": "/(.*)", diff --git a/vite.config.ts b/vite.config.ts index 022070b9d92..a011239a5c4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -73,7 +73,7 @@ export default defineConfig({ port: 4000, proxy: { "/api": { - target: "https://local.kha.vin", + target: "https://carehcx-preview.ohc.network", changeOrigin: true, }, }, From e9493787a7f29abd854be86123aa241194e3b552 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Mon, 10 Jul 2023 20:49:00 +0530 Subject: [PATCH 03/20] Update netlify.toml --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 372fdc60632..69385a7ea86 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,7 +9,7 @@ NODE_OPTIONS = "--max_old_space_size=4096" [[redirects]] from = "/api/*" -to = "https://carehcx-preview.ohc.network/api/:splat" +to = "https://carehcxapi.coronasafe.in/api/:splat" status = 200 force = true From 1bde1f4810b42a7686a36ba52e3d14a186b0b6f9 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 6 Feb 2024 14:43:48 +0530 Subject: [PATCH 04/20] Update netlify.toml --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 69385a7ea86..56163a01ddc 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,7 +9,7 @@ NODE_OPTIONS = "--max_old_space_size=4096" [[redirects]] from = "/api/*" -to = "https://carehcxapi.coronasafe.in/api/:splat" +to = "https://careapi.coronasafe.in/api/:splat" status = 200 force = true From 09704134f5737ed7f9828069a7b5181fb0b0e283 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 19 Jul 2024 11:33:19 +0530 Subject: [PATCH 05/20] revert netlify backend proxy --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 1b3fa7af479..4ab805434f5 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,7 +9,7 @@ NODE_OPTIONS = "--max_old_space_size=4096" [[redirects]] from = "/api/*" -to = "https://careapi.coronasafe.in/api/:splat" +to = "https://careapi.ohc.network/api/:splat" status = 200 force = true From 2d85b159b8065179925417ba93f8e0a35feeb536 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 19 Jul 2024 11:42:01 +0530 Subject: [PATCH 06/20] fixed build errors --- src/Components/HCX/ClaimCardCommunication.tsx | 40 ++++++++++--------- src/Components/HCX/ClaimCardInfo.tsx | 3 +- src/Components/HCX/SendCommunicationModal.tsx | 2 +- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index 8644659d9f0..e8ac259b53a 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -38,7 +38,7 @@ export default function ClaimCardCommunication({ HCXActions.communications.list({ claim: claim.id, ordering: "created_date", - }) + }), ); if (response.status === 200 && response.data) { @@ -48,9 +48,9 @@ export default function ClaimCardCommunication({ setMessages((prev) => [ ...prev, { ...content, user: communication.created_by, index: i }, - ]) + ]), ); - } + }, ); } }, [claim.id, dispatch]); @@ -63,7 +63,7 @@ export default function ClaimCardCommunication({ type: response.type as string, data: response.data as string, })), - }) + }), ); console.log(response, response.status); @@ -81,7 +81,7 @@ export default function ClaimCardCommunication({ }, [responses]); return ( -
+
{createdCommunication && ( setShowMessages(false)} - className="care-l-info-circle w-7 h-7 text-gray-600 cursor-pointer hover:text-gray-800" />
-
+
{messages.map((message) => (

{message.data} @@ -121,31 +122,34 @@ export default function ClaimCardCommunication({ ))} {responses.map((message, i) => ( -

+

setResponses((prev) => prev.filter((_, j) => i !== j)) } - className="group relative flex items-center justify-center gap-2 ml-2 py-3 px-4 text-white bg-blue-400 rounded-bl-3xl rounded-tl-3xl rounded-tr-xl hover:bg-red-400" + className="group relative ml-2 flex items-center justify-center gap-2 rounded-bl-3xl rounded-tl-3xl rounded-tr-xl bg-blue-400 px-4 py-3 text-white hover:bg-red-400" > - + {message.data} - +

))}
-
+
setInputText(e.value)} placeholder="Enter a message" rows={1} - className="w-full -mb-3" + className="-mb-3 w-full" /> {inputText.length || !responses.length ? (
setShowMessages(true)} - className="care-l-comment-alt-message h-7 w-7 cursor-pointer text-gray-600 hover:text-gray-800" /> {claim.use && ( diff --git a/src/Components/HCX/SendCommunicationModal.tsx b/src/Components/HCX/SendCommunicationModal.tsx index 16e5b570d2f..66c77c3f2dd 100644 --- a/src/Components/HCX/SendCommunicationModal.tsx +++ b/src/Components/HCX/SendCommunicationModal.tsx @@ -42,7 +42,7 @@ export default function SendCommunicationModal({ className="w-full max-w-screen-lg" titleAction={ - {isLoading && } + {isLoading && } {isLoading ? "Sending Message" : "Send Message"} } From 6a346ec1af818223397c1b06f79d1d799d9468a5 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 19 Jul 2024 17:04:34 +0530 Subject: [PATCH 07/20] migrated from useDispatch to useQuery --- .../Facility/ConsultationClaims.tsx | 51 +++++++------- src/Components/HCX/ClaimCard.tsx | 4 +- src/Components/HCX/ClaimCardCommunication.tsx | 66 +++++++++---------- src/Components/HCX/CreateClaimCard.tsx | 2 - src/Components/HCX/SendCommunicationModal.tsx | 16 +++-- src/Components/Patient/FileUpload.tsx | 24 +++---- src/Redux/actions.tsx | 35 +--------- src/Redux/api.tsx | 23 ++++++- 8 files changed, 102 insertions(+), 119 deletions(-) diff --git a/src/Components/Facility/ConsultationClaims.tsx b/src/Components/Facility/ConsultationClaims.tsx index 214aae88aed..c9d617e795c 100644 --- a/src/Components/Facility/ConsultationClaims.tsx +++ b/src/Components/Facility/ConsultationClaims.tsx @@ -1,15 +1,14 @@ import * as Notification from "../../Utils/Notifications"; -import { useCallback, useEffect, useState } from "react"; +import { useState } from "react"; import ClaimCard from "../HCX/ClaimCard"; import CreateClaimCard from "../HCX/CreateClaimCard"; -import { HCXActions } from "../../Redux/actions"; -import { HCXClaimModel } from "../HCX/models"; import PageTitle from "../Common/PageTitle"; import { navigate } from "raviger"; -import { useDispatch } from "react-redux"; import { useMessageListener } from "../../Common/hooks/useMessageListener"; +import useQuery from "../../Utils/request/useQuery"; +import routes from "../../Redux/api"; interface Props { facilityId: string; @@ -22,32 +21,28 @@ export default function ConsultationClaims({ consultationId, patientId, }: Props) { - const dispatch = useDispatch(); - const [claims, setClaims] = useState(); const [isCreateLoading, setIsCreateLoading] = useState(false); - const fetchClaims = useCallback(async () => { - const res = await dispatch( - HCXActions.claims.list({ + const { data: claimsResult, refetch: refetchClaims } = useQuery( + routes.listHCXClaims, + { + query: { ordering: "-modified_date", consultation: consultationId, - }), - ); - - if (res.data && res.data.results) { - setClaims(res.data.results); - if (isCreateLoading) - Notification.Success({ msg: "Fetched Claim Approval Results" }); - } else { - if (isCreateLoading) - Notification.Success({ msg: "Error Fetched Claim Approval Results" }); - } - setIsCreateLoading(false); - }, [dispatch, consultationId]); - - useEffect(() => { - fetchClaims(); - }, [fetchClaims]); + }, + onResponse: (res) => { + if (res.data && res.data.results) { + if (isCreateLoading) + Notification.Success({ msg: "Fetched Claim Approval Results" }); + } else { + if (isCreateLoading) + Notification.Error({ + msg: "Error Fetching Claim Approval Results", + }); + } + }, + }, + ); useMessageListener((data) => { if ( @@ -55,7 +50,7 @@ export default function ConsultationClaims({ (data.from === "claim/on_submit" || data.from === "preauth/on_submit") && data.message === "success" ) { - fetchClaims(); + refetchClaims(); } }); @@ -83,7 +78,7 @@ export default function ConsultationClaims({
- {claims?.map((claim) => ( + {claimsResult?.results.map((claim) => (
diff --git a/src/Components/HCX/ClaimCard.tsx b/src/Components/HCX/ClaimCard.tsx index 2b5ff4daa58..75c8b6a8a23 100644 --- a/src/Components/HCX/ClaimCard.tsx +++ b/src/Components/HCX/ClaimCard.tsx @@ -25,10 +25,8 @@ export default function ClaimCard({ claim }: IProps) { } }, [cardContainerRef]); - console.log(containerDimensions); - return showMessages ? ( -
+
) : ( diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index e8ac259b53a..7b34cdb377f 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -1,13 +1,14 @@ import { HCXClaimModel, HCXCommunicationModel } from "./models"; -import { useCallback, useEffect, useRef, useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import ButtonV2 from "../Common/components/ButtonV2"; import CareIcon from "../../CAREUI/icons/CareIcon"; -import { HCXActions } from "../../Redux/actions"; import SendCommunicationModal from "./SendCommunicationModal"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; import { classNames } from "../../Utils/utils"; -import { useDispatch } from "react-redux"; +import routes from "../../Redux/api"; +import useQuery from "../../Utils/request/useQuery"; +import request from "../../Utils/request/request"; interface IProps { claim: HCXClaimModel; @@ -25,56 +26,55 @@ export default function ClaimCardCommunication({ claim, setShowMessages, }: IProps) { - const dispatch = useDispatch(); - const [messages, setMessages] = useState([]); const [responses, setResponses] = useState([]); const [inputText, setInputText] = useState(""); const [createdCommunication, setCreatedCommunication] = useState(); const bottomRef = useRef(null); - const fetchCommunications = useCallback(async () => { - const response = await dispatch( - HCXActions.communications.list({ + const { data: communicationsResult, refetch: refetchCommunications } = + useQuery(routes.listHCXCommunications, { + query: { claim: claim.id, ordering: "created_date", - }), - ); + }, + }); - if (response.status === 200 && response.data) { - response.data.results?.forEach( - (communication: HCXCommunicationModel, i: number) => { - communication.content?.forEach((content) => - setMessages((prev) => [ - ...prev, - { ...content, user: communication.created_by, index: i }, - ]), - ); - }, - ); - } - }, [claim.id, dispatch]); + const messages = useMemo(() => { + return ( + (communicationsResult?.results + ?.flatMap((communication, i) => { + return communication.content?.map((content) => ({ + ...content, + user: communication.created_by, + index: i, + })); + }) + .filter(Boolean) as IMessage[]) ?? [] + ); + }, [communicationsResult]); const handleSubmit = async () => { - const response = await dispatch( - HCXActions.communications.create({ + if (!claim.id) return; + + const { res, data } = await request(routes.createHCXCommunication, { + body: { claim: claim.id, content: responses.map((response) => ({ type: response.type as string, data: response.data as string, })), - }), - ); + }, + }); - console.log(response, response.status); - if (response.status === 201) { - setCreatedCommunication(response.data); //TODO: check if this is correct + if (res?.status === 201) { + setCreatedCommunication(data); } }; useEffect(() => { - fetchCommunications(); - }, [fetchCommunications, createdCommunication]); + refetchCommunications(); + }, [refetchCommunications, createdCommunication]); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: "smooth" }); @@ -101,7 +101,7 @@ export default function ClaimCardCommunication({
- {messages.map((message) => ( + {messages?.map((message) => (
(); const [use_, setUse_] = useState(use); - console.log(items); - useEffect(() => { async function autoFill() { const latestApprovedPreAuthsRes = await dispatch( diff --git a/src/Components/HCX/SendCommunicationModal.tsx b/src/Components/HCX/SendCommunicationModal.tsx index 66c77c3f2dd..9454d3f57e3 100644 --- a/src/Components/HCX/SendCommunicationModal.tsx +++ b/src/Components/HCX/SendCommunicationModal.tsx @@ -3,11 +3,11 @@ import * as Notification from "../../Utils/Notifications"; import CareIcon from "../../CAREUI/icons/CareIcon"; import DialogModal from "../Common/Dialog"; import { FileUpload } from "../Patient/FileUpload"; -import { HCXActions } from "../../Redux/actions"; import { HCXCommunicationModel } from "./models"; import { Submit } from "../Common/components/ButtonV2"; -import { useDispatch } from "react-redux"; import { useState } from "react"; +import request from "../../Utils/request/request"; +import routes from "../../Redux/api"; interface Props { communication: HCXCommunicationModel; @@ -19,14 +19,18 @@ export default function SendCommunicationModal({ communication, ...props }: Props) { - const dispatch = useDispatch(); const [isLoading, setIsLoading] = useState(false); const handleSubmit = async () => { setIsLoading(true); - const res = await dispatch(HCXActions.sendCommunication(communication.id!)); - if (res.data) { + const { res } = await request(routes.hcxSendCommunication, { + body: { + communication: communication.id, + }, + }); + + if (res?.ok) { Notification.Success({ msg: "Message Sent" }); props.onClose(); } @@ -50,7 +54,7 @@ export default function SendCommunicationModal({
diff --git a/src/Components/Patient/FileUpload.tsx b/src/Components/Patient/FileUpload.tsx index 5f129ade216..6e0926089c0 100644 --- a/src/Components/Patient/FileUpload.tsx +++ b/src/Components/Patient/FileUpload.tsx @@ -101,9 +101,9 @@ export const LinearProgressWithLabel = (props: any) => { interface FileUploadProps { type: string; - patientId?: any; - facilityId?: any; - consultationId?: any; + patientId?: string; + facilityId?: string; + consultationId?: string; consentId?: string; hideBack: boolean; audio?: boolean; @@ -257,12 +257,12 @@ export const FileUpload = (props: FileUploadProps) => { }, []); const { data: patient } = useQuery(routes.getPatient, { - pathParams: { id: patientId }, + pathParams: { id: patientId! }, prefetch: !!patientId, }); const { data: consultation } = useQuery(routes.getConsultation, { - pathParams: { id: consultationId }, + pathParams: { id: consultationId! }, prefetch: !!consultationId, }); @@ -560,7 +560,7 @@ export const FileUpload = (props: FileUploadProps) => { pathParams: { id, fileType, - associatingId: getAssociatedId(), + associatingId: getAssociatedId()!, }, }); @@ -583,7 +583,7 @@ export const FileUpload = (props: FileUploadProps) => { pathParams: { id, fileType: type, - associatingId: getAssociatedId(), + associatingId: getAssociatedId()!, }, }); @@ -1046,7 +1046,7 @@ export const FileUpload = (props: FileUploadProps) => { pathParams: { id: data.id, fileType: type, - associatingId: getAssociatedId(), + associatingId: getAssociatedId()!, }, }); }; @@ -1065,7 +1065,7 @@ export const FileUpload = (props: FileUploadProps) => { original_name: name ?? "", file_type: type, name: filename, - associating_id: getAssociatedId(), + associating_id: getAssociatedId()!, file_category: category, mime_type: f?.type ?? "", }, @@ -1150,7 +1150,7 @@ export const FileUpload = (props: FileUploadProps) => { original_name: name, file_type: type, name: filename, - associating_id: getAssociatedId(), + associating_id: getAssociatedId()!, file_category: category, mime_type: audioBlob?.type ?? "", }, @@ -1495,8 +1495,8 @@ export const FileUpload = (props: FileUploadProps) => { hideBack={hideBack} breadcrumbs={false} crumbsReplacements={{ - [facilityId]: { name: patient?.facility_object?.name }, - [patientId]: { name: patient?.name }, + [facilityId!]: { name: patient?.facility_object?.name }, + [patientId!]: { name: patient?.name }, }} backUrl={ type === "CONSULTATION" diff --git a/src/Redux/actions.tsx b/src/Redux/actions.tsx index a9d450f76dd..6f064fc3a32 100644 --- a/src/Redux/actions.tsx +++ b/src/Redux/actions.tsx @@ -1,8 +1,4 @@ -import { - HCXClaimModel, - HCXCommunicationModel, - HCXPolicyModel, -} from "../Components/HCX/models"; +import { HCXClaimModel, HCXPolicyModel } from "../Components/HCX/models"; import { fireRequest } from "./fireRequest"; // Facility @@ -172,31 +168,6 @@ export const HCXActions = { }, }, - communications: { - list(params: object) { - return fireRequest("listHCXCommunications", [], params); - }, - create(obj: HCXCommunicationModel) { - return fireRequest("createHCXCommunication", [], obj); - }, - read(id: string) { - return fireRequest("getHCXCommunication", [], {}, { external_id: id }); - }, - update(id: string, obj: HCXCommunicationModel) { - return fireRequest("updateHCXCommunication", [], obj, { - external_id: id, - }); - }, - partialUpdate(id: string, obj: Partial) { - return fireRequest("partialUpdateHCXCommunication", [], obj, { - external_id: id, - }); - }, - delete(id: string) { - return fireRequest("deleteHCXCommunication", [], {}, { external_id: id }); - }, - }, - preauths: { list(consultation: string) { return fireRequest( @@ -216,8 +187,4 @@ export const HCXActions = { makeClaim(claim: string) { return fireRequest("hcxMakeClaim", [], { claim }); }, - - sendCommunication(communication: string) { - return fireRequest("hcxSendCommunication", [], { communication }); - }, }; diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index a24b94d6427..3ef39fae5ed 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -92,7 +92,11 @@ import { NotificationData, PNconfigData, } from "../Components/Notifications/models"; -import { HCXPolicyModel } from "../Components/HCX/models"; +import { + HCXClaimModel, + HCXCommunicationModel, + 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"; @@ -1627,6 +1631,7 @@ const routes = { listHCXClaims: { path: "/api/v1/hcx/claim/", method: "GET", + TRes: Type>(), }, createHCXClaim: { @@ -1662,26 +1667,38 @@ const routes = { listHCXCommunications: { path: "/api/v1/hcx/communication/", method: "GET", + TRes: Type>(), }, createHCXCommunication: { path: "/api/v1/hcx/communication/", method: "POST", + TRes: Type(), + TBody: Type<{ + claim: string; + content: { + type: string; + data: string; + }[]; + }>(), }, getHCXCommunication: { path: "/api/v1/hcx/communication/{external_id}/", method: "GET", + TRes: Type(), }, updateHCXCommunication: { path: "/api/v1/hcx/communication/{external_id}/", method: "PUT", + TRes: Type(), }, partialUpdateHCXCommunication: { path: "/api/v1/hcx/communication/{external_id}/", method: "PATCH", + TRes: Type(), }, deleteHCXCommunication: { @@ -1692,6 +1709,10 @@ const routes = { hcxSendCommunication: { path: "/api/v1/hcx/send_communication/", method: "POST", + TRes: Type(), + TBody: Type<{ + communication: string; + }>(), }, } as const; From 7ca6865a54ec966132a9e811d3d7cbcbee0b98f4 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Wed, 31 Jul 2024 15:10:59 +0530 Subject: [PATCH 08/20] enable hcx --- public/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/config.json b/public/config.json index dd35eee6420..88ad2cdf5c8 100644 --- a/public/config.json +++ b/public/config.json @@ -22,7 +22,7 @@ "sample_format_asset_import": "/asset-import-template.xlsx", "sample_format_external_result_import": "/External-Results-Template.csv", "enable_abdm": true, - "enable_hcx": false, + "enable_hcx": true, "enable_scribe": false, "min_encounter_date": "2020-01-01" } \ No newline at end of file From 92b567ecf942a51abc4f118f8bdca8ddfd6f1555 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Wed, 31 Jul 2024 15:17:04 +0530 Subject: [PATCH 09/20] fixed build errors --- src/Components/Facility/DischargeModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index d845420b0df..ce21c8ecd71 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -390,7 +390,7 @@ const DischargeModal = ({

Claim Insurance

{latestClaim ? ( - + ) : ( Date: Wed, 31 Jul 2024 15:21:42 +0530 Subject: [PATCH 10/20] fixed hcx routes --- src/Routers/AppRouter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Routers/AppRouter.tsx b/src/Routers/AppRouter.tsx index bba3bd04899..422dfe6804f 100644 --- a/src/Routers/AppRouter.tsx +++ b/src/Routers/AppRouter.tsx @@ -64,7 +64,7 @@ export default function AppRouter() { let routes = Routes; if (enable_hcx) { - routes = { ...routes, ...HCXRoutes }; + routes = { ...HCXRoutes, ...routes }; } if ( From 769c4837163b1d0ccdf5076ac7e86b601053983a Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Sun, 4 Aug 2024 13:53:47 +0530 Subject: [PATCH 11/20] added multiple file support in useFileUpload hook --- .../Patient/PatientConsentRecords.tsx | 6 +- src/Utils/useFileUpload.tsx | 189 ++++++++++-------- 2 files changed, 110 insertions(+), 85 deletions(-) diff --git a/src/Components/Patient/PatientConsentRecords.tsx b/src/Components/Patient/PatientConsentRecords.tsx index a8b94f2d041..f4e20e2a3d8 100644 --- a/src/Components/Patient/PatientConsentRecords.tsx +++ b/src/Components/Patient/PatientConsentRecords.tsx @@ -179,11 +179,11 @@ export default function PatientConsentRecords(props: { fileUpload.setFileName(e.value)} />
- {fileUpload.file ? ( + {fileUpload.files[0] ? ( <> { @@ -213,7 +213,7 @@ export default function PatientConsentRecords(props: { diff --git a/src/Utils/useFileUpload.tsx b/src/Utils/useFileUpload.tsx index f072d66d6bc..708cf61c622 100644 --- a/src/Utils/useFileUpload.tsx +++ b/src/Utils/useFileUpload.tsx @@ -19,6 +19,7 @@ import imageCompression from "browser-image-compression"; import { DEFAULT_ALLOWED_EXTENSIONS } from "../Common/constants"; export type FileUploadOptions = { + multiple?: boolean; type: string; category?: FileCategory; onUpload?: (file: FileUploadModel) => void; @@ -35,6 +36,7 @@ export type FileUploadButtonProps = { icon?: IconName; content?: string; className?: string; + children?: React.ReactNode; }; export type FileUploadReturn = { @@ -45,10 +47,12 @@ export type FileUploadReturn = { handleFileUpload: (associating_id: string) => Promise; Dialogues: JSX.Element; UploadButton: (_: FileUploadButtonProps) => JSX.Element; - fileName: string; - file: File | null; - setFileName: (name: string) => void; - clearFile: () => void; + fileNames: string[]; + files: File[]; + setFileName: (names: string, index?: number) => void; + setFileNames: (names: string[]) => void; + removeFile: (index: number) => void; + clearFiles: () => void; }; const videoConstraints = { @@ -72,16 +76,16 @@ const ExtImage: string[] = [ export default function useFileUpload( options: FileUploadOptions, ): FileUploadReturn { - const { type, onUpload, category = "UNSPECIFIED" } = options; + const { type, onUpload, category = "UNSPECIFIED", multiple } = options; - const [uploadFileName, setUploadFileName] = useState(""); + const [uploadFileNames, setUploadFileNames] = useState([]); const [error, setError] = useState(null); const [progress, setProgress] = useState(null); const [cameraModalOpen, setCameraModalOpen] = useState(false); const [cameraFacingFront, setCameraFacingFront] = useState(true); const webRef = useRef(null); const [previewImage, setPreviewImage] = useState(null); - const [file, setFile] = useState(null); + const [files, setFiles] = useState([]); const handleSwitchCamera = useCallback(() => { setCameraFacingFront((prevState) => !prevState); @@ -99,8 +103,8 @@ export default function useFileUpload( const myFile = new File([blob], `capture.${extension}`, { type: blob.type, }); - setUploadFileName(uploadFileName || ""); - setFile(myFile); + setUploadFileNames((prev) => [...prev, `capture.${extension}`]); + setFiles((prev) => [...prev, myFile]); }); }; @@ -108,57 +112,56 @@ export default function useFileUpload( if (!e.target.files?.length) { return; } - const f = e.target.files[0]; - const fileName = f.name; - setFile(e.target.files[0]); - setUploadFileName( - uploadFileName || - fileName.substring(0, fileName.lastIndexOf(".")) || - fileName, - ); + const selectedFiles = Array.from(e.target.files); + const fileNames = selectedFiles.map((file) => file.name); + setFiles((prev) => [...prev, ...selectedFiles]); + setUploadFileNames((prev) => [...prev, ...fileNames]); - const ext: string = fileName.split(".")[1]; - - if (ExtImage.includes(ext)) { - const options = { - initialQuality: 0.6, - alwaysKeepResolution: true, - }; - imageCompression(f, options).then((compressedFile: File) => { - setFile(compressedFile); - }); - return; - } - setFile(f); + selectedFiles.forEach((file) => { + const ext: string = file.name.split(".")[1]; + if (ExtImage.includes(ext)) { + const options = { + initialQuality: 0.6, + alwaysKeepResolution: true, + }; + imageCompression(file, options).then((compressedFile: File) => { + setFiles((prev) => + prev.map((f) => (f.name === file.name ? compressedFile : f)), + ); + }); + } + }); }; const validateFileUpload = () => { - const filenameLength = uploadFileName.trim().length; - const f = file; - if (f === undefined || f === null) { - setError("Please choose a file to upload"); - return false; - } - if (filenameLength === 0) { - setError("Please give a name !!"); - return false; - } - if (f.size > 10e7) { - setError("Maximum size of files is 100 MB"); + if (files.length === 0) { + setError("Please choose files to upload"); return false; } - const extension = f.name.split(".").pop(); - if ( - "allowedExtensions" in options && - !options.allowedExtensions?.includes(extension || "") - ) { - setError( - `Invalid file type ".${extension}" Allowed types: ${options.allowedExtensions?.join(", ")}`, - ); - return false; + for (const file of files) { + const filenameLength = file.name.trim().length; + if (filenameLength === 0) { + setError("Please give a name for all files!"); + return false; + } + if (file.size > 10e7) { + setError("Maximum size of files is 100 MB"); + return false; + } + const extension = file.name.split(".").pop(); + if ( + "allowedExtensions" in options && + !options.allowedExtensions?.includes(extension || "") + ) { + setError( + `Invalid file type ".${extension}" Allowed types: ${options.allowedExtensions?.join(", ")}`, + ); + return false; + } } return true; }; + const markUploadComplete = ( data: CreateFileResponse, associatingId: string, @@ -173,24 +176,20 @@ export default function useFileUpload( }); }; - const uploadfile = async (data: CreateFileResponse) => { + const uploadfile = async (data: CreateFileResponse, file: File) => { const url = data.signed_url; const internal_name = data.internal_name; - const f = file; - if (!f) return; - const newFile = new File([f], `${internal_name}`); + const newFile = new File([file], `${internal_name}`); console.log("filetype: ", newFile.type); return new Promise((resolve, reject) => { uploadFile( url, newFile, "PUT", - { "Content-Type": file?.type }, + { "Content-Type": file.type }, (xhr: XMLHttpRequest) => { if (xhr.status >= 200 && xhr.status < 300) { setProgress(null); - setFile(null); - setUploadFileName(""); Notification.Success({ msg: "File Uploaded Successfully", }); @@ -219,27 +218,34 @@ export default function useFileUpload( const handleUpload = async (associating_id: string) => { if (!validateFileUpload()) return; - const f = file; - const filename = uploadFileName === "" && f ? f.name : uploadFileName; - const name = f?.name; setProgress(0); - const { data } = await request(routes.createUpload, { - body: { - original_name: name ?? "", - file_type: type, - name: filename, - associating_id, - file_category: category, - mime_type: f?.type ?? "", - }, - }); + for (const [index, file] of files.entries()) { + const filename = + uploadFileNames[index] === "" && file + ? file.name + : uploadFileNames[index]; + + const { data } = await request(routes.createUpload, { + body: { + original_name: file.name ?? "", + file_type: type, + name: filename, + associating_id, + file_category: category, + mime_type: file.type ?? "", + }, + }); - if (data) { - await uploadfile(data); - await markUploadComplete(data, associating_id); + if (data) { + await uploadfile(data, file); + await markUploadComplete(data, associating_id); + } } + + setFiles([]); + setUploadFileNames([]); }; const cameraFacingMode = cameraFacingFront @@ -417,13 +423,23 @@ export default function useFileUpload( props.className, )} > - - {props.content || t("choose_file")} + {props.children ? ( + props.children + ) : ( + <> + + {props.content || t("choose_file")} + + )} { - setFile(null); - setUploadFileName(""); + fileNames: uploadFileNames, + files: files, + setFileNames: setUploadFileNames, + setFileName: (name: string, index = 0) => { + setUploadFileNames((prev) => + prev.map((n, i) => (i === index ? name : n)), + ); + }, + removeFile: (index = 0) => { + setFiles((prev) => prev.filter((_, i) => i !== index)); + setUploadFileNames((prev) => prev.filter((_, i) => i !== index)); + }, + clearFiles: () => { + setFiles([]); + setUploadFileNames([]); }, }; } From b45ec9aad6e60e634292900029833fd92703b986 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Sun, 4 Aug 2024 13:54:52 +0530 Subject: [PATCH 12/20] altered the hcx communication flow, add text message and upload files in a single step --- src/Components/HCX/ClaimCardCommunication.tsx | 180 ++++++++++-------- src/Locale/en/Common.json | 4 +- 2 files changed, 108 insertions(+), 76 deletions(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index 7b34cdb377f..87746ef509c 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -1,13 +1,15 @@ -import { HCXClaimModel, HCXCommunicationModel } from "./models"; -import { useEffect, useMemo, useRef, useState } from "react"; +import { HCXClaimModel } from "./models"; +import { useMemo, useRef, useState } from "react"; +import * as Notification from "../../Utils/Notifications"; import ButtonV2 from "../Common/components/ButtonV2"; import CareIcon from "../../CAREUI/icons/CareIcon"; -import SendCommunicationModal from "./SendCommunicationModal"; import TextAreaFormField from "../Form/FormFields/TextAreaFormField"; import { classNames } from "../../Utils/utils"; import routes from "../../Redux/api"; import useQuery from "../../Utils/request/useQuery"; +import { useTranslation } from "react-i18next"; +import useFileUpload from "../../Utils/useFileUpload"; import request from "../../Utils/request/request"; interface IProps { @@ -26,12 +28,18 @@ export default function ClaimCardCommunication({ claim, setShowMessages, }: IProps) { - const [responses, setResponses] = useState([]); + const { t } = useTranslation(); const [inputText, setInputText] = useState(""); - const [createdCommunication, setCreatedCommunication] = - useState(); + const [isSendingCommunication, setIsSendingCommunication] = useState(false); const bottomRef = useRef(null); + const { UploadButton, files, removeFile, clearFiles, handleFileUpload } = + useFileUpload({ + multiple: true, + type: "COMMUNICATION", + allowedExtensions: ["pdf", "jpg", "jpeg", "png"], + }); + const { data: communicationsResult, refetch: refetchCommunications } = useQuery(routes.listHCXCommunications, { query: { @@ -57,41 +65,48 @@ export default function ClaimCardCommunication({ const handleSubmit = async () => { if (!claim.id) return; + setIsSendingCommunication(true); + const { res, data } = await request(routes.createHCXCommunication, { body: { claim: claim.id, - content: responses.map((response) => ({ - type: response.type as string, - data: response.data as string, - })), + content: [ + { + type: "text", + data: inputText, + }, + ], }, }); - if (res?.status === 201) { - setCreatedCommunication(data); - } - }; + if (res?.status === 201 && data) { + await handleFileUpload(data.id as string); + + const { res } = await request(routes.hcxSendCommunication, { + body: { + communication: data.id, + }, + }); - useEffect(() => { - refetchCommunications(); - }, [refetchCommunications, createdCommunication]); + if (res?.ok) { + Notification.Success({ msg: "Sent communication to HCX" }); - useEffect(() => { - bottomRef.current?.scrollIntoView({ behavior: "smooth" }); - }, [responses]); + await refetchCommunications(); + + setInputText(""); + clearFiles(); + + bottomRef.current?.scrollIntoView({ behavior: "smooth", block: "end" }); + } else { + Notification.Error({ msg: "Error sending communication to HCX" }); + } + } + + setIsSendingCommunication(false); + }; return (
- {createdCommunication && ( - { - setCreatedCommunication(undefined); - setResponses([]); - }} - /> - )}
))} - {responses.map((message, i) => ( -
-

- setResponses((prev) => prev.filter((_, j) => i !== j)) - } - className="group relative ml-2 flex items-center justify-center gap-2 rounded-bl-3xl rounded-tl-3xl rounded-tr-xl bg-blue-400 px-4 py-3 text-white hover:bg-red-400" - > - - {message.data} - - -

-
- ))} -
- setInputText(e.value)} - placeholder="Enter a message" - rows={1} - className="-mb-3 w-full" - /> - {inputText.length || !responses.length ? ( - { - setResponses((prev) => [ - ...prev, - { type: "text", data: inputText }, - ]); - setInputText(""); - }} - disabled={!inputText.length} - > - Add - - ) : ( - - Submit - - )} +
+
+ {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" + /> +
+ + + + + {t("send_message")} +
); diff --git a/src/Locale/en/Common.json b/src/Locale/en/Common.json index 89faf842586..8209ffec18f 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -176,5 +176,7 @@ "caution": "Caution", "feed_optimal_experience_for_phones": "For optimal viewing experience, consider rotating your device.", "feed_optimal_experience_for_apple_phones": "For optimal viewing experience, consider rotating your device. Ensure auto-rotate is enabled in your device settings.", - "action_irreversible": "This action is irreversible" + "action_irreversible": "This action is irreversible", + "send_message": "Send Message", + "enter_message": "Start typing your message..." } From 36bbd3169d194a293517d4c43d8ddd2a8b0ac882 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Sun, 4 Aug 2024 14:58:45 +0530 Subject: [PATCH 13/20] added view attachments feature in hcx communications --- src/Components/HCX/ClaimCardCommunication.tsx | 193 +++++++++++++----- src/Locale/en/Common.json | 5 +- 2 files changed, 148 insertions(+), 50 deletions(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index 87746ef509c..e5e28ae1f30 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -1,5 +1,5 @@ -import { HCXClaimModel } from "./models"; -import { useMemo, useRef, useState } from "react"; +import { HCXClaimModel, HCXCommunicationModel } from "./models"; +import { useState } from "react"; import * as Notification from "../../Utils/Notifications"; import ButtonV2 from "../Common/components/ButtonV2"; @@ -11,19 +11,13 @@ import useQuery from "../../Utils/request/useQuery"; import { useTranslation } from "react-i18next"; import useFileUpload from "../../Utils/useFileUpload"; import request from "../../Utils/request/request"; +import { FileUploadModel } from "../Patient/models"; interface IProps { claim: HCXClaimModel; setShowMessages: (show: boolean) => void; } -interface IMessage { - type?: string; - data?: string; - user?: string | null; - index?: number; -} - export default function ClaimCardCommunication({ claim, setShowMessages, @@ -31,7 +25,6 @@ export default function ClaimCardCommunication({ const { t } = useTranslation(); const [inputText, setInputText] = useState(""); const [isSendingCommunication, setIsSendingCommunication] = useState(false); - const bottomRef = useRef(null); const { UploadButton, files, removeFile, clearFiles, handleFileUpload } = useFileUpload({ @@ -44,24 +37,10 @@ export default function ClaimCardCommunication({ useQuery(routes.listHCXCommunications, { query: { claim: claim.id, - ordering: "created_date", + ordering: "-created_date", }, }); - const messages = useMemo(() => { - return ( - (communicationsResult?.results - ?.flatMap((communication, i) => { - return communication.content?.map((content) => ({ - ...content, - user: communication.created_by, - index: i, - })); - }) - .filter(Boolean) as IMessage[]) ?? [] - ); - }, [communicationsResult]); - const handleSubmit = async () => { if (!claim.id) return; @@ -95,8 +74,6 @@ export default function ClaimCardCommunication({ setInputText(""); clearFiles(); - - bottomRef.current?.scrollIntoView({ behavior: "smooth", block: "end" }); } else { Notification.Error({ msg: "Error sending communication to HCX" }); } @@ -115,29 +92,10 @@ export default function ClaimCardCommunication({ />
-
- {messages?.map((message) => ( -
-

- {message.data} -

-
- ))} + -
-
@@ -203,3 +161,140 @@ export default function ClaimCardCommunication({
); } + +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/Locale/en/Common.json b/src/Locale/en/Common.json index 8209ffec18f..1384ce9cb4b 100644 --- a/src/Locale/en/Common.json +++ b/src/Locale/en/Common.json @@ -178,5 +178,8 @@ "feed_optimal_experience_for_apple_phones": "For optimal viewing experience, consider rotating your device. Ensure auto-rotate is enabled in your device settings.", "action_irreversible": "This action is irreversible", "send_message": "Send Message", - "enter_message": "Start typing your message..." + "enter_message": "Start typing your message...", + "see_attachments": "See Attachments", + "no_attachments_found": "This communication has no attachments.", + "fetching": "Fetching" } From dd50a05921e39159785dc1084ccaf78bd1bcfdf1 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Mon, 5 Aug 2024 10:51:02 +0530 Subject: [PATCH 14/20] minor styling: fixed upload button width in hcx communication card --- src/Components/HCX/ClaimCardCommunication.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index e5e28ae1f30..002abfa6a15 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -147,9 +147,11 @@ export default function ClaimCardCommunication({ className="-mb-3" />
- - - +
+ + + +
Date: Mon, 5 Aug 2024 15:19:14 +0530 Subject: [PATCH 15/20] fixed cypress fails --- .../patient_spec/patient_registration.cy.ts | 97 +++++++++++-------- .../pageobject/Patient/PatientInsurance.ts | 44 ++++++++- cypress/support/commands.ts | 6 ++ cypress/support/index.ts | 1 + 4 files changed, 106 insertions(+), 42 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_registration.cy.ts b/cypress/e2e/patient_spec/patient_registration.cy.ts index f94dbbe46cd..48befda6086 100644 --- a/cypress/e2e/patient_spec/patient_registration.cy.ts +++ b/cypress/e2e/patient_spec/patient_registration.cy.ts @@ -177,16 +177,23 @@ describe("Patient Creation with consultation", () => { "policy_id", patientOneFirstPolicyId, ); - patientInsurance.typePatientInsuranceDetail( - patientOneFirstInsuranceId, - "insurer_id", - patientOneFirstInsurerId, - ); - patientInsurance.typePatientInsuranceDetail( - patientOneFirstInsuranceId, - "insurer_name", - patientOneFirstInsurerName, - ); + cy.checkConfig("enable_hcx").then((isHCXEnabled) => { + if (isHCXEnabled) { + patientInsurance.selectInsurer("test"); + } else { + patientInsurance.typePatientInsuranceDetail( + patientOneFirstInsuranceId, + "insurer_id", + patientOneFirstInsurerId, + ); + patientInsurance.typePatientInsuranceDetail( + patientOneFirstInsuranceId, + "insurer_name", + patientOneFirstInsurerName, + ); + } + }); + patientInsurance.clickAddInsruanceDetails(); patientInsurance.typePatientInsuranceDetail( patientOneSecondInsuranceId, @@ -198,16 +205,23 @@ describe("Patient Creation with consultation", () => { "policy_id", patientOneSecondPolicyId, ); - patientInsurance.typePatientInsuranceDetail( - patientOneSecondInsuranceId, - "insurer_id", - patientOneSecondInsurerId, - ); - patientInsurance.typePatientInsuranceDetail( - patientOneSecondInsuranceId, - "insurer_name", - patientOneSecondInsurerName, - ); + cy.checkConfig("enable_hcx").then((isHCXEnabled) => { + if (isHCXEnabled) { + patientInsurance.selectInsurer("Care"); + } else { + patientInsurance.typePatientInsuranceDetail( + patientOneSecondInsuranceId, + "insurer_id", + patientOneSecondInsurerId, + ); + patientInsurance.typePatientInsuranceDetail( + patientOneSecondInsuranceId, + "insurer_name", + patientOneSecondInsurerName, + ); + } + }); + patientPage.clickUpdatePatient(); cy.wait(3000); patientPage.verifyPatientUpdated(); @@ -231,26 +245,33 @@ describe("Patient Creation with consultation", () => { .contains(patientOneFirstSubscriberId) .scrollIntoView(); cy.wait(2000); - patientInsurance.verifyPatientPolicyDetails( - patientOneFirstSubscriberId, - patientOneFirstPolicyId, - patientOneFirstInsurerId, - patientOneFirstInsurerName, - ); + cy.checkConfig("enable_hcx").then((isHCXEnabled) => { + patientInsurance.verifyPatientPolicyDetails( + patientOneFirstSubscriberId, + patientOneFirstPolicyId, + patientOneFirstInsurerId, + patientOneFirstInsurerName, + isHCXEnabled, + ); + }); patientInsurance.clickPatientInsuranceViewDetail(); cy.wait(3000); - patientInsurance.verifyPatientPolicyDetails( - patientOneFirstSubscriberId, - patientOneFirstPolicyId, - patientOneFirstInsurerId, - patientOneFirstInsurerName, - ); - patientInsurance.verifyPatientPolicyDetails( - patientOneSecondSubscriberId, - patientOneSecondPolicyId, - patientOneSecondInsurerId, - patientOneSecondInsurerName, - ); + cy.checkConfig("enable_hcx").then((isHCXEnabled) => { + patientInsurance.verifyPatientPolicyDetails( + patientOneFirstSubscriberId, + patientOneFirstPolicyId, + patientOneFirstInsurerId, + patientOneFirstInsurerName, + isHCXEnabled, + ); + patientInsurance.verifyPatientPolicyDetails( + patientOneSecondSubscriberId, + patientOneSecondPolicyId, + patientOneSecondInsurerId, + patientOneSecondInsurerName, + isHCXEnabled, + ); + }); }); it("Patient Registration using the transfer with no consultation", () => { diff --git a/cypress/pageobject/Patient/PatientInsurance.ts b/cypress/pageobject/Patient/PatientInsurance.ts index be4c25c5535..bdd571e9d0c 100644 --- a/cypress/pageobject/Patient/PatientInsurance.ts +++ b/cypress/pageobject/Patient/PatientInsurance.ts @@ -2,13 +2,41 @@ class PatientInsurance { typePatientInsuranceDetail( containerId: string, fieldId: string, - value: string + value: string, ) { cy.get(`#${containerId}`).within(() => { cy.get(`#${fieldId}`).click().type(value); }); } + selectInsurer(insurer: string) { + cy.intercept("GET", "**/api/v1/hcx/payors/**", { + statusCode: 200, + body: [ + { + name: "test payor 2", + code: "testpayor2.swasthmock@swasth-hcx-staging", + }, + { + name: "Care Payor", + code: "khavinshankar.gmail@swasth-hcx-staging", + }, + { + name: "Alliance", + code: "hcxdemo.yopmail@swasth-hcx-staging", + }, + ], + }).as("getInsurer"); + cy.get("[name='insurer']") + .last() + .click() + .type(insurer) + .then(() => { + cy.wait("@getInsurer"); + cy.get("[role='option']").contains(insurer).click(); + }); + } + clickPatientInsuranceViewDetail() { cy.get("#insurance-view-details").scrollIntoView(); cy.get("#insurance-view-details").click(); @@ -18,13 +46,21 @@ class PatientInsurance { cy.get("[data-testid=add-insurance-button]").click(); } - verifyPatientPolicyDetails(subscriberId, policyId, insurerId, insurerName) { + verifyPatientPolicyDetails( + subscriberId, + policyId, + insurerId, + insurerName, + isHcxEnabled, + ) { cy.get("[data-testid=patient-details]").then(($dashboard) => { cy.url().should("include", "/facility/"); expect($dashboard).to.contain(subscriberId); expect($dashboard).to.contain(policyId); - expect($dashboard).to.contain(insurerId); - expect($dashboard).to.contain(insurerName); + if (!isHcxEnabled) { + expect($dashboard).to.contain(insurerId); + expect($dashboard).to.contain(insurerName); + } }); } } diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 45a3cde3245..d44578fa917 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -204,3 +204,9 @@ Cypress.Commands.add("verifyContentPresence", (selector, texts) => { }); }); }); + +Cypress.Commands.add("checkConfig", (configName) => { + return cy.request("/config.json").then((response) => { + return response.body[configName]; + }); +}); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index c9af6a02c96..0b1522b2db8 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -44,6 +44,7 @@ declare global { selector: string, texts: string[], ): Chainable; + checkConfig(configName: string): Chainable; } } } From 7924eb7c74165aa9d2ad24ac1fe568a7c5996172 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Mon, 5 Aug 2024 15:29:08 +0530 Subject: [PATCH 16/20] fixed typo in name field --- src/Components/HCX/InsuranceDetailsBuilder.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/HCX/InsuranceDetailsBuilder.tsx b/src/Components/HCX/InsuranceDetailsBuilder.tsx index 1e401410ff0..36db895e04f 100644 --- a/src/Components/HCX/InsuranceDetailsBuilder.tsx +++ b/src/Components/HCX/InsuranceDetailsBuilder.tsx @@ -136,7 +136,7 @@ const InsuranceDetailEditCard = ({ {enable_hcx ? ( Date: Mon, 5 Aug 2024 15:39:43 +0530 Subject: [PATCH 17/20] added name attribute to autocomplete's input --- src/Components/Form/FormFields/Autocomplete.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Components/Form/FormFields/Autocomplete.tsx b/src/Components/Form/FormFields/Autocomplete.tsx index a891fc75d9a..2e649e1a397 100644 --- a/src/Components/Form/FormFields/Autocomplete.tsx +++ b/src/Components/Form/FormFields/Autocomplete.tsx @@ -163,6 +163,7 @@ export const Autocomplete = (props: AutocompleteProps) => {
value?.label || ""} From 3d8e1b9154495bc61391fecd77a49b7a74a11fbf Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Mon, 5 Aug 2024 16:04:35 +0530 Subject: [PATCH 18/20] added an overlay behind file preview in hcx communication card --- src/Components/HCX/ClaimCardCommunication.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index 002abfa6a15..aa63f95fc51 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -98,7 +98,7 @@ export default function ClaimCardCommunication({
-
+
{files.map((file, i) => (
Date: Tue, 6 Aug 2024 18:45:26 +0530 Subject: [PATCH 19/20] temp: updated backend url in netlify --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 4ab805434f5..0b2f1efd031 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,7 +9,7 @@ NODE_OPTIONS = "--max_old_space_size=4096" [[redirects]] from = "/api/*" -to = "https://careapi.ohc.network/api/:splat" +to = "https://work.khavinshankar.dev/api/:splat" status = 200 force = true From 5bef90251bfa9619fa609800447922761054cf1c Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Fri, 23 Aug 2024 12:17:20 +0530 Subject: [PATCH 20/20] fixed linting issue --- src/Components/HCX/ClaimCardCommunication.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/HCX/ClaimCardCommunication.tsx b/src/Components/HCX/ClaimCardCommunication.tsx index aa63f95fc51..da61393597f 100644 --- a/src/Components/HCX/ClaimCardCommunication.tsx +++ b/src/Components/HCX/ClaimCardCommunication.tsx @@ -87,7 +87,7 @@ export default function ClaimCardCommunication({
setShowMessages(false)} />