Skip to content

Commit

Permalink
updated index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrin2005 committed Dec 13, 2024
1 parent db2fb4c commit 2098454
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 23 deletions.
57 changes: 56 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"@radix-ui/react-toast": "^1.2.2",
"@radix-ui/react-tooltip": "^1.1.4",
"@sentry/browser": "^8.42.0",
"@tanstack/react-query": "^5.62.3",
"@tanstack/react-query-devtools": "^5.62.7",
"@yudiel/react-qr-scanner": "^2.0.8",
"bowser": "^2.11.0",
"browser-image-compression": "^2.0.2",
Expand Down Expand Up @@ -178,4 +180,4 @@
"node": ">=22.11.0"
},
"packageManager": "[email protected]"
}
}
40 changes: 19 additions & 21 deletions src/components/Facility/Investigations/Reports/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useCallback, useReducer, useState } from "react";
import { useTranslation } from "react-i18next";

import ButtonV2 from "@/components/Common/ButtonV2";
import CircularProgress from "@/components/Common/CircularProgress";
import Loading from "@/components/Common/Loading";
import Page from "@/components/Common/Page";
Expand Down Expand Up @@ -284,6 +283,9 @@ const InvestigationReports = ({ id }: any) => {
const prevSessionDisabled = sessionPage <= 1 || isLoading.tableData;
const nextSessionDisabled = isNextSessionDisabled || isLoading.tableData;

const buttonPrimary = "bg-green-500 text-white px-4 py-2 rounded";
const buttonSecondary = "bg-gray-100 text-gray-500 px-4 py-2 rounded";

if (patientLoading) {
return <Loading />;
}
Expand Down Expand Up @@ -314,14 +316,13 @@ const InvestigationReports = ({ id }: any) => {
/>
</div>
{!isLoading.investigationLoading && (
<ButtonV2
<button
onClick={() => fetchInvestigation()}
disabled={getTestDisabled}
variant="primary"
className="my-2.5"
className={`my-2.5 ${buttonPrimary}`}
>
{t("get_tests")}
</ButtonV2>
</button>
)}
{!!isLoading.investigationLoading && (
<CircularProgress className="text-primary-500" />
Expand Down Expand Up @@ -349,25 +350,23 @@ const InvestigationReports = ({ id }: any) => {
/>
</div>
<div className="flex space-x-2">
<ButtonV2
<button
onClick={() => {
setSessionPage(1);
handleGenerateReports(1);
}}
disabled={generateReportDisabled}
variant="primary"
className="my-2.5"
className={`my-2.5 ${buttonPrimary}`}
>
{t("generate_report")}
</ButtonV2>
<ButtonV2
</button>
<button
onClick={clearSelectedInvestigations}
disabled={!selectedInvestigations.length}
variant="secondary"
className="my-2.5"
className={`my-2.5 ${buttonSecondary}`}
>
{t("clear")}
</ButtonV2>
</button>
</div>
</>
)}
Expand All @@ -380,19 +379,19 @@ const InvestigationReports = ({ id }: any) => {
{!!investigationTableData.length && (
<>
<div className="my-2.5">
<ButtonV2
<button
onClick={() => handleSessionPage("NEXT")}
disabled={prevSessionDisabled}
>
{isLoading.tableData ? "Loading..." : t("next_sessions")}
</ButtonV2>
<ButtonV2
</button>
<button
onClick={() => handleSessionPage("PREV")}
disabled={nextSessionDisabled}
className="ml-3"
>
{isLoading.tableData ? "Loading..." : t("prev_sessions")}
</ButtonV2>
</button>
</div>

<ReportTable
Expand All @@ -406,14 +405,13 @@ const InvestigationReports = ({ id }: any) => {
/>

{!loadMoreDisabled && (
<ButtonV2
<button
disabled={loadMoreDisabled}
onClick={handleLoadMore}
className="my-2.5 w-full"
variant="primary"
className={`my-2.5 w-full${buttonPrimary}`}
>
{t("load_more")}
</ButtonV2>
</button>
)}
</>
)}
Expand Down

0 comments on commit 2098454

Please sign in to comment.