From 65db136642b1338ae25aeca31c6c4ea254c9bb50 Mon Sep 17 00:00:00 2001 From: Abhishek Gaddi <110591073+AbhiGaddi@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:07:20 +0530 Subject: [PATCH 1/2] Added supporting documents table --- index.html | 2 +- src/App.tsx | 14 +- src/components/DocumentList.tsx | 75 ++ src/components/DropdownUser.tsx | 2 +- src/components/FileManager.tsx | 112 +-- src/main.tsx | 14 +- src/pages/Authentication/SignIn.tsx | 3 +- src/pages/Claims/ClaimDetails.tsx | 684 +++++++++--------- src/pages/Claims/Claims.tsx | 4 +- .../CoverageEligibilityList.tsx | 359 +++++---- src/pages/Preauth/PreauthList.tsx | 2 +- 11 files changed, 677 insertions(+), 594 deletions(-) create mode 100644 src/components/DocumentList.tsx diff --git a/index.html b/index.html index ff80fd1..d221822 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Self Service Portal - HCX + Mock Payor - HCX
diff --git a/src/App.tsx b/src/App.tsx index 7f9cef2..6f2dbee 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -26,13 +26,13 @@ function App() { <> } > }> @@ -41,7 +41,7 @@ function App() { } /> @@ -50,7 +50,7 @@ function App() { } /> @@ -60,7 +60,7 @@ function App() { /> @@ -69,7 +69,7 @@ function App() { } /> @@ -78,7 +78,7 @@ function App() { } /> diff --git a/src/components/DocumentList.tsx b/src/components/DocumentList.tsx new file mode 100644 index 0000000..c1cb38a --- /dev/null +++ b/src/components/DocumentList.tsx @@ -0,0 +1,75 @@ +import React, { useState } from 'react'; +import ModalFileViewer from './ModalFileViewer'; +import EmptyState from './EmptyState'; + +interface DocumentsListProps { + files: string[]; +} + +const DocumentsList: React.FC = ({ files }: DocumentsListProps) => { + const [showFile, setShowFile] = useState(false); + const [selectedFile, setSelectedFile] = useState(""); + + const onFileView = (file: string) => { + setSelectedFile(file); + setShowFile(true); + } + + return ( +
+

Supporting Documents

+ {files.length !== 0 ? + + + + + + + + + + {files.map((file: any, index: number) => ( + + + + + + ))} + +
+ Document Type + + Document Name + + Action +
+

{file.category.coding[0].code}

+
+

+ {decodeURIComponent(file.valueAttachment.url).split("/").at(-1) || "Document"} +

+
+ onFileView(file.valueAttachment.url)}> + + + + + + + + +
+ : + + } + {showFile && + setShowFile(false)} /> + } +
+ ); +}; + +export default DocumentsList; diff --git a/src/components/DropdownUser.tsx b/src/components/DropdownUser.tsx index 25bf772..f7c2ab0 100644 --- a/src/components/DropdownUser.tsx +++ b/src/components/DropdownUser.tsx @@ -159,7 +159,7 @@ const DropdownUser = () => { */} - - ) - })} +
+ +
+ ) + })} - - : - - } - + + : + + } + ); }; diff --git a/src/main.tsx b/src/main.tsx index ed3195f..53c4271 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -12,11 +12,11 @@ import "react-toastify/dist/ReactToastify.css"; ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - - - + + + - - - -); + + + +); \ No newline at end of file diff --git a/src/pages/Authentication/SignIn.tsx b/src/pages/Authentication/SignIn.tsx index fb1e4e9..cac1d73 100644 --- a/src/pages/Authentication/SignIn.tsx +++ b/src/pages/Authentication/SignIn.tsx @@ -20,7 +20,6 @@ const SignIn: React.FC = () => { const [userName, setUserName] = useState(''); const [password, setPassword] = useState(''); - const [showLoader, setShowLoader] = useState(false); const [userError, setUserError] = useState(false); const [passError, setPassError] = useState(false); let sessionToken = sessionStorage.getItem("hcx_user_token"); @@ -44,7 +43,7 @@ const SignIn: React.FC = () => { console.log("participant token", res); getParticipantByCode(userName).then((res: any) => { dispatch(addParticipantDetails(res["data"]["participants"][0])); - navigate("/payor/coverageeligibility/list"); + navigate("/coverageeligibility/list"); }).catch((error) => { toast.error("Something went wrong. Please contact the administrator" || "Internal Server Error", { position: toast.POSITION.TOP_RIGHT diff --git a/src/pages/Claims/ClaimDetails.tsx b/src/pages/Claims/ClaimDetails.tsx index 07de233..bc17e2a 100644 --- a/src/pages/Claims/ClaimDetails.tsx +++ b/src/pages/Claims/ClaimDetails.tsx @@ -1,7 +1,7 @@ import { Link } from "react-router-dom"; import { bgcolorPicker, colorPicker } from "../../utils/StringUtil"; import { useEffect, useState } from "react"; -import { useDispatch, useSelector } from "react-redux"; +import { useSelector } from "react-redux"; import { RootState } from "../../store"; import _ from "lodash"; import { ClaimDetail } from "./Claims"; @@ -14,363 +14,371 @@ import { toast } from "react-toastify"; import { approveClaim, rejectClaim } from "../../api/PayerService"; import EmptyState from "../../components/EmptyState"; import axios from "axios"; +import DocumentsList from "../../components/DocumentList"; export type ChecklistItem = { - id: string; - name: string; - status?: "pass" | "fail" | "na"; - }; - - interface claimProps{ - claimType : "preauth" | "claim" - } + id: string; + name: string; + status?: "pass" | "fail" | "na"; +}; + +interface claimProps { + claimType: "preauth" | "claim" +} -const ClaimDetails:React.FC = ({claimType}:claimProps) => { +const ClaimDetails: React.FC = ({ claimType }: claimProps) => { - const dispatch = useDispatch(); - const appData: Object = useSelector((state: RootState) => state.appDataReducer.appData); - const [claim, setClaim] = useState(_.get(appData,"claim") || null); - const [requestID, setRequestId] = useState(_.get(appData,"claim.request_id") || "12345"); - const authToken = useSelector((state: RootState) => state.tokenReducer.participantToken); - const [medSettled, setMedSettled] = useState(claim?.medical_info.status == "Approved" ? true :false) - const [finSettled, setFinSettled] = useState(claim?.financial_info.status == "Approved" ? true :false) - const [opdSettled, setOpdSettled] = useState(claim?.status == "Approved" ? true :false); - const [claimDetailsBox, setClaimDetailsBox] = useState( - {"resource_created": formatDate(_.get(claim, "resources.claim.created") || "2023-12-18T06:17:07+00:00") , - "Insurer": textOrDash(_.get(claim, "resources.claim.insurer.name") || "Not Available"), - "Provider": textOrDash(_.get(claim, "provider") || "Not Available"), - "Total_Claim_Cost" : textOrDash(_.get(claim, "requested_amount") || "Not Available"), - "Priority" : textOrDash(_.get(claim, "resources.claim.priority.coding[0].code") || "Not Available") + const appData: Object = useSelector((state: RootState) => state.appDataReducer.appData); + localStorage.setItem('claimData', JSON.stringify(appData)); + const [claim, setClaim] = useState(_.get(appData, "claim") || null); + const [requestID, setRequestId] = useState(_.get(appData, "claim.request_id") || "12345"); + const authToken = useSelector((state: RootState) => state.tokenReducer.participantToken); + const [medSettled, setMedSettled] = useState(claim?.medical_info.status == "Approved" ? true : false) + const [finSettled, setFinSettled] = useState(claim?.financial_info.status == "Approved" ? true : false) + const [opdSettled, setOpdSettled] = useState(claim?.status == "Approved" ? true : false); + const [claimDetailsBox, setClaimDetailsBox] = useState( + { + "resource_created": formatDate(_.get(claim, "resources.claim.created") || "2023-12-18T06:17:07+00:00"), + "Insurer": textOrDash(_.get(claim, "resources.claim.insurer.name") || "Not Available"), + "Provider": textOrDash(_.get(claim, "provider") || "Not Available"), + "Total_Claim_Cost": textOrDash(_.get(claim, "requested_amount") || "Not Available"), + "Priority": textOrDash(_.get(claim, "resources.claim.priority.coding[0].code") || "Not Available") }); - const supportingFiles = (claim as any).resources.claim.supportingInfo || []; - console.log("claim selected", claim); - const [openTab, setOpenTab] = useState(1); + const supportingFiles = (claim as any).resources.claim.supportingInfo || []; + console.log("claim selected", claim); + const [openTab, setOpenTab] = useState(1); - const activeClasses = 'text-primary border-primary'; - const inactiveClasses = 'border-transparent'; + const activeClasses = 'text-primary border-primary'; + const inactiveClasses = 'border-transparent'; - const processFile = (url: string) => { - let data = JSON.stringify({ - "file_locations": [url] - }); - - let config = { - method: 'post', - maxBodyLength: Infinity, - url: 'http://docxhcxapi.centralindia.cloudapp.azure.com/document/analyse/submit ', - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer HCX@12345' - }, - data: data - }; - axios.request(config) - .then((response: { data: any; }) => { - console.log(JSON.stringify(response.data)); - localStorage.setItem(url, response.data.request_id); - }) - .catch((error: any) => { - console.log(error); - }); - } - useEffect(()=>{ - supportingFiles.map((file: any, index: any) => { - processFile(file.valueAttachment.url); + const processFile = (url: string) => { + let data = JSON.stringify({ + "file_locations": [url] + }); + + let config = { + method: 'post', + maxBodyLength: Infinity, + url: 'http://docxhcxapi.centralindia.cloudapp.azure.com/document/analyse/submit ', + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer HCX@12345' + }, + data: data + }; + axios.request(config) + .then((response: { data: any; }) => { + console.log(JSON.stringify(response.data)); + localStorage.setItem(url, response.data.request_id); + }) + .catch((error: any) => { + console.log(error); }); - },[]) + } + + + console.log("Current state of claim:", claim); + + useEffect(() => { + supportingFiles.map((file: any, index: any) => { + processFile(file.valueAttachment.url); + }); + }, []) + const financialDetailsBoxInfo = { + requested_amount: claim ? claim.requested_amount : "Not Available", + approved_amount: claim ? claim.approved_amount : "Not Available", + status: claim ? claim.financial_info.status : "Not Available", + bank_account_number: claim ? claim.account_number : "Not Available", + ifsc_code: claim ? claim.ifsc_code : "Not Available" + } + + const [opddetailsChecklist, setopdDetailsChecklist] = useState([ + { + id: "1", + name: "All OPD documents Verified", + }, + ]); + + const [detailsChecklist, setDetailsChecklist] = useState([ + { + id: "1", + name: "Proof of Identity Attached", + }, + { + id: "2", + name: "Policy Active", + }, + ]); + + const [checklist, setChecklist] = useState([ + { + id: "1", + name: "Treatment in line with diagnosis", + }, + { + id: "2", + name: "Discharge summary available", + }, + { + id: "3", + name: "Discharge summary in line with treatment", + }, + ]); - const financialDetailsBoxInfo = { - requested_amount : claim ? claim.requested_amount : "Not Available", - approved_amount : claim ? claim.approved_amount : "Not Available", - status : claim ? claim.financial_info.status : "Not Available", - bank_account_number : claim ? claim.account_number : "Not Available", - ifsc_code : claim ? claim.ifsc_code : "Not Available" + const [financialCheckList, setFinancialCheckList] = useState( + [ + { + id: "1", + name: "Amount within wallet range?", + }, + { + id: "2", + name: "Procedures not in exclusion list? ", + }, + { + id: "3", + name: "Procedures as per approved plan?", + }, + { + id: "4", + name: "Waiting period observed? ", + }, + { + id: "5", + name: "Policy In force force for the treatment period?", + }, + { + id: "6", + name: "Needed supporting documents available?", + }, + ] + ); + const handleReject = async (request_id: string, type: string) => { + await rejectClaim(request_id, type, authToken, "/claim/reject"); + toast("Claim Rejected", { type: "success" }); + }; + + const handleApprove = async ( + request_id: string, + type: string, + remarks: string, + approved_amount: number) => { + if (type == "medical" || "financial") { + approveClaim( + request_id, + type, + remarks, + approved_amount, + authToken, + "/claim/approve"); + toast(`${type} ${claimType} approved`, { type: "success" }); + } else { + approveClaim( + request_id, + "medical", + remarks, + approved_amount, + authToken, + "/claim/approve"); + approveClaim( + request_id, + "financial", + remarks, + approved_amount, + authToken, + "/claim/approve"); + toast(`${claimType} approved`, { type: "success" }); } + }; - const [opddetailsChecklist, setopdDetailsChecklist] = useState([ - { - id: "1", - name: "All OPD documents Verified", - }, - ]); - - const [detailsChecklist, setDetailsChecklist] = useState([ - { - id: "1", - name: "Proof of Identity Attached", - }, - { - id: "2", - name: "Policy Active", - }, - ]); - - const [checklist, setChecklist] = useState([ - { - id: "1", - name: "Treatment in line with diagnosis", - }, - { - id: "2", - name: "Discharge summary available", - }, - { - id: "3", - name: "Discharge summary in line with treatment", - }, - ]); - - const [financialCheckList, setFinancialCheckList] = useState( - [ - { - id: "1", - name: "Amount within wallet range?", - }, - { - id: "2", - name: "Procedures not in exclusion list? ", - }, - { - id: "3", - name: "Procedures as per approved plan?", - }, - { - id: "4", - name: "Waiting period observed? ", - }, - { - id: "5", - name: "Policy In force force for the treatment period?", - }, - { - id: "6", - name: "Needed supporting documents available?", - }, - ] - ); - const handleReject = async (request_id: string, type: string) => { - await rejectClaim( request_id, type , authToken, "/claim/reject"); - toast("Claim Rejected", { type: "success" }); - }; - - const handleApprove = async ( - request_id: string, - type: string, - remarks: string, - approved_amount: number) => { - if (type == "medical" || "financial") { - approveClaim( - request_id, - type, - remarks, - approved_amount, - authToken, - "/claim/approve"); - toast(`${type} ${claimType} approved`, { type: "success" }); - } else { - approveClaim( - request_id, - "medical", - remarks, - approved_amount, - authToken, - "/claim/approve"); - approveClaim( - request_id, - "financial", - remarks, - approved_amount, - authToken, - "/claim/approve"); - toast(`${claimType} approved`, { type: "success" }); - } - }; + return ( + <> +
+
+
+

+ {properText(claimType)} Details +

+

Claim ID : {claim ? claim.request_id : "Not Available"}

+

Claim No : {claim ? claim.request_no : "Not Available"}

+
+
+

+   +

+

Status : + {claim ? claim.status : "Not Available"} +

+
- return ( - <> -
-
-
-

- {properText(claimType)} Details -

-

Claim ID : {claim ? claim.request_id : "Not Available"}

-

Claim No : {claim ? claim.request_no : "Not Available"}

-
-
-

-   -

-

Status : - {claim ? claim.status : "Not Available"} -

-
+
+
+
+
+ {claim && claim.sub_type !== "OPD" ? + <> + setOpenTab(1)} + > + General Details + + setOpenTab(2)} + > + Medical Details + + setOpenTab(3)} + > + Financial Details + + : <> setOpenTab(1)} + > + OPD Claim + } +
+
+
+ {claim && claim.sub_type !== "OPD" ? + <> +
+
+ + +
+
+ +
-
-
-
- { claim && claim.sub_type !== "OPD" ? - <> - setOpenTab(1)} - > - General Details - - setOpenTab(2)} - > - Medical Details - - setOpenTab(3)} - > - Financial Details - - : <> setOpenTab(1)} - > - OPD Claim - } -
- -
-
- {claim && claim.sub_type !== "OPD" ? - <> -
-
- - -
-
- -
-
- - : null} + + : null} - {claim && claim.sub_type == "OPD" ? - <> -
-
- - - - ({ - id: item.productOrService.coding[0].code, - display: item.productOrService.coding[0].display, - code: item.productOrService.coding[0].code, - value: `${item.unitPrice.value} ${item.unitPrice.currency}`, - }))} - > - -
-
- handleApprove(requestID,type,remarks,approvedAmount) } onReject={(type) => {handleReject(requestID, type)}}> -
-
- - : null} + {claim && claim.sub_type == "OPD" ? + <> +
+
+ + + + ({ + id: item.productOrService.coding[0].code, + display: item.productOrService.coding[0].display, + code: item.productOrService.coding[0].code, + value: `${item.unitPrice.value} ${item.unitPrice.currency}`, + }))} + > + {/* */} +
+
+ handleApprove(requestID, type, remarks, approvedAmount)} onReject={(type) => { handleReject(requestID, type) }}> +
+
+
+ +
+ + : null} -
-
- {claim? -
-
- {claim.diagnosis && claim.diagnosis.length > 0 ? ( - item.diagnosisCodeableConcept !== undefined - ) - .map((item) => ({ - id: item.diagnosisCodeableConcept.coding[0].code, - display: item.type[0].coding[0].display, - code: item.diagnosisCodeableConcept.coding[0].code, - // text: item.diagnosisCodeableConcept.text, - })), - ...claim.diagnosis - .filter((item: any) => item.diagnosisReference !== undefined) - .map((item: any) => ({ - id: item.diagnosisReference.code.coding[0].code, - display: item.diagnosisReference.code.coding[0].display, - code: item.diagnosisReference.code.coding[0].code, - })), - ]}>): - } - ({ - id: item.productOrService.coding[0].code, - display: item.productOrService.coding[0].display, - code: item.productOrService.coding[0].code, - value: `${item.unitPrice.value} ${item.unitPrice.currency}`, - }))} - > - -
-
- handleApprove(requestID,type,remarks,approvedAmount) } onReject={(type) => {handleReject(requestID, type)}}> -
-
- : null} -
-
- {claim ? - <> -
-
- - ({ - id: item.productOrService.coding[0].code, - display: item.productOrService.coding[0].display, - code: item.productOrService.coding[0].code, - value: `${item.unitPrice.value} ${item.unitPrice.currency}`, - }))} - > - -
-
- handleApprove(requestID,type,remarks,approvedAmount) } onReject={(type) => {handleReject(requestID, type)}}> -
-
- - : null} -
+
+
+ {claim ? +
+
+ {claim.diagnosis && claim.diagnosis.length > 0 ? ( + item.diagnosisCodeableConcept !== undefined + ) + .map((item) => ({ + id: item.diagnosisCodeableConcept.coding[0].code, + display: item.type[0].coding[0].display, + code: item.diagnosisCodeableConcept.coding[0].code, + // text: item.diagnosisCodeableConcept.text, + })), + ...claim.diagnosis + .filter((item: any) => item.diagnosisReference !== undefined) + .map((item: any) => ({ + id: item.diagnosisReference.code.coding[0].code, + display: item.diagnosisReference.code.coding[0].display, + code: item.diagnosisReference.code.coding[0].code, + })), + ]}>) : + } + ({ + id: item.productOrService.coding[0].code, + display: item.productOrService.coding[0].display, + code: item.productOrService.coding[0].code, + value: `${item.unitPrice.value} ${item.unitPrice.currency}`, + }))} + > + +
+
+ handleApprove(requestID, type, remarks, approvedAmount)} onReject={(type) => { handleReject(requestID, type) }}> +
+
+ : null} +
+
+ {claim ? + <> +
+
+ + ({ + id: item.productOrService.coding[0].code, + display: item.productOrService.coding[0].display, + code: item.productOrService.coding[0].code, + value: `${item.unitPrice.value} ${item.unitPrice.currency}`, + }))} + > + +
+
+ handleApprove(requestID, type, remarks, approvedAmount)} onReject={(type) => { handleReject(requestID, type) }}> +
-
- ) + + : null} +
+
+
+ ) } diff --git a/src/pages/Claims/Claims.tsx b/src/pages/Claims/Claims.tsx index 416c5ed..d3d6e76 100644 --- a/src/pages/Claims/Claims.tsx +++ b/src/pages/Claims/Claims.tsx @@ -7,7 +7,7 @@ import _ from "lodash"; import { toast } from "react-toastify"; import CommonDataTable from "../../components/CommonDataTable"; import Loader from "../../common/Loader"; -import { Navigate, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { addAppData } from "../../reducers/app_data"; import { properText } from "../../utils/StringUtils"; import ModalEditor from "../../components/ModalEditor"; @@ -270,7 +270,7 @@ const ClaimsList:React.FC = ({claimType}:claimProps) => { const onClaimClick = (id:string) => { getClaim(id); - navigate(`/payor/claims/detail`) + navigate(`/claims/detail`) } return( diff --git a/src/pages/CoverageEligibility/CoverageEligibilityList.tsx b/src/pages/CoverageEligibility/CoverageEligibilityList.tsx index 22e4ba3..6e571a4 100644 --- a/src/pages/CoverageEligibility/CoverageEligibilityList.tsx +++ b/src/pages/CoverageEligibility/CoverageEligibilityList.tsx @@ -8,79 +8,59 @@ import { useDispatch, useSelector } from "react-redux"; import { RootState } from "../../store"; import Loader from "../../common/Loader"; import ModalEditor from "../../components/ModalEditor"; -import ModalCoverageEligibility from "../../components/ModalCoverageEligibility"; import { useNavigate } from "react-router-dom"; import { addAppData } from "../../reducers/app_data"; - export type CoverageDetail = { - id:string; - request_id: string; - request_no: string; - name: string; - insurance_no: string; - provider:string; - expiry: string; - status: string; - resource: object; - response_fhir: object; - servicedPeriod:object; +export type CoverageDetail = { + id: string; + request_id: string; + request_no: string; + name: string; + insurance_no: string; + provider: string; + expiry: string; + status: string; + resource: object; + response_fhir: object; + servicedPeriod: object; +} + +const CoverageEligibilityList = () => { + + const participantDetails: Object = useSelector((state: RootState) => state.participantDetailsReducer.participantDetails); + const authToken = useSelector((state: RootState) => state.tokenReducer.participantToken); + const [showComponent, setShowComponent] = useState(false); + const navigate = useNavigate(); + const dispatch = useDispatch(); + + const coverageEligibilityMapper = (coverage: any): CoverageDetail => { + const { resource } = unbundleAs( + coverage.payload, + "CoverageEligibilityRequest" + ); + + return { + id: coverage.request_id, + request_id: coverage.request_id, + request_no: resource.id, + name: resource.patient?.name[0].text, + provider: resource.provider?.name, + insurance_no: resource.insurance[0].coverage?.subscriberId, + status: coverage.status, + servicedPeriod: resource.servicedPeriod, + expiry: resource.servicedPeriod?.end + ? formatDate(resource.servicedPeriod.end) + : "", + resource, + response_fhir: coverage.response_fhir, + }; } - const CoverageEligibilityList = () => { - - const participantDetails: Object = useSelector((state: RootState) => state.participantDetailsReducer.participantDetails); - const authToken = useSelector((state: RootState) => state.tokenReducer.participantToken); - const [showComponent, setShowComponent] = useState(false); - const navigate = useNavigate(); - const dispatch = useDispatch(); - - const coverageEligibilityMapper = (coverage: any):CoverageDetail => { - const { resource } = unbundleAs( - coverage.payload, - "CoverageEligibilityRequest" - ); - - return { - id: coverage.request_id, - request_id: coverage.request_id, - request_no: resource.id, - name: resource.patient?.name[0].text, - provider: resource.provider?.name, - insurance_no: resource.insurance[0].coverage?.subscriberId, - status: coverage.status, - servicedPeriod: resource.servicedPeriod, - expiry: resource.servicedPeriod?.end - ? formatDate(resource.servicedPeriod.end) - : "", - resource, - response_fhir: coverage.response_fhir, - }; - } - - const [selectedRequest, setSelectedRequest] = useState(""); - const [showFilter, setShowFilter] = useState(false); - const [coverageEligibilityRequests, setCoverageEligibilityRequests] = - useState< - { - request_id: string; - request_no: string; - name: string; - insurance_no: string; - expiry: string; - status: string; - resource: object; - response_fhir: object; - }[] - >(); - const [showJSON, setShowJSON] = useState(false); - const [showEditor, setShowEditor] = useState(false); - const [coverage, setCoverage] = useState<{}>(); - const [coverageString, setCoverageString] = useState(""); - const [coverageResponse, setCoverageResponse] = useState(""); - const [requestId, setRequestId] = useState(""); - const [showEditorResponse, setShowEditorResponse] = useState(false); - const [coverageMapped, setCoverageMapped] = useState< + const [selectedRequest, setSelectedRequest] = useState(""); + const [showFilter, setShowFilter] = useState(false); + const [coverageEligibilityRequests, setCoverageEligibilityRequests] = + useState< { request_id: string; request_no: string; @@ -90,121 +70,140 @@ import { addAppData } from "../../reducers/app_data"; status: string; resource: object; response_fhir: object; - } >(); - const [showCoverageModal, setShowCoverageModal] = useState(false); - - - const handleInputChange = (value: any, event: any) => { - setCoverageResponse(value); - }; - - const getCoverages = () => { - listRequest("coverageeligibility", authToken).then((resp:any) => { - setShowComponent(false); - console.log("cov resp", resp); - setCoverageEligibilityRequests( - resp.data.coverageeligibility.map(coverageEligibilityMapper) - ); - setShowComponent(true); - }).catch((err:any) => { - console.error("Error while fetching request list", err); - setCoverageEligibilityRequests([]); - }); - } - - async function getCoverage(id: any): Promise { - const obj = coverageEligibilityRequests?.find( - (coverage: any) => coverage.request_id === id - ) - setRequestId(id) - setCoverage(obj?.resource); - dispatch(addAppData({"coverage":obj})); - setCoverageString(JSON.stringify(obj?.resource, null, 4)) - setCoverageResponse(JSON.stringify(obj?.response_fhir, null, 4)) - } - - useEffect(() => { + }[] + >(); + const [showJSON, setShowJSON] = useState(false); + const [showEditor, setShowEditor] = useState(false); + const [coverage, setCoverage] = useState<{}>(); + const [coverageString, setCoverageString] = useState(""); + const [coverageResponse, setCoverageResponse] = useState(""); + const [requestId, setRequestId] = useState(""); + const [showEditorResponse, setShowEditorResponse] = useState(false); + const [coverageMapped, setCoverageMapped] = useState< + { + request_id: string; + request_no: string; + name: string; + insurance_no: string; + expiry: string; + status: string; + resource: object; + response_fhir: object; + }>(); + const [showCoverageModal, setShowCoverageModal] = useState(false); + + + const handleInputChange = (value: any, event: any) => { + setCoverageResponse(value); + }; + + const getCoverages = () => { + listRequest("coverageeligibility", authToken).then((resp: any) => { + setShowComponent(false); + console.log("cov resp", resp); + setCoverageEligibilityRequests( + resp.data.coverageeligibility.map(coverageEligibilityMapper) + ); + setShowComponent(true); + }).catch((err: any) => { + console.error("Error while fetching request list", err); + setCoverageEligibilityRequests([]); + }); + } + + async function getCoverage(id: any): Promise { + const obj = coverageEligibilityRequests?.find( + (coverage: any) => coverage.request_id === id + ) + setRequestId(id) + setCoverage(obj?.resource); + dispatch(addAppData({ "coverage": obj })); + setCoverageString(JSON.stringify(obj?.resource, null, 4)) + setCoverageResponse(JSON.stringify(obj?.response_fhir, null, 4)) + } + + useEffect(() => { + getCoverages(); + }, []); + + + const updateRespFhir = (value: any) => { + setCoverageResponse(value); + console.log("value of responseFHIR", value); + updateResponse({ request_id: requestId, response_fhir: value }, authToken); + setShowEditor(false); + getCoverages(); + } + + const onActionClick = (action: string, id: string) => { + setRequestId(id); + if (action == "View") { + getCoverage(id); + setShowEditor(true); + } else if (action == "Approve") { + approveCoverageEligibilityRequest(id, authToken); + toast("Coverage Eligibility Request Approved", { + type: "success", + }); + setTimeout(() => { getCoverages(); - }, []); - - - const updateRespFhir = (value: any) => { - setCoverageResponse(value); - console.log("value of responseFHIR", value); - updateResponse({ request_id: requestId, response_fhir: value }, authToken); - setShowEditor(false); + }, 1000); + } else if (action == "Reject") { + rejectCoverageEligibilityRequest(id, authToken); + toast("Coverage Eligibility Request Rejected", { + type: "error", + }); + setTimeout(() => { getCoverages(); - } - - const onActionClick =(action:string,id:string)=> { - setRequestId(id); - if(action == "View"){ - getCoverage(id); - setShowEditor(true); - }else if(action == "Approve"){ - approveCoverageEligibilityRequest(id, authToken); - toast("Coverage Eligibility Request Approved", { - type: "success", - }); - setTimeout(() => { - getCoverages(); - }, 1000); - }else if(action == "Reject"){ - rejectCoverageEligibilityRequest(id, authToken); - toast("Coverage Eligibility Request Rejected", { - type: "error", - }); - setTimeout(() => { - getCoverages(); - }, 1000); - } - } - - const onCoverageClick = (id:string) => { - const obj = coverageEligibilityRequests?.find( - (coverage: any) => coverage.request_id === id - ) - setRequestId(id); - setCoverageMapped(obj) - getCoverage(id); - //setShowCoverageModal(true); - navigate("/payor/coverageeligibility/details") - } - - - return( + }, 1000); + } + } + + const onCoverageClick = (id: string) => { + const obj = coverageEligibilityRequests?.find( + (coverage: any) => coverage.request_id === id + ) + setRequestId(id); + setCoverageMapped(obj) + getCoverage(id); + //setShowCoverageModal(true); + navigate("/coverageeligibility/details") + } + + + return ( + <> + {showEditor ? + updateRespFhir(value)} onClose={() => setShowEditor(false)}> + : null} + {showComponent ? + ({ + ...coverage, + id: coverage.request_id, + patient_name: coverage.name, + request_no: coverage.request_no.slice(-8), + enableButtons: coverage.status == "Pending" ? true : false + })) as any} + actions={[{ text: "Approve", type: "success" }, { text: "Reject", type: "danger" }, { text: "View", type: "normal" }]} + onAction={(action, id) => onActionClick(action, id)} + onRowClick={(id: string) => onCoverageClick(id)} + > : <> - {showEditor ? - updateRespFhir(value)} onClose={() => setShowEditor(false)}> - : null } - { showComponent ? - ({ - ...coverage, - id: coverage.request_id, - patient_name: coverage.name, - request_no: coverage.request_no.slice(-8), - enableButtons: coverage.status == "Pending" ? true : false - })) as any} - actions={[{text:"Approve",type:"success"},{text:"Reject",type:"danger"},{text:"View",type:"normal"}]} - onAction={(action,id)=>onActionClick(action,id)} - onRowClick={(id:string) => onCoverageClick(id)} - > : - <> - - } - ) + + } + ) } export default CoverageEligibilityList; \ No newline at end of file diff --git a/src/pages/Preauth/PreauthList.tsx b/src/pages/Preauth/PreauthList.tsx index 34a9089..db5a2a7 100644 --- a/src/pages/Preauth/PreauthList.tsx +++ b/src/pages/Preauth/PreauthList.tsx @@ -257,7 +257,7 @@ const PreauthList:React.FC = ({claimType}:claimProps) => { const onClaimClick = (id:string) => { getClaim(id); - navigate(`/payor/${claimUseType}/detail`) + navigate(`/${claimUseType}/detail`) } const onActionClick =(action:string,id:string)=> { From a7ccaf534a8aa14dd56a4183255eb7fbf3257af3 Mon Sep 17 00:00:00 2001 From: Abhishek Gaddi <110591073+AbhiGaddi@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:07:57 +0530 Subject: [PATCH 2/2] Added supporting documents table --- src/components/Sidebar.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index ff85b3d..0c6d405 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -87,7 +87,7 @@ const Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => { > {/* */}
- + Logo Logo @@ -129,7 +129,7 @@ const Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => { {/* */}
  • {
  • {