BusinessAssets TypeScript File : ps
This commit is contained in:
parent
81ee80698b
commit
34de049358
@ -52,7 +52,12 @@ export class PdQuestionBusinessAssetsPage {
|
||||
lender_applicant_id: any;
|
||||
subproduct_abbr: any;
|
||||
customer_segment_abbr: any;
|
||||
|
||||
RentAmtInwordsForAddress: any =[];
|
||||
appxMarketAmtInwordsForAddress: any =[];
|
||||
isOtherOwnerForAddress : boolean = false;
|
||||
isOtherOwner: boolean = false;
|
||||
public m_vehicle_type = [];
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams,public aws:AwsServiceProvider,public fb:FormBuilder,public qustcat:QuestionCategoryProvider,public cons:ConstantsProvider,public toast:ToastProvider) {
|
||||
|
||||
|
||||
@ -64,8 +69,8 @@ export class PdQuestionBusinessAssetsPage {
|
||||
this.applicants = this.applicants.filter(appt=>appt.applicant_type != 2)
|
||||
this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
|
||||
this.generalExistBusinessYear = this.pdDetails.business_years;
|
||||
this.generalExistBusinessMonth = this.pdDetails.business_month;
|
||||
this.pageTitle = this.pdDetails.company_name + ' - ' +this.pageTitle ;
|
||||
this.generalExistBusinessMonth = this.pdDetails.business_month;
|
||||
this.pageTitle = this.pdDetails.company_name + ' - ' +this.pageTitle ;
|
||||
this.main_applicant = this.pdDetails.applicant_name;
|
||||
this.lender_applicant_id = this.pdDetails.lender_applicant_id;
|
||||
this.subproduct_abbr = this.pdDetails.subproduct_abbr;
|
||||
@ -101,17 +106,24 @@ export class PdQuestionBusinessAssetsPage {
|
||||
console.log('ionViewDidLoad PdQuestionBusinessAssetsPage');
|
||||
}
|
||||
getDropDown(){
|
||||
this.qustcat.getcommondrop('VEHICLETYPE').subscribe(
|
||||
data => {
|
||||
this.m_vehicle_type = data['records'].filter(data => data.is_active == 1);
|
||||
})
|
||||
|
||||
this.qustcat.getcommondrop('ASSETTYPE').subscribe(data=>{
|
||||
this.m_assets_type=data['records'].filter(val=>val.isactive==1 && val.flag==1);
|
||||
console.log(this.m_assets_type)
|
||||
// console.log(this.m_assets_type)
|
||||
})
|
||||
|
||||
this.qustcat.getcommondrop('PROPERTIES').subscribe(data=>{
|
||||
this.m_propertyType=data['records'].filter(val=>val.isactive==1)
|
||||
})
|
||||
|
||||
this.qustcat.getCompaniesListsForBusiness(this.pdDetails.pd_id).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);
|
||||
console.log("existCompanyList",this.existCompanyList)
|
||||
this.existCompanyList=data['records'].filter(val=>val.is_active==true);
|
||||
// console.log("existCompanyList",this.existCompanyList)
|
||||
}
|
||||
|
||||
let modifyCompanyList : any=[];
|
||||
@ -130,6 +142,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
this.qustcat.getcommondrop('ADDRESSTYPE').subscribe(data=>{
|
||||
this.m_address_type=data['records'].filter(val=>val.isactive == 1);
|
||||
})
|
||||
@ -143,7 +156,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
this.qustcat.retiverForm(params).subscribe(res=>{
|
||||
|
||||
if(res['dataStatus']==true){
|
||||
console.log("records",res['records'])
|
||||
// console.log("records",res['records'])
|
||||
//this.data_all=res['records']
|
||||
/* var assestArray=Object.keys(res['records'].business_assets_details).map(function(key){
|
||||
return res['records'].business_assets_details[key]
|
||||
@ -193,10 +206,10 @@ export class PdQuestionBusinessAssetsPage {
|
||||
business_years:[''],
|
||||
business_month:[''],
|
||||
business_address_availability:[''],
|
||||
|
||||
business_is_pd_visited:[''],
|
||||
business_pd_visited_remark:[''],
|
||||
|
||||
business_assets_for_address: this.fb.array([
|
||||
this.createBusinessAssetsForAddress()]),
|
||||
business_assets_details : this.fb.array([
|
||||
this.initBusinessDetails(),
|
||||
]),
|
||||
@ -205,7 +218,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
|
||||
}
|
||||
else{
|
||||
console.log("Data Here");
|
||||
// console.log("Data Here");
|
||||
let value=data;
|
||||
this._businessAssetsQuesFrom=this.fb.group({
|
||||
pdid: [this.pdDetails.pd_id],
|
||||
@ -213,19 +226,28 @@ export class PdQuestionBusinessAssetsPage {
|
||||
formid: [this.formDetails.form_id],
|
||||
company_id : [this.company_id],
|
||||
fk_createdby:[this.users],
|
||||
|
||||
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_assets_for_address: this.fb.array([]),
|
||||
business_assets_details : this.fb.array([]),
|
||||
business_assets_form_remark:[value.business_assets_form_remark || '']
|
||||
});
|
||||
if (value.business_address_availability == 'yes') {
|
||||
// console.log(value.business_assets_for_address);
|
||||
this.addBusinessAssetsForAddress(value.business_assets_for_address);
|
||||
}
|
||||
else {
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddress());
|
||||
}
|
||||
this.addBusinessAssetsDetailsWithData(value.business_assets_details);
|
||||
}
|
||||
this.loadDetails=true
|
||||
}
|
||||
|
||||
initBusinessDetails(){
|
||||
return this.fb.group({
|
||||
business_assets_mode:[''],
|
||||
@ -244,12 +266,15 @@ export class PdQuestionBusinessAssetsPage {
|
||||
loadProperty() {
|
||||
return this.fb.group({
|
||||
property_type: [''],
|
||||
other_property_type: ['']
|
||||
other_property_type: [''],
|
||||
address_of_the_property: ['']
|
||||
});
|
||||
}
|
||||
load_Four_Weeler() {
|
||||
return this.fb.group({
|
||||
manufacturer_model_vehicle: ['']
|
||||
manufacturer_model_vehicle: [''],
|
||||
vehicle_type: [''],
|
||||
other_vehicle_type: ['']
|
||||
});
|
||||
}
|
||||
loadEquipmentManufacturingDescription() {
|
||||
@ -265,7 +290,6 @@ export class PdQuestionBusinessAssetsPage {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** Add More Asset using Flag Both "Other Asset" And "Business Asset" */
|
||||
addAssetDetails(e) {
|
||||
|
||||
@ -280,12 +304,31 @@ export class PdQuestionBusinessAssetsPage {
|
||||
control.removeAt(i);
|
||||
|
||||
}
|
||||
|
||||
createBusinessAssetsForAddress(): FormGroup {
|
||||
return this.fb.group({
|
||||
business_approximate_market_value: [''],
|
||||
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: ['']
|
||||
});
|
||||
}
|
||||
|
||||
selectedAssetsType(e: any, i: any): void {
|
||||
let val = i;
|
||||
const arr = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
|
||||
arr.controls.splice(0);
|
||||
|
||||
switch (e.value) {
|
||||
case '1': {
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
control.push(this.otherBusinessAssetsDescription());
|
||||
break;
|
||||
}
|
||||
case '2': {
|
||||
let val = i;
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
@ -302,31 +345,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
control.push(this.loadEquipmentManufacturingDescription());
|
||||
break;
|
||||
}
|
||||
// case '5': {
|
||||
// const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
// //control.push(this.loadJwellDescription());
|
||||
// break;
|
||||
// }
|
||||
// case '8': {
|
||||
// const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
// control.push(this.loadConsumerDurableDescription());
|
||||
// break;
|
||||
// }
|
||||
// case '6': {
|
||||
// const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
// control.push(this.loadInsuranceDescription());
|
||||
// break;
|
||||
// }
|
||||
// case '7': {
|
||||
// const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
// control.push(this.loadInvestDescription());
|
||||
// break;
|
||||
// }
|
||||
case '1': {
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
control.push(this.otherBusinessAssetsDescription());
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
@ -336,13 +355,15 @@ export class PdQuestionBusinessAssetsPage {
|
||||
loadPropertyWithData(data) {
|
||||
return this.fb.group({
|
||||
property_type: [data.property_type],
|
||||
other_property_type: [data.other_property_type]
|
||||
//property_type:['']
|
||||
other_property_type: [data.other_property_type],
|
||||
address_of_the_property: [data.address_of_the_property],
|
||||
});
|
||||
}
|
||||
load_Four_WeelerWithData(data){
|
||||
return this.fb.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]
|
||||
})
|
||||
}
|
||||
|
||||
@ -354,17 +375,55 @@ export class PdQuestionBusinessAssetsPage {
|
||||
otherBusinessAssetsDescriptionWithData(data) {
|
||||
return this.fb.group({
|
||||
any_other_assets: [data.any_other_assets],
|
||||
any_other_asset_value : [data.any_other_asset_value],
|
||||
any_other_asset_loan : [data.any_other_asset_loan],
|
||||
});
|
||||
}
|
||||
|
||||
loadDetails:boolean
|
||||
addBusinessAssetsForAddress(data) {
|
||||
var result = Object.keys(data).map(function (key) {
|
||||
return data[key];
|
||||
});
|
||||
if (result.length > 0) {
|
||||
result.forEach((datas, index) => {
|
||||
this.RentAmtInwordsForAddress[index] = this.cons.convertNumberToWords(datas.business_monthly_rented_amt);
|
||||
this.appxMarketAmtInwordsForAddress[index] = this.cons.convertNumberToWords(datas.business_approximate_market_value);
|
||||
let Avaliablity = 1;
|
||||
// console.log(datas.business_name_of_the_owner);
|
||||
if(datas.business_name_of_the_owner.length > 0){
|
||||
datas.business_name_of_the_owner.forEach(option => {
|
||||
if(option.id == 0 && option.group_id == 2){
|
||||
Avaliablity = option.id;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false;
|
||||
});
|
||||
|
||||
for (let val of result) {
|
||||
let vals = {
|
||||
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_vintage: val.business_vintage,
|
||||
business_purchase_year: val.business_purchase_year,
|
||||
business_emi: val.business_emi
|
||||
};
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddressWithData(vals));
|
||||
}
|
||||
} else {
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddress());
|
||||
}
|
||||
}
|
||||
addBusinessAssetsDetailsWithData(supp_data){
|
||||
var result=Object.keys(supp_data).map(function(key){
|
||||
return supp_data[key];
|
||||
})
|
||||
console.log("Result",result)
|
||||
// console.log("Result",result)
|
||||
if(result.length>0){
|
||||
result.forEach((datas,index)=>{
|
||||
this.appxMarketAmtInwords[index]=this.cons.convertNumberToWords(+datas.business_approximate_market_value)
|
||||
@ -386,12 +445,26 @@ export class PdQuestionBusinessAssetsPage {
|
||||
control.push(this.initBusinessDetailsWithdata(formData));
|
||||
this.setBusinessAssetsDetailsWithData(formData.business_assets_mode, val.business_details, control.length - 1)
|
||||
}
|
||||
console.log("Add Business Details exit")
|
||||
// console.log("Add Business Details exit");
|
||||
}
|
||||
this.loadDetails=true
|
||||
}
|
||||
|
||||
createBusinessAssetsForAddressWithData(data): FormGroup {
|
||||
return this.fb.group({
|
||||
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],
|
||||
business_vintage: [data.business_vintage],
|
||||
business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
|
||||
business_emi: [data.business_emi]
|
||||
});
|
||||
}
|
||||
|
||||
initBusinessDetailsWithdata(data) {
|
||||
console.log("initBusinessDetailsWithdata",data)
|
||||
// console.log("initBusinessDetailsWithdata",data)
|
||||
|
||||
let formGroup= this.fb.group({
|
||||
business_assets_mode: [data.business_assets_mode],
|
||||
@ -410,8 +483,8 @@ export class PdQuestionBusinessAssetsPage {
|
||||
return formGroup;
|
||||
}
|
||||
setBusinessAssetsDetailsWithData(assets_details_mode:any,datas:any,i:any){
|
||||
console.log("Asset Mode business asset",assets_details_mode)
|
||||
console.log("setBusinessAssetsDetailsWithData",datas)
|
||||
// console.log("Asset Mode business asset",assets_details_mode)
|
||||
// console.log("setBusinessAssetsDetailsWithData",datas)
|
||||
let val = i;
|
||||
let data = datas;
|
||||
const control=(<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
|
||||
@ -421,7 +494,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
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 };
|
||||
business_property_datas = { 'property_type': datas.property_type, 'other_property_type': datas.other_property_type, 'address_of_the_property': datas.address_of_the_property };
|
||||
});
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
control.push(this.loadPropertyWithData(business_property_datas));
|
||||
@ -430,7 +503,7 @@ export class PdQuestionBusinessAssetsPage {
|
||||
case '3': {
|
||||
let business_Four_Weeler_datas : any;
|
||||
data.forEach((datas,i) => {
|
||||
business_Four_Weeler_datas = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle };
|
||||
business_Four_Weeler_datas = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle, 'vehicle_type': datas.vehicle_type, 'other_vehicle_type': datas.other_vehicle_type };
|
||||
});
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
control.push(this.load_Four_WeelerWithData(business_Four_Weeler_datas));
|
||||
@ -452,8 +525,8 @@ export class PdQuestionBusinessAssetsPage {
|
||||
this.AssetValueInwords[i] = this.cons.convertNumberToWords(+datas.any_other_asset_value);
|
||||
array_datas = {
|
||||
'any_other_assets': datas.any_other_assets,
|
||||
'any_other_asset_value' : datas.any_other_asset_value,
|
||||
'any_other_asset_loan' : datas.any_other_asset_loan,
|
||||
// 'any_other_asset_value': datas.any_other_asset_value,
|
||||
'any_other_asset_loan': datas.any_other_asset_loan,
|
||||
};
|
||||
});
|
||||
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
|
||||
@ -466,6 +539,18 @@ export class PdQuestionBusinessAssetsPage {
|
||||
}
|
||||
}
|
||||
|
||||
public paymentModeTextBox: number;
|
||||
selectedPM(e) {
|
||||
this.paymentModeTextBox = e.value;
|
||||
// this.f.supplier_details.controls.get('payment_mode_value');
|
||||
}
|
||||
|
||||
public freqPurchaseTextBox: number;
|
||||
selectedFreqPurchase(e) {
|
||||
this.freqPurchaseTextBox = e.value;
|
||||
}
|
||||
|
||||
|
||||
onSubmit(){
|
||||
var answerData=this._businessAssetsQuesFrom.value;
|
||||
//To Remove The "Null" With Key also
|
||||
@ -483,18 +568,28 @@ export class PdQuestionBusinessAssetsPage {
|
||||
|
||||
}
|
||||
// calculate vintage and purchase {}
|
||||
calculateVintagePurchase(value: any, controlKey: any,type: number){
|
||||
if(type==1){
|
||||
calculateVintagePurchase(value: any, controlKey: any, type: number) {
|
||||
if (type == 1) {
|
||||
let control: any = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_details'];
|
||||
control.controls[controlKey].controls['business_purchase_year'].setValue(value!='' ? parseInt(this.currentYear)-parseInt(value) : '');
|
||||
}
|
||||
else if(type==2) {
|
||||
control.controls[controlKey].controls['business_purchase_year'].setValue(value != '' ? parseInt(this.currentYear) - parseInt(value) : '');
|
||||
}
|
||||
else if (type == 2) {
|
||||
let control: any = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_details'];
|
||||
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_purchase_year'].setValue(value) : control.controls[controlKey].controls['business_purchase_year'].setValue('');
|
||||
value!='' && value<=this.currentYear ? control.controls[controlKey].controls['business_vintage'].setValue(parseInt(this.currentYear)-parseInt(value)) : control.controls[controlKey].controls['business_vintage'].setValue('')
|
||||
value != '' && value <= this.currentYear ? control.controls[controlKey].controls['business_purchase_year'].setValue(value) : control.controls[controlKey].controls['business_purchase_year'].setValue('');
|
||||
value != '' && value <= this.currentYear ? control.controls[controlKey].controls['business_vintage'].setValue(parseInt(this.currentYear) - parseInt(value)) : control.controls[controlKey].controls['business_vintage'].setValue('')
|
||||
}
|
||||
if (type == 3) {
|
||||
let control: any = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.controls[controlKey].controls['business_purchase_year'].setValue(value != '' ? parseInt(this.currentYear) - parseInt(value) : '');
|
||||
}
|
||||
else if (type == 4) {
|
||||
let control: any = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
value != '' && value <= this.currentYear ? control.controls[controlKey].controls['business_purchase_year'].setValue(value) : control.controls[controlKey].controls['business_purchase_year'].setValue('');
|
||||
value != '' && value <= this.currentYear ? control.controls[controlKey].controls['business_vintage'].setValue(parseInt(this.currentYear) - parseInt(value)) : control.controls[controlKey].controls['business_vintage'].setValue('')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
compareObjects(o1: any, o2: any) {
|
||||
if(o1.id == o2.id && o1.group_id == o2.group_id)
|
||||
return true;
|
||||
@ -513,77 +608,134 @@ export class PdQuestionBusinessAssetsPage {
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
||||
setRequiredValidation(value, item, flag) {
|
||||
|
||||
}
|
||||
// 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'){
|
||||
item.controls.business_monthly_rented_amt.clearValidators();
|
||||
if (flag == 1) {
|
||||
if (value == 'yes') {
|
||||
this._businessAssetsQuesFrom.controls.business_years.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_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_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') {
|
||||
item.controls.business_monthly_rented_amt.clearValidators();
|
||||
item.controls.business_name_of_the_owner.setValidators([Validators.required]);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
item.controls.business_monthly_rented_amt.setValidators([Validators.required]);
|
||||
item.controls.business_name_of_the_owner.clearValidators();
|
||||
item.controls.business_name_of_the_owner.clearValidators();
|
||||
}
|
||||
item.controls.business_monthly_rented_amt.updateValueAndValidity();
|
||||
item.controls.business_name_of_the_owner.updateValueAndValidity();
|
||||
}
|
||||
if(flag == 4){
|
||||
value==0
|
||||
? item.controls.business_name_of_the_other_owner.setValidators([Validators.required])
|
||||
: item.controls.business_name_of_the_other_owner.clearValidators();
|
||||
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
|
||||
}
|
||||
if(flag == 5){
|
||||
value==1
|
||||
? item.controls.other_vehicle_type.setValidators([Validators.required])
|
||||
: item.controls.other_vehicle_type.clearValidators();
|
||||
item.controls.other_vehicle_type.updateValueAndValidity();
|
||||
}
|
||||
if(flag == 6){
|
||||
value==1
|
||||
? item.controls.other_property_type.setValidators([Validators.required])
|
||||
: item.controls.other_property_type.clearValidators();
|
||||
item.controls.other_property_type.updateValueAndValidity();
|
||||
}
|
||||
|
||||
item.controls.business_monthly_rented_amt.updateValueAndValidity();
|
||||
item.controls.business_name_of_the_owner.updateValueAndValidity();
|
||||
}
|
||||
if (flag == 4) {
|
||||
let Avaliablity = 1;
|
||||
value.forEach(option => {
|
||||
if(option.id == 0 && option.group_id == 2){
|
||||
Avaliablity = option.id;
|
||||
}
|
||||
});
|
||||
if(Avaliablity == 0){
|
||||
|
||||
item.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
|
||||
this.isOtherOwner = true;
|
||||
}else{
|
||||
|
||||
item.controls.business_name_of_the_other_owner.setValue('');
|
||||
item.controls.business_name_of_the_other_owner.clearValidators();
|
||||
this.isOtherOwner = false;
|
||||
}
|
||||
|
||||
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
|
||||
|
||||
// value == 0
|
||||
// ? item.controls.business_name_of_the_other_owner.setValidators([Validators.required])
|
||||
// : item.controls.business_name_of_the_other_owner.clearValidators();
|
||||
// item.controls.business_name_of_the_other_owner.updateValueAndValidity();
|
||||
}
|
||||
if (flag == 5) {
|
||||
value == 1
|
||||
? item.controls.other_vehicle_type.setValidators([Validators.required])
|
||||
: item.controls.other_vehicle_type.clearValidators();
|
||||
item.controls.other_vehicle_type.updateValueAndValidity();
|
||||
}
|
||||
if (flag == 6) {
|
||||
value == 1
|
||||
? item.controls.other_property_type.setValidators([Validators.required])
|
||||
: item.controls.other_property_type.clearValidators();
|
||||
item.controls.other_property_type.updateValueAndValidity();
|
||||
|
||||
value != ''
|
||||
? item.controls.address_of_the_property.setValidators([Validators.required])
|
||||
: item.controls.address_of_the_property.clearValidators();
|
||||
item.controls.address_of_the_property.updateValueAndValidity();
|
||||
}
|
||||
if (flag == 7) {
|
||||
if (value == 'owned') {
|
||||
item.controls.business_monthly_rented_amt.clearValidators();
|
||||
item.controls.business_name_of_the_owner.setValidators([Validators.required]);
|
||||
}
|
||||
else {
|
||||
item.controls.business_monthly_rented_amt.setValidators([Validators.required]);
|
||||
item.controls.business_name_of_the_owner.clearValidators();
|
||||
}
|
||||
item.controls.business_monthly_rented_amt.updateValueAndValidity();
|
||||
item.controls.business_name_of_the_owner.updateValueAndValidity();
|
||||
}
|
||||
if(flag == 8){
|
||||
let Avaliablity = 1;
|
||||
value.forEach(option => {
|
||||
if(option.id == 0 && option.group_id == 2){
|
||||
// console.log('true');
|
||||
Avaliablity = option.id;
|
||||
}
|
||||
});
|
||||
// isOtherOwner: boolean = false;
|
||||
if(Avaliablity == 0){
|
||||
// console.log(Avaliablity);
|
||||
item.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
|
||||
this.isOtherOwnerForAddress = true;
|
||||
}else{
|
||||
// console.log(Avaliablity);
|
||||
item.controls.business_name_of_the_other_owner.setValue('');
|
||||
item.controls.business_name_of_the_other_owner.clearValidators();
|
||||
this.isOtherOwnerForAddress = false;
|
||||
}
|
||||
|
||||
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/** To Convert Month into Year */
|
||||
ConvertMonthintoYear(e){
|
||||
|
||||
@ -640,6 +792,12 @@ export class PdQuestionBusinessAssetsPage {
|
||||
case 3:
|
||||
this.RentAmtInwords[i]=this.cons.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
case 9:
|
||||
this.RentAmtInwordsForAddress[i] = this.cons.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
case 10:
|
||||
this.appxMarketAmtInwordsForAddress[i] = this.cons.convertNumberToWords(e.target.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user