client , supplier form details changes : kdk

This commit is contained in:
dineshkumarkannan 2018-12-20 18:22:46 +05:30
parent 0c5e266257
commit b0dc7c94ee
4 changed files with 97 additions and 84 deletions

View File

@ -19,7 +19,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Manufacturing Product Name" formControlName="manufacturing_product_name"> <mat-select placeholder="Manufacturing Product Name" formControlName="manufacturing_product_name">
<mat-option *ngFor="let pm of m_manufacturingProducts" [value]="pm.name">{{ pm.name }}</mat-option> <mat-option *ngFor="let pm of m_manufacturingProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<!--<mat-form-field style="width: 100%"> <!--<mat-form-field style="width: 100%">
@ -77,7 +77,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Trading Product Name" formControlName="trade_product_name"> <mat-select placeholder="Trading Product Name" formControlName="trade_product_name">
<mat-option *ngFor="let pm of m_tradingProducts" [value]="pm.name">{{ pm.name }}</mat-option> <mat-option *ngFor="let pm of m_tradingProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<!--<mat-form-field style="width: 100%"> <!--<mat-form-field style="width: 100%">
@ -136,7 +136,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%"> <mat-form-field style="width: 100%">
<mat-select placeholder="Service Provider Product Name" formControlName="service_provider_product_name"> <mat-select placeholder="Service Provider Product Name" formControlName="service_provider_product_name">
<mat-option *ngFor="let pm of m_suplierProducts" [value]="pm.name">{{ pm.name }}</mat-option> <mat-option *ngFor="let pm of m_suplierProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<!--<mat-form-field style="width: 100%"> <!--<mat-form-field style="width: 100%">

View File

@ -104,36 +104,38 @@ export class ClientInfoComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
// if(data.dataStatus === undefined){ if(data.dataStatus){
let datas = { // let datas = {
"profession_name": "Others", // "profession_name": "Others",
"type_of_activity": [ // "type_of_activity": [
{ // {
"type_of_activity_id": 1, // "type_of_activity_id": 1,
"name": "Manufacturing Details" // "name": "Manufacturing Details"
}, // },
{ // {
"type_of_activity_id": 2, // "type_of_activity_id": 2,
"name": "Retail trading" // "name": "Retail trading"
}, // },
{ // {
"type_of_activity_id": 3, // "type_of_activity_id": 3,
"name": "Wholesale trading" // "name": "Wholesale trading"
}, // },
{ // {
"type_of_activity_id": 4, // "type_of_activity_id": 4,
"name": "Service Providers" // "name": "Service Providers"
} // }
] // ]
}; // };
// this.m_manufacturingProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 1 ){return data.product_details}}); let datas = data.records;
// this.m_tradingProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 3 ){return data.product_details}}); this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 1 ){return data}}).map(data=> [...data.prodcuts]);
// this.m_suplierProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 4 ){return data.product_details}}); this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3 ){return data}}).map(data=> [...data.prodcuts]);
this.m_suplierProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 4 ){return data}}).map(data=> [...data.prodcuts]);
// alert(JSON.stringify(this.m_manufacturingProducts[0]));
this.initFormLoadDetails(datas.type_of_activity); this.initFormLoadDetails(datas.type_of_activity);
// }else { }else {
// this.notifier.notify('warning', 'No Category Records Found.!'); this.notifier.notify('warning', 'No Category Records Found.!');
// this.noRecordsFound = false; this.noRecordsFound = false;
// } }
}, err => { }, err => {
this.notifier.notify('warning', 'No Category Records Found.!'); this.notifier.notify('warning', 'No Category Records Found.!');
this.noRecordsFound = false; this.noRecordsFound = false;
@ -153,7 +155,7 @@ export class ClientInfoComponent implements OnInit {
if (dataForm !== undefined) { if (dataForm !== undefined) {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['2'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
@ -161,7 +163,7 @@ export class ClientInfoComponent implements OnInit {
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
// Load form details for manufacturing // Load form details for manufacturing
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if (arr.length > 0) { if (arr.length > 0) {
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
return dataForm.main_raw_materials[key]; return dataForm.main_raw_materials[key];
@ -171,7 +173,7 @@ export class ClientInfoComponent implements OnInit {
} }
// Load form details for the wholeshale trading details // Load form details for the wholeshale trading details
let arr1 = record.filter(data => data.type_of_activity_id === 3); let arr1 = record.filter(data => data.type_of_activity_id == 3);
if (arr1.length > 0) { if (arr1.length > 0) {
let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
return dataForm.trading_products[key]; return dataForm.trading_products[key];
@ -181,7 +183,7 @@ export class ClientInfoComponent implements OnInit {
} }
// Load form details for the service provider prduct details // Load form details for the service provider prduct details
let arr2 = record.filter(data => data.type_of_activity_id === 4); let arr2 = record.filter(data => data.type_of_activity_id == 4);
if (arr2.length > 0) { if (arr2.length > 0) {
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) { let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
return dataForm.service_products[key]; return dataForm.service_products[key];
@ -190,7 +192,7 @@ export class ClientInfoComponent implements OnInit {
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_products_total_payments_percent_on_credit || null); this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_products_total_payments_percent_on_credit || null);
} }
// Load form details for the retail trading details // Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id === 2); let arr3 = record.filter(data => data.type_of_activity_id == 2);
if (arr3.length > 0) { if (arr3.length > 0) {
this.retaildTradingForm = true; this.retaildTradingForm = true;
} }
@ -198,24 +200,24 @@ export class ClientInfoComponent implements OnInit {
} else { } else {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['2'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if (arr.length > 0) { if (arr.length > 0) {
this.initManufacturingProductsDetails(null); this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
} }
let arr1 = record.filter(data => data.type_of_activity_id === 3); let arr1 = record.filter(data => data.type_of_activity_id == 3);
if (arr1.length > 0) { if (arr1.length > 0) {
this.initTradingProductsDetails(null); this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
} }
let arr2 = record.filter(data => data.type_of_activity_id === 4); let arr2 = record.filter(data => data.type_of_activity_id == 4);
if (arr2.length > 0) { if (arr2.length > 0) {
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) { let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
return dataForm.service_products[key]; return dataForm.service_products[key];
@ -224,7 +226,7 @@ export class ClientInfoComponent implements OnInit {
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_products_total_payments_percent_on_credit || null); this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_products_total_payments_percent_on_credit || null);
} }
// Load form details for the retail trading details // Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id === 2); let arr3 = record.filter(data => data.type_of_activity_id == 2);
if (arr3.length > 0) { if (arr3.length > 0) {
this.retaildTradingForm = true; this.retaildTradingForm = true;
} }
@ -233,30 +235,30 @@ export class ClientInfoComponent implements OnInit {
} else { } else {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['2'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
supplier_info_form_remark: [] supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if (arr.length > 0) { if (arr.length > 0) {
this.initManufacturingProductsDetails(null); this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
} }
let arr1 = record.filter(data => data.type_of_activity_id === 3); let arr1 = record.filter(data => data.type_of_activity_id == 3);
if (arr1.length > 0) { if (arr1.length > 0) {
this.initTradingProductsDetails(null); this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
} }
let arr2 = record.filter(data => data.type_of_activity_id === 4); let arr2 = record.filter(data => data.type_of_activity_id == 4);
if (arr2.length > 0) { if (arr2.length > 0) {
this.initServiceProviderProductsDetails(null); this.initServiceProviderProductsDetails(null);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null);
} }
// Load form details for the retail trading details // Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id === 2); let arr3 = record.filter(data => data.type_of_activity_id == 2);
if (arr3.length > 0) { if (arr3.length > 0) {
this.retaildTradingForm = true; this.retaildTradingForm = true;
} }
@ -271,7 +273,7 @@ export class ClientInfoComponent implements OnInit {
manufacturingForm: Boolean = false; manufacturingForm: Boolean = false;
manufacturingFormCreation(val) { manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 1); let arr = val.filter(data => data.type_of_activity_id == 1);
if (arr.length > 0) { if (arr.length > 0) {
this.manufacturingForm = true; this.manufacturingForm = true;
return this._formBuilder.group({ return this._formBuilder.group({
@ -286,7 +288,7 @@ export class ClientInfoComponent implements OnInit {
tradingForm: Boolean = false; tradingForm: Boolean = false;
tradingFormCreation(val) { tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 3); let arr = val.filter(data => data.type_of_activity_id == 3);
if (arr.length > 0) { if (arr.length > 0) {
this.tradingForm = true; this.tradingForm = true;
return this._formBuilder.group({ return this._formBuilder.group({
@ -300,7 +302,7 @@ export class ClientInfoComponent implements OnInit {
serviceProviderForm: Boolean = false; serviceProviderForm: Boolean = false;
serviceProviderFormCreation(val) { serviceProviderFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 4); let arr = val.filter(data => data.type_of_activity_id == 4);
if (arr.length > 0) { if (arr.length > 0) {
this.serviceProviderForm = true; this.serviceProviderForm = true;
return this._formBuilder.group({ return this._formBuilder.group({
@ -491,8 +493,16 @@ export class ClientInfoComponent implements OnInit {
var answerFormValues = this._supplierQuesFrom.value; var answerFormValues = this._supplierQuesFrom.value;
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); Object.keys(answerFormValues).forEach((key) => {if(answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === ''){ delete answerFormValues[key]}; console.log("chec:" +answerFormValues[key])});
console.log(JSON.stringify(answerFormValues)); if(answerFormValues.manufacturing_details[0]==null){
delete answerFormValues['manufacturing_details'];
}
if(answerFormValues.trade_details[0]==null){
delete answerFormValues['trade_details'];
}
if(answerFormValues.service_provider_details[0]==null){
delete answerFormValues['service_provider_details'];
}
// Add BRANCH data with help Service File // Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => { dataresult => {

View File

@ -255,3 +255,4 @@ export class FamilyDetailsComponent implements OnInit {
// } // }
} }

View File

@ -77,29 +77,30 @@ export class SupplierInfoComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
// if(data.dataStatus === undefined){ if(data.dataStatus){
let datas = { // let datas = {
"profession_name": "Others", // "profession_name": "Others",
"type_of_activity": [ // "type_of_activity": [
{ // {
"type_of_activity_id": 1, // "type_of_activity_id": 1,
"name": "Manufacturing Details" // "name": "Manufacturing Details"
}, // },
{ // {
"type_of_activity_id": 2, // "type_of_activity_id": 2,
"name": "Retail trading" // "name": "Retail trading"
}, // },
{ // {
"type_of_activity_id": 4, // "type_of_activity_id": 4,
"name": "Service Provider" // "name": "Service Provider"
} // }
] // ]
}; // };
let datas = data.records;
this.initFormLoadDetails(datas.type_of_activity); this.initFormLoadDetails(datas.type_of_activity);
// }else { }else {
// this.notifier.notify('warning', 'No Category Records Found.!'); this.notifier.notify('warning', 'No Category Records Found.!');
// this.noRecordsFound = false; this.noRecordsFound = false;
// } }
}, err => { }, err => {
this.notifier.notify('warning', 'No Category Records Found.!'); this.notifier.notify('warning', 'No Category Records Found.!');
this.noRecordsFound = false; this.noRecordsFound = false;
@ -113,6 +114,7 @@ export class SupplierInfoComponent implements OnInit {
serviceProviderForm: Boolean = false; serviceProviderForm: Boolean = false;
initFormLoadDetails(record) { initFormLoadDetails(record) {
// alert(JSON.stringify(record));
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe( this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
data => { data => {
if(data.dataStatus){ if(data.dataStatus){
@ -126,7 +128,7 @@ export class SupplierInfoComponent implements OnInit {
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if(arr.length > 0) { if(arr.length > 0) {
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
return dataForm.main_raw_materials[key]; return dataForm.main_raw_materials[key];
@ -134,7 +136,7 @@ export class SupplierInfoComponent implements OnInit {
this.initManufacturingProductsDetails(api_main_raw_materials); this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.main_raw_materials_total_payments_percent_on_credit || null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.main_raw_materials_total_payments_percent_on_credit || null);
} }
let arr1 = record.filter(data => data.type_of_activity_id === 2 || 3); let arr1 = record.filter(data => data.type_of_activity_id == 2 || 3);
if(arr1.length > 0) { if(arr1.length > 0) {
let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
return dataForm.trading_products[key]; return dataForm.trading_products[key];
@ -152,19 +154,19 @@ export class SupplierInfoComponent implements OnInit {
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if(arr.length > 0) { if(arr.length > 0) {
this.initManufacturingProductsDetails(null); this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
} }
let arr1 = record.filter(data => data.type_of_activity_id === 2 || 3); let arr1 = record.filter(data => data.type_of_activity_id == 2 || 3);
if(arr1.length > 0) { if(arr1.length > 0) {
this.initTradingProductsDetails(null); this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
} }
this.noRecordsFound = true; this.noRecordsFound = true;
} }
let arr2 = record.filter(data => data.type_of_activity_id === 4); let arr2 = record.filter(data => data.type_of_activity_id == 4);
if(arr2.length > 0) { if(arr2.length > 0) {
this.serviceProviderForm = true; this.serviceProviderForm = true;
} }
@ -177,17 +179,17 @@ export class SupplierInfoComponent implements OnInit {
supplier_info_form_remark: [] supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
let arr = record.filter(data => data.type_of_activity_id === 1); let arr = record.filter(data => data.type_of_activity_id == 1);
if(arr.length > 0) { if(arr.length > 0) {
this.initManufacturingProductsDetails(null); this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
} }
let arr1 = record.filter(data => data.type_of_activity_id === 2 || 3); let arr1 = record.filter(data => data.type_of_activity_id == 2 || 3);
if(arr1.length > 0) { if(arr1.length > 0) {
this.initTradingProductsDetails(null); this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
} }
let arr2 = record.filter(data => data.type_of_activity_id === 4); let arr2 = record.filter(data => data.type_of_activity_id == 4);
if(arr2.length > 0) { if(arr2.length > 0) {
this.serviceProviderForm = true; this.serviceProviderForm = true;
} }
@ -202,7 +204,7 @@ export class SupplierInfoComponent implements OnInit {
manufacturingForm: Boolean = false; manufacturingForm: Boolean = false;
manufacturingFormCreation(val) { manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 1); let arr = val.filter(data => data.type_of_activity_id == 1);
if (arr.length > 0) { if (arr.length > 0) {
this.manufacturingForm = true; this.manufacturingForm = true;
return this._formBuilder.group({ return this._formBuilder.group({
@ -217,7 +219,7 @@ export class SupplierInfoComponent implements OnInit {
tradingForm: Boolean = false; tradingForm: Boolean = false;
tradingFormCreation(val) { tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 2 || 3); let arr = val.filter(data => data.type_of_activity_id == 2 || 3);
if (arr.length > 0) { if (arr.length > 0) {
this.tradingForm = true; this.tradingForm = true;
return this._formBuilder.group({ return this._formBuilder.group({