|
|
@ -39,12 +39,24 @@ export class ScheduleAppointmentComponent implements OnInit { |
|
|
|
@ViewChild("scheduleAppointmentPDF") |
|
|
|
scheduleAppointmentPDF!: ElementRef; |
|
|
|
|
|
|
|
constructor(private formBuilder: FormBuilder, private router: Router, private scheduleAppointmentService:ScheduleAppointmentService) {} |
|
|
|
userDetails:any = { |
|
|
|
employeeId:null, |
|
|
|
employeeName:null, |
|
|
|
designation:null, |
|
|
|
department:null, |
|
|
|
level:null, |
|
|
|
location:null, |
|
|
|
date:null, |
|
|
|
gender:null |
|
|
|
}; |
|
|
|
|
|
|
|
constructor(private formBuilder: FormBuilder, private router: Router, private scheduleAppointmentService:ScheduleAppointmentService) { |
|
|
|
this.createNewForm(); |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
this.downloadPDF = false; |
|
|
|
this.getUserDetails() |
|
|
|
this.createNewForm(); |
|
|
|
this.getUserDetails(); |
|
|
|
this.initiateForm(); |
|
|
|
} |
|
|
|
|
|
|
@ -63,12 +75,33 @@ export class ScheduleAppointmentComponent implements OnInit { |
|
|
|
this.todayDate.setDate(this.todayDate.getDate() + 1); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description to create the new form on the initialization of the component. |
|
|
|
* @returns Void(); |
|
|
|
*/ |
|
|
|
createNewForm(): void { |
|
|
|
this.scheduleAppointmentForm = this.formBuilder.group({ |
|
|
|
employeeId: [{ value: '', disabled: true }, Validators.required], |
|
|
|
employeeName: [{ value: '', disabled: true }, Validators.required], |
|
|
|
level: [{ value: '', disabled: true }, Validators.required], |
|
|
|
designation: [ |
|
|
|
{ value: '', disabled: true }, |
|
|
|
Validators.required, |
|
|
|
], |
|
|
|
department: [{ value: '', disabled: true }], |
|
|
|
location: [{ value: '', disabled: true }], |
|
|
|
eligiblePackage: [{ value: "eligiblePackage", disabled: true }], |
|
|
|
preferredDate: ["", Validators.required], |
|
|
|
contactNumber: ["9730370631", Validators.required], |
|
|
|
gender: ["Male"], |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description to create the user details. |
|
|
|
* @returns Void(); |
|
|
|
*/ |
|
|
|
getUserDetails() { |
|
|
|
let response; |
|
|
|
const body = { |
|
|
|
userId: "E114989", |
|
|
|
password: "init1234", |
|
|
@ -79,32 +112,31 @@ export class ScheduleAppointmentComponent implements OnInit { |
|
|
|
.subscribe( |
|
|
|
(res: { StatusCode: number; IsRequestSuccessfull: any; Data: any }) => { |
|
|
|
if (res && res?.StatusCode === 200 && res?.IsRequestSuccessfull) { |
|
|
|
response = res && res?.Data ? res.Data : null; |
|
|
|
this.userDetails = res && res?.Data ? res.Data : null; |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
this.initiateControls(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description to create the new form on the initialization of the component. |
|
|
|
* @returns Void(); |
|
|
|
*/ |
|
|
|
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"], |
|
|
|
}); |
|
|
|
initiateControls(){ |
|
|
|
this.userDetails.employeeId = this.userDetails && this.userDetails?.employeeId?this.userDetails?.employeeId:"12345"; |
|
|
|
this.userDetails.employeeName = this.userDetails && this.userDetails?.employeeName?this.userDetails?.employeeName:"Bajaj"; |
|
|
|
this.userDetails.level = this.userDetails && this.userDetails?.level?this.userDetails?.level:"L3"; |
|
|
|
this.userDetails.designation = this.userDetails &&this.userDetails?.designation?this.userDetails?.designation:"developer"; |
|
|
|
this.userDetails.department = this.userDetails && this.userDetails?.department?this.userDetails?.department:"MIS"; |
|
|
|
this.userDetails.location = this.userDetails && this.userDetails?.location?this.userDetails?.location:"Akrudi"; |
|
|
|
this.userDetails.date = this.userDetails &&this.userDetails?.date?this.userDetails?.date:"22/02/2022"; |
|
|
|
this.userDetails.gender = this.userDetails && this.userDetails?.gender?this.userDetails?.gender:"Male"; |
|
|
|
|
|
|
|
this.scheduleAppointmentForm.get('employeeId')?.setValue(this.userDetails?.employeeId); |
|
|
|
this.scheduleAppointmentForm.get('employeeName')?.setValue(this.userDetails?.employeeName); |
|
|
|
this.scheduleAppointmentForm.get('designation')?.setValue(this.userDetails?.designation); |
|
|
|
this.scheduleAppointmentForm.get('department')?.setValue(this.userDetails?.department); |
|
|
|
this.scheduleAppointmentForm.get('level')?.setValue(this.userDetails?.level); |
|
|
|
this.scheduleAppointmentForm.get('location')?.setValue(this.userDetails?.location); |
|
|
|
this.scheduleAppointmentForm.get('preferredDate')?.setValue(this.userDetails?.date); |
|
|
|
this.scheduleAppointmentForm.get('gender')?.setValue(this.userDetails?.gender); |
|
|
|
} |
|
|
|
|
|
|
|
scheduleAppointmentSubmitForm() { |
|
|
|