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 99161205..8a9482bc 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
@@ -9,26 +9,26 @@
- Name of Dependant {{i+1}}
+ Name of Dependant {{i+1}} *
- Relation of Employee with Dependant {{i+1}}
+ Relation of Employee with Dependant {{i+1}} *
- Age of Dependant {{i+1}}
+ Age of Dependant {{i+1}} *
- Gender of Dependant {{i+1}}
-
+ Gender of Dependant {{i+1}} *
+
{{gender}}
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 c26bef19..1d45ad06 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,5 +1,6 @@
import { Component, ElementRef, OnInit, ViewChild } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
+import { MatSelectChange } from "@angular/material/select";
import { Router } from "@angular/router";
import { GENDER_LIST, SCHEDULE_APPOINTMENT } from "src/constants/constants";
import { ScheduleAppointmentService } from "../schedule-appointment/schedule-appointment.service";
@@ -29,15 +30,42 @@ export class AddDependantsComponent implements OnInit {
createNewForm(): void {
this.addDependantForm = this.formBuilder.group({
- nameOfDependant: ["John"],
- employeeRelation: ["Brother"],
- age: ["34"],
- gender: ["Male"],
+ nameOfDependant: [''],
+ employeeRelation: [''],
+ age: [''],
+ gender: [''],
});
}
createEnquirySubmitHandler() {
- if (this.counterArr.length < 6) {
+ this.isMaxCount = false;
+ let responeObj = this.addDependantForm.value;
+ let isValidObj = {
+ isValid:false,
+ isNameValid:false,
+ isEmployeeRelation:false,
+ isAgeValid:false,
+ isGenderValid:false
+ }
+ if(responeObj.nameOfDependant.length > 0){
+ isValidObj.isNameValid = true;
+ }
+ if(responeObj.employeeRelation.length > 0){
+ isValidObj.isEmployeeRelation = true;
+ }
+ if(responeObj.age.length > 0){
+ isValidObj.isAgeValid = true;
+ }
+ if(responeObj.gender.length > 0){
+ isValidObj.isGenderValid = true;
+ }
+
+ if(isValidObj.isNameValid && isValidObj.isEmployeeRelation && isValidObj.isAgeValid && isValidObj.isGenderValid){
+ isValidObj.isValid = true;
+ }
+
+ if (isValidObj.isValid && this.counterArr.length < 6) {
+ //this.createNewForm();
this.counter++;
this.counterArr.push(this.counter);
} else {
@@ -55,4 +83,14 @@ export class AddDependantsComponent implements OnInit {
this.scheduleAppointmentService.saveAdditionalDependentDetails(responseObject);
this.router.navigate([SCHEDULE_APPOINTMENT]);
}
+
+ selectGender(event:MatSelectChange){
+ let selectedData;
+ selectedData = {
+ value: event.value,
+ text: event.source.triggerValue,
+ };
+ //this.addDependantForm.form selectedData.value;
+ this.addDependantForm.get('gender')?.setValue(selectedData.value);
+ }
}
\ No newline at end of file