From 1e0396227126eb78b10d98486fbb64512279fcab Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 19 Mar 2019 15:30:35 +0530 Subject: [PATCH] employeement info : ps --- .../employment-info.component.html | 162 +++++++++----- .../employment-info.component.ts | 206 +++++++++++++++--- .../neighbour-hood.component.ts | 6 +- 3 files changed, 285 insertions(+), 89 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html index 9fdec2f52..2abb7946a 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html @@ -20,7 +20,7 @@
- + Select @@ -28,6 +28,11 @@ cl.company_name }} + + + + +

@@ -40,6 +45,17 @@ + + + + Total working Experience is Lower + + + + + +
@@ -49,8 +65,8 @@ No -
- +
+ @@ -60,7 +76,7 @@ - + - - - - +
- - - - - +
+

Date of Salary

+ + + Select + + {{date.date}} + + + + + + Select + + {{date.date}} + + + +
+ + + + OnlyNumber type="text" autocomplete="off" required> {{"₹"}} {{employmentForm.controls['gross_monthly_salary'].value | numberToWords}} Only + OnlyNumber type="text" autocomplete="off" required> {{"₹"}} {{employmentForm.controls['net_monthly_salary'].value | numberToWords}} Only - - {{"₹"}} {{employmentForm.controls['bonus_incentive'].value | numberToWords}} Only + + {{"₹"}} {{employmentForm.controls['amount_paid_in_cash'].value | numberToWords}} Only - - + + {{"₹"}} {{employmentForm.controls['amount_paid_through_bank'].value | numberToWords}} Only + + + Select Validated Not Validated - + - + - - - - - - Select - {{ - fd.name }} - - - - - Select - Fixed - Variable - depending on performance - Others - - - - - Select @@ -197,6 +218,35 @@ + + + + {{"₹"}} {{employmentForm.controls['bonus_incentive'].value | numberToWords}} Only + + + + + Select + {{ + fd.name }} + + + + + + Select + Fixed + Variable + depending on performance + Others + + + + + + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts index f410d58eb..1c9723558 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -48,7 +48,9 @@ export class EmploymentInfoComponent implements OnInit { public company_related_applicants_list: any[]; public company_relationship_list: any[]; public filtered_company_relationship_list: any[]; - + public dateonly: any = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}]; + public todate: any[] = this.dateonly; + public workExperienceFlag: boolean = false; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService, @@ -62,6 +64,7 @@ export class EmploymentInfoComponent implements OnInit { this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + } public viewerOptions: any = { navbar: false, @@ -106,8 +109,12 @@ export class EmploymentInfoComponent implements OnInit { this._pd.retriveForm(params).subscribe(value => { if (value.status == 200) { this.employmentForm.controls['employer_name'].setValue(value.records.employer_name); + this.employmentForm.controls['employer_in_brief'].setValue(value.records.employer_in_brief); this.employmentForm.controls['how_long_year'].setValue(value.records.how_long_year); this.employmentForm.controls['how_long_month'].setValue(value.records.how_long_month); + this.employmentForm.controls['total_business_experience'].setValue(value.records.total_business_experience); + this.workExperienceFlag = (+value.records.total_business_previous_experience) < (+value.records.how_long_year) ? true : false; + this.employmentForm.controls['total_business_previous_experience'].setValue(value.records.total_business_previous_experience); this.employmentForm.controls['was_met'].setValue(value.records.was_met); if (value.records.name_person_met) { this.employmentForm.controls['name_person_met'].setValue(value.records.name_person_met); @@ -117,27 +124,28 @@ export class EmploymentInfoComponent implements OnInit { } this.employmentForm.controls['confirm_salary'].setValue(value.records.confirm_salary); if (value.records.confirm_salary_amount) { - this.employmentForm.controls['confirm_salary_amount'].setValue(value.records.confirm_salary_amount); - // this.employmentForm.controls['salary_from_date'].setValue(value.records.salary_from_date); - // this.employmentForm.controls['salary_to_date'].setValue(value.records.salary_to_date); - this.employmentForm.controls['total_business_experience'].setValue(value.records.total_business_experience); - this.employmentForm.controls['total_business_previous_experience'].setValue(value.records.total_business_previous_experience); + this.employmentForm.controls['confirm_salary_amount'].setValue(value.records.confirm_salary_amount); } this.employmentForm.controls['attendance_seen'].setValue(value.records.attendance_seen); this.employmentForm.controls['sal_reg_seen'].setValue(value.records.sal_reg_seen); this.employmentForm.controls['from_date_the_salary_is_rcv'].setValue(value.records.from_date_the_salary_is_rcv); + if(value.records.from_date_the_salary_is_rcv){ + this.formDate(value.records.from_date_the_salary_is_rcv); + } this.employmentForm.controls['to_date_the_salary_is_rcv'].setValue(value.records.to_date_the_salary_is_rcv); this.employmentForm.controls['gross_monthly_salary'].setValue(value.records.gross_monthly_salary); this.employmentForm.controls['net_monthly_salary'].setValue(value.records.net_monthly_salary); - this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive); this.employmentForm.controls['amount_paid_in_cash'].setValue(value.records.amount_paid_in_cash); + this.employmentForm.controls['amount_paid_through_bank'].setValue(value.records.amount_paid_through_bank); + this.employmentForm.controls['check_validated'].setValue(value.records.check_validated); this.employmentForm.controls['how_was_it_validated'].setValue(value.records.how_was_it_validated); this.employmentForm.controls['why_was_it_not_validated'].setValue(value.records.why_was_it_not_validated); - this.employmentForm.controls['amount_paid_through_bank'].setValue(value.records.amount_paid_through_bank); + this.employmentForm.controls['any_delays'].setValue(value.records.any_delays); + this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive); this.employmentForm.controls['bonus_frequency'].setValue(value.records.bonus_frequency); this.employmentForm.controls['bonus_type'].setValue(value.records.bonus_type); this.employmentForm.controls['bonus_type_other'].setValue(value.records.bonus_type_other); - this.employmentForm.controls['any_delays'].setValue(value.records.any_delays); + this.employmentForm.controls['employment_remarks'].setValue(value.records.employment_remarks); } }) @@ -163,30 +171,32 @@ export class EmploymentInfoComponent implements OnInit { public initemploymentForm(): void { this.employmentForm = this.fb.group({ employer_name: ['', Validators.compose([Validators.required])], + employer_in_brief: ['', Validators.compose([Validators.required])], how_long_year: ['', Validators.compose([Validators.required])], how_long_month: [''], - was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - name_person_met: [''], - designation_person_met: [''], - confirm_salary: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - confirm_salary_amount: [''], total_business_experience: [''], total_business_previous_experience: [''], - attendance_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - sal_reg_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'No' : '', Validators.compose([Validators.required])], - from_date_the_salary_is_rcv: [''], - to_date_the_salary_is_rcv: [''], + was_met: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + name_person_met: [''], + designation_person_met: [''], + confirm_salary: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + confirm_salary_amount: [''], + attendance_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + sal_reg_seen: [this.pd_cus_segment == 'SAL-CHQ' ? 'no' : '', Validators.compose([Validators.required])], + from_date_the_salary_is_rcv: ['',Validators.compose([Validators.max(31), Validators.min(0)])], + to_date_the_salary_is_rcv: ['',Validators.compose([Validators.max(31), Validators.min(0)])], gross_monthly_salary: ['', Validators.compose([Validators.required])], net_monthly_salary: ['', Validators.compose([Validators.required])], - bonus_incentive: ['', Validators.compose([Validators.required])], amount_paid_in_cash: [''], + amount_paid_through_bank: [''], + check_validated:[''], how_was_it_validated: [''], why_was_it_not_validated: [''], - amount_paid_through_bank: [''], + any_delays: ['', Validators.compose([Validators.required])], + bonus_incentive: ['', Validators.compose([Validators.required])], bonus_frequency: [''], bonus_type: [''], bonus_type_other: [''], - any_delays: ['', Validators.compose([Validators.required])], // employment_details: this.fb.array([]), employment_remarks: [''], }); @@ -217,15 +227,112 @@ export class EmploymentInfoComponent implements OnInit { } submitDetails() { + if(this.pd_cus_segment != 'SAL-CHQ'){ + if(this.employmentForm.controls.was_met.value == 'no'){ + + this.employmentForm.controls.name_person_met.setValue(''); + this.employmentForm.controls.name_person_met.clearValidators(); + this.employmentForm.controls.name_person_met.updateValueAndValidity(); + + this.employmentForm.controls.designation_person_met.setValue(''); + this.employmentForm.controls.designation_person_met.clearValidators(); + this.employmentForm.controls.designation_person_met.updateValueAndValidity(); + + } + + if(this.employmentForm.controls.confirm_salary.value == 'no'){ + + this.employmentForm.controls.confirm_salary_amount.setValue(''); + this.employmentForm.controls.confirm_salary_amount.clearValidators(); + this.employmentForm.controls.confirm_salary_amount.updateValueAndValidity(); + } + + } + else if(this.pd_cus_segment == 'SAL-CHQ'){ + this.employmentForm.controls.was_met.clearValidators(); + this.employmentForm.controls.was_met.updateValueAndValidity(); + + this.employmentForm.controls.name_person_met.clearValidators(); + this.employmentForm.controls.name_person_met.updateValueAndValidity(); + + this.employmentForm.controls.designation_person_met.clearValidators(); + this.employmentForm.controls.designation_person_met.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary.clearValidators(); + this.employmentForm.controls.confirm_salary.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary.clearValidators(); + this.employmentForm.controls.confirm_salary.updateValueAndValidity(); + + this.employmentForm.controls.confirm_salary_amount.clearValidators(); + this.employmentForm.controls.confirm_salary_amount.updateValueAndValidity(); + + this.employmentForm.controls.attendance_seen.clearValidators(); + this.employmentForm.controls.attendance_seen.updateValueAndValidity(); + + this.employmentForm.controls.sal_reg_seen.clearValidators(); + this.employmentForm.controls.sal_reg_seen.updateValueAndValidity(); + } + + if(this.employmentForm.controls.amount_paid_in_cash.value != 0 && this.employmentForm.controls.amount_paid_in_cash.value != '' ){ + + if(this.employmentForm.controls.check_validated.value == 'validated'){ + this.employmentForm.controls.why_was_it_not_validated.setValue(''); + } + else if(this.employmentForm.controls.check_validated.value != 'validated'){ + this.employmentForm.controls.how_was_it_validated.setValue(''); + } + } + else{ + this.employmentForm.controls.check_validated.setValue('') + this.employmentForm.controls.how_was_it_validated.setValue('') + this.employmentForm.controls.why_was_it_not_validated.setValue('') + } + + this.employmentForm.controls.check_validated.updateValueAndValidity(); + this.employmentForm.controls.how_was_it_validated.updateValueAndValidity(); + this.employmentForm.controls.why_was_it_not_validated.updateValueAndValidity(); + + if(this.employmentForm.controls.bonus_incentive.value == 0){ + this.employmentForm.controls.bonus_frequency.setValue(''); + this.employmentForm.controls.bonus_frequency.updateValueAndValidity(); + + this.employmentForm.controls.bonus_type.setValue(''); + this.employmentForm.controls.bonus_type.updateValueAndValidity(); + + this.employmentForm.controls.bonus_type_other.setValue(''); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + else{ + if(this.employmentForm.controls.bonus_type.value == 'others'){ + this.employmentForm.controls.bonus_type_other.setValidators([Validators.required]); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + else if(this.employmentForm.controls.bonus_type.value != 'others'){ + this.employmentForm.controls.bonus_type_other.setValue(''); + this.employmentForm.controls.bonus_type_other.clearValidators(); + this.employmentForm.controls.bonus_type_other.updateValueAndValidity(); + } + } + + if (!this.employmentForm.valid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); return; } + + if(+this.employmentForm.controls.total_business_experience.value < +this.employmentForm.controls.how_long_year.value){ + this.notifier.notify('warning', 'Total working Experience is Lower.!'); + return; + } + + let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; records.fk_createdby = this.pdid; records.employer_name = this.employmentForm.controls['employer_name'].value; + records.employer_in_brief = this.employmentForm.controls['employer_in_brief'].value; records.how_long_year = this.employmentForm.controls['how_long_year'].value; records.how_long_month = this.employmentForm.controls['how_long_month'].value; records.was_met = this.employmentForm.controls['was_met'].value; @@ -245,15 +352,20 @@ export class EmploymentInfoComponent implements OnInit { records.to_date_the_salary_is_rcv = this.employmentForm.controls['to_date_the_salary_is_rcv'].value; records.gross_monthly_salary = this.employmentForm.controls['gross_monthly_salary'].value; records.net_monthly_salary = this.employmentForm.controls['net_monthly_salary'].value; - records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value; + records.amount_paid_in_cash = this.employmentForm.controls['amount_paid_in_cash'].value; + records.amount_paid_through_bank = this.employmentForm.controls['amount_paid_through_bank'].value; + records.check_validated = this.employmentForm.controls['check_validated'].value; records.how_was_it_validated = this.employmentForm.controls['how_was_it_validated'].value; records.why_was_it_not_validated = this.employmentForm.controls['why_was_it_not_validated'].value; - records.amount_paid_through_bank = this.employmentForm.controls['amount_paid_through_bank'].value; + + records.any_delays = this.employmentForm.controls['any_delays'].value; + + records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value; records.bonus_frequency = this.employmentForm.controls['bonus_frequency'].value; records.bonus_type = this.employmentForm.controls['bonus_type'].value; records.bonus_type_other = this.employmentForm.controls['bonus_type_other'].value; - records.any_delays = this.employmentForm.controls['any_delays'].value; + records.employment_remarks = this.employmentForm.controls['employment_remarks'].value; this._pd.saveForm(records).subscribe(data => { @@ -274,13 +386,47 @@ export class EmploymentInfoComponent implements OnInit { }) } /** On Key Press Event For Numbers */ - keyPress(event: any) { - const pattern = /[0-9]/; - - let inputChar = String.fromCharCode(event.charCode); - if (event.keyCode != 8 && !pattern.test(inputChar)) { - event.preventDefault(); + checkWorkingExperiences(){ + + if((+this.employmentForm.controls.total_business_experience.value ) < (+this.employmentForm.controls.how_long_year.value)){ + console.log(+this.employmentForm.controls.total_business_experience.value , +this.employmentForm.controls.how_long_year.value); + this.workExperienceFlag = false; + return true; + } + else{ + this.workExperienceFlag = true; + return false; } } + + // keyPress(event: any) { + // const pattern = /[0-9]/; + + // let inputChar = String.fromCharCode(event.charCode); + // if (event.keyCode != 8 && !pattern.test(inputChar)) { + // event.preventDefault(); + // } + // } + + formDate(value){ + // console.log('to',this.todate) + // console.log(value); + // console.log('to length',this.todate.length); + // console.log('index',value-1); + // console.log('this.todate',this.todate[11]); + // console.log('this.todate',this.todate[11].isdisabled); + this.employmentForm.controls['to_date_the_salary_is_rcv'].setValue(''); + this.todate = [{date:1,isdisabled:false},{date:2,isdisabled:false},{date:3,isdisabled:false},{date:4,isdisabled:false},{date:5,isdisabled:false},{date:6,isdisabled:false},{date:7,isdisabled:false},{date:8,isdisabled:false},{date:9,isdisabled:false},{date:10,isdisabled:false},{date:11,isdisabled:false},{date:12,isdisabled:false},{date:13,isdisabled:false},{date:14,isdisabled:false},{date:15,isdisabled:false},{date:16,isdisabled:false},{date:17,isdisabled:false},{date:18,isdisabled:false},{date:19,isdisabled:false},{date:20,isdisabled:false},{date:21,isdisabled:false},{date:22,isdisabled:false},{date:23,isdisabled:false},{date:24,isdisabled:false},{date:25,isdisabled:false},{date:26,isdisabled:false},{date:27,isdisabled:false},{date:28,isdisabled:false},{date:29,isdisabled:false},{date:30,isdisabled:false},{date:31,isdisabled:false}]; + var i ; + + if(value != 0 && value != '') + for(i=0;i<=value-1;i++){ + this.todate[i].isdisabled = true; + if(value == 31){ + this.todate[30].isdisabled = false; + } + } + + } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts index 090d17c51..20704606c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.ts @@ -281,15 +281,15 @@ export class NeighbourHoodComponent implements OnInit { if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == '' || nbhdChildCtrl.controls.did_not_know_the_business_operation.value == false){ - nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]); - nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].setValidators([Validators.required]); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_year'].setValidators([Validators.required]); nbhdChildCtrl.controls['how_long_do_know_in_year'].updateValueAndValidity(); } else if(nbhdChildCtrl.controls.did_not_know_the_business_operation.value == true){ nbhdChildCtrl.controls['how_long_do_know_in_month'].setValue(''); - nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators(); + // nbhdChildCtrl.controls['how_long_do_know_in_month'].clearValidators(); nbhdChildCtrl.controls['how_long_do_know_in_month'].updateValueAndValidity(); nbhdChildCtrl.controls['how_long_do_know_in_year'].setValue(''); nbhdChildCtrl.controls['how_long_do_know_in_year'].clearValidators();