diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
index 14aaa7e9b..7da7ce2d6 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html
@@ -16,30 +16,59 @@
@@ -69,28 +103,55 @@
Trading Product #{{l+1}}
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
index 62520e33b..04edcbf9f 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts
@@ -43,16 +43,18 @@ export class SupplierInfoComponent implements OnInit {
public m_paymentModeType = [];
private notifier: NotifierService;
-
+ titleList: any=[];
+ companyRelationShipList: any=[];
constructor(
notifier: NotifierService,
private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
- @Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
+ @Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialogRef: MatDialogRef) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 1;
this.company_id = this.pd_all_details.company_id
this.notifier = notifier;
+
}
public viewerOptions: any = {
navbar: false,
@@ -112,6 +114,8 @@ export class SupplierInfoComponent implements OnInit {
// this.getM_FreqOfPurchase();
this.getM_PaymentModeType();
// this.getPdSupplierFormDetails();
+ this.getMasterDetails('COMPANYRELATIONSHIPS',1);
+ this.getMasterDetails('TITLES',2);
}
@@ -136,7 +140,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 == 2);
if(arr.length > 0) {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key];
@@ -146,7 +150,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.manufacturing_details[0].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 == 3 || data.type_of_activity_id ==4);
if(arr1.length > 0) {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key];
@@ -166,19 +170,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 == 2);
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 == 3 || data.type_of_activity_id == 4);
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 == 5);
if(arr2.length > 0) {
this.serviceProviderForm = true;
}
@@ -186,22 +190,23 @@ export class SupplierInfoComponent implements OnInit {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
+ company_id: [this.company_id],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(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 == 2);
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 == 3 || data.type_of_activity_id== 4);
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 == 5);
if(arr2.length > 0) {
this.serviceProviderForm = true;
}
@@ -216,7 +221,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 == 2);
if (arr.length > 0) {
this.manufacturingForm = true;
return this._formBuilder.group({
@@ -231,7 +236,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 == 3 || data.type_of_activity_id == 4);
if (arr.length > 0) {
this.tradingForm = true;
return this._formBuilder.group({
@@ -259,21 +264,30 @@ export class SupplierInfoComponent implements OnInit {
return this._formBuilder.group({
manufacturing_raw_material_name: [''],
manufacturing_supplier_name: [''],
+ person_title_name:[''],
+ person_designation:[''],
manufacturing_contact_person_name: [''],
- manufacturing_contact_person_mobile_number: [''],
+ manufacturing_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
manufacturing_payment_type: [''],
manufacturing_credit_days: [''],
manufacturing_frequency_of_purchase: [''],
+ person_stdcode:['', Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
+ person_landline:['', Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
+
})
} else {
return this._formBuilder.group({
manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null],
manufacturing_supplier_name: [records.manufacturing_supplier_name || null],
+ person_title_name:[records.person_title_name || null],
+ person_designation:[records.person_title_name || null],
manufacturing_contact_person_name: [records.manufacturing_contact_person_name || null],
- manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null],
+ manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
manufacturing_payment_type: [records.manufacturing_payment_type || null],
manufacturing_credit_days: [records.manufacturing_credit_days || null],
manufacturing_frequency_of_purchase: [records.manufacturing_frequency_of_purchase || null],
+ person_stdcode:[records.person_stdcode || null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
+ person_landline:[records.person_landline || null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
}
}
@@ -294,8 +308,12 @@ export class SupplierInfoComponent implements OnInit {
return this._formBuilder.group({
trade_product_name: [''],
trade_supplier_name: [''],
+ person_title_name:[''],
+ person_designation:[],
trade_product_contact_person_name: [''],
- trade_product_contact_person_mobile_number: [''],
+ trade_product_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
+ person_stdcode:[null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
+ person_landline:[null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
trade_product_payment_type: [''],
trade_product_frequency_of_purchase: [''],
trade_product_credit_days: [''],
@@ -303,9 +321,13 @@ export class SupplierInfoComponent implements OnInit {
} else {
return this._formBuilder.group({
trade_product_name: [records.trade_product_name],
+ person_title_name:[records.person_title_name],
+ person_designation:[records.person_designation],
trade_supplier_name: [records.trade_supplier_name],
trade_product_contact_person_name: [records.trade_product_contact_person_name],
- trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number],
+ trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number, Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
+ person_stdcode:[records.person_stdcode, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
+ person_landline:[records.person_landline, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
trade_product_payment_type: [records.trade_product_payment_type],
trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase],
trade_product_credit_days: [records.trade_product_credit_days],
@@ -337,6 +359,25 @@ export class SupplierInfoComponent implements OnInit {
control.removeAt(inx);
}
+ // get all master details
+ getMasterDetails(table:string,type:number){
+ this.pdTrigerService.getAllMasterDatas(table).subscribe(
+ data => {
+ if (data.dataStatus) {
+ if(type==1){
+ this.companyRelationShipList=data.records.filter(item => item.name != 'Others');
+
+ }
+ if(type==2){
+ this.titleList=data.records.filter(val=>val.isactive==1);
+
+ }
+
+
+ }
+ }, error => this.errorMessage = error);
+ }
+
// ==================
//getM_FreqOfPurchase() {
@@ -377,15 +418,17 @@ export class SupplierInfoComponent implements OnInit {
//To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
- console.log(JSON.stringify(answerFormValues));
//Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {
if (dataresult.status == 200) {
// console.log(dataresult);
- this.notifier.notify('success', 'Record Saved Successfully.!');
+ this.notifier.notify('success', 'Saved Successfully.!');
// this.dialogRef.close();
// alert("sample alert for Saving");
+ setTimeout(() =>{
+ this.dialogRef.close();
+ },3000);
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');