Skip to content

Commit

Permalink
Merge branch 'develop' into issues/8672/fix-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
syedfardeenjeelani authored Oct 19, 2024
2 parents 2b5dd16 + 5c39b2c commit 54c08f1
Show file tree
Hide file tree
Showing 34 changed files with 2,345 additions and 1,665 deletions.
2 changes: 0 additions & 2 deletions cypress/e2e/users_spec/UsersManage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe("Manage User", () => {

beforeEach(() => {
cy.restoreLocalStorage();
console.log(localStorage);
cy.clearLocalStorage(/filters--.+/);
console.log(localStorage);
cy.awaitUrl("/users");
});

Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/users_spec/UsersProfile.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ describe("Manage User Profile", () => {

beforeEach(() => {
cy.restoreLocalStorage();
console.log(localStorage);
cy.clearLocalStorage(/filters--.+/);
console.log(localStorage);
cy.awaitUrl("/user/profile");
});

Expand Down
12 changes: 6 additions & 6 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ to = "/index.html"
status = 200

[[headers]]
for = "/*"
[headers.values]
cache-control = "max-age=0, no-store"
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Content-Security-Policy-Report-Only = '''
for = "/*"
[headers.values]
cache-control = "max-age=0, no-store"
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Content-Security-Policy-Report-Only = '''
default-src 'self';
script-src 'self' 'nonce-f51b9742' https://plausible.10bedicu.in;
style-src 'self' 'unsafe-inline';
Expand Down
15 changes: 11 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"echarts": "^5.5.1",
"echarts-for-react": "^3.0.2",
"events": "^3.3.0",
"hi-profiles": "^1.0.6",
"hi-profiles": "^1.1.0",
"i18next": "^23.11.4",
"i18next-browser-languagedetector": "^7.2.1",
"lodash-es": "^4.17.21",
Expand Down
30 changes: 15 additions & 15 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1144,23 +1144,23 @@ export const AssetImportSchema: SchemaType = {

// ABDM
export const ABDM_CONSENT_PURPOSE = [
{ value: "CAREMGT", label: "Care Management" },
{ value: "BTG", label: "Break The Glass" },
{ value: "PUBHLTH", label: "Public Health" },
{ value: "HPAYMT", label: "Healthcare Payment" },
{ value: "DSRCH", label: "Disease Specific Healthcare Research" },
{ value: "PATRQT", label: "Self Requested" },
] as { value: ConsentPurpose; label: string }[];
"CAREMGT",
"BTG",
"PUBHLTH",
"HPAYMT",
"DSRCH",
"PATRQT",
] as ConsentPurpose[];

export const ABDM_HI_TYPE = [
{ value: "Prescription", label: "Prescription" },
{ value: "DiagnosticReport", label: "Diagnostic Report" },
{ value: "OPConsultation", label: "Op Consultation" },
{ value: "DischargeSummary", label: "Discharge Summary" },
{ value: "ImmunizationRecord", label: "Immunization Record" },
{ value: "HealthDocumentRecord", label: "Record Artifact" },
{ value: "WellnessRecord", label: "Wellness Record" },
] as { value: ConsentHIType; label: string }[];
"Prescription",
"DiagnosticReport",
"OPConsultation",
"DischargeSummary",
"ImmunizationRecord",
"HealthDocumentRecord",
"WellnessRecord",
] as ConsentHIType[];

export const USER_TYPES_MAP = {
Pharmacist: "Pharmacist",
Expand Down
107 changes: 64 additions & 43 deletions src/Components/ABDM/ABDMFacilityRecords.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import { Link } from "raviger";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
import { formatDateTime } from "../../Utils/utils";
import { classNames, formatDateTime } from "../../Utils/utils";
import Loading from "../Common/Loading";
import Page from "../Common/components/Page";
import CareIcon from "../../CAREUI/icons/CareIcon";
import ButtonV2 from "../Common/components/ButtonV2";
import { useTranslation } from "react-i18next";

interface IProps {
facilityId: string;
}

const TableHeads = [
"Patient",
"Status",
"Created On",
"Consent Granted On",
// "Requested By",
"Health Information Range",
"Expires On",
"HI Profiles",
"consent__patient",
"consent__status",
"created_on",
"updated_on",
"consent__hi_range",
"expires_on",
"consent__hi_types",
];

export default function ABDMFacilityRecords({ facilityId }: IProps) {
const { t } = useTranslation();

const {
data: consentsResult,
loading,
refetch,
} = useQuery(routes.abha.listConsents, {
} = useQuery(routes.abdm.consent.list, {
query: { facility: facilityId, ordering: "-created_date" },
});

Expand All @@ -36,7 +38,7 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
}

return (
<Page title="Patient Consent List">
<Page title={t("facility_consent_requests_page_title")}>
<div className="px-4 sm:px-6 lg:px-8">
<div className="sm:flex sm:items-center"></div>
<div className="mt-8 flow-root">
Expand All @@ -51,7 +53,7 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
scope="col"
className="px-3 py-3.5 text-center text-sm font-semibold text-secondary-900"
>
{head}
{t(head)}
</th>
))}
<th
Expand All @@ -63,9 +65,9 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
ghost
className="max-w-2xl text-sm text-secondary-700 hover:text-secondary-900"
>
<CareIcon icon="l-refresh" /> Refresh
<CareIcon icon="l-refresh" /> {t("refresh")}
</ButtonV2>
<span className="sr-only">View</span>
<span className="sr-only">{t("view")}</span>
</th>
</tr>
</thead>
Expand All @@ -84,21 +86,44 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) < new Date()
? "EXPIRED"
: (consent.consent_artefacts?.[0]?.status ??
consent.status)}
? t("consent__status__EXPIRED")
: t(
`consent__status__${
consent.consent_artefacts?.[0]?.status ??
consent.status
}`,
)}
</td>

<td className="px-3 py-4 text-center text-sm">
{formatDateTime(consent.created_date)}
</td>

<td className="px-3 py-4 text-center text-sm">
{consent.consent_artefacts.length
? formatDateTime(
consent.consent_artefacts[0].created_date,
)
: "-"}
{consent.status === "EXPIRED" ||
new Date(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) < new Date() ? (
<p className="flex flex-col items-center gap-1">
{formatDateTime(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
)}
<span className="text-sm text-secondary-600">
{t("expired_on")}
</span>
</p>
) : consent.status === "REQUESTED" ? (
"-"
) : (
<p className="flex flex-col items-center gap-1">
{formatDateTime(consent.modified_date)}
<span className="text-sm text-secondary-600">
{t(`${consent.status.toLowerCase()}_on`)}
</span>
</p>
)}
</td>

<td className="px-3 py-4 text-center text-sm">
Expand Down Expand Up @@ -127,34 +152,30 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) {
consent.hi_types
)?.map((hiType) => (
<span className="mb-2 mr-2 rounded-full bg-secondary-100 px-2 py-1 text-xs font-medium text-secondary-600">
{hiType}
{t(`consent__hi_type__${hiType}`)}
</span>
))}
</div>
</td>

<td className="sticky right-0 whitespace-nowrap bg-white py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
<div className="flex flex-col items-center justify-center gap-2">
{(consent.consent_artefacts?.[0]?.status ??
consent.status) === "GRANTED" &&
new Date(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) > new Date() ? (
<Link
key={consent.id}
href={`/abdm/health-information/${consent.id}`}
className={
"cursor-pointer text-primary-600 hover:text-primary-900"
}
>
View
</Link>
) : (
<p className="cursor-not-allowed text-secondary-600 opacity-70">
View
</p>
)}
<Link
key={consent.id}
href={`/abdm/health-information/${consent.id}`}
className={classNames(
(consent.consent_artefacts?.[0]?.status ??
consent.status) === "GRANTED" &&
new Date(
consent.consent_artefacts?.[0]?.expiry ??
consent.expiry,
) > new Date()
? "cursor-pointer text-primary-600 hover:text-primary-900"
: "pointer-events-none cursor-not-allowed text-secondary-600 opacity-70",
)}
>
{t("view")}
</Link>
</div>
</td>
</tr>
Expand Down
Loading

0 comments on commit 54c08f1

Please sign in to comment.