From fc809bfa61095aee451538275e5bc2d8a454d6b7 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 21 Feb 2019 17:58:54 +0530 Subject: [PATCH] title : ps --- src/app/app.module.ts | 4 - .../pd-question-category.ts | 6 +- .../pd-question-business-banking.html | 2 +- .../pd-question-business-banking.scss | 15 +- .../pd-question-business-banking.ts | 7 +- .../pd-question-business-group.ts | 6 +- .../pd-question-client-info.html | 829 ++++++++---------- .../pd-question-client-info.scss | 5 +- .../pd-question-client-info.ts | 546 +++++------- .../pd-question-stock-info.html | 767 +++++++--------- .../pd-question-stock-info.scss | 3 + .../pd-question-stock-info.ts | 194 +--- .../pd-question-supplier-info.html | 508 +++++------ .../pd-question-supplier-info.scss | 3 + .../pd-question-supplier-info.ts | 754 ++++++++-------- 15 files changed, 1577 insertions(+), 2072 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 979ff4f7..125ce925 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -115,10 +115,6 @@ import { PdPipe } from '../pipes/pd/pd'; import { PdQuestionAssessedBusinessIncomePage } from '../pages/pd-question/pd-question-assessed-business-income/pd-question-assessed-business-income'; import { PdGeneralImagesPage } from '../pages/pd-general-images/pd-general-images'; import { PdQuestionSalaryInfoPage } from '../pages/pd-question/pd-question-salary-info/pd-question-salary-info'; -import { DatabaseProvider } from '../providers/database/database' -import { SQLite } from '@ionic-native/sqlite' -import { AndroidPermissions } from '@ionic-native/android-permissions'; - @NgModule({ declarations: [ diff --git a/src/pages/pd-question-category/pd-question-category.ts b/src/pages/pd-question-category/pd-question-category.ts index ee57b740..a546cde7 100644 --- a/src/pages/pd-question-category/pd-question-category.ts +++ b/src/pages/pd-question-category/pd-question-category.ts @@ -18,11 +18,11 @@ import { PdQuestionBankingPage } from '../pd-question/pd-question-banking/pd-que import { PdQuestionFamilyPage } from '../pd-question/pd-question-family/pd-question-family'; import { PdQuestionAssestsPage } from '../pd-question/pd-question-assests/pd-question-assests'; import { PdQuestionOtherIncomePage } from '../pd-question/pd-question-other-income/pd-question-other-income'; -import { PdQuestionSupplierInfoPage } from '../pd-question/pd-question-supplier-info/pd-question-supplier-info'; +import { PdQuestionSupplierInfoPage } from '../pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info'; import { PdQuestionPersonalInfoPage } from '../pd-question/pd-question-personal-info/pd-question-personal-info'; -import { PdQuestionStockInfoPage } from '../pd-question/pd-question-stock-info/pd-question-stock-info'; +import { PdQuestionStockInfoPage } from '../pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info'; import { PdQuestionFinancialInfoPage } from '../pd-question/pd-question-financial-info/pd-question-financial-info'; -import { PdQuestionClientInfoPage } from '../pd-question/pd-question-client-info/pd-question-client-info'; +import { PdQuestionClientInfoPage } from '../pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info'; import { PdQuestionRentalInfoPage } from '../pd-question/pd-question-rental-info/pd-question-rental-info'; import { PdQuestionAssessedInfoPage } from '../pd-question/pd-question-assessed-info/pd-question-assessed-info'; import { PdQuestionAssessedDashPage } from '../pd-question/pd-question-assessed-dash/pd-question-assessed-dash'; diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.html b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.html index 2156ccbf..781b92df 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.html @@ -7,7 +7,7 @@ - Banking Details + {{formDetails.form_name}} diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.scss b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.scss index 7976a5db..4deff19f 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.scss +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.scss @@ -1,3 +1,16 @@ page-pd-question-business-banking { - + mat-hint{ + font-size:12px; + } + .scroll-content{ + background-color: #eee; + } + .mat-card{ + margin-bottom: 15px; + border-radius: 10px !important; + box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.56), 0 4px 25px 0 rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2) !important; + } + .mat-card-content{ + margin-bottom: 0px !important; + } } diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.ts b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.ts index 87f1ac37..ba0380bc 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-banking/pd-question-business-banking.ts @@ -46,15 +46,16 @@ step:number constructor(public navCtrl: NavController, public navParams: NavParams,public aws: AwsServiceProvider,public fb:FormBuilder,public qustCat:QuestionCategoryProvider,public cons:ConstantsProvider,public toast:ToastProvider) { this.pdDetails=this.navParams.get('pdDetails') - console.log("pd",this.pdDetails); - this.pdDetails = this.navParams.get('pdDetails'); + // console.log("pd",this.pdDetails); this.pd_cus_segment=this.pdDetails.customer_segment_abbr.toUpperCase(); this.pd_cus_segment=this.pd_cus_segment.substring(0,3) this.pdid=this.pdDetails.pd_id; this.formDetails=this.navParams.get('formDetails'); this.form_id = this.formDetails.form_id; this.company_id=this.pdDetails.company_id - // console.log("Form Id",this.FormId); + // console.log(" business bank Form Id fetched",this.form_id); + // console.log(" business bank Form Details",this.formDetails); + // console.log(" business bank Form Id",this.formDetails.form_id); this.applicants = this.pdDetails.applicat_details; this.applicants = this.applicants.filter(appt=>appt.applicant_type != 2) this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'}); diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-business-group.ts b/src/pages/pd-question/pd-question-business-group/pd-question-business-group.ts index 871e6ef1..d3f7dc2d 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-business-group.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-business-group.ts @@ -82,15 +82,15 @@ export class PdQuestionBusinessGroupPage { // console.log("form_id",details.form_id) } if(details.form_id==15){ - this.navCtrl.push(PdQuestionSupplierInfoPage,{'formDetails':details.form_id,'pdDetails':this.pdDetails}); + this.navCtrl.push(PdQuestionSupplierInfoPage,{'formDetails':details,'pdDetails':this.pdDetails}); // console.log("form_id",details.form_id) } if(details.form_id==21){ - this.navCtrl.push(PdQuestionBusinessBankingPage,{'formDetails':details.form_id,'pdDetails':this.pdDetails}); + this.navCtrl.push(PdQuestionBusinessBankingPage,{'formDetails':details,'pdDetails':this.pdDetails}); // console.log("form_id",details.form_id) } if(details.form_id==22){ - this.navCtrl.push(PdQuestionBusinessAssetsPage,{'formDetails':details.form_id,'pdDetails':this.pdDetails}); + this.navCtrl.push(PdQuestionBusinessAssetsPage,{'formDetails':details,'pdDetails':this.pdDetails}); // console.log("form_id",details.form_id) } diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html index 7f03730f..277647e4 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.html @@ -1,464 +1,387 @@ - - - - {{formDetails.form_name}} - - + + + {{formDetails.form_name}} + - -
- - - Manufacturing Product Details -
-
-
-
- - Product #{{l+1}} - -
- - - {{ pm.name }} - - - - - - - - - - - - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - - - - - Enter Valid Mobile Number. - - - - Enter Valid STD Code Number. - - - - - Enter Valid LandLine Number. - - - - - - - {{ pm.name }} - - - - - - Payment received in Cash. - Payment received through Banking channels. - - - - - - - No of days of Credit provided to Client for payment - - - - - - - - -
- - - - - - - - - - -
-
- -
-
- - -
-
-
- - Trading Product Details -
-
-
-
- - Trading Product #{{l+1}} - - -
- - - {{ pm.name }} - - - - - - - - - - - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - - - - - - Enter Valid Mobile Number. - - - - Enter Valid STD Code Number. -   -   - - - Enter Valid LandLine Number. - - + +
+ +
+ +
Manufacturing Product Details
+
+
+
+
+ Product #{{l+1}} + +
+ + + {{ + pm.name }} + + + + + + + + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + + + Enter Valid Mobile Number. + + + + Enter Valid STD Code Number. + + + + + Enter Valid LandLine Number. + + + + {{ + pm.name }} + + + + + Payment received in + Cash. + Payment + received through Banking channels. + + + + No of days of Credit provided to Client for payment + + + + + + + +
+ + + + + + + + + + + + +
+
+
+
+ + + +
+
+
+
+ +
Trading Product Details
+
+
+
+
+ Trading Product #{{l+1}} + +
+ + + + {{ + pm.name }} + + + + + + + + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + + + Enter Valid Mobile Number. + + + + Enter Valid STD Code Number. + + + + + Enter Valid LandLine Number. + + + + {{ + pm.name }} + - - - - {{ pm.name }} - - - - - - Payment received in Cash. - Payment received through Banking channels. - - - - - - - No of days of Credit provided to Client for payment - - - - - - -
- - - - - - - - - - -
- - -
-
-
- - - -
-
-
-
- - - -
-
-
-
- - Service Provided #{{l+1}} - - -
- - - {{ pm.name }} - - - - - - - - - - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - - - - - Enter Valid Mobile Number. - - - - Enter Valid STD Code Number. -   -   - - - Enter Valid LandLine Number. - - - - - - {{ pm.name }} - - - - - - Payment received in Cash. - Payment received through Banking channels. - - - - +
+
+
+
+ Service Provided #{{l+1}} + +
+ + + {{ + pm.name }} + + + + + + + + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + + + Enter Valid Mobile Number. + + + + Enter Valid STD Code Number. + + + + + Enter Valid LandLine Number. + + + + {{ + pm.name }} + + + + + Payment received in + Cash. + Payment + received through Banking channels. + + + -
- - No of days of Credit provided to Client for payment - - - - - - +
+ + No of days of Credit provided to Client for payment + + + + + + - - - - - - - - - - - - - -
-
- -
- - - -
- -
-
-
- - - Remarks - - - - - - - - - - + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+
+ + + Remarks + + + + + + - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.scss b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.scss index 7d3770d4..ed74ff63 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.scss +++ b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.scss @@ -2,7 +2,10 @@ page-pd-question-client-info { mat-hint{ font-size:12px; } - .mat-card{ + .scroll-content{ + background-color: #eee; + } + .mat-card{ margin-bottom: 15px; border-radius: 10px !important; box-shadow: 0 16px 38px -12px rgba(0, 0, 0, 0.56), 0 4px 25px 0 rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2) !important; diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts index c9ce875b..5067ee30 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-client-info/pd-question-client-info.ts @@ -22,8 +22,8 @@ export class PdQuestionClientInfoPage { users: any; pdDetails: any; formDetails: any; - pdid:any; - company_id:any; + pdid: any; + company_id: any; questionDetails: any; clientInfoForm: FormGroup; @@ -34,54 +34,54 @@ export class PdQuestionClientInfoPage { public m_paymentType = []; - companyRelationShipList: any=[]; - - titleList: any=[]; + companyRelationShipList: any = []; + + titleList: any = []; noRecordsFound: Boolean = false; errorMessage: any = ''; - m_manufacturingProducts : any =[]; - m_tradingProducts:any=[]; - m_suplierProducts : any =[]; - - - constructor(public navCtrl: NavController, public navParams: NavParams,public qustCat:QuestionCategoryProvider,public aws:AwsServiceProvider,public toast:ToastProvider,public fb:FormBuilder) { + m_manufacturingProducts: any = []; + m_tradingProducts: any = []; + m_suplierProducts: any = []; + + + constructor(public navCtrl: NavController, public navParams: NavParams, public qustCat: QuestionCategoryProvider, public aws: AwsServiceProvider, public toast: ToastProvider, public fb: FormBuilder) { this.pdDetails = this.navParams.get('pdDetails'); - this.formDetails=this.navParams.get('formDetails'); + this.formDetails = this.navParams.get('formDetails'); this.users = this.aws.getlocale(); - this.pdid=this.pdDetails.pd_id; - this.company_id=this.pdDetails.company_id; + this.pdid = this.pdDetails.pd_id; + this.company_id = this.pdDetails.company_id; - this.qustCat.getTypeofActivityForSuppliedInfoForm(this.pdid,this.company_id).subscribe(data => { - - if(data.dataStatus){ - - let datas = data.records; - this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 2 ){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 == 5 ){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.m_tradingProducts.push(val.prodcuts); - } - } + this.qustCat.getTypeofActivityForSuppliedInfoForm(this.pdid, this.company_id).subscribe(data => { - if (val.type_of_activity_id == 4) { - if(val.prodcuts){ - this.m_tradingProducts.push(val.prodcuts); - } - } + if (data.dataStatus) { + + let datas = data.records; + this.m_manufacturingProducts = datas.type_of_activity.filter(data => { if (data.type_of_activity_id == 2) { 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 == 5) { return data } }).map(data => [...data.prodcuts]); + let api = Object.keys(datas.type_of_activity).map(function (key) { + return datas.type_of_activity[key]; }); - } - this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts); + if (api.length > 0) { + api.forEach(val => { + if (val.type_of_activity_id == 3) { + if (val.prodcuts) { + this.m_tradingProducts.push(val.prodcuts); + } + } - this.initFormLoadDetails(datas.type_of_activity); + if (val.type_of_activity_id == 4) { + if (val.prodcuts) { + this.m_tradingProducts.push(val.prodcuts); + } + } + }); + } + this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts); - }else { + this.initFormLoadDetails(datas.type_of_activity); + + } else { this.toast.pdTriggerappmessage('No Category Records Found.!'); this.noRecordsFound = false; this.errorMessage = data.msg; @@ -101,10 +101,10 @@ export class PdQuestionClientInfoPage { initFormLoadDetails(record) { let params: any = {}; - params.pd_id = this.pdid; - params.pd_form_id = this.formDetails.form_id; - params.company_id = this.company_id; - this.qustCat.retiverForm(params).subscribe( + params.pd_id = this.pdid; + params.pd_form_id = this.formDetails.form_id; + params.company_id = this.company_id; + this.qustCat.retiverForm(params).subscribe( data => { if (data['dataStatus']) { let dataForm = data['records']; @@ -112,8 +112,8 @@ export class PdQuestionClientInfoPage { this.clientInfoForm = this.fb.group({ pdid: [this.pdid], formid: [this.formDetails.form_id], - company_id:[this.company_id], - fk_createdby:[this.users], + 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)]), service_provider_details: this.fb.array([this.serviceProviderFormCreation(record)]), @@ -126,8 +126,8 @@ export class PdQuestionClientInfoPage { // 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; - + let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; + this.initManufacturingProductsDetails(api_main_raw_materials); this.clientInfoForm.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); } @@ -138,8 +138,8 @@ export class PdQuestionClientInfoPage { // 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; - + let api_trading_products = dataForm.trade_details[0].trading_products; + this.initTradingProductsDetails(api_trading_products); this.clientInfoForm.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); } @@ -164,8 +164,8 @@ export class PdQuestionClientInfoPage { this.clientInfoForm = this.fb.group({ pdid: [this.pdid], formid: [this.formDetails.form_id], - company_id:[this.company_id], - fk_createdby:[this.users], + 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)]), service_provider_details: this.fb.array([this.serviceProviderFormCreation(record)]), @@ -201,8 +201,8 @@ export class PdQuestionClientInfoPage { this.clientInfoForm = this.fb.group({ pdid: [this.pdid], formid: [this.formDetails.form_id], - company_id:[this.company_id], - fk_createdby:[this.users], + 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)]), service_provider_details: this.fb.array([this.serviceProviderFormCreation(record)]), @@ -286,10 +286,10 @@ export class PdQuestionClientInfoPage { if (datas === null) { control.push(this.initManufacturingProducts(null)); } else { - datas.forEach((val,inx) => { - this.checkCard(val.manufacturing_payment_type,1,inx); + datas.forEach((val, inx) => { + this.checkCard(val.manufacturing_payment_type, 1, inx); control.push(this.initManufacturingProducts(val)); - }); + }); // for (let val of datas) { // control.push(this.initManufacturingProducts(val)); // } @@ -304,15 +304,15 @@ export class PdQuestionClientInfoPage { manufacturing_contact_person_name: [''], manufacturing_contact_person_mobile_number: [''],//,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], manufacturing_payment_type: [''], - manufacturing_payment_mode:[''], + manufacturing_payment_mode: [''], // manufacturing_credit_days: [''], - person_title_name:[''], - person_designation:[''], - 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]*$')])], - other_person_designation:[''], - manufacturing_credit_days_from:[''], - manufacturing_credit_days_to:[''] + person_title_name: [''], + person_designation: [''], + 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]*$')])], + other_person_designation: [''], + manufacturing_credit_days_from: [''], + manufacturing_credit_days_to: [''] }) } else { return this.fb.group({ @@ -321,15 +321,15 @@ export class PdQuestionClientInfoPage { 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 || null], + manufacturing_payment_mode: [records.manufacturing_payment_mode || null], manufacturing_credit_days: [records.manufacturing_credit_days || null], - person_title_name:[records.person_title_name || null], - person_designation:[records.person_designation || 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]*$')])], - other_person_designation:[records.other_person_designation || null], - manufacturing_credit_days_from:[records.manufacturing_credit_days_from || null], - manufacturing_credit_days_to:[records.manufacturing_credit_days_to || null] + person_title_name: [records.person_title_name || null], + person_designation: [records.person_designation || 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]*$')])], + other_person_designation: [records.other_person_designation || null], + manufacturing_credit_days_from: [records.manufacturing_credit_days_from || null], + manufacturing_credit_days_to: [records.manufacturing_credit_days_to || null] }) } } @@ -339,8 +339,8 @@ export class PdQuestionClientInfoPage { if (datas === null) { control.push(this.initTradingProducts(null)); } else { - datas.forEach((val,inx) => { - this.checkCard(val.trade_product_payment_type,2,inx); + datas.forEach((val, inx) => { + this.checkCard(val.trade_product_payment_type, 2, inx); control.push(this.initTradingProducts(val)); }); // for (let val of datas) { @@ -357,15 +357,15 @@ export class PdQuestionClientInfoPage { trade_product_contact_person_name: [''], trade_product_contact_person_mobile_number: [''],//Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], trade_product_payment_type: [''], - trade_product_payment_mode:[''], + trade_product_payment_mode: [''], trade_product_frequency_of_purchase: [''], trade_product_credit_days_from: [''], trade_product_credit_days_to: [''], - person_title_name:[''], - person_designation:[''], - 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]*$')])], - other_person_designation:[''], + person_title_name: [''], + person_designation: [''], + 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]*$')])], + other_person_designation: [''], }) } else { return this.fb.group({ @@ -374,15 +374,15 @@ export class PdQuestionClientInfoPage { 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)])], trade_product_payment_type: [records.trade_product_payment_type], - trade_product_payment_mode:[records.trade_product_payment_mode], + 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], - person_title_name:[records.person_title_name || null], - person_designation:[records.person_designation || 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]*$')])], - other_person_designation:[records.other_person_designation || null], + person_title_name: [records.person_title_name || null], + person_designation: [records.person_designation || 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]*$')])], + other_person_designation: [records.other_person_designation || null], }) } } @@ -392,8 +392,8 @@ export class PdQuestionClientInfoPage { if (datas === null) { control.push(this.initServiceProviderProducts(null)); } else { - datas.forEach((val,inx) => { - this.checkCard(val.service_provider_product_payment_type,3,inx); + datas.forEach((val, inx) => { + this.checkCard(val.service_provider_product_payment_type, 3, inx); control.push(this.initServiceProviderProducts(val)); }); // for (let val of datas) { @@ -410,15 +410,15 @@ export class PdQuestionClientInfoPage { service_provider_product_contact_person_name: [''], service_provider_product_contact_person_mobile_number: [''],//Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], service_provider_product_payment_type: [''], - service_provider_product_payment_mode:[''], + service_provider_product_payment_mode: [''], service_provider_product_frequency_of_purchase: [''], service_provider_product_credit_days_from: [''], service_provider_product_credit_days_to: [''], - person_title_name:[''], - person_designation:[''], - 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]*$')])], - other_person_designation:[''], + person_title_name: [''], + person_designation: [''], + 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]*$')])], + other_person_designation: [''], }) } else { return this.fb.group({ @@ -431,11 +431,11 @@ export class PdQuestionClientInfoPage { service_provider_product_frequency_of_purchase: [records.service_provider_product_frequency_of_purchase], service_provider_product_credit_days_from: [records.service_provider_product_credit_days_from], service_provider_product_credit_days_to: [records.service_provider_product_credit_days_to], - person_title_name:[records.person_title_name || null], - person_designation:[records.person_designation || 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]*$')])], - other_person_designation:[records.other_person_designation || null], + person_title_name: [records.person_title_name || null], + person_designation: [records.person_designation || 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]*$')])], + other_person_designation: [records.other_person_designation || null], }) } } @@ -443,7 +443,7 @@ export class PdQuestionClientInfoPage { addMoreRawMaterials(e): void { // e.stropPropagation(); const control = this.clientInfoForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; - + control.push(this.initManufacturingProducts(null)); } @@ -455,7 +455,7 @@ export class PdQuestionClientInfoPage { addMoretradeProduct(e): void { // e.stropPropagation(); const control = this.clientInfoForm.controls['trade_details']['controls'][0].controls['trading_products']; - + control.push(this.initTradingProducts(null)); } @@ -467,7 +467,7 @@ export class PdQuestionClientInfoPage { addMoreServiceProduct(e): void { // e.stropPropagation(); const control = this.clientInfoForm.controls['service_provider_details']['controls'][0].controls['service_products']; - + control.push(this.initServiceProviderProducts(null)); } @@ -476,256 +476,124 @@ export class PdQuestionClientInfoPage { control.removeAt(inx); } - getdropList(){ - + getdropList() { + this.qustCat.getcommondrop('COMPANYRELATIONSHIPS').subscribe( data => { this.companyRelationShipList = data['records'].filter(data => data.isactive == 1); - }); + }); this.qustCat.getcommondrop('TITLES').subscribe( - data => { - this.titleList = data['records'].filter(data => data.isactive == 1); - }); + data => { + this.titleList = data['records'].filter(data => data.isactive == 1); + }); this.qustCat.getcommondrop('PAYMENTMODE').subscribe( - data => { - this.m_paymentType = data['records'].filter(data => data.isactive == 1); - }); + data => { + this.m_paymentType = data['records'].filter(data => data.isactive == 1); + }); } -// saveclientDetails(answerData) -// { -// let records:any ={}; + // saveclientDetails(answerData) + // { + // let records:any ={}; -// records.pdid = this.pdDetails.pd_id; -// records.formid = this.FormId.form_id; -// records.fk_createdby = this.users; - -// records.client_details = answerData.clientArray; + // records.pdid = this.pdDetails.pd_id; + // records.formid = this.FormId.form_id; + // records.fk_createdby = this.users; -// this.qustCat.saveForm(records).subscribe(res=> -// { -// if(res['dataStatus']==true) -// { -// this.toast.pdTriggerappmessage('Record Saved Successfully.!'); -// this.navCtrl.pop(); -// } -// }); + // records.client_details = answerData.clientArray; + + // this.qustCat.saveForm(records).subscribe(res=> + // { + // if(res['dataStatus']==true) + // { + // this.toast.pdTriggerappmessage('Record Saved Successfully.!'); + // this.navCtrl.pop(); + // } + // }); + + + // } + /** To Save/Edited Popup Data */ + saveClientInfo(answerFormValues) { + // console.log(answerFormValues); + Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete 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']; + } - -// } -/** To Save/Edited Popup Data */ -saveClientInfo(answerFormValues){ -// console.log(answerFormValues); -Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete 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']; -} - //To Remove The "Null" With Key also - Object.keys(answerFormValues).forEach((key) => {if(answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === ''){ delete answerFormValues[key]}; }); - this.qustCat.saveForm(answerFormValues).subscribe(responsed=> - { - if(responsed['status'] == 200) { - this.navCtrl.pop(); - this.toast.pdTriggerappmessage('Record Saved Successfully.!'); - }else{ - this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!'); - } + Object.keys(answerFormValues).forEach((key) => { if (answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === '') { delete answerFormValues[key] }; }); + this.qustCat.saveForm(answerFormValues).subscribe(responsed => { + if (responsed['status'] == 200) { + this.navCtrl.pop(); + this.toast.pdTriggerappmessage('Record Saved Successfully.!'); + } else { + this.toast.pdTriggerappmessage('Something Wents Wrong Try Again.!'); + } }); -} - -selectedPersonDesignation(items,e,flag){ - if(flag == 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 ?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(); + + selectedPersonDesignation(items, e, flag) { + if (flag == 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 ?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 == 3) { + // 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 == 3){ - // 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; + spCreditCardFlag: boolean = false; + mfgCounter: any = []; + trdCounter: any = []; + spCounter: any = []; + checkCard(e, flag, index) { + + if (flag == 3 && e == 3) { + this.spCounter[index] = 1; + } + else if (flag == 3 && e != 3) { + this.spCounter[index] = 0; + } + let SP = this.spCounter.reduce((sum, val) => sum + +val, 0); + this.spCreditCardFlag = SP > 0 ? true : false; + + 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; + } -} -mfgCreditCardFlag : boolean = false; -trdCreditCardFlag : boolean = false; -spCreditCardFlag : boolean = false; -mfgCounter: any = []; -trdCounter: any = []; -spCounter: any =[]; -checkCard(e,flag,index){ - - if(flag == 3 && e==3){ - this.spCounter[index] = 1; - } - else if(flag == 3 && e!=3){ - this.spCounter[index] = 0; - } - let SP = this.spCounter.reduce((sum, val) => sum + +val, 0); - this.spCreditCardFlag = SP > 0 ? true : false ; - - 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 ; - -} - - -} -//paymentModeTextBox: any; -//clientDataArray:FormArray; -//apiLoadFinish:boolean = false; -// this.clientForms = this.fb.group({ -// clientArray:this.fb.array([]) -// }); -// this.getClientDetails(); -// this.getdropdown(); - - -// createClientItem() -// { -// return this.fb.group( -// { -// client_name: [''], -// contact_person: [''], -// mobile_number: [''], -// payment_mode: [''], -// per_of_immediate_advance_payment:[''], -// credit_period:[''], -// frequency_of_purchase: [''], -// freq_purchase_others_text_value: [''] -// }) -// } -// selectedPM(e) { -// this.paymentModeTextBox = e.value; -// // this.f.supplier_details.controls.get('payment_mode_value'); -// } -// public freqPurchaseTextBox: number; -// selectedFreqPurchase(e){ -// this.freqPurchaseTextBox = e.value; -// } -// getdropdown() -// { -// this.qustCat.getcommondrop('FREQUENCY').subscribe( -// data => { -// this.m_freqOfPurchase = data['records'].filter(data => data.isactive == 1); -// }, -// error => { -// // this.notifier.notify('warning', 'No Category Records Found.!'); -// // this.m_assets_type = "No Category Records Found."; -// } -// ) -// this.qustCat.getcommondrop('PAYMENTMODE').subscribe( -// data => { -// this.m_paymentModeType = data['records'].filter(data => data.isactive == 1); -// }, -// error => { -// // this.notifier.notify('warning', 'No Category Records Found.!'); -// // this.m_assets_type = "No Category Records Found."; -// } -// ) -// } -// addClientDetails() -// { -// this.clientDataArray = this.clientForms.get('clientArray') as FormArray; -// this.clientDataArray.push(this.createClientItem()); -// } -// removeClientDetails(i) -// { - -// if(this.clientDataArray.length==1) -// { -// this.clientForms.controls['clientArray'].reset(); -// }else{ -// this.clientDataArray = this.clientForms.get('clientArray') as FormArray; -// this.clientDataArray.removeAt(i); -// } -// } - -// saveclientDetails(answerData) -// { -// let records:any ={}; - -// records.pdid = this.pdDetails.pd_id; -// records.formid = this.FormId.form_id; -// records.fk_createdby = this.users; - -// records.client_details = answerData.clientArray; - -// this.qustCat.saveForm(records).subscribe(res=> -// { -// if(res['dataStatus']==true) -// { -// this.toast.pdTriggerappmessage('Record Saved Successfully.!'); -// this.navCtrl.pop(); -// } -// }); - - -// } -// getClientDetails() -// { -// let records = {'pd_id':this.pdDetails.pd_id,'pd_form_id':this.FormId.form_id} -// let clientData:any = []; -// this.qustCat.retiverForm(records).subscribe( -// data => { -// if(data['dataStatus']==true) -// { -// let clientDetails = data['records']; - -// clientData = Object.keys(data['records'].client_details).map(function(key) { - -// return clientDetails.client_details[key]; -// }); -// this.clientDataArray = this.clientForms.get('clientArray') as FormArray; - -// if(clientData.length ==0) -// { - -// this.clientDataArray.push(this.createClientItem()); -// }else -// { - -// clientData.forEach(datas=> -// { -// this.clientDataArray.push(this.createClientItem()); -// }) - -// this.clientForms.controls['clientArray'].setValue(clientData); -// this.apiLoadFinish = true; -// } -// }else{ - -// this.addClientDetails(); -// this.apiLoadFinish = true; -// } -// } -// ); -// } +} \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.html index 6e631cf0..1a5a8ab9 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.html @@ -1,452 +1,325 @@ - - - - {{formDetails.form_name}} - - + + + {{formDetails.form_name}} + - - - -
- - - Manufacturing Stock Details -
-
-
-
- - Raw Material #{{a+1}} - - - - - - - - Add Stock Details - No Stock Observed - - - - - - - - - {{uom.name}} - - - - - - - - {{"₹"}} {{M_rawValueInWords[a]}} Only - - - - - Yes - No - - - - - Please comment on the stock level observed? - - - - - - - - - - - - - - - - -
-
- -
-
- - Finished Goods #{{b+1}} - - - - - - - - Add Stock Details - No Stock Observed - - - - - - - - - {{uom.name}} - - - - - - - - {{"₹"}} {{M_goodsValueInWords[b]}} Only - - - - - Yes - No - - - - Please comment on the finished goods stock level observed? - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - Retail Trading Details -
-
- -
-
- - - Traded Goods #{{e+1}} - - - - - - - Add Stock Details - No Stock Observed - - - - - - - - - {{uom.name}} - - - - - - - - {{"₹"}} {{R_tradedGoodsValueInWords[e]}} Only - - - - - Yes - No - - - - - Please comment on the Traded Goods stock level observed? - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - Wholesale Trading Details -
-
-
-
- - Traded Goods #{{g+1}} - - - - - - - Add Stock Details - No stock observed - - - - - - - - - {{uom.name}} - - - - - - - - {{"₹"}} {{T_tradedGoodsValueInWords[g]}} Only - - - - - - Yes - No - - - - - Please comment on the Traded Goods stock level observed? - - - - - - - - - - - - - - - - - -
-
-
-
- -
- - - Service Provider Details -
Service Provider Details Not applicable here !!
-
- - - - Remarks - - - - - - - - - - - - - - - - -
- -
- -
{{ errorMessage }}
-
- - + + Add Stock Details + No Stock Observed + + + + + + + + + {{uom.name}} + + + + + + + + {{"₹"}} + {{M_rawValueInWords[a]}} Only + + + + Yes + No + + + + Please comment on the stock level observed? + + + + + + + + + + + + + + + + + + + +
+
+
+
+ Finished Goods #{{b+1}} + + + + + + + Add Stock Details + No Stock Observed + + + + + + + + + {{uom.name}} + + + + + + + + {{"₹"}} + {{M_goodsValueInWords[b]}} Only + + + + Yes + No + + + + Please comment on the finished goods + stock level observed? + + + + + + + + + + + + + + + + + + +
+
+
- - - - - - - - - - - + + +
Retail Trading Details
+
+
+
+
+ Traded Goods #{{e+1}} + + + + + + + Add Stock Details + No Stock Observed + + + + + + + + + {{uom.name}} + + + + + + + + {{"₹"}} + {{R_tradedGoodsValueInWords[e]}} Only + + + + Yes + No + + + + Please comment on the Traded Goods stock level observed? + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
Wholesale Trading Details
+
+
+
+
+ Traded Goods #{{g+1}} + + + + + + + Add Stock Details + No stock observed + + + + + + + + + {{uom.name}} + + + + + + + + {{"₹"}} + {{T_tradedGoodsValueInWords[g]}} Only + + + + Yes + No + + + + Please comment on the Traded Goods stock level observed? + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
Service Provider Details
+
Service Provider Details Not applicable here !!
+
+ + + Remarks + + + + + + + +
-
- -
- - -

Finished Goods

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- -
-
- - Remarks - - -
+
-
---> \ No newline at end of file +
+ +
+
{{ errorMessage }}
+
+
+
+ \ No newline at end of file diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.scss b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.scss index af5e7d9d..265b685c 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.scss +++ b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.scss @@ -2,6 +2,9 @@ page-pd-question-stock-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-stock-info/pd-question-stock-info.ts b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.ts index 9c0d8ab5..19741eb4 100644 --- a/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.ts +++ b/src/pages/pd-question/pd-question-business-group/pd-question-stock-info/pd-question-stock-info.ts @@ -28,20 +28,16 @@ export class PdQuestionStockInfoPage { company_id : any; pdid:any; stockForm: FormGroup; - noRecordsFound: Boolean; errorMessage: any = ''; - M_rawValueInWords : any = []; M_goodsValueInWords : any = []; R_tradedGoodsValueInWords : any = []; T_tradedGoodsValueInWords : any = []; - mrmCommentFlag:any=[]; mfgCommentFlag:any=[]; rtrdCommentFlag:any=[]; wtrdCommentFlag:any=[]; - serviceProviderForm: Boolean = false; suppliers_raw_materials : any = []; suppliers_retail_trade_details : any = []; @@ -54,9 +50,7 @@ export class PdQuestionStockInfoPage { this.users = this.aws.getlocale(); this.company_id=this.pdDetails.company_id; this.pdid=this.pdDetails.pd_id; - this.qustCat.stockFormAccess(this.pdid,this.company_id).subscribe(data => { - if(data.dataStatus == true){ this.initstockForm(data.record); } @@ -78,26 +72,21 @@ export class PdQuestionStockInfoPage { this.noRecordsFound = false; this.errorMessage = 'No Records Found , Something went Wrong!'; }) - this.getdropdown(); } public initstockForm(record){ - let api = Object.keys(record.from_business).map(function (key) { return record.from_business[key]; }); let rm_api = record.from_supplier; - let params: any = {}; params.pd_id = this.pdid; params.pd_form_id = this.formDetails.form_id; params.company_id = this.company_id; this.qustCat.retiverForm(params).subscribe(value => { - if (value['status'] == 200) { let dataForm = value['records']; - if(dataForm !== undefined) { this.stockForm = this.fb.group({ pdid: [this.pdid], @@ -143,7 +132,6 @@ export class PdQuestionStockInfoPage { } } else{ - this.stockForm = this.fb.group({ pdid: [this.pdid], formid: [this.formDetails.form_id], @@ -154,7 +142,6 @@ export class PdQuestionStockInfoPage { retail_details : this.fb.array([this.retailFormCreation(record.from_business)]), trade_details: this.fb.array([this.tradingFormCreation(record.from_business)]), }); - if(api.length > 0){ api.forEach(val => { if (val.type_of_activity_id == 2) { @@ -179,10 +166,8 @@ export class PdQuestionStockInfoPage { if(val.products){ // this.suppliers_service_product = val.products; this.serviceProviderForm = true; - } - + } } - }); this.noRecordsFound = true; } @@ -241,21 +226,16 @@ export class PdQuestionStockInfoPage { getdropdown() { this.qustCat.getcommondrop('UOM').subscribe(data => { - if(data['dataStatus']==true){ - this.uomData = data['records'].filter(uom=>uom.isactive==1); - } }); } manufacturingForm: Boolean = false; manufacturingFormCreation(record) { - let arr = record.from_business.filter(data => data.type_of_activity_id == 2); let rm_arr = record.from_supplier; - if (arr.length > 0) { this.manufacturingForm = true; return this.fb.group({ @@ -269,14 +249,17 @@ export class PdQuestionStockInfoPage { retailForm: Boolean = false; retailFormCreation(val) { - let arr = val.filter(data => data.type_of_activity_id == 3); if (arr.length > 0) { - this.retailForm = true; + // if(arr.products != undefined){ + this.retailForm = true; return this.fb.group({ retail_traded_goods: this.fb.array([]) - }) - // } + }); + // }else{ + // this.retailForm = false; + // return; + // } } else { return; } @@ -284,25 +267,31 @@ export class PdQuestionStockInfoPage { tradingForm: Boolean = false; tradingFormCreation(val) { + // console.log('val',val); + // console.log('tradingForm',this.tradingForm); let arr = val.filter(data => data.type_of_activity_id == 4); + if (arr.length > 0) { + // console.log(arr.products); + // if(arr.products === undefined){ + // console.log(arr.products); + // this.tradingForm = false; + // return; + // } this.tradingForm = true; return this.fb.group({ - trading_traded_goods: this.fb.array([]) - }); + trading_traded_goods: this.fb.array([]) + }); } else { return; } } initManufacturingDetails(datas) { - const rawMaterial = this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; const finishedGoods = this.stockForm.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; const control = this.stockForm.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; if(datas === null){ - - if(this.suppliers_raw_materials.length > 0){ this.suppliers_raw_materials.forEach(val => { let Ref_RawMaterials : any = {'raw_name': val, @@ -319,9 +308,7 @@ export class PdQuestionStockInfoPage { else{ rawMaterial.push(this.createRawmaterial(null)); } - if(this.suppliers_finished_goods.length > 0){ - // for (let val of this.suppliers_finished_goods) { this.suppliers_finished_goods.forEach(val => { let Ref_Finished_Goods : any = {'goods_name': val, 'goods_observed': '', @@ -332,17 +319,13 @@ export class PdQuestionStockInfoPage { 'is_sufficiant_goods': '', 'finishedgoods_remarks':''}; finishedGoods.push(this.createGoods(Ref_Finished_Goods)); - // finishedGoods.push(this.createGoods(null)); }); } else{ finishedGoods.push(this.createGoods(null)); } - } else { - if(datas.manufacturing_raw_materials != undefined){ - // for (let val of datas.manufacturing_raw_materials) { datas.manufacturing_raw_materials.forEach((val,index) => { if(val.raw_value){ this.inWords(val.raw_value,1,index); @@ -355,9 +338,7 @@ export class PdQuestionStockInfoPage { rawMaterial.push(this.createRawmaterial(null)); } if(datas.manufacturing_finished_goods != undefined){ - // for (let val of datas.manufacturing_finished_goods) { datas.manufacturing_finished_goods.forEach((val,index) => { - if(val.goods_value){ this.inWords(val.goods_value,2,index); } @@ -373,9 +354,7 @@ export class PdQuestionStockInfoPage { } createRawmaterial(records) { - if(records === null) { - return this.fb.group({ raw_name: [''], stock_observed:[''], @@ -383,21 +362,17 @@ export class PdQuestionStockInfoPage { raw_uom: [''], other_uom : [''], raw_value: [''], - // rawmaterial_value: [''], is_sufficiant_raw: [''], rawmaterial_remarks:[''] }) - } else { - + } else { return this.fb.group({ - // manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null], raw_name: [records.raw_name], stock_observed:[records.stock_observed], raw_quantity: [records.raw_quantity], raw_uom: [records.raw_uom], other_uom : [records.other_uom], raw_value: [records.raw_value], - // rawmaterial_value: [records.rawmaterial_value], is_sufficiant_raw: [records.is_sufficiant_raw], rawmaterial_remarks:[records.rawmaterial_remarks] }) @@ -405,14 +380,10 @@ export class PdQuestionStockInfoPage { } initRetailDetails(datas) { - const tradedGoods = this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods']; - if(datas === null){ - if(this.suppliers_retail_trade_details.length > 0){ // this.rawMaterialAccess = true; - this.suppliers_retail_trade_details.forEach(val => { let Ref_Trade_Goods : any = { 'traded_goods_name': val, @@ -429,18 +400,14 @@ export class PdQuestionStockInfoPage { else{ tradedGoods.push(this.createTradedGoods(null)); } - } else { if(datas.retail_traded_goods !== undefined){ - // for (let val of datas.retail_traded_goods) { datas.retail_traded_goods.forEach((val,index) => { - if(val.estimated_traded_goods_value){ this.inWords(val.estimated_traded_goods_value,3,index); } this.checkComments(val.is_sufficiant_traded_goods,3,index); tradedGoods.push(this.createTradedGoods(val)); - }); } else{ @@ -459,7 +426,6 @@ export class PdQuestionStockInfoPage { goods_uom: [''], goods_other_uom: [''], goods_value: [''], - // finished_goods_value: [''], is_sufficiant_goods: [''], finishedgoods_remarks:[''] }); @@ -472,7 +438,6 @@ export class PdQuestionStockInfoPage { goods_uom: [records.goods_uom], goods_other_uom: [records.goods_other_uom], goods_value: [records.goods_value], - // finished_goods_value: [records.finished_goods_value], is_sufficiant_goods: [records.is_sufficiant_goods], finishedgoods_remarks:[records.finishedgoods_remarks] }) @@ -482,10 +447,7 @@ export class PdQuestionStockInfoPage { initTradingDetails(datas) { const tradedGoods = this.stockForm.controls['trade_details']['controls'][0].controls['trading_traded_goods']; if(datas === null){ - - if(this.suppliers_wholesale_trade_details.length > 0){ - // for (let val of this.suppliers_trade_details) { this.suppliers_wholesale_trade_details.forEach(val => { let Ref_Trade_Goods : any = { 'traded_goods_name': val, @@ -506,9 +468,7 @@ export class PdQuestionStockInfoPage { } else { if(datas.trading_traded_goods !==undefined) { - // for (let val of datas.trading_traded_goods) { - datas.trading_traded_goods.forEach((val,index) => { - + datas.trading_traded_goods.forEach((val,index) => { if(val.estimated_traded_goods_value){ this.inWords(val.estimated_traded_goods_value,4,index); } @@ -519,7 +479,6 @@ export class PdQuestionStockInfoPage { else{ tradedGoods.push(this.createTradedGoods(null)); } - } } @@ -532,7 +491,6 @@ export class PdQuestionStockInfoPage { traded_goods_uom: [''], traded_goods_other_uom: [''], estimated_traded_goods_value: [''], - // traded_goods_value: [''], is_sufficiant_traded_goods: [''], traded_goods_remarks:[''] }); @@ -545,7 +503,6 @@ export class PdQuestionStockInfoPage { traded_goods_uom: [records.traded_goods_uom], traded_goods_other_uom: [records.traded_goods_other_uom], estimated_traded_goods_value: [records.estimated_traded_goods_value], - // traded_goods_value: [records.traded_goods_value], is_sufficiant_traded_goods: [records.is_sufficiant_traded_goods], traded_goods_remarks:[records.traded_goods_remarks] }) @@ -590,7 +547,6 @@ export class PdQuestionStockInfoPage { */ addTradedGoods(flag) { switch(flag){ - case 1: { const control = this.stockForm.controls['retail_details']['controls'][0].controls['retail_traded_goods']; control.push(this.createTradedGoods(null)); @@ -633,7 +589,6 @@ export class PdQuestionStockInfoPage { } checkComments(e,flag,index){ - if(flag == 1 && e=='no'){ this.mrmCommentFlag[index] = true; } @@ -662,10 +617,8 @@ export class PdQuestionStockInfoPage { /** To Save/Edited Popup Data */ saveStockInfo(answerFormValues) { - //To Remove The "Null" With Key also Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); - this.qustCat.saveForm(answerFormValues).subscribe(responsed => { if(responsed['status'] == 200) { this.navCtrl.pop(); @@ -677,7 +630,6 @@ export class PdQuestionStockInfoPage { } inWords(e,flag:number,i){ - switch(flag){ case 1 : this.M_rawValueInWords[i] = this.constant.convertNumberToWords(e); @@ -696,108 +648,4 @@ export class PdQuestionStockInfoPage { } } - // createRawmaterial() { - // return this.fb.group({ - // raw_name: [''], - // stock_observed:[''], - // raw_quantity: [''], - // raw_uom: [''], - // other_uom : [''], - // raw_value: [''], - // rawmaterial_value: [''], - // is_sufficiant_raw: [''], - // }); - // } - // createGoods() { - // return this.fb.group({ - // goods_name: [''], - // goods_quantity: [''], - // goods_value: [''], - // finished_goods_value: [''], - // is_sufficiant_goods: [''], - // }); - // } - // addRawMaterials() { - // const control = this.stockForm.controls['raw_materials']; - // control.push(this.createRawmaterial()); - // } - // deleteRawMaterials(index) { - // const control = this.stockForm.controls['raw_materials']; - // if(control.length==1) - // { - // this.stockForm.controls['raw_materials'].reset(); - // }else{ - // control.removeAt(index); - // } - // } - // addGoods() { - // const control = this.stockForm.controls['finished_goods']; - - // control.push(this.createGoods()); - // } - // deleteGoods(index) { - // const control = this.stockForm.controls['finished_goods']; - // if(control.length==1) - // { - // this.stockForm.controls['finished_goods'].reset(); - // }else{ - // control.removeAt(index); - // } - // } - - - // submitDetails(answerData) { - - // let records: any = {}; - // records.pdid = this.pdDetails.pd_id; - // records.formid = this.FormId.form_id; - // records.fk_createdby = this.users; - // records.raw_materials = answerData.raw_materials; - // records.stock_remarks = answerData.stock_remarks; - // records.finished_goods = answerData.finished_goods; - - // this.qustCat.saveForm(records).subscribe(data => { - // this.navCtrl.pop(); - // this.toast.pdTriggerappmessage('Record Saved Successfully.!'); - // }); - // } - - // getStockDetails() { - // let records = { 'pd_id': this.pdDetails.pd_id, 'pd_FormId': this.FormId.form_id }; - - // this.qustCat.retiverForm(records).subscribe(value => { - - // const rawMaterial = this.stockForm.controls['raw_materials']; - // const finishedGoods = this.stockForm.controls['finished_goods']; - // if (value['dataStatus'] == true) { - // let stockDetails = value['records']; - // let result = Object.keys(stockDetails.raw_materials).map(function (key) { - // return stockDetails.raw_materials[key]; - // }); - // let result_Goods = Object.keys(stockDetails.finished_goods).map(function (key) { - // return stockDetails.finished_goods[key]; - // }); - // this.stockForm.controls['stock_remarks'].setValue(stockDetails.stock_remarks); - // if (result.length > 0) { - // result.forEach(val => { - // rawMaterial.push(this.createRawmaterial()); - // }); - // this.stockForm.controls['raw_materials'].setValue(result); - // } else { - // rawMaterial.push(this.createRawmaterial()); - // } - // if (result_Goods.length > 0) { - // result_Goods.forEach(val => { - // finishedGoods.push(this.createGoods()); - // }); - // this.stockForm.controls['finished_goods'].setValue(result_Goods); - // } else { - // finishedGoods.push(this.createGoods()); - // } - // } else { - // this.addRawMaterials(); - // this.addGoods(); - // } - // }) - // } } diff --git a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html index f72792aa..9b958dcd 100755 --- a/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html +++ b/src/pages/pd-question/pd-question-business-group/pd-question-supplier-info/pd-question-supplier-info.html @@ -1,278 +1,254 @@ - - - - {{formDetails.form_name}} - - + + + {{formDetails.form_name}} + - - - -
- - - - Manufacturing Product Details -
-
-
-
- - Raw Material #{{l+1}} - - -
- - - - - - - - - - - - {{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 - - - - - - - - + +
+ +
+ + +
Manufacturing Product Details
+
+
+
+
+
+ Raw Material #{{l+1}} + +
+ + + + + + + + + + {{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 + + + + + + + +
+
+ + + + + + + + + + + +
- - - - - - - - - - - - - - -
-
- - - - - -
- - - -
- - -
-
- - - - - Trading Product Details - -
-
-
-
- - Trading Product #{{l+1}} - - - -
- - - {{ tp.name }} - - - - - - - - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - - - - Enter Valid Mobile Number. - - - - - Enter Valid STD Code Number. - - - - - Enter Valid LandLine Number. - - - - {{ pm.name }} - - - - - Payment received in Cash. - Payment received through Banking - channels. - - - - - - No.of days of Credit Provided by Supplier - - - - - - -
-
- - - - - - - - -
+
+ + + +
- - - - -
- - - + + + + +
Trading Product Details
+
+ +
+
+
+
+ Trading Product #{{l+1}} + +
+ + + {{ tp.name }} + + + + + + + + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + + + Enter Valid Mobile Number. + + + + Enter Valid STD Code Number. + + + + + Enter Valid LandLine Number. + + + + {{ pm.name }} + + + + + Payment received in Cash. + Payment received through + Banking + channels. + + + + No.of days of Credit Provided by Supplier + + + + + + + +
+
+ + + + + + + + + + + +
- +
+
+ + + +
+
+
+
+ - -
-
- + +
Service Provider Product Details
+
- - Service Provider Product Details -
Service Provider Details Not applicable here !!
-
- - - +
Service Provider Details Not applicable here !!
+
+ + Remarks - - - - - - - - - - - - -
{{ errorMessage }}
+ + + + + +
+ +
+
+ +
+
{{ errorMessage }}
+
+
+
\ 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