From 746ad4d9ea0cabd330a739265c722670b23abdfc Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 9 Feb 2019 09:50:48 +0530 Subject: [PATCH] changes:ps --- .../list-pd/all-pd/all-pd.component.html | 2 +- .../completed-pd/completed-pd.component.html | 2 +- .../inprogress-pd.component.html | 2 +- .../qc-completed-pd.component.html | 2 +- .../scheduled-pd/scheduled-pd.component.html | 2 +- .../forms/address/address.component.html | 38 ++- .../forms/address/address.component.ts | 322 ++++++++++-------- .../business-assets-info.component.html | 274 +++++++++++---- .../business-assets-info.component.ts | 274 ++++++++++++++- .../business-info.component.html | 12 +- .../business-info/business-info.component.ts | 116 +++++-- .../final-remarks/final-remarks.component.ts | 16 + .../financial-info.component.ts | 6 +- .../general-info/general-info.component.scss | 18 +- .../general-info/general-info.component.ts | 12 +- .../snack-bar/snack-bar.component.html | 3 - .../snack-bar/snack-bar.component.scss | 0 .../snack-bar/snack-bar.component.spec.ts | 25 -- .../snack-bar/snack-bar.component.ts | 15 - 19 files changed, 806 insertions(+), 335 deletions(-) delete mode 100644 ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.html delete mode 100644 ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.scss delete mode 100644 ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.spec.ts delete mode 100644 ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html index a99ba910b..fe0faeb7f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html @@ -98,7 +98,7 @@ {{details.pd_date_of_initiation}}
- {{details.city_name}}-{{details.pincode}} + {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html index 6bffc56a4..ed414e711 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html @@ -87,7 +87,7 @@ {{details.pd_date_of_initiation}}
- {{details.city_name}}-{{details.pincode}} + {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html index f4a00c56c..0be34afd2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html @@ -84,7 +84,7 @@ {{details.pd_date_of_initiation}}
- {{details.city_name}}-{{details.pincode}} + {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html index 05b38c1eb..de43da466 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html @@ -84,7 +84,7 @@ {{details.pd_date_of_initiation}}
- {{details.city_name}}-{{details.pincode}} + {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html index 97cdd5535..300ed7344 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html @@ -84,7 +84,7 @@ {{details.pd_date_of_initiation}}
- {{details.city_name}}-{{details.pincode}} + {{details.city_name}}-{{details.pincode_id == 1 ? details.other_pincode : details.pincode }}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html index fe2a1a427..cf7c1b250 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html @@ -17,7 +17,7 @@
- +
@@ -43,7 +43,8 @@
- + + Address Type Required
@@ -59,15 +60,16 @@
- + + Locality Required
- - requried + MixUse Required
@@ -91,11 +93,12 @@
-
+
-
+ + @@ -178,7 +181,7 @@ --(Customer Behaviour)--> - + - + -
+ + + + + {{monthErrorMessage}} + + +
+ + + + + Yes + No + + + + + + + + + + +
+ +
+ + + + Yes + No + + + + +
+ + + + +
+
+

Additional Unit #{{i+1}}

+ + + + + {{m_addressType.address_type}} + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
+
+ +
+ +
+
+ +

Business Premises And Other Assets

+
@@ -27,7 +148,7 @@
- + {{ asset.name | titlecase }} @@ -41,23 +162,15 @@
- + - {{ prop.name | titlecase }} + {{m_addressType.address_type}} + - + - - - Owned - Rented - - - - -
@@ -68,12 +181,23 @@
- - - - + + -
+ + + Car / Jeep + Rickshaw / Tempo + Truck / Bus + Tractor + Two Wheeler + Others (Please Specify) + + + + + +
@@ -181,12 +305,12 @@
- + {{"₹"}} {{AssetValueInwords[s]}} Only - + {{data.viewValue | titlecase}} @@ -208,62 +332,70 @@
- - - - {{"₹"}} {{appxMarketAmtInwords[i]}} Only - - - - - - - {{val.name}} - - - - - - + + + + Owned + Rented + + - - + + + + +
- - - - Approx Vintage - - - - - Purchase Year - - +
- - + + + + {{"₹"}} {{appxMarketAmtInwords[i]}} Only + - -
- - - - Yes - No - - -
-
+ + + + + {{val.name}} + + + + + + + + + + + + + + + Approx Vintage + + + + + + Purchase Year + + + +
+ + +
+ + + Yes + No + + +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts index f4d380596..44f5ee44e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts @@ -22,6 +22,7 @@ export class BusinessAssetsInfoComponent implements OnInit { pageTitle: string ="Assets used for Business"; pdid:string; + placeholderName : any = 'Was any business activity seen at the Address Type during PD visit?'; public _businessAssetsQuesFrom: FormGroup; public submitted = false; @@ -47,6 +48,13 @@ export class BusinessAssetsInfoComponent implements OnInit { existCompanyList: any =[]; mergeCompanyApplicant: any=[]; currentYear:any=new Date().getFullYear(); + addressLabel : any; + public m_addressType = []; + CustSegAbbr: any; + generalExistBusinessYear:Number; + generalExistBusinessMonth:Number; + yearErrorMessage: any; + monthErrorMessage: any; public viewerOptions: any = { navbar: false, @@ -82,10 +90,12 @@ export class BusinessAssetsInfoComponent implements OnInit { this.company_id =this.pd_all_details.company_id; this.notifier = notifier; this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ; - this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; + this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant; this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id; this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; + this.generalExistBusinessYear = this.pd_all_details.business_years; + this.generalExistBusinessMonth = this.pd_all_details.business_month; } @@ -94,6 +104,7 @@ export class BusinessAssetsInfoComponent implements OnInit { // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; // }); + this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ if(data.dataStatus){ this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true && val.company_order_id==this.company_id); @@ -121,6 +132,27 @@ export class BusinessAssetsInfoComponent implements OnInit { this.getM_PropertyType(); // this.getM_InvestmentType(); // this.getM_FreqOfPurchase(); + this.getM_Address_Type(); + + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = '5'; + + this.pdTrigerService.retriveForm(params).subscribe(data => { + if(data.status == 200) { + console.log(data.records); + + this.addressLabel = ''; + + let selectedAddressType = this.m_addressType.filter(element =>element.address_type_id == data.records.address_type)[0]; + let address = data.records.address; + let addressType = data.records.address_type != 1 ? selectedAddressType.address_type : data.records.address_type_others; + + this.placeholderName = 'Was any business activity seen at the '+addressType+' during PD visit?'; + this.addressLabel = " : "+address+' / '+addressType ; + + } + }); } /** Assets Type For Dropdown List */ @@ -173,6 +205,25 @@ export class BusinessAssetsInfoComponent implements OnInit { // ) // } + getM_Address_Type() { + this.pdTrigerService.getAllMasterDatas('ADDRESSTYPE').subscribe( + data => { + this.m_addressType = data.records.filter(data => data.isactive == 1); + // console.log(this.m_addressType); + // if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){ + + // // console.log('whole',FilteredAddressType); + // let index1 = this.m_addressType.map(data => data.address_type).indexOf("Residence"); + // this.m_addressType.splice(index1, 1); + // // console.log('FirstOne',FilteredAddressType); + // let index2 = this.m_addressType.map(data => data.address_type).indexOf("Residence cum Office"); + // this.m_addressType.splice(index2, 1); + // // console.log('SecondOne',FilteredAddressType); + // } + // console.log(this.m_addressType); + }) + } + //Get Data Based on PDID and FORMID apiLoadFinish: boolean = false; getPdSupplierFormDetails() { @@ -200,9 +251,23 @@ export class BusinessAssetsInfoComponent implements OnInit { pdid: [this.pdid], formid: ['22'], company_id : [this.company_id], + business_years:[value.business_years], + business_month:[value.business_month], + business_address_availability:[value.business_address_availability], + business_is_pd_visited:[value.business_is_pd_visited], + business_pd_visited_remark:[value.business_pd_visited_remark], + business_activity:[value.business_activity], + business_premises_additional_units: this._formBuilder.array([]), business_assets_details : this._formBuilder.array([]), - business_assets_form_remark:[value.business_assets_form_remark || 'check'] + business_assets_form_remark:[value.business_assets_form_remark || null] }); + if(value.business_activity == 'yes'){ + this.addBusinessUnitsWithData(value.business_premises_additional_units); + } + else{ + const control = this._businessAssetsQuesFrom.controls['business_premises_additional_units']; + control.push(this.createUnits()); + } this.addBusinessAssetsDetailsWithData(value.business_assets_details); } else { this._businessAssetsQuesFrom = this._formBuilder.group({ @@ -212,6 +277,15 @@ export class BusinessAssetsInfoComponent implements OnInit { business_assets_details : this._formBuilder.array([ this.initBusinessDetails(), ]), + business_years:[''], + business_month:[''], + business_address_availability:[''], + business_activity:[''], + business_is_pd_visited:[''], + business_pd_visited_remark:[''], + business_premises_additional_units: this._formBuilder.array([ + this.createUnits() + ]), business_assets_form_remark:[''] }); } @@ -231,13 +305,25 @@ export class BusinessAssetsInfoComponent implements OnInit { business_assets_mode: [''], business_details: this._formBuilder.array([]), business_approximate_market_value: [''], - business_name_of_the_owner: [], - business_name_of_the_other_owner: [], + business_ownership_type:[''], + business_monthly_rented_amt:[''], + business_name_of_the_owner: [''], + business_name_of_the_other_owner: [''], business_vintage: [''], business_purchase_year: ['',Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], business_emi: [''], }); } + createUnits(): FormGroup { + return this._formBuilder.group({ + no_of_additional_units: [''], + premises_type: [''], + premises_type_others: [''], + premises_city: [''], + premises_remarks: [''], + }); + } + selectedPropertyOwnedType(e,s,i){ // const control = (this._businessAssetsQuesFrom.controls['business_assets_details']).at(i).get('business_details') as FormArray ; @@ -313,8 +399,6 @@ export class BusinessAssetsInfoComponent implements OnInit { return this._formBuilder.group({ property_type: [''], other_property_type: [''], - properties_ownership_type : [''], - properties_monthly_rented_amt:[''] }); } @@ -366,7 +450,10 @@ export class BusinessAssetsInfoComponent implements OnInit { load_Four_Weeler() { return this._formBuilder.group({ - manufacturer_model_vehicle: [''] + manufacturer_model_vehicle: [''], + vehicle_type:[''], + other_vehicle_type:[''] + }); } @@ -380,8 +467,6 @@ export class BusinessAssetsInfoComponent implements OnInit { return this._formBuilder.group({ property_type: [data.property_type], other_property_type: [data.other_property_type], - properties_ownership_type : [data.properties_ownership_type], - properties_monthly_rented_amt:[data.properties_monthly_rented_amt] //property_type:[''] }); } @@ -435,7 +520,9 @@ export class BusinessAssetsInfoComponent implements OnInit { load_Four_WeelerWithData(data) { return this._formBuilder.group({ - manufacturer_model_vehicle: [data.manufacturer_model_vehicle] + manufacturer_model_vehicle: [data.manufacturer_model_vehicle], + vehicle_type:[data.vehicle_type], + other_vehicle_type:[data.other_vehicle_type] }); } @@ -445,12 +532,25 @@ export class BusinessAssetsInfoComponent implements OnInit { // }); // } + createUnitswithData(data){ + let formGroup= this._formBuilder.group({ + no_of_additional_units: [data.no_of_additional_units], + premises_type: [data.premises_type], + premises_type_others: [data.premises_type_others], + premises_city: [data.premises_city], + premises_remarks: [data.premises_remarks], + }); + return formGroup; + } + initBusinessDetailsWithdata(data) { let formGroup= this._formBuilder.group({ business_assets_mode: [data.business_assets_mode], business_details: this._formBuilder.array([]), business_approximate_market_value: [data.business_approximate_market_value], + business_ownership_type : [data.business_ownership_type], + business_monthly_rented_amt:[data.business_monthly_rented_amt], business_name_of_the_owner: [data.business_name_of_the_owner], business_name_of_the_other_owner:[data.business_name_of_the_other_owner || ''], // relation: [data.relation || ''], @@ -463,6 +563,30 @@ export class BusinessAssetsInfoComponent implements OnInit { } loadDetails: boolean; + addBusinessUnitsWithData(data){ + + var result = Object.keys(data).map(function (key) { + return data[key]; + }); + + if (result.length > 0) { + for (let val of result) { + let vals = { + no_of_additional_units: val.no_of_additional_units, + premises_type: val.premises_type, + premises_type_others: val.premises_type_others, + premises_city: val.premises_city, + premises_remarks: val.premises_remarks, + }; + const control = this._businessAssetsQuesFrom.controls['business_premises_additional_units']; + control.push(this.createUnitswithData(vals)); + } + }else{ + const control = this._businessAssetsQuesFrom.controls['business_premises_additional_units']; + control.push(this.createUnits()); + } + +} addBusinessAssetsDetailsWithData(supp_data) { @@ -479,6 +603,8 @@ export class BusinessAssetsInfoComponent implements OnInit { let vals = { business_assets_mode: val.business_assets_mode, business_approximate_market_value: val.business_approximate_market_value, + business_ownership_type:val.business_ownership_type, + business_monthly_rented_amt:val.business_monthly_rented_amt, business_name_of_the_owner: val.business_name_of_the_owner, business_name_of_the_other_owner: val.business_name_of_the_other_owner, business_purchase_year: val. business_purchase_year, @@ -506,8 +632,8 @@ export class BusinessAssetsInfoComponent implements OnInit { case '2': { let business_property_datas : any; data.forEach((datas,i) => { - business_property_datas = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type,'properties_ownership_type':datas.properties_ownership_type,'properties_monthly_rented_amt':datas.properties_monthly_rented_amt }; - this.selectedPropertyOwnedType(datas.properties_ownership_type,i,val); + business_property_datas = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type }; + // this.selectedPropertyOwnedType(datas.properties_ownership_type,i,val); }); const control = (this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ; control.push(this.loadPropertyWithData(business_property_datas)); @@ -697,6 +823,130 @@ export class BusinessAssetsInfoComponent implements OnInit { } } + // ConvertMonthintoYear(e){ + + // let business_year = this._businessAssetsQuesFrom.controls.business_years.value; + + // let converted_month : number = e%12; + // let converted_year : number = e/12; + + // this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); + // this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); + + // } + + /** To Convert Month into Year */ + ConvertMonthintoYear(e){ + + let business_year = this._businessAssetsQuesFrom.controls.business_years.value; + + let converted_month : number = e%12; + let converted_year : number = e/12; + + let Year = +business_year + +Math.floor(converted_year); + + if(Year > this.generalExistBusinessYear){ + this.yearErrorMessage = "Higher than Business Vintage"; + this._businessAssetsQuesFrom.controls.business_years.setValue(''); + this._businessAssetsQuesFrom.controls.business_month.setValue(''); + + } + else{ + if(Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) + { + this.monthErrorMessage = "Higher than Business Vintage"; + this._businessAssetsQuesFrom.controls.business_years.setValue(''); + this._businessAssetsQuesFrom.controls.business_month.setValue(''); + + }else{ + this.monthErrorMessage = ''; + this.yearErrorMessage = ''; + this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); + this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); + } + } + } + + checkWithExistBusinessYear(e){ + + if(+e > this.generalExistBusinessYear){ + this.yearErrorMessage = "Higher than Business Vintage"; + this._businessAssetsQuesFrom.controls.business_years.setValue(''); + + } + else{ + this.yearErrorMessage = ''; + } + } + + setRequiredValidation(value,item,flag) { + console.log(item); + console.log(value); + console.log(flag); +if(flag == 1){ + if(value == 'yes') + { this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_month.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_activity.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_pd_visited_remark.setValidators([Validators.required]) ; + this._businessAssetsQuesFrom.controls.business_activity.setValidators([Validators.required]) ; + } + else{ + this._businessAssetsQuesFrom.controls.business_years.clearValidators(); + this._businessAssetsQuesFrom.controls.business_month.clearValidators(); + this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators(); + this._businessAssetsQuesFrom.controls.business_activity.clearValidators(); + this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators(); + this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators(); + this._businessAssetsQuesFrom.controls.business_activity.clearValidators(); + } + this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_month.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_activity.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_activity.updateValueAndValidity(); + + +} +if(flag == 2){ + value==1 + ? item.controls.premises_type_others.setValidators([Validators.required]) + : item.controls.premises_type_others.clearValidators(); + item.controls.premises_type_others.updateValueAndValidity(); +} +if(flag == 3){ + if(value == 'owned'){ + this._businessAssetsQuesFrom.controls.business_monthly_rented_amt.clearValidators(); + this._businessAssetsQuesFrom.controls.business_name_of_the_owner.setValidators([Validators.required]); + } + else{ + this._businessAssetsQuesFrom.controls.business_monthly_rented_amt.setValidators([Validators.required]); + this._businessAssetsQuesFrom.controls.business_name_of_the_owner.clearValidators(); + } + this._businessAssetsQuesFrom.controls.business_monthly_rented_amt.updateValueAndValidity(); + this._businessAssetsQuesFrom.controls.business_name_of_the_owner.updateValueAndValidity(); +} + + } + + addUnits() { + const control = this._businessAssetsQuesFrom.controls['business_premises_additional_units']; + control.push(this.createUnits()); + } + + removeUnits(index) { + const control = this._businessAssetsQuesFrom.controls['business_premises_additional_units']; + control.removeAt(index); + } + + selectedAddressType(e: any){ + this.placeholderName = 'Was any business activity seen at the '+e+' during PD visit?'; + } + /** Amount InWords */ inWords(e,i,flag){ switch(flag){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 181afd4fd..70c372dff 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -220,7 +220,7 @@ - + Within India Export Both @@ -457,7 +457,7 @@ - + Within India Export Both @@ -696,7 +696,7 @@ - + Within India Export Both @@ -933,7 +933,7 @@ - + Within India Export Both @@ -1270,11 +1270,11 @@ formControlName="employees_total" required> - -
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts index 23418fc2a..94bc64cb9 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts @@ -286,6 +286,7 @@ export class BusinessInfoComponent implements OnInit { selectedManufacturing.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert'); selectedManufacturing.length > 0 ? this.businessForm.addControl('factory_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('factory_cert'); selectedManufacturing.forEach((element,index)=>{ + this.CheckExport(element.area_of_sale,'MActivity',index); manufacturingControl.push(this.createActivity()); if(element.area_of_sale=='Within India'){ manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); @@ -350,6 +351,7 @@ export class BusinessInfoComponent implements OnInit { selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); selectedRetail.forEach((element,index)=>{ + this.CheckExport(element.area_of_sale,'RActivity',index); retailControl.push(this.createActivity()); if(element.area_of_sale=='Within India'){ retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); @@ -411,6 +413,7 @@ export class BusinessInfoComponent implements OnInit { selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); selectedWholesale.forEach((element,index)=>{ + this.CheckExport(element.area_of_sale,'WActivity',index); wholesaleControl.push(this.createActivity()); if(element.area_of_sale=='Within India'){ wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); @@ -474,6 +477,7 @@ export class BusinessInfoComponent implements OnInit { selectedService.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets'); selectedService.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines'); selectedService.forEach((element,index)=>{ + this.CheckExport(element.area_of_sale,'SPActivity',index); serviceProviderControl.push(this.createServiceActivity()); if(element.area_of_sale=='Within India'){ serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([])); @@ -1075,7 +1079,7 @@ export class BusinessInfoComponent implements OnInit { getAllPersons() { this._pd.getAllPersonsName(this.pdid).subscribe(data => { if(data.dataStatus){ - this.personsList = data.record; + this.personsList = data.record.filter(val=>val.applicant_type==1); // if(data.record.applicant_type == 1){ // this.personsList.push({groupName:'APPLICANTS',groupValues:{name:data.record.applicant_name,group_id:data.record.applicant_type}}); // } @@ -1455,7 +1459,7 @@ export class BusinessInfoComponent implements OnInit { }); let total = ManufacturingArray.reduce((sum, item) => sum + +item.approx_sale, 0); if(total > 100 || total < 100){ - this.notifier.notify('warning',"Approximate sales doesn't add upto 100%"); + validationFlag++; } } }); @@ -1695,31 +1699,89 @@ export class BusinessInfoComponent implements OnInit { // } - CheckExport(e,val){ - // console.log(e); - // console.log(val); - let flag: number = 0; - if(val == 1){ - e != "Within India" ? - flag++ :flag--; - } - if(val == 2){ - e != "Within India" ? - flag++ :flag--; - } - if(val == 3){ - e != "Within India" ? - flag++ :flag--; - } - if(val == 4){ - e != "Within India" ? - flag++ :flag--; - } - if(flag > 0){ - this.ExportFlag = true; - } - - } +// counterForExportCart : number = 0; +// domesticCounter : number = 0; +// foreignCounter : number = 0; + + +// CheckExport(value,flag,index){ + +// if((flag == 1 || flag == 2 || flag == 3 || flag == 4 ) && value != "Within India"){ +// this.foreignCounter++; +// // index = index+1; +// // this.counterForExportCart++; +// // this.counter = this.counter+index; +// } +// else{ +// this.domesticCounter++; +// if(this.foreignCounter > 0){ +// this.foreignCounter--; +// } +// // index = index+1; +// // this.counter = this.counter-index; +// // this.counterForExportCart--; +// } +// // this.ExportFlag = this.counterForExportCart == 1 ? true : false ; +// console.log('this.domesticCounter : ',this.domesticCounter,', this.foreignCounter : ',this.foreignCounter); +// if(this.domesticCounter == 0 && this.foreignCounter == 0){ +// this.ExportFlag = false; +// }else if(this.foreignCounter >= 0) { +// this.ExportFlag = true; +// } +// console.log('Cuurent Flag Status : ',this.ExportFlag ); +// } + +ManufacturingCounterArray: any = []; +RetailCounterArray: any = []; +WholeSaleCounterArray: any = []; +ServiceCounterArray: any = []; + +CheckExport(value,stringFlag,index){ + + if(stringFlag == 'MActivity' && value != "Within India"){ + this.ManufacturingCounterArray[index] = 1; + } + else{ + this.ManufacturingCounterArray[index] = 0; + } + + if(stringFlag == 'RActivity' && value != "Within India"){ + this.RetailCounterArray[index] = 1; + } + else{ + this.RetailCounterArray[index] = 0; + } + + if(stringFlag == 'WActivity' && value != "Within India"){ + this.WholeSaleCounterArray[index] = 1; + } + else{ + this.WholeSaleCounterArray[index] = 0; + } + + if(stringFlag == 'SPActivity' && value != "Within India") + { + this.ServiceCounterArray[index] = 1; + } + else{ + this.ServiceCounterArray[index] = 0; + } + + let SumOfManufacturingCounter = this.ManufacturingCounterArray.reduce((sum, val) => sum + +val, 0); + // console.log(SumOfManufacturingCounter,this.ManufacturingCounterArray); + let SumOfRetailCounter = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0); + // console.log(SumOfRetailCounter , this.RetailCounterArray); + let SumOfWholeSaleCounter = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); + // console.log(SumOfWholeSaleCounter,this.WholeSaleCounterArray); + let SumOfServiceCounter = this.ServiceCounterArray.reduce((sum, val) => sum + +val, 0); + // console.log(SumOfServiceCounter,this.ServiceCounterArray); + + let overallCounter = SumOfManufacturingCounter + SumOfRetailCounter + SumOfWholeSaleCounter + SumOfServiceCounter ; + + this.ExportFlag = overallCounter > 0 ? true : false ; + // console.log('overallCounter , SumOfManufacturingCounter , SumOfRetailCounter , SumOfWholeSaleCounter , SumOfServiceCounter ' , overallCounter , SumOfManufacturingCounter , SumOfRetailCounter , SumOfWholeSaleCounter , SumOfServiceCounter); + // console.log('Current Flag Status : ',this.ExportFlag ); +} inWords(e,flag){ switch(flag){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index fdcf0b02b..b39722f4c 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -133,6 +133,22 @@ export class FinalRemarksComponent implements OnInit { /** To Save/Edited Popup Data */ onSubmit() { this.submitted = true; + if (this._finalRemarkForm.controls.final_custormer_remark_type.value == 1) { + this._finalRemarkForm.controls['final_other_customer_behaviour'].setValidators([Validators.required]); + this._finalRemarkForm.controls['final_other_customer_behaviour'].updateValueAndValidity(); + } + if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 1){ + this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]); + this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); + } + if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 3){ + this._finalRemarkForm.controls['enter_reason_for_negative'].setValidators([Validators.required]); + this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); + } + if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){ + this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValidators([Validators.required]); + this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity(); + } // stop here if form is invalid if (this._finalRemarkForm.invalid) { this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts index c18e322cb..de9d1fa0f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -657,7 +657,7 @@ export class FinancialInfoComponent implements OnInit { let D = (C / estimate_sales_from) * 100; if(estimate_sales_from <= 5000000){ - if(D >= 20){ + if(D > 20){ var r = confirm("Given Sales Range is greater than 20%"); if (r == true) { details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0); @@ -671,7 +671,7 @@ export class FinancialInfoComponent implements OnInit { } } else if(estimate_sales_from > 5000000 && estimate_sales_from <= 10000000){ - if(D >= 15){ + if(D > 15){ var r = confirm("Given Sales Range is greater than 15%"); if (r == true) { details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0); @@ -685,7 +685,7 @@ export class FinancialInfoComponent implements OnInit { } } else if(estimate_sales_from > 10000000){ - if(D >= 10){ + if(D > 10){ var r = confirm("Given Sales Range is greater than 10%"); if (r == true) { details.controls.estimate_sales_to.setValue(estimate_sales_to!= Infinity ? estimate_sales_to:0); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss index bd0c2ae7d..180c39802 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.scss @@ -16,7 +16,23 @@ mat-header-cell mat-cell { display:flex; justify-content:flex-end; - } + } + + mat-cell:nth-child(5), + mat-header-cell:nth-child(5) { + flex: 0 0 17%; + } + + mat-cell:nth-child(6), + mat-header-cell:nth-child(6) { + flex: 0 0 20%; + } + + mat-cell:nth-child(7), + mat-header-cell:nth-child(7) { + justify-content: end; +} + .table-checkbox { margin-left: 15% !important; } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index a774c3184..a662f26a4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -8,6 +8,7 @@ import { element } from '@angular/core/src/render3/instructions'; import { ELEMENT_PROBE_PROVIDERS } from '@angular/platform-browser/src/dom/debug/ng_probe'; import { DatePipe } from '@angular/common'; import { SearchRelationPipe } from './../../../../../pd-pipes/search-relation.pipe'; +import { Options } from 'selenium-webdriver/edge'; @Component({ selector: 'app-general-info', @@ -474,12 +475,19 @@ export class GeneralInfoComponent implements OnInit { removeIndividuals(findex,details){ let control = this._generalForm.controls['individuals']; - control.removeAt(findex); + // console.log('control',control.dirty); + // console.log('control',control.dirty); + // control.markAsDirty({onlySelf:true}); + console.log(control); + // control.removeAt(findex); let controls = this._generalForm.controls['persons_with_relationships']; + console.log('control',control); let name = details.value.applicant_name; let index1 = controls.value.map(data => data.applicant_name).indexOf(name); - controls.removeAt(index1); + control.markAsDirty({onlySelf:true}); + console.log('control',); + // controls.removeAt(index1); } diff --git a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.html b/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.html deleted file mode 100644 index 8fe9cab13..000000000 --- a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- snack-bar works! -

diff --git a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.scss b/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.spec.ts b/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.spec.ts deleted file mode 100644 index 05db7e794..000000000 --- a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SnackBarComponent } from './snack-bar.component'; - -describe('SnackBarComponent', () => { - let component: SnackBarComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SnackBarComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SnackBarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.ts b/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.ts deleted file mode 100644 index d7870a9e2..000000000 --- a/ng6-seed/src/app/personal-discussion/snack-bar/snack-bar.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-snack-bar', - templateUrl: './snack-bar.component.html', - styleUrls: ['./snack-bar.component.scss'] -}) -export class SnackBarComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -}