From b6381b1006969ef475b2287f2ba81f28eb25c4fa Mon Sep 17 00:00:00 2001 From: Parth Kothari Date: Fri, 12 Jan 2024 17:36:24 +0530 Subject: [PATCH 1/3] Fixes with Lint --- .eslintrc.json | 5 +- .husky/pre-commit | 1 + package-lock.json | 101 ++++- package.json | 2 +- .../app-footer/app-footer.component.html | 13 +- .../app-footer/app-footer.component.spec.ts | 45 ++- .../app-footer/app-footer.component.ts | 68 ++-- .../app-header/app-header.component.html | 198 +++++++--- .../app-header/app-header.component.spec.ts | 151 +++---- .../app-header/app-header.component.ts | 307 ++++++++------- .../camera-dialog.component.html | 252 ++++++++---- .../camera-dialog.component.spec.ts | 45 ++- .../camera-dialog/camera-dialog.component.ts | 177 +++++---- .../common-dialog.component.html | 215 ++++++---- .../common-dialog.component.spec.ts | 45 ++- .../common-dialog/common-dialog.component.ts | 63 +-- .../previous-details.component.html | 37 +- .../previous-details.component.spec.ts | 45 ++- .../previous-details.component.ts | 89 +++-- .../core/components/set-language.component.ts | 69 ++-- ...-commit-and-version-details.component.html | 27 +- ...mmit-and-version-details.component.spec.ts | 45 ++- ...ow-commit-and-version-details.component.ts | 58 +-- .../spinner/spinner.component.spec.ts | 45 ++- .../components/spinner/spinner.component.ts | 53 ++- .../textarea-dialog.component.html | 16 +- .../textarea-dialog.component.spec.ts | 45 ++- .../textarea-dialog.component.ts | 53 ++- .../textarea-dialog.service.ts | 58 ++- src/app/app-modules/core/core.module.ts | 127 +++--- .../MobileNumber/myMobileNumber.directive.ts | 65 ++- .../disableFormControl.directive.ts | 68 ++-- .../directives/email/myEmail.directive.ts | 84 ++-- .../core/directives/name/myName.directive.ts | 67 ++-- .../null-default-value.directive.ts | 57 +-- .../directives/numberValidator.directive.ts | 66 ++-- .../password/myPassword.directive.ts | 127 +++--- .../directives/stringValidator.directive.ts | 94 ++--- src/app/app-modules/core/material.module.ts | 52 ++- .../mocks/beneficiary-details-service-stub.ts | 46 ++- .../core/services/auth-guard.service.ts | 67 ++-- .../app-modules/core/services/auth.service.ts | 105 ++--- .../services/beneficiary-details.service.ts | 74 ++-- .../core/services/camera.service.ts | 145 +++---- .../services/can-deactivate-guard.service.ts | 47 ++- .../core/services/confirmation.service.ts | 371 ++++++++++-------- .../services/global-error-handler.service.ts | 47 ++- .../core/services/http-interceptor.service.ts | 61 +-- .../core/services/http-service.service.ts | 77 ++-- src/app/app-modules/core/services/index.ts | 44 +-- .../core/services/spinner.service.ts | 46 ++- .../appointment-view.component.html | 169 +++++--- .../appointment-view.component.spec.ts | 45 ++- .../appointment-view.component.ts | 240 ++++++----- .../dashboard/dashboard.component.html | 2 +- .../dashboard/dashboard.component.spec.ts | 45 ++- .../dashboard/dashboard.component.ts | 47 ++- .../scheduler/mystaff/mystaff.component.html | 48 ++- .../mystaff/mystaff.component.spec.ts | 45 ++- .../scheduler/mystaff/mystaff.component.ts | 126 +++--- .../mystaff/profile/profile.component.html | 61 ++- .../mystaff/profile/profile.component.spec.ts | 45 ++- .../mystaff/profile/profile.component.ts | 84 ++-- .../chief-complaint-report.component.html | 63 ++- .../chief-complaint-report.component.spec.ts | 45 ++- .../chief-complaint-report.component.ts | 236 ++++++----- .../consultation-report.component.html | 62 ++- .../consultation-report.component.spec.ts | 45 ++- .../consultation-report.component.ts | 212 +++++----- .../daily-report/daily-report.component.html | 56 ++- .../daily-report.component.spec.ts | 45 ++- .../daily-report/daily-report.component.ts | 198 +++++----- .../monthly-report.component.html | 51 ++- .../monthly-report.component.spec.ts | 45 ++- .../monthly-report.component.ts | 257 ++++++------ .../total-consultation-report.component.html | 63 ++- ...otal-consultation-report.component.spec.ts | 45 ++- .../total-consultation-report.component.ts | 224 ++++++----- .../scheduler/scheduler-routing.module.ts | 74 ++-- .../app-modules/scheduler/scheduler.module.ts | 70 ++-- .../scheduler/shared/services/index.ts | 40 +- .../shared/services/scheduler.service.ts | 211 +++++----- .../create-sms-template.component.html | 243 +++++++++--- .../create-sms-template.component.spec.ts | 45 ++- .../create-sms-template.component.ts | 290 ++++++++------ .../sms-template-list.component.html | 139 +++++-- .../sms-template-list.component.spec.ts | 45 ++- .../sms-template-list.component.ts | 139 ++++--- .../sms-template/sms-template.component.html | 2 +- .../sms-template.component.spec.ts | 45 ++- .../sms-template/sms-template.component.ts | 46 ++- .../view-sms-template.component.html | 5 +- .../view-sms-template.component.spec.ts | 45 ++- .../view-sms-template.component.ts | 96 ++--- ...pecialization-calander-view.component.html | 95 ++++- ...ialization-calander-view.component.spec.ts | 45 ++- .../specialization-calander-view.component.ts | 132 ++++--- .../timesheet/timesheet.component.html | 174 ++++++-- .../timesheet/timesheet.component.spec.ts | 45 ++- .../timesheet/timesheet.component.ts | 347 ++++++++-------- src/app/app-routing.module.ts | 15 +- src/app/app.component.html | 2 +- src/app/app.component.spec.ts | 14 +- src/app/app.component.ts | 39 +- src/app/app.module.ts | 26 +- src/app/redir-open/redir-open.component.html | 2 +- .../redir-open/redir-open.component.spec.ts | 45 ++- src/app/redir-open/redir-open.component.ts | 198 ++++++---- src/environments/environment.development.ts | 44 +-- src/environments/environment.prod.ts | 44 +-- src/environments/environment.ts | 46 +-- src/index.html | 40 +- src/main.ts | 6 +- src/test.ts | 46 +-- src/typings.d.ts | 42 +- 115 files changed, 5646 insertions(+), 4205 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 51dd1f9..67decd9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,7 +31,10 @@ "prefix": "app", "style": "kebab-case" } - ] + ], + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-empty-function": 0, + "@typescript-eslint/no-unused-vars": 0 } }, { diff --git a/.husky/pre-commit b/.husky/pre-commit index d24fdfc..e7a7dcc 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,3 +2,4 @@ . "$(dirname -- "$0")/_/husky.sh" npx lint-staged +npx lint-staged diff --git a/package-lock.json b/package-lock.json index 91601fd..d2f0b12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3160,6 +3160,15 @@ "@fullcalendar/core": "~6.1.10" } }, + "node_modules/@fullcalendar/core": { + "version": "6.1.10", + "resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.10.tgz", + "integrity": "sha512-oTXGJSAGpCf1oY+CKp5qYjMHkJCPBkJ3SHitl63n8Q6xKeiwQ4EF6Au451euUovREwJpLmD1AyZrCnWmtB9AVg==", + "peer": true, + "dependencies": { + "preact": "~10.12.1" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -4651,6 +4660,16 @@ "url": "https://opencollective.com/unts" } }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, "node_modules/@schematics/angular": { "version": "16.2.11", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-16.2.11.tgz", @@ -14177,6 +14196,16 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "node_modules/preact": { + "version": "10.12.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz", + "integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -18597,7 +18626,8 @@ "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true + "dev": true, + "requires": {} }, "@babel/plugin-proposal-unicode-property-regex": { "version": "7.18.6", @@ -19773,6 +19803,15 @@ "tslib": "^2.3.0" } }, + "@fullcalendar/core": { + "version": "6.1.10", + "resolved": "https://registry.npmjs.org/@fullcalendar/core/-/core-6.1.10.tgz", + "integrity": "sha512-oTXGJSAGpCf1oY+CKp5qYjMHkJCPBkJ3SHitl63n8Q6xKeiwQ4EF6Au451euUovREwJpLmD1AyZrCnWmtB9AVg==", + "peer": true, + "requires": { + "preact": "~10.12.1" + } + }, "@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", @@ -20711,7 +20750,8 @@ "version": "16.2.11", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-16.2.11.tgz", "integrity": "sha512-4ndXJ4s94ZsryVGSDk/waIDrUqXqdGWftoOEn81Zu+nkL9ncI/G1fNUlSJ5OqeKmMLxMFouoy+BuJfvT+gEgnQ==", - "dev": true + "dev": true, + "requires": {} }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -21019,6 +21059,12 @@ "integrity": "sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ==", "dev": true }, + "@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true + }, "@schematics/angular": { "version": "16.2.11", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-16.2.11.tgz", @@ -21551,7 +21597,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-1.0.1.tgz", "integrity": "sha512-pcub+YbFtFhaGRTo1832FQHQSHvMrlb43974e2eS8EKleR3p1cDdkJFPci1UhwkEf1J9Bz+wKBSzqpKp7nNj2A==", - "dev": true + "dev": true, + "requires": {} }, "@webassemblyjs/ast": { "version": "1.11.6", @@ -21857,13 +21904,15 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "dev": true + "dev": true, + "requires": {} }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "7.2.0", @@ -22354,7 +22403,8 @@ "bootstrap": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.2.tgz", - "integrity": "sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==" + "integrity": "sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==", + "requires": {} }, "brace-expansion": { "version": "1.1.11", @@ -23540,7 +23590,8 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "dev": true + "dev": true, + "requires": {} } } }, @@ -23910,7 +23961,8 @@ "version": "9.1.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", - "dev": true + "dev": true, + "requires": {} }, "eslint-plugin-prettier": { "version": "5.1.3", @@ -24986,7 +25038,8 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", - "dev": true + "dev": true, + "requires": {} }, "ieee754": { "version": "1.2.1", @@ -25796,7 +25849,8 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.1.0.tgz", "integrity": "sha512-sPQE1+nlsn6Hwb5t+HHwyy0A1FNCVKuL1192b+XNauMYWThz2kweiBVW1DqloRpVvZIJkIoHVB7XRpK78n1xbQ==", - "dev": true + "dev": true, + "requires": {} }, "karma-source-map-support": { "version": "1.4.0", @@ -28132,7 +28186,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", - "dev": true + "dev": true, + "requires": {} }, "postcss-modules-local-by-default": { "version": "4.0.3", @@ -28179,6 +28234,12 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "preact": { + "version": "10.12.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.12.1.tgz", + "integrity": "sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==", + "peer": true + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -29271,7 +29332,8 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "dev": true + "dev": true, + "requires": {} } } }, @@ -29703,7 +29765,8 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "json-schema-traverse": { "version": "0.4.1", @@ -29835,7 +29898,8 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", - "dev": true + "dev": true, + "requires": {} }, "tsconfig-paths": { "version": "4.2.0", @@ -30331,7 +30395,8 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "dev": true, + "requires": {} }, "json-schema-traverse": { "version": "0.4.1", @@ -30420,7 +30485,8 @@ "version": "8.15.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.1.tgz", "integrity": "sha512-W5OZiCjXEmk0yZ66ZN82beM5Sz7l7coYxpRkzS+p9PP+ToQry8szKh+61eNktr7EA9DOwvFGhfC605jDHbP6QQ==", - "dev": true + "dev": true, + "requires": {} } } }, @@ -30609,7 +30675,8 @@ "version": "7.5.9", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true + "dev": true, + "requires": {} }, "xlsx": { "version": "0.18.5", diff --git a/package.json b/package.json index 009654c..f53d000 100644 --- a/package.json +++ b/package.json @@ -71,4 +71,4 @@ "prettier-eslint": "^16.2.0", "typescript": "~5.1.3" } -} +} \ No newline at end of file diff --git a/src/app/app-modules/core/components/app-footer/app-footer.component.html b/src/app/app-modules/core/components/app-footer/app-footer.component.html index bc6ad45..046a49a 100644 --- a/src/app/app-modules/core/components/app-footer/app-footer.component.html +++ b/src/app/app-modules/core/components/app-footer/app-footer.component.html @@ -1,15 +1,18 @@ \ No newline at end of file + diff --git a/src/app/app-modules/core/components/app-footer/app-footer.component.spec.ts b/src/app/app-modules/core/components/app-footer/app-footer.component.spec.ts index bc622af..e6082bf 100644 --- a/src/app/app-modules/core/components/app-footer/app-footer.component.spec.ts +++ b/src/app/app-modules/core/components/app-footer/app-footer.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AppFooterComponent } from './app-footer.component'; @@ -29,9 +29,8 @@ describe('AppFooterComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppFooterComponent ] - }) - .compileComponents(); + declarations: [AppFooterComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/app-footer/app-footer.component.ts b/src/app/app-modules/core/components/app-footer/app-footer.component.ts index fb9cc31..330a848 100644 --- a/src/app/app-modules/core/components/app-footer/app-footer.component.ts +++ b/src/app/app-modules/core/components/app-footer/app-footer.component.ts @@ -1,53 +1,50 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { HttpServiceService } from '../../services/http-service.service'; import { SetLanguageComponent } from '../set-language.component'; @Component({ selector: 'app-footer', templateUrl: './app-footer.component.html', - styleUrls: ['./app-footer.component.css'] + styleUrls: ['./app-footer.component.css'], }) -export class AppFooterComponent implements OnInit { - +export class AppFooterComponent implements OnInit, DoCheck { languageComponent!: SetLanguageComponent; status!: boolean; // today: Date; - constructor( - public httpServiceService : HttpServiceService - ) { } - year:any; - today!:Date; - currentLanguageSet:any; + constructor(public httpServiceService: HttpServiceService) {} + year: any; + today!: Date; + currentLanguageSet: any; ngOnInit() { this.today = new Date(); this.year = this.today.getFullYear(); this.fetchLanguageResponse(); - console.log('inside footer',this.year); - - setInterval(() => { - this.status = navigator.onLine; - }, 1000); + console.log('inside footer', this.year); + + setInterval(() => { + this.status = navigator.onLine; + }, 1000); } // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- @@ -61,5 +58,4 @@ export class AppFooterComponent implements OnInit { this.currentLanguageSet = this.languageComponent.currentLanguageObject; } // -----End------ - } diff --git a/src/app/app-modules/core/components/app-header/app-header.component.html b/src/app/app-modules/core/components/app-header/app-header.component.html index 77a3cf0..a8c8cfd 100644 --- a/src/app/app-modules/core/components/app-header/app-header.component.html +++ b/src/app/app-modules/core/components/app-header/app-header.component.html @@ -2,73 +2,113 @@
@@ -78,39 +118,81 @@
-
\ No newline at end of file +
diff --git a/src/app/app-modules/core/components/app-header/app-header.component.spec.ts b/src/app/app-modules/core/components/app-header/app-header.component.spec.ts index 2a4b4fb..65e0320 100644 --- a/src/app/app-modules/core/components/app-header/app-header.component.spec.ts +++ b/src/app/app-modules/core/components/app-header/app-header.component.spec.ts @@ -1,25 +1,32 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { async, ComponentFixture, tick, inject, fakeAsync, TestBed } from '@angular/core/testing'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { + async, + ComponentFixture, + tick, + inject, + fakeAsync, + TestBed, +} from '@angular/core/testing'; import { AuthService } from '../../services/auth.service'; import { AppHeaderComponent } from './app-header.component'; import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; @@ -34,26 +41,18 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { Router, ActivatedRoute } from '@angular/router'; import { MaterialModule } from '../../../core/material.module'; - class RouterStub { - navigate(something) { - - } + // navigate(something) {} } class MockActivatedRoute { - snapshot = { - params: [null] - } + params: [null], + }; } class authServiceMock { - - logoutUser() { - - } + // logoutUser() {} } - describe('AppHeaderComponent', () => { let component: AppHeaderComponent; let fixture: ComponentFixture; @@ -63,13 +62,14 @@ describe('AppHeaderComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], - imports: [ MaterialModule, NoopAnimationsModule], - declarations: [ AppHeaderComponent ], - providers: [{ provide: Router, useClass: RouterStub }, + imports: [MaterialModule, NoopAnimationsModule], + declarations: [AppHeaderComponent], + providers: [ + { provide: Router, useClass: RouterStub }, { provide: ActivatedRoute, useClass: MockActivatedRoute }, - {provide: AuthService, useClass: authServiceMock}] - }) - .compileComponents(); + { provide: AuthService, useClass: authServiceMock }, + ], + }).compileComponents(); })); beforeEach(() => { @@ -84,68 +84,75 @@ describe('AppHeaderComponent', () => { window.sessionStorage.setItem('isAuthenticated', 'true'); }); - it('should create app header component', () => { expect(component).toBeTruthy(); }); it('should get servicePointName from localstorage when init', () => { fixture.autoDetectChanges(); - expect(component.servicePoint).toEqual(window.localStorage.getItem('servicePointName')); - }) + expect(component.servicePoint).toEqual( + window.localStorage.getItem('servicePointName'), + ); + }); it('should get userName from localstorage when init', () => { fixture.autoDetectChanges(); expect(component.userName).toEqual(window.localStorage.getItem('userName')); - }) + }); it('should get isAuthenticated from localstorage when init', () => { fixture.autoDetectChanges(); - expect((component.isAuthenticated).toString()).toBe(window.sessionStorage.getItem('isAuthenticated')); - }) + expect(component.isAuthenticated.toString()).toBe( + window.sessionStorage.getItem('isAuthenticated'), + ); + }); - it('should keep roles as undefined as we\'ve kept showroles as no', () => { + it("should keep roles as undefined as we've kept showroles as no", () => { fixture.autoDetectChanges(); expect(component.roles).toBe(undefined); - }) + }); - it('should keep filteredNavigation as undefined as we\'ve kept showroles as no', () => { + it("should keep filteredNavigation as undefined as we've kept showroles as no", () => { fixture.autoDetectChanges(); expect(component.filteredNavigation).toBe(undefined); - }) - + }); it('should set roles as per save in localstorage when we have showRoles set to true', () => { component.showRoles = true; - const role = '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; + const role = + '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; window.localStorage.setItem('role', role); component.ngOnInit(); fixture.detectChanges(); expect(component.roles).toBeTruthy(); - }) + }); - it('should not set roles as per save in localstorage when we don\'t have showRoles set to true', () => { - const role = '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; + it("should not set roles as per save in localstorage when we don't have showRoles set to true", () => { + const role = + '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; window.localStorage.setItem('role', role); component.ngOnInit(); fixture.detectChanges(); expect(component.roles).not.toBeTruthy(); - }) + }); it('should filteredNavigation as per save in localstorage when we have showRoles set to true', () => { component.showRoles = true; - const role = '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; + const role = + '["Registrar","Nurse","Doctor","TC Specialist","Oncologist","Lab Technician","Pharmacist"]'; window.localStorage.setItem('role', role); component.ngOnInit(); fixture.detectChanges(); expect(component.filteredNavigation).toBeTruthy(); - }) + }); it('should call logout method on click of logout tag', fakeAsync(() => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of(1)); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of(1), + ); component.ngOnInit(); fixture.detectChanges(); - let el = fixture.debugElement.query(By.css('#logoutButton')); + const el = fixture.debugElement.query(By.css('#logoutButton')); el.triggerEventHandler('click', null); tick(); fixture.detectChanges(); @@ -153,7 +160,9 @@ describe('AppHeaderComponent', () => { })); it('should not clear local storage asresponse is not correct', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 401})); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 401 }), + ); component.ngOnInit(); component.logout(); @@ -161,7 +170,9 @@ describe('AppHeaderComponent', () => { }); it('should not clear session storage asresponse is not correct', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 401 })); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 401 }), + ); component.ngOnInit(); component.logout(); @@ -169,7 +180,9 @@ describe('AppHeaderComponent', () => { }); it('should clear local storage as response is correct', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 200 })); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 200 }), + ); component.ngOnInit(); component.logout(); @@ -177,7 +190,9 @@ describe('AppHeaderComponent', () => { }); it('should clear local storage as response is correct', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 200 })); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 200 }), + ); component.ngOnInit(); component.logout(); @@ -185,7 +200,9 @@ describe('AppHeaderComponent', () => { }); it('should call to navigate to other component', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 200 })); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 200 }), + ); const spier = spyOn(router, 'navigate'); component.ngOnInit(); component.logout(); @@ -193,12 +210,12 @@ describe('AppHeaderComponent', () => { }); it('should call to navigate to login component', () => { - const spy = spyOn(authService, 'logoutUser').and.returnValue(Observable.of({ statusCode: 200 })); + const spy = spyOn(authService, 'logoutUser').and.returnValue( + Observable.of({ statusCode: 200 }), + ); const spier = spyOn(router, 'navigate'); component.ngOnInit(); component.logout(); expect(spier).toHaveBeenCalledWith(['/login']); }); - - }); diff --git a/src/app/app-modules/core/components/app-header/app-header.component.ts b/src/app/app-modules/core/components/app-header/app-header.component.ts index fba0cdb..09c861c 100644 --- a/src/app/app-modules/core/components/app-header/app-header.component.ts +++ b/src/app/app-modules/core/components/app-header/app-header.component.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component, OnInit, Input } from '@angular/core'; import { Router } from '@angular/router'; import { AuthService } from '../../services/auth.service'; @@ -31,17 +31,17 @@ import { environment } from 'src/environments/environment'; @Component({ selector: 'app-header', templateUrl: './app-header.component.html', - styleUrls: ['./app-header.component.css'] + styleUrls: ['./app-header.component.css'], }) export class AppHeaderComponent implements OnInit { - @Input('showRoles') + @Input() showRoles!: boolean; - language_file_path: any = "./assets/"; - app_language: any = "English"; + language_file_path: any = './assets/'; + app_language: any = 'English'; currentLanguageSet: any; languageArray: any; status: any; - isConnected:boolean=true; + isConnected = true; servicePoint: any; userName: any; isAuthenticated!: boolean; @@ -49,48 +49,49 @@ export class AppHeaderComponent implements OnInit { filteredNavigation: any; navigation: any; reportNavigation: any; - license:any; + license: any; constructor( private router: Router, private auth: AuthService, public httpServiceService: HttpServiceService, private confirmationService: ConfirmationService, - private dialog: MatDialog) { } - + private dialog: MatDialog, + ) {} + ngOnInit() { - this.getUIVersionAndCommitDetails() - this.license = environment.licenseUrl; + this.getUIVersionAndCommitDetails(); + this.license = environment.licenseUrl; this.servicePoint = localStorage.getItem('tm-servicePointName'); this.userName = localStorage.getItem('tm-userName'); this.fetchLanguageSet(); - this.isAuthenticated = sessionStorage.getItem('tm-isAuthenticated') == 'true' - + this.isAuthenticated = + sessionStorage.getItem('tm-isAuthenticated') == 'true'; } fetchLanguageSet() { - this.httpServiceService.fetchLanguageSet().subscribe(languageRes => { + this.httpServiceService.fetchLanguageSet().subscribe((languageRes) => { this.languageArray = languageRes; this.getLanguage(); - }) - console.log("language array" + this.languageArray); - + }); + console.log('language array' + this.languageArray); } changeLanguage(language: any) { - - this.httpServiceService.getLanguage(this.language_file_path+language+".json").subscribe({next:(response:any) => { - if(response){ - this.languageSuccessHandler(response,language) - }else{ - alert(this.currentLanguageSet.langNotDefined) - } - }, - error:error => { - alert(this.currentLanguageSet.comingUpWithThisLang + " " + language); - - } - }); + this.httpServiceService + .getLanguage(this.language_file_path + language + '.json') + .subscribe({ + next: (response: any) => { + if (response) { + this.languageSuccessHandler(response, language); + } else { + alert(this.currentLanguageSet.langNotDefined); + } + }, + error: (error) => { + alert(this.currentLanguageSet.comingUpWithThisLang + ' ' + language); + }, + }); } getLanguage() { @@ -102,9 +103,9 @@ export class AppHeaderComponent implements OnInit { } languageSuccessHandler(response: any, language: any) { - console.log("language is ", response); + console.log('language is ', response); if (response == undefined) { - alert(this.currentLanguageSet.langNotDefined) + alert(this.currentLanguageSet.langNotDefined); } if (response[language] !== undefined) { @@ -114,143 +115,167 @@ export class AppHeaderComponent implements OnInit { this.languageArray.forEach((item: any) => { if (item.languageName == language) { this.app_language = language; - } - }); } else { this.app_language = language; } - + this.httpServiceService.getCurrentLanguage(response[language]); this.rolenavigation(); } else { - alert(this.currentLanguageSet.comingUpWithThisLang + " " + language); + alert(this.currentLanguageSet.comingUpWithThisLang + ' ' + language); } } - rolenavigation(){ - this.navigation = [ - { - role: 'Supervisor', - label: this.currentLanguageSet.supervisor, - work: [ - // { link: ['/telemedicine/timesheet', 'Supervisor'], label: 'Timesheet' }, - { link: '/telemedicine/myStaff', label: this.currentLanguageSet.myStaff }, - { link: 'specialization/dayview', label: this.currentLanguageSet.dayView }, - { link: 'smstemplate', label: this.currentLanguageSet.sMSTemplate } - // { link: 'appointment/view', label: 'Appointment View' }, - - ] - }, - { - role: "TC Specialist", - label: this.currentLanguageSet.tCSpecialist, - work: [ - { link: ['/telemedicine/timesheet', 'TC Specialist'], label: this.currentLanguageSet.timesheet } - ] - } - - ]; + rolenavigation() { + this.navigation = [ + { + role: 'Supervisor', + label: this.currentLanguageSet.supervisor, + work: [ + // { link: ['/telemedicine/timesheet', 'Supervisor'], label: 'Timesheet' }, + { + link: '/telemedicine/myStaff', + label: this.currentLanguageSet.myStaff, + }, + { + link: 'specialization/dayview', + label: this.currentLanguageSet.dayView, + }, + { link: 'smstemplate', label: this.currentLanguageSet.sMSTemplate }, + // { link: 'appointment/view', label: 'Appointment View' }, + ], + }, + { + role: 'TC Specialist', + label: this.currentLanguageSet.tCSpecialist, + work: [ + { + link: ['/telemedicine/timesheet', 'TC Specialist'], + label: this.currentLanguageSet.timesheet, + }, + ], + }, + ]; - this.reportNavigation = [{ - role: 'Reports', - label: this.currentLanguageSet.report, - work: [ - { link: 'chiefComplaintReport', label: this.currentLanguageSet.chiefComplaintReport }, - { link: 'totalConsultationReport', label: this.currentLanguageSet.totalConsultationReport }, - { link: 'consultationReport', label: this.currentLanguageSet.consultationReport }, - { link: 'monthlyReport', label: this.currentLanguageSet.monthlyReport }, - { link: 'dailyReport', label: this.currentLanguageSet.dailyReport } - ] - }] + this.reportNavigation = [ + { + role: 'Reports', + label: this.currentLanguageSet.report, + work: [ + { + link: 'chiefComplaintReport', + label: this.currentLanguageSet.chiefComplaintReport, + }, + { + link: 'totalConsultationReport', + label: this.currentLanguageSet.totalConsultationReport, + }, + { + link: 'consultationReport', + label: this.currentLanguageSet.consultationReport, + }, + { + link: 'monthlyReport', + label: this.currentLanguageSet.monthlyReport, + }, + { link: 'dailyReport', label: this.currentLanguageSet.dailyReport }, + ], + }, + ]; - if (this.showRoles) { - let tmRoles = localStorage.getItem('roles'); - this.roles = tmRoles !== null ? JSON.parse(tmRoles): String - if (this.roles) { - this.filteredNavigation = this.navigation.filter((item: any) => { - return this.roles.includes(item.role); - }) + if (this.showRoles) { + const tmRoles = localStorage.getItem('roles'); + this.roles = tmRoles !== null ? JSON.parse(tmRoles) : String; + if (this.roles) { + this.filteredNavigation = this.navigation.filter((item: any) => { + return this.roles.includes(item.role); + }); + } + console.log(' this.filteredNavigation', this.filteredNavigation); } - console.log(' this.filteredNavigation', this.filteredNavigation); - } } DataSync() { - this.router.navigate(['/datasync']) + this.router.navigate(['/datasync']); } redirectToSpecialistWorklist() { - let returnUrl! :any; - returnUrl = sessionStorage.getItem('tm-return'); + const returnUrl: any = sessionStorage.getItem('tm-return'); this.router.navigateByUrl(returnUrl); } returnToMMU: any; logout() { - let loginUrl ! : any ; - loginUrl = sessionStorage.getItem('tm-fallback'); - this.auth.logout().subscribe({next:(res: any) => { - this.auth.removeExternalSessionData(); - this.router.navigateByUrl(loginUrl); - }, - error: (error: any) => { - this.auth.removeExternalSessionData(); - this.router.navigateByUrl(loginUrl); - }}); + const loginUrl: any = sessionStorage.getItem('tm-fallback'); + this.auth.logout().subscribe({ + next: (res: any) => { + this.auth.removeExternalSessionData(); + this.router.navigateByUrl(loginUrl); + }, + error: (error: any) => { + this.auth.removeExternalSessionData(); + this.router.navigateByUrl(loginUrl); + }, + }); } - + + handleKeyDownSwymed(event: KeyboardEvent): void { + if (event.key == 'Enter' || event.key == 'Spacebar' || event.key == ' ') { + this.getSwymedLogout(); + } + } + getSwymedLogout() { this.auth.getSwymedLogout().subscribe((res: any) => { window.location.href = res.data.response; this.logout(); - }) + }); } commitDetailsUI: any; - versionUI: any + versionUI: any; getUIVersionAndCommitDetails() { - let commitDetailsPath: any = "assets/git-version.json"; - this.auth.getUIVersionAndCommitDetails(commitDetailsPath).subscribe({next:(res) => { - console.log('res', res); - this.commitDetailsUI = res - this.versionUI = this.commitDetailsUI['version'] - }, - error:err => { - console.log('err', err); - - }}) + const commitDetailsPath: any = 'assets/git-version.json'; + this.auth.getUIVersionAndCommitDetails(commitDetailsPath).subscribe({ + next: (res) => { + console.log('res', res); + this.commitDetailsUI = res; + this.versionUI = this.commitDetailsUI['version']; + }, + error: (err) => { + console.log('err', err); + }, + }); } showVersionAndCommitDetails() { - this.auth.getAPIVersionAndCommitDetails().subscribe({next:(res: any) => { - if (res.statusCode == 200) { - this.constructAPIAndUIDetails(res.data); - } - }, - error:err => { - }}) + this.auth.getAPIVersionAndCommitDetails().subscribe({ + next: (res: any) => { + if (res.statusCode == 200) { + this.constructAPIAndUIDetails(res.data); + } + }, + }); } constructAPIAndUIDetails(apiVersionAndCommitDetails: any) { - let data = { + const data = { commitDetailsUI: { version: this.commitDetailsUI['version'], - commit: this.commitDetailsUI['commit'] + commit: this.commitDetailsUI['commit'], }, commitDetailsAPI: { version: apiVersionAndCommitDetails['git.build.version'] || 'NA', - commit: apiVersionAndCommitDetails['git.commit.id'] || 'NA' - } - } + commit: apiVersionAndCommitDetails['git.commit.id'] || 'NA', + }, + }; if (data) { - this.showData(data) + this.showData(data); } } showData(versionData: any) { - this.dialog.open(ShowCommitAndVersionDetailsComponent, { - data: versionData + this.dialog.open(ShowCommitAndVersionDetailsComponent, { + data: versionData, }); - } - } diff --git a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.html b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.html index 17c809b..7c1760e 100644 --- a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.html +++ b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.html @@ -1,101 +1,183 @@
- -
- - -
- Webcam initialization failed: {{ webcamInitError.message }} -
- Retry - base64 -
-
- -

-
- - - -
-

-
+ +
+ + +
+ Webcam initialization failed: {{ webcamInitError.message }} +
+ Retry + base64 +
+
+ +

+
+ + + +
+

+
-
- -
- imageCode -
-
- -
- -
-
+ +
+ imageCode +
+
+ +
+ +
+
- -
- -
-

{{currentLanguageSet?.noDataAvailable}}

-
-
- -
- -
-
+
+ +
+

{{ currentLanguageSet?.noDataAvailable }}

+
+
+ +
+ +
+
- -
-
-
- annotate -
- -
- -
-

{{currentLanguageSet?.markDescriptions}}

-
- - - -
-
+ +
+
+
+ annotate
- + +
- -
- - - +
+

{{ currentLanguageSet?.markDescriptions }}

+
+ + +
- +
+
+ + + +
+ + + +
+
+ +

+ {{ currentLanguageSet?.bodyWeightTrends }} +

+

+ {{ currentLanguageSet?.bloodGlucoseTrends }} +

+

+ {{ currentLanguageSet?.bloodPressureTrends }} +

+ +
- -

{{currentLanguageSet?.bodyWeightTrends}}

-

{{currentLanguageSet?.bloodGlucoseTrends}}

-

{{currentLanguageSet?.bloodPressureTrends}}

- -
- - -
- - -
-
-
\ No newline at end of file + +
+ + +
+
+
diff --git a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.spec.ts b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.spec.ts index 7bc205d..5527a2b 100644 --- a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.spec.ts +++ b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CameraDialogComponent } from './camera-dialog.component'; @@ -29,9 +29,8 @@ describe('CameraDialogComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ CameraDialogComponent ] - }) - .compileComponents(); + declarations: [CameraDialogComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.ts b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.ts index 9d71a72..64a095c 100644 --- a/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.ts +++ b/src/app/app-modules/core/components/camera-dialog/camera-dialog.component.ts @@ -1,25 +1,34 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, Output, EventEmitter, ElementRef, ViewChild } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { + Component, + OnInit, + Output, + EventEmitter, + ElementRef, + ViewChild, + AfterViewInit, + DoCheck, +} from '@angular/core'; import { ConfirmationService } from '../../services/confirmation.service'; import { SetLanguageComponent } from '../set-language.component'; import { HttpServiceService } from '../../services/http-service.service'; @@ -39,22 +48,20 @@ interface Mark { @Component({ selector: 'app-camera-dialog', templateUrl: './camera-dialog.component.html', - styleUrls: ['./camera-dialog.component.css'] + styleUrls: ['./camera-dialog.component.css'], }) - -export class CameraDialogComponent implements OnInit { - +export class CameraDialogComponent implements OnInit, AfterViewInit, DoCheck { @Output() cancelEvent = new EventEmitter(); @ViewChild('myCanvas') - myCanvas!: { nativeElement: any; }; - @ViewChild('myImg') myImg!: { nativeElement: any; }; + myCanvas!: { nativeElement: any }; + @ViewChild('myImg') myImg!: { nativeElement: any }; status: any; public imageCode: any; public availablePoints: any; public annotate: any; public title: any; - public capture: boolean = false; + public capture = false; public captured: any = false; public webcam: any; public graph: any; @@ -66,30 +73,31 @@ export class CameraDialogComponent implements OnInit { markers: Mark[] = []; ctx!: CanvasRenderingContext2D; loaded!: boolean; - languageComponent! : SetLanguageComponent; + languageComponent!: SetLanguageComponent; currentLanguageSet: any; triggerObservable: Subject = new Subject(); webcamImage: WebcamImage | undefined; webcamInitError: WebcamInitError | undefined; - public barChartType: ChartType = 'bar' + public barChartType: ChartType = 'bar'; public barChartData: ChartData = { datasets: [ { - backgroundColor: ["red", "green", "blue"], - } - ] + backgroundColor: ['red', 'green', 'blue'], + }, + ], }; constructor( public dialogRef: MatDialogRef, private element: ElementRef, - public httpServiceService : HttpServiceService, - private confirmationService: ConfirmationService) { - this.options = { - width: 500, - height: 390, - video: true, - cameraType: 'back' - }; + public httpServiceService: HttpServiceService, + private confirmationService: ConfirmationService, + ) { + this.options = { + width: 500, + height: 390, + video: true, + cameraType: 'back', + }; } captureImage(webcamImage: WebcamImage): void { // Handle the captured image data @@ -97,18 +105,22 @@ export class CameraDialogComponent implements OnInit { this.base64 = webcamImage.imageAsDataUrl; this.captured = true; } + handleKeyDownRecaptureImg(event: KeyboardEvent): void { + if (event.key == 'Enter' || event.key == 'Spacebar' || event.key == ' ') { + this.recaptureImage(); + } + } recaptureImage(): void { // Trigger new image capture this.captured = false; this.triggerObservable.next(); } - captureImageButton(){ - if(this.captured){ - this.status = "Retry"; - } - else{ - this.status = "Capture" + captureImageButton() { + if (this.captured) { + this.status = 'Retry'; + } else { + this.status = 'Capture'; } } @@ -118,8 +130,9 @@ export class CameraDialogComponent implements OnInit { } ngOnInit() { this.loaded = false; - this.status = "Capture"; - if (this.availablePoints && this.availablePoints.markers) this.pointsToWrite = this.availablePoints.markers; + this.status = 'Capture'; + if (this.availablePoints && this.availablePoints.markers) + this.pointsToWrite = this.availablePoints.markers; this.fetchLanguageResponse(); } @@ -135,20 +148,29 @@ export class CameraDialogComponent implements OnInit { this.loaded = true; } if (this.pointsToWrite) this.loadMarks(); - } loadMarks() { this.pointsToWrite.forEach((num) => { this.pointMark(num); - }) + }); } loadingCanvas() { this.canvas = this.myCanvas.nativeElement; this.ctx = this.canvas.getContext('2d'); - let img = this.myImg.nativeElement; - this.ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, this.canvas.width, this.canvas.height); + const img = this.myImg.nativeElement; + this.ctx.drawImage( + img, + 0, + 0, + img.width, + img.height, + 0, + 0, + this.canvas.width, + this.canvas.height, + ); this.ctx.font = 'bold 20px serif'; this.score = 1; } @@ -180,50 +202,51 @@ export class CameraDialogComponent implements OnInit { yCord: event.offsetY, description: event.description, point: event.point, - }) + }); } else { this.markers.push({ xCord: event.offsetX, yCord: event.offsetY, - description: "", + description: '', point: this.score, - }) + }); } this.score++; - } - getMarkers() { return { beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), visitID: localStorage.getItem('visitID'), - createdBy:localStorage.getItem('userName'), + createdBy: localStorage.getItem('userName'), imageID: '', providerServiceMapID: localStorage.getItem('providerServiceID'), - markers: this.markers - } + markers: this.markers, + }; } downloadGraph() { const containerElement = document.getElementById('container-dialog'); if (containerElement) { - html2canvas(containerElement).then((canvas: any) => { + html2canvas(containerElement).then((canvas: any) => { canvas.toBlob((blob: any) => { - try { - let graphName = `${this.graph.type}_${localStorage.getItem('beneficiaryRegID')}_${localStorage.getItem('visitID')}` - || 'graphTrends'; - saveAs(blob, graphName); - } catch (e) { - const newWindow = window.open(); - if (newWindow) { - newWindow.document.write(''); - } - } - }) - }); - } - + try { + const graphName = + `${this.graph.type}_${localStorage.getItem( + 'beneficiaryRegID', + )}_${localStorage.getItem('visitID')}` || 'graphTrends'; + saveAs(blob, graphName); + } catch (e) { + const newWindow = window.open(); + if (newWindow) { + newWindow.document.write( + '', + ); + } + } + }); + }); + } } // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- @@ -238,5 +261,3 @@ export class CameraDialogComponent implements OnInit { } // -----End------ } - - diff --git a/src/app/app-modules/core/components/common-dialog/common-dialog.component.html b/src/app/app-modules/core/components/common-dialog/common-dialog.component.html index 61e7808..8aabb36 100644 --- a/src/app/app-modules/core/components/common-dialog/common-dialog.component.html +++ b/src/app/app-modules/core/components/common-dialog/common-dialog.component.html @@ -1,86 +1,167 @@
-

{{ (title == 'warn'? 'warning': title) | titlecase }}

-
{{ message }}
-
- - -
+

+ {{ (title === "warn" ? "warning" : title) | titlecase }} +

+
{{ message }}
+
+ + +
-

{{ (status == 'warn'? 'warning': status) | titlecase }}

-
{{ message }}
-
- -
+

+ {{ (status === "warn" ? "warning" : status) | titlecase }} +

+
{{ message }}
+
+ +
-

{{ message | titlecase }}

-
- - - -
-
- - -
+

{{ message | titlecase }}

+
+ + + +
+
+ + +
-

{{ message | titlecase }}

-
- - - -
-
- - -
+

{{ message | titlecase }}

+
+ + + +
+
+ + +
-

Info

-
-

{{ message | titlecase }}

-
    -
  • {{items | titlecase}}
  • -
-
-
- -
+

Info

+
+

{{ message | titlecase }}

+
    +
  • + + {{ items | titlecase }} +
  • +
+
+
+ +
-

Info

-
-

{{message | titlecase}}

- - - {{value.name}} - - -
-
- - -
+

Info

+
+

{{ message | titlecase }}

+ + + {{ value.name }} + + +
+
+ + +
-

{{ title }}

-
- {{message}}   - - {{minutes.toFixed(0)}}   minutes   - {{seconds}}   seconds - -
-
- - -
-
\ No newline at end of file +

{{ title }}

+
+ {{ message }}   + + {{ minutes.toFixed(0) }}   minutes   + {{ seconds }}   seconds + +
+
+ + +
+
diff --git a/src/app/app-modules/core/components/common-dialog/common-dialog.component.spec.ts b/src/app/app-modules/core/components/common-dialog/common-dialog.component.spec.ts index 9c35970..f8d7015 100644 --- a/src/app/app-modules/core/components/common-dialog/common-dialog.component.spec.ts +++ b/src/app/app-modules/core/components/common-dialog/common-dialog.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CommonDialogComponent } from './common-dialog.component'; @@ -29,9 +29,8 @@ describe('CommonDialogComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ CommonDialogComponent ] - }) - .compileComponents(); + declarations: [CommonDialogComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/common-dialog/common-dialog.component.ts b/src/app/app-modules/core/components/common-dialog/common-dialog.component.ts index 52e9231..5319a3f 100644 --- a/src/app/app-modules/core/components/common-dialog/common-dialog.component.ts +++ b/src/app/app-modules/core/components/common-dialog/common-dialog.component.ts @@ -1,25 +1,31 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, Output, EventEmitter } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { + Component, + OnInit, + Output, + EventEmitter, + DoCheck, +} from '@angular/core'; import { HttpServiceService } from '../../services/http-service.service'; import { SetLanguageComponent } from '../set-language.component'; import { MatDialogRef } from '@angular/material/dialog'; @@ -28,7 +34,7 @@ import { MatDialogRef } from '@angular/material/dialog'; templateUrl: './common-dialog.component.html', styleUrls: ['./common-dialog.component.css'], }) -export class CommonDialogComponent implements OnInit { +export class CommonDialogComponent implements OnInit, DoCheck { @Output() cancelEvent = new EventEmitter(); public title!: string; @@ -56,8 +62,10 @@ export class CommonDialogComponent implements OnInit { // Choose from Radio Button Ends - constructor(public dialogRef: MatDialogRef, - public httpServiceService: HttpServiceService) { } + constructor( + public dialogRef: MatDialogRef, + public httpServiceService: HttpServiceService, + ) {} ngOnInit() { this.fetchLanguageResponse(); @@ -81,7 +89,7 @@ export class CommonDialogComponent implements OnInit { this.intervalRef = setInterval(() => { if (timer == 0) { clearInterval(this.intervalRef); - this.dialogRef.close({ action: 'timeout'}); + this.dialogRef.close({ action: 'timeout' }); } else { this.minutes = timer / 60; this.seconds = timer % 60; @@ -94,12 +102,12 @@ export class CommonDialogComponent implements OnInit { stopTimer() { clearInterval(this.intervalRef); - this.dialogRef.close({action: 'cancel', remainingTime: this.timer}); + this.dialogRef.close({ action: 'cancel', remainingTime: this.timer }); } continueSession() { clearInterval(this.intervalRef); - this.dialogRef.close({action: 'continue'}); + this.dialogRef.close({ action: 'continue' }); } // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- @@ -113,5 +121,4 @@ export class CommonDialogComponent implements OnInit { this.currentLanguageSet = this.languageComponent.currentLanguageObject; } // -----End------ - } diff --git a/src/app/app-modules/core/components/previous-details/previous-details.component.html b/src/app/app-modules/core/components/previous-details/previous-details.component.html index 61c8565..7fdebd9 100644 --- a/src/app/app-modules/core/components/previous-details/previous-details.component.html +++ b/src/app/app-modules/core/components/previous-details/previous-details.component.html @@ -1,26 +1,43 @@

{{ input.title }}

-
- + search
- - - - - +
{{ column.columnName }}{{ data[column.keyName] }}
+ + + + - + -
{{ column.columnName }}{{ data[column.keyName] }}
+
diff --git a/src/app/app-modules/core/components/previous-details/previous-details.component.spec.ts b/src/app/app-modules/core/components/previous-details/previous-details.component.spec.ts index 5399151..7b6111e 100644 --- a/src/app/app-modules/core/components/previous-details/previous-details.component.spec.ts +++ b/src/app/app-modules/core/components/previous-details/previous-details.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PreviousDetailsComponent } from './previous-details.component'; @@ -29,9 +29,8 @@ describe('PreviousDetailsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ PreviousDetailsComponent ] - }) - .compileComponents(); + declarations: [PreviousDetailsComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/previous-details/previous-details.component.ts b/src/app/app-modules/core/components/previous-details/previous-details.component.ts index dfe01ca..3886e4f 100644 --- a/src/app/app-modules/core/components/previous-details/previous-details.component.ts +++ b/src/app/app-modules/core/components/previous-details/previous-details.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, Inject } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, OnInit, Inject, DoCheck } from '@angular/core'; import { HttpServiceService } from '../../services/http-service.service'; import { SetLanguageComponent } from '../set-language.component'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @@ -27,24 +27,24 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @Component({ selector: 'app-previous-details', templateUrl: './previous-details.component.html', - styleUrls: ['./previous-details.component.css'] + styleUrls: ['./previous-details.component.css'], }) -export class PreviousDetailsComponent implements OnInit { - +export class PreviousDetailsComponent implements OnInit, DoCheck { dataList = []; filteredDataList = []; columnList: any[] = []; - currentLanguageSet:any; + currentLanguageSet: any; languageComponent!: SetLanguageComponent; constructor( public dialogRef: MatDialogRef, - public httpServiceService:HttpServiceService, - @Inject(MAT_DIALOG_DATA) public input: any) { } + public httpServiceService: HttpServiceService, + @Inject(MAT_DIALOG_DATA) public input: any, + ) {} ngOnInit() { this.fetchLanguageResponse(); - if (this.input.dataList.data instanceof Array){ + if (this.input.dataList.data instanceof Array) { this.dataList = this.input.dataList.data; this.filteredDataList = this.dataList.slice(); } @@ -53,16 +53,16 @@ export class PreviousDetailsComponent implements OnInit { } filterPreviousData(searchTerm: any) { - console.log("searchTerm", searchTerm); - if (!searchTerm) - this.filteredDataList = this.dataList; + console.log('searchTerm', searchTerm); + if (!searchTerm) this.filteredDataList = this.dataList; else { this.filteredDataList = []; this.dataList.forEach((item) => { - for (let key in item) { - let value: string = '' + item[key]; + for (const key in item) { + const value: string = '' + item[key]; if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { - this.filteredDataList.push(item); break; + this.filteredDataList.push(item); + break; } } }); @@ -73,16 +73,15 @@ export class PreviousDetailsComponent implements OnInit { this.dialogRef.close(); } - // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- - ngDoCheck() { - this.fetchLanguageResponse(); - } - - fetchLanguageResponse() { - this.languageComponent = new SetLanguageComponent(this.httpServiceService); - this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; - } - // -----End------ + // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- + ngDoCheck() { + this.fetchLanguageResponse(); + } + fetchLanguageResponse() { + this.languageComponent = new SetLanguageComponent(this.httpServiceService); + this.languageComponent.setLanguage(); + this.currentLanguageSet = this.languageComponent.currentLanguageObject; + } + // -----End------ } diff --git a/src/app/app-modules/core/components/set-language.component.ts b/src/app/app-modules/core/components/set-language.component.ts index a5fe0e1..c47a5ee 100644 --- a/src/app/app-modules/core/components/set-language.component.ts +++ b/src/app/app-modules/core/components/set-language.component.ts @@ -1,34 +1,34 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ /* * JA354063 - Created on 21-07-21 */ -import { Component } from "@angular/core"; -import { HttpServiceService } from "../services/http-service.service"; +import { Component } from '@angular/core'; +import { HttpServiceService } from '../services/http-service.service'; @Component({ - template: "", + template: '', }) -export class SetLanguageComponent { +export class SetLanguageComponent { static currentLanguageObject: any; static setLanguage() { throw new Error('Method not implemented.'); @@ -42,18 +42,17 @@ export class SetLanguageComponent { setLanguage() { const languageSubscription = this.httpServices.currentLangugae$.subscribe({ - next: (languageResponse) => { - this.currentLanguageObject = languageResponse; - }, - error: (err) => { - console.log(err); - }, - complete: () => { - console.log("completed"); - } + next: (languageResponse) => { + this.currentLanguageObject = languageResponse; + }, + error: (err) => { + console.log(err); + }, + complete: () => { + console.log('completed'); + }, }); languageSubscription.unsubscribe(); -} - + } } diff --git a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.html b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.html index b8977ea..8fb864f 100644 --- a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.html +++ b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.html @@ -1,34 +1,35 @@
-

{{currentLanguageSet?.versionDetails}}

-
- + + - - + + - - - + + + - - - + + +
{{currentLanguageSet?.aPI}} {{currentLanguageSet?.uI}} {{ currentLanguageSet?.aPI }}{{ currentLanguageSet?.uI }}
{{currentLanguageSet?.version}} {{input.commitDetailsAPI.version}}{{input.commitDetailsUI.version}} {{ currentLanguageSet?.version }}{{ input.commitDetailsAPI.version }}{{ input.commitDetailsUI.version }}
{{currentLanguageSet?.commit}} {{input.commitDetailsAPI.commit}}{{input.commitDetailsUI.commit}} {{ currentLanguageSet?.commit }}{{ input.commitDetailsAPI.commit }}{{ input.commitDetailsUI.commit }}
-
\ No newline at end of file +
diff --git a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.spec.ts b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.spec.ts index 14be91e..76bf782 100644 --- a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.spec.ts +++ b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ShowCommitAndVersionDetailsComponent } from './show-commit-and-version-details.component'; @@ -29,9 +29,8 @@ describe('ShowCommitAndVersionDetailsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ShowCommitAndVersionDetailsComponent ] - }) - .compileComponents(); + declarations: [ShowCommitAndVersionDetailsComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.ts b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.ts index ff3c183..a2a1605 100644 --- a/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.ts +++ b/src/app/app-modules/core/components/show-commit-and-version-details/show-commit-and-version-details.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, Inject } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, OnInit, Inject, DoCheck } from '@angular/core'; import { HttpServiceService } from '../../services/http-service.service'; import { SetLanguageComponent } from '../set-language.component'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @@ -27,15 +27,16 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @Component({ selector: 'app-show-commit-and-version-details', templateUrl: './show-commit-and-version-details.component.html', - styleUrls: ['./show-commit-and-version-details.component.css'] + styleUrls: ['./show-commit-and-version-details.component.css'], }) -export class ShowCommitAndVersionDetailsComponent implements OnInit { - - currentLanguageSet:any; +export class ShowCommitAndVersionDetailsComponent implements OnInit, DoCheck { + currentLanguageSet: any; languageComponent!: SetLanguageComponent; - constructor(@Inject(MAT_DIALOG_DATA) public input: any, - public httpServiceService : HttpServiceService, - public dialogRef: MatDialogRef) { } + constructor( + @Inject(MAT_DIALOG_DATA) public input: any, + public httpServiceService: HttpServiceService, + public dialogRef: MatDialogRef, + ) {} ngOnInit() { this.fetchLanguageResponse(); @@ -52,5 +53,4 @@ export class ShowCommitAndVersionDetailsComponent implements OnInit { this.currentLanguageSet = this.languageComponent.currentLanguageObject; } // -----End------ - } diff --git a/src/app/app-modules/core/components/spinner/spinner.component.spec.ts b/src/app/app-modules/core/components/spinner/spinner.component.spec.ts index 97da4c1..d9a5d40 100644 --- a/src/app/app-modules/core/components/spinner/spinner.component.spec.ts +++ b/src/app/app-modules/core/components/spinner/spinner.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SpinnerComponent } from './spinner.component'; @@ -29,9 +29,8 @@ describe('SpinnerComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SpinnerComponent ] - }) - .compileComponents(); + declarations: [SpinnerComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/spinner/spinner.component.ts b/src/app/app-modules/core/components/spinner/spinner.component.ts index 476b814..310e0e0 100644 --- a/src/app/app-modules/core/components/spinner/spinner.component.ts +++ b/src/app/app-modules/core/components/spinner/spinner.component.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component, OnDestroy, OnInit } from '@angular/core'; import { SpinnerState, SpinnerService } from '../../services/spinner.service'; import { Subscription } from 'rxjs'; @@ -26,22 +26,21 @@ import { Subscription } from 'rxjs'; @Component({ selector: 'app-spinner', templateUrl: './spinner.component.html', - styleUrls: ['./spinner.component.css'] + styleUrls: ['./spinner.component.css'], }) export class SpinnerComponent implements OnDestroy, OnInit { visible = false; private spinnerStateChanged!: Subscription; - constructor( - private spinnerService: SpinnerService - ) { } + constructor(private spinnerService: SpinnerService) {} ngOnInit() { - this.spinnerStateChanged = this.spinnerService.spinnerState - .subscribe((state: SpinnerState) => { + this.spinnerStateChanged = this.spinnerService.spinnerState.subscribe( + (state: SpinnerState) => { this.visible = state.show; - }); + }, + ); } ngOnDestroy() { diff --git a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.html b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.html index 5d9e8bd..c605c1b 100644 --- a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.html +++ b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.html @@ -1,6 +1,16 @@
- - {{ message.value.length }} / {{ data.length }} + + {{ message.value.length }} / {{ data.length }} -
\ No newline at end of file + diff --git a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.spec.ts b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.spec.ts index ae09927..f818b0f 100644 --- a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.spec.ts +++ b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TextareaDialogComponent } from './textarea-dialog.component'; @@ -29,9 +29,8 @@ describe('TextareaDialogComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ TextareaDialogComponent ] - }) - .compileComponents(); + declarations: [TextareaDialogComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.ts b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.ts index b436add..eeb4f37 100644 --- a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.ts +++ b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.component.ts @@ -1,41 +1,40 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component, OnInit, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @Component({ selector: 'app-textarea-dialog', templateUrl: './textarea-dialog.component.html', - styleUrls: ['./textarea-dialog.component.css'] + styleUrls: ['./textarea-dialog.component.css'], }) export class TextareaDialogComponent implements OnInit { - constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: any) { } + @Inject(MAT_DIALOG_DATA) public data: any, + ) {} ngOnInit() { - this.dialogRef.backdropClick().subscribe(result => { - this.dialogRef.close(this.data.observations); - }) + this.dialogRef.backdropClick().subscribe((result) => { + this.dialogRef.close(this.data.observations); + }); } - } diff --git a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.service.ts b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.service.ts index 98d7284..116722b 100644 --- a/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.service.ts +++ b/src/app/app-modules/core/components/textarea-dialog/textarea-dialog.service.ts @@ -1,39 +1,37 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable } from '@angular/core'; import { TextareaDialogComponent } from './textarea-dialog.component'; import { MatDialog } from '@angular/material/dialog'; import { Observable } from 'rxjs'; @Injectable() export class TextareaDialog { + constructor(public dialog: MatDialog) {} - constructor(public dialog: MatDialog) { } - - open(observations: string, length = 500): Observable { - let dialogRef = this.dialog.open(TextareaDialogComponent, { - width: '500px', - data: { 'observations': observations, 'length': length } - }); - return dialogRef.afterClosed(); - } - + open(observations: string, length = 500): Observable { + const dialogRef = this.dialog.open(TextareaDialogComponent, { + width: '500px', + data: { observations: observations, length: length }, + }); + return dialogRef.afterClosed(); + } } diff --git a/src/app/app-modules/core/core.module.ts b/src/app/app-modules/core/core.module.ts index 9d95fca..dc52d5f 100644 --- a/src/app/app-modules/core/core.module.ts +++ b/src/app/app-modules/core/core.module.ts @@ -1,28 +1,27 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { RouterModule } from '@angular/router'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; - import { MatDialogModule } from '@angular/material/dialog'; import { HttpServiceService } from './services/http-service.service'; import { HttpClientModule } from '@angular/common/http'; @@ -44,14 +43,7 @@ import { ShowCommitAndVersionDetailsComponent } from './components/show-commit-a import { PreviousDetailsComponent } from './components/previous-details/previous-details.component'; import { SpinnerComponent } from './components/spinner/spinner.component'; import { TextareaDialogComponent } from './components/textarea-dialog/textarea-dialog.component'; -import { myEmail } from './directives/email/myEmail.directive'; -import { myMobileNumber } from './directives/MobileNumber/myMobileNumber.directive'; -import { myName } from './directives/name/myName.directive'; -import { myPassword } from './directives/password/myPassword.directive'; -import { DisableFormControlDirective } from './directives/disableFormControl.directive'; import { NullDefaultValueDirective } from './directives/null-default-value.directive'; -import { NumberValidator } from './directives/numberValidator.directive'; -import { StringValidator } from './directives/stringValidator.directive'; import { FullCalendarModule } from '@fullcalendar/angular'; import { MatInputModule } from '@angular/material/input'; import { MatTooltipModule } from '@angular/material/tooltip'; @@ -64,8 +56,15 @@ import { MatIconModule } from '@angular/material/icon'; import { MatButtonModule } from '@angular/material/button'; import { MatTableModule } from '@angular/material/table'; import { MaterialModule } from './material.module'; -import {WebcamModule} from 'ngx-webcam'; +import { WebcamModule } from 'ngx-webcam'; import { NgChartsModule } from 'ng2-charts'; +import { MyMobileNumberDirective } from './directives/MobileNumber/myMobileNumber.directive'; +import { DisableFormControlDirective } from './directives/disableFormControl.directive'; +import { myEmailDirective } from './directives/email/myEmail.directive'; +import { myNameDirective } from './directives/name/myName.directive'; +import { NumberValidatorDirective } from './directives/numberValidator.directive'; +import { myPasswordDirective } from './directives/password/myPassword.directive'; +import { StringValidatorDirective } from './directives/stringValidator.directive'; @NgModule({ imports: [ @@ -98,43 +97,55 @@ import { NgChartsModule } from 'ng2-charts'; AppHeaderComponent, PreviousDetailsComponent, ShowCommitAndVersionDetailsComponent, - myEmail, myMobileNumber, myName, myPassword, DisableFormControlDirective, NullDefaultValueDirective, NumberValidator, - StringValidator + myEmailDirective, + MyMobileNumberDirective, + myNameDirective, + myPasswordDirective, + DisableFormControlDirective, + NullDefaultValueDirective, + NumberValidatorDirective, + StringValidatorDirective, ], exports: [ - RouterModule, - FormsModule, - ReactiveFormsModule, - MaterialModule, - SetLanguageComponent, - CommonDialogComponent, - CameraDialogComponent, - TextareaDialogComponent, - SpinnerComponent, - AppFooterComponent, - AppHeaderComponent, - PreviousDetailsComponent, - ShowCommitAndVersionDetailsComponent, - myEmail, myMobileNumber, myName, myPassword, DisableFormControlDirective, NullDefaultValueDirective, NumberValidator, - StringValidator - ], + RouterModule, + FormsModule, + ReactiveFormsModule, + MaterialModule, + SetLanguageComponent, + CommonDialogComponent, + CameraDialogComponent, + TextareaDialogComponent, + SpinnerComponent, + AppFooterComponent, + AppHeaderComponent, + PreviousDetailsComponent, + ShowCommitAndVersionDetailsComponent, + myEmailDirective, + MyMobileNumberDirective, + myNameDirective, + myPasswordDirective, + DisableFormControlDirective, + NullDefaultValueDirective, + NumberValidatorDirective, + StringValidatorDirective, + ], }) export class CoreModule { static forRoot(): ModuleWithProviders { return { ngModule: CoreModule, providers: [ - ConfirmationService, - CameraService, - BeneficiaryDetailsService, - HttpInterceptor, - HttpServiceService, - AuthGuard, - AuthService, - SpinnerService, - CanDeactivateGuardService, - GlobalErrorHandler, - ] + ConfirmationService, + CameraService, + BeneficiaryDetailsService, + HttpInterceptor, + HttpServiceService, + AuthGuard, + AuthService, + SpinnerService, + CanDeactivateGuardService, + GlobalErrorHandler, + ], }; } } diff --git a/src/app/app-modules/core/directives/MobileNumber/myMobileNumber.directive.ts b/src/app/app-modules/core/directives/MobileNumber/myMobileNumber.directive.ts index 2542eec..f0ba739 100644 --- a/src/app/app-modules/core/directives/MobileNumber/myMobileNumber.directive.ts +++ b/src/app/app-modules/core/directives/MobileNumber/myMobileNumber.directive.ts @@ -1,38 +1,35 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, HostListener, Input } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, HostListener } from '@angular/core'; @Directive({ - selector: '[myMobileNumber]' + selector: '[appMyMobileNumber]', }) -export class myMobileNumber { - constructor(){} - @HostListener('keypress',['$event']) onKeyPress(ev: any) { - var regex = new RegExp(/^[a-zA-Z~!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/); - var key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); - if (regex.test(key)) { - ev.preventDefault(); - } - } - - -} \ No newline at end of file +export class MyMobileNumberDirective { + @HostListener('keypress', ['$event']) onKeyPress(ev: any) { + const regex = new RegExp(/^[a-zA-Z~!@#$%^&*()_+\-=[]{};':"\\|,.<>\/?]*$/); + const key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); + if (regex.test(key)) { + ev.preventDefault(); + } + } +} diff --git a/src/app/app-modules/core/directives/disableFormControl.directive.ts b/src/app/app-modules/core/directives/disableFormControl.directive.ts index d7ced61..74eeeba 100644 --- a/src/app/app-modules/core/directives/disableFormControl.directive.ts +++ b/src/app/app-modules/core/directives/disableFormControl.directive.ts @@ -1,47 +1,43 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Directive, Input } from '@angular/core'; -import { FormArray, FormGroup, NgControl } from '@angular/forms'; +import { NgControl } from '@angular/forms'; @Directive({ - selector: '[disableFormControl]' + selector: '[appDisableFormControl]', }) export class DisableFormControlDirective { - @Input() set disableFormControl(condition: boolean) { const control = this.ngControl?.control; - - if(control){ + + if (control) { const action = condition ? 'disable' : 'enable'; - if (action == 'disable' && !control.disabled){ - control.setValue(null); - control.markAsTouched(); - control[action](); - } - } - + if (action == 'disable' && !control.disabled) { + control.setValue(null); + control.markAsTouched(); + control[action](); + } + } } - constructor(private ngControl: NgControl) { - } - -} \ No newline at end of file + constructor(private ngControl: NgControl) {} +} diff --git a/src/app/app-modules/core/directives/email/myEmail.directive.ts b/src/app/app-modules/core/directives/email/myEmail.directive.ts index 78297a9..1025f39 100644 --- a/src/app/app-modules/core/directives/email/myEmail.directive.ts +++ b/src/app/app-modules/core/directives/email/myEmail.directive.ts @@ -1,47 +1,49 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Directive, forwardRef } from '@angular/core'; -import { NG_VALIDATORS, Validator, Validators, ValidatorFn, AbstractControl } from '@angular/forms'; +import { NG_VALIDATORS, Validator, AbstractControl } from '@angular/forms'; @Directive({ - selector: '[validateEmail]', - providers: [ - { provide: NG_VALIDATORS, useExisting: forwardRef(() => myEmail), multi: true } - ] + selector: '[appValidateEmail]', + providers: [ + { + provide: NG_VALIDATORS, + useExisting: forwardRef(() => myEmailDirective), + multi: true, + }, + ], }) -export class myEmail implements Validator { - pattern = /^[0-9a-zA-Z_.]+@[a-zA-Z_]+?\.\b(org|com|in|co.in|ORG|COM|IN|CO.IN)\b$/; +export class myEmailDirective implements Validator { + pattern = + /^[0-9a-zA-Z_.]+@[a-zA-Z_]+?\.\b(org|com|in|co.in|ORG|COM|IN|CO.IN)\b$/; + validate(control: AbstractControl): { [key: string]: any } | null { + const input = control.value; + if (input == '' || input == null) return null; - constructor() { } - - validate(control: AbstractControl): { [key: string]: any } | null { - - let input = control.value; - if(input == '' || input==null) - return null; - - let flag = this.pattern.test(input); - return flag ? null : { - valid: false - }; - } -} \ No newline at end of file + const flag = this.pattern.test(input); + return flag + ? null + : { + valid: false, + }; + } +} diff --git a/src/app/app-modules/core/directives/name/myName.directive.ts b/src/app/app-modules/core/directives/name/myName.directive.ts index e1792ef..662fe2d 100644 --- a/src/app/app-modules/core/directives/name/myName.directive.ts +++ b/src/app/app-modules/core/directives/name/myName.directive.ts @@ -1,40 +1,35 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, HostListener, Input } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, HostListener } from '@angular/core'; @Directive({ - selector: '[myName]' + selector: '[appMyName]', }) -export class myName { - constructor(element: ElementRef) { - } - - @HostListener('keypress', ['$event']) onKeyPress(ev: any) { - var regex = new RegExp(/^[0-9 ~!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]*$/); - var key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); - if (regex.test(key)) { - ev.preventDefault(); - } - } - - -} \ No newline at end of file +export class myNameDirective { + @HostListener('keypress', ['$event']) onKeyPress(ev: any) { + const regex = new RegExp(/^[0-9 ~!@#$%^&*()_+\-=[]{};':"\\|,.<>\/?]*$/); + const key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); + if (regex.test(key)) { + ev.preventDefault(); + } + } +} diff --git a/src/app/app-modules/core/directives/null-default-value.directive.ts b/src/app/app-modules/core/directives/null-default-value.directive.ts index fdb681c..261c59a 100644 --- a/src/app/app-modules/core/directives/null-default-value.directive.ts +++ b/src/app/app-modules/core/directives/null-default-value.directive.ts @@ -1,39 +1,40 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, Attribute, HostListener } from '@angular/core'; -import { NgControl, } from '@angular/forms'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, ElementRef, HostListener } from '@angular/core'; +import { NgControl } from '@angular/forms'; @Directive({ - selector: '[defaultNull]' + selector: '[appDefaultNull]', }) export class NullDefaultValueDirective { - - constructor(private el: ElementRef, private control: NgControl) { } + constructor( + private el: ElementRef, + private control: NgControl, + ) {} @HostListener('input', ['$event.target']) onEvent(target: HTMLInputElement) { - if(this.control && this.control.control){ - this.control.control.setValue((target.value === '') ? null : target.value); + if (this.control && this.control.control) { + this.control.control.setValue(target.value === '' ? null : target.value); } - } } diff --git a/src/app/app-modules/core/directives/numberValidator.directive.ts b/src/app/app-modules/core/directives/numberValidator.directive.ts index 1cc784f..55c2c0b 100644 --- a/src/app/app-modules/core/directives/numberValidator.directive.ts +++ b/src/app/app-modules/core/directives/numberValidator.directive.ts @@ -1,51 +1,48 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, Attribute, HostListener, Input } from '@angular/core'; -import { AbstractControl } from '@angular/forms'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, ElementRef, HostListener, Input } from '@angular/core'; @Directive({ - selector: '[allowMax][formControlName],[allowMax][formControl],[allowMax][ngModel],[allowMax]' + selector: + '[appAllowMax][formControlName],[appAllowMax][formControl],[appAllowMax][ngModel],[appAllowMax]', }) -export class NumberValidator { - @Input('allowMax') +export class NumberValidatorDirective { + @Input('appAllowMax') public max!: number; - constructor(private elementRef: ElementRef) { } + constructor(private elementRef: ElementRef) {} validate(input: any) { - let max = this.max; + const max = this.max; - if (+input <= +max) - return true; - else - return false; + if (+input <= +max) return true; + else return false; } @HostListener('input', ['$event']) onInput(event: any) { - let value = event.target.value; + const value = event.target.value; - if (!this.validate(value)) - event.target.value = this.lastValue; + if (!this.validate(value)) event.target.value = this.lastValue; this.lastValue = event.target.value; } @@ -55,5 +52,4 @@ export class NumberValidator { onFocus(event: any) { this.lastValue = event.target.value; } - } diff --git a/src/app/app-modules/core/directives/password/myPassword.directive.ts b/src/app/app-modules/core/directives/password/myPassword.directive.ts index c4f4707..64dca9d 100644 --- a/src/app/app-modules/core/directives/password/myPassword.directive.ts +++ b/src/app/app-modules/core/directives/password/myPassword.directive.ts @@ -1,76 +1,65 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, HostListener, Input } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, HostListener } from '@angular/core'; @Directive({ - selector: '[myPassword]' + selector: '[appMyPassword]', }) -export class myPassword { - constructor(element: ElementRef) { +export class myPasswordDirective { + private passwordValidator(password: any) { + if (password.match(/^[a-zA-Z]{1,1}[a-zA-Z0-9 $%#@!&^*()+{}[\]-]{7,11}$/)) { + if (password.length >= 8) { + return 1; + } else { + return 0; + } + } else { + return -1; + } + } - } + @HostListener('keyup', ['$event']) onKeyUp(ev: any) { + const result = this.passwordValidator(ev.target.value); + if (result == 1) { + ev.target.nextSibling.nextElementSibling.innerHTML = 'Strong Password'; + ev.target.style.border = '2px solid green'; + } + if (result == 0) { + ev.target.nextSibling.nextElementSibling.innerHTML = 'Weak Password'; + ev.target.style.border = '2px solid yellow'; + } - private passwordValidator(password: any) { - if (password.match(/^[a-zA-Z]{1,1}[a-zA-Z0-9 $%#@!&^*()+{}\[\]-]{7,11}$/)) { - if (password.length >=8) { - return 1; - } - else { - return 0; - } - } - else { - return -1; - } - } + if (result == -1) { + ev.target.nextSibling.nextElementSibling.innerHTML = + 'password should be 8-12 characters long and must start with an alphabet and can have numbers alphabets and $%#@!&^*()-+{}[]'; + ev.target.style.border = '2px solid red'; + } + } - @HostListener('keyup', ['$event']) onKeyUp(ev: any) { - - var result = this.passwordValidator(ev.target.value); - if (result == 1) { - ev.target.nextSibling.nextElementSibling.innerHTML = "Strong Password"; - ev.target.style.border = "2px solid green"; - } - if (result == 0) { - ev.target.nextSibling.nextElementSibling.innerHTML = "Weak Password"; - ev.target.style.border = "2px solid yellow"; - } - - if (result == -1) { - ev.target.nextSibling.nextElementSibling.innerHTML = "password should be 8-12 characters long and must start with an alphabet and can have numbers alphabets and $%#@!&^*()-+{}[]"; - ev.target.style.border = "2px solid red"; - } - - - } - - @HostListener('keypress', ['$event']) onKeyPress(ev: any) { - var regex = new RegExp(/^[\s]*$/); - var key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); - if (regex.test(key)) { - ev.preventDefault(); - } - } - - - -} \ No newline at end of file + @HostListener('keypress', ['$event']) onKeyPress(ev: any) { + const regex = new RegExp(/^[\s]*$/); + const key = String.fromCharCode(!ev.charCode ? ev.which : ev.charCode); + if (regex.test(key)) { + ev.preventDefault(); + } + } +} diff --git a/src/app/app-modules/core/directives/stringValidator.directive.ts b/src/app/app-modules/core/directives/stringValidator.directive.ts index 07e0cb3..7afa6fc 100644 --- a/src/app/app-modules/core/directives/stringValidator.directive.ts +++ b/src/app/app-modules/core/directives/stringValidator.directive.ts @@ -1,32 +1,30 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Directive, ElementRef, Attribute, HostListener, Input } from '@angular/core'; -import { AbstractControl, ValidatorFn } from '@angular/forms'; - + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Directive, HostListener, Input } from '@angular/core'; @Directive({ - selector: '[allowText][formControlName],[allowText][formControl],[allowText][ngModel],[allowText]' + selector: + '[appAllowText][formControlName],[appAllowText][formControl],[appAllowText][ngModel],[appAllowText]', }) -export class StringValidator { - +export class StringValidatorDirective { @Input() allowText!: string; @@ -44,14 +42,10 @@ export class StringValidator { lastValue = null; result!: boolean; - - constructor(private elementRef: ElementRef) { } - validate(input: any) { - let patternCode = this.allowText.trim(); + const patternCode = this.allowText.trim(); - if (input == null || input == '') - return false; + if (input == null || input == '') return false; switch (patternCode) { case 'alphabet': @@ -84,41 +78,39 @@ export class StringValidator { case 'address': this.result = this.address.test(input); break; - default: this.result = false; + default: + this.result = false; } return this.result; } @HostListener('input', ['$event']) onInput(event: any) { - let val = event.target.value; - let lastVal = this.lastValue; - let maxlength = event.target.maxLength; + const val = event.target.value; + const lastVal = this.lastValue; + const maxlength = event.target.maxLength; if (this.allowText.trim() == 'decimal') { - if (val == ''){ + if (val == '') { event.target.value = ''; - } else if (!(this.validate(val))) { + } else if (!this.validate(val)) { event.target.value = lastVal; } } else { - - var inserted = this.findDelta(val, lastVal); + const inserted = this.findDelta(val, lastVal); // get removed chars - var removed = this.findDelta(lastVal, val); + const removed = this.findDelta(lastVal, val); // determine if user pasted content - var pasted = inserted.length >= 1 || (!inserted && !removed); + const pasted = inserted.length >= 1 || (!inserted && !removed); if (maxlength > 0 && val.length > maxlength) { event.target.value = lastVal; } else { if (pasted) { - if (!(this.isValidString(val))) event.target.value = lastVal; - } - else if (!removed) { - if (!(this.isValidChar(inserted))) event.target.value = lastVal; + if (!this.isValidString(val)) event.target.value = lastVal; + } else if (!removed) { + if (!this.isValidChar(inserted)) event.target.value = lastVal; } - } } this.lastValue = event.target.value; @@ -126,7 +118,7 @@ export class StringValidator { @HostListener('focus', ['$event']) onFocus(event: any) { - let input = event.target.value; + const input = event.target.value; this.lastValue = input; } @@ -134,8 +126,8 @@ export class StringValidator { let delta = ''; for (let i = 0; i < value.length; i++) { - let str = value.substr(0, i) + - value.substr(i + value.length - prevValue.length); + const str = + value.substr(0, i) + value.substr(i + value.length - prevValue.length); if (str === prevValue) delta = value.substr(i, value.length - prevValue.length); @@ -150,7 +142,7 @@ export class StringValidator { isValidString(str: any) { for (let i = 0; i < str.length; i++) - if (!(this.isValidChar(str.substr(i, 1)))) return false; + if (!this.isValidChar(str.substr(i, 1))) return false; return true; } } diff --git a/src/app/app-modules/core/material.module.ts b/src/app/app-modules/core/material.module.ts index 662ed2b..c98ea7e 100644 --- a/src/app/app-modules/core/material.module.ts +++ b/src/app/app-modules/core/material.module.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { NgModule } from '@angular/core'; import { MatChipsModule } from '@angular/material/chips'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; @@ -77,11 +77,8 @@ import { MatTableModule } from '@angular/material/table'; MatProgressBarModule, MatListModule, MatTableModule, - - ], - providers: [ - { provide: MAT_DATE_LOCALE, useValue: 'en-GB' }, ], + providers: [{ provide: MAT_DATE_LOCALE, useValue: 'en-GB' }], exports: [ MatIconModule, MatAutocompleteModule, @@ -109,8 +106,7 @@ import { MatTableModule } from '@angular/material/table'; MatTabsModule, MatPaginatorModule, MatProgressBarModule, - MatListModule - ] + MatListModule, + ], }) -export class MaterialModule { } - +export class MaterialModule {} diff --git a/src/app/app-modules/core/mocks/beneficiary-details-service-stub.ts b/src/app/app-modules/core/mocks/beneficiary-details-service-stub.ts index 64a56fa..7161607 100644 --- a/src/app/app-modules/core/mocks/beneficiary-details-service-stub.ts +++ b/src/app/app-modules/core/mocks/beneficiary-details-service-stub.ts @@ -1,29 +1,27 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { BehaviorSubject } from "rxjs"; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { BehaviorSubject } from 'rxjs'; export class BeneficiaryDetailsServiceStub { - beneficiaryDetails = new BehaviorSubject(null); beneficiaryDetails$ = this.beneficiaryDetails.asObservable(); - -} \ No newline at end of file +} diff --git a/src/app/app-modules/core/services/auth-guard.service.ts b/src/app/app-modules/core/services/auth-guard.service.ts index b10c665..4496bbe 100644 --- a/src/app/app-modules/core/services/auth-guard.service.ts +++ b/src/app/app-modules/core/services/auth-guard.service.ts @@ -1,51 +1,48 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; +import { Router, ActivatedRoute } from '@angular/router'; import { HttpServiceService } from './http-service.service'; import { SetLanguageComponent } from '../components/set-language.component'; @Injectable() export class AuthGuard { - - currentLanguageSet:any; - languageComponent! : SetLanguageComponent; + currentLanguageSet: any; + languageComponent!: SetLanguageComponent; constructor( private router: Router, public httpServiceService: HttpServiceService, - private route: ActivatedRoute) { } - - // For setting language - ngOnInit() { + private route: ActivatedRoute, + ) { this.fetchLanguageResponse(); } + // For setting language canActivate(route: any, state: any) { if (sessionStorage.getItem('tm-isAuthenticated')) { return true; - } - else { - let componentName = route.component ? route.component.name : ""; + } else { + const componentName = route.component ? route.component.name : ''; alert(this.currentLanguageSet.youAreNotAuthorised + componentName); this.router.navigate(['/redirin']); return false; @@ -53,9 +50,9 @@ export class AuthGuard { } // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- - ngDoCheck() { - this.fetchLanguageResponse(); - } + // ngDoCheck() { + // this.fetchLanguageResponse(); + // } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); @@ -63,6 +60,4 @@ export class AuthGuard { this.currentLanguageSet = this.languageComponent.currentLanguageObject; } // -----End------ - - } diff --git a/src/app/app-modules/core/services/auth.service.ts b/src/app/app-modules/core/services/auth.service.ts index d27e9f5..bc85307 100644 --- a/src/app/app-modules/core/services/auth.service.ts +++ b/src/app/app-modules/core/services/auth.service.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; @@ -27,59 +27,70 @@ import { environment } from 'src/environments/environment'; @Injectable() export class AuthService { - constructor( private router: Router, - private http: HttpClient) { } + private http: HttpClient, + ) {} login(userName: string, password: string) { - return this.http.post(environment.loginUrl, { userName: userName, password: password }) - // .map(res => res.json()); + return this.http.post(environment.loginUrl, { + userName: userName, + password: password, + }); + // .map(res => res.json()); } getUserSecurityQuestionsAnswer(uname: any): Observable { - return this.http.post(environment.getUserSecurityQuestionsAnswerUrl, { 'userName': uname.toLowerCase() }) - // .map(res => res.json().data) - }; + return this.http.post(environment.getUserSecurityQuestionsAnswerUrl, { + userName: uname.toLowerCase(), + }); + // .map(res => res.json().data) + } getSecurityQuestions() { - return this.http.get(environment.getSecurityQuestionUrl) - // .map(res => res.json()) + return this.http.get(environment.getSecurityQuestionUrl); + // .map(res => res.json()) } saveUserSecurityQuestionsAnswer(userQuestionAnswer: any) { - return this.http.post(environment.saveUserSecurityQuestionsAnswerUrl, userQuestionAnswer) - // .map(res => res.json()) + return this.http.post( + environment.saveUserSecurityQuestionsAnswerUrl, + userQuestionAnswer, + ); + // .map(res => res.json()) } setNewPassword(userName: string, password: string) { - return this.http.post(environment.setNewPasswordUrl, { 'userName': userName, 'password': password }) - // .map(res => res.json()) - }; + return this.http.post(environment.setNewPasswordUrl, { + userName: userName, + password: password, + }); + // .map(res => res.json()) + } logout() { - return this.http.post(environment.logoutUrl, '') - // .map((res) => res.json()); + return this.http.post(environment.logoutUrl, ''); + // .map((res) => res.json()); } validateSessionKey() { - return this.http.post(environment.getSessionExistsURL, {}) - // .map(res => res.json()); + return this.http.post(environment.getSessionExistsURL, {}); + // .map(res => res.json()); } getSwymedLogout() { - return this.http.get(environment.getSwymedLogoutUrl) - // .map(res => res.json()) - // .catch(err => { - // return Observable.throw(err); - // }) + return this.http.get(environment.getSwymedLogoutUrl); + // .map(res => res.json()) + // .catch(err => { + // return Observable.throw(err); + // }) } getUIVersionAndCommitDetails(url: any) { - return this.http.get(url) - // .map((res) => res.json()); + return this.http.get(url); + // .map((res) => res.json()); } getAPIVersionAndCommitDetails() { - return this.http.get(environment.apiVersionUrl) - // .map((res) => res.json()); + return this.http.get(environment.apiVersionUrl); + // .map((res) => res.json()); } removeExternalSessionData() { sessionStorage.removeItem('tm-fallback'); diff --git a/src/app/app-modules/core/services/beneficiary-details.service.ts b/src/app/app-modules/core/services/beneficiary-details.service.ts index 11027c0..e9a3e7f 100644 --- a/src/app/app-modules/core/services/beneficiary-details.service.ts +++ b/src/app/app-modules/core/services/beneficiary-details.service.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @@ -26,31 +26,37 @@ import { environment } from 'src/environments/environment'; @Injectable() export class BeneficiaryDetailsService { - beneficiaryDetails = new BehaviorSubject(null); beneficiaryDetails$ = this.beneficiaryDetails.asObservable(); - constructor(private http: HttpClient) { } + constructor(private http: HttpClient) {} getBeneficiaryDetails(beneficiaryRegID: string, benFlowID: string) { - this.http.post(environment.getBeneficiaryDetail, { beneficiaryRegID: beneficiaryRegID, benFlowID: benFlowID }) - .subscribe({next:(res:any) => { - if (res.json().data) { - this.beneficiaryDetails.next(res.json().data); - } - }, - error:err => { - this.beneficiaryDetails.next(null); - }}); + this.http + .post(environment.getBeneficiaryDetail, { + beneficiaryRegID: beneficiaryRegID, + benFlowID: benFlowID, + }) + .subscribe({ + next: (res: any) => { + if (res.json().data) { + this.beneficiaryDetails.next(res.json().data); + } + }, + error: (err) => { + this.beneficiaryDetails.next(null); + }, + }); } getBeneficiaryImage(beneficiaryRegID: string) { - return this.http.post(environment.getBeneficiaryImage, { beneficiaryRegID: beneficiaryRegID }) - // .map((res : any)=> res.json().data); + return this.http.post(environment.getBeneficiaryImage, { + beneficiaryRegID: beneficiaryRegID, + }); + // .map((res : any)=> res.json().data); } reset() { this.beneficiaryDetails.next(null); } - } diff --git a/src/app/app-modules/core/services/camera.service.ts b/src/app/app-modules/core/services/camera.service.ts index f7c8121..b0bcb9d 100644 --- a/src/app/app-modules/core/services/camera.service.ts +++ b/src/app/app-modules/core/services/camera.service.ts @@ -1,82 +1,89 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { DOCUMENT } from '@angular/common'; import { Injectable, Inject } from '@angular/core'; -import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog'; +import { + MatDialog, + MatDialogConfig, + MatDialogRef, +} from '@angular/material/dialog'; import { Observable } from 'rxjs'; import { CameraDialogComponent } from '../components/camera-dialog/camera-dialog.component'; @Injectable() export class CameraService { + constructor(private dialog: MatDialog) {} - constructor(private dialog: MatDialog, @Inject(DOCUMENT) doc: any) { - } + public capture(titleAlign = 'center'): Observable { + // const dialogRef: MatDialogRef; + const config = new MatDialogConfig(); + const dialogRef: MatDialogRef = this.dialog.open( + CameraDialogComponent, + config, + ); + dialogRef.componentInstance.capture = true; + dialogRef.componentInstance.imageCode = false; + return dialogRef.afterClosed(); + } + public viewImage(benImageCode: string, titleAlign = 'center'): void { + const config = new MatDialogConfig(); + const dialogRef: MatDialogRef = this.dialog.open( + CameraDialogComponent, + config, + ); + dialogRef.componentInstance.capture = false; + dialogRef.componentInstance.imageCode = benImageCode; + } - public capture(titleAlign: string = 'center'): Observable { + public annotate( + image: string, + points: any, + titleAlign = 'center', + ): Observable { + const dialogRef: MatDialogRef = this.dialog.open( + CameraDialogComponent, + { + width: '80%', + }, + ); + dialogRef.componentInstance.capture = false; + dialogRef.componentInstance.imageCode = false; + dialogRef.componentInstance.annotate = image; + dialogRef.componentInstance.availablePoints = points; + return dialogRef.afterClosed(); + } - let dialogRef: MatDialogRef; - const config = new MatDialogConfig(); - dialogRef = this.dialog.open(CameraDialogComponent, config); - dialogRef.componentInstance.capture = true; - dialogRef.componentInstance.imageCode = false; - return dialogRef.afterClosed(); - - } - - public viewImage(benImageCode: string, titleAlign: string = 'center'): void { - - let dialogRef: MatDialogRef; - const config = new MatDialogConfig(); - dialogRef = this.dialog.open(CameraDialogComponent, config); - dialogRef.componentInstance.capture = false; - dialogRef.componentInstance.imageCode = benImageCode; - - } - - public annotate(image: string, points: any, titleAlign: string = 'center'): Observable { - - let dialogRef: MatDialogRef; - dialogRef = this.dialog.open(CameraDialogComponent, { - width: '80%' - }); - dialogRef.componentInstance.capture = false; - dialogRef.componentInstance.imageCode = false; - dialogRef.componentInstance.annotate = image; - dialogRef.componentInstance.availablePoints = points; - return dialogRef.afterClosed(); - - } - - public ViewGraph(graph: any): void { - let dialogRef: MatDialogRef; - dialogRef = this.dialog.open(CameraDialogComponent, { - width: '80%', - }); - dialogRef.componentInstance.capture = false; - dialogRef.componentInstance.imageCode = false; - dialogRef.componentInstance.annotate = false; - dialogRef.componentInstance.availablePoints = false; - dialogRef.componentInstance.graph = graph; - } - + public ViewGraph(graph: any): void { + const dialogRef: MatDialogRef = this.dialog.open( + CameraDialogComponent, + { + width: '80%', + }, + ); + dialogRef.componentInstance.capture = false; + dialogRef.componentInstance.imageCode = false; + dialogRef.componentInstance.annotate = false; + dialogRef.componentInstance.availablePoints = false; + dialogRef.componentInstance.graph = graph; + } } diff --git a/src/app/app-modules/core/services/can-deactivate-guard.service.ts b/src/app/app-modules/core/services/can-deactivate-guard.service.ts index 9966015..8110aee 100644 --- a/src/app/app-modules/core/services/can-deactivate-guard.service.ts +++ b/src/app/app-modules/core/services/can-deactivate-guard.service.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable } from '@angular/core'; import { CanDeactivate } from '@angular/router'; import { Observable } from 'rxjs'; @@ -27,10 +27,9 @@ export interface CanComponentDeactivate { } @Injectable() -export class CanDeactivateGuardService implements CanDeactivate{ - - constructor() { } - +export class CanDeactivateGuardService + implements CanDeactivate +{ canDeactivate(component: CanComponentDeactivate) { return component.canDeactivate ? component.canDeactivate() : true; } diff --git a/src/app/app-modules/core/services/confirmation.service.ts b/src/app/app-modules/core/services/confirmation.service.ts index 7d570f4..efaf1e8 100644 --- a/src/app/app-modules/core/services/confirmation.service.ts +++ b/src/app/app-modules/core/services/confirmation.service.ts @@ -1,177 +1,234 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable, Inject } from '@angular/core'; import { DOCUMENT } from '@angular/common'; -import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog'; +import { + MatDialog, + MatDialogConfig, + MatDialogRef, +} from '@angular/material/dialog'; import { Observable } from 'rxjs'; import { CommonDialogComponent } from '../components/common-dialog/common-dialog.component'; @Injectable() export class ConfirmationService { - private isShown: boolean = false; + private isShown = false; - constructor(private dialog: MatDialog, @Inject(DOCUMENT) doc: any) { - } + constructor(private dialog: MatDialog) {} - public confirm(title: string, message: string, btnOkText: string = 'OK', btnCancelText: string = 'Cancel'): Observable { - let dialogRef: MatDialogRef; - dialogRef = this.dialog.open(CommonDialogComponent, { - width: '420px', - disableClose: false - }); - dialogRef.componentInstance.title = title; - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.btnCancelText = btnCancelText; - dialogRef.componentInstance.confirmAlert = true; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = false; - return dialogRef.afterClosed(); - } + public confirm( + title: string, + message: string, + btnOkText = 'OK', + btnCancelText = 'Cancel', + ): Observable { + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + { + width: '420px', + disableClose: false, + }, + ); + dialogRef.componentInstance.title = title; + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.btnCancelText = btnCancelText; + dialogRef.componentInstance.confirmAlert = true; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = false; + return dialogRef.afterClosed(); + } - public alert(message: string, status: string = 'info', btnOkText: string = 'OK'): any { - let dialogRef: MatDialogRef; - const config = { - width: '420px', - } - dialogRef = this.dialog.open(CommonDialogComponent, config); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.status = status.toLowerCase(); - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = true; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = false; - return dialogRef.afterClosed(); - } + public alert(message: string, status = 'info', btnOkText = 'OK'): any { + const config = { + width: '420px', + }; + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + config, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.status = status.toLowerCase(); + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = true; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = false; + return dialogRef.afterClosed(); + } - public alertConfirm(message: string, status: string = 'info', titleAlign: string = 'center', - messageAlign: string = 'center', btnOkText: string = 'Ok'): Observable { - + public alertConfirm( + message: string, + status = 'info', + titleAlign = 'center', + messageAlign = 'center', + btnOkText = 'Ok', + ): Observable { if (!this.isShown) { - let dialogRef: MatDialogRef; - const config = new MatDialogConfig(); - dialogRef = this.dialog.open(CommonDialogComponent, config); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.status = status; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = true; - dialogRef.afterClosed().subscribe(res => { - this.isShown = false; - } - ) - this.isShown = true; - return dialogRef.afterClosed(); - } - else{ - return null as any; - } -} - public remarks(message: string, titleAlign: string = 'center', messageAlign: string = 'center', btnOkText: string = 'Submit', btnCancelText:string = "Cancel"): Observable { - let dialogRef: MatDialogRef; - const config = { - width: '420px', - } - dialogRef = this.dialog.open(CommonDialogComponent, config); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = true; - dialogRef.componentInstance.editRemarks = false; - dialogRef.componentInstance.btnCancelText = btnCancelText; - return dialogRef.afterClosed(); + const config = new MatDialogConfig(); + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + config, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.status = status; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = true; + dialogRef.afterClosed().subscribe((res) => { + this.isShown = false; + }); + this.isShown = true; + return dialogRef.afterClosed(); + } else { + return null as any; } + } + public remarks( + message: string, + titleAlign = 'center', + messageAlign = 'center', + btnOkText = 'Submit', + btnCancelText = 'Cancel', + ): Observable { + const config = { + width: '420px', + }; + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + config, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = true; + dialogRef.componentInstance.editRemarks = false; + dialogRef.componentInstance.btnCancelText = btnCancelText; + return dialogRef.afterClosed(); + } - public editRemarks(message: string, comments: string, titleAlign: string = 'center', messageAlign: string = 'center', btnOkText: string = 'Submit', btnCancelText:string = "Cancel"): Observable { - let dialogRef: MatDialogRef; - dialogRef = this.dialog.open(CommonDialogComponent, { width: '60%' }); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = true; - dialogRef.componentInstance.comments = comments; - dialogRef.componentInstance.btnCancelText = btnCancelText; + public editRemarks( + message: string, + comments: string, + titleAlign = 'center', + messageAlign = 'center', + btnOkText = 'Submit', + btnCancelText = 'Cancel', + ): Observable { + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + { width: '60%' }, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = true; + dialogRef.componentInstance.comments = comments; + dialogRef.componentInstance.btnCancelText = btnCancelText; - return dialogRef.afterClosed(); - } + return dialogRef.afterClosed(); + } - public notify(message: string, mandatories: any, titleAlign: string = 'center', messageAlign: string = 'center', btnOkText: string = 'OK'): Observable { - let dialogRef: MatDialogRef; - const config = { - width: '420px' - } - dialogRef = this.dialog.open(CommonDialogComponent, config); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = false; - dialogRef.componentInstance.notify = true; - dialogRef.componentInstance.mandatories = mandatories; - return dialogRef.afterClosed(); - } + public notify( + message: string, + mandatories: any, + titleAlign = 'center', + messageAlign = 'center', + btnOkText = 'OK', + ): Observable { + const config = { + width: '420px', + }; + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + config, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = false; + dialogRef.componentInstance.notify = true; + dialogRef.componentInstance.mandatories = mandatories; + return dialogRef.afterClosed(); + } - public choice(message: string, values: any, titleAlign: string = 'center', messageAlign: string = 'center', btnOkText: string = 'Confirm', btnCancelText: string = 'Cancel'): Observable { - let dialogRef: MatDialogRef; - const config = { - width: '420px', - } - dialogRef = this.dialog.open(CommonDialogComponent, config); - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.btnCancelText = btnCancelText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = false; - dialogRef.componentInstance.notify = false; - dialogRef.componentInstance.choice = true; - dialogRef.componentInstance.values = values; - return dialogRef.afterClosed(); - } - - public startTimer(title: string, message: string, timer: number, btnOkText: string = 'Continue', btnCancelText: string = 'Cancel'): Observable { - let dialogRef: MatDialogRef; - dialogRef = this.dialog.open(CommonDialogComponent, { - width: '420px', - disableClose: true, - }); - dialogRef.componentInstance.title = title; - dialogRef.componentInstance.message = message; - dialogRef.componentInstance.btnOkText = btnOkText; - dialogRef.componentInstance.btnCancelText = btnCancelText; - dialogRef.componentInstance.confirmAlert = false; - dialogRef.componentInstance.alert = false; - dialogRef.componentInstance.remarks = false; - dialogRef.componentInstance.editRemarks = false; - dialogRef.componentInstance.sessionTimeout = true; - dialogRef.componentInstance.updateTimer(timer); - return dialogRef.afterClosed(); - } + public choice( + message: string, + values: any, + titleAlign = 'center', + messageAlign = 'center', + btnOkText = 'Confirm', + btnCancelText = 'Cancel', + ): Observable { + const config = { + width: '420px', + }; + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + config, + ); + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.btnCancelText = btnCancelText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = false; + dialogRef.componentInstance.notify = false; + dialogRef.componentInstance.choice = true; + dialogRef.componentInstance.values = values; + return dialogRef.afterClosed(); + } + public startTimer( + title: string, + message: string, + timer: number, + btnOkText = 'Continue', + btnCancelText = 'Cancel', + ): Observable { + const dialogRef: MatDialogRef = this.dialog.open( + CommonDialogComponent, + { + width: '420px', + disableClose: true, + }, + ); + dialogRef.componentInstance.title = title; + dialogRef.componentInstance.message = message; + dialogRef.componentInstance.btnOkText = btnOkText; + dialogRef.componentInstance.btnCancelText = btnCancelText; + dialogRef.componentInstance.confirmAlert = false; + dialogRef.componentInstance.alert = false; + dialogRef.componentInstance.remarks = false; + dialogRef.componentInstance.editRemarks = false; + dialogRef.componentInstance.sessionTimeout = true; + dialogRef.componentInstance.updateTimer(timer); + return dialogRef.afterClosed(); + } } diff --git a/src/app/app-modules/core/services/global-error-handler.service.ts b/src/app/app-modules/core/services/global-error-handler.service.ts index a5c3351..81ee899 100644 --- a/src/app/app-modules/core/services/global-error-handler.service.ts +++ b/src/app/app-modules/core/services/global-error-handler.service.ts @@ -1,33 +1,30 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { ErrorHandler, Injectable} from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { ErrorHandler, Injectable } from '@angular/core'; @Injectable() export class GlobalErrorHandler implements ErrorHandler { - - handleError(error: Error) { console.log(error); throw error; } - -} \ No newline at end of file +} diff --git a/src/app/app-modules/core/services/http-interceptor.service.ts b/src/app/app-modules/core/services/http-interceptor.service.ts index e0cba79..b65769a 100644 --- a/src/app/app-modules/core/services/http-interceptor.service.ts +++ b/src/app/app-modules/core/services/http-interceptor.service.ts @@ -1,34 +1,40 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { Observable, catchError, tap, throwError } from 'rxjs'; import { ConfirmationService } from './confirmation.service'; import { SpinnerService } from './spinner.service'; -import { HttpClient, HttpErrorResponse, HttpEvent, HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http'; +import { + HttpClient, + HttpErrorResponse, + HttpEvent, + HttpHandler, + HttpRequest, + HttpResponse, +} from '@angular/common/http'; @Injectable() export class HttpInterceptor implements HttpInterceptor { - timerRef: any; currentLanguageSet: any; constructor( @@ -40,9 +46,9 @@ export class HttpInterceptor implements HttpInterceptor { intercept( req: HttpRequest, - next: HttpHandler + next: HttpHandler, ): Observable> { - let key: any = sessionStorage.getItem('key'); + const key: any = sessionStorage.getItem('key'); let modifiedReq = null; if (key !== undefined && key !== null) { modifiedReq = req.clone({ @@ -55,8 +61,8 @@ export class HttpInterceptor implements HttpInterceptor { } return next.handle(modifiedReq).pipe( tap((event: HttpEvent) => { - if(req.url !== undefined && !req.url.includes('cti/getAgentState') ) - this.spinnerService.show(); + if (req.url !== undefined && !req.url.includes('cti/getAgentState')) + this.spinnerService.show(); if (event instanceof HttpResponse) { console.log(event.body); this.onSuccess(req.url, event.body); @@ -68,7 +74,7 @@ export class HttpInterceptor implements HttpInterceptor { console.error(error); this.spinnerService.show(); return throwError(error.error); - }) + }), ); } @@ -86,5 +92,4 @@ export class HttpInterceptor implements HttpInterceptor { } } // -----End------ - } diff --git a/src/app/app-modules/core/services/http-service.service.ts b/src/app/app-modules/core/services/http-service.service.ts index fa36658..e8edcc6 100644 --- a/src/app/app-modules/core/services/http-service.service.ts +++ b/src/app/app-modules/core/services/http-service.service.ts @@ -1,64 +1,63 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Injectable } from "@angular/core"; -import { HttpClient } from "@angular/common/http"; -import { Observable, BehaviorSubject, Subject } from "rxjs"; -import { environment } from "src/environments/environment"; - + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable, BehaviorSubject, Subject } from 'rxjs'; +import { environment } from 'src/environments/environment'; @Injectable() export class HttpServiceService { private _listners = new Subject(); listen(): Observable { - return this._listners.asObservable(); + return this._listners.asObservable(); } filter(filterBy: string) { - this._listners.next(filterBy); + this._listners.next(filterBy); } language!: any; appCurrentLanguge = new BehaviorSubject(this.language); currentLangugae$ = this.appCurrentLanguge.asObservable(); - constructor( private _http: HttpClient, - private http: HttpClient,) { } + constructor( + private _http: HttpClient, + private http: HttpClient, + ) {} fetchLanguageSet() { - console.log("Here i come"); - - return this.http.get(environment.getLanguageList) - // .map(res => res.json().data); - + console.log('Here i come'); + + return this.http.get(environment.getLanguageList); + // .map(res => res.json().data); } getLanguage(url: string) { - return this._http.get(url); } getCurrentLanguage(response: any) { - console.log("here at one", response); + console.log('here at one', response); this.language = response; - console.log("teste",this.language); - this.appCurrentLanguge.next(response) ; - console.log("here at two",this.appCurrentLanguge.value); + console.log('teste', this.language); + this.appCurrentLanguge.next(response); + console.log('here at two', this.appCurrentLanguge.value); } } diff --git a/src/app/app-modules/core/services/index.ts b/src/app/app-modules/core/services/index.ts index fb4e0d2..0dabf49 100644 --- a/src/app/app-modules/core/services/index.ts +++ b/src/app/app-modules/core/services/index.ts @@ -1,30 +1,26 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ export * from './confirmation.service'; export * from './camera.service'; export * from './spinner.service'; export * from './global-error-handler.service'; export * from './auth.service'; - - - - diff --git a/src/app/app-modules/core/services/spinner.service.ts b/src/app/app-modules/core/services/spinner.service.ts index e8c8ee5..1d28833 100644 --- a/src/app/app-modules/core/services/spinner.service.ts +++ b/src/app/app-modules/core/services/spinner.service.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; export interface SpinnerState { @@ -29,7 +29,7 @@ export interface SpinnerState { export class SpinnerService { spinnerSubject = new Subject(); spinnerState = this.spinnerSubject.asObservable(); - temp:any = []; + temp: any = []; show() { this.temp.push(true); if (this.temp.length == 1) { @@ -38,8 +38,7 @@ export class SpinnerService { } hide() { - if (this.temp.length > 0) - this.temp.pop(); + if (this.temp.length > 0) this.temp.pop(); if (this.temp.length == 0) this.spinnerSubject.next({ show: false }); @@ -49,5 +48,4 @@ export class SpinnerService { this.temp = [false]; this.hide(); } - } diff --git a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.html b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.html index 373d851..8d20894 100644 --- a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.html +++ b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.html @@ -3,84 +3,140 @@
- - + +
- +
-
- -
- +
+ +
- - -
- - +
+ + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + - - - + + @@ -88,11 +144,18 @@ @@ -104,4 +167,4 @@ - \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.spec.ts b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.spec.ts index 293f9ba..68999a0 100644 --- a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.spec.ts +++ b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AppointmentViewComponent } from './appointment-view.component'; @@ -29,9 +29,8 @@ describe('AppointmentViewComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AppointmentViewComponent ] - }) - .compileComponents(); + declarations: [AppointmentViewComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.ts b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.ts index 8c81afc..2493ba5 100644 --- a/src/app/app-modules/scheduler/appointment-view/appointment-view.component.ts +++ b/src/app/app-modules/scheduler/appointment-view/appointment-view.component.ts @@ -1,20 +1,19 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy, DoCheck } from '@angular/core'; import { SchedulerService } from '../shared/services/scheduler.service'; -import { ConfirmationService } from "../../core/services/confirmation.service"; +import { ConfirmationService } from '../../core/services/confirmation.service'; -import { BeneficiaryDetailsService } from "../../core/services/beneficiary-details.service"; -import { CameraService } from "../../core/services/camera.service"; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { CameraService } from '../../core/services/camera.service'; import { SetLanguageComponent } from '../../core/components/set-language.component'; import { HttpServiceService } from '../../core/services/http-service.service'; import * as moment from 'moment'; @Component({ selector: 'app-appointment-view', templateUrl: './appointment-view.component.html', - styleUrls: ['./appointment-view.component.css'] + styleUrls: ['./appointment-view.component.css'], }) -export class AppointmentViewComponent implements OnInit, OnDestroy { - - languageComponent! : SetLanguageComponent; +export class AppointmentViewComponent implements OnInit, OnDestroy, DoCheck { + languageComponent!: SetLanguageComponent; selectedSpecialization: any; selectedSpecialist: any; viewDate: any; @@ -39,17 +38,19 @@ export class AppointmentViewComponent implements OnInit, OnDestroy { private cameraService: CameraService, public httpServiceService: HttpServiceService, private beneficiaryDetailsService: BeneficiaryDetailsService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} ngOnInit() { this.blankTable.length = 5; this.getSpecializationMaster(); - let userInfo = { userID: localStorage.getItem('supervisor-specialistID') }; + const userInfo = { + userID: localStorage.getItem('supervisor-specialistID'), + }; this.selectedSpecialist = userInfo; this.fetchLanguageResponse(); this.viewDate = new Date(); this.getAllAppointment(); - } ngOnDestroy() { @@ -57,62 +58,83 @@ export class AppointmentViewComponent implements OnInit, OnDestroy { } getSpecializationMaster() { - this.schedulerService.getSpecializationMaster() - .subscribe((res: any) => { - if (res.statusCode == 200 && res.data) { - this.specializationMaster = res.data; - } - }); + this.schedulerService.getSpecializationMaster().subscribe((res: any) => { + if (res.statusCode == 200 && res.data) { + this.specializationMaster = res.data; + } + }); } getSpecialist() { this.selectedSpecialist = undefined; - let providerServiceMapID = localStorage.getItem("tm-providerServiceMapID"); - let userID = localStorage.getItem("tm-userID"); - let specializationID = this.selectedSpecialization.specializationID; - - this.schedulerService.getSpecialist({ specializationID, providerServiceMapID, userID }) - .subscribe({next:(res: any) => { - if (res.statusCode == 200 && res.data) { - this.specialistList = res.data; - } else { + const providerServiceMapID = localStorage.getItem( + 'tm-providerServiceMapID', + ); + const userID = localStorage.getItem('tm-userID'); + const specializationID = this.selectedSpecialization.specializationID; + + this.schedulerService + .getSpecialist({ specializationID, providerServiceMapID, userID }) + .subscribe({ + next: (res: any) => { + if (res.statusCode == 200 && res.data) { + this.specialistList = res.data; + } else { + this.specialistList = []; + } + }, + error: (error: any) => { this.specialistList = []; - } - }, - error: (error: any) => { - this.specialistList = []; - }}); + }, + }); } getAllAppointment() { - let providerServiceMapID = localStorage.getItem("tm-providerServiceMapID"); - let userID = localStorage.getItem("tm-userID"); - let specializationID = null; - let specialistID = this.selectedSpecialist.userID; - let appointmentDate = new Date(this.viewDate) + const providerServiceMapID = localStorage.getItem( + 'tm-providerServiceMapID', + ); + const userID = localStorage.getItem('tm-userID'); + const specializationID = null; + const specialistID = this.selectedSpecialist.userID; + let appointmentDate = new Date(this.viewDate); appointmentDate.setHours(23); appointmentDate.setMinutes(59); appointmentDate.setSeconds(59); appointmentDate.setMilliseconds(0); - appointmentDate = new Date(appointmentDate.valueOf() - 1 * appointmentDate.getTimezoneOffset() * 60 * 1000) - - this.schedulerService.getAllAppointments({ specializationID, specialistID, appointmentDate, providerServiceMapID, userID }) - .subscribe({next:(res: any) => { - if (res && res.statusCode == 200 && res.data) { - this.filterTerm = null; - let benlist = this.loadDataToBenList(res.data); - this.beneficiaryList = benlist; - this.filteredBeneficiaryList = benlist; - this.pageChanged({ page: this.activePage, itemsPerPage: this.rowsPerPage }); - } else { - this.confirmationService.alert(res.errorMessage, "error"); - } - }, - error: (error: any) => { - this.confirmationService.alert(error, "error"); - }}); + appointmentDate = new Date( + appointmentDate.valueOf() - + 1 * appointmentDate.getTimezoneOffset() * 60 * 1000, + ); + + this.schedulerService + .getAllAppointments({ + specializationID, + specialistID, + appointmentDate, + providerServiceMapID, + userID, + }) + .subscribe({ + next: (res: any) => { + if (res && res.statusCode == 200 && res.data) { + this.filterTerm = null; + const benlist = this.loadDataToBenList(res.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.pageChanged({ + page: this.activePage, + itemsPerPage: this.rowsPerPage, + }); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + error: (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + }); } filterBeneficiaryList(searchTerm: string | null) { @@ -120,18 +142,18 @@ export class AppointmentViewComponent implements OnInit, OnDestroy { this.filteredBeneficiaryList = this.beneficiaryList; } else { this.filteredBeneficiaryList = []; - this.beneficiaryList.forEach(item => { - for (let key in item) { + this.beneficiaryList.forEach((item) => { + for (const key in item) { if ( - key == "beneficiaryID" || - key == "benName" || - key == "genderName" || - key == "age" || - key == "benVisitDate" || - key == "VisitCategory" || - key == "benVisitNo" + key == 'beneficiaryID' || + key == 'benName' || + key == 'genderName' || + key == 'age' || + key == 'benVisitDate' || + key == 'VisitCategory' || + key == 'benVisitNo' ) { - let value: string = "" + item[key]; + const value: string = '' + item[key]; if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { this.filteredBeneficiaryList.push(item); break; @@ -146,19 +168,23 @@ export class AppointmentViewComponent implements OnInit, OnDestroy { loadDataToBenList(data: any) { data.forEach((element: any) => { - element.genderName = element.genderName || "Not Available"; - element.age = element.age || "Not Available"; - element.statusMessage = element.statusMessage || "Not Available"; - element.VisitCategory = element.VisitCategory || "Not Available"; - element.benVisitNo = element.benVisitNo || "Not Available"; - element.districtName = element.districtName || "Not Available"; - element.villageName = element.villageName || "Not Available"; + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; element.arrival = false; - element.preferredPhoneNum = element.preferredPhoneNum || "Not Available"; - element.visitDate = moment(element.visitDate).format("DD-MM-YYYY") || "Not Available"; - element.benVisitDate = moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || 'Not Available'; - element.tCRequestDate = moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || 'Not Available'; - + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY') || 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; }); return data; } @@ -170,48 +196,60 @@ export class AppointmentViewComponent implements OnInit, OnDestroy { } patientImageView(benregID: any) { - this.beneficiaryDetailsService.getBeneficiaryImage(benregID) - .subscribe((data:any) => { - if (data.data && data.data.benImage) this.cameraService.viewImage(data.benImage); - else this.confirmationService.alert(this.currentLanguageSet.imagenotfound); + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data.data && data.data.benImage) + this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert(this.currentLanguageSet.imagenotfound); }); } cancelTCRequest(beneficiary: any) { - this.confirmationService.confirm("info", this.currentLanguageSet.cancelTCrequest,this.currentLanguageSet.yes, this.currentLanguageSet.no) - .subscribe(res => { + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.cancelTCrequest, + this.currentLanguageSet.yes, + this.currentLanguageSet.no, + ) + .subscribe((res) => { if (res) { - this.schedulerService.cancelBeneficiaryTCRequest({ - benflowID: beneficiary.benFlowID, - benRegID: beneficiary.beneficiaryRegID, - visitCode: beneficiary.visitCode, - userID: beneficiary.tCSpecialistUserID, - modifiedBy: localStorage.getItem('tm-userName'), - }).subscribe({next:(res:any) => { - if (res && res.statusCode && res.data) { - this.confirmationService.alert(res.data.response, "success"); - this.getAllAppointment(); - } else { - this.confirmationService.alert(res.errorMessage, "error") - } - }, - error: (error: any) => { - this.confirmationService.alert(error, "error"); - }}); + this.schedulerService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('tm-userName'), + }) + .subscribe({ + next: (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.getAllAppointment(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + error: (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + }); } }); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- - } diff --git a/src/app/app-modules/scheduler/dashboard/dashboard.component.html b/src/app/app-modules/scheduler/dashboard/dashboard.component.html index 9b65453..d601c83 100644 --- a/src/app/app-modules/scheduler/dashboard/dashboard.component.html +++ b/src/app/app-modules/scheduler/dashboard/dashboard.component.html @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/dashboard/dashboard.component.spec.ts b/src/app/app-modules/scheduler/dashboard/dashboard.component.spec.ts index 1b0f24f..ac3b27d 100644 --- a/src/app/app-modules/scheduler/dashboard/dashboard.component.spec.ts +++ b/src/app/app-modules/scheduler/dashboard/dashboard.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DashboardComponent } from './dashboard.component'; @@ -29,9 +29,8 @@ describe('DashboardComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DashboardComponent ] - }) - .compileComponents(); + declarations: [DashboardComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/dashboard/dashboard.component.ts b/src/app/app-modules/scheduler/dashboard/dashboard.component.ts index 2163f32..6f09d79 100644 --- a/src/app/app-modules/scheduler/dashboard/dashboard.component.ts +++ b/src/app/app-modules/scheduler/dashboard/dashboard.component.ts @@ -1,32 +1,29 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component } from '@angular/core'; @Component({ selector: 'app-dashboard', templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.css'] + styleUrls: ['./dashboard.component.css'], }) -export class DashboardComponent { - - -} +export class DashboardComponent {} diff --git a/src/app/app-modules/scheduler/mystaff/mystaff.component.html b/src/app/app-modules/scheduler/mystaff/mystaff.component.html index 185aa6f..ce2d1c0 100644 --- a/src/app/app-modules/scheduler/mystaff/mystaff.component.html +++ b/src/app/app-modules/scheduler/mystaff/mystaff.component.html @@ -2,33 +2,59 @@
- +
- + All - - {{specialization.specialization}} + + {{ specialization.specialization }}
-
+
-

{{specialist?.titleName + " " + specialist?.firstName + " " + specialist?.lastName}}

-
{{specialist?.specialization}}
-

{{specialist?.genderName}}

+

+ {{ + specialist?.titleName + + " " + + specialist?.firstName + + " " + + specialist?.lastName + }} +

+
{{ specialist?.specialization }}
+

{{ specialist?.genderName }}

-
\ No newline at end of file + diff --git a/src/app/app-modules/scheduler/mystaff/mystaff.component.spec.ts b/src/app/app-modules/scheduler/mystaff/mystaff.component.spec.ts index 1885ba2..c2e55fb 100644 --- a/src/app/app-modules/scheduler/mystaff/mystaff.component.spec.ts +++ b/src/app/app-modules/scheduler/mystaff/mystaff.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MystaffComponent } from './mystaff.component'; @@ -29,9 +29,8 @@ describe('MystaffComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ MystaffComponent ] - }) - .compileComponents(); + declarations: [MystaffComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/mystaff/mystaff.component.ts b/src/app/app-modules/scheduler/mystaff/mystaff.component.ts index d3d2140..1a4f691 100644 --- a/src/app/app-modules/scheduler/mystaff/mystaff.component.ts +++ b/src/app/app-modules/scheduler/mystaff/mystaff.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { SchedulerService } from '../shared/services'; import { Router } from '@angular/router'; import { HttpServiceService } from '../../core/services/http-service.service'; @@ -28,73 +28,79 @@ import { SetLanguageComponent } from '../../core/components/set-language.compone @Component({ selector: 'app-mystaff', templateUrl: './mystaff.component.html', - styleUrls: ['./mystaff.component.css'] + styleUrls: ['./mystaff.component.css'], }) -export class MystaffComponent implements OnInit { - +export class MystaffComponent implements OnInit, DoCheck { specialistList = []; filterTerm: any; - filteredSpecialistList : any[] = []; + filteredSpecialistList: any[] = []; specializationMaster: any[] = []; selectedSpecialization: any; - currentLanguageSet:any; + currentLanguageSet: any; languageComponent!: SetLanguageComponent; - constructor(private schedulerService: SchedulerService, - public httpServiceService:HttpServiceService, - private router: Router) { } + constructor( + private schedulerService: SchedulerService, + public httpServiceService: HttpServiceService, + private router: Router, + ) {} ngOnInit() { - let specialistListReq = { - "specializationID": 0, - "providerServiceMapID": localStorage.getItem('tm-providerServiceMapID'), - "userID": localStorage.getItem('tm-userID') - } + const specialistListReq = { + specializationID: 0, + providerServiceMapID: localStorage.getItem('tm-providerServiceMapID'), + userID: localStorage.getItem('tm-userID'), + }; this.fetchLanguageResponse(); this.getAllSpecialist(specialistListReq); this.getSpecialisationMaster(); } getAllSpecialist(specialistListReq: any) { - this.schedulerService.getAllSpecialist(specialistListReq).subscribe((response: any) => { - if (response.statusCode == 200) { - this.specialistList = response.data; - this.filteredSpecialistList = response.data; - } - console.log('Specialist List..', this.specialistList); - }) + this.schedulerService + .getAllSpecialist(specialistListReq) + .subscribe((response: any) => { + if (response.statusCode == 200) { + this.specialistList = response.data; + this.filteredSpecialistList = response.data; + } + console.log('Specialist List..', this.specialistList); + }); } getSpecialisationMaster() { - this.schedulerService.getSpecializationMaster() - .subscribe((res: any) => { - if (res.statusCode == 200 && res.data) { - this.specializationMaster = res.data; - } - }); + this.schedulerService.getSpecializationMaster().subscribe((res: any) => { + if (res.statusCode == 200 && res.data) { + this.specializationMaster = res.data; + } + }); } openProfile(specialist: any) { console.log('Opening profile..'); - let userID = specialist.userID; - localStorage.setItem('supervisor-specialistID',userID); - + const userID = specialist.userID; + localStorage.setItem('supervisor-specialistID', userID); + this.router.navigate(['telemedicine/profile', userID]); } filterSpecialist() { - let filter1 = this.specialistList; - let filter2 = this.filterBySearch(this.filterTerm, filter1); - let filter3 = this.filterBySpec(this.selectedSpecialization, filter2); + const filter1 = this.specialistList; + const filter2 = this.filterBySearch(this.filterTerm, filter1); + const filter3 = this.filterBySpec(this.selectedSpecialization, filter2); this.filteredSpecialistList = filter3; } filterBySpec(selectedSpecialization: string, filteredSpecialist: any) { - if (selectedSpecialization == undefined || selectedSpecialization == null || selectedSpecialization == "All") { + if ( + selectedSpecialization == undefined || + selectedSpecialization == null || + selectedSpecialization == 'All' + ) { return filteredSpecialist; } else { - let filteredSpecialistList: any[] = []; + const filteredSpecialistList: any[] = []; filteredSpecialist.forEach((item: any) => { if (item.specialization == this.selectedSpecialization) { filteredSpecialistList.push(item); @@ -107,17 +113,17 @@ export class MystaffComponent implements OnInit { if (!searchTerm.trim()) { return filteredSpecialist; } - + return filteredSpecialist.filter((item: any) => { - let valuesToCheck = ["firstName", "lastName"]; - + const valuesToCheck = ['firstName', 'lastName']; + return valuesToCheck.some((key) => { - let value = (item[key] || "").toString().toLowerCase(); + const value = (item[key] || '').toString().toLowerCase(); return value.includes(searchTerm.toLowerCase()); }); }); } - + // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- ngDoCheck() { this.fetchLanguageResponse(); diff --git a/src/app/app-modules/scheduler/mystaff/profile/profile.component.html b/src/app/app-modules/scheduler/mystaff/profile/profile.component.html index a28c6f9..12d2e00 100644 --- a/src/app/app-modules/scheduler/mystaff/profile/profile.component.html +++ b/src/app/app-modules/scheduler/mystaff/profile/profile.component.html @@ -1,23 +1,47 @@
- -
- Avatar Profile + Avatar Profile
-

{{specialistData?.titleName+ specialistData?.firstName + " " + specialistData?.lastName}}

-
{{specialistData?.specialization}}
-
{{specialistData?.emailID}}
-
{{specialistData?.contactNumber}}
-
{{specialistData?.gender}}
+

+ {{ + specialistData?.titleName + + specialistData?.firstName + + " " + + specialistData?.lastName + }} +

+
+ {{ specialistData?.specialization }} +
+
{{ specialistData?.emailID }}
+
{{ specialistData?.contactNumber }}
+
{{ specialistData?.gender }}
@@ -26,18 +50,17 @@
{{specialistData?.gender}}
- - - - - - - - - + + + + + + + +
- \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/mystaff/profile/profile.component.spec.ts b/src/app/app-modules/scheduler/mystaff/profile/profile.component.spec.ts index e075326..9915d47 100644 --- a/src/app/app-modules/scheduler/mystaff/profile/profile.component.spec.ts +++ b/src/app/app-modules/scheduler/mystaff/profile/profile.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ProfileComponent } from './profile.component'; @@ -29,9 +29,8 @@ describe('ProfileComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ProfileComponent ] - }) - .compileComponents(); + declarations: [ProfileComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/mystaff/profile/profile.component.ts b/src/app/app-modules/scheduler/mystaff/profile/profile.component.ts index 500f646..dd6daba 100644 --- a/src/app/app-modules/scheduler/mystaff/profile/profile.component.ts +++ b/src/app/app-modules/scheduler/mystaff/profile/profile.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, OnChanges } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, OnInit, OnChanges, DoCheck } from '@angular/core'; import { SchedulerService } from '../../shared/services'; import { ActivatedRoute } from '@angular/router'; import { Location } from '@angular/common'; @@ -29,59 +29,59 @@ import { MatTabChangeEvent } from '@angular/material/tabs'; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', - styleUrls: ['./profile.component.css'] + styleUrls: ['./profile.component.css'], }) -export class ProfileComponent implements OnInit, OnChanges { - +export class ProfileComponent implements OnInit, OnChanges, DoCheck { specialistData: any; currentLanguageSet: any; languageComponent!: SetLanguageComponent; - constructor(private schedulerService: SchedulerService, + constructor( + private schedulerService: SchedulerService, private activatedRoute: ActivatedRoute, public httpServiceService: HttpServiceService, - private location: Location) { } + private location: Location, + ) {} ngOnInit() { this.initializeprofile(); this.fetchLanguageResponse(); } - initializeprofile(){ - let userID = this.activatedRoute.snapshot.params['userID']; + initializeprofile() { + const userID = this.activatedRoute.snapshot.params['userID']; this.getSpecialistData(userID); } ngOnChanges() { console.log('checkonchange'); - } checkOnClick() { console.log('checkonchangeclick'); } getSpecialistData(userID: any) { - this.schedulerService.getSpecialistByUserID(userID).subscribe((response: any) => { - if (response.statusCode == 200) { - this.specialistData = response.data; - console.log('Specialist Data..', this.specialistData); - } - }); + this.schedulerService + .getSpecialistByUserID(userID) + .subscribe((response: any) => { + if (response.statusCode == 200) { + this.specialistData = response.data; + console.log('Specialist Data..', this.specialistData); + } + }); } backToStaffPage() { this.location.back(); } - getChangedTab!:boolean; + getChangedTab!: boolean; public tabChanged(tabChangeEvent: MatTabChangeEvent): void { - console.log('changedtab',tabChangeEvent.index); - if(tabChangeEvent.index == 0) - this.getChangedTab = true - else - this.getChangedTab = false + console.log('changedtab', tabChangeEvent.index); + if (tabChangeEvent.index == 0) this.getChangedTab = true; + else this.getChangedTab = false; } - // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- + // AV40085804 27/09/2021 Integrating Multilingual Functionality -----Start----- ngDoCheck() { this.fetchLanguageResponse(); } diff --git a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.html b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.html index d29951e..926c6cb 100644 --- a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.html +++ b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.html @@ -1,24 +1,59 @@
-

{{currentLanguageSet?.chiefComplaintReport}}

+

{{ currentLanguageSet?.chiefComplaintReport }}

-
+
- - + +
-
- - - -
+
+ + + + +
- -
\ No newline at end of file + + diff --git a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.spec.ts b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.spec.ts index da65e65..4a5c901 100644 --- a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.spec.ts +++ b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChiefComplaintReportComponent } from './chief-complaint-report.component'; @@ -29,9 +29,8 @@ describe('ChiefComplaintReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ChiefComplaintReportComponent ] - }) - .compileComponents(); + declarations: [ChiefComplaintReportComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.ts b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.ts index 1015870..582cde8 100644 --- a/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.ts +++ b/src/app/app-modules/scheduler/reports/chief-complaint-report/chief-complaint-report.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { SchedulerService } from '../../shared/services/scheduler.service'; import { ConfirmationService } from '../../../core/services/confirmation.service'; @@ -30,19 +30,20 @@ import { HttpServiceService } from 'src/app/app-modules/core/services/http-servi @Component({ selector: 'app-chief-complaint-report', templateUrl: './chief-complaint-report.component.html', - styleUrls: ['./chief-complaint-report.component.css'] + styleUrls: ['./chief-complaint-report.component.css'], }) -export class ChiefComplaintReportComponent implements OnInit { - +export class ChiefComplaintReportComponent implements OnInit, DoCheck { chiefComplaintForm!: FormGroup; languageComponent!: SetLanguageComponent; currentLanguageSet: any; - constructor(private formBuilder: FormBuilder, + constructor( + private formBuilder: FormBuilder, public httpServiceService: HttpServiceService, private schedulerService: SchedulerService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} providerServiceMapID: any; userID: any; @@ -59,7 +60,7 @@ export class ChiefComplaintReportComponent implements OnInit { this.createChiefComplaintForm(); this.today = new Date(); - this.dateOffset = (24 * 60 * 60 * 1000); + this.dateOffset = 24 * 60 * 60 * 1000; this.maxEndDate = new Date(); this.maxEndDate.setDate(this.today.getDate() - 1); this.fetchLanguageResponse(); @@ -69,7 +70,7 @@ export class ChiefComplaintReportComponent implements OnInit { this.chiefComplaintForm = this.formBuilder.group({ startDate: null, endDate: null, - }) + }); } get startDate() { @@ -85,19 +86,19 @@ export class ChiefComplaintReportComponent implements OnInit { if (this.endDate == null) { this.minEndDate = new Date(this.startDate); - console.log("new Date(this.today.getDate() - 1);", new Date(this.today)); + console.log('new Date(this.today.getDate() - 1);', new Date(this.today)); } else { this.chiefComplaintForm.patchValue({ - endDate: null - }) - if(this.startDate !=undefined && this.startDate !=null) - this.minEndDate = new Date(this.startDate); + endDate: null, + }); + if (this.startDate != undefined && this.startDate != null) + this.minEndDate = new Date(this.startDate); } } searchReport() { - let startDate: Date = new Date(this.chiefComplaintForm.value.startDate); - let endDate: Date = new Date(this.chiefComplaintForm.value.endDate); + const startDate: Date = new Date(this.chiefComplaintForm.value.startDate); + const endDate: Date = new Date(this.chiefComplaintForm.value.endDate); startDate.setHours(0); startDate.setMinutes(0); @@ -109,29 +110,49 @@ export class ChiefComplaintReportComponent implements OnInit { endDate.setSeconds(59); endDate.setMilliseconds(0); - console.log("Data form value...", JSON.stringify(this.chiefComplaintForm.value)); - let reqObjForChiefCompalintReport = { - "fromDate": new Date(startDate.valueOf() - 1 * startDate.getTimezoneOffset() * 60 * 1000), - "toDate": new Date(endDate.valueOf() - 1 * endDate.getTimezoneOffset() * 60 * 1000), - "providerServiceMapID": this.providerServiceMapID, - "userID": this.userID - } - console.log("Data form data", JSON.stringify(reqObjForChiefCompalintReport, null, 4)); + console.log( + 'Data form value...', + JSON.stringify(this.chiefComplaintForm.value), + ); + const reqObjForChiefCompalintReport = { + fromDate: new Date( + startDate.valueOf() - 1 * startDate.getTimezoneOffset() * 60 * 1000, + ), + toDate: new Date( + endDate.valueOf() - 1 * endDate.getTimezoneOffset() * 60 * 1000, + ), + providerServiceMapID: this.providerServiceMapID, + userID: this.userID, + }; + console.log( + 'Data form data', + JSON.stringify(reqObjForChiefCompalintReport, null, 4), + ); - this.schedulerService.getChiefComplaintReports(reqObjForChiefCompalintReport).subscribe({next:(response: any) => { - console.log("Json data of response: ", JSON.stringify(response, null, 4)); - if (response.statusCode == 200) { - this.chiefComplaintRawData = response.data; - console.log('chiefComplaintRawData', JSON.stringify(this.chiefComplaintRawData, null, 4)); + this.schedulerService + .getChiefComplaintReports(reqObjForChiefCompalintReport) + .subscribe({ + next: (response: any) => { + console.log( + 'Json data of response: ', + JSON.stringify(response, null, 4), + ); + if (response.statusCode == 200) { + this.chiefComplaintRawData = response.data; + console.log( + 'chiefComplaintRawData', + JSON.stringify(this.chiefComplaintRawData, null, 4), + ); - this.getResponseOfSearchThenDo(); - } else { - this.confirmationService.alert(response.errorMessage, 'error'); - } - }, - error: (err: any) => { - this.confirmationService.alert(err, 'error'); - }}) + this.getResponseOfSearchThenDo(); + } else { + this.confirmationService.alert(response.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } downloadReport(downloadFlag: any) { @@ -141,118 +162,131 @@ export class ChiefComplaintReportComponent implements OnInit { } getResponseOfSearchThenDo() { - let criteria: any = []; - criteria.push({ 'Filter_Name': 'Start Date', 'value': this.startDate }); - criteria.push({ 'Filter_Name': 'End Date', 'value': this.endDate }); + const criteria: any = []; + criteria.push({ Filter_Name: 'Start Date', value: this.startDate }); + criteria.push({ Filter_Name: 'End Date', value: this.endDate }); this.exportToxlsx(criteria); } exportToxlsx(criteria: any) { if (this.chiefComplaintRawData.length > 0) { - let reports: any =[]; - let reportHeadings: any = []; - let reportSheet : any = {}; - let wb_name = "Chief Complaint Report"; - const criteria_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(criteria); + const reports: any = []; + const reportHeadings: any = []; + const reportSheet: any = {}; + const wb_name = 'Chief Complaint Report'; + const criteria_worksheet: XLSX.WorkSheet = + XLSX.utils.json_to_sheet(criteria); reportHeadings.push('Criteria'); reports.push(criteria_worksheet); reportSheet['Criteria'] = criteria_worksheet; - this.chiefComplaintRawData.forEach((obj : any)=> { + this.chiefComplaintRawData.forEach((obj: any) => { obj.chiefComplaintReport.forEach((checkForNull: any) => { - for (let key in checkForNull) { + for (const key in checkForNull) { if (checkForNull[key] == null) { - checkForNull[key] = ""; + checkForNull[key] = ''; } } }); - }) + }); for (const element of this.chiefComplaintRawData) { if (element.vanID) { - let headKey = this.chiefComplaintRawData[0].chiefComplaintReport[0]; - let head = Object.keys(headKey); + const headKey = this.chiefComplaintRawData[0].chiefComplaintReport[0]; + const head = Object.keys(headKey); console.log('headKey', headKey); - const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(element.chiefComplaintReport, { header: (head) }); + const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet( + element.chiefComplaintReport, + { header: head }, + ); // below code added to modify the headers - let i = 65; // starting from 65 since it is the ASCII code of 'A'. + let i = 65; // starting from 65 since it is the ASCII code of 'A'. let count = 0; - console.log("head", head); + console.log('head', head); while (i < head.length + 65) { let j; if (count > 0) { - j = i - (26 * count); - } - else { + j = i - 26 * count; + } else { j = i; } - let cellPosition = String.fromCharCode(j); + const cellPosition = String.fromCharCode(j); let finalCellName: any; if (count == 0) { - finalCellName = cellPosition + "1"; + finalCellName = cellPosition + '1'; console.log(finalCellName); - } - else { - let newcellPosition = String.fromCharCode(64 + count); - finalCellName = newcellPosition + cellPosition + "1"; + } else { + const newcellPosition = String.fromCharCode(64 + count); + finalCellName = newcellPosition + cellPosition + '1'; console.log(finalCellName); } - let newName = this.modifyHeader(head, i); - delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName; + const newName = this.modifyHeader(head, i); + delete report_worksheet[finalCellName].w; + report_worksheet[finalCellName].v = newName; i++; - if (i == 91 + (count * 26)) { + if (i == 91 + count * 26) { count++; } } // --------end-------- - let heading = element.vanName; + const heading = element.vanName; reportHeadings.push(heading); reports.push(report_worksheet); - reportSheet[heading] = report_worksheet + reportSheet[heading] = report_worksheet; } - } const workbook: XLSX.WorkBook = { Sheets: reportSheet, - SheetNames: reportHeadings + SheetNames: reportHeadings, }; - const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: "array" }); - let blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); + const excelBuffer: any = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + }); if ((navigator as any).msSaveBlob) { (navigator as any).msSaveBlob(blob, wb_name); - } - else { - let link = document.createElement("a"); + } else { + const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.setAttribute('visibility', 'hidden'); - link.download = wb_name.replace(/ /g, "_") + ".xlsx"; + link.download = wb_name.replace(/ /g, '_') + '.xlsx'; document.body.appendChild(link); link.click(); document.body.removeChild(link); } - this.confirmationService.alert(this.currentLanguageSet.chiefComplaintreportdownloaded, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.chiefComplaintreportdownloaded, + 'success', + ); } else { this.confirmationService.alert(this.currentLanguageSet.norecordfound); } } modifyHeader(headers: any, i: any) { let modifiedHeader: string; - modifiedHeader = headers[i - 65].toString().replace(/([A-Z])/g, ' $1').trim(); - modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); - return modifiedHeader.replace(/I D/g, "ID"); + modifiedHeader = headers[i - 65] + .toString() + .replace(/([A-Z])/g, ' $1') + .trim(); + modifiedHeader = + modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); + return modifiedHeader.replace(/I D/g, 'ID'); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.html b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.html index e2baad7..25c4939 100644 --- a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.html +++ b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.html @@ -1,24 +1,62 @@
-

{{currentLanguageSet?.consultationReport}}

+

{{ currentLanguageSet?.consultationReport }}

-
+
- - + +
-
- - -
+
+ + + +
- -
\ No newline at end of file + + diff --git a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.spec.ts b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.spec.ts index a90b2cc..039dbf7 100644 --- a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.spec.ts +++ b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ConsultationReportComponent } from './consultation-report.component'; @@ -29,9 +29,8 @@ describe('ConsultationReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ConsultationReportComponent ] - }) - .compileComponents(); + declarations: [ConsultationReportComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.ts b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.ts index 85edc3a..7ebd139 100644 --- a/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.ts +++ b/src/app/app-modules/scheduler/reports/consultation-report/consultation-report.component.ts @@ -1,26 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; - + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { SchedulerService } from '../../shared/services/scheduler.service'; import { ConfirmationService } from '../../../core/services/confirmation.service'; @@ -32,20 +31,20 @@ import { FormBuilder, FormGroup } from '@angular/forms'; @Component({ selector: 'app-consultation-report', templateUrl: './consultation-report.component.html', - styleUrls: ['./consultation-report.component.css'] + styleUrls: ['./consultation-report.component.css'], }) -export class ConsultationReportComponent implements OnInit { - +export class ConsultationReportComponent implements OnInit, DoCheck { consultationForm!: FormGroup; languageComponent!: SetLanguageComponent; currentLanguageSet: any; - + constructor( private formBuilder: FormBuilder, public httpServiceService: HttpServiceService, private schedulerService: SchedulerService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} providerServiceMapID: any; userID: any; @@ -63,13 +62,12 @@ export class ConsultationReportComponent implements OnInit { this.maxEndDate = new Date(); this.today = new Date(); this.maxEndDate.setDate(this.today.getDate() - 1); - } createConsultationForm() { this.consultationForm = this.formBuilder.group({ fromDate: null, toDate: null, - }) + }); } get fromDate() { return this.consultationForm.controls['fromDate'].value; @@ -84,10 +82,10 @@ export class ConsultationReportComponent implements OnInit { this.minEndDate = new Date(this.fromDate); } else { this.consultationForm.patchValue({ - toDate: null - }) - if(this.fromDate !=undefined && this.fromDate !=null) - this.minEndDate = new Date(this.fromDate); + toDate: null, + }); + if (this.fromDate != undefined && this.fromDate != null) + this.minEndDate = new Date(this.fromDate); } } downloadReport(downloadFlag: boolean) { @@ -97,8 +95,8 @@ export class ConsultationReportComponent implements OnInit { } setDate() { - let fromDate: Date = new Date(this.consultationForm.value.fromDate); - let toDate: Date = new Date(this.consultationForm.value.toDate); + const fromDate: Date = new Date(this.consultationForm.value.fromDate); + const toDate: Date = new Date(this.consultationForm.value.toDate); fromDate.setHours(0); fromDate.setMinutes(0); @@ -113,56 +111,74 @@ export class ConsultationReportComponent implements OnInit { } searchReport(fromDate: any, toDate: any) { - let reqObjForConsultantReport = { - "fromDate": new Date(fromDate.valueOf() - 1 * fromDate.getTimezoneOffset() * 60 * 1000), - "toDate": new Date(toDate.valueOf() - 1 * toDate.getTimezoneOffset() * 60 * 1000), - "providerServiceMapID": this.providerServiceMapID, - "userID": this.userID - } - this.schedulerService.getConsultantReport(reqObjForConsultantReport).subscribe({next:(response: any) => { - console.log("Json data of response: ", JSON.stringify(response, null, 4)); - if (response.statusCode == 200) { - this.consultationReportList = response.data; - this.createSearchCriteria(); - } else { - this.confirmationService.alert(response.errorMessage, 'error'); - } - }, - error: (err: any) => { - this.confirmationService.alert(err, 'error'); - }}) + const reqObjForConsultantReport = { + fromDate: new Date( + fromDate.valueOf() - 1 * fromDate.getTimezoneOffset() * 60 * 1000, + ), + toDate: new Date( + toDate.valueOf() - 1 * toDate.getTimezoneOffset() * 60 * 1000, + ), + providerServiceMapID: this.providerServiceMapID, + userID: this.userID, + }; + this.schedulerService + .getConsultantReport(reqObjForConsultantReport) + .subscribe({ + next: (response: any) => { + console.log( + 'Json data of response: ', + JSON.stringify(response, null, 4), + ); + if (response.statusCode == 200) { + this.consultationReportList = response.data; + this.createSearchCriteria(); + } else { + this.confirmationService.alert(response.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } createSearchCriteria() { - let criteria: any = []; - criteria.push({ 'Filter_Name': 'From date', 'value': this.fromDate }); - criteria.push({ 'Filter_Name': 'To date', 'value': this.toDate }); + const criteria: any = []; + criteria.push({ Filter_Name: 'From date', value: this.fromDate }); + criteria.push({ Filter_Name: 'To date', value: this.toDate }); this.exportToxlsx(criteria); } exportToxlsx(criteria: any) { if (this.consultationReportList.length > 0) { - let array = this.checkDataForNull(); + const array = this.checkDataForNull(); if (array.length != 0) { - let head = Object.keys(array[0]); - let wb_name = "Consultation Report"; - const criteria_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(criteria); - const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(this.consultationReportList, { header: (head) }); + const head = Object.keys(array[0]); + const wb_name = 'Consultation Report'; + const criteria_worksheet: XLSX.WorkSheet = + XLSX.utils.json_to_sheet(criteria); + const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet( + this.consultationReportList, + { header: head }, + ); - let data = this.assignDataToColumns(head, report_worksheet) - this.createWorkBook(data, wb_name, criteria_worksheet) + const data = this.assignDataToColumns(head, report_worksheet); + this.createWorkBook(data, wb_name, criteria_worksheet); } - this.confirmationService.alert(this.currentLanguageSet.consultationReportdownloaded, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.consultationReportdownloaded, + 'success', + ); } else { this.confirmationService.alert(this.currentLanguageSet.norecordfound); } } checkDataForNull() { - let array = this.consultationReportList.filter(function (obj: any) { - for (let key in obj) { + const array = this.consultationReportList.filter(function (obj: any) { + for (const key in obj) { if (obj[key] === null) { - obj[key] = ""; + obj[key] = ''; } } return obj; @@ -171,32 +187,30 @@ export class ConsultationReportComponent implements OnInit { } assignDataToColumns(head: any, report_worksheet: any) { - - let i = 65; // starting from 65 since it is the ASCII code of 'A'. + let i = 65; // starting from 65 since it is the ASCII code of 'A'. let count = 0; while (i < head.length + 65) { let j; if (count > 0) { - j = i - (26 * count); - } - else { + j = i - 26 * count; + } else { j = i; } - let cellPosition = String.fromCharCode(j); + const cellPosition = String.fromCharCode(j); let finalCellName: any; if (count == 0) { - finalCellName = cellPosition + "1"; + finalCellName = cellPosition + '1'; console.log(finalCellName); - } - else { - let newcellPosition = String.fromCharCode(64 + count); - finalCellName = newcellPosition + cellPosition + "1"; + } else { + const newcellPosition = String.fromCharCode(64 + count); + finalCellName = newcellPosition + cellPosition + '1'; console.log(finalCellName); } - let newName = this.modifyHeader(head, i); - delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName; + const newName = this.modifyHeader(head, i); + delete report_worksheet[finalCellName].w; + report_worksheet[finalCellName].v = newName; i++; - if (i == 91 + (count * 26)) { + if (i == 91 + count * 26) { count++; } } @@ -204,18 +218,24 @@ export class ConsultationReportComponent implements OnInit { } createWorkBook(data: any, wb_name: any, criteria_worksheet: any) { - - const workbook: XLSX.WorkBook = { Sheets: { 'Report': data, 'Criteria': criteria_worksheet }, SheetNames: ['Criteria', 'Report'] }; - const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: "array" }); - let blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); + const workbook: XLSX.WorkBook = { + Sheets: { Report: data, Criteria: criteria_worksheet }, + SheetNames: ['Criteria', 'Report'], + }; + const excelBuffer: any = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + }); if ((navigator as any).msSaveBlob) { (navigator as any).msSaveBlob(blob, wb_name); - } - else { - let link = document.createElement("a"); + } else { + const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.setAttribute('visibility', 'hidden'); - link.download = wb_name.replace(/ /g, "_") + ".xlsx"; + link.download = wb_name.replace(/ /g, '_') + '.xlsx'; document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -224,20 +244,24 @@ export class ConsultationReportComponent implements OnInit { modifyHeader(headers: any, i: any) { let modifiedHeader: string; - modifiedHeader = headers[i - 65].toString().replace(/([A-Z])/g, ' $1').trim(); - modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); - return modifiedHeader.replace(/I D/g, "ID"); + modifiedHeader = headers[i - 65] + .toString() + .replace(/([A-Z])/g, ' $1') + .trim(); + modifiedHeader = + modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); + return modifiedHeader.replace(/I D/g, 'ID'); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.html b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.html index 7a48618..7213f0f 100644 --- a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.html +++ b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.html @@ -1,18 +1,40 @@
-

{{currentLanguageSet?.dailyReport}}

-
- -
-
-
- - - -
- -
- -
- -
\ No newline at end of file +

{{ currentLanguageSet?.dailyReport }}

+ + +
+
+
+ + + +
+ +
+ +
+ +
diff --git a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.spec.ts b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.spec.ts index a4d6373..2a1fc64 100644 --- a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.spec.ts +++ b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DailyReportComponent } from './daily-report.component'; @@ -29,9 +29,8 @@ describe('DailyReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ DailyReportComponent ] - }) - .compileComponents(); + declarations: [DailyReportComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.ts b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.ts index 959cb0b..91fefac 100644 --- a/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.ts +++ b/src/app/app-modules/scheduler/reports/daily-report/daily-report.component.ts @@ -1,50 +1,49 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; import { SchedulerService } from '../../shared/services/scheduler.service'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import * as XLSX from 'xlsx'; import { SetLanguageComponent } from '../../../core/components/set-language.component'; import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; - @Component({ selector: 'app-daily-report', templateUrl: './daily-report.component.html', - styleUrls: ['./daily-report.component.css'] + styleUrls: ['./daily-report.component.css'], }) -export class DailyReportComponent implements OnInit { - +export class DailyReportComponent implements OnInit, DoCheck { dailyReportForm!: FormGroup; languageComponent!: SetLanguageComponent; currentLanguageSet: any; - + constructor( private formBuilder: FormBuilder, private schedulerService: SchedulerService, public httpServiceService: HttpServiceService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} providerServiceMapID: any; userID: any; @@ -61,12 +60,11 @@ export class DailyReportComponent implements OnInit { this.maxEndDate = new Date(); this.today = new Date(); this.maxEndDate.setDate(this.today.getDate() - 1); - } createDailyReportForm() { this.dailyReportForm = this.formBuilder.group({ fromDate: null, - }) + }); } get fromDate() { return this.dailyReportForm.controls['fromDate'].value; @@ -79,7 +77,7 @@ export class DailyReportComponent implements OnInit { } setDate() { - let fromDate: Date = new Date(this.dailyReportForm.value.fromDate); + const fromDate: Date = new Date(this.dailyReportForm.value.fromDate); fromDate.setHours(0); fromDate.setMinutes(0); @@ -90,53 +88,67 @@ export class DailyReportComponent implements OnInit { } searchReport(fromDate: any) { - let reqObjForDailyReport = { - "fromDate": new Date(fromDate.valueOf() - 1 * fromDate.getTimezoneOffset() * 60 * 1000), - "providerServiceMapID": this.providerServiceMapID, - "userID": this.userID - } - this.schedulerService.getDailyReport(reqObjForDailyReport).subscribe({next:(response: any) => { - console.log("Json data of response: ", JSON.stringify(response, null, 4)); - if (response.statusCode == 200) { - this.dailyReportList = response.data; - this.createSearchCriteria(); - } else { - this.confirmationService.alert(response.errorMessage, 'error'); - } - }, - error:(err: any) => { - this.confirmationService.alert(err, 'error'); - }}) + const reqObjForDailyReport = { + fromDate: new Date( + fromDate.valueOf() - 1 * fromDate.getTimezoneOffset() * 60 * 1000, + ), + providerServiceMapID: this.providerServiceMapID, + userID: this.userID, + }; + this.schedulerService.getDailyReport(reqObjForDailyReport).subscribe({ + next: (response: any) => { + console.log( + 'Json data of response: ', + JSON.stringify(response, null, 4), + ); + if (response.statusCode == 200) { + this.dailyReportList = response.data; + this.createSearchCriteria(); + } else { + this.confirmationService.alert(response.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } createSearchCriteria() { - let criteria: any = []; - criteria.push({ 'Filter_Name': 'Date', 'value': this.fromDate }); + const criteria: any = []; + criteria.push({ Filter_Name: 'Date', value: this.fromDate }); this.exportToxlsx(criteria); } exportToxlsx(criteria: any) { if (this.dailyReportList.length > 0) { - let array = this.checkDataForNull(); + const array = this.checkDataForNull(); if (array.length != 0) { - let head = Object.keys(array[0]); - let wb_name = "Daily Report"; - const criteria_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(criteria); - const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(this.dailyReportList, { header: (head) }); - - let data = this.assignDataToColumns(head, report_worksheet) - this.createWorkBook(data, wb_name, criteria_worksheet) + const head = Object.keys(array[0]); + const wb_name = 'Daily Report'; + const criteria_worksheet: XLSX.WorkSheet = + XLSX.utils.json_to_sheet(criteria); + const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet( + this.dailyReportList, + { header: head }, + ); + + const data = this.assignDataToColumns(head, report_worksheet); + this.createWorkBook(data, wb_name, criteria_worksheet); } - this.confirmationService.alert(this.currentLanguageSet.dailyReportdownloaded, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.dailyReportdownloaded, + 'success', + ); } else { this.confirmationService.alert(this.currentLanguageSet.norecordfound); } } checkDataForNull() { - let array = this.dailyReportList.filter(function (obj: any) { - for (let key in obj) { + const array = this.dailyReportList.filter(function (obj: any) { + for (const key in obj) { if (obj[key] == null) { - obj[key] = ""; + obj[key] = ''; } } return obj; @@ -144,50 +156,54 @@ export class DailyReportComponent implements OnInit { return array; } assignDataToColumns(head: any, report_worksheet: any) { - - let i = 65; // starting from 65 since it is the ASCII code of 'A'. + let i = 65; // starting from 65 since it is the ASCII code of 'A'. let count = 0; while (i < head.length + 65) { let j; if (count > 0) { - j = i - (26 * count); - } - else { + j = i - 26 * count; + } else { j = i; } - let cellPosition = String.fromCharCode(j); + const cellPosition = String.fromCharCode(j); let finalCellName: any; if (count == 0) { - finalCellName = cellPosition + "1"; + finalCellName = cellPosition + '1'; console.log(finalCellName); - } - else { - let newcellPosition = String.fromCharCode(64 + count); - finalCellName = newcellPosition + cellPosition + "1"; + } else { + const newcellPosition = String.fromCharCode(64 + count); + finalCellName = newcellPosition + cellPosition + '1'; console.log(finalCellName); } - let newName = this.modifyHeader(head, i); - delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName; + const newName = this.modifyHeader(head, i); + delete report_worksheet[finalCellName].w; + report_worksheet[finalCellName].v = newName; i++; - if (i == 91 + (count * 26)) { + if (i == 91 + count * 26) { count++; } } return report_worksheet; } createWorkBook(data: any, wb_name: any, criteria_worksheet: any) { - - const workbook: XLSX.WorkBook = { Sheets: { 'Report': data, 'Criteria': criteria_worksheet }, SheetNames: ['Criteria', 'Report'] }; - const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: "array" }); - let blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); + const workbook: XLSX.WorkBook = { + Sheets: { Report: data, Criteria: criteria_worksheet }, + SheetNames: ['Criteria', 'Report'], + }; + const excelBuffer: any = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + }); if ((navigator as any).msSaveBlob) { (navigator as any).msSaveBlob(blob, wb_name); - } - else { - let link = document.createElement("a"); + } else { + const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.setAttribute('visibility', 'hidden'); - link.download = wb_name.replace(/ /g, "_") + ".xlsx"; + link.download = wb_name.replace(/ /g, '_') + '.xlsx'; document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -196,20 +212,24 @@ export class DailyReportComponent implements OnInit { modifyHeader(headers: any, i: any) { let modifiedHeader: string; - modifiedHeader = headers[i - 65].toString().replace(/([A-Z])/g, ' $1').trim(); - modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); - return modifiedHeader.replace(/I D/g, "ID"); + modifiedHeader = headers[i - 65] + .toString() + .replace(/([A-Z])/g, ' $1') + .trim(); + modifiedHeader = + modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.slice(1); + return modifiedHeader.replace(/I D/g, 'ID'); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.html b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.html index 6810729..61b2fc2 100644 --- a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.html +++ b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.html @@ -1,26 +1,57 @@
-

{{currentLanguageSet?.monthlyReport}}

+

{{ currentLanguageSet?.monthlyReport }}

- - + +
- - -
+ + + +
{{ van.vehicalNo }}{{currentLanguageSet?.monthlyReport}} [disabled]="!monthlyReportForm.valid" (click)="downloadReport(true)" > - {{currentLanguageSet?.download}} + {{ currentLanguageSet?.download }}
diff --git a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.spec.ts b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.spec.ts index ceea9b5..1d83067 100644 --- a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.spec.ts +++ b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MonthlyReportComponent } from './monthly-report.component'; @@ -29,9 +29,8 @@ describe('MonthlyReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ MonthlyReportComponent ] - }) - .compileComponents(); + declarations: [MonthlyReportComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.ts b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.ts index 8b85b90..c479ea6 100644 --- a/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.ts +++ b/src/app/app-modules/scheduler/reports/monthly-report/monthly-report.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { SchedulerService } from '../../shared/services/scheduler.service'; import { ConfirmationService } from '../../../core/services/confirmation.service'; @@ -28,33 +28,31 @@ import * as moment from 'moment'; import { SetLanguageComponent } from '../../../core/components/set-language.component'; import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; - - @Component({ selector: 'app-monthly-report', templateUrl: './monthly-report.component.html', - styleUrls: ['./monthly-report.component.css'] + styleUrls: ['./monthly-report.component.css'], }) -export class MonthlyReportComponent implements OnInit { - +export class MonthlyReportComponent implements OnInit, DoCheck { monthlyReportForm!: FormGroup; reportForm: any; languageComponent!: SetLanguageComponent; currentLanguageSet: any; - - constructor( + + constructor( private formBuilder: FormBuilder, private schedulerService: SchedulerService, public httpServiceService: HttpServiceService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} - providerServiceMapID: any; - userID: any; - monthlyReportList = []; - today!: Date; - minEndDate!: Date; - maxEndDate!: Date; + providerServiceMapID: any; + userID: any; + monthlyReportList = []; + today!: Date; + minEndDate!: Date; + maxEndDate!: Date; ngOnInit() { this.providerServiceMapID = localStorage.getItem('tm-providerServiceMapID'); @@ -67,35 +65,36 @@ export class MonthlyReportComponent implements OnInit { this.maxEndDate = new Date(); this.today = new Date(); this.maxEndDate.setDate(this.today.getDate() - 1); - } vanMaster: any[] = []; - getServicePoint(){ - - this.schedulerService.getVanMaster(this.providerServiceMapID).subscribe({next:(res: any) => { - console.log(res); - - if (res && res.statusCode == 200) { - if (res.data && res.data.length > 0) { - this.vanMaster = res.data + getServicePoint() { + this.schedulerService.getVanMaster(this.providerServiceMapID).subscribe({ + next: (res: any) => { + console.log(res); + + if (res && res.statusCode == 200) { + if (res.data && res.data.length > 0) { + this.vanMaster = res.data; + } else { + this.confirmationService.alert( + this.currentLanguageSet.noVansweremappedforthisprovider, + ); + } } else { - this.confirmationService.alert(this.currentLanguageSet.noVansweremappedforthisprovider); + this.confirmationService.alert(res.errorMessage, 'error'); } - } else { - this.confirmationService.alert(res.errorMessage, 'error'); - } - - }, - error: (err: any) => { - this.confirmationService.alert(err, 'error'); - }}) + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } createMonthlyReportForm() { this.monthlyReportForm = this.formBuilder.group({ fromDate: null, toDate: null, - van : null, - }) + van: null, + }); } get fromDate() { return this.monthlyReportForm.controls['fromDate'].value; @@ -110,11 +109,11 @@ export class MonthlyReportComponent implements OnInit { this.minEndDate = new Date(this.fromDate); } else { this.monthlyReportForm.patchValue({ - toDate: null - }) + toDate: null, + }); //( this.monthlyReportForm.controls['toDate']).patchValue({ toDate: null }); - if(this.fromDate !=undefined && this.fromDate !=null) - this.minEndDate = new Date(this.fromDate); + if (this.fromDate != undefined && this.fromDate != null) + this.minEndDate = new Date(this.fromDate); } } @@ -127,50 +126,68 @@ export class MonthlyReportComponent implements OnInit { return this.monthlyReportForm.controls['van'].value; } searchReport() { - let reqObjForMonthlyReport = { - "providerServiceMapID": this.providerServiceMapID, - "userID": this.userID, - "fromDate": moment(this.fromDate).format("YYYY-MM-DD"), - "toDate": moment(this.toDate).format("YYYY-MM-DD"), - "vanID" : this.van.vanID - } + const reqObjForMonthlyReport = { + providerServiceMapID: this.providerServiceMapID, + userID: this.userID, + fromDate: moment(this.fromDate).format('YYYY-MM-DD'), + toDate: moment(this.toDate).format('YYYY-MM-DD'), + vanID: this.van.vanID, + }; console.log(reqObjForMonthlyReport); - - this.schedulerService.getMonthlyReports(reqObjForMonthlyReport).subscribe((response: any) => { - console.log("Json data of response: ", JSON.stringify(response, null, 2)); - if (response.statusCode == 200) { - this.monthlyReportList = response.data; - this.createSearchCriteria(); - } - }) + + this.schedulerService + .getMonthlyReports(reqObjForMonthlyReport) + .subscribe((response: any) => { + console.log( + 'Json data of response: ', + JSON.stringify(response, null, 2), + ); + if (response.statusCode == 200) { + this.monthlyReportList = response.data; + this.createSearchCriteria(); + } + }); } createSearchCriteria() { - let criteria: any = []; - criteria.push({ 'Filter_Name': 'From Month', 'value': moment(this.fromDate).format("MMM-YY") }); - criteria.push({ 'Filter_Name': 'To Month', 'value': moment(this.toDate).format("MMM-YY") }); + const criteria: any = []; + criteria.push({ + Filter_Name: 'From Month', + value: moment(this.fromDate).format('MMM-YY'), + }); + criteria.push({ + Filter_Name: 'To Month', + value: moment(this.toDate).format('MMM-YY'), + }); this.exportToxlsx(criteria); } exportToxlsx(criteria: any) { if (this.monthlyReportList.length > 0) { - let array = this.checkDataForNull(); + const array = this.checkDataForNull(); if (array.length != 0) { - let head = Object.keys(array[0]); - let wb_name = "Monthly Report"; - const criteria_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(criteria); - const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(this.monthlyReportList, { header: (head) }); - let data = this.assignDataToColumns(head, report_worksheet) - this.createWorkBook(data, wb_name, criteria_worksheet) + const head = Object.keys(array[0]); + const wb_name = 'Monthly Report'; + const criteria_worksheet: XLSX.WorkSheet = + XLSX.utils.json_to_sheet(criteria); + const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet( + this.monthlyReportList, + { header: head }, + ); + const data = this.assignDataToColumns(head, report_worksheet); + this.createWorkBook(data, wb_name, criteria_worksheet); } - this.confirmationService.alert(this.currentLanguageSet.monthlyReportdownloaded, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.monthlyReportdownloaded, + 'success', + ); } else { this.confirmationService.alert(this.currentLanguageSet.norecordfound); } } checkDataForNull() { - let array = this.monthlyReportList.filter(function (obj: any) { - for (let key in obj) { + const array = this.monthlyReportList.filter(function (obj: any) { + for (const key in obj) { if (obj[key] == null) { - obj[key] = ""; + obj[key] = ''; } } return obj; @@ -178,71 +195,79 @@ export class MonthlyReportComponent implements OnInit { return array; } assignDataToColumns(head: any, report_worksheet: any) { - - let i = 65; // starting from 65 since it is the ASCII code of 'A'. + let i = 65; // starting from 65 since it is the ASCII code of 'A'. let count = 0; while (i < head.length + 65) { let j; if (count > 0) { - j = i - (26 * count); - } - else { + j = i - 26 * count; + } else { j = i; } - let cellPosition = String.fromCharCode(j); + const cellPosition = String.fromCharCode(j); let finalCellName: any; if (count == 0) { - finalCellName = cellPosition + "1"; + finalCellName = cellPosition + '1'; console.log(finalCellName); - } - else { - let newcellPosition = String.fromCharCode(64 + count); - finalCellName = newcellPosition + cellPosition + "1"; + } else { + const newcellPosition = String.fromCharCode(64 + count); + finalCellName = newcellPosition + cellPosition + '1'; console.log(finalCellName); } - let newName = this.modifyHeader(head, i); - delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName; + const newName = this.modifyHeader(head, i); + delete report_worksheet[finalCellName].w; + report_worksheet[finalCellName].v = newName; i++; - if (i == 91 + (count * 26)) { + if (i == 91 + count * 26) { count++; } } return report_worksheet; } createWorkBook(data: any, wb_name: any, criteria_worksheet: any) { - - const workbook: XLSX.WorkBook = { Sheets: { 'Report': data, 'Criteria': criteria_worksheet }, SheetNames: ['Criteria', 'Report'] }; - const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: "array" }); - let blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); + const workbook: XLSX.WorkBook = { + Sheets: { Report: data, Criteria: criteria_worksheet }, + SheetNames: ['Criteria', 'Report'], + }; + const excelBuffer: any = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + }); if ((navigator as any).msSaveBlob) { (navigator as any).msSaveBlob(blob, wb_name); - } - else { - let link = document.createElement("a"); + } else { + const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.setAttribute('visibility', 'hidden'); - link.download = wb_name.replace(/ /g, "_") + ".xlsx"; + link.download = wb_name.replace(/ /g, '_') + '.xlsx'; document.body.appendChild(link); link.click(); document.body.removeChild(link); } } - modifyHeader(headers: any, i:any) { + modifyHeader(headers: any, i: any) { let modifiedHeader: string; - modifiedHeader = headers[i - 65].toString().replace(/([A-Z])/g, ' $1').trim(); - modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substring(1); - return modifiedHeader.replace(/I D/g, "ID"); + modifiedHeader = headers[i - 65] + .toString() + .replace(/([A-Z])/g, ' $1') + .trim(); + modifiedHeader = + modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substring(1); + return modifiedHeader.replace(/I D/g, 'ID'); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.html b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.html index 8ec7f69..522267c 100644 --- a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.html +++ b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.html @@ -1,27 +1,62 @@
-

{{currentLanguageSet?.totalConsultationReport}}

+

{{ currentLanguageSet?.totalConsultationReport }}

- - +
- - - + + +
- - - + + +
-
- -
\ No newline at end of file + + diff --git a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.spec.ts b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.spec.ts index bd6e0f8..d53d81b 100644 --- a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.spec.ts +++ b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TotalConsultationReportComponent } from './total-consultation-report.component'; @@ -29,9 +29,8 @@ describe('TotalConsultationReportComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ TotalConsultationReportComponent ] - }) - .compileComponents(); + declarations: [TotalConsultationReportComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.ts b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.ts index eb39a41..89fa340 100644 --- a/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.ts +++ b/src/app/app-modules/scheduler/reports/total-consultation-report/total-consultation-report.component.ts @@ -1,26 +1,26 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; import { SchedulerService } from '../../shared/services/scheduler.service'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import * as XLSX from 'xlsx'; @@ -28,26 +28,23 @@ import * as moment from 'moment'; import { SetLanguageComponent } from '../../../core/components/set-language.component'; import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; - - - @Component({ selector: 'app-total-consultation-report', templateUrl: './total-consultation-report.component.html', - styleUrls: ['./total-consultation-report.component.css'] + styleUrls: ['./total-consultation-report.component.css'], }) -export class TotalConsultationReportComponent implements OnInit { - +export class TotalConsultationReportComponent implements OnInit, DoCheck { totalConsultationForm!: FormGroup; - languageComponent!: SetLanguageComponent; + languageComponent!: SetLanguageComponent; currentLanguageSet: any; - + constructor( private formBuilder: FormBuilder, private schedulerService: SchedulerService, public httpServiceService: HttpServiceService, - private confirmationService: ConfirmationService) { } + private confirmationService: ConfirmationService, + ) {} providerServiceMapID: any; userID: any; @@ -66,13 +63,12 @@ export class TotalConsultationReportComponent implements OnInit { this.maxEndDate = new Date(); this.today = new Date(); this.maxEndDate.setDate(this.today.getDate() - 1); - } createTotalConsultationForm() { this.totalConsultationForm = this.formBuilder.group({ fromDate: null, toDate: null, - }) + }); } get fromDate() { return this.totalConsultationForm.controls['fromDate'].value; @@ -87,10 +83,10 @@ export class TotalConsultationReportComponent implements OnInit { this.minEndDate = new Date(this.fromDate); } else { this.totalConsultationForm.patchValue({ - toDate: null + toDate: null, }); - if(this.fromDate !=undefined && this.fromDate !=null) - this.minEndDate = new Date(this.fromDate); + if (this.fromDate != undefined && this.fromDate != null) + this.minEndDate = new Date(this.fromDate); } } @@ -101,56 +97,78 @@ export class TotalConsultationReportComponent implements OnInit { } searchReport() { - let reqObjForTotalConsultationReport = { - "providerServiceMapID": this.providerServiceMapID, - "userID": this.userID, - "fromDate": moment(this.fromDate).format("YYYY-MM-DD"), - "toDate": moment(this.toDate).format("YYYY-MM-DD") - } - console.log("reqObjForTotalConsultationReport", JSON.stringify(reqObjForTotalConsultationReport, null, 4)); + const reqObjForTotalConsultationReport = { + providerServiceMapID: this.providerServiceMapID, + userID: this.userID, + fromDate: moment(this.fromDate).format('YYYY-MM-DD'), + toDate: moment(this.toDate).format('YYYY-MM-DD'), + }; + console.log( + 'reqObjForTotalConsultationReport', + JSON.stringify(reqObjForTotalConsultationReport, null, 4), + ); - this.schedulerService.getTotalConsultationReports(reqObjForTotalConsultationReport).subscribe({next:(response: any) => { - console.log("Json data of response: ", JSON.stringify(response, null, 4)); - if (response.statusCode == 200) { - this.totalConsultationList = response.data; - this.createSearchCriteria(); - } - else { - this.confirmationService.alert(response.errorMessage, 'error'); - } - }, - error:(err: any) => { - this.confirmationService.alert(err, 'error'); - }}) + this.schedulerService + .getTotalConsultationReports(reqObjForTotalConsultationReport) + .subscribe({ + next: (response: any) => { + console.log( + 'Json data of response: ', + JSON.stringify(response, null, 4), + ); + if (response.statusCode == 200) { + this.totalConsultationList = response.data; + this.createSearchCriteria(); + } else { + this.confirmationService.alert(response.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } createSearchCriteria() { - let criteria: any = []; - criteria.push({ 'Filter_Name': 'From Month', 'value': moment(this.fromDate).format("MMM-YY") }); - criteria.push({ 'Filter_Name': 'To Month', 'value': moment(this.toDate).format("MMM-YY") }); + const criteria: any = []; + criteria.push({ + Filter_Name: 'From Month', + value: moment(this.fromDate).format('MMM-YY'), + }); + criteria.push({ + Filter_Name: 'To Month', + value: moment(this.toDate).format('MMM-YY'), + }); this.exportToxlsx(criteria); } exportToxlsx(criteria: any) { if (this.totalConsultationList.length > 0) { - let array = this.checkDataForNull(); + const array = this.checkDataForNull(); if (array.length != 0) { - let head = Object.keys(array[0]); - let wb_name = "Total Consultation Report"; - const criteria_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(criteria); - const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(this.totalConsultationList, { header: (head) }); - let data = this.assignDataToColumns(head, report_worksheet) - this.createWorkBook(data, wb_name, criteria_worksheet) + const head = Object.keys(array[0]); + const wb_name = 'Total Consultation Report'; + const criteria_worksheet: XLSX.WorkSheet = + XLSX.utils.json_to_sheet(criteria); + const report_worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet( + this.totalConsultationList, + { header: head }, + ); + const data = this.assignDataToColumns(head, report_worksheet); + this.createWorkBook(data, wb_name, criteria_worksheet); } - this.confirmationService.alert(this.currentLanguageSet.totalConsultationReportDownloaded, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.totalConsultationReportDownloaded, + 'success', + ); } else { this.confirmationService.alert(this.currentLanguageSet.norecordfound); } } checkDataForNull() { - let array = this.totalConsultationList.filter(function (obj: any) { - for (let key in obj) { + const array = this.totalConsultationList.filter(function (obj: any) { + for (const key in obj) { if (obj[key] == null) { - obj[key] = ""; + obj[key] = ''; } } return obj; @@ -158,52 +176,56 @@ export class TotalConsultationReportComponent implements OnInit { return array; } - assignDataToColumns(head: any, report_worksheet:any) { - - let i = 65; // starting from 65 since it is the ASCII code of 'A'. + assignDataToColumns(head: any, report_worksheet: any) { + let i = 65; // starting from 65 since it is the ASCII code of 'A'. let count = 0; while (i < head.length + 65) { let j; if (count > 0) { - j = i - (26 * count); - } - else { + j = i - 26 * count; + } else { j = i; } - let cellPosition = String.fromCharCode(j); + const cellPosition = String.fromCharCode(j); let finalCellName: any; if (count == 0) { - finalCellName = cellPosition + "1"; + finalCellName = cellPosition + '1'; console.log(finalCellName); - } - else { - let newcellPosition = String.fromCharCode(64 + count); - finalCellName = newcellPosition + cellPosition + "1"; + } else { + const newcellPosition = String.fromCharCode(64 + count); + finalCellName = newcellPosition + cellPosition + '1'; console.log(finalCellName); } - let newName = this.modifyHeader(head, i); - delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName; + const newName = this.modifyHeader(head, i); + delete report_worksheet[finalCellName].w; + report_worksheet[finalCellName].v = newName; i++; - if (i == 91 + (count * 26)) { + if (i == 91 + count * 26) { count++; } } return report_worksheet; } - createWorkBook(data: any, wb_name: any, criteria_worksheet:any) { - - const workbook: XLSX.WorkBook = { Sheets: { 'Report': data, 'Criteria': criteria_worksheet }, SheetNames: ['Criteria', 'Report'] }; - const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: "array" }); - let blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); + createWorkBook(data: any, wb_name: any, criteria_worksheet: any) { + const workbook: XLSX.WorkBook = { + Sheets: { Report: data, Criteria: criteria_worksheet }, + SheetNames: ['Criteria', 'Report'], + }; + const excelBuffer: any = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + const blob = new Blob([excelBuffer], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + }); if ((navigator as any).msSaveBlob) { (navigator as any).msSaveBlob(blob, wb_name); - } - else { - let link = document.createElement("a"); + } else { + const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.setAttribute('visibility', 'hidden'); - link.download = wb_name.replace(/ /g, "_") + ".xlsx"; + link.download = wb_name.replace(/ /g, '_') + '.xlsx'; document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -212,20 +234,24 @@ export class TotalConsultationReportComponent implements OnInit { modifyHeader(headers: any, i: any) { let modifiedHeader: string; - modifiedHeader = headers[i - 65].toString().replace(/([A-Z])/g, ' $1').trim(); - modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substring(1); - return modifiedHeader.replace(/I D/g, "ID"); + modifiedHeader = headers[i - 65] + .toString() + .replace(/([A-Z])/g, ' $1') + .trim(); + modifiedHeader = + modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substring(1); + return modifiedHeader.replace(/I D/g, 'ID'); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/scheduler-routing.module.ts b/src/app/app-modules/scheduler/scheduler-routing.module.ts index 06f0abc..48e7fa8 100644 --- a/src/app/app-modules/scheduler/scheduler-routing.module.ts +++ b/src/app/app-modules/scheduler/scheduler-routing.module.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; @@ -48,58 +48,58 @@ const routes: Routes = [ }, { path: 'specialization/dayview', - component: SpecializationCalanderViewComponent + component: SpecializationCalanderViewComponent, }, { path: 'appointment/view', - component: AppointmentViewComponent + component: AppointmentViewComponent, }, { path: 'myStaff', - component: MystaffComponent + component: MystaffComponent, }, { path: 'profile/:userID', - component: ProfileComponent + component: ProfileComponent, }, { path: 'smstemplate', - component: SmsTemplateComponent + component: SmsTemplateComponent, }, { path: 'createsmstemplate', - component: CreateSmsTemplateComponent + component: CreateSmsTemplateComponent, }, { path: 'viewSMSTemplate/:provider/:smsTemplateID', - component: ViewSmsTemplateComponent + component: ViewSmsTemplateComponent, }, { path: 'chiefComplaintReport', - component: ChiefComplaintReportComponent + component: ChiefComplaintReportComponent, }, { path: 'totalConsultationReport', - component: TotalConsultationReportComponent + component: TotalConsultationReportComponent, }, { path: 'consultationReport', - component: ConsultationReportComponent + component: ConsultationReportComponent, }, { path: 'monthlyReport', - component: MonthlyReportComponent + component: MonthlyReportComponent, }, { path: 'dailyReport', - component: DailyReportComponent - } - ] - } + component: DailyReportComponent, + }, + ], + }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule] + exports: [RouterModule], }) -export class SchedulerRoutingModule { } +export class SchedulerRoutingModule {} diff --git a/src/app/app-modules/scheduler/scheduler.module.ts b/src/app/app-modules/scheduler/scheduler.module.ts index 20bc808..b31d5a5 100644 --- a/src/app/app-modules/scheduler/scheduler.module.ts +++ b/src/app/app-modules/scheduler/scheduler.module.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CoreModule } from '../core/core.module'; @@ -46,9 +46,31 @@ import { NgChartsModule } from 'ng2-charts'; @NgModule({ imports: [ - CommonModule, SchedulerRoutingModule,MatTableModule, MaterialModule, FullCalendarModule, NgChartsModule, CoreModule.forRoot() + CommonModule, + SchedulerRoutingModule, + MatTableModule, + MaterialModule, + FullCalendarModule, + NgChartsModule, + CoreModule.forRoot(), ], - declarations: [DashboardComponent, TimesheetComponent, SpecializationCalanderViewComponent, AppointmentViewComponent, MystaffComponent, ProfileComponent, SmsTemplateComponent, SmsTemplateListComponent, CreateSmsTemplateComponent, ViewSmsTemplateComponent, ChiefComplaintReportComponent, TotalConsultationReportComponent, ConsultationReportComponent, MonthlyReportComponent, DailyReportComponent], - providers: [SchedulerService] + declarations: [ + DashboardComponent, + TimesheetComponent, + SpecializationCalanderViewComponent, + AppointmentViewComponent, + MystaffComponent, + ProfileComponent, + SmsTemplateComponent, + SmsTemplateListComponent, + CreateSmsTemplateComponent, + ViewSmsTemplateComponent, + ChiefComplaintReportComponent, + TotalConsultationReportComponent, + ConsultationReportComponent, + MonthlyReportComponent, + DailyReportComponent, + ], + providers: [SchedulerService], }) -export class SchedulerModule { } +export class SchedulerModule {} diff --git a/src/app/app-modules/scheduler/shared/services/index.ts b/src/app/app-modules/scheduler/shared/services/index.ts index f02f1f9..bed8fba 100644 --- a/src/app/app-modules/scheduler/shared/services/index.ts +++ b/src/app/app-modules/scheduler/shared/services/index.ts @@ -1,22 +1,22 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ export * from './scheduler.service'; diff --git a/src/app/app-modules/scheduler/shared/services/scheduler.service.ts b/src/app/app-modules/scheduler/shared/services/scheduler.service.ts index 64c3da3..2f10dc1 100644 --- a/src/app/app-modules/scheduler/shared/services/scheduler.service.ts +++ b/src/app/app-modules/scheduler/shared/services/scheduler.service.ts @@ -1,185 +1,180 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { HttpClient } from "@angular/common/http"; -import { Injectable } from "@angular/core"; -import { environment } from "src/environments/environment"; - + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; @Injectable() export class SchedulerService { constructor(private http: HttpClient) {} getServicePoints(userId: string, serviceProviderId: string) { - return this.http - .post(environment.servicePointUrl, { - userID: userId, - providerServiceMapID: serviceProviderId - }) - // .map(res => res.json()) - // .catch(err => { - // return Observable.throw(err); - // }); - } - getVanMaster(providerServiceMapID: any){ - return this.http.get(environment.getVanMasterUrl+providerServiceMapID) + return this.http.post(environment.servicePointUrl, { + userID: userId, + providerServiceMapID: serviceProviderId, + }); + // .map(res => res.json()) + // .catch(err => { + // return Observable.throw(err); + // }); + } + getVanMaster(providerServiceMapID: any) { + return this.http.get(environment.getVanMasterUrl + providerServiceMapID); // .map(res => res.json()); - } + } getAllEvents(userInfo: any, year = 0, month = 0, day = 0) { - return this.http - .post(`${environment.getAllEventsUrl}/${year}/${month}/${day}`, userInfo) - // .map(res => res.json()); + return this.http.post( + `${environment.getAllEventsUrl}/${year}/${month}/${day}`, + userInfo, + ); + // .map(res => res.json()); } getTimesheetBySpecialization(specializationDetails: any) { - return this.http - .post(environment.getTimesheetBySpecializationUrl, specializationDetails) - // .map(res => res.json()); + return this.http.post( + environment.getTimesheetBySpecializationUrl, + specializationDetails, + ); + // .map(res => res.json()); } markAvailability(availabilityDetails: any) { - return this.http - .post(environment.markAvailabilityUrl, availabilityDetails) - // .map(res => res.json()); + return this.http.post(environment.markAvailabilityUrl, availabilityDetails); + // .map(res => res.json()); } markNonAvailability(nonAvailabilityDetails: any) { - return this.http - .post(environment.markNonAvailabilityUrl, nonAvailabilityDetails) - // .map(res => res.json()); + return this.http.post( + environment.markNonAvailabilityUrl, + nonAvailabilityDetails, + ); + // .map(res => res.json()); } getSpecializationMaster() { - return this.http - .post(environment.getSpecializationMasterUrl, {}) - // .map(res => res.json()); + return this.http.post(environment.getSpecializationMasterUrl, {}); + // .map(res => res.json()); } getSpecialist(specialization: any) { - return this.http - .post(environment.getSpecialistUrl, specialization) - // .map(res => res.json()); + return this.http.post(environment.getSpecialistUrl, specialization); + // .map(res => res.json()); } getAllAppointments(requestObj: any) { - let reqobj = { + const reqobj = { psmID: requestObj.providerServiceMapID, userID: requestObj.specialistID, - date: requestObj.appointmentDate + date: requestObj.appointmentDate, }; - return this.http - .post(environment.getAllAppointmentUrl, reqobj) - // .map(res => res.json()); + return this.http.post(environment.getAllAppointmentUrl, reqobj); + // .map(res => res.json()); } cancelBeneficiaryTCRequest(tcRequest: any) { - return this.http - .post(environment.cancelBeneficiaryTCRequestUrl, tcRequest) - // .map(res => res.json()); + return this.http.post(environment.cancelBeneficiaryTCRequestUrl, tcRequest); + // .map(res => res.json()); } /** * My Staff */ getAllSpecialist(allSpecialistRequest: any) { - return this.http - .post(environment.getAllSpecialistUrl, allSpecialistRequest) - // .map(res => res.json()); + return this.http.post( + environment.getAllSpecialistUrl, + allSpecialistRequest, + ); + // .map(res => res.json()); } getSpecialistByUserID(specialistByUserIDReq: any) { - return this.http - .get(environment.getSpecialistByUserIDUrl + specialistByUserIDReq) - // .map(res => res.json()); + return this.http.get( + environment.getSpecialistByUserIDUrl + specialistByUserIDReq, + ); + // .map(res => res.json()); } getSMSType() { - let serviceID = 4; - return this.http - .post(environment.getSMSTypeUrl, { serviceID: serviceID }) - // .map(res => res.json()); + const serviceID = 4; + return this.http.post(environment.getSMSTypeUrl, { serviceID: serviceID }); + // .map(res => res.json()); } getSMSParameter() { - let serviceID = 4; - return this.http - .post(environment.getSMSParameterURL, { serviceID: serviceID }) - // .map(res => res.json()); + const serviceID = 4; + return this.http.post(environment.getSMSParameterURL, { + serviceID: serviceID, + }); + // .map(res => res.json()); } getAllSMSTemplates(smsTypeID?: any) { - let providerServiceMapID = localStorage.getItem("tm-providerServiceMapID"); - return this.http - .post(environment.getAllSMSTemplatesUrl, { - providerServiceMapID: providerServiceMapID, - smsTemplateTypeID: smsTypeID || undefined - }) - // .map(res => res.json()); + const providerServiceMapID = localStorage.getItem( + 'tm-providerServiceMapID', + ); + return this.http.post(environment.getAllSMSTemplatesUrl, { + providerServiceMapID: providerServiceMapID, + smsTemplateTypeID: smsTypeID || undefined, + }); + // .map(res => res.json()); } saveSMSTemplate(reqobj: any) { - return this.http - .post(environment.saveSMSTemplateUrl, reqobj) - // .map(res => res.json()); + return this.http.post(environment.saveSMSTemplateUrl, reqobj); + // .map(res => res.json()); } getFullSMSTemplate(reqobj: any) { - return this.http - .post(environment.getFullSMSTemplateUrl, reqobj) - // .map(res => res.json()); + return this.http.post(environment.getFullSMSTemplateUrl, reqobj); + // .map(res => res.json()); } updateSMSTemplate(reqobj: any) { - return this.http - .post(environment.updateSMSTemplateUrl, reqobj) - // .map(res => res.json()); + return this.http.post(environment.updateSMSTemplateUrl, reqobj); + // .map(res => res.json()); } /** * For Reports */ getChiefComplaintReports(reqobj: any) { - return this.http - .post(environment.getChiefComplaintReportUrl, reqobj) - // .map(res => res.json()); + return this.http.post(environment.getChiefComplaintReportUrl, reqobj); + // .map(res => res.json()); } getTotalConsultationReports(reqObj: any) { - return this.http - .post(environment.getTotalConsultationReportsUrl, reqObj) - // .map(res => res.json()); + return this.http.post(environment.getTotalConsultationReportsUrl, reqObj); + // .map(res => res.json()); } getConsultantReport(reqObj: any) { - return this.http - .post(environment.getConsultantReportUrl, reqObj) - // .map(res => res.json()); + return this.http.post(environment.getConsultantReportUrl, reqObj); + // .map(res => res.json()); } getMonthlyReports(reqObj: any) { - return this.http - .post(environment.getMonthlyReportsUrl, reqObj) - // .map(res => res.json()); + return this.http.post(environment.getMonthlyReportsUrl, reqObj); + // .map(res => res.json()); } getDailyReport(reqObj: any) { - return this.http - .post(environment.getDailyReportUrl, reqObj) - // .map(res => res.json()); + return this.http.post(environment.getDailyReportUrl, reqObj); + // .map(res => res.json()); } } diff --git a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.html b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.html index afcb94b..671a56a 100644 --- a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.html +++ b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.html @@ -1,90 +1,235 @@
-

{{heading}}

+

{{ heading }}

- +
- + - {{smsType.smsType}} + {{ smsType.smsType }}
- - {{smsTemplate ? smsTemplate?.length:0}}/200 + + {{ smsTemplate ? smsTemplate?.length : 0 }}/200
-
- +
+ - {{parameter}} + {{ parameter }}
-
- +
+ - {{type.smsParameterType}} + {{ type.smsParameterType }}
-
- - - {{parameterValue.smsParameterName}} +
+ + + {{ parameterValue.smsParameterName }}
-
- +
+
-
- -
{{currentLanguageSet?.sNo}}{{currentLanguageSet?.beneficiaryID}}{{currentLanguageSet?.beneficiaryName}}{{currentLanguageSet?.gender}}{{currentLanguageSet?.age}}{{currentLanguageSet?.visitCategoryVisitNo}}{{currentLanguageSet?.visitDate}}{{currentLanguageSet?.tCDate}}{{currentLanguageSet?.image}}{{currentLanguageSet?.action}}{{ currentLanguageSet?.sNo }} + {{ currentLanguageSet?.beneficiaryID }} + + {{ currentLanguageSet?.beneficiaryName }} + {{ currentLanguageSet?.gender }}{{ currentLanguageSet?.age }} + {{ currentLanguageSet?.visitCategoryVisitNo }} + {{ currentLanguageSet?.visitDate }}{{ currentLanguageSet?.tCDate }}{{ currentLanguageSet?.image }} + {{ currentLanguageSet?.action }} +
                              
{{filteredBeneficiaryList.indexOf(beneficiary)+1}}{{beneficiary?.beneficiaryID}}{{beneficiary?.benName | titlecase}}{{beneficiary.genderName | titlecase}}{{beneficiary.age}}
+ {{ filteredBeneficiaryList.indexOf(beneficiary) + 1 }} + {{ beneficiary?.beneficiaryID }}{{ beneficiary?.benName | titlecase }}{{ beneficiary.genderName | titlecase }}{{ beneficiary.age }} - {{beneficiary.VisitCategory}} / - {{beneficiary.benVisitNo}} + {{ beneficiary.VisitCategory }} + + / + {{ + beneficiary.benVisitNo + }} {{beneficiary.benVisitDate}}{{beneficiary.tCRequestDate}} - Avatar Profile + {{ beneficiary.benVisitDate }}{{ beneficiary.tCRequestDate }} + Avatar Profile -
-
{{currentLanguageSet?.totalCount}} : {{ filteredBeneficiaryList.length }}
+
+ {{ currentLanguageSet?.totalCount }} : + {{ filteredBeneficiaryList.length }} +
- +
- - - +
+
{{ currentLanguageSet?.sNo }} {{ element.sNo }}
+ + + + + - - - - - - - - + + + + + + + + + + - - - + + + - - - -
+ {{ currentLanguageSet?.sNo }} + + {{ element.sNo }} + {{ currentLanguageSet?.parameter }}{{ element.smsParameterName }}{{ currentLanguageSet?.valueType }}{{ element.smsParameterType }}{{ currentLanguageSet?.value }}{{ element.smsParameterValue }} + {{ currentLanguageSet?.parameter }} + + {{ element.smsParameterName }} + + {{ currentLanguageSet?.valueType }} + + {{ element.smsParameterType }} + + {{ currentLanguageSet?.value }} + + {{ element.smsParameterValue }} + {{ currentLanguageSet?.action }} - - + {{ currentLanguageSet?.action }} + + + + +
+ + + +
- - - - + + + +
- -
-
\ No newline at end of file +
diff --git a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.spec.ts b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.spec.ts index 6e583fe..3731e7e 100644 --- a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.spec.ts +++ b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { CreateSmsTemplateComponent } from './create-sms-template.component'; @@ -29,9 +29,8 @@ describe('CreateSmsTemplateComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ CreateSmsTemplateComponent ] - }) - .compileComponents(); + declarations: [CreateSmsTemplateComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.ts b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.ts index 722c6e4..fa9617e 100644 --- a/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.ts +++ b/src/app/app-modules/scheduler/sms-template/create-sms-template/create-sms-template.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, Input } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, OnInit, Input, DoCheck } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import { SchedulerService } from '../../shared/services'; @@ -31,26 +31,37 @@ import { HttpServiceService } from 'src/app/app-modules/core/services/http-servi @Component({ selector: 'app-create-sms-template', templateUrl: './create-sms-template.component.html', - styleUrls: ['./create-sms-template.component.css'] + styleUrls: ['./create-sms-template.component.css'], }) -export class CreateSmsTemplateComponent implements OnInit { - @Input('fullSMSTemplate') +export class CreateSmsTemplateComponent implements OnInit, DoCheck { + @Input() fullSMSTemplate: any; languageComponent!: SetLanguageComponent; currentLanguageSet: any; - displayedColumns: string[] = ['sNo', 'parameter', 'valueType', 'value', 'action']; - - constructor(private fb: FormBuilder, + displayedColumns: string[] = [ + 'sNo', + 'parameter', + 'valueType', + 'value', + 'action', + ]; + + constructor( + private fb: FormBuilder, private schedulerService: SchedulerService, public httpServiceService: HttpServiceService, private confirmationService: ConfirmationService, private location: Location, - private activatedRoute: ActivatedRoute) { } - smsTemplateCreationForm!: FormGroup + private activatedRoute: ActivatedRoute, + ) {} + ngDoCheck(): void { + throw new Error('Method not implemented.'); + } + smsTemplateCreationForm!: FormGroup; - masterSMSType:any[] = []; - parameters :any[] = []; - templateView: boolean = false; + masterSMSType: any[] = []; + parameters: any[] = []; + templateView = false; ngOnInit() { this.smsTemplateCreationForm = this.createsmsTemplateCreationForm(); this.getSMSType(); @@ -58,43 +69,49 @@ export class CreateSmsTemplateComponent implements OnInit { } heading: any; getSMSType(view?: string) { - this.schedulerService.getSMSType().subscribe({next:(res:any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - this.masterSMSType = res.data; - if (this.fullSMSTemplate) { - this.createViewSMSTemplate() + this.schedulerService.getSMSType().subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + this.masterSMSType = res.data; + if (this.fullSMSTemplate) { + this.createViewSMSTemplate(); + } else { + this.heading = this.currentLanguageSet.createSMSTemplate; + } } else { - this.heading = this.currentLanguageSet.createSMSTemplate + this.confirmationService.alert(res.errorMessage, 'error'); } - } else { - this.confirmationService.alert(res.errorMessage, 'error') - } - }, - error: (err: any) => { - this.confirmationService.alert(err, 'error'); - }}); + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } createViewSMSTemplate() { - this.mappedSMSParameter = this.fullSMSTemplate.smsParameterMaps + this.mappedSMSParameter = this.fullSMSTemplate.smsParameterMaps; this.fullSMSTemplate.smsType = this.masterSMSType.filter((smsType: any) => { - if (smsType && smsType.smsTypeID && this.fullSMSTemplate.smsType && this.fullSMSTemplate.smsType.smsTypeID){ - return smsType.smsTypeID == this.fullSMSTemplate.smsType.smsTypeID - } - else{ + if ( + smsType && + smsType.smsTypeID && + this.fullSMSTemplate.smsType && + this.fullSMSTemplate.smsType.smsTypeID + ) { + return smsType.smsTypeID == this.fullSMSTemplate.smsType.smsTypeID; + } else { return false; } - }) + }); this.smsTemplateCreationForm.patchValue(this.fullSMSTemplate); this.templateReadOnly = true; this.templateView = true; - this.heading = this.currentLanguageSet.viewSMSTemplate + this.heading = this.currentLanguageSet.viewSMSTemplate; } get smsTemplate() { - return this.smsTemplateCreationForm.controls['smsTemplate'].value + return this.smsTemplateCreationForm.controls['smsTemplate'].value; } - smsTypeID: any + smsTypeID: any; checkSMSType() { this.smsTypeID = this.smsType.smsTypeID; } @@ -105,22 +122,22 @@ export class CreateSmsTemplateComponent implements OnInit { smsTemplate: null, parameter: null, smsParameterType: null, - smsParameterValue: null - }) + smsParameterValue: null, + }); } parameterCount: any; - templateReadOnly: boolean = false; + templateReadOnly = false; extractParameters() { if (this.smsTypeID && this.smsTemplateName && this.smsTemplate) { this.parameters = []; - let tempParameters = []; + const tempParameters = []; let string_contents = []; - let regex = /[!?.,\n]/g; + const regex = /[!?.,\n]/g; string_contents = this.smsTemplate.replace(regex, ' ').split(' '); for (const element of string_contents) { if (element.startsWith('$$') && element.endsWith('$$')) { - let item = element.substr(2).slice(0, -2); + const item = element.substr(2).slice(0, -2); console.log(item); tempParameters.push(item); } @@ -134,38 +151,43 @@ export class CreateSmsTemplateComponent implements OnInit { this.parametersLength = this.parameters.length; this.templateReadOnly = true; } else { - this.confirmationService.alert(this.currentLanguageSet.noparametersidentifiedinsmstemplate, 'info'); + this.confirmationService.alert( + this.currentLanguageSet.noparametersidentifiedinsmstemplate, + 'info', + ); } console.log('param', this.parameters, this.parameterCount); } else { - this.confirmationService.alert(this.currentLanguageSet.provideallmandatoryfields) + this.confirmationService.alert( + this.currentLanguageSet.provideallmandatoryfields, + ); } - - } get parameter() { return this.smsTemplateCreationForm.controls['parameter'].value; } masterSMSParameter: any[] = []; getSMSparameter() { - this.schedulerService.getSMSParameter().subscribe({next:(res: any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - this.masterSMSParameter = res.data; - } else { - this.confirmationService.alert(res.errorMessage, 'error') - } - }, - error:(err: any) => { - this.confirmationService.alert(err, 'error'); - }}); + this.schedulerService.getSMSParameter().subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + this.masterSMSParameter = res.data; + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } get smsParameterType() { - return this.smsTemplateCreationForm.controls['smsParameterType'].value + return this.smsTemplateCreationForm.controls['smsParameterType'].value; } - selectedParameterValues!: any + selectedParameterValues!: any; getParameterValue() { - this.selectedParameterValues = this.smsParameterType.smsParameters + this.selectedParameterValues = this.smsParameterType.smsParameters; } get smsParameterValue() { return this.smsTemplateCreationForm.controls['smsParameterValue'].value; @@ -173,20 +195,25 @@ export class CreateSmsTemplateComponent implements OnInit { mappedSMSParameter: any[] = []; parametersLength: any; addSMSParameterTemplate() { - let reqObj = { - 'createdBy': localStorage.getItem('tm-userName'), - 'modifiedBy': localStorage.getItem('tm-userName'), - 'smsParameterName': this.parameter, - 'smsParameterType': this.smsParameterType.smsParameterType, - 'smsParameterID': this.smsParameterValue.smsParameterID, - 'smsParameterValue': this.smsParameterValue.smsParameterName - } - if (reqObj.smsParameterName != undefined && + const reqObj = { + createdBy: localStorage.getItem('tm-userName'), + modifiedBy: localStorage.getItem('tm-userName'), + smsParameterName: this.parameter, + smsParameterType: this.smsParameterType.smsParameterType, + smsParameterID: this.smsParameterValue.smsParameterID, + smsParameterValue: this.smsParameterValue.smsParameterName, + }; + if ( + reqObj.smsParameterName != undefined && reqObj.smsParameterType != undefined && - reqObj.smsParameterID != undefined) { + reqObj.smsParameterID != undefined + ) { this.mappedSMSParameter.push(reqObj); } else { - this.confirmationService.alert(this.currentLanguageSet.ValueTypeAndValueShouldBeSelected, 'info'); + this.confirmationService.alert( + this.currentLanguageSet.ValueTypeAndValueShouldBeSelected, + 'info', + ); } this.parameters.splice(this.parameters.indexOf(this.parameter), 1); @@ -194,53 +221,59 @@ export class CreateSmsTemplateComponent implements OnInit { this.smsTemplateCreationForm.patchValue({ parameter: null, smsParameterType: null, - smsParameterValue: null + smsParameterValue: null, }); this.masterSMSParameter = []; this.selectedParameterValues = []; } removeSMSParameterTemplate(parameter: any, sNo: any) { - - let indexToRemove = this.mappedSMSParameter.findIndex(item => item.sNo === sNo); - + const indexToRemove = this.mappedSMSParameter.findIndex( + (item) => item.sNo === sNo, + ); if (indexToRemove !== -1) { this.mappedSMSParameter.splice(indexToRemove, 1); this.parameters.push(parameter.smsParameterName); this.parametersLength = this.parameters.length; } } - + saveSMStemplate() { - let requestObject = { - 'createdBy': localStorage.getItem('tm-userName'), - 'providerServiceMapID': localStorage.getItem('tm-providerServiceMapID'), - 'smsParameterMaps': this.mappedSMSParameter, - 'smsTemplate': this.smsTemplate, - 'smsTemplateName': this.smsTemplateName, - 'smsTypeID': this.smsTypeID - } - this.schedulerService.saveSMSTemplate(requestObject).subscribe({next:(res: any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - this.confirmationService.alertConfirm(this.currentLanguageSet.templateCreationSuccess, 'success') - .subscribe(() => { - this.location.back(); - }); - } else { - this.confirmationService.alert(res.errorMessage, 'error') - } - }, - error:(err: any) => { - this.confirmationService.alert(err, 'error'); - }}); + const requestObject = { + createdBy: localStorage.getItem('tm-userName'), + providerServiceMapID: localStorage.getItem('tm-providerServiceMapID'), + smsParameterMaps: this.mappedSMSParameter, + smsTemplate: this.smsTemplate, + smsTemplateName: this.smsTemplateName, + smsTypeID: this.smsTypeID, + }; + this.schedulerService.saveSMSTemplate(requestObject).subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + this.confirmationService + .alertConfirm( + this.currentLanguageSet.templateCreationSuccess, + 'success', + ) + .subscribe(() => { + this.location.back(); + }); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } get smsTemplateName() { - return this.smsTemplateCreationForm.controls['smsTemplateName'].value + return this.smsTemplateCreationForm.controls['smsTemplateName'].value; } get smsType() { - return this.smsTemplateCreationForm.controls['smsType'].value + return this.smsTemplateCreationForm.controls['smsType'].value; } goToViewList() { this.location.back(); @@ -253,7 +286,7 @@ export class CreateSmsTemplateComponent implements OnInit { this.smsTemplateCreationForm.patchValue({ parameter: null, smsParameterType: null, - smsParameterValue: null + smsParameterValue: null, }); this.masterSMSParameter = []; this.selectedParameterValues = []; @@ -261,19 +294,24 @@ export class CreateSmsTemplateComponent implements OnInit { } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + DoCheck() { this.fetchLanguageResponse(); - if(this.currentLanguageSet !==undefined && this.currentLanguageSet !==null && this.fullSMSTemplate !==undefined && this.fullSMSTemplate !==null){ - // this.createViewSMSTemplate() - } else { - this.heading = this.currentLanguageSet.createSMSTemplate + if ( + this.currentLanguageSet !== undefined && + this.currentLanguageSet !== null && + this.fullSMSTemplate !== undefined && + this.fullSMSTemplate !== null + ) { + // this.createViewSMSTemplate() + } else { + this.heading = this.currentLanguageSet.createSMSTemplate; } } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.html b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.html index 709dc6f..f2c79e3 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.html +++ b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.html @@ -1,50 +1,111 @@
-

{{currentLanguageSet?.sMSTemplateList}}

+

+ {{ currentLanguageSet?.sMSTemplateList }} +

- - - - - - - - - - +
{{ currentLanguageSet?.sNo }} {{ element.sNo }} {{ currentLanguageSet?.templateName }}{{ element.smsTemplateName }}
+ + + + + + + + + - - - + + + - - + + + + + + - - - - - - - - - - - - - - - -
+ {{ currentLanguageSet?.sNo }} + + {{ element.sNo }} + + {{ currentLanguageSet?.templateName }} + + {{ element.smsTemplateName }} + {{ currentLanguageSet?.templateType }}{{ element.smsType?.smsType }} + {{ currentLanguageSet?.templateType }} + + {{ element.smsType?.smsType }} + {{ currentLanguageSet?.template }}{{ element.smsTemplate }} + {{ currentLanguageSet?.template }} + {{ element.smsTemplate }} + {{ currentLanguageSet?.view }} + + + {{ currentLanguageSet?.view }} - {{ currentLanguageSet?.action }} - - - -
- + {{ currentLanguageSet?.action }} + + + + + + + + + + + + + + + + + + + {{currentLanguageSet?.sMSTemplateList}}
-
\ No newline at end of file + diff --git a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.spec.ts b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.spec.ts index 4ef5769..18baa4c 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.spec.ts +++ b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SmsTemplateListComponent } from './sms-template-list.component'; @@ -29,9 +29,8 @@ describe('SmsTemplateListComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SmsTemplateListComponent ] - }) - .compileComponents(); + declarations: [SmsTemplateListComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.ts b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.ts index 3c892ca..28022b8 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.ts +++ b/src/app/app-modules/scheduler/sms-template/sms-template-list/sms-template-list.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import { SchedulerService } from '../../shared/services'; import { Router } from '@angular/router'; @@ -28,18 +28,27 @@ import { HttpServiceService } from 'src/app/app-modules/core/services/http-servi @Component({ selector: 'app-sms-template-list', templateUrl: './sms-template-list.component.html', - styleUrls: ['./sms-template-list.component.css'] + styleUrls: ['./sms-template-list.component.css'], }) -export class SmsTemplateListComponent implements OnInit { - +export class SmsTemplateListComponent implements OnInit, DoCheck { languageComponent!: SetLanguageComponent; currentLanguageSet: any; - displayedColumns: string[] = ['sNo', 'templateName', 'templateType', 'template', 'view', 'action', 'createNewSMSTemplate']; - - constructor(private schedulerService: SchedulerService, + displayedColumns: string[] = [ + 'sNo', + 'templateName', + 'templateType', + 'template', + 'view', + 'action', + 'createNewSMSTemplate', + ]; + + constructor( + private schedulerService: SchedulerService, private confirmationService: ConfirmationService, public httpServiceService: HttpServiceService, - private router: Router) { } + private router: Router, + ) {} ngOnInit() { this.getAllSMSTemplates(); @@ -47,57 +56,71 @@ export class SmsTemplateListComponent implements OnInit { } templateList = []; getAllSMSTemplates() { - this.schedulerService.getAllSMSTemplates().subscribe({next:(res: any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - this.templateList = res.data; - } else { - this.confirmationService.alert(res.errorMessage, 'error') - } - }, - error: (err: any)=> { - this.confirmationService.alert(err, 'error'); - }}); + this.schedulerService.getAllSMSTemplates().subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + this.templateList = res.data; + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } viewFullSMSTemplate(template: any) { console.log('template', template); - this.router.navigate(['telemedicine/viewSMSTemplate', template.providerServiceMapID, template.smsTemplateID]) + this.router.navigate([ + 'telemedicine/viewSMSTemplate', + template.providerServiceMapID, + template.smsTemplateID, + ]); } createNewSMSTemplate() { - this.router.navigate(['telemedicine/createsmstemplate']) + this.router.navigate(['telemedicine/createsmstemplate']); } activateDeactivate(template: any, flag: any) { template.deleted = flag; template.modifiedBy = localStorage.getItem('tm-userName'); - this.schedulerService.updateSMSTemplate(template).subscribe({next:(res: any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - if (flag) { - this.confirmationService.alert(this.currentLanguageSet.deactivatedsuccessfully, 'success'); - this.getAllSMSTemplates(); + this.schedulerService.updateSMSTemplate(template).subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + if (flag) { + this.confirmationService.alert( + this.currentLanguageSet.deactivatedsuccessfully, + 'success', + ); + this.getAllSMSTemplates(); + } else { + this.confirmationService.alert( + this.currentLanguageSet.activatedsuccessfully, + 'success', + ); + this.getAllSMSTemplates(); + } } else { - this.confirmationService.alert(this.currentLanguageSet.activatedsuccessfully, 'success'); - this.getAllSMSTemplates(); + this.confirmationService.alert(res.errorMessage, 'error'); } - } else { - this.confirmationService.alert(res.errorMessage, 'error') - } - }, - error:(err: any) => { - this.confirmationService.alert(err, 'error'); - }}); + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + }); } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/sms-template/sms-template.component.html b/src/app/app-modules/scheduler/sms-template/sms-template.component.html index def5523..bfa17d2 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template.component.html +++ b/src/app/app-modules/scheduler/sms-template/sms-template.component.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/sms-template/sms-template.component.spec.ts b/src/app/app-modules/scheduler/sms-template/sms-template.component.spec.ts index f897054..1c1fa76 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template.component.spec.ts +++ b/src/app/app-modules/scheduler/sms-template/sms-template.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SmsTemplateComponent } from './sms-template.component'; @@ -29,9 +29,8 @@ describe('SmsTemplateComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SmsTemplateComponent ] - }) - .compileComponents(); + declarations: [SmsTemplateComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/sms-template/sms-template.component.ts b/src/app/app-modules/scheduler/sms-template/sms-template.component.ts index d517481..b1719c7 100644 --- a/src/app/app-modules/scheduler/sms-template/sms-template.component.ts +++ b/src/app/app-modules/scheduler/sms-template/sms-template.component.ts @@ -1,31 +1,29 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component } from '@angular/core'; @Component({ selector: 'app-sms-template', templateUrl: './sms-template.component.html', - styleUrls: ['./sms-template.component.css'] + styleUrls: ['./sms-template.component.css'], }) -export class SmsTemplateComponent { - -} +export class SmsTemplateComponent {} diff --git a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.html b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.html index 6c8853e..3b78316 100644 --- a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.html +++ b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.html @@ -1 +1,4 @@ - \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.spec.ts b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.spec.ts index 07029f7..3322469 100644 --- a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.spec.ts +++ b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ViewSmsTemplateComponent } from './view-sms-template.component'; @@ -29,9 +29,8 @@ describe('ViewSmsTemplateComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ViewSmsTemplateComponent ] - }) - .compileComponents(); + declarations: [ViewSmsTemplateComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.ts b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.ts index 0eaa635..6509a5d 100644 --- a/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.ts +++ b/src/app/app-modules/scheduler/sms-template/view-sms-template/view-sms-template.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import { SchedulerService } from '../../shared/services'; import { ActivatedRoute } from '@angular/router'; @@ -29,49 +29,53 @@ import { HttpServiceService } from 'src/app/app-modules/core/services/http-servi @Component({ selector: 'app-view-sms-template', templateUrl: './view-sms-template.component.html', - styleUrls: ['./view-sms-template.component.css'] + styleUrls: ['./view-sms-template.component.css'], }) -export class ViewSmsTemplateComponent implements OnInit { - - languageComponent! : SetLanguageComponent; +export class ViewSmsTemplateComponent implements OnInit, DoCheck { + languageComponent!: SetLanguageComponent; currentLanguageSet: any; - constructor(private schedulerService: SchedulerService, + constructor( + private schedulerService: SchedulerService, public httpServiceService: HttpServiceService, - private confirmationService: ConfirmationService, private activatedRoute: ActivatedRoute,private location:Location) { } + private confirmationService: ConfirmationService, + private activatedRoute: ActivatedRoute, + private location: Location, + ) {} fullSMSTemplate: any; ngOnInit() { this.getFullSMSTemplate(); } getFullSMSTemplate() { - let reqObj = { - 'providerServiceMapID': this.activatedRoute.snapshot.params['provider'], - 'smsTemplateID': this.activatedRoute.snapshot.params['smsTemplateID'] - } - this.schedulerService.getFullSMSTemplate(reqObj).subscribe({next:(res: any) => { - console.log('res', res); - if (res && res.statusCode == 200) { - this.fullSMSTemplate = res.data; - } else { - this.confirmationService.alert(res.errorMessage, 'error'); + const reqObj = { + providerServiceMapID: this.activatedRoute.snapshot.params['provider'], + smsTemplateID: this.activatedRoute.snapshot.params['smsTemplateID'], + }; + this.schedulerService.getFullSMSTemplate(reqObj).subscribe({ + next: (res: any) => { + console.log('res', res); + if (res && res.statusCode == 200) { + this.fullSMSTemplate = res.data; + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + this.location.back(); + } + }, + error: (err: any) => { + this.confirmationService.alert(err, 'error'); this.location.back(); - } - }, - error: (err: any) => { - this.confirmationService.alert(err, 'error'); - this.location.back(); - }}); + }, + }); } - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } - } diff --git a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.html b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.html index 07bc6c4..24c7a31 100644 --- a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.html +++ b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.html @@ -1,33 +1,66 @@
-
- +
- - - {{specialization.specialization}} + + + {{ specialization.specialization }}
- - + +
-
@@ -39,10 +72,11 @@
- + + - + - +
{{currentLanguageSet?.specialist}}{{ currentLanguageSet?.specialist }}
@@ -54,12 +88,41 @@
{{ ((resource?.firstName || " ") + ' ' + (resource?.lastName || "")) | titlecase }}   + {{ + (resource?.firstName || " ") + + " " + + (resource?.lastName || "") | titlecase + }} +   +
-
- -
{{ event.slot.charAt(0) }}
+
+ +
+ {{ event.slot.charAt(0) }} +
@@ -72,4 +135,4 @@
- \ No newline at end of file + diff --git a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.spec.ts b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.spec.ts index 43c133a..af0a1bd 100644 --- a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.spec.ts +++ b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SpecializationCalanderViewComponent } from './specialization-calander-view.component'; @@ -29,9 +29,8 @@ describe('SpecializationCalanderViewComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SpecializationCalanderViewComponent ] - }) - .compileComponents(); + declarations: [SpecializationCalanderViewComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.ts b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.ts index 21eabca..f693161 100644 --- a/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.ts +++ b/src/app/app-modules/scheduler/specialization-calander-view/specialization-calander-view.component.ts @@ -1,25 +1,25 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { Component, DoCheck, OnInit } from '@angular/core'; import { SchedulerService } from '../shared/services/scheduler.service'; import { SetLanguageComponent } from '../../core/components/set-language.component'; import { HttpServiceService } from '../../core/services/http-service.service'; @@ -27,9 +27,9 @@ import { HttpServiceService } from '../../core/services/http-service.service'; @Component({ selector: 'app-specialization-calander-view', templateUrl: './specialization-calander-view.component.html', - styleUrls: ['./specialization-calander-view.component.css'] + styleUrls: ['./specialization-calander-view.component.css'], }) -export class SpecializationCalanderViewComponent implements OnInit { +export class SpecializationCalanderViewComponent implements OnInit, DoCheck { daySlots: any[] = []; eventWithResource: any[] = []; viewDate: any; @@ -40,7 +40,8 @@ export class SpecializationCalanderViewComponent implements OnInit { constructor( private schedulerService: SchedulerService, - public httpServiceService: HttpServiceService) { } + public httpServiceService: HttpServiceService, + ) {} ngOnInit() { this.initDaySlots(); @@ -51,76 +52,91 @@ export class SpecializationCalanderViewComponent implements OnInit { } getSpecialisationMaster() { - this.schedulerService.getSpecializationMaster() - .subscribe((res: any) => { - if (res.statusCode == 200 && res.data) { - this.specializationMaster = res.data; - } - }); + this.schedulerService.getSpecializationMaster().subscribe((res: any) => { + if (res.statusCode == 200 && res.data) { + this.specializationMaster = res.data; + } + }); } getTimesheetBySpecialization() { - let specializationDetails = { - "date": new Date(this.viewDate), - "specializationID": this.selectedSpecialization, - "userID": localStorage.getItem('tm-userID'), - "providerServiceMapID": localStorage.getItem('tm-providerServiceMapID') - } + const specializationDetails = { + date: new Date(this.viewDate), + specializationID: this.selectedSpecialization, + userID: localStorage.getItem('tm-userID'), + providerServiceMapID: localStorage.getItem('tm-providerServiceMapID'), + }; - this.schedulerService.getTimesheetBySpecialization(specializationDetails) + this.schedulerService + .getTimesheetBySpecialization(specializationDetails) .subscribe((res: any) => { this.eventWithResource = res.data; - if(this.eventWithResource.length < 8){ + if (this.eventWithResource.length < 8) { this.eventWithResource.length = 8; } this.eventWithResource.forEach((eventWithResource: any) => { - if (eventWithResource.specialistAvailability && eventWithResource.specialistAvailability.slots) { - eventWithResource.specialistAvailability.slots.forEach((slot: any) => { - let fromTimeArr = slot.fromTime.split(":"); - let toTimeArr = slot.toTime.split(":"); - if (fromTimeArr && fromTimeArr[0]) - slot.index = parseInt(fromTimeArr[0]); - if (fromTimeArr && fromTimeArr[1]) - slot.left = parseInt(fromTimeArr[1]); - if (fromTimeArr.length > 0 && toTimeArr.length > 0) - slot.width = this.calculateEventWidth(fromTimeArr[0], fromTimeArr[1], toTimeArr[0], toTimeArr[1]); - }) + if ( + eventWithResource.specialistAvailability && + eventWithResource.specialistAvailability.slots + ) { + eventWithResource.specialistAvailability.slots.forEach( + (slot: any) => { + const fromTimeArr = slot.fromTime.split(':'); + const toTimeArr = slot.toTime.split(':'); + if (fromTimeArr && fromTimeArr[0]) + slot.index = parseInt(fromTimeArr[0]); + if (fromTimeArr && fromTimeArr[1]) + slot.left = parseInt(fromTimeArr[1]); + if (fromTimeArr.length > 0 && toTimeArr.length > 0) + slot.width = this.calculateEventWidth( + fromTimeArr[0], + fromTimeArr[1], + toTimeArr[0], + toTimeArr[1], + ); + }, + ); } }); if (this.eventWithResource.length < 8) { - this.eventWithResource.length = 8 + this.eventWithResource.length = 8; } - }) + }); } - - calculateEventWidth(fromTimeHour:any, fromTimeMinute: any, toTimeHour: any, toTimeMinute: any) { + + calculateEventWidth( + fromTimeHour: any, + fromTimeMinute: any, + toTimeHour: any, + toTimeMinute: any, + ) { if (fromTimeHour && fromTimeMinute && toTimeHour && toTimeMinute) { - return ((toTimeHour - fromTimeHour) * 60 + (toTimeMinute - fromTimeMinute)) + return (toTimeHour - fromTimeHour) * 60 + (toTimeMinute - fromTimeMinute); } return 0; } initDaySlots() { for (let i = 0; i < 24; i++) { - this.daySlots.push(i + ":00"); + this.daySlots.push(i + ':00'); } } initEventWithResource() { - let temp = new Array(8); + const temp = new Array(8); this.eventWithResource = temp; } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-modules/scheduler/timesheet/timesheet.component.html b/src/app/app-modules/scheduler/timesheet/timesheet.component.html index 6ed1053..88ebd65 100644 --- a/src/app/app-modules/scheduler/timesheet/timesheet.component.html +++ b/src/app/app-modules/scheduler/timesheet/timesheet.component.html @@ -2,26 +2,53 @@
- +
-
+
- - - {{specialization.specialization}} + + + {{ specialization.specialization }}
- - - {{ specialist.firstName + ' ' + (specialist.middleName || '') + ' ' + specialist.lastName }} + + + {{ + specialist.firstName + + " " + + (specialist.middleName || "") + + " " + + specialist.lastName + }}
@@ -29,52 +56,135 @@
-
+
- - {{currentLanguageSet?.available}} - {{currentLanguageSet?.notAvailable}} + + {{ + currentLanguageSet?.available + }} + {{ + currentLanguageSet?.notAvailable + }}
- - + +
-
- - +
+ +
- - + +
- - + +
-
- +
+
- +
-
\ No newline at end of file +
diff --git a/src/app/app-modules/scheduler/timesheet/timesheet.component.spec.ts b/src/app/app-modules/scheduler/timesheet/timesheet.component.spec.ts index 8454683..c55b25b 100644 --- a/src/app/app-modules/scheduler/timesheet/timesheet.component.spec.ts +++ b/src/app/app-modules/scheduler/timesheet/timesheet.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TimesheetComponent } from './timesheet.component'; @@ -29,9 +29,8 @@ describe('TimesheetComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ TimesheetComponent ] - }) - .compileComponents(); + declarations: [TimesheetComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/app-modules/scheduler/timesheet/timesheet.component.ts b/src/app/app-modules/scheduler/timesheet/timesheet.component.ts index c5ef587..9b3f4d4 100644 --- a/src/app/app-modules/scheduler/timesheet/timesheet.component.ts +++ b/src/app/app-modules/scheduler/timesheet/timesheet.component.ts @@ -1,25 +1,33 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ -import { Component, OnInit, ViewChild, ChangeDetectorRef, Input,OnChanges } from '@angular/core'; + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ +import { + Component, + OnInit, + ViewChild, + ChangeDetectorRef, + Input, + OnChanges, + DoCheck, +} from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { FullCalendarComponent } from '@fullcalendar/angular'; @@ -34,15 +42,14 @@ import { Options } from 'html2canvas'; @Component({ selector: 'app-timesheet', templateUrl: './timesheet.component.html', - styleUrls: ['./timesheet.component.css'] + styleUrls: ['./timesheet.component.css'], }) -export class TimesheetComponent implements OnInit, OnChanges { - - @Input('getChangedTab') +export class TimesheetComponent implements OnInit, OnChanges, DoCheck { + @Input() getChangedTab!: boolean; @ViewChild(FullCalendarComponent) ucCalendar!: FullCalendarComponent; - calendarOptions: Options | null =null; + calendarOptions: Options | null = null; availabiltyForm!: FormGroup; timeList: any[] = []; @@ -60,14 +67,15 @@ export class TimesheetComponent implements OnInit, OnChanges { languageComponent!: SetLanguageComponent; currentLanguageSet: any; - + constructor( private fb: FormBuilder, private cdRef: ChangeDetectorRef, private route: ActivatedRoute, public httpServiceService: HttpServiceService, private confirmationService: ConfirmationService, - private schedulerService: SchedulerService) { } + private schedulerService: SchedulerService, + ) {} ngOnInit() { this.initializeCalender(); @@ -77,7 +85,7 @@ export class TimesheetComponent implements OnInit, OnChanges { ngOnChanges() { if (this.getChangedTab) { this.initializeCalender(); - this.calendarOptions = null; + this.calendarOptions = null; } } @@ -89,45 +97,47 @@ export class TimesheetComponent implements OnInit, OnChanges { this.getUserDesignation(); this.minSelectableDate = new Date(); - let temp = new Date(); + const temp = new Date(); temp.setMonth(temp.getMonth() + 2); this.maxSelectableDate = temp; } - getUserDesignation() { let userInfo; - this.route.params.subscribe(param => { + this.route.params.subscribe((param) => { this.designation = param['designation']; - if (this.designation == "TC Specialist") { + if (this.designation == 'TC Specialist') { userInfo = { userID: localStorage.getItem('tm-userID') }; } else { userInfo = { userID: localStorage.getItem('supervisor-specialistID') }; } - let date = new Date(); + const date = new Date(); this.selectedSpecialist = userInfo; - this.schedulerService.getAllEvents(userInfo, date.getFullYear(), date.getMonth() + 1) + this.schedulerService + .getAllEvents(userInfo, date.getFullYear(), date.getMonth() + 1) .subscribe((res: any) => { - let eventSourceList = res.data; - let eventSources = this.mapResponseToEventSources(eventSourceList); + const eventSourceList = res.data; + const eventSources = this.mapResponseToEventSources(eventSourceList); this.initCalender(eventSources); }); - }) + }); } submitAvailabilityForm(availabiltyForm: any) { - let availabilityFormValue: any = JSON.parse(JSON.stringify(this.availabiltyForm.value)); + const availabilityFormValue: any = JSON.parse( + JSON.stringify(this.availabiltyForm.value), + ); - let fromDate = new Date(availabilityFormValue.configuredFromDate); + const fromDate = new Date(availabilityFormValue.configuredFromDate); fromDate.setHours(5, 30, 0, 0); availabilityFormValue.configuredFromDate = fromDate; - let fromTime = new Date(availabilityFormValue.configuredFromTime); - let temp1 = new Date(availabilityFormValue.configuredFromDate); + const fromTime = new Date(availabilityFormValue.configuredFromTime); + const temp1 = new Date(availabilityFormValue.configuredFromDate); temp1.setHours(fromTime.getHours() + 5, fromTime.getMinutes() + 30); availabilityFormValue.configuredFromTime = temp1.toJSON(); - let toDate = new Date(availabilityFormValue.configuredToDate); + const toDate = new Date(availabilityFormValue.configuredToDate); toDate.setHours(5, 30, 0, 0); availabilityFormValue.configuredToDate = toDate; @@ -137,14 +147,14 @@ export class TimesheetComponent implements OnInit, OnChanges { availabilityFormValue.userID = this.selectedSpecialist.userID; if (availabilityFormValue.isAvailability === 'true') { - let toTime = new Date(availabilityFormValue.configuredToTime); - let temp2 = new Date(availabilityFormValue.configuredToDate); + const toTime = new Date(availabilityFormValue.configuredToTime); + const temp2 = new Date(availabilityFormValue.configuredToDate); temp2.setHours(toTime.getHours() + 5, toTime.getMinutes() + 30); availabilityFormValue.configuredToTime = temp2.toJSON(); this.markAvailability(availabiltyForm, availabilityFormValue); } else { - let toTime = new Date(availabilityFormValue.configuredToTime); - let temp3 = new Date(availabilityFormValue.configuredFromDate); + const toTime = new Date(availabilityFormValue.configuredToTime); + const temp3 = new Date(availabilityFormValue.configuredFromDate); temp3.setHours(toTime.getHours() + 5, toTime.getMinutes() + 30); availabilityFormValue.configuredToTime = temp3.toJSON(); @@ -153,76 +163,90 @@ export class TimesheetComponent implements OnInit, OnChanges { this.markNonAvailability(availabiltyForm, availabilityFormValue); } } - markAvailability(availabiltyForm: FormGroup, availabilityFormValue: any) - { this.schedulerService.markAvailability(availabilityFormValue) .subscribe({ next: (res: any) => - { if (res.statusCode == 200 && res.data) - { this.confirmationService.alert(this.currentLanguageSet.markedSuccessfully, 'success'); - availabiltyForm.reset(); - availabiltyForm.markAsPristine(); - this.calendarOptions = null; this.initializeCalender(); } - - else - { this.confirmationService.alert(res.errorMessage, 'warn'); } - }, - error: (error: any) => { - if (error && error.error) { - this.confirmationService.alert(error.error, 'warn'); } - }, - });} - - markNonAvailability(availabiltyForm: any, nonAvailabilityFormValue: any) { - this.schedulerService.markNonAvailability(nonAvailabilityFormValue) - .subscribe({next:(res: any) => { + markAvailability(availabiltyForm: FormGroup, availabilityFormValue: any) { + this.schedulerService.markAvailability(availabilityFormValue).subscribe({ + next: (res: any) => { if (res.statusCode == 200 && res.data) { - this.confirmationService.alert(this.currentLanguageSet.markedSuccessfully, 'success'); + this.confirmationService.alert( + this.currentLanguageSet.markedSuccessfully, + 'success', + ); availabiltyForm.reset(); availabiltyForm.markAsPristine(); - this.initDayList(); - this.ucCalendar.getApi().removeAllEventSources(); - this.getMonthEvents(new Date()); + this.calendarOptions = null; + this.initializeCalender(); } else { this.confirmationService.alert(res.errorMessage, 'warn'); } - }, + }, error: (error: any) => { - this.confirmationService.alert(error, 'warn'); - }}) + if (error && error.error) { + this.confirmationService.alert(error.error, 'warn'); + } + }, + }); + } + + markNonAvailability(availabiltyForm: any, nonAvailabilityFormValue: any) { + this.schedulerService + .markNonAvailability(nonAvailabilityFormValue) + .subscribe({ + next: (res: any) => { + if (res.statusCode == 200 && res.data) { + this.confirmationService.alert( + this.currentLanguageSet.markedSuccessfully, + 'success', + ); + availabiltyForm.reset(); + availabiltyForm.markAsPristine(); + this.initDayList(); + this.ucCalendar.getApi().removeAllEventSources(); + this.getMonthEvents(new Date()); + } else { + this.confirmationService.alert(res.errorMessage, 'warn'); + } + }, + error: (error: any) => { + this.confirmationService.alert(error, 'warn'); + }, + }); } clickButton(model: any) { - let temp = model.data as Moment; + const temp = model.data as Moment; this.ucCalendar.getApi().removeAllEventSources(); this.getMonthEvents(temp.toDate()); } initCalender(eventSources?: any) { this.calendarOptions = { - themeSystem: "bootstrap3", + themeSystem: 'bootstrap3', editable: false, eventLimit: true, header: { left: 'prev,next', center: 'title', - right: 'month,listMonth' + right: 'month,listMonth', }, displayEventEnd: true, displayEventTime: true, timeFormat: 'HH:mm', - eventSources: eventSources || [] + eventSources: eventSources || [], } as any; } getMonthEvents(date?: Date) { if (!date) date = new Date(); - let userInfo = { userID: this.selectedSpecialist.userID }; + const userInfo = { userID: this.selectedSpecialist.userID }; - this.schedulerService.getAllEvents(userInfo, date.getFullYear(), date.getMonth() + 1) + this.schedulerService + .getAllEvents(userInfo, date.getFullYear(), date.getMonth() + 1) .subscribe((res: any) => { if (res.statusCode == 200 && res.data) { - let eventSourceList = res.data; - let eventSources = this.mapResponseToEventSources(eventSourceList); - eventSources.forEach(eventSource => { + const eventSourceList = res.data; + const eventSources = this.mapResponseToEventSources(eventSourceList); + eventSources.forEach((eventSource) => { this.ucCalendar.getApi().addEventSource(eventSource); }); } else { @@ -232,46 +256,50 @@ export class TimesheetComponent implements OnInit, OnChanges { } getSpecialisationMaster() { - this.schedulerService.getSpecializationMaster() - .subscribe((res: any) => { - if (res.statusCode == 200 && res.data) { - this.specializationMaster = res.data; - } - }); + this.schedulerService.getSpecializationMaster().subscribe((res: any) => { + if (res.statusCode == 200 && res.data) { + this.specializationMaster = res.data; + } + }); } - getSpecialist() { + getSpecialist() { this.ucCalendar.getApi().removeAllEventSources(); this.selectedSpecialist = undefined; this.availabiltyForm.reset(); - let providerServiceMapID = localStorage.getItem("tm-providerServiceMapID"); - let userID = localStorage.getItem("tm-userID"); - let specializationID = this.selectedSpecialization.specializationID; - this.schedulerService.getSpecialist({ specializationID, providerServiceMapID, userID }) - .subscribe({next: (res: any) => { - if (res.statusCode == 200 && res.data) { - this.specialistList = res.data; - } else { + const providerServiceMapID = localStorage.getItem( + 'tm-providerServiceMapID', + ); + const userID = localStorage.getItem('tm-userID'); + const specializationID = this.selectedSpecialization.specializationID; + this.schedulerService + .getSpecialist({ specializationID, providerServiceMapID, userID }) + .subscribe({ + next: (res: any) => { + if (res.statusCode == 200 && res.data) { + this.specialistList = res.data; + } else { + this.specialistList = []; + } + }, + error: (error: any) => { this.specialistList = []; - } - }, - error: (error: any) => { - this.specialistList = []; - }}) + }, + }); } mapResponseToEventSources(eventSourceList: any) { - let temp: any[] = []; + const temp: any[] = []; eventSourceList.forEach((eventSource: any) => { const dateObj = new Date(eventSource.configuredDate); const yearMonthDay = this.getDateString(dateObj); eventSource.slots.forEach((slot: any) => { - let events = []; - let color = slot.status == "Available" ? 'green' : 'red'; + const events = []; + const color = slot.status == 'Available' ? 'green' : 'red'; events.push({ start: yearMonthDay + 'T' + slot.fromTime + 'Z', - end: yearMonthDay + 'T' + slot.toTime + 'Z' + end: yearMonthDay + 'T' + slot.toTime + 'Z', }); temp.push({ events, color }); }); @@ -281,60 +309,68 @@ export class TimesheetComponent implements OnInit, OnChanges { createAvailabiltyForm() { this.availabiltyForm = this.fb.group({ - "configuredFromDate": null, - "configuredToDate": null, - "configuredFromTime": null, - "configuredToTime": null, - "isAvailability": null, - }) + configuredFromDate: null, + configuredToDate: null, + configuredFromTime: null, + configuredToTime: null, + isAvailability: null, + }); } initDayList() { - this.dayList = [ { - name: "S", - isWeedend: true, - isSelected: false - }, + this.dayList = [ + { + name: 'S', + isWeedend: true, + isSelected: false, + }, { - name: "M", + name: 'M', isWeedend: false, - isSelected: false - }, { - name: "T", + isSelected: false, + }, + { + name: 'T', isWeedend: false, - isSelected: false - }, { - name: "W", + isSelected: false, + }, + { + name: 'W', isWeedend: false, - isSelected: false - }, { - name: "T", + isSelected: false, + }, + { + name: 'T', isWeedend: false, - isSelected: false - }, { - name: "F", + isSelected: false, + }, + { + name: 'F', isWeedend: false, - isSelected: false - }, { - name: "S", + isSelected: false, + }, + { + name: 'S', isWeedend: true, - isSelected: false - } + isSelected: false, + }, ]; } initTimeList() { for (let i = 0; i < 24; i++) { for (let j = 0; j < 60; j = j + 5) { - let hours = i.toString().length == 1 ? 0 + i.toString() : i.toString(); - let minutes = j.toString().length == 1 ? 0 + j.toString() : j.toString(); - this.timeList.push(hours + ":" + minutes + ":00"); + const hours = + i.toString().length == 1 ? 0 + i.toString() : i.toString(); + const minutes = + j.toString().length == 1 ? 0 + j.toString() : j.toString(); + this.timeList.push(hours + ':' + minutes + ':00'); } } } getExcludedDays(dateArray: any) { - let excludedDays: any[] = []; + const excludedDays: any[] = []; dateArray.forEach((element: any, index: any) => { if (element.isSelected) excludedDays.push(index); }); @@ -344,21 +380,21 @@ export class TimesheetComponent implements OnInit, OnChanges { getDateString(dateObj: any) { let dd: any = dateObj.getDate(); let mm: any = dateObj.getMonth() + 1; - let yyyy = dateObj.getFullYear(); + const yyyy = dateObj.getFullYear(); if (dd < 10) { - dd = '0' + dd + dd = '0' + dd; } if (mm < 10) { - mm = '0' + mm + mm = '0' + mm; } return yyyy + '-' + mm + '-' + dd; } startOfDate(dateString: any) { - let start = new Date(dateString); + const start = new Date(dateString); start.setHours(0, 0, 0, 0); return start; } @@ -368,16 +404,14 @@ export class TimesheetComponent implements OnInit, OnChanges { } get configuredFromDate() { - let fd = this.availabiltyForm.controls['configuredFromDate'].value; - if (fd) - fd.setHours(0, 0, 0, 0); + const fd = this.availabiltyForm.controls['configuredFromDate'].value; + if (fd) fd.setHours(0, 0, 0, 0); return fd; } get configuredToDate() { - let td = this.availabiltyForm.controls['configuredToDate'].value; - if (td) - td.setHours(0, 0, 0, 0); + const td = this.availabiltyForm.controls['configuredToDate'].value; + if (td) td.setHours(0, 0, 0, 0); return td; } @@ -385,13 +419,16 @@ export class TimesheetComponent implements OnInit, OnChanges { return this.availabiltyForm.controls['configuredFromTime'].value; } - configuredToDateBoolean: boolean = true; + configuredToDateBoolean = true; resetFormValue() { this.configuredToDateBoolean = true; this.availabiltyForm.patchValue({ - configuredFromDate: null, configuredToDate: null, configuredFromTime: null, configuredToTime: null - }) + configuredFromDate: null, + configuredToDate: null, + configuredFromTime: null, + configuredToTime: null, + }); if (this.isAvailability === 'true') { this.availabiltyForm.get('configuredToDate')!.clearValidators(); } else { @@ -400,14 +437,14 @@ export class TimesheetComponent implements OnInit, OnChanges { } //AN40085822 27/9/2021 Integrating Multilingual Functionality --Start-- - ngDoCheck(){ + ngDoCheck() { this.fetchLanguageResponse(); } fetchLanguageResponse() { this.languageComponent = new SetLanguageComponent(this.httpServiceService); this.languageComponent.setLanguage(); - this.currentLanguageSet = this.languageComponent.currentLanguageObject; + this.currentLanguageSet = this.languageComponent.currentLanguageObject; } //--End-- } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index e0af10d..e6600f8 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,25 +6,24 @@ const routes: Routes = [ { path: '', redirectTo: 'redirin', - pathMatch: 'full' + pathMatch: 'full', }, { - path:'redirin', - component: RedirOpenComponent + path: 'redirin', + component: RedirOpenComponent, }, { path: 'telemedicine', canActivate: [AuthGuard], loadChildren: () => import('./app-modules/scheduler/scheduler.module').then( - (x) => x.SchedulerModule - + (x) => x.SchedulerModule, ), - } + }, ]; @NgModule({ imports: [RouterModule.forRoot(routes, { useHash: true })], - exports: [RouterModule] + exports: [RouterModule], }) -export class AppRoutingModule { } +export class AppRoutingModule {} diff --git a/src/app/app.component.html b/src/app/app.component.html index 4e014ad..875e765 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 336f641..115cd31 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -3,10 +3,12 @@ import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(() => TestBed.configureTestingModule({ - imports: [RouterTestingModule], - declarations: [AppComponent] - })); + beforeEach(() => + TestBed.configureTestingModule({ + imports: [RouterTestingModule], + declarations: [AppComponent], + }), + ); it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); @@ -24,6 +26,8 @@ describe('AppComponent', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.nativeElement as HTMLElement; - expect(compiled.querySelector('.content span')?.textContent).toContain('scheduler-ui app is running!'); + expect(compiled.querySelector('.content span')?.textContent).toContain( + 'scheduler-ui app is running!', + ); }); }); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 1d2250b..d957abe 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,27 +1,42 @@ -import { Component } from '@angular/core'; -import { NavigationCancel, NavigationEnd, NavigationError, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, Router } from '@angular/router'; +import { Component, OnInit } from '@angular/core'; +import { + NavigationCancel, + NavigationEnd, + NavigationError, + ResolveStart, + RouteConfigLoadEnd, + RouteConfigLoadStart, + Router, +} from '@angular/router'; import { SpinnerService } from './app-modules/core/services/spinner.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.css'] + styleUrls: ['./app.component.css'], }) -export class AppComponent { +export class AppComponent implements OnInit { constructor( private router: Router, - private spinnerService: SpinnerService) { } + private spinnerService: SpinnerService, + ) {} ngOnInit() { - this.router.events.subscribe(event => { - if (event instanceof ResolveStart || event instanceof RouteConfigLoadStart) { + this.router.events.subscribe((event) => { + if ( + event instanceof ResolveStart || + event instanceof RouteConfigLoadStart + ) { this.spinnerService.show(); - } else if (event instanceof NavigationEnd || event instanceof RouteConfigLoadEnd) { - setTimeout(() =>this.spinnerService.hide(), 500); + } else if ( + event instanceof NavigationEnd || + event instanceof RouteConfigLoadEnd + ) { + setTimeout(() => this.spinnerService.hide(), 500); } else if (event instanceof NavigationError) { - setTimeout(() =>this.spinnerService.hide(), 500); - } else if (() =>event instanceof NavigationCancel) { - setTimeout(() =>this.spinnerService.hide(), 500); + setTimeout(() => this.spinnerService.hide(), 500); + } else if (event instanceof NavigationCancel) { + setTimeout(() => this.spinnerService.hide(), 500); } }); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ff86069..8870ac7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -4,28 +4,24 @@ import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import {MatIconModule} from '@angular/material/icon'; +import { MatIconModule } from '@angular/material/icon'; import { MatFormFieldModule } from '@angular/material/form-field'; -import {MatDialogModule} from '@angular/material/dialog'; -import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatDialogModule } from '@angular/material/dialog'; +import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatInputModule } from '@angular/material/input'; import { MatTooltipModule } from '@angular/material/tooltip'; -import { FullCalendarModule } from '@fullcalendar/angular'; +import { FullCalendarModule } from '@fullcalendar/angular'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatButtonModule } from '@angular/material/button'; import { MatTableModule } from '@angular/material/table'; import { CoreModule } from './app-modules/core/core.module'; import { CommonModule } from '@angular/common'; -import {WebcamModule} from 'ngx-webcam'; +import { WebcamModule } from 'ngx-webcam'; import { MatMenuModule } from '@angular/material/menu'; import { NgChartsModule } from 'ng2-charts'; - - @NgModule({ - declarations: [ - AppComponent - ], + declarations: [AppComponent], imports: [ BrowserModule, AppRoutingModule, @@ -47,11 +43,7 @@ import { NgChartsModule } from 'ng2-charts'; WebcamModule, MatMenuModule, NgChartsModule, - CoreModule.forRoot() - - - - + CoreModule.forRoot(), ], providers: [ // HttpClient, @@ -61,6 +53,6 @@ import { NgChartsModule } from 'ng2-charts'; // multi: true, // }, ], - bootstrap: [AppComponent] + bootstrap: [AppComponent], }) -export class AppModule { } +export class AppModule {} diff --git a/src/app/redir-open/redir-open.component.html b/src/app/redir-open/redir-open.component.html index 9a52906..270866c 100644 --- a/src/app/redir-open/redir-open.component.html +++ b/src/app/redir-open/redir-open.component.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/app/redir-open/redir-open.component.spec.ts b/src/app/redir-open/redir-open.component.spec.ts index 5160886..550ae46 100644 --- a/src/app/redir-open/redir-open.component.spec.ts +++ b/src/app/redir-open/redir-open.component.spec.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RedirOpenComponent } from './redir-open.component'; @@ -29,9 +29,8 @@ describe('RedirOpenComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RedirOpenComponent ] - }) - .compileComponents(); + declarations: [RedirOpenComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/redir-open/redir-open.component.ts b/src/app/redir-open/redir-open.component.ts index da58d7e..41c2c60 100644 --- a/src/app/redir-open/redir-open.component.ts +++ b/src/app/redir-open/redir-open.component.ts @@ -1,26 +1,32 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ import { Component, OnInit } from '@angular/core'; -import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationError } from '@angular/router'; +import { + Router, + ActivatedRoute, + NavigationStart, + NavigationEnd, + NavigationError, +} from '@angular/router'; import { SpinnerService } from '../app-modules/core/services/spinner.service'; import { Location } from '@angular/common'; import { AuthService } from '../app-modules/core/services/auth.service'; @@ -29,10 +35,9 @@ import { ConfirmationService } from '../app-modules/core/services/confirmation.s @Component({ selector: 'app-redir-open', templateUrl: './redir-open.component.html', - styleUrls: ['./redir-open.component.css'] + styleUrls: ['./redir-open.component.css'], }) export class RedirOpenComponent implements OnInit { - externalSession = { protocol: '', host: '', @@ -41,7 +46,7 @@ export class RedirOpenComponent implements OnInit { parentApp: '', auth: '', username: '', - } + }; constructor( private router: Router, @@ -50,40 +55,51 @@ export class RedirOpenComponent implements OnInit { private location: Location, private auth: AuthService, private confirmationService: ConfirmationService, - private authService: AuthService) { } + private authService: AuthService, + ) {} ngOnInit() { this.extractExternalSessionDetailsFromUrl(); this.setRouteStrate(); } - setRouteStrate() { + setRouteStrate() { this.router.events.subscribe((event: any) => { if (event instanceof NavigationStart) { this.spinnerService.show(); } else if (event instanceof NavigationEnd) { - setTimeout(() =>this.spinnerService.hide(), 500); + setTimeout(() => this.spinnerService.hide(), 500); } else if (event instanceof NavigationError) { - setTimeout(() =>this.spinnerService.hide(), 500); + setTimeout(() => this.spinnerService.hide(), 500); } else { - setTimeout(() =>this.spinnerService.hide()); + setTimeout(() => this.spinnerService.hide()); } }); } extractExternalSessionDetailsFromUrl() { - let params = this.route.snapshot.queryParams; - this.externalSession.protocol = params['protocol'] === 'undefined' ? undefined : params['protocol']; - this.externalSession.host = params['host'] === 'undefined' ? undefined : params['host']; - this.externalSession.fallbackURL = params['fallback'] === 'undefined' ? undefined : params['fallback']; - this.externalSession.returnURL = params['back'] === 'undefined' ? undefined : params['back']; - this.externalSession.parentApp = params['app'] === 'undefined' ? undefined : params['app']; - this.externalSession.auth = params['user'] === 'undefined' ? undefined : params['user']; + const params = this.route.snapshot.queryParams; + this.externalSession.protocol = + params['protocol'] === 'undefined' ? undefined : params['protocol']; + this.externalSession.host = + params['host'] === 'undefined' ? undefined : params['host']; + this.externalSession.fallbackURL = + params['fallback'] === 'undefined' ? undefined : params['fallback']; + this.externalSession.returnURL = + params['back'] === 'undefined' ? undefined : params['back']; + this.externalSession.parentApp = + params['app'] === 'undefined' ? undefined : params['app']; + this.externalSession.auth = + params['user'] === 'undefined' ? undefined : params['user']; if (this.externalSession && this.externalSession.auth) { sessionStorage.setItem('tm-key', this.externalSession.auth); - sessionStorage.setItem('tm-parentLogin', `${this.externalSession.protocol}//${this.externalSession.host}`); + sessionStorage.setItem( + 'tm-parentLogin', + `${this.externalSession.protocol}//${this.externalSession.host}`, + ); this.validateSessionKey(); } else { - this.confirmationService.alert("Can't access telemedicine directly") + this.confirmationService + .alert("Can't access telemedicine directly") .subscribe((res: any) => { this.auth.removeExternalSessionData(); this.location.back(); @@ -92,30 +108,46 @@ export class RedirOpenComponent implements OnInit { } validateSessionKey() { - this.authService.validateSessionKey() - .subscribe({next:(res: any) => { - debugger; - + this.authService.validateSessionKey().subscribe({ + next: (res: any) => { if (res.statusCode == 200 && res.data) { - let TMPrevilegeObj = res.data.previlegeObj.filter((previlege: any) => { - if (previlege.roles[0].serviceRoleScreenMappings[0].providerServiceMapping.serviceID == '4') { - return previlege; - } - }); + const TMPrevilegeObj = res.data.previlegeObj.filter( + (previlege: any) => { + if ( + previlege.roles[0].serviceRoleScreenMappings[0] + .providerServiceMapping.serviceID == '4' + ) { + return previlege; + } + }, + ); if (TMPrevilegeObj && TMPrevilegeObj.length > 0) { - let roles = this.getUserRoles(TMPrevilegeObj[0]); - let designation = this.getUserDesignation(res.data); + const roles = this.getUserRoles(TMPrevilegeObj[0]); + const designation = this.getUserDesignation(res.data); - let providerServiceMapID = TMPrevilegeObj[0].providerServiceMapID; - sessionStorage.setItem("apimanClientKey", TMPrevilegeObj[0].apimanClientKey); - let userName = res.data.userName; - let userID = res.data.userID; - this.storeExernalSessionData(this.externalSession, { providerServiceMapID, userName, designation, userID, roles }); - if (roles.length == 1 && roles[0] == 'Supervisor' && designation == 'Supervisor') { + const providerServiceMapID = TMPrevilegeObj[0].providerServiceMapID; + sessionStorage.setItem( + 'apimanClientKey', + TMPrevilegeObj[0].apimanClientKey, + ); + const userName = res.data.userName; + const userID = res.data.userID; + this.storeExernalSessionData(this.externalSession, { + providerServiceMapID, + userName, + designation, + userID, + roles, + }); + if ( + roles.length == 1 && + roles[0] == 'Supervisor' && + designation == 'Supervisor' + ) { this.router.navigate(['/telemedicine/myStaff']); } else { - this.router.navigate(['/telemedicine/timesheet/', designation]) + this.router.navigate(['/telemedicine/timesheet/', designation]); } } else { this.goBackToOrigin("Don't have previlege for TM"); @@ -123,24 +155,33 @@ export class RedirOpenComponent implements OnInit { } else { this.goBackToOrigin(res.errorMessage); } - }, - error:error => { + }, + error: (error) => { this.goBackToOrigin(error); - }}) + }, + }); } goBackToOrigin(error: any) { - this.confirmationService.alert(error, 'error') - .subscribe((res: any) => { - this.auth.removeExternalSessionData(); - this.location.back(); - }); + this.confirmationService.alert(error, 'error').subscribe((res: any) => { + this.auth.removeExternalSessionData(); + this.location.back(); + }); } storeExernalSessionData(externalSession: any, loginResponse: any) { - sessionStorage.setItem('tm-fallback', `${this.externalSession.protocol}//${this.externalSession.host}#${this.externalSession.fallbackURL}`); - sessionStorage.setItem('tm-return', `${this.externalSession.protocol}//${this.externalSession.host}#${this.externalSession.returnURL}`); - sessionStorage.setItem('tm-parentLogin', `${this.externalSession.protocol}//${this.externalSession.host}`); + sessionStorage.setItem( + 'tm-fallback', + `${this.externalSession.protocol}//${this.externalSession.host}#${this.externalSession.fallbackURL}`, + ); + sessionStorage.setItem( + 'tm-return', + `${this.externalSession.protocol}//${this.externalSession.host}#${this.externalSession.returnURL}`, + ); + sessionStorage.setItem( + 'tm-parentLogin', + `${this.externalSession.protocol}//${this.externalSession.host}`, + ); sessionStorage.setItem('tm-host', `${this.externalSession.parentApp}`); sessionStorage.setItem('tm-key', this.externalSession.auth); sessionStorage.setItem('tm-isAuthenticated', 'true'); @@ -148,7 +189,10 @@ export class RedirOpenComponent implements OnInit { localStorage.setItem('tm-roles', JSON.stringify(loginResponse.roles)); localStorage.setItem('tm-designation', loginResponse.designation); localStorage.setItem('tm-userName', loginResponse.userName); - localStorage.setItem('tm-providerServiceMapID', loginResponse.providerServiceMapID); + localStorage.setItem( + 'tm-providerServiceMapID', + loginResponse.providerServiceMapID, + ); localStorage.setItem('tm-userID', loginResponse.userID); } @@ -160,14 +204,18 @@ export class RedirOpenComponent implements OnInit { } getUserRoles(serviceData: any) { - let roleArray: any[] = []; + const roleArray: any[] = []; if (serviceData && serviceData.roles) { - let rolesData = serviceData.roles; + const rolesData = serviceData.roles; rolesData.forEach((role: any) => { if (role && role.serviceRoleScreenMappings) { role.serviceRoleScreenMappings.forEach((serviceRole: any) => { - if (serviceRole && serviceRole.screen && serviceRole.screen.screenName) - roleArray.push(serviceRole.screen.screenName) + if ( + serviceRole && + serviceRole.screen && + serviceRole.screen.screenName + ) + roleArray.push(serviceRole.screen.screenName); }); } }); @@ -177,10 +225,12 @@ export class RedirOpenComponent implements OnInit { getUserDesignation(loginDataResponse: any) { let designation; - if (loginDataResponse.designation && loginDataResponse.designation.designationName) { + if ( + loginDataResponse.designation && + loginDataResponse.designation.designationName + ) { designation = loginDataResponse.designation.designationName; } return designation; } - } diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index 475f556..da823a1 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ // The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. @@ -91,6 +91,6 @@ export const environment = { licenseUrl: `${COMMON_API}license.html`, apiVersionUrl: `${SCHEDULER_API}version`, - // Language List - getLanguageList: `${COMMON_API}beneficiary/getLanguageList` + // Language List + getLanguageList: `${COMMON_API}beneficiary/getLanguageList`, }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 475f556..da823a1 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ // The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. @@ -91,6 +91,6 @@ export const environment = { licenseUrl: `${COMMON_API}license.html`, apiVersionUrl: `${SCHEDULER_API}version`, - // Language List - getLanguageList: `${COMMON_API}beneficiary/getLanguageList` + // Language List + getLanguageList: `${COMMON_API}beneficiary/getLanguageList`, }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ceb303e..604f582 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ // The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. @@ -94,8 +94,8 @@ export const environment = { getMonthlyReportsUrl: `${TM_API}TMReport/MonthlyReport`, getDailyReportUrl: `${TM_API}TMReport/DailyReport`, licenseUrl: `${COMMON_API}license.html`, - apiVersionUrl:`${SCHEDULER_API}version`, + apiVersionUrl: `${SCHEDULER_API}version`, - // Language List - getLanguageList: `${COMMON_API}beneficiary/getLanguageList` + // Language List + getLanguageList: `${COMMON_API}beneficiary/getLanguageList`, }; diff --git a/src/index.html b/src/index.html index ab848aa..a8357bb 100644 --- a/src/index.html +++ b/src/index.html @@ -1,27 +1,23 @@ + + + Tele Medicine Unit + - - - Tele Medicine Unit - - - - - - - - - - - - We are loading your data.....Kindly wait ......... - + + + + + + + + + We are loading your data.....Kindly wait ......... + diff --git a/src/main.ts b/src/main.ts index c58dc05..17a5cd4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,6 +2,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; - -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.error(err)); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/src/test.ts b/src/test.ts index 81fa6be..8092b1a 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1,24 +1,24 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/long-stack-trace-zone'; @@ -30,7 +30,7 @@ import 'zone.js/dist/fake-async-test'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, - platformBrowserDynamicTesting + platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. @@ -38,12 +38,12 @@ declare const __karma__: any; declare const require: any; // Prevent Karma from running prematurely. -__karma__.loaded = function () {}; +// __karma__.loaded = function () {}; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/src/typings.d.ts b/src/typings.d.ts index d31bd05..1031034 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -1,26 +1,26 @@ /* -* AMRIT – Accessible Medical Records via Integrated Technology -* Integrated EHR (Electronic Health Records) Solution -* -* Copyright (C) "Piramal Swasthya Management and Research Institute" -* -* This file is part of AMRIT. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see https://www.gnu.org/licenses/. -*/ + * AMRIT – Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ /* SystemJS module definition */ -declare var module: NodeModule; +declare let module: NodeModule; interface NodeModule { id: string; } From 2b3f00030d751f79aff92d5c213f4cad4e059960 Mon Sep 17 00:00:00 2001 From: Parth Kothari Date: Tue, 16 Jan 2024 20:42:44 +0530 Subject: [PATCH 2/3] Resolved Merged conflicts --- src/app/app.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d957abe..7c95e2d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -36,6 +36,7 @@ export class AppComponent implements OnInit { } else if (event instanceof NavigationError) { setTimeout(() => this.spinnerService.hide(), 500); } else if (event instanceof NavigationCancel) { + // Arrow Function Key Added setTimeout(() => this.spinnerService.hide(), 500); } }); From 3feccb1e041e1ba7a7bc24fc46e4747af357b812 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 06:11:09 +0000 Subject: [PATCH 3/3] Bump ngx-bootstrap from 11.0.0 to 11.0.2 Bumps [ngx-bootstrap](https://github.com/valor-software/ngx-bootstrap) from 11.0.0 to 11.0.2. - [Release notes](https://github.com/valor-software/ngx-bootstrap/releases) - [Changelog](https://github.com/valor-software/ngx-bootstrap/blob/development/CHANGELOG.md) - [Commits](https://github.com/valor-software/ngx-bootstrap/compare/v11.0.0...v11.0.2) --- updated-dependencies: - dependency-name: ngx-bootstrap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index d2f0b12..9b18c21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "html2canvas": "^1.4.1", "moment": "^2.29.4", "ng2-charts": "^5.0.4", - "ngx-bootstrap": "^11.0.0", + "ngx-bootstrap": "^11.0.2", "ngx-webcam": "^0.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", @@ -12737,9 +12737,9 @@ } }, "node_modules/ngx-bootstrap": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-11.0.0.tgz", - "integrity": "sha512-AQvoAwk10Deiyr+NARwLAQ2MG7IhQHeXSCGTVf80e1w2vNaJg1xrR3ubbSEBigfAXAWadGGKbBF2An1WRnm6uA==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-11.0.2.tgz", + "integrity": "sha512-McvQ72XB6692Jus47jahWWwjpSCa6EtHMIqoyMewKCEHMv0ybDgVnOAdEsWKvwfulowHn7Y/jDjeiURwYJG9cQ==", "dependencies": { "tslib": "^2.3.0" }, @@ -27173,9 +27173,9 @@ } }, "ngx-bootstrap": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-11.0.0.tgz", - "integrity": "sha512-AQvoAwk10Deiyr+NARwLAQ2MG7IhQHeXSCGTVf80e1w2vNaJg1xrR3ubbSEBigfAXAWadGGKbBF2An1WRnm6uA==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-11.0.2.tgz", + "integrity": "sha512-McvQ72XB6692Jus47jahWWwjpSCa6EtHMIqoyMewKCEHMv0ybDgVnOAdEsWKvwfulowHn7Y/jDjeiURwYJG9cQ==", "requires": { "tslib": "^2.3.0" } diff --git a/package.json b/package.json index f53d000..9bf8421 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "html2canvas": "^1.4.1", "moment": "^2.29.4", "ng2-charts": "^5.0.4", - "ngx-bootstrap": "^11.0.0", + "ngx-bootstrap": "^11.0.2", "ngx-webcam": "^0.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0",