assets and general form changes

This commit is contained in:
gandhimathi 2019-01-11 17:44:55 +05:30
parent cda1577cc2
commit 594c467ebe
5 changed files with 54 additions and 37 deletions

View File

@ -28,7 +28,7 @@
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event,i,2)" placeholder="Assets Type" formControlName="business_assets_mode" requried>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name | titlecase }}</mat-option>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id" [disabled]="asset.flag!=1">{{ asset.name | titlecase }}</mat-option>
</mat-select>
</mat-form-field>
</div>
@ -55,26 +55,27 @@
</div>
</div>
<!--Four Wheeler-->
<!--vehicle-->
<div *ngIf="sup.get('business_assets_mode').value == 2">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" autocomplete="off">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_vehicle" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
<!--Two Wheeler-->
<!-- Eqipment Manufacturing -->
<div *ngIf="sup.get('business_assets_mode').value == 3">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" autocomplete="off">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%">
<input matInput placeholder="Description" formControlName="equipment_manufacturing_description" >
</mat-form-field>
</div>
</div>
@ -321,19 +322,20 @@
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_four_weeler" autocomplete="off">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_vehicle" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
<!--Two Wheeler-->
<!-- Eqipment Manufacturing -->
<div *ngIf="sup.get('assets_mode').value == 3">
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:30%">
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model_two_weeler" autocomplete="off">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%">
<input matInput placeholder="Description" formControlName="equipment_manufacturing_description" >
</mat-form-field>
</div>
</div>
@ -419,7 +421,7 @@
<mat-form-field style="width:30%">
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest" (keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,10)">
<mat-hint align="start" style="font-size:70%" *ngIf="sup.get('amount_of_invest').value != ''">{{"&#8377;"}} {{OtherAmtInvestInwords[i]}} Only</mat-hint>
<mat-hint align="start" style="font-size:70%" *ngIf="detail.get('amount_of_invest').value != ''">{{"&#8377;"}} {{OtherAmtInvestInwords[i]}} Only</mat-hint>
</mat-form-field>
</div>

View File

@ -225,7 +225,7 @@ public m_investmentType = [];
// });
this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active);
this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true);
}
let modifyCompanyList : any=[];
@ -234,9 +234,7 @@ public m_investmentType = [];
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 => {
@ -448,7 +446,7 @@ public m_investmentType = [];
case '3': {
const control = (flag == 1) ? (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray
: (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_Weeler());
control.push(this.loadEquipmentManufacturingDescription());
break;
}
case '4': {
@ -512,6 +510,12 @@ public m_investmentType = [];
});
}
loadEquipmentManufacturingDescription() {
return this._formBuilder.group({
equipment_manufacturing_description: ['']
});
}
otherAssetsDescription() {
return this._formBuilder.group({
any_other_assets: [''],
@ -547,20 +551,20 @@ public m_investmentType = [];
return this._formBuilder.group({
investments_type: [''],
other_investments_type:[''],
amount_of_invest: [''],
amount_of_invest: [],
bank_name: ['']
});
}
load_Four_Weeler() {
return this._formBuilder.group({
manufacturer_model_four_weeler: ['']
manufacturer_model_vehicle: ['']
});
}
load_Two_Weeler() {
return this._formBuilder.group({
manufacturer_model_two_weeler: ['']
manufacturer_model_vehicle: ['']
});
}
@ -583,6 +587,11 @@ public m_investmentType = [];
consumer_durable_description: [data.consumer_durable_description]
});
}
loadEquipmentManufacturingDescriptionWithData(data) {
return this._formBuilder.group({
equipment_manufacturing_description: [data.equipment_manufacturing_description]
});
}
otherAssetsDescriptionWithData(data) {
return this._formBuilder.group({
@ -627,13 +636,13 @@ public m_investmentType = [];
load_Four_WeelerWithData(data) {
return this._formBuilder.group({
manufacturer_model_four_weeler: [data.manufacturer_model_four_weeler]
manufacturer_model_vehicle: [data.manufacturer_model_vehicle]
});
}
load_Two_WeelerWithData(data) {
return this._formBuilder.group({
manufacturer_model_two_weeler: [data.manufacturer_model_two_weeler]
manufacturer_model_vehicle: [data.manufacturer_model_vehicle]
});
}
@ -758,7 +767,7 @@ public m_investmentType = [];
case '2': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'manufacturer_model_four_weeler': datas.manufacturer_model_four_weeler };
array_data = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.load_Four_WeelerWithData(array_data));
@ -767,10 +776,10 @@ public m_investmentType = [];
case '3': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'manufacturer_model_two_weeler': datas.manufacturer_model_two_weeler };
array_data = { 'equipment_manufacturing_description': datas.equipment_manufacturing_description };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.load_Two_WeelerWithData(array_data));
control.push(this.loadEquipmentManufacturingDescriptionWithData(array_data));
break;
}
case '4': {
@ -860,19 +869,19 @@ public m_investmentType = [];
case '2': {
let business_Four_Weeler_datas : any;
data.forEach((datas,i) => {
business_Four_Weeler_datas = { 'manufacturer_model_four_weeler': datas.manufacturer_model_four_weeler };
business_Four_Weeler_datas = { 'manufacturer_model_vehicle': datas.manufacturer_model_vehicle };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Four_WeelerWithData(business_Four_Weeler_datas));
break;
}
case '3': {
let business_Two_Weeler_datas : any;
let equipment_manufacturing_description_datas : any;
data.forEach((datas,i) => {
business_Two_Weeler_datas = { 'manufacturer_model_two_weeler': datas.manufacturer_model_two_weeler };
equipment_manufacturing_description_datas= { 'equipment_manufacturing_description': datas.equipment_manufacturing_description };
});
const control = (<FormArray>this._assetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray ;
control.push(this.load_Two_WeelerWithData(business_Two_Weeler_datas));
control.push(this.loadEquipmentManufacturingDescriptionWithData(equipment_manufacturing_description_datas));
break;
}
case '4': {

View File

@ -63,11 +63,12 @@
<mat-card-content>
<div fxLayout="row wrap" formArrayName="companies">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" *ngFor="let com of _generalForm.controls.companies['controls']; let c = index; let last = last;" [formGroupName]="c">
<mat-form-field style="width: 60%" *ngIf="com.value.is_active==true">
<mat-form-field style="width: 45%" *ngIf="com.value.is_active==true">
<input matInput placeholder="Company/Firm" formControlName="company_name" type="text">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeCompanies(c)" *ngIf="c>0 && com.value.is_active==true"
<mat-checkbox class="table-checkbox-com" color="primary" formControlName="is_company_applicant"> Is Applicant</mat-checkbox>
<button type="button" class="mr-1 mb-1 hover-icon table-checkbox-com" mat-raised-button mat-icon-button (click)="removeCompanies(c)" *ngIf="c>0 && com.value.is_active==true"
matTooltip="Remove Company/Firm" matTooltipPosition="above">
<mat-icon>delete</mat-icon>
</button>

View File

@ -20,6 +20,9 @@
.table-checkbox {
margin-left: 15% !important;
}
.table-checkbox-com {
margin-left: 3% !important;
}
.p-text {
color:#e00201 !important;
font-weight: bold;

View File

@ -217,13 +217,13 @@ export class GeneralInfoComponent implements OnInit {
// create companies
if(element.company_name!='' && element.company_name!=null){
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:element.company_name,is_active:true}
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:element.company_name,is_company_applicant:element.is_company_applicant,is_active:true}
companyControl.push(this.createCompanies(setCompanyValues))
}
});
// check company if null update one row
if(companyControl.controls.length ==0){
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:'',is_active:true}
let setCompanyValues: any = {company_order_id :companyControl.controls.length+1,company_name:'',is_company_applicant:false,is_active:true,is_new:false}
companyControl.push(this.createCompanies(setCompanyValues))
}
@ -258,7 +258,9 @@ export class GeneralInfoComponent implements OnInit {
company_order_id: [elementValue.company_order_id],
company_name: [elementValue.company_name],
company_messrs_name: ['M/s'],
is_active: [elementValue.is_active]
is_company_applicant:[elementValue.is_company_applicant],
is_active: [elementValue.is_active],
is_new:[elementValue.is_new]
});
}
@ -305,7 +307,7 @@ export class GeneralInfoComponent implements OnInit {
// add more companies
addMoreCompanies() {
let control: any = this._generalForm.get('companies') as FormArray;
let setValues: any = {company_order_id :control.controls.length+1,company_name:'',is_active:true}
let setValues: any = {company_order_id :control.controls.length+1,company_name:'',is_company_applicant:false,is_active:true,is_new: true}
control.push(this.createCompanies(setValues))
}