This commit is contained in:
venbatechnologies@gmail.com 2019-01-09 20:28:59 +05:30
commit 295d7e0666
2 changed files with 53 additions and 16 deletions

View File

@ -218,14 +218,20 @@
<mat-hint align="start" style="font-size:70%" *ngIf="sup.get('business_approximate_market_value').value != ''">{{"&#8377;"}} {{appxMarketAmtInwords[i]}} Only</mat-hint> <mat-hint align="start" style="font-size:70%" *ngIf="sup.get('business_approximate_market_value').value != ''">{{"&#8377;"}} {{appxMarketAmtInwords[i]}} Only</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5" style="width:30%"> <mat-form-field *ngIf="sup.get('business_assets_mode').value == 1 || sup.get('business_assets_mode').value == 2 || sup.get('business_assets_mode').value == 3 || sup.get('business_assets_mode').value == 4 || sup.get('business_assets_mode').value == 5" style="width:45%">
<!-- <input matInput placeholder="Name of the Business Owner" formControlName="business_name_of_the_owner" autocomplete="off"> -->
<mat-select placeholder="Asset Owned by" <mat-select placeholder="Asset Owned by"
formControlName="business_name_of_the_owner" required> formControlName="business_name_of_the_owner" [compareWith]="compareObjects" required>
<mat-option [value]="company.company_name" *ngFor="let company of existCompanyList">{{company.company_name | titlecase}}</mat-option> <mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<!-- <mat-option value="Others">Others</mat-option> --> <mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="checkOthers(sup.get('business_name_of_the_owner').value)===true" style="width:45%">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner" autocomplete="off">
</mat-form-field>
</div> </div>

View File

@ -22,6 +22,7 @@ import {
} from '@angular/material'; } from '@angular/material';
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import { element } from '@angular/core/src/render3/instructions';
@Component({ @Component({
selector: 'app-assets-info', selector: 'app-assets-info',
templateUrl: './assets-info.component.html', templateUrl: './assets-info.component.html',
@ -184,6 +185,8 @@ public m_investmentType = [];
private notifier: NotifierService; private notifier: NotifierService;
existCompanyList: any =[]; existCompanyList: any =[];
mergeCompanyApplicant: any=[];
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
@ -224,6 +227,24 @@ public m_investmentType = [];
if(data.dataStatus){ if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active); this.existCompanyList = data.records.filter(val =>val.is_active);
} }
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
}) })
this.getPdSupplierFormDetails(); this.getPdSupplierFormDetails();
@ -315,8 +336,6 @@ public m_investmentType = [];
getPdSupplierFormDetails() { getPdSupplierFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '4').subscribe( this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '4').subscribe(
data => { data => {
console.log(data);
console.log(data.records);
if (data) { if (data) {
if (data.dataStatus) { if (data.dataStatus) {
this.formLoadData(data.records); this.formLoadData(data.records);
@ -332,7 +351,6 @@ public m_investmentType = [];
} }
formLoadData(val) { formLoadData(val) {
console.log(val);
if (val !== null) { if (val !== null) {
let value = val; let value = val;
this._assetsQuesFrom = this._formBuilder.group({ this._assetsQuesFrom = this._formBuilder.group({
@ -394,6 +412,7 @@ public m_investmentType = [];
business_details: this._formBuilder.array([]), business_details: this._formBuilder.array([]),
business_approximate_market_value: [''], business_approximate_market_value: [''],
business_name_of_the_owner: [], business_name_of_the_owner: [],
business_name_of_the_owner_other: [],
//other_owner:[''], //other_owner:[''],
//relation:[''], //relation:[''],
business_purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])], business_purchase_year: ['',Validators.compose([Validators.minLength(4),Validators.maxLength(4)])],
@ -656,7 +675,7 @@ public m_investmentType = [];
business_details: this._formBuilder.array([]), business_details: this._formBuilder.array([]),
business_approximate_market_value: [data.business_approximate_market_value], business_approximate_market_value: [data.business_approximate_market_value],
business_name_of_the_owner: [data.business_name_of_the_owner], business_name_of_the_owner: [data.business_name_of_the_owner],
// other_owner:[data.other_owner || ''], business_name_of_the_other_owner:[data.business_name_of_the_other_owner || ''],
// relation: [data.relation || ''], // relation: [data.relation || ''],
business_purchase_year: [data. business_purchase_year], business_purchase_year: [data. business_purchase_year],
// purchase_month: [data.purchase_month], // purchase_month: [data.purchase_month],
@ -670,7 +689,6 @@ public m_investmentType = [];
loadDetails: boolean; loadDetails: boolean;
addAssetsDetailsWithData(supp_data) { addAssetsDetailsWithData(supp_data) {
//console.log(supp_data);
var result = Object.keys(supp_data).map(function (key) { var result = Object.keys(supp_data).map(function (key) {
return supp_data[key]; return supp_data[key];
}); });
@ -721,7 +739,7 @@ public m_investmentType = [];
business_assets_mode: val.business_assets_mode, business_assets_mode: val.business_assets_mode,
business_approximate_market_value: val.business_approximate_market_value, business_approximate_market_value: val.business_approximate_market_value,
business_name_of_the_owner: val.business_name_of_the_owner, business_name_of_the_owner: val.business_name_of_the_owner,
// other_owner: val.other_owner, business_name_of_the_other_owner: val.business_name_of_the_other_owner,
// relation : val.relation, // relation : val.relation,
business_purchase_year: val. business_purchase_year, business_purchase_year: val. business_purchase_year,
// purchase_month: val.purchase_month, // purchase_month: val.purchase_month,
@ -949,8 +967,6 @@ public m_investmentType = [];
/** Add More Asset using Flag Both "Other Asset" And "Business Asset" */ /** Add More Asset using Flag Both "Other Asset" And "Business Asset" */
addAssetDetails(e,flag) { addAssetDetails(e,flag) {
// console.log(flag);
// console.log(e);
if(flag == 1){ if(flag == 1){
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetails()); control.push(this.initDetails());
@ -994,9 +1010,26 @@ public m_investmentType = [];
} }
} }
// compare objects for merge two master table details
compareObjects(o1: any, o2: any) {
if(o1.id == o2.id && o1.group_id == o2.group_id)
return true;
else return false
}
// check others
checkOthers(values){
if(values!=null) {
return values.id==0 ? true : false;
}
else {
return false;
}
}
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
console.log(this._assetsQuesFrom.value);
this.submitted = true; this.submitted = true;
// stop here if form is invalid // stop here if form is invalid
@ -1025,7 +1058,6 @@ public m_investmentType = [];
val.business_elapsed_tenure = ''; val.business_elapsed_tenure = '';
} }
}); });
console.log(answerFormValues);
// Save the data with help of Service // Save the data with help of Service
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => { dataresult => {
@ -1067,7 +1099,6 @@ console.log(answerFormValues);
loanTenureCalc(details ,flag) loanTenureCalc(details ,flag)
{ {
if(flag == 1){ if(flag == 1){
//console.log(details.value);
let ElapsedValues; let ElapsedValues;
if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){ if(details.value.original_loan_tenure != null && details.value.original_loan_tenure != '' && details.value.balance_tenure != null && details.value.balance_tenure != ''){