Skip to content

Commit

Permalink
Merge branch 'develop' into sainak/feat/webrtc-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak authored Oct 18, 2023
2 parents 0afb117 + db52839 commit 5fbfa78
Show file tree
Hide file tree
Showing 59 changed files with 1,370 additions and 1,150 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("Asset Tab", () => {
assetPage.selectImportOption();
assetPage.selectImportFacility("Dummy Facility 1");
assetPage.importAssetFile();
assetPage.selectImportLocation("Camera Loc");
assetPage.selectImportLocation("Camera Locations");
assetPage.clickImportAsset();
});

Expand Down
33 changes: 33 additions & 0 deletions cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import { AssetFilters } from "../../pageobject/Asset/AssetFilters";

function addDaysToDate(numberOfDays: number) {
const inputDate = new Date();
inputDate.setDate(inputDate.getDate() + numberOfDays);
return inputDate.toISOString().split("T")[0];
}

describe("Asset", () => {
const assetPage = new AssetPage();
const loginPage = new LoginPage();
Expand All @@ -26,6 +32,33 @@ describe("Asset", () => {
cy.awaitUrl("/assets");
});

it("Verify Asset Warranty Expiry Label", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
assetSearchPage.verifyBadgeContent(assetname);
assetSearchPage.clickAssetByName(assetname);
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // greater than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(80)); // less than 3 months
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("3 months");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(20)); // less than 1 month
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("1 month");
assetPage.clickupdatedetailbutton();
assetPage.scrollintoWarrantyDetails();
assetPage.enterWarrantyExpiryDate(addDaysToDate(100)); // check for greater than 3 months again to verify the label is removed
assetPage.clickassetupdatebutton();
assetPage.verifyWarrantyExpiryLabel("");
});

it("Create & Edit a service history and verify reflection", () => {
assetSearchPage.typeSearchKeyword(assetname);
assetSearchPage.pressEnter();
Expand Down
29 changes: 26 additions & 3 deletions cypress/pageobject/Asset/AssetCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class AssetPage {

configureVitalAsset(hostName: string, localIp: string) {
cy.get("[data-testid=asset-configure-button]").click();
cy.get("#middlewareHostname").type(hostName);
cy.get("#middleware_hostname").type(hostName);
cy.get("#localipAddress").type(localIp);
}

Expand Down Expand Up @@ -285,16 +285,39 @@ export class AssetPage {
cy.get("#notes").scrollIntoView();
}

enterAssetNotes(text) {
enterAssetNotes(text: string) {
cy.get("#notes").click().clear();
cy.get("#notes").click().type(text);
}

enterAssetservicedate(text) {
enterAssetservicedate(text: string) {
cy.get("input[name='last_serviced_on']").click();
cy.get("#date-input").click().type(text);
}

scrollintoWarrantyDetails() {
cy.get("#warranty-details").scrollIntoView();
}

enterWarrantyExpiryDate(text: string) {
cy.get("#WarrantyAMCExpiry").click();
cy.get("#WarrantyAMCExpiry").click().type(text);
}

verifyWarrantyExpiryLabel(duration: string) {
if (duration === "") {
cy.get("#warranty-amc-expired-red").should("not.exist");
cy.get("#warranty-amc-expiring-soon-orange").should("not.exist");
cy.get("#warranty-amc-expiring-soon-yellow").should("not.exist");
} else if (duration === "expired") {
cy.get("#warranty-amc-expired-red").should("be.visible");
} else if (duration === "1 month") {
cy.get("#warranty-amc-expiring-soon-orange").should("be.visible");
} else if (duration === "3 months") {
cy.get("#warranty-amc-expiring-soon-yellow").should("be.visible");
}
}

clickassetupdatebutton() {
cy.get("#submit").click();
}
Expand Down
18 changes: 16 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"events": "^3.3.0",
"i18next": "^23.2.7",
"i18next-browser-languagedetector": "^7.1.0",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"postcss-loader": "^7.3.3",
"qrcode.react": "^3.1.0",
"raviger": "^4.1.2",
Expand Down Expand Up @@ -114,7 +114,7 @@
"@types/cypress": "^1.1.3",
"@types/echarts": "^4.9.18",
"@types/google.maps": "^3.53.4",
"@types/lodash": "^4.14.195",
"@types/lodash-es": "^4.17.9",
"@types/lodash.get": "^4.4.7",
"@types/node": "^20.4.0",
"@types/prop-types": "*",
Expand Down
9 changes: 5 additions & 4 deletions public/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"site_url": "care.coronasafe.in",
"analytics_server_url": "https://plausible.10bedicu.in",
"header_logo": {
"light":"https://cdn.coronasafe.network/header_logo.png",
"dark":"https://cdn.coronasafe.network/header_logo.png"
"light": "https://cdn.coronasafe.network/header_logo.png",
"dark": "https://cdn.coronasafe.network/header_logo.png"
},
"main_logo": {
"light":"https://cdn.coronasafe.network/light-logo.svg",
"dark":"https://cdn.coronasafe.network/black-logo.svg"
"light": "https://cdn.coronasafe.network/light-logo.svg",
"dark": "https://cdn.coronasafe.network/black-logo.svg"
},
"gmaps_api_key": "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk",
"gov_data_api_key": "579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b",
Expand All @@ -25,4 +25,5 @@
"enable_abdm": true,
"jwt_token_refresh_interval": 300000,
"use_webrtc": true
"enable_abdm": true
}
2 changes: 2 additions & 0 deletions src/CAREUI/display/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface Props {
text: string;
tooltip?: string;
className?: string;
id?: string;
}

export default function Chip({
Expand All @@ -21,6 +22,7 @@ export default function Chip({
}: Props) {
return (
<span
id={props?.id}
className={classNames(
"inline-flex items-center gap-2 font-medium leading-4",

Expand Down
2 changes: 1 addition & 1 deletion src/CAREUI/misc/PaginatedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function useContextualized<TItem>() {
return ctx as PaginatedListContext<TItem>;
}

interface Props<TItem> extends QueryOptions {
interface Props<TItem> extends QueryOptions<PaginatedResponse<TItem>> {
route: QueryRoute<PaginatedResponse<TItem>>;
perPage?: number;
children: (ctx: PaginatedListContext<TItem>) => JSX.Element | JSX.Element[];
Expand Down
1 change: 1 addition & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export const TELEMEDICINE_ACTIONS = [
{ id: 60, text: "COMPLETE", desc: "Complete" },
{ id: 70, text: "REVIEW", desc: "Review" },
{ id: 80, text: "NOT_REACHABLE", desc: "Not Reachable" },
{ id: 90, text: "DISCHARGE_RECOMMENDED", desc: "Discharge Recommended" },
];

export const FRONTLINE_WORKER = [
Expand Down
2 changes: 1 addition & 1 deletion src/Common/hooks/useAsyncOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce } from "lodash";
import { debounce } from "lodash-es";
import { useMemo, useState } from "react";
import { useDispatch } from "react-redux";

Expand Down
19 changes: 11 additions & 8 deletions src/Components/ABDM/ABHAProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import CareIcon from "../../CAREUI/icons/CareIcon";
import DialogModal from "../Common/Dialog";
import QRCode from "qrcode.react";
import { formatDateTime } from "../../Utils/utils";
import { getAbhaCard } from "../../Redux/actions";
import { useDispatch } from "react-redux";
import { useRef } from "react";
import request from "../../Utils/request/request";
import routes from "../../Redux/api";

interface IProps {
patientId?: string;
Expand All @@ -18,21 +18,24 @@ interface IProps {

const ABHAProfileModal = ({ patientId, show, onClose, abha }: IProps) => {
const printRef = useRef(null);
const dispatch = useDispatch<any>();

const downloadAbhaCard = async (type: "pdf" | "png") => {
if (!patientId) return;
const response = await dispatch(getAbhaCard(patientId, type));
const { res, data } = await request(routes.abha.getAbhaCard, {
body: {
patient: patientId,
type: type,
},
});

if (response.status === 200 && response.data) {
if (res?.status === 200 && data) {
if (type === "png") {
const downloadLink = document.createElement("a");
downloadLink.href =
"data:application/octet-stream;base64," + response.data;
downloadLink.href = "data:application/octet-stream;base64," + data;
downloadLink.download = "abha.png";
downloadLink.click();
} else {
const htmlPopup = `<embed width=100% height=100%" type='application/pdf' src='data:application/pdf;base64,${response.data}'></embed>`;
const htmlPopup = `<embed width=100% height=100%" type='application/pdf' src='data:application/pdf;base64,${data}'></embed>`;

const printWindow = window.open("", "PDF");
printWindow?.document.write(htmlPopup);
Expand Down
Loading

0 comments on commit 5fbfa78

Please sign in to comment.