diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html index 2702d8782..1e4fc96db 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html @@ -28,7 +28,7 @@     - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html index 4342e3a12..184017d97 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/completed-pd/completed-pd.component.html @@ -30,7 +30,7 @@     - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html index a127a43a6..865287383 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/inprogress-pd/inprogress-pd.component.html @@ -29,7 +29,7 @@     - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html index 57af8f024..608edfd29 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/qc-completed-pd/qc-completed-pd.component.html @@ -29,7 +29,7 @@     - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html index 3bf5cf7cc..5e8e82f54 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/scheduled-pd/scheduled-pd.component.html @@ -29,7 +29,7 @@     - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html index 39dabe925..ec604f9cc 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.html @@ -74,17 +74,20 @@
+ Enter Valid Mobile Number. + type="text" OnlyNumber > Enter Valid STD Code Number.   -   + formControlName="person_landline" type="text" OnlyNumber > Enter Valid LandLine Number.
@@ -208,18 +211,18 @@
+ formControlName="trade_product_contact_person_mobile_number" autocomplete="off" + OnlyNumber type="text" maxlength="10"> Enter Valid Mobile Number. + OnlyNumber type="text"> Enter Valid STD Code Number.   -   + formControlName="person_landline" type="text" OnlyNumber> Enter Valid LandLine Number.
@@ -345,17 +348,18 @@
+ formControlName="service_provider_product_contact_person_mobile_number" + autocomplete="off" OnlyNumber type="text" maxlength="10"> Enter Valid Mobile Number. + type="text" OnlyNumber> Enter Valid STD Code Number.   -   + formControlName="person_landline" type="text" OnlyNumber> Enter Valid LandLine Number.
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html index cccef65e0..806c21d8f 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.html @@ -147,22 +147,30 @@ CLIX - - - Select - Heavy Footfall (lots of customers in the locality / marketplace). - Medium Footfall (Medium no of customers in the locality / marketplace). - Low Footfall (Few customers seen in the locality / marketplace). - - Comment on Footfall in the market where the B2C outlet is located Required - + + + Select + Heavy Footfall (lots of customers in the locality / marketplace). + Medium Footfall (Medium no of customers in the locality / marketplace). + Low Footfall (Few customers seen in the locality / marketplace). + + Comment on Footfall in the market where the B2C outlet is located Required + -
+ + + + Select + Yes + No + + + Approximate No of similar outlets / stores seen by PD officer during the visit to that location Required -
+ + + + Select + Yes + No + + + - - Specify The Demolition Activity Comment Required + + Comment on any demolition activity observed is Required - +

Demolition Activity Image

-
+ + + + Select + Yes + No + + - - Specify The Sealing Activity Comment Required + + Comment on any sealing activity observed in area is Required - +

Sealing Activity Image

diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts index c6bc0d410..662f0ab2e 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/final-remarks/final-remarks.component.ts @@ -236,10 +236,10 @@ export class FinalRemarksComponent implements OnInit { this.clixChange(data.records.sealing_activity,2); this.clixChange(data.records.demolition_activity,3); - if(data.records.is_competition ==true){ this._finalRemarkForm.controls.appx_outlet_or_stores.setValue(data.records.appx_outlet_or_stores);} - if(data.records.sealing_activity ==true){ this._finalRemarkForm.controls.comment_of_demolition_activity.setValue(data.records.comment_of_demolition_activity); + if(data.records.is_competition =='yes'){ this._finalRemarkForm.controls.appx_outlet_or_stores.setValue(data.records.appx_outlet_or_stores);} + if(data.records.sealing_activity =='yes'){ this._finalRemarkForm.controls.comment_of_demolition_activity.setValue(data.records.comment_of_demolition_activity); this._finalRemarkForm.controls.demolition_activity_pic.setValue(data.records.demolition_activity_pic); } - if(data.records.demolition_activity ==true) {this._finalRemarkForm.controls.comment_of_sealing_activity.setValue(data.records.comment_of_sealing_activity); + if(data.records.demolition_activity =='yes') {this._finalRemarkForm.controls.comment_of_sealing_activity.setValue(data.records.comment_of_sealing_activity); this._finalRemarkForm.controls.sealing_activity_pic.setValue(data.records.sealing_activity_pic); } } @@ -618,16 +618,17 @@ export class FinalRemarksComponent implements OnInit { } clixChange(e,flag){ + console.log(e,flag); if(flag == 1){ - e==true ? this._finalRemarkForm.addControl('appx_outlet_or_stores', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('appx_outlet_or_stores'); + e == 'yes' ? this._finalRemarkForm.addControl('appx_outlet_or_stores', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('appx_outlet_or_stores'); } if(flag == 2){ - e==true ? this._finalRemarkForm.addControl('comment_of_demolition_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_demolition_activity'); - e==true ? this._finalRemarkForm.addControl('demolition_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('demolition_activity_pic'); + e== 'yes' ? this._finalRemarkForm.addControl('comment_of_demolition_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_demolition_activity'); + e== 'yes' ? this._finalRemarkForm.addControl('demolition_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('demolition_activity_pic'); } if(flag == 3){ - e==true ? this._finalRemarkForm.addControl('comment_of_sealing_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_sealing_activity'); - e==true ? this._finalRemarkForm.addControl('sealing_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('sealing_activity_pic'); + e== 'yes' ? this._finalRemarkForm.addControl('comment_of_sealing_activity', new FormControl('', Validators.required)) : this._finalRemarkForm.removeControl('comment_of_sealing_activity'); + e== 'yes' ? this._finalRemarkForm.addControl('sealing_activity_pic', new FormControl('')) : this._finalRemarkForm.removeControl('sealing_activity_pic'); } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html index 124f7de79..375f701df 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html @@ -371,17 +371,119 @@
- + + +
Service Provider Details
+ +
+
+
+
+ + + Service Provider {{g+1}} + + + + + + + + Select + Add Stock Details + No stock observed + + + + + + + + + + Select + {{uom.name}} + + + + + UOM Required + + + + {{"₹"}} + {{sp.get('estimated_service_provider_value').value + | numberToWords}} Only + + + + +
+ +
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+ + + Select + + {{val.isdisplayvalue}} + + + + + Is the stock of finished / goods observed, sufficient considering the size of operations Required + + + Please comment on the stock level observed? + + +
+ + + --
Service Provider
Service Provider Details Not applicable here !!
-
- - - + -->
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts index 61c143fc6..55d3bce73 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -43,17 +43,19 @@ export class StockComponent implements OnInit { company_id: string; RMCommentCard: boolean = false; - TGCommentCard: boolean = false + TGCommentCard: boolean = false; + SPCommentCard: boolean = false; - serviceProviderForm: Boolean = false; + // serviceProviderForm: Boolean = false; suppliers_raw_materials: any = []; suppliers_retail_trade_details: any = []; suppliers_wholesale_trade_details: any = []; suppliers_finished_goods: any = []; - // suppliers_service_product : any = []; + suppliers_service_providers : any = []; public RMsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",disabled:false},{value:"no",isdisplayvalue:"No",disabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",disabled:false}]; public TGsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}]; + public SPsufficientList: any = [{value:"yes",isdisplayvalue:"Yes",isdisabled:false},{value:"no",isdisplayvalue:"No",isdisabled:false},{value:"not applicable",isdisplayvalue:"Stock not required to be maintained",isdisabled:false}]; /** Constructor */ constructor(notifier: NotifierService, @@ -134,7 +136,7 @@ export class StockComponent implements OnInit { let api = Object.keys(record.from_business).map(function (key) { return record.from_business[key]; }); - + let type2 = record.from_business.filter(data => data.type_of_activity_id == 2); let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0; @@ -142,7 +144,9 @@ export class StockComponent implements OnInit { let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0; let type4 = record.from_business.filter(data => data.type_of_activity_id == 4); let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0; - + let type5 = record.from_business.filter(data => data.type_of_activity_id == 5); + let type5length = type5[0].hasOwnProperty("products") ? type5[0].products.length : 0; + let rm_api = record.from_supplier.hasOwnProperty("raw_material") ? record.from_supplier.raw_material : []; let params: any = {}; @@ -163,8 +167,11 @@ export class StockComponent implements OnInit { manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), retail_details: this.fb.array([this.retailFormCreation(type3length)]), trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + servicing_details: this.fb.array([this.servicingFormCreation(type5length)]), is_sufficiant_finished_and_traded_goods: [dataForm.is_sufficiant_finished_and_traded_goods], - finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks] + finished_and_traded_goods_remarks: [dataForm.finished_and_traded_goods_remarks], + is_sufficiant_service_goods: [dataForm.hasOwnProperty('is_sufficiant_service_goods') ? dataForm.is_sufficiant_service_goods : ''], + service_goods_remarks: [dataForm.hasOwnProperty('service_goods_remarks') ? dataForm.service_goods_remarks : '' ] }); if (api.length > 0) { api.forEach(val => { @@ -196,7 +203,16 @@ export class StockComponent implements OnInit { } if (val.type_of_activity_id == 5) { if (val.products) { - this.serviceProviderForm = true; + // this.serviceProviderForm = true; + let servicing_temparr = []; + if(dataForm.hasOwnProperty('service_provider')){ + servicing_temparr['service_provider'] = dataForm.servicing_details[0].service_provider; + this.initServicingDetails(servicing_temparr); + } + else{ + this.suppliers_service_providers = val.products; + this.initServicingDetails(null); + } } } }); @@ -215,8 +231,11 @@ export class StockComponent implements OnInit { manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), retail_details: this.fb.array([this.retailFormCreation(type3length)]), trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + servicing_details: this.fb.array([this.servicingFormCreation(type5length)]), is_sufficiant_finished_and_traded_goods: [''], - finished_and_traded_goods_remarks: [''] + finished_and_traded_goods_remarks: [''], + is_sufficiant_service_goods: [''], + service_goods_remarks: [''] }); if (api.length > 0) { @@ -244,8 +263,9 @@ export class StockComponent implements OnInit { } if (val.type_of_activity_id == 5) { if (val.products) { - // this.suppliers_service_product = val.products; - this.serviceProviderForm = true; + this.suppliers_service_providers = val.products; + this.initServicingDetails(null); + // this.serviceProviderForm = true; } } @@ -265,8 +285,11 @@ export class StockComponent implements OnInit { manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), retail_details: this.fb.array([this.retailFormCreation(type3length)]), trade_details: this.fb.array([this.tradingFormCreation(type4length)]), + servicing_details: this.fb.array([this.servicingFormCreation(type5length)]), is_sufficiant_finished_and_traded_goods: [''], - finished_and_traded_goods_remarks: [''] + finished_and_traded_goods_remarks: [''], + is_sufficiant_service_goods: [''], + service_goods_remarks: [''] }); if (api.length > 0) { api.forEach(val => { @@ -293,8 +316,8 @@ export class StockComponent implements OnInit { } if (val.type_of_activity_id == 5) { if (val.products) { - // this.suppliers_service_product = val.products; - this.serviceProviderForm = true; + this.suppliers_service_providers = val.products; + this.initServicingDetails(null); } } }); @@ -352,6 +375,19 @@ export class StockComponent implements OnInit { } } + servicingForm: Boolean = false; + servicingFormCreation(val) { + + // let arr = val.filter(data => data.type_of_activity_id == 4); + if (val > 0) { + this.servicingForm = true; + return this.fb.group({ + service_provider: this.fb.array([]) + }); + } else { + return; + } + } initManufacturingDetails(datas) { @@ -608,6 +644,75 @@ export class StockComponent implements OnInit { } } + + initServicingDetails(datas) { + + const service = this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider']; + if (datas === null) { + + if (this.suppliers_service_providers.length > 0) { + + this.suppliers_service_providers.forEach(val => { + let Serv_Prov_Goods: any = { + 'service_provider_name': val, + 'service_provider_observed': '', + 'service_provider_quantity': '', + 'service_provider_uom': '', + 'service_provider_other_uom': '', + 'estimated_service_provider_value': '' + } + + service.push(this.createServiceProvider(Serv_Prov_Goods)); + }); + } + else { + service.push(this.createServiceProvider(null)); + } + + } else { + if (datas.service_provider !== undefined) { + + datas.service_provider.forEach((val, index) => { + this.checkComments(val.traded_goods_observed, 5, index); + service.push(this.createServiceProvider(val)); + }); + } + else { + service.push(this.createServiceProvider(null)); + } + + } + } + + createServiceProvider(records) { + + if (records === null) { + + return this.fb.group({ + service_provider_name: [''], + service_provider_observed: [''], + service_provider_quantity: [''], + service_provider_uom: [''], + service_provider_other_uom: [''], + estimated_service_provider_value: [''], + // traded_goods_value: [''], + }); + } + else { + + return this.fb.group({ + service_provider_name: [records.service_provider_name], + service_provider_observed: [records.service_provider_observed], + service_provider_quantity: [records.service_provider_quantity], + service_provider_uom: [records.service_provider_uom], + service_provider_other_uom: [records.service_provider_other_uom], + estimated_service_provider_value: [records.estimated_service_provider_value], + // traded_goods_value: [records.traded_goods_value], + + }) + } + } + /** Manufacturing -> To Add More Raw Material Details */ addRawMaterials(flag) { if (flag == 1) { @@ -657,6 +762,11 @@ export class StockComponent implements OnInit { control.push(this.createTradedGoods(null)); break; } + case 3: { + const control = this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider']; + control.push(this.createServiceProvider(null)); + break; + } default: { break; } @@ -679,6 +789,11 @@ export class StockComponent implements OnInit { control.removeAt(index); break; } + case 3: { + const control = this.stockForms.controls['servicing_details']['controls'][0].controls['service_provider']; + control.removeAt(index); + break; + } default: { break; } @@ -758,6 +873,11 @@ export class StockComponent implements OnInit { else{ items.controls['traded_goods_other_uom'].clearValidators(); items.controls['traded_goods_other_uom'].setValue('');} items.controls['traded_goods_other_uom'].updateValueAndValidity(); } + else if (flag == 5) { + if(e == 1){ items.controls['service_provider_other_uom'].setValidators([Validators.required]); } + else{ items.controls['service_provider_other_uom'].clearValidators(); items.controls['service_provider_other_uom'].setValue('');} + items.controls['service_provider_other_uom'].updateValueAndValidity(); + } } getUOM() { @@ -785,11 +905,13 @@ export class StockComponent implements OnInit { FinishedCounterArray: any = []; RetailCounterArray: any = []; WholeSaleCounterArray: any = []; + ServiceCounterArray: any = []; not_stock_of_rm: any = []; not_stock_of_fg: any = []; not_stock_of_tg: any = []; not_stock_of_ws: any = []; + not_stock_of_sp: any = []; checkComments(value, flag, index) { @@ -829,9 +951,34 @@ export class StockComponent implements OnInit { this.WholeSaleCounterArray[index] = value != "" ? 1 : 0 this.not_stock_of_ws[index] = value == "yes" ? 1 : 0; } + if (flag == 5) { + + this.ServiceCounterArray[index] = value != "" ? 1 : 0 + this.not_stock_of_sp[index] = value == "yes" ? 1 : 0; + + let SPOverallCount = this.ServiceCounterArray.reduce((sum, val) => sum + +val, 0); + this.SPCommentCard = SPOverallCount > 0 ? true : false; + + let not_stock3 = this.not_stock_of_rm.reduce((sum, val) => sum + +val, 0); + + if(not_stock3 > 0){ + + this.SPsufficientList[0].disabled = false; + this.SPsufficientList[2].disabled = true; + + } + else if(not_stock3 == 0){ + + this.SPsufficientList[0].disabled = true; + this.SPsufficientList[2].disabled = false; + + } + + } + let FGOverallCount = this.FinishedCounterArray.reduce((sum, val) => sum + +val, 0); let RTGOverallCount = this.RetailCounterArray.reduce((sum, val) => sum + +val, 0); - let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); + let WTGOverallCount = this.WholeSaleCounterArray.reduce((sum, val) => sum + +val, 0); let TGOverallCount = FGOverallCount + RTGOverallCount + WTGOverallCount; this.TGCommentCard = TGOverallCount > 0 ? true : false; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html index e3553efcb..dfc8306d2 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.html @@ -13,340 +13,569 @@
- - - - -
Manufacturing Product Details
-
-
-
-
- -
Raw Material {{l+1}}
-
- - - - - - -
-
- - - Select - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - Person Designation Required - -
-
- - - Enter Valid Mobile Number. - - - - Enter Valid STD Code Number. -   -   - - - Enter Valid LandLine Number. - -
-
- - - + + + + + + Person Designation Required + +
+
+ + + Enter Valid Mobile Number. + + + + Enter Valid STD Code Number. +   -   + + + Enter Valid LandLine Number. + +
+
+ + + - - Select - {{ pm.name + + Select + {{ pm.name }} - + - - - - Select - Payment made in Cash. - Payment made - through Banking channels. - Payment made through Cash and Banking Channels. - + + + + Select + Payment made in + Cash. + + Payment made + through Banking channels. + + Payment made through Cash and Banking Channels. + + + +
+ +
+ No.of days of Credit Provided by Supplier + + + + + + +
+ +
+ + + +
+
+
+
+
+
+ +
+
+
+ +
-
- No.of days of Credit Provided by Supplier - - - - - - -
- -
- - - -
- -
-
-
-
- -
-
-
- - - -
- -
- -
- -
Trading Product Details
-
-
-
-
- -
Trading Product {{l+1}}
-
- - - - {{ - pm.name }} - - - - - -
-
- - - Select - - {{tl.name}} - - - - - - - - - Select - - {{comrelShip.name}} - - - - - - - Person Designation Required - -
-
- - - Enter Valid Mobile Number. - - - - - - Enter Valid STD Code Number. -   -   - - - Enter Valid LandLine Number. - -
-
- - - - Select - {{ pm.name - }} - - - - - Select - Payment made in Cash. - Payment made - through Banking channels. - Payment made through Cash and Banking Channels. - - - -
- -
- No.of days of Credit Provided by Supplier - - - - - - -
- -
- - - -
-
-
-
-
-
- -
-
-
- - - -
- -
-
-
- -
Service Provider Product Details
-
Service Provider Details Not applicable here !!
-
- - - - - -
-
-
-
-
-
-
- -
- - {{doc.document_name}} -
-
- -
-
-
-
-
-
-
- - picture_as_pdf - {{doc.document_title}} - + + +
Trading Product Details
+
+
+
+
+ +
Trading Product + {{l+1}}
+
+ + + + {{ + pm.name }} + + + + + +
+
+ + + Select + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + Person Designation Required + +
+
+ + + Enter Valid Mobile Number. + + + + + + Enter Valid STD Code Number. +   -   + + + Enter Valid LandLine Number. + +
+
+ + + + Select + {{ pm.name + }} + + + + + Select + Payment made in + Cash. + + Payment made + through Banking channels. + + Payment made through Cash and Banking Channels. + + + + +
+ +
+ No.of days of Credit Provided by Supplier + + + + + + +
+ +
+ + + +
+
+
+
+
+
+ +
+
+
+ + + +
+ +
+
+
+ +
Service Provider Product Details
+
+
+
+
+ +
Service Provider + {{l+1}}
+
+ + + + {{ + sp.name }} + + + + + +
+
+ + + Select + + {{tl.name}} + + + + + + + + + Select + + {{comrelShip.name}} + + + + + + + + Person Designation Required + +
+
+ + + Enter Valid Mobile Number. + + + + + + Enter Valid STD Code Number. +   -   + + + Enter Valid LandLine Number. + +
+
+ + + + Select + {{ pm.name + }} + + + + + Select + Payment made in + Cash. + + Payment made + through Banking channels. + + Payment made through Cash and Banking Channels. + + + + +
+ +
+ No.of days of Credit Provided by Supplier + + + + + + +
+ +
+ + + +
+
+
+
+
+
+ +
+
+
+ + + +
+ +
+
+
+ + + + + + +
+
+
+
+
+
+
+ +
+ + {{doc.document_name}} +
+ +
+ +
+
+
+
+
+
+
+
+
+ + picture_as_pdf + {{doc.document_title}} + +
+
-
-
- - -

No Files

-
-
- - + + +

No Files

+
+
+ + - + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts index 35ec0a8af..d06645fd5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/supplier-info/supplier-info.component.ts @@ -32,6 +32,7 @@ export class SupplierInfoComponent implements OnInit { public m_manufacturingProducts = []; public m_tradingProducts = []; + public m_serviceProvider = []; company_id: string; public _supplierQuesFrom: FormGroup; @@ -110,11 +111,11 @@ export class SupplierInfoComponent implements OnInit { let datas = data.records; this.initFormLoadDetails(datas.type_of_activity); 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]); - + 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) { @@ -128,10 +129,17 @@ export class SupplierInfoComponent implements OnInit { this.m_tradingProducts.push(val.prodcuts); } } + if(val.type_of_activity_id == 5){ + if (val.prodcuts) { + this.m_serviceProvider.push(val.prodcuts); + } + } }); } this.m_tradingProducts = [].concat.apply([], this.m_tradingProducts); + this.m_serviceProvider = [].concat.apply([], this.m_serviceProvider); + } else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; @@ -151,8 +159,6 @@ export class SupplierInfoComponent implements OnInit { this.retriveFile(); } - - serviceProviderForm: Boolean = false; initFormLoadDetails(record) { let params: any = {}; params.parent_pdid = this.parent_pdid; @@ -172,6 +178,7 @@ export class SupplierInfoComponent implements OnInit { company_id: [this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), }); @@ -208,6 +215,22 @@ export class SupplierInfoComponent implements OnInit { this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null); } } + + let arr2 = record.filter(data => data.type_of_activity_id == 5); + + if (arr2.length > 0) { + + if (dataForm.hasOwnProperty('servicing_details') && dataForm.servicing_details[0] !== null) { + let api_service_providers = dataForm.servicing_details[0].service_providers; + this.initServiceProvidersDetails(api_service_providers); + this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(dataForm.servicing_details[0].service_providers_total_payments_percent_on_credit || null); + } + else { + this.initServiceProvidersDetails(null); + this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null); + } + } + this.noRecordsFound = true; } else { this._supplierQuesFrom = this._formBuilder.group({ @@ -217,6 +240,7 @@ export class SupplierInfoComponent implements OnInit { company_id: [this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), }); @@ -230,12 +254,14 @@ export class SupplierInfoComponent implements OnInit { this.initTradingProductsDetails(null); this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null); } + let arr2 = record.filter(data => data.type_of_activity_id == 5); + if (arr2.length > 0) { + + this.initServiceProvidersDetails(null); + this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(dataForm.servicing_details[0].service_providers_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._supplierQuesFrom = this._formBuilder.group({ parent_pdid: [this.parent_pdid], @@ -244,6 +270,7 @@ export class SupplierInfoComponent implements OnInit { company_id: [this.company_id], manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), + servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), supplier_info_form_remark: [] // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), }); @@ -259,7 +286,9 @@ export class SupplierInfoComponent implements OnInit { } let arr2 = record.filter(data => data.type_of_activity_id == 5); if (arr2.length > 0) { - this.serviceProviderForm = true; + // this.serviceProviderForm = true; + this.initServiceProvidersDetails(null); + this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers_total_payments_percent_on_credit'].setValue(null); } this.noRecordsFound = true; } @@ -299,6 +328,20 @@ export class SupplierInfoComponent implements OnInit { } } + servicingForm: Boolean = false; + servicingFormCreation(val) { + let arr = val.filter(data => data.type_of_activity_id == 5); + if (arr.length > 0) { + this.servicingForm = true; + return this._formBuilder.group({ + service_providers: this._formBuilder.array([]), + service_providers_total_payments_percent_on_credit: [] + }); + } else { + return; + } + } + initManufacturingProductsDetails(datas) { const control = this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; if (datas === null) { @@ -349,7 +392,7 @@ export class SupplierInfoComponent implements OnInit { }) } } - + initTradingProductsDetails(datas) { const control = this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products']; @@ -401,6 +444,58 @@ export class SupplierInfoComponent implements OnInit { } } + initServiceProvidersDetails(datas) { + const control = this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers']; + + if (datas === null) { + control.push(this.initServiceProviders(null)); + + } else { + datas.forEach((val, inx) => { + this.checkCard(val.trade_product_payment_type, 3, inx); + control.push(this.initServiceProviders(val)); + }); + } + } + + initServiceProviders(records) { + if (records === null) { + return this._formBuilder.group({ + service_provider_name: [''], + service_provider_supplier_name: [''], + person_title_name: [''], + person_designation: [''], + other_person_designation: [''], + service_provider_contact_person_name: [''], + service_provider_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]*$')])], + service_provider_payment_type: [''], + service_provider_payment_mode: [''], + service_provider_frequency_of_purchase: [''], + service_provider_credit_days_from: [''], + service_provider_credit_days_to: [''], + }) + } else { + return this._formBuilder.group({ + service_provider_name: [records.service_provider_name], + person_title_name: [records.person_title_name], + person_designation: [records.person_designation], + other_person_designation: [records.other_person_designation], + service_provider_supplier_name: [records.service_provider_supplier_name], + service_provider_contact_person_name: [records.service_provider_contact_person_name], + service_provider_contact_person_mobile_number: [records.service_provider_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]*$')])], + service_provider_payment_type: [records.service_provider_payment_type], + service_provider_payment_mode: [records.service_provider_payment_mode], + service_provider_frequency_of_purchase: [records.service_provider_frequency_of_purchase], + service_provider_credit_days_from: [records.service_provider_credit_days_from], + service_provider_credit_days_to: [records.service_provider_credit_days_to], + }) + } + } + addMoreRawMaterials(e): void { // e.stropPropagation(); const control = this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; @@ -424,6 +519,17 @@ export class SupplierInfoComponent implements OnInit { const control = this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products']; control.removeAt(inx); } + + addMoreServiceProvider(e): void { + // e.stropPropagation(); + const control = this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers']; + control.push(this.initServiceProviders(null)); + } + + removeServiceProvider(inx): void { + const control = this._supplierQuesFrom.controls['servicing_details']['controls'][0].controls['service_providers']; + control.removeAt(inx); + } // get all master details getMasterDetails(table: string, type: number) { @@ -528,12 +634,20 @@ export class SupplierInfoComponent implements OnInit { else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');} items.controls['other_person_designation'].updateValueAndValidity(); } + else if (flag == 3) { + if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); } + else{ 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 == 2 && e == 3) { this.trdCounter[index] = 1; @@ -552,9 +666,32 @@ export class SupplierInfoComponent implements OnInit { } let MFG = this.mfgCounter.reduce((sum, val) => sum + +val, 0); this.mfgCreditCardFlag = MFG > 0 ? true : false; + + 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; } selectedPaymentTerms(items, e, flag) { + if (flag == 3) { + if (e == 3) { + items.controls['service_provider_credit_days_from'].setValidators([Validators.required]); + items.controls['service_provider_credit_days_to'].setValidators([Validators.required]); + } + else { + items.controls['service_provider_credit_days_from'].clearValidators(); + items.controls['service_provider_credit_days_from'].setValue(''); + items.controls['service_provider_credit_days_to'].clearValidators(); + items.controls['service_provider_credit_days_to'].setValue(''); + } + items.controls['service_provider_credit_days_from'].updateValueAndValidity(); + items.controls['service_provider_credit_days_to'].updateValueAndValidity(); + } if (flag == 2) { if (e == 3) { items.controls['trade_product_credit_days_from'].setValidators([Validators.required]); diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html index ab580e3a1..130e1467d 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html +++ b/ng6-seed/src/app/quality-check/qc-list/qc-pd-report/qc-pd-report.component.html @@ -36,7 +36,7 @@ - + diff --git a/ng6-seed/src/app/shared/messaging.service.ts b/ng6-seed/src/app/shared/messaging.service.ts index 13fd14bc0..17501a308 100644 --- a/ng6-seed/src/app/shared/messaging.service.ts +++ b/ng6-seed/src/app/shared/messaging.service.ts @@ -43,11 +43,11 @@ export class MessagingService { this.angularFireDB.object('fcmTokens/').update(data) }) - let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}}; - this.updateNotificationToken(params).subscribe( - (data) => { console.log('success',data);}, - (err) => { console.error('something wents wrong on update notify.', err); - }); + // let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}}; + // this.updateNotificationToken(params).subscribe( + // (data) => { console.log('success',data);}, + // (err) => { console.error('something wents wrong on update notify.', err); + // }); } updateNotificationToken(params): Observable {