From a319f6fb7d1dd6c7b8ba34dbfa30d2d5a301999c Mon Sep 17 00:00:00 2001 From: ganga satish kumar Date: Fri, 11 Feb 2022 00:48:03 +0530 Subject: [PATCH] review comments --- .../add-dependants.component.html | 4 +- .../add-dependants.component.scss | 6 + .../add-dependants.component.ts | 13 +- .../generate-letter.component.ts | 180 +++++++------- .../schedule-appointment.component.html | 220 +++++++++++------- .../schedule-appointment.component.ts | 161 +++++++++---- src/constants/constants.ts | 33 +-- 7 files changed, 375 insertions(+), 242 deletions(-) diff --git a/src/app/annual-health-checkup/add-dependants/add-dependants.component.html b/src/app/annual-health-checkup/add-dependants/add-dependants.component.html index 16c3248c..cee063e7 100644 --- a/src/app/annual-health-checkup/add-dependants/add-dependants.component.html +++ b/src/app/annual-health-checkup/add-dependants/add-dependants.component.html @@ -1,4 +1,5 @@
+ arrow_back_ios_new
-
+
-
\ No newline at end of file diff --git a/src/app/annual-health-checkup/add-dependants/add-dependants.component.scss b/src/app/annual-health-checkup/add-dependants/add-dependants.component.scss index f413f960..dd5a3ebe 100644 --- a/src/app/annual-health-checkup/add-dependants/add-dependants.component.scss +++ b/src/app/annual-health-checkup/add-dependants/add-dependants.component.scss @@ -2,6 +2,9 @@ padding: 5%; margin-bottom: 2.5em; height: auto; + .back-icon{ + margin-top: 5% !important; + } .align-middle{ width: 100% !important; .input-field{ @@ -33,5 +36,8 @@ left:5%; background: white !important; } + hr:last-child(){ + display: none; + } } \ No newline at end of file diff --git a/src/app/annual-health-checkup/add-dependants/add-dependants.component.ts b/src/app/annual-health-checkup/add-dependants/add-dependants.component.ts index f708afdf..bbb7e744 100644 --- a/src/app/annual-health-checkup/add-dependants/add-dependants.component.ts +++ b/src/app/annual-health-checkup/add-dependants/add-dependants.component.ts @@ -1,6 +1,7 @@ import { Component, ElementRef, OnInit, ViewChild } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { GENDER_LIST } from "src/constants/constants"; +import { Router } from "@angular/router"; +import { GENDER_LIST, SCHEDULE_APPOINTMENT } from "src/constants/constants"; @Component({ selector: "app-add-dependants", @@ -19,7 +20,7 @@ export class AddDependantsComponent implements OnInit { isMaxCount: boolean = false; genderList = GENDER_LIST; - constructor(private formBuilder: FormBuilder) { + constructor(private formBuilder: FormBuilder, private router:Router) { this.createNewForm(); } @@ -41,5 +42,13 @@ export class AddDependantsComponent implements OnInit { } else { this.isMaxCount = true; } + + if(this.counterArr.length === 6){ + this.isMaxCount = true; + } + } + + navigateToPrevious(){ + this.router.navigate([SCHEDULE_APPOINTMENT]); } } \ No newline at end of file diff --git a/src/app/annual-health-checkup/generate-letter/generate-letter.component.ts b/src/app/annual-health-checkup/generate-letter/generate-letter.component.ts index 9952ae1d..05f59fe8 100644 --- a/src/app/annual-health-checkup/generate-letter/generate-letter.component.ts +++ b/src/app/annual-health-checkup/generate-letter/generate-letter.component.ts @@ -1,124 +1,138 @@ -import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Component, ElementRef, OnInit, ViewChild } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { jsPDF } from "jspdf"; +import * as pdfMake from "pdfmake/build/pdfmake"; +import { GenerateLetterService } from "./generate-letter.service"; -import * as pdfMake from 'pdfmake/build/pdfmake'; -import { GenerateLetterService } from './generate-letter.service'; -//import * as pdfFonts from 'pdfmake / build / vfs_fonts'; - -var pdfFonts = require('pdfmake/build/vfs_fonts.js'); +var pdfFonts = require("pdfmake/build/vfs_fonts.js"); (pdfMake as any).vfs = pdfFonts.pdfMake.vfs; var htmlToPdfmake = require("html-to-pdfmake"); - @Component({ - selector: 'app-generate-letter', - templateUrl: './generate-letter.component.html', - styleUrls: ['./generate-letter.component.scss'] + selector: "app-generate-letter", + templateUrl: "./generate-letter.component.html", + styleUrls: ["./generate-letter.component.scss"], }) export class GenerateLetterComponent implements OnInit { generateLetterForm!: FormGroup; - name = 'Angular Html To Pdf '; - title:string = ''; - location:string = ''; - letterDate:string = ''; - printPDF:boolean = false; - level:string = ''; + name = "Angular Html To Pdf "; + title: string = ""; + location: string = ""; + letterDate: string = ""; + printPDF: boolean = false; + level: string = ""; - @ViewChild('pdfTable', {static: false}) pdfTable: ElementRef | undefined; - @ViewChild('content') - content!: ElementRef; + @ViewChild("pdfTable", { static: false }) pdfTable: ElementRef | undefined; - @ViewChild('generateLetterL0L1') - generateLetterL0L1!:ElementRef; + @ViewChild("generateLetterL0L1") + generateLetterL0L1!: ElementRef; - @ViewChild('generateLetterL3') - generateLetterL3!:ElementRef; + @ViewChild("generateLetterL3") + generateLetterL3!: ElementRef; - downloadPDFlevel3:boolean = false; - downloadPDFlevel0:boolean = false; - isDisabled:boolean = true; + downloadPDFlevel3: boolean = false; + downloadPDFlevel0: boolean = false; + isDisabled: boolean = true; - constructor( private formBuilder: FormBuilder, - private generateLetterService:GenerateLetterService - ) { + private generateLetterService: GenerateLetterService + ) { this.createNewForm(); } + /** + * @description to initialize component + * @returns Void(); + */ ngOnInit(): void { + this.getUserDetails(); + } + + /** + * @description to create the user details. + * @returns Void(); + */ + getUserDetails() { let response; - const body = { - userId: 'E114989', - password: 'init1234' - }; + const body = { + userId: "E114989", + password: "init1234", + }; this.generateLetterService - .saveSelectedBike(body) - .subscribe( - (res: { - StatusCode: number; - IsRequestSuccessfull: any; - Data: any; - }) => { - if (res && res?.StatusCode === 200 && res?.IsRequestSuccessfull){ - response = res && res?.Data ? res.Data : null; - } - }); + .saveSelectedBike(body) + .subscribe( + (res: { StatusCode: number; IsRequestSuccessfull: any; Data: any }) => { + if (res && res?.StatusCode === 200 && res?.IsRequestSuccessfull) { + response = res && res?.Data ? res.Data : null; + } + } + ); } /** * @description to create the new form on the initialization of the component. * @returns Void(); */ - - createNewForm(): void { + createNewForm(): void { this.generateLetterForm = this.formBuilder.group({ - employeeId: [{value:"1234", disabled:true}], - employeeName: [{value:"Satish Ganga", disabled:true}], - designation: [{value:"developer", disabled:true}], - department: [{value:"MIS", disabled:true}], - level: [{value:"L3", disabled:true}], - location: [{value:"Akrudi", disabled:true}], - date: [{value:"22/02/2022", disabled:true}], - gender: [{value:"Male", disabled:true}] + employeeId: [{ value: "1234", disabled: true }], + employeeName: [{ value: "Satish Ganga", disabled: true }], + designation: [{ value: "developer", disabled: true }], + department: [{ value: "MIS", disabled: true }], + level: [{ value: "L3", disabled: true }], + location: [{ value: "Akrudi", disabled: true }], + date: [{ value: "22/02/2022", disabled: true }], + gender: [{ value: "Male", disabled: true }], }); - this.title = this.generateLetterForm?.get('employeeName')?.value; - this.location = this.generateLetterForm?.get('location')?.value; - this.letterDate = this.generateLetterForm?.get('date')?.value; - this.level = this.generateLetterForm?.get('level')?.value; + this.title = this.generateLetterForm?.get("employeeName")?.value; + this.location = this.generateLetterForm?.get("location")?.value; + this.letterDate = this.generateLetterForm?.get("date")?.value; + this.level = this.generateLetterForm?.get("level")?.value; } - - downloadPDF() { - this.printPDF = true; - const doc = new jsPDF(); - const pdfTable:any = this.level === 'L3'? this.generateLetterL3.nativeElement : this.generateLetterL0L1.nativeElement; - - //get table html - //const pdfTable = this.content.nativeElement; - //html to pdf format - var html = htmlToPdfmake(pdfTable.innerHTML); - const documentDefinition = { content: html }; - pdfMake.createPdf(documentDefinition).download(); - this.printPDF = false; - this.downloadPDFlevel3 = false; - this.downloadPDFlevel0 = false; - // doc.save("output.pdf"); - //generateLetterL0L1 + /** + * @description to download PDF + * @returns Void(); + */ + downloadPDF() { + this.printPDF = true; + const doc = new jsPDF(); + const pdfTable: any = + this.level === "L3" + ? this.generateLetterL3.nativeElement + : this.generateLetterL0L1.nativeElement; + + //get table html + //const pdfTable = this.content.nativeElement; + //html to pdf format + var html = htmlToPdfmake(pdfTable.innerHTML); + const documentDefinition = { content: html }; + pdfMake.createPdf(documentDefinition).download(); + this.printPDF = false; + this.downloadPDFlevel3 = false; + this.downloadPDFlevel0 = false; + // doc.save("output.pdf"); } - createEnquirySubmitHandler(){ + /** + * @description to create PDF based on L3, L0, L1. + * @returns Void(); + */ + createEnquirySubmitHandler() { this.printPDF = true; - if(this.level === 'L3'){ + if (this.level === "L3") { this.downloadPDFlevel3 = true; - }else{ + } else { this.downloadPDFlevel0 = true; } } - sendMail():void{ - console.log('sendMail'); + /** + * @description to create the user details. + * @returns Void(); + */ + sendMail(): void { + console.log("sendMail"); } -} - +} \ No newline at end of file diff --git a/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.html b/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.html index 8d4b6991..738b1f7c 100644 --- a/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.html +++ b/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.html @@ -1,92 +1,140 @@
-
-
- - Employee ID - - -
-
- - Employee Name - - -
-
- - Level - - -
-
- - Department - + +
+ + Employee ID + + +
+
+ + Employee Name + + +
+
+ + Level + + +
+
+ + Department + + +
+
+ + Location + + +
+
+ + Select additonal Test + + + {{healthTest}} + + -
-
+
+
- Location - + Eligible Package + + +
+
+ + Hospital Name + + + {{hospital.value}} + + -
-
- - Select additonal Test - - - {{healthTest}} - - - -
-
- - Eligible Package - - - {{package}} - - - -
-
- - Hospital Name - - - {{hospital.value}} - - - -
-
- - Preferred date - - - - - - -
-
- - Contact Number - +
+
+ + Preferred date + + + + + -
-
- Click to downlaod price list for each additional test -
-
- - -
- +
+
+ + Contact Number + + +
+
+ Click to downlaod price list for each additional test +
+
+ + +
+ + +
+
+

Annual Health Check-up 2021-22

+

The rates of optional tests across empanelled hospitals in Pune are as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Hospital NameHIV-I & HIV-II by Tridot/ ELISA technique/HIV RapidHb1AcEye Check Package & Ophthalmologist consultationTreadmill Test
Apollo HospitalRs.500Rs.500Rs.300Rs.1000
PCMC HospitalRs.700Rs.350Rs.400Rs.1000
Deenanath Mangesh HospitalRs.405Rs.405Rs.360Rs.1080
Express ClinicsRs.350Rs.350Rs.450Rs.1000
Ruby Hall ClinicRs.595Rs.808Rs.600Rs.1530
\ No newline at end of file diff --git a/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.ts b/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.ts index 32f78564..d575edc1 100644 --- a/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.ts +++ b/src/app/annual-health-checkup/schedule-appointment/schedule-appointment.component.ts @@ -1,66 +1,137 @@ -import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Router } from '@angular/router'; -import { ADDITIONAL_TEST, ELIGIBLE_PACKAGE, SELECT_HOSPITAL } from 'src/constants/constants'; -import { RouterService } from '../../shared/services/routerService'; - +import { THIS_EXPR } from "@angular/compiler/src/output/output_ast"; +import { Component, ElementRef, OnInit, ViewChild } from "@angular/core"; +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; +import { Router } from "@angular/router"; +import { + SELECT_HOSPITAL, + SENIOR_LEVEL_PACKAGE, + MIDDLE_LEVEL_PACKAGE, + SENIOR_LEVEL_ADDITONAL_TEST, + MIDDLE_LEVEL_ADDITONAL_TEST, + SCHEDULE_APPOINTMENT, + ADD_DEPENDENTS, +} from "src/constants/constants"; +import { jsPDF } from "jspdf"; +import * as pdfMake from "pdfmake/build/pdfmake"; +import { MatSelectChange } from "@angular/material/select"; +var pdfFonts = require("pdfmake/build/vfs_fonts.js"); +(pdfMake as any).vfs = pdfFonts.pdfMake.vfs; +var htmlToPdfmake = require("html-to-pdfmake"); @Component({ - selector: 'app-schedule-appointment', - templateUrl: './schedule-appointment.component.html', - styleUrls: ['./schedule-appointment.component.scss'] + selector: "app-schedule-appointment", + templateUrl: "./schedule-appointment.component.html", + styleUrls: ["./schedule-appointment.component.scss"], }) export class ScheduleAppointmentComponent implements OnInit { + scheduleAppointmentForm!: FormGroup; + name = "Angular Html To Pdf "; + additionalTests: string[] = SENIOR_LEVEL_ADDITONAL_TEST; + hospitalList: any[] = SELECT_HOSPITAL; + todayDate: any = new Date(); + downloadPDF: boolean = false; + level: string = ""; + hospitalObject: any; + additionaltest: any; + interval: any; - generateLetterForm!: FormGroup; - name = 'Angular Html To Pdf '; - additionalTests:string[] = ADDITIONAL_TEST; - hospitalList:any[] = SELECT_HOSPITAL; - eligiblePackage:string[] = ELIGIBLE_PACKAGE; - todayDate:Date = new Date(); + @ViewChild("pdfTable", { static: false }) pdfTable: ElementRef | undefined; + @ViewChild("scheduleAppointmentPDF") + scheduleAppointmentPDF!: ElementRef; - @ViewChild('pdfTable', {static: false}) pdfTable: ElementRef | undefined; - @ViewChild('content') - content!: ElementRef; - - constructor( - private formBuilder: FormBuilder, - private router: Router - ) { - this.createNewForm(); - } + constructor(private formBuilder: FormBuilder, private router: Router) {} ngOnInit(): void { + this.downloadPDF = false; + this.createNewForm(); + let packageName = ""; + this.level = this.scheduleAppointmentForm?.get("level")?.value; + packageName = + this.level === "L3" ? SENIOR_LEVEL_PACKAGE : MIDDLE_LEVEL_PACKAGE; + this.additionalTests = + this.level === "L3" + ? SENIOR_LEVEL_ADDITONAL_TEST + : MIDDLE_LEVEL_ADDITONAL_TEST; + this.scheduleAppointmentForm?.controls["eligiblePackage"].setValue( + packageName + ); + this.todayDate.setDate(this.todayDate.getDate() + 1); } /** * @description to create the new form on the initialization of the component. * @returns Void(); */ - - createNewForm(): void { - this.generateLetterForm = this.formBuilder.group({ - employeeId: [{value:"1234", disabled:true}], - employeeName: [{value:"bajaj", disabled:true}], - level: [{value:"L3", disabled:true}], - designation: [{value:"developer", disabled:true}], - department: [{value:"MIS", disabled:true}], - location: [{value:"Akrudi", disabled:true}], - additonalTest: [""], - eligiblePackage: ["eligiblePackage"], - hospitalName: ["hospitalName"], - preferredDate: ['preferredDate'], - contactNumber: ['9730370631'], - date: ["22/02/2022"], - gender: ["Male"] + createNewForm(): void { + this.scheduleAppointmentForm = this.formBuilder.group({ + employeeId: [{ value: "1234", disabled: true }, Validators.required], + employeeName: [{ value: "bajaj", disabled: true }, Validators.required], + level: [{ value: "L3", disabled: true }, Validators.required], + designation: [ + { value: "developer", disabled: true }, + Validators.required, + ], + department: [{ value: "MIS", disabled: true }], + location: [{ value: "Akrudi", disabled: true }], + eligiblePackage: [{ value: "eligiblePackage", disabled: true }], + preferredDate: ["", Validators.required], + contactNumber: ["9730370631", Validators.required], + gender: ["Male"], }); } - createEnquirySubmitHandler(){ + createEnquirySubmitHandler() { + let responseObject = { + employeeId: this.scheduleAppointmentForm?.get("employeeId")?.value, + employeeName: this.scheduleAppointmentForm?.get("employeeName")?.value, + level: this.level, + department: this.scheduleAppointmentForm?.get("department")?.value, + location: this.scheduleAppointmentForm?.get("location")?.value, + additonalTest: this.additionaltest, + eligiblePackage: + this.scheduleAppointmentForm?.get("eligiblePackage")?.value, + hospitalName: this.hospitalObject, + preferredDate: this.scheduleAppointmentForm?.get("preferredDate")?.value, + contactNumber: this.scheduleAppointmentForm?.get("contactNumber")?.value, + }; + console.log(responseObject); + } + addDependants() { + console.log('click'); + this.router.navigate([ADD_DEPENDENTS]); } - addDependants(){ - this.router.navigate(['addDependants']); + selectHospital(event: MatSelectChange) { + let selectedData; + selectedData = { + value: event.value, + text: event.source.triggerValue, + }; + console.log(selectedData); + this.hospitalObject = selectedData.value; } -} \ No newline at end of file + selectedAdditonalTest(event: MatSelectChange) { + let selectedData; + selectedData = { + value: event.value, + text: event.source.triggerValue, + }; + this.additionaltest = selectedData.value; + } + + downloadAppointment() { + this.downloadPDF = true; + this.interval = setInterval(() => { + const doc = new jsPDF(); + //get table html + const pdfTable = this.scheduleAppointmentPDF?.nativeElement; + //html to pdf format + var html = htmlToPdfmake(pdfTable?.innerHTML); + const documentDefinition = { content: html }; + pdfMake.createPdf(documentDefinition).download(); + this.downloadPDF = false; + clearInterval(this.interval); + }, 1000); + } +} diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 88009bfd..e5a445a2 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -6,26 +6,6 @@ of the constant name and also the naming convention should be in all caps. */ -export const ALPHABETS_STRING = 'abcdefghijklmnopqrstuvwxyz'; -export const NUMBERS_STRING = '0123456789'; -export const SALT_VALUE = 'You can count on my steel'; -export const NO_FINGERPRINT = 'No fingerprint available'; -export const MAX_RETRY_ATTEMPTS = 1; -export const ENDPOINTS_TO_EXCLUDE = { - 'tokenCall': 'oauth2/v6/tokens' -}; -export const CLIENT_ID_FOR_TOKEN_GEN = { - 'SIDWEB': 'SIDWeb' -}; - -export const ADDITIONAL_TEST = [ - 'HIV-I & HIV-II', - 'Tridot/ ELISA', - 'technique/HIV', - 'Rapid', - 'Hb1Ac', 'Eye Check Package', 'Ophthalmologist consultation' -]; - export const SELECT_HOSPITAL = [ {value:'Ruby Hall, Pune', mail:'health@rubyhall.com'}, {value:'Deenanath Mangeshkar Hospital, Pune', mail:'pr@dmhospital.org'}, @@ -40,16 +20,21 @@ export const SELECT_HOSPITAL = [ {value:'Express Clinics, Shop No 18, 19, 20, Empire Estate, Old Mumbai-Pune Highway, Chinchwad, Pune – 411019',mail:'chipnq@expressclinics.in'} ]; -export const ELIGIBLE_PACKAGE = [ - 'Senior Level Package (L0-L1)', - 'Middle Level Package (L2-L3)' -]; +export const MIDDLE_LEVEL_ADDITONAL_TEST= ['HIV-I & HIV-II by Tridot/ ELISA technique/HIV Rapid','Hb1Ac','Eye Check Package & Ophthalmologist consultation']; +export const SENIOR_LEVEL_ADDITONAL_TEST= ['HIV-I & HIV-II by Tridot/ ELISA technique/HIV Rapid','Hb1Ac','Eye Check Package & Ophthalmologist consultation','Treadmill Test']; + +export const SENIOR_LEVEL_PACKAGE = 'Middle Level Package (L2-L3)'; +export const MIDDLE_LEVEL_PACKAGE = 'Senior Level Package (L0-L1)'; export const GENDER_LIST = [ 'Male', 'Female' ]; +export const SCHEDULE_APPOINTMENT = 'scheduleAppointment'; +export const ADD_DEPENDENTS = 'addDependants'; + +