Skip to content

Commit

Permalink
Merge branch 'develop' into fix#6771
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevildude authored Apr 21, 2024
2 parents 97acb93 + 768a5b3 commit 3c490bc
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 17 deletions.
4 changes: 1 addition & 3 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ describe("Asset", () => {
assetPage.interceptAssetCreation();
assetPage.clickCreateAsset();
assetPage.verifyAssetCreation();

assetSearchPage.typeSearchKeyword("New Test Asset Vital");
assetSearchPage.pressEnter();

assetPage.openCreatedAsset();
assetPage.configureVitalAsset("Host name", "192.168.1.64");
assetPage.configureVitalAsset("Host name", "192.168.1.20");
assetPage.clickConfigureVital();
});

Expand Down
4 changes: 2 additions & 2 deletions src/Components/ABDM/LinkABHANumberModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ const ScanABHAQRSection = ({
body: {
patientId,
hidn: abha?.hidn,
phr: abha?.hid,
phr: (abha?.phr ?? abha?.hid) as string,
name: abha?.name,
gender: abha?.gender,
dob: abha?.dob.replace(/\//g, "-"),
address: abha?.address,
"dist name": abha?.district_name,
"dist name": abha?.["dist name"] ?? abha?.district_name,
"state name": abha?.["state name"],
},
});
Expand Down
8 changes: 5 additions & 3 deletions src/Components/ABDM/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ export interface ILinkViaQRBody {
export interface ABHAQRContent {
address: string;
distlgd: string;
district_name: string;
district_name?: string;
dob: string;
gender: "M";
hid: string;
gender: "M" | "F" | "O";
hid?: string;
phr?: string;
"dist name"?: string;
hidn: string;
mobile: string;
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ const LogUpdateCardAttribute = <T extends keyof DailyRoundsModel>({
</div>
);

case "rounds_type":
return (
<div className="flex flex-col items-center gap-2 md:flex-row">
<AttributeLabel attributeKey={attributeKey} />
<span className="text-sm font-semibold text-gray-700">
{(attributeValue as string) === "VENTILATOR"
? "CRITICAL CARE"
: (attributeValue as string)}
</span>
</div>
);

default:
return (
<div className="flex flex-col items-center gap-2 md:flex-row">
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form/FormFields/TextFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => {
);
const _trailing =
trailing === trailingFocused ? (
<div className="relative inset-y-0 right-0 flex items-center pr-3">
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
{trailing}
</div>
) : (
Expand Down
33 changes: 26 additions & 7 deletions src/Components/Notifications/NotificationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ const NotificationTile = ({
setIsMarkingAsRead(false);
};

const handleMarkAsUnRead = async () => {
setIsMarkingAsRead(true);
await request(routes.markNotificationAsUnRead, {
pathParams: { id: result.id },
body: { read_at: null },
});
setResult({ ...result, read_at: null });
setIsMarkingAsRead(false);
};

const resultUrl = (event: string, data: any) => {
switch (event) {
case "PATIENT_CREATED":
Expand Down Expand Up @@ -107,24 +117,33 @@ const NotificationTile = ({
</div>
<div className="flex justify-end gap-2">
<ButtonV2
className={classNames(
"bg-white px-2 py-1 font-semibold hover:bg-secondary-300",
result.read_at && "invisible",
)}
className="bg-white px-2 py-1 font-semibold hover:bg-secondary-300"
variant="secondary"
border
ghost
disabled={isMarkingAsRead}
onClick={(event) => {
event.stopPropagation();
handleMarkAsRead();
if (result.read_at) {
handleMarkAsUnRead();
} else {
handleMarkAsRead();
}
}}
>
<CareIcon
icon={isMarkingAsRead ? "l-spinner" : "l-envelope-check"}
icon={
isMarkingAsRead
? "l-spinner"
: result.read_at
? "l-envelope"
: "l-envelope-check"
}
className={isMarkingAsRead ? "animate-spin" : ""}
/>
<span className="text-xs">{t("mark_as_read")}</span>
<span className="text-xs">
{result.read_at ? t("mark_as_unread") : t("mark_as_read")}
</span>
</ButtonV2>
<ButtonV2
border
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Patient/SampleDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const SampleDetails = ({ id }: DetailRoute) => {
);
};

if (isLoading) {
if (isLoading || !sampleDetails) {
return <Loading />;
}

Expand Down
1 change: 1 addition & 0 deletions src/Locale/en/Notifications.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"no_notices_for_you": "No notices for you.",
"mark_as_read": "Mark as Read",
"mark_as_unread": "Mark as Unread",
"subscribe": "Subscribe",
"subscribe_on_this_device": "Subscribe on this device",
"show_unread_notifications": "Show Unread",
Expand Down
5 changes: 5 additions & 0 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,11 @@ const routes = {
method: "PATCH",
TRes: Type<NotificationData>(),
},
markNotificationAsUnRead: {
path: "/api/v1/notification/{id}/",
method: "PATCH",
TRes: Type<NotificationData>(),
},
getPublicKey: {
path: "/api/v1/notification/public_key/",
method: "GET",
Expand Down

0 comments on commit 3c490bc

Please sign in to comment.