client , supplier form details changes : kdk
This commit is contained in:
parent
0c5e266257
commit
b0dc7c94ee
@ -19,7 +19,7 @@
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
<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-form-field>
|
||||
<!--<mat-form-field style="width: 100%">
|
||||
@ -77,7 +77,7 @@
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
<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-form-field>
|
||||
<!--<mat-form-field style="width: 100%">
|
||||
@ -136,7 +136,7 @@
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 100%">
|
||||
<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-form-field>
|
||||
<!--<mat-form-field style="width: 100%">
|
||||
|
||||
@ -104,36 +104,38 @@ export class ClientInfoComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
|
||||
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
|
||||
// if(data.dataStatus === undefined){
|
||||
let datas = {
|
||||
"profession_name": "Others",
|
||||
"type_of_activity": [
|
||||
{
|
||||
"type_of_activity_id": 1,
|
||||
"name": "Manufacturing Details"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 2,
|
||||
"name": "Retail trading"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 3,
|
||||
"name": "Wholesale trading"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 4,
|
||||
"name": "Service Providers"
|
||||
}
|
||||
]
|
||||
};
|
||||
// this.m_manufacturingProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 1 ){return data.product_details}});
|
||||
// this.m_tradingProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 3 ){return data.product_details}});
|
||||
// this.m_suplierProducts = data.type_of_activity_id.filter(data=>{if(data.type_of_activity_id === 4 ){return data.product_details}});
|
||||
this.initFormLoadDetails(datas.type_of_activity);
|
||||
// }else {
|
||||
// this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
// this.noRecordsFound = false;
|
||||
if(data.dataStatus){
|
||||
// let datas = {
|
||||
// "profession_name": "Others",
|
||||
// "type_of_activity": [
|
||||
// {
|
||||
// "type_of_activity_id": 1,
|
||||
// "name": "Manufacturing Details"
|
||||
// },
|
||||
// {
|
||||
// "type_of_activity_id": 2,
|
||||
// "name": "Retail trading"
|
||||
// },
|
||||
// {
|
||||
// "type_of_activity_id": 3,
|
||||
// "name": "Wholesale trading"
|
||||
// },
|
||||
// {
|
||||
// "type_of_activity_id": 4,
|
||||
// "name": "Service Providers"
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
let datas = data.records;
|
||||
this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 1 ){return data}}).map(data=> [...data.prodcuts]);
|
||||
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);
|
||||
}else {
|
||||
this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
this.noRecordsFound = false;
|
||||
}
|
||||
}, err => {
|
||||
this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
this.noRecordsFound = false;
|
||||
@ -153,7 +155,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
if (dataForm !== undefined) {
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['1'],
|
||||
formid: ['2'],
|
||||
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
|
||||
trade_details: this._formBuilder.array([this.tradingFormCreation(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)]),
|
||||
});
|
||||
// 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) {
|
||||
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
||||
return dataForm.main_raw_materials[key];
|
||||
@ -171,7 +173,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
|
||||
return dataForm.trading_products[key];
|
||||
@ -181,7 +183,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (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);
|
||||
}
|
||||
// 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) {
|
||||
this.retaildTradingForm = true;
|
||||
}
|
||||
@ -198,24 +200,24 @@ export class ClientInfoComponent implements OnInit {
|
||||
} else {
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['1'],
|
||||
formid: ['2'],
|
||||
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
|
||||
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
|
||||
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
|
||||
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
|
||||
// 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) {
|
||||
this.initManufacturingProductsDetails(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) {
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (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);
|
||||
}
|
||||
// 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) {
|
||||
this.retaildTradingForm = true;
|
||||
}
|
||||
@ -233,30 +235,30 @@ export class ClientInfoComponent implements OnInit {
|
||||
} else {
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['1'],
|
||||
formid: ['2'],
|
||||
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
|
||||
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
|
||||
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
|
||||
supplier_info_form_remark: []
|
||||
// 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) {
|
||||
this.initManufacturingProductsDetails(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) {
|
||||
this.initTradingProductsDetails(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) {
|
||||
this.initServiceProviderProductsDetails(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
|
||||
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) {
|
||||
this.retaildTradingForm = true;
|
||||
}
|
||||
@ -271,7 +273,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
|
||||
manufacturingForm: Boolean = false;
|
||||
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) {
|
||||
this.manufacturingForm = true;
|
||||
return this._formBuilder.group({
|
||||
@ -286,7 +288,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
|
||||
tradingForm: Boolean = false;
|
||||
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) {
|
||||
this.tradingForm = true;
|
||||
return this._formBuilder.group({
|
||||
@ -300,7 +302,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
|
||||
serviceProviderForm: Boolean = false;
|
||||
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) {
|
||||
this.serviceProviderForm = true;
|
||||
return this._formBuilder.group({
|
||||
@ -491,8 +493,16 @@ export class ClientInfoComponent implements OnInit {
|
||||
var answerFormValues = this._supplierQuesFrom.value;
|
||||
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
|
||||
console.log(JSON.stringify(answerFormValues));
|
||||
Object.keys(answerFormValues).forEach((key) => {if(answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === ''){ delete answerFormValues[key]}; console.log("chec:" +answerFormValues[key])});
|
||||
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
|
||||
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
||||
dataresult => {
|
||||
|
||||
@ -255,3 +255,4 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -77,29 +77,30 @@ export class SupplierInfoComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
|
||||
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
|
||||
// if(data.dataStatus === undefined){
|
||||
let datas = {
|
||||
"profession_name": "Others",
|
||||
"type_of_activity": [
|
||||
{
|
||||
"type_of_activity_id": 1,
|
||||
"name": "Manufacturing Details"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 2,
|
||||
"name": "Retail trading"
|
||||
},
|
||||
{
|
||||
"type_of_activity_id": 4,
|
||||
"name": "Service Provider"
|
||||
}
|
||||
]
|
||||
};
|
||||
this.initFormLoadDetails(datas.type_of_activity);
|
||||
// }else {
|
||||
// this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
// this.noRecordsFound = false;
|
||||
if(data.dataStatus){
|
||||
// let datas = {
|
||||
// "profession_name": "Others",
|
||||
// "type_of_activity": [
|
||||
// {
|
||||
// "type_of_activity_id": 1,
|
||||
// "name": "Manufacturing Details"
|
||||
// },
|
||||
// {
|
||||
// "type_of_activity_id": 2,
|
||||
// "name": "Retail trading"
|
||||
// },
|
||||
// {
|
||||
// "type_of_activity_id": 4,
|
||||
// "name": "Service Provider"
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
let datas = data.records;
|
||||
this.initFormLoadDetails(datas.type_of_activity);
|
||||
}else {
|
||||
this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
this.noRecordsFound = false;
|
||||
}
|
||||
}, err => {
|
||||
this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
this.noRecordsFound = false;
|
||||
@ -113,6 +114,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
|
||||
serviceProviderForm: Boolean = false;
|
||||
initFormLoadDetails(record) {
|
||||
// alert(JSON.stringify(record));
|
||||
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
|
||||
data => {
|
||||
if(data.dataStatus){
|
||||
@ -126,7 +128,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
|
||||
// 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) {
|
||||
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
||||
return dataForm.main_raw_materials[key];
|
||||
@ -134,7 +136,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
let api_trading_products = Object.keys(dataForm.trading_products).map(function (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]
|
||||
// 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) {
|
||||
this.initManufacturingProductsDetails(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) {
|
||||
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.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) {
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
@ -177,17 +179,17 @@ export class SupplierInfoComponent implements OnInit {
|
||||
supplier_info_form_remark: []
|
||||
// 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) {
|
||||
this.initManufacturingProductsDetails(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) {
|
||||
this.initTradingProductsDetails(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) {
|
||||
this.serviceProviderForm = true;
|
||||
}
|
||||
@ -202,7 +204,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
|
||||
manufacturingForm: Boolean = false;
|
||||
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) {
|
||||
this.manufacturingForm = true;
|
||||
return this._formBuilder.group({
|
||||
@ -217,7 +219,7 @@ export class SupplierInfoComponent implements OnInit {
|
||||
|
||||
tradingForm: Boolean = false;
|
||||
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) {
|
||||
this.tradingForm = true;
|
||||
return this._formBuilder.group({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user