-
-
-
-
-
-
-
-
-
-
-
- {{tl.name}}
-
-
-
-
-
-
-
-
-
- Select
-
- {{comrelShip.name}}
-
-
-
-
-
-
-
-
-
-
-
- Enter Valid Mobile Number.
-
-
-
-
- Enter Valid STD Code Number.
-
-
-
-
- Enter Valid LandLine Number.
-
-
-
-
-
- {{ pm.name }}
-
-
-
-
-
- Payment made in Cash.
- Payment made through Banking
- channels.
-
-
-
-
- No.of days of Credit Provided by Supplier
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.scss b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.scss
index 42ac55c9..13f7f226 100755
--- a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.scss
+++ b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.scss
@@ -2,6 +2,9 @@ page-pd-question-supplier-info {
mat-hint{
font-size:12px;
}
+ .scroll-content{
+ background-color: #eee;
+ }
.mat-card{
margin-bottom: 15px;
border-radius: 10px !important;
diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts
index 50330b2b..f0f6b4e4 100755
--- a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts
+++ b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.ts
@@ -12,7 +12,6 @@ import { ToastProvider } from '../../../../providers/common-provider/toast';
* Ionic pages and navigation.
*/
-
@Component({
selector: 'page-pd-question-supplier-info',
templateUrl: 'pd-question-supplier-info.html',
@@ -21,65 +20,64 @@ import { ToastProvider } from '../../../../providers/common-provider/toast';
export class PdQuestionSupplierInfoPage {
users: any;
pdDetails: any;
- formDetails:any;
- company_id:any;
- form_id:any;
+ formDetails: any;
+ company_id: any;
+ form_id: any;
questionDetails: any;
supplierInfoForm: FormGroup;
- business_manufacturingProducts : any = [];
- business_tradingProducts : any = [];
+ business_manufacturingProducts: any = [];
+ business_tradingProducts: any = [];
m_titleList: any = [];
m_paymentList: any = [];
- m_companyRelationShipList : any = [];
-
+ m_companyRelationShipList: any = [];
+
noRecordsFound: Boolean = false;
public submitted = false;
errorMessage: any = '';
- constructor(public navCtrl: NavController, public navParams: NavParams,public fb:FormBuilder,public aws:AwsServiceProvider,public qustCat:QuestionCategoryProvider,public toast:ToastProvider) {
-
+ constructor(public navCtrl: NavController, public navParams: NavParams, public fb: FormBuilder, public aws: AwsServiceProvider, public qustCat: QuestionCategoryProvider, public toast: ToastProvider) {
+
this.questionDetails = this.navParams.get('questionDetails');
this.pdDetails = this.navParams.get('pdDetails');
- this.formDetails=this.navParams.get('formDetails');
+ this.formDetails = this.navParams.get('formDetails');
this.form_id = this.formDetails.form_id;
- // console.log(this.formDetails);
- this.company_id=this.pdDetails.company_id;
+ this.company_id = this.pdDetails.company_id;
this.users = this.aws.getlocale();
-
-
+
+
this.qustCat.getTypeofActivityForSuppliedInfoForm(this.pdDetails.pd_id, this.company_id).subscribe(data => {
-
- if(data.dataStatus){
-
- let datas = data.records;
- this.initFormLoadDetails(datas.type_of_activity);
- this.business_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 2 ){return data}}).map(data=> [...data.prodcuts]);
- // this.business_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]);
-
- let api = Object.keys(datas.type_of_activity).map(function (key) {
- return datas.type_of_activity[key];
- });
- if(api.length > 0){
- api.forEach(val => {
- if (val.type_of_activity_id == 3) {
- if(val.prodcuts){
- this.business_tradingProducts.push(val.prodcuts);
- }
- }
+ if (data.dataStatus) {
- if (val.type_of_activity_id == 4) {
- if(val.prodcuts){
- this.business_tradingProducts.push(val.prodcuts);
- }
- }
- });
+ let datas = data.records;
+ this.initFormLoadDetails(datas.type_of_activity);
+ this.business_manufacturingProducts = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 2) { return data } }).map(data => [...data.prodcuts]);
+ // this.business_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3){return data}}).map(data=> [...data.prodcuts]);
+
+ let api = Object.keys(datas.type_of_activity).map(function (key) {
+ return datas.type_of_activity[key];
+ });
+
+ if (api.length > 0) {
+ api.forEach(val => {
+ if (val.type_of_activity_id == 3) {
+ if (val.prodcuts) {
+ this.business_tradingProducts.push(val.prodcuts);
+ }
}
- this.business_tradingProducts = [].concat.apply([], this.business_tradingProducts);
-
- }else {
+ if (val.type_of_activity_id == 4) {
+ if (val.prodcuts) {
+ this.business_tradingProducts.push(val.prodcuts);
+ }
+ }
+ });
+ }
+
+ this.business_tradingProducts = [].concat.apply([], this.business_tradingProducts);
+
+ } else {
this.toast.pdTriggerappmessage('No Category Records Found.!');
this.noRecordsFound = false;
this.errorMessage = data.msg;
@@ -101,375 +99,375 @@ export class PdQuestionSupplierInfoPage {
serviceProviderForm: Boolean = false;
initFormLoadDetails(record) {
let params: any = {};
- params.pd_id = this.pdDetails.pd_id;
- params.pd_form_id = this.form_id;
- params.company_id = this.company_id;
-
- this.qustCat.retiverForm(params).subscribe(
+ params.pd_id = this.pdDetails.pd_id;
+ params.pd_form_id = this.form_id;
+ params.company_id = this.company_id;
+
+ this.qustCat.retiverForm(params).subscribe(
data => {
- if(data['dataStatus'] == true){
- let dataForm = data['records'];
- if(dataForm !== undefined) {
- this.supplierInfoForm = this.fb.group({
- pdid: [this.pdDetails.pd_id],
- formid: [this.form_id],
- company_id: [this.company_id],
- fk_createdby:[this.users],
- manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
- trade_details: this.fb.array([this.tradingFormCreation(record)]),
- supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
- // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
- });
- 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];
- // });
- let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
-
- this.initManufacturingProductsDetails(api_main_raw_materials);
- this.supplierInfoForm.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 == 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];
- // });
- let api_trading_products = dataForm.trade_details[0].trading_products;
- this.initTradingProductsDetails(api_trading_products);
- this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
- }
- this.noRecordsFound = true;
- } else {
- this.supplierInfoForm = this.fb.group({
- pdid: [this.pdDetails.pd_id],
- formid: [this.form_id],
- company_id: [this.company_id],
- fk_createdby:[this.users],
- manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
- trade_details: this.fb.array([this.tradingFormCreation(record)]),
- supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
- // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
- });
- let arr = record.filter(data => data.type_of_activity_id == 2);
- if(arr.length > 0) {
- this.initManufacturingProductsDetails(null);
- this.supplierInfoForm.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 || data.type_of_activity_id == 4);
- if(arr1.length > 0) {
- this.initTradingProductsDetails(null);
- this.supplierInfoForm.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 == 5);
- if(arr2.length > 0) {
- this.serviceProviderForm = true;
- }
- } else {
+ if (data['dataStatus'] == true) {
+ let dataForm = data['records'];
+ if (dataForm !== undefined) {
this.supplierInfoForm = this.fb.group({
- pdid: [this.pdDetails.pd_id],
- formid: [this.form_id],
- company_id: [this.company_id],
- fk_createdby:[this.users],
- manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
- trade_details: this.fb.array([this.tradingFormCreation(record)]),
- supplier_info_form_remark: []
- // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
- });
- let arr = record.filter(data => data.type_of_activity_id == 2);
- if(arr.length > 0) {
- this.initManufacturingProductsDetails(null);
- this.supplierInfoForm.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 || data.type_of_activity_id== 4);
- if(arr1.length > 0) {
- this.initTradingProductsDetails(null);
- this.supplierInfoForm.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 == 5);
- if(arr2.length > 0) {
- this.serviceProviderForm = true;
- }
+ pdid: [this.pdDetails.pd_id],
+ formid: [this.form_id],
+ company_id: [this.company_id],
+ fk_createdby: [this.users],
+ manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
+ trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
+ // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ });
+ 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];
+ // });
+ let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
+
+ this.initManufacturingProductsDetails(api_main_raw_materials);
+ this.supplierInfoForm.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 == 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];
+ // });
+ let api_trading_products = dataForm.trade_details[0].trading_products;
+ this.initTradingProductsDetails(api_trading_products);
+ this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
+ }
this.noRecordsFound = true;
+ } else {
+ this.supplierInfoForm = this.fb.group({
+ pdid: [this.pdDetails.pd_id],
+ formid: [this.form_id],
+ company_id: [this.company_id],
+ fk_createdby: [this.users],
+ manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
+ trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
+ // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ });
+ let arr = record.filter(data => data.type_of_activity_id == 2);
+ if (arr.length > 0) {
+ this.initManufacturingProductsDetails(null);
+ this.supplierInfoForm.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 || data.type_of_activity_id == 4);
+ if (arr1.length > 0) {
+ this.initTradingProductsDetails(null);
+ this.supplierInfoForm.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 == 5);
+ if (arr2.length > 0) {
+ this.serviceProviderForm = true;
+ }
+ } else {
+ this.supplierInfoForm = this.fb.group({
+ pdid: [this.pdDetails.pd_id],
+ formid: [this.form_id],
+ company_id: [this.company_id],
+ fk_createdby: [this.users],
+ manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]),
+ trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ supplier_info_form_remark: []
+ // wholesale_trade_details: this.fb.array([this.tradingFormCreation(record)]),
+ });
+ let arr = record.filter(data => data.type_of_activity_id == 2);
+ if (arr.length > 0) {
+ this.initManufacturingProductsDetails(null);
+ this.supplierInfoForm.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 || data.type_of_activity_id == 4);
+ if (arr1.length > 0) {
+ this.initTradingProductsDetails(null);
+ this.supplierInfoForm.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 == 5);
+ if (arr2.length > 0) {
+ this.serviceProviderForm = true;
+ }
+ this.noRecordsFound = true;
}
}, err => {
}
- );
- }
+ );
+ }
- manufacturingForm: Boolean = false;
- manufacturingFormCreation(val) {
- let arr = val.filter(data => data.type_of_activity_id == 2);
- if (arr.length > 0) {
- this.manufacturingForm = true;
- return this.fb.group({
- main_raw_materials: this.fb.array([]),
- main_raw_materials_total_payments_percent_on_credit: []
- })
- // }
- } else {
- return;
- }
+ manufacturingForm: Boolean = false;
+ manufacturingFormCreation(val) {
+ let arr = val.filter(data => data.type_of_activity_id == 2);
+ if (arr.length > 0) {
+ this.manufacturingForm = true;
+ return this.fb.group({
+ main_raw_materials: this.fb.array([]),
+ main_raw_materials_total_payments_percent_on_credit: []
+ })
+ // }
+ } else {
+ return;
}
-
- tradingForm: Boolean = false;
- tradingFormCreation(val) {
- 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.fb.group({
- trading_products: this.fb.array([]),
- trading_products_total_payments_percent_on_credit: []
- });
- } else {
- return;
- }
+ }
+
+ tradingForm: Boolean = false;
+ tradingFormCreation(val) {
+ 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.fb.group({
+ trading_products: this.fb.array([]),
+ trading_products_total_payments_percent_on_credit: []
+ });
+ } else {
+ return;
}
-
- initManufacturingProductsDetails(datas) {
- const control =
this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
- if(datas === null){
- control.push(this.initManufacturingProducts(null));
- } else {
- datas.forEach((val,inx) => {
- this.checkCard(val.manufacturing_payment_type,1,inx);
- control.push(this.initManufacturingProducts(val));
- });
- }
- }
-
- initManufacturingProducts(records) {
- if(records === null) {
- return this.fb.group({
- manufacturing_raw_material_name: [''],
- manufacturing_supplier_name: [''],
- person_title_name:[''],
- person_designation:[''],
- other_person_designation:[''],
- manufacturing_contact_person_name: [''],
- manufacturing_contact_person_mobile_number: [''],
- //,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])
- manufacturing_payment_type: [''],
- manufacturing_payment_mode:[''],
- manufacturing_credit_days_from: [''],
- manufacturing_credit_days_to:[''],
- 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.fb.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_designation || null],
- other_person_designation:[records.other_person_designation || null],
- manufacturing_contact_person_name: [records.manufacturing_contact_person_name || 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_payment_mode:[records.manufacturing_payment_mode],
- manufacturing_credit_days_from: [records.manufacturing_credit_days_from || null],
- manufacturing_credit_days_to:[records.manufacturing_credit_days_to || 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]*$')])
- })
- }
- }
-
- initTradingProductsDetails(datas) {
- const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
-
- if(datas === null){
- control.push(this.initTradingProducts(null));
- } else {
- datas.forEach((val,inx) => {
- this.checkCard(val.trade_product_payment_type,2,inx);
- control.push(this.initTradingProducts(val));
- });
- }
- }
-
- initTradingProducts(records) {
- if(records === null) {
- return this.fb.group({
- trade_product_name: [''],
- trade_supplier_name: [''],
- person_title_name:[''],
- person_designation:[''],
- other_person_designation:[''],
- trade_product_contact_person_name: [''],
- 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_payment_mode: [''],
- trade_product_frequency_of_purchase: [''],
- trade_product_credit_days_from: [''],
- trade_product_credit_days_to: [''],
- })
- } else {
- return this.fb.group({
- trade_product_name: [records.trade_product_name],
- person_title_name:[records.person_title_name],
- person_designation:[records.person_designation],
- other_person_designation:[records.other_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],
- //, 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_payment_mode: [records.trade_product_payment_mode],
- trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase],
- trade_product_credit_days_from: [records.trade_product_credit_days_from],
- trade_product_credit_days_to: [records.trade_product_credit_days_to],
- })
- }
- }
-
- addMoreRawMaterials(e): void {
- // e.stropPropagation();
- const control = this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
-
+ }
+
+ initManufacturingProductsDetails(datas) {
+ const control = this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
+ if (datas === null) {
control.push(this.initManufacturingProducts(null));
+ } else {
+ datas.forEach((val, inx) => {
+ this.checkCard(val.manufacturing_payment_type, 1, inx);
+ control.push(this.initManufacturingProducts(val));
+ });
}
-
- removeRawMaterials(inx): void {
- const control = this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
- control.removeAt(inx);
+ }
+
+ initManufacturingProducts(records) {
+ if (records === null) {
+ return this.fb.group({
+ manufacturing_raw_material_name: [''],
+ manufacturing_supplier_name: [''],
+ person_title_name: [''],
+ person_designation: [''],
+ other_person_designation: [''],
+ manufacturing_contact_person_name: [''],
+ manufacturing_contact_person_mobile_number: [''],
+ //,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])
+ manufacturing_payment_type: [''],
+ manufacturing_payment_mode: [''],
+ manufacturing_credit_days_from: [''],
+ manufacturing_credit_days_to: [''],
+ 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.fb.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_designation || null],
+ other_person_designation: [records.other_person_designation || null],
+ manufacturing_contact_person_name: [records.manufacturing_contact_person_name || 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_payment_mode: [records.manufacturing_payment_mode],
+ manufacturing_credit_days_from: [records.manufacturing_credit_days_from || null],
+ manufacturing_credit_days_to: [records.manufacturing_credit_days_to || 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]*$')])
+ })
}
-
- addMoretradeProduct(e): void {
- // e.stropPropagation();
- const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
-
+ }
+
+ initTradingProductsDetails(datas) {
+ const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
+
+ if (datas === null) {
control.push(this.initTradingProducts(null));
- }
-
- removeTradingProduct(inx): void {
- const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
- control.removeAt(inx);
- }
-
-
- getdropList(){
-
- this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(
- data => {
- this.m_companyRelationShipList = data['records'].filter(data => data.isactive == 1);
- });
-
- this.qustCat.getcommondrop('TITLES').subscribe(
- data => {
- this.m_titleList = data['records'].filter(data => data.isactive == 1);
- });
-
- this.qustCat.getcommondrop('PAYMENTMODE').subscribe(
- data => {
- this.m_paymentList = data['records'].filter(data => data.isactive == 1);
+ } else {
+ datas.forEach((val, inx) => {
+ this.checkCard(val.trade_product_payment_type, 2, inx);
+ control.push(this.initTradingProducts(val));
});
}
+ }
-
-saveSupplierInfo(FormValues) {
+ initTradingProducts(records) {
+ if (records === null) {
+ return this.fb.group({
+ trade_product_name: [''],
+ trade_supplier_name: [''],
+ person_title_name: [''],
+ person_designation: [''],
+ other_person_designation: [''],
+ trade_product_contact_person_name: [''],
+ 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_payment_mode: [''],
+ trade_product_frequency_of_purchase: [''],
+ trade_product_credit_days_from: [''],
+ trade_product_credit_days_to: [''],
+ })
+ } else {
+ return this.fb.group({
+ trade_product_name: [records.trade_product_name],
+ person_title_name: [records.person_title_name],
+ person_designation: [records.person_designation],
+ other_person_designation: [records.other_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],
+ //, 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_payment_mode: [records.trade_product_payment_mode],
+ trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase],
+ trade_product_credit_days_from: [records.trade_product_credit_days_from],
+ trade_product_credit_days_to: [records.trade_product_credit_days_to],
+ })
+ }
+ }
+
+ addMoreRawMaterials(e): void {
+ // e.stropPropagation();
+ const control = this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
+
+ control.push(this.initManufacturingProducts(null));
+ }
+
+ removeRawMaterials(inx): void {
+ const control = this.supplierInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
+ control.removeAt(inx);
+ }
+
+ addMoretradeProduct(e): void {
+ // e.stropPropagation();
+ const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
+
+ control.push(this.initTradingProducts(null));
+ }
+
+ removeTradingProduct(inx): void {
+ const control = this.supplierInfoForm.controls['trade_details']['controls'][0].controls['trading_products'];
+ control.removeAt(inx);
+ }
+
+
+ getdropList() {
+
+ this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe(
+ data => {
+ this.m_companyRelationShipList = data['records'].filter(data => data.isactive == 1);
+ });
+
+ this.qustCat.getcommondrop('TITLES').subscribe(
+ data => {
+ this.m_titleList = data['records'].filter(data => data.isactive == 1);
+ });
+
+ this.qustCat.getcommondrop('PAYMENTMODE').subscribe(
+ data => {
+ this.m_paymentList = data['records'].filter(data => data.isactive == 1);
+ });
+ }
+
+
+ saveSupplierInfo(FormValues) {
var answerFormValues = FormValues;
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
this.qustCat.saveForm(answerFormValues).subscribe(responsed => {
- if(responsed['status'] == 200) {
+ if (responsed['status'] == 200) {
this.navCtrl.pop();
this.toast.pdTriggerappmessage('Record Saved Successfully.!');
- }else{
- this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
+ } else {
+ this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!');
}
});
-
-}
-selectedPersonDesignation(items,e,flag){
- if(flag == 1){
- e==1 ? '' : '' ;
- // e==1 ? items.controls['other_person_designation'].setValidators([Validators.required])
- // : items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue('');
- // items.controls['other_person_designation'].updateValueAndValidity();
}
- else if(flag == 2){
- e==1 ? '' : '' ;
- // e==1 ?items.controls['other_person_designation'].setValidators([Validators.required])
- // :items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue('');
- // items.controls['other_person_designation'].updateValueAndValidity();
- }
-}
-mfgCreditCardFlag : boolean = false;
-trdCreditCardFlag : boolean = false;
-mfgCounter: any = [];
-trdCounter: any = [];
-checkCard(e,flag,index){
- if(flag == 2 && e==3){
- this.trdCounter[index] = 1;
- }
- else if(flag == 2 && e!=3){
- this.trdCounter[index] = 0;
- }
- let TRD = this.trdCounter.reduce((sum, val) => sum + +val, 0);
- this.trdCreditCardFlag = TRD > 0 ? true : false ;
-
- if(flag == 1 && e==3){
- this.mfgCounter[index] = 1;
- }
- else if(flag == 1 && e!=3){
- this.mfgCounter[index] = 0;
- }
- let MFG = this.mfgCounter.reduce((sum, val) => sum + +val, 0);
- this.mfgCreditCardFlag = MFG > 0 ? true : false ;
-}
-
-selectedPaymentTerms(items,e,flag){
- if(flag == 2){
- if(e==3){
- // items.controls['trade_product_credit_days_from'].setValidators([Validators.required]);
- // items.controls['trade_product_credit_days_to'].setValidators([Validators.required]);
+ selectedPersonDesignation(items, e, flag) {
+ if (flag == 1) {
+ e == 1 ? '' : '';
+ // e==1 ? items.controls['other_person_designation'].setValidators([Validators.required])
+ // : items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue('');
+ // items.controls['other_person_designation'].updateValueAndValidity();
}
- else{
- items.controls['trade_product_credit_days_from'].clearValidators();
- items.controls['trade_product_credit_days_from'].setValue('');
- items.controls['trade_product_credit_days_to'].clearValidators();
- items.controls['trade_product_credit_days_to'].setValue('');
+ else if (flag == 2) {
+ e == 1 ? '' : '';
+ // e==1 ?items.controls['other_person_designation'].setValidators([Validators.required])
+ // :items.controls['other_person_designation'].clearValidators(),items.controls['other_person_designation'].setValue('');
+ // items.controls['other_person_designation'].updateValueAndValidity();
}
- items.controls['trade_product_credit_days_from'].updateValueAndValidity();
- items.controls['trade_product_credit_days_to'].updateValueAndValidity();
}
- else if(flag == 1){
- if(e==3){ //items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]);
- //items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]);
- }
- else{
- items.controls['manufacturing_credit_days_from'].clearValidators();
- items.controls['manufacturing_credit_days_from'].setValue('');
- items.controls['manufacturing_credit_days_to'].clearValidators();
- items.controls['manufacturing_credit_days_to'].setValue('');
+
+ mfgCreditCardFlag: boolean = false;
+ trdCreditCardFlag: boolean = false;
+ mfgCounter: any = [];
+ trdCounter: any = [];
+ checkCard(e, flag, index) {
+ if (flag == 2 && e == 3) {
+ this.trdCounter[index] = 1;
+ }
+ else if (flag == 2 && e != 3) {
+ this.trdCounter[index] = 0;
+ }
+ let TRD = this.trdCounter.reduce((sum, val) => sum + +val, 0);
+ this.trdCreditCardFlag = TRD > 0 ? true : false;
+
+ if (flag == 1 && e == 3) {
+ this.mfgCounter[index] = 1;
+ }
+ else if (flag == 1 && e != 3) {
+ this.mfgCounter[index] = 0;
+ }
+ let MFG = this.mfgCounter.reduce((sum, val) => sum + +val, 0);
+ this.mfgCreditCardFlag = MFG > 0 ? true : false;
+ }
+
+ selectedPaymentTerms(items, e, flag) {
+ if (flag == 2) {
+ if (e == 3) {
+ // items.controls['trade_product_credit_days_from'].setValidators([Validators.required]);
+ // items.controls['trade_product_credit_days_to'].setValidators([Validators.required]);
+ }
+ else {
+ items.controls['trade_product_credit_days_from'].clearValidators();
+ items.controls['trade_product_credit_days_from'].setValue('');
+ items.controls['trade_product_credit_days_to'].clearValidators();
+ items.controls['trade_product_credit_days_to'].setValue('');
+ }
+ items.controls['trade_product_credit_days_from'].updateValueAndValidity();
+ items.controls['trade_product_credit_days_to'].updateValueAndValidity();
+ }
+ else if (flag == 1) {
+ if (e == 3) { //items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]);
+ //items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]);
+ }
+ else {
+ items.controls['manufacturing_credit_days_from'].clearValidators();
+ items.controls['manufacturing_credit_days_from'].setValue('');
+ items.controls['manufacturing_credit_days_to'].clearValidators();
+ items.controls['manufacturing_credit_days_to'].setValue('');
+ }
+ items.controls['manufacturing_credit_days_from'].updateValueAndValidity();
+ items.controls['manufacturing_credit_days_to'].updateValueAndValidity();
}
- items.controls['manufacturing_credit_days_from'].updateValueAndValidity();
- items.controls['manufacturing_credit_days_to'].updateValueAndValidity();
}
-}
}
\ No newline at end of file