From 2f7f36bbab68fe131eee8b023fc83d17ec6550e9 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 10:41:42 +0530 Subject: [PATCH 01/13] button color changes --- .../business-info/business-info.component.html | 16 ++++++++-------- .../neighbour-hood/neighbour-hood.component.html | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html index 907f84964..afaceb53b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -276,7 +276,7 @@ add @@ -299,7 +299,7 @@ add @@ -364,7 +364,7 @@ add @@ -387,7 +387,7 @@ add @@ -452,7 +452,7 @@ add @@ -475,7 +475,7 @@ add @@ -540,7 +540,7 @@ add @@ -563,7 +563,7 @@ add diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html index cfa8d8f4b..9b6a835ee 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html @@ -46,7 +46,7 @@ @@ -99,7 +99,7 @@ From 412a8d956ae09663cc22dad6f61e2b831c368246 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 10:42:18 +0530 Subject: [PATCH 02/13] merge changes: kms --- .../financial-info.component.html | 2 +- .../financial-info.component.ts | 23 +- .../start-pd/forms/stock/stock.component.html | 605 ++++++++---- .../start-pd/forms/stock/stock.component.ts | 923 ++++++++++++------ 4 files changed, 1010 insertions(+), 543 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html index 683db0cd1..6ee1a4bb7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -68,7 +68,7 @@ - {{SalesStatement[i]}} + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts index f0bd5306c..2cbef9a51 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -459,16 +459,18 @@ export class FinancialInfoComponent implements OnInit { } - calAmount(index, detail) { + + calAmount(i, detail) { + console.log(detail); + let salary = detail.value.estimate_annual_sale; - if(detail.value.estimate_profit_or_loss == 1){ + if(detail.value.estimate_profit_or_loss == 1){ - // let profit = detail.value.estimate_net_profit; - let margin_profit = detail.value.estimate_margin_of_profit; - - + // let profit = detail.value.estimate_net_profit; + let margin_profit = detail.value.estimate_margin_of_profit; + if (salary != '' && margin_profit != '') { @@ -480,7 +482,6 @@ export class FinancialInfoComponent implements OnInit { //detail.controls.estimate_margin_of_profit.setValue(margin.toFixed(2)); detail.controls.estimate_net_profit.setValue(profit.toFixed(2)); - } } // else if (detail.value.estimate_profit_or_loss == 2){ @@ -498,7 +499,7 @@ export class FinancialInfoComponent implements OnInit { } submitDetails() { - console.log(this.financialForm.value.date_per_financial['financial_variation']); + if(this.financialForm.value.date_per_financial['finanical_profit_or_loss'] == 1){ this.financialForm.value.date_per_financial['financial_net_profit'].setValidators([Validators.required]); @@ -527,9 +528,9 @@ export class FinancialInfoComponent implements OnInit { this.financialForm.value.date_per_financial['financial_margin_of_loss'].setValidators([Validators.required]); this.financialForm.value.date_per_financial['financial_margin_of_loss'].updateValueAndValidity(); } - if (!this.financialForm.valid) { - return; - } + // if (!this.financialForm.valid) { + // return; + // } let records = this.financialForm.value; console.log('data', records); this._pd.saveForm(records).subscribe(data => { 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 450d5378e..ea0fce859 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 @@ -1,222 +1,414 @@ -
-

+

{{pageTitle}}
-
-

- + + +
+ + - - - - - -
-
- - - -

Raw Materials

- -

-
+ + + +
+
+ + +

Manufacturing Details

+
+
+
+
+
+

{{a+1}} . Raw Material

- - Yes - No + + Yes + No - - - - - - + + + + + - {{uom.name}} - + {{uom.name}} + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the stock level observed? + + + + + + +
+
+ +
+
+

{{b+1}} Finished Goods

+ + + - - - - - - {{"₹"}} {{rawValueInWords}} Only - - - - - - - + + Yes No - - Please comment on the stock level observed? - - - - - - - -
- - - -
-
-
-
- - - -

Finished Goods

- -

-
- - - - - - - Yes - No - - - - - - - - - {{"₹"}} {{goodsValueInWords}} Only - - - - - - - - Yes - No - - - - Please comment on the finished goods stock level observed? - - - - - - - -
-
-
- - +
+ +
+
+

{{c+1}} Traded Goods

+ + + + + + + Yes + No + + + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the Traded Goods stock level observed? + + + + + + + +
+
+ + + + +

Retail Details

+
+ +
+
+ +
+
+

{{d+1}} Finished Goods

+ + + + + + + Yes + No + + + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the finished goods stock level observed? + + + + + + + +
+
-
-
- - -

Stock of Goods Traded

- -

-
- - - - - - - Yes - No - - - - - - - - - {{"₹"}} {{tradedGoodsValueInWords}} Only - - - - - - - - Yes - No - - - - Please comment on the Traded Goods stock level observed? - - - - - - - -
-
-
- +
+
+

{{e+1}} Traded Goods

+ + + + + + + Yes + No + + + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the Traded Goods stock level observed? + + + + + + +
- - - +
+
+ + + + + +

Trading Details

+
+ +
+
+
+
+

{{f+1}} Finished Goods

+ + + + + + + Yes + No + + + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the finished goods stock level observed? + + + + + + + + +
+
+ +
+
+

{{g+1}} Traded Goods

+ + + + + + + Yes + No + + + + + + + + + + + + + + + + + Yes + No + + + + Please comment on the Traded Goods stock level observed? + + + + + + + + +
+
+
+
+ +
+ +
+
+ + + + -
-
+
+
@@ -246,7 +438,7 @@
-
+
Image 3
@@ -283,7 +475,7 @@ picture_as_pdf version_111
-
+
@@ -306,40 +498,33 @@
-
- - +
+ + - - + +
Remarks - -
-
- -
+ +
+
+ +
- - - - - - - - + +
+ +
--> - + \ No newline at end of file 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 619b4856b..9eff1689c 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 @@ -35,7 +35,7 @@ export class StockComponent implements OnInit { pageTitle: string ="Stock Details"; pdid: number; form_id: number; - public stockForm: FormGroup; + public stockForms: FormGroup; private notifier: NotifierService; public uomData : any = []; @@ -46,6 +46,8 @@ export class StockComponent implements OnInit { rawMaterialAccess: boolean; finishedGoodsAccess: boolean; tradeConcernAccess: boolean; + public submitted = false; + noRecordsFound: Boolean = false; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, @@ -74,154 +76,310 @@ export class StockComponent implements OnInit { } }; ngOnInit() { - this.initstockForm(); - this.getUOM(); - //this.setSku('data',0); + + // this._pd.stockFormsAccess({pd_id:this.pdid}).subscribe(data => { + // if(data.status == 200){ + // this.initstockForms(data.record.type_of_activity); + // } + // }, err => { + // this.notifier.notify('warning', 'There is No Type Of Activity Please Check Bussiness Information.!'); + // }) + + this._pd.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { + // if(data.dataStatus === undefined){ + let datas = { + "profession_name": "Others", + "type_of_activity": [ + { + "type_of_activity_id": 1, + "name": "Manufacturing Details" + }, + { + "type_of_activity_id": 2, + "name": "Retail trading" + }, + { + "type_of_activity_id": 3, + "name": "Trading Concern" + }, + { + "type_of_activity_id": 4, + "name": "Service Provider" + } + ] + }; + this.initstockForms(datas.type_of_activity); + // }else { + // this.notifier.notify('warning', 'No Category Records Found.!'); + // this.noRecordsFound = false; + // } + }, err => { + + this.notifier.notify('warning', 'There is No Type Of Activity Please Check Bussiness Information.!'); + this.noRecordsFound = false; + }) + + this.getUOM(); + } + + public initstockForms(record){ + let params: any = {}; - let activityArray : any = []; params.pd_id = this.pdid; params.pd_form_id = this.form_id; - - this._pd.stockFormAccess({pd_id:this.pdid}).subscribe(value => { - console.log(value); - const rawMaterial = this.stockForm.controls['raw_materials']; - const finishedGoods = this.stockForm.controls['finished_goods']; - const tradedGoods = this.stockForm.controls['traded_goods']; - - if (value.status == 200) { - console.log('value.records',value.records); - value.records.type_of_activity.forEach(val => { - //console.log(val); - //console.log(val.type_of_activity_id); - this.rawMaterialAccess = true; - this.finishedGoodsAccess = true; - this.tradeConcernAccess = true; - if(val.type_of_activity_id == 1){ - rawMaterial.push(this.createRawmaterial()); - finishedGoods.push(this.createGoods()); - tradedGoods.push(this.createTradedGoods()); - } - else if(val.type_of_activity_id == 2){ - rawMaterial.push(this.createRawmaterial()); - finishedGoods.push(this.createGoods()); - } - else if(val.type_of_activity_id == 3){ - rawMaterial.push(this.createRawmaterial()); - finishedGoods.push(this.createGoods()); - } - // else if(val.type_of_activity_id == 4){ - // } - - }); - - this._pd.retriveForm({pd_id:this.pdid,pd_form_id:'1'}).subscribe(value => { - //console.log('Raw material Name',value.records.main_raw_materials); - - // const faControl = (this.stockForm.controls['raw_materials']).at(1); - - //const control = (this.stockForm.controls['raw_materials']).at(0); - //console.log(control); - - // this.stockForm.controls['raw_materials'].setValue(value.records.main_raw_materials); - // if (value.status == 200) { - // this.rawmaterial = value.records.main_raw_materials; - // }else{ this.rawmaterial = ''; } - }) this._pd.retriveForm(params).subscribe(value => { - //console.log('value', value); - if (value.status == 200) { - console.log('data',value); - // Raw Material Access is True means., Data have to load, - if(this.rawMaterialAccess == true){ - - let result = Object.keys(value.records.raw_materials).map(function(key) { - return value.records.raw_materials[key]; - }); - - if (result.length > 0) { - - result.forEach(val => { - - //this.RawMaterialValidation(val.stock_observed); - rawMaterial.push(this.createRawmaterial()); - if(val.raw_value != '' && val.raw_value != null ){ this.rawValueInWords = this._pd.convertNumberToWords(val.raw_value); } - }); - this.stockForm.controls['raw_materials'].setValue(result); - } else { - rawMaterial.push(this.createRawmaterial()); - } - } - - // Finished Goods Access is TRUE Means., data have to load., - if(this.finishedGoodsAccess == true){ - let result_Goods = Object.keys(value.records.finished_goods).map(function(key) { - return value.records.finished_goods[key]; - }); - - if (result_Goods.length > 0) { - - result_Goods.forEach(val => { - - //this.GoodsValidation(val.goods_observed); - finishedGoods.push(this.createGoods()); - if(val.goods_value != '' && val.goods_value != null ){ this.goodsValueInWords = this._pd.convertNumberToWords(val.goods_value); } - }); - this.stockForm.controls['finished_goods'].setValue(result_Goods); - } else { - finishedGoods.push(this.createGoods()); - } - } - - //TradeConcern Access is TRUE Means., data have to load., - if(this.tradeConcernAccess == true){ - let result_Traded_Goods = Object.keys(value.records.finished_goods).map(function(key) { - return value.records.traded_goods[key]; - }); - - if (result_Traded_Goods.length > 0) { - - result_Traded_Goods.forEach(val => { - - - tradedGoods.push(this.createTradedGoods()); - if(val.traded_goods_value != '' && val.traded_goods_value != null ) - { this.tradedGoodsValueInWords = this._pd.convertNumberToWords(val.traded_goods_value); } - }); - this.stockForm.controls['traded_goods'].setValue(result_Traded_Goods); - } else { - tradedGoods.push(this.createTradedGoods()); - } - } - - - this.stockForm.controls['stock_remarks'].setValue(value.records.stock_remarks); + let dataForm = value.records; - } else { - // rawMaterial.push(this.createRawmaterial()); - // finishedGoods.push(this.createGoods()); - // tradedGoods.push(this.createTradedGoods()); + if(dataForm !== undefined) { + console.log('dtaForm',dataForm); + this.stockForms = this.fb.group({ + pdid: [this.pdid], + formid: [this.form_id], + stock_remarks: [''], + manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), + retail_details : this.fb.array([this.retailFormCreation(record)]), + trade_details: this.fb.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id === 1); + if(arr.length > 0) { + let retail_finished_goods; + let manufacturing_raw_materials; + let manufacturing_finished_goods; + let manufacturing_traded_goods; + if(dataForm.manufacturing_raw_materials !==undefined){ + manufacturing_raw_materials = Object.keys(dataForm.manufacturing_raw_materials).map(function (key) { + return dataForm.manufacturing_raw_materials[key]; + }); + } + if(dataForm.manufacturing_finished_goods !==undefined){ + manufacturing_finished_goods = Object.keys(dataForm.manufacturing_finished_goods).map(function (key) { + return dataForm.manufacturing_finished_goods[key]; + }); + } + if(dataForm.manufacturing_traded_goods !==undefined){ + manufacturing_traded_goods = Object.keys(dataForm.manufacturing_traded_goods).map(function (key) { + return dataForm.manufacturing_traded_goods[key]; + }); + } + if(dataForm.retail_finished_goods !==undefined) + { + retail_finished_goods = Object.keys(dataForm.retail_finished_goods).map(function(key) + { + return dataForm.retail_finished_goods[key]; + }) + } + //console.log(retail_finished_goods,manufacturing_traded_goods); + let manufacturing_temparr = []; + manufacturing_temparr['manufacturing_traded_goods'] = manufacturing_traded_goods;manufacturing_temparr['manufacturing_finished_goods'] = manufacturing_finished_goods;manufacturing_temparr['manufacturing_raw_materials'] = manufacturing_raw_materials; + this.initManufacturingDetails(manufacturing_temparr); + } + let arr1 = record.filter(data => data.type_of_activity_id === 2); + if(arr1.length > 0) { + let retail_finished_goods; + let retail_traded_goods; + + + if(dataForm.retail_traded_goods !==undefined){ + retail_traded_goods = Object.keys(dataForm.retail_traded_goods).map(function (key) { + return dataForm.retail_traded_goods[key]; + }); + } + if(dataForm.retail_finished_goods !==undefined) + { + retail_finished_goods = Object.keys(dataForm.retail_finished_goods).map(function(key) + { + return dataForm.retail_finished_goods[key]; + }) + } + + let retail_temparr = []; + retail_temparr['retail_traded_goods'] = retail_traded_goods; + retail_temparr['retail_finished_goods'] = retail_finished_goods; + this.initRetailDetails(retail_temparr); + } + let arr2 = record.filter(data => data.type_of_activity_id === 3); + if(arr2.length > 0) { + let trading_finished_goods; + let trading_traded_goods; + + if(dataForm.trading_finished_goods !==undefined){ + + trading_finished_goods = Object.keys(dataForm.trading_finished_goods).map(function (key) { + return dataForm.trading_finished_goods[key]; + }); + } + if(dataForm.trading_traded_goods !==undefined) + { + trading_traded_goods = Object.keys(dataForm.trading_traded_goods).map(function(key) + { + return dataForm.trading_traded_goods[key]; + }) + } + + let trading_temparr = []; + trading_temparr['trading_finished_goods'] = trading_finished_goods; + trading_temparr['trading_traded_goods'] = trading_traded_goods; + this.initTradingDetails(trading_temparr); + } + this.noRecordsFound = true; + } + else{ + console.log('dataForm',dataForm); + this.stockForms = this.fb.group({ + pdid: [this.pdid], + formid: [this.form_id], + stock_remarks: [''], + manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), + retail_details : this.fb.array([this.retailFormCreation(record)]), + trade_details: this.fb.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id === 1); + if(arr.length > 0) { + this.initManufacturingDetails(null); + } + let arr1 = record.filter(data => data.type_of_activity_id === 2); + if(arr1.length > 0) { + this.initRetailDetails(null); + } + let arr2 = record.filter(data => data.type_of_activity_id === 3); + if(arr2.length > 0) { + this.initTradingDetails(null); + } + let arr3 = record.filter(data => data.type_of_activity_id === 4); + if(arr3.length > 0) { + //this.serviceProviderForm = true; + } + this.noRecordsFound = true; + } + } + else { + this.stockForms = this.fb.group({ + pdid: [this.pdid], + formid: [this.form_id], + stock_remarks: [''], + manufacturing_details: this.fb.array([this.manufacturingFormCreation(record)]), + retail_details : this.fb.array([this.retailFormCreation(record)]), + trade_details: this.fb.array([this.tradingFormCreation(record)]), + }); + let arr = record.filter(data => data.type_of_activity_id === 1); + if(arr.length > 0) { + this.initManufacturingDetails(null); + } + let arr1 = record.filter(data => data.type_of_activity_id === 2); + if(arr1.length > 0) { + this.initRetailDetails(null); + } + let arr2 = record.filter(data => data.type_of_activity_id === 3); + if(arr2.length > 0) { + this.initTradingDetails(null); + } + let arr3 = record.filter(data => data.type_of_activity_id === 4); + if(arr3.length > 0) { + //this.serviceProviderForm = true; + } + this.noRecordsFound = true; } }) - } -}); -} - public initstockForm(): void { - this.stockForm = this.fb.group({ - stock_remarks: ['', Validators.compose([Validators.required])], - raw_materials: this.fb.array([]), - finished_goods: this.fb.array([]), - traded_goods: this.fb.array([]) - }); + // this.stockForms = this.fb.group({ + // stock_remarks: ['', Validators.compose([Validators.required])], + // raw_materials: this.fb.array([]), + // finished_goods: this.fb.array([]), + // traded_goods: this.fb.array([]) + // }); } + + manufacturingForm: Boolean = false; + manufacturingFormCreation(val) { + let arr = val.filter(data => data.type_of_activity_id === 1); + if (arr.length > 0) { + this.manufacturingForm = true; + return this.fb.group({ + manufacturing_raw_materials: this.fb.array([]), + manufacturing_finished_goods: this.fb.array([]), + manufacturing_traded_goods: this.fb.array([]) + }) + // } + } else { + return; + } + } + + retailForm: Boolean = false; + retailFormCreation(val) { + let arr = val.filter(data => data.type_of_activity_id === 2); + if (arr.length > 0) { + this.retailForm = true; + return this.fb.group({ + retail_finished_goods: this.fb.array([]), + retail_traded_goods: this.fb.array([]) + }) + // } + } else { + return; + } + } + + tradingForm: Boolean = false; + tradingFormCreation(val) { + let arr = val.filter(data => data.type_of_activity_id === 3); + if (arr.length > 0) { + this.tradingForm = true; + return this.fb.group({ + trading_finished_goods: this.fb.array([]), + trading_traded_goods: this.fb.array([]) + }); + } else { + return; + } + } + //setSku(sku: string, index: number) { // const faControl = - // (this.stockForm.controls['raw_materials']).at(index); + // (this.stockForms.controls['raw_materials']).at(index); // faControl['controls'].raw_name.setValue(sku); // } - createRawmaterial() { + + initManufacturingDetails(datas) { + + const rawMaterial = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; + const finishedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + const tradedGoods = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['main_raw_materials']; + + if(datas === null){ + console.log(299,'if'); + // rawMaterial.push(this.createRawmaterial(null)); + // finishedGoods.push(this.createGoods(null)); + // tradedGoods.push(this.createTradedGoods(null)); + + } else { + console.log(305,'else') + for (let val of datas.manufacturing_raw_materials) { + console.log(val); + + rawMaterial.push(this.createRawmaterial(val)); + + } + for (let val of datas.manufacturing_finished_goods) { + console.log(val); + + finishedGoods.push(this.createGoods(val)); + + } + for (let val of datas.manufacturing_traded_goods) { + console.log(val); + + tradedGoods.push(this.createTradedGoods(val)); + + } + console.log(310,rawMaterial); + } + } + + createRawmaterial2() { return this.fb.group({ raw_name: ['', Validators.compose([Validators.required])], stock_observed:['', Validators.compose([Validators.required])], @@ -234,7 +392,67 @@ export class StockComponent implements OnInit { rawmaterial_remarks:[''] }); } - createGoods() { + + + createRawmaterial(records) { + // console.log(330,'function in'); + if(records === null) { + // console.log(331,'fif'); + return this.fb.group({ + raw_name: [''], + stock_observed:[''], + raw_quantity: [''], + raw_uom: [''], + other_uom : [''], + raw_value: [''], + rawmaterial_value: [''], + is_sufficiant_raw: [''], + rawmaterial_remarks:[''] + }) + } else { + // console.log(343,'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] + }) + } + } + + initRetailDetails(datas) { + + const finishedGoods = this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods']; + const tradedGoods = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; + + if(datas === null){ + + finishedGoods.push(this.createGoods(null)); + tradedGoods.push(this.createTradedGoods(null)); + + } else { + + for (let val of datas.retail_finished_goods) { + console.log(val); + + finishedGoods.push(this.createGoods(val)); + + } + for (let val of datas.retail_traded_goods) { + console.log(val); + tradedGoods.push(this.createTradedGoods(val)); + + } + } + } + + createGoods2() { return this.fb.group({ goods_name: ['', Validators.compose([Validators.required])], goods_observed: ['', Validators.compose([Validators.required])], @@ -246,7 +464,33 @@ export class StockComponent implements OnInit { }); } - createTradedGoods() { + createGoods(records) { + if(records === null) { + return this.fb.group({ + goods_name: [''], + goods_observed: [''], + goods_quantity: [''], + goods_value: [''], + finished_goods_value: [''], + is_sufficiant_goods: [''], + finishedgoods_remarks:[''] + }); + } + else { + return this.fb.group({ + goods_name: [records.goods_name], + goods_observed: [records.goods_observed], + goods_quantity: [records.goods_quantity], + goods_value: [records.goods_value], + finished_goods_value: [records.finished_goods_value], + is_sufficiant_goods: [records.is_sufficiant_goods], + finishedgoods_remarks:[records.finishedgoods_remarks] + }) + } + } + + + createTradedGoods2() { return this.fb.group({ traded_goods_name: ['', Validators.compose([Validators.required])], traded_goods_observed: ['', Validators.compose([Validators.required])], @@ -257,64 +501,231 @@ export class StockComponent implements OnInit { traded_goods_remarks:[''] }); } - addRawMaterials() { - const control = this.stockForm.controls['raw_materials']; - control.push(this.createRawmaterial()); - } - deleteRawMaterials(index) { - const control = this.stockForm.controls['raw_materials']; - control.removeAt(index); - } - addGoods() { - const control = this.stockForm.controls['finished_goods']; - control.push(this.createGoods()); - } - deleteGoods(index) { - const control = this.stockForm.controls['finished_goods']; - control.removeAt(index); - } - addTradedGoods() { - const control = this.stockForm.controls['traded_goods']; - control.push(this.createTradedGoods()); - } - deleteTradedGoods(index) { - const control = this.stockForm.controls['traded_goods']; - control.removeAt(index); + + initTradingDetails(datas) { + + const finishedGoods = this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods']; + const tradedGoods = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; + + if(datas === null){ + + finishedGoods.push(this.createGoods(null)); + tradedGoods.push(this.createTradedGoods(null)); + + } else { + // for (let val of datas) { + + // finishedGoods.push(this.createGoods(val.trading_finished_goods)); + // tradedGoods.push(this.createTradedGoods(val.trading_traded_goods)); + + // } + + for (let val of datas.trading_finished_goods) { + console.log(val); + + finishedGoods.push(this.createGoods(val)); + + } + for (let val of datas.trading_traded_goods) { + console.log(val); + tradedGoods.push(this.createTradedGoods(val)); + + } + + } } - submitDetails() { - if (!this.stockForm.valid) { - return; - } - let records: any = {}; - records.pdid = this.pdid; - records.formid = this.form_id; - records.fk_createdby = this.pdid; - if(this.rawMaterialAccess == true){ - records.raw_materials = this.stockForm.controls['raw_materials'].value; } - if(this.finishedGoodsAccess == true){ - records.finished_goods = this.stockForm.controls['finished_goods'].value;} - if(this.tradeConcernAccess == true){ - records.traded_goods = this.stockForm.controls['traded_goods'].value; } - records.stock_remarks = this.stockForm.controls['stock_remarks'].value; - //console.log('data', records); - this._pd.saveForm(records).subscribe(data => { - //console.log('data', data); - this.notifier.notify('success', 'Saved Successfully.'); - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }) - } - validateAllFormFields(formGroup: FormGroup) { - Object.keys(formGroup.controls).forEach(field => { - const control = formGroup.get(field); - if (control instanceof FormControl) { - control.markAsTouched({onlySelf: true}); - } else if (control instanceof FormGroup) { - this.validateAllFormFields(control); - } + + createTradedGoods(records) { + if(records === null) { + return this.fb.group({ + traded_goods_name: [''], + traded_goods_observed: [''], + traded_goods_quantity: [''], + estimated_traded_goods_value: [''], + traded_goods_value: [''], + is_sufficiant_traded_goods: [''], + traded_goods_remarks:[''] }); + } + else { + return this.fb.group({ + traded_goods_name: [records.traded_goods_name], + traded_goods_observed: [records.traded_goods_observed], + traded_goods_quantity: [records.traded_goods_quantity], + 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] + }) } + } + + addRawMaterials(flag) { + + if(flag==1){ + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; + control.push(this.createRawmaterial(null)); + } + } + + + + deleteRawMaterials(index,flag) { + if(flag==1){ + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_raw_materials']; + // const control = this.stockForms.controls['raw_materials']; + control.removeAt(index); + } + } + + addGoods(flag) { + //const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + //const control = this.stockForms.controls['finished_goods']; + //control.push(this.createGoods(null)); + switch(flag){ + case 1: { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + control.push(this.createGoods(null)); + break; + } + case 2: { + const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods']; + control.push(this.createGoods(null)); + break; + } + case 3: { + const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods']; + control.push(this.createGoods(null)); + break; + } + default: { + break; + } + } + } + deleteGoods(index,flag) { + switch(flag){ + case 1: { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + control.removeAt(index); + break; + } + case 2: { + const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_finished_goods']; + control.removeAt(index); + break; + } + case 3: { + const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_finished_goods']; + control.removeAt(index); + break; + } + default: { + break; + } + + } + //const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_finished_goods']; + //const control = this.stockForms.controls['finished_goods']; + } + + addTradedGoods(flag) { + // const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; + // //const control = this.stockForms.controls['traded_goods']; + + // control.push(this.createTradedGoods(null)); + switch(flag){ + case 1: { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; + control.push(this.createTradedGoods(null)); + break; + } + case 2: { + const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; + control.push(this.createTradedGoods(null)); + break; + } + case 3: { + const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; + control.push(this.createTradedGoods(null)); + break; + } + default: { + break; + } + } + } + deleteTradedGoods(index,flag) { + switch(flag){ + case 1: { + const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; + control.removeAt(index); + break; + } + case 2: { + const control = this.stockForms.controls['retail_details']['controls'][0].controls['retail_traded_goods']; + control.removeAt(index); + break; + } + case 3: { + const control = this.stockForms.controls['trade_details']['controls'][0].controls['trading_traded_goods']; + control.removeAt(index); + break; + } + default: { + break; + } + } + + //const control = this.stockForms.controls['manufacturing_details']['controls'][0].controls['manufacturing_traded_goods']; + //const control = this.stockForms.controls['traded_goods']; + + } + + + /** To Save/Edited Popup Data */ + submitDetails(e) { + this.submitted = true; + // stop here if form is invalid + // if (this.stockForms.invalid) { + // return; + // } else { + var answerFormValues = this.stockForms.value; + + //To Remove The "Null" With Key also + Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); + + this._pd.savePDFormDetailsWithID(answerFormValues).subscribe( + dataresult => { + if (dataresult.status == 200) { + + this.notifier.notify('success', 'Record Saved Successfully.!'); + + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + + }); + + //} + } + + // validateAllFormFields(formGroup: FormGroup) { + // Object.keys(formGroup.controls).forEach(field => { + // const control = formGroup.get(field); + // if (control instanceof FormControl) { + // control.markAsTouched({onlySelf: true}); + // } else if (control instanceof FormGroup) { + // this.validateAllFormFields(control); + // } + // }); + // } + getUOM() { this._pd.getAllMasterDatas('UOM').subscribe(data => { @@ -352,134 +763,4 @@ export class StockComponent implements OnInit { break; } } - - // Validation Dynamically Add And Remove - GoodsValidation(event: any){ - // console.log('First Time',event); - // console.log('First Time Value',event.value); - - const control = this.stockForm.controls['finished_goods']; - - if(event.value == 'no') { - - control.controls[0].get('goods_quantity').setValidators([Validators.required]); - control.controls[0].get('goods_quantity').updateValueAndValidity(); - - control.controls[0].get('goods_value').setValidators([Validators.required]); - control.controls[0].get('goods_value').updateValueAndValidity(); - - control.controls[0].get('finished_goods_value').setValidators([Validators.required]); - control.controls[0].get('finished_goods_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_goods').setValidators([Validators.required]); - control.controls[0].get('is_sufficiant_goods').updateValueAndValidity(); - - - } - else - if(event.value == 'yes') { - - control.controls[0].get('goods_quantity').clearValidators(); - control.controls[0].get('goods_quantity').updateValueAndValidity(); - - control.controls[0].get('goods_value').clearValidators(); - control.controls[0].get('goods_value').updateValueAndValidity(); - - control.controls[0].get('finished_goods_value').clearValidators(); - control.controls[0].get('finished_goods_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_goods').clearValidators(); - control.controls[0].get('is_sufficiant_goods').updateValueAndValidity(); - - - - } - - } - - RawMaterialValidation(event: any){ - // console.log('First Time',event); - // console.log('First Time Value',event.value); - - const control = this.stockForm.controls['raw_materials']; - - if(event.value == 'no') { - - control.controls[0].get('raw_quantity').setValidators([Validators.required]); - control.controls[0].get('raw_quantity').updateValueAndValidity(); - - control.controls[0].get('raw_uom').setValidators([Validators.required]); - control.controls[0].get('raw_uom').updateValueAndValidity(); - - control.controls[0].get('raw_value').setValidators([Validators.required]); - control.controls[0].get('raw_value').updateValueAndValidity(); - - control.controls[0].get('rawmaterial_value').setValidators([Validators.required]); - control.controls[0].get('rawmaterial_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_raw').setValidators([Validators.required]); - control.controls[0].get('is_sufficiant_raw').updateValueAndValidity(); - - - } - else - if(event.value == 'yes') { - - control.controls[0].get('raw_quantity').clearValidators(); - control.controls[0].get('raw_quantity').updateValueAndValidity(); - - control.controls[0].get('raw_uom').clearValidators(); - control.controls[0].get('raw_uom').updateValueAndValidity(); - - control.controls[0].get('raw_value').clearValidators(); - control.controls[0].get('raw_value').updateValueAndValidity(); - - control.controls[0].get('rawmaterial_value').clearValidators(); - control.controls[0].get('rawmaterial_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_raw').clearValidators(); - control.controls[0].get('is_sufficiant_raw').updateValueAndValidity(); - } - - } - - TradedGoodsValidation(event: any){ - console.log('First Time',event); - console.log('First Time Value',event.value); - - const control = this.stockForm.controls['tradeded_goods']; - - if(event.value == 'no') { - - control.controls[0].get('traded_goods_quantity').setValidators([Validators.required]); - control.controls[0].get('traded_goods_quantity').updateValueAndValidity(); - - control.controls[0].get('estimated_traded_goods_value').setValidators([Validators.required]); - control.controls[0].get('estimated_traded_goods_value').updateValueAndValidity(); - - control.controls[0].get('traded_goods_value').setValidators([Validators.required]); - control.controls[0].get('traded_goods_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_traded_goods').setValidators([Validators.required]); - control.controls[0].get('is_sufficiant_traded_goods').updateValueAndValidity(); - } - else - if(event.value == 'yes') { - - control.controls[0].get('traded_goods_quantity').clearValidators(); - control.controls[0].get('traded_goods_quantity').updateValueAndValidity(); - - control.controls[0].get('estimated_traded_goods_value').clearValidators(); - control.controls[0].get('estimated_traded_goods_value').updateValueAndValidity(); - - control.controls[0].get('traded_goods_value').clearValidators(); - control.controls[0].get('traded_goods_value').updateValueAndValidity(); - - control.controls[0].get('is_sufficiant_traded_goods').clearValidators(); - control.controls[0].get('is_sufficiant_traded_goods').updateValueAndValidity(); - - } - - } - -} +} \ No newline at end of file From 562c7533ce20f4c8c1955f8705478bce2637b965 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 10:43:30 +0530 Subject: [PATCH 03/13] neighbour hood changes --- .../start-pd/forms/neighbour-hood/neighbour-hood.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html index 9b6a835ee..e8da740ae 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/neighbour-hood/neighbour-hood.component.html @@ -46,7 +46,7 @@ From e1517795b3c244de19c839b75177ac37a6099274 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Fri, 21 Dec 2018 11:21:35 +0530 Subject: [PATCH 04/13] entity api endpoint changes : kdk --- .../forms/family-details/family-details.component.ts | 3 +-- ng6-seed/src/app/settings/service/entity/entity.service.ts | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 4187be04d..93585e27d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -254,5 +254,4 @@ export class FamilyDetailsComponent implements OnInit { // } // } -} - +} \ No newline at end of file diff --git a/ng6-seed/src/app/settings/service/entity/entity.service.ts b/ng6-seed/src/app/settings/service/entity/entity.service.ts index 1a859a99f..d40a3639e 100755 --- a/ng6-seed/src/app/settings/service/entity/entity.service.ts +++ b/ng6-seed/src/app/settings/service/entity/entity.service.ts @@ -5,6 +5,10 @@ import { catchError } from 'rxjs/operators'; import { of } from 'rxjs'; import 'rxjs/add/operator/map'; + +/** Environment */ +import { environment } from 'environments/environment'; + /** Imported Service Files Are., */ import { AwsService } from '../../../AwsService/aws.service'; /** Consant Value For Created Date And Updated Date */ @@ -20,7 +24,7 @@ const currentdate = new Date().toJSON().slice(0, 19).replace('T', ' '); * Kdk */ export class EntityService { - private apiUrl = "http://ssa.sineedge.com/sparqapi/api/"; + private apiUrl = environment.apiEndpoint; private serviceUrl = 'https://jsonplaceholder.typicode.com/users'; constructor(private _http: HttpClient, From ddd6968a850c251c49d3b624452a51f1a370e556 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 11:23:51 +0530 Subject: [PATCH 05/13] pd view discussion options enabled --- .../list-pd/view-pd/view-pd.component.html | 2 +- .../list-pd/view-pd/view-pd.component.ts | 27 ++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 8697b5004..3c7d65a08 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -11,7 +11,7 @@
- + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index bcf27d053..64fd67858 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -60,16 +60,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { this.route.params.subscribe(params => { this.viewID = params['pdid']; }); - let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm'); - let scheduledDateTime: string="2018-12-03 08:20"; - let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime); - let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60); - if(diffInHours>=-4){ - this.enableStartPD=true; - } - else { - this.enableStartPD=false; - } + this.viewPdDetails(this.viewID); } @@ -84,6 +75,22 @@ export class ViewPdComponent implements OnInit, OnDestroy { //this.applicantPDLogsData= data.records.pd_logs.master; this.currentPDStatus = data.records.pd_master_details[0].pd_status; this.pdAdditionalReqData = data.records.pd_additional_requirements; + // enable pd start time + if(data.records.pd_master_details[0].scheduled_on_for_validation){ + let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm'); + let scheduledDateTime: string=data.records.pd_master_details[0].scheduled_on_for_validation; + let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime); + let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60); + if(diffInHours>=-4){ + this.enableStartPD=true; + } + else { + this.enableStartPD=false; + } + } + else { + this.enableStartPD=false; + } } }, error => this.errorMessage = error); } From 1b2a5b310bf9240c4799eb5153358252f83948a6 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 11:24:18 +0530 Subject: [PATCH 06/13] merge : kms --- .../forms/family-details/family-details.component.ts | 3 +-- ng6-seed/src/app/settings/service/entity/entity.service.ts | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 4187be04d..93585e27d 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -254,5 +254,4 @@ export class FamilyDetailsComponent implements OnInit { // } // } -} - +} \ No newline at end of file diff --git a/ng6-seed/src/app/settings/service/entity/entity.service.ts b/ng6-seed/src/app/settings/service/entity/entity.service.ts index 1a859a99f..d40a3639e 100755 --- a/ng6-seed/src/app/settings/service/entity/entity.service.ts +++ b/ng6-seed/src/app/settings/service/entity/entity.service.ts @@ -5,6 +5,10 @@ import { catchError } from 'rxjs/operators'; import { of } from 'rxjs'; import 'rxjs/add/operator/map'; + +/** Environment */ +import { environment } from 'environments/environment'; + /** Imported Service Files Are., */ import { AwsService } from '../../../AwsService/aws.service'; /** Consant Value For Created Date And Updated Date */ @@ -20,7 +24,7 @@ const currentdate = new Date().toJSON().slice(0, 19).replace('T', ' '); * Kdk */ export class EntityService { - private apiUrl = "http://ssa.sineedge.com/sparqapi/api/"; + private apiUrl = environment.apiEndpoint; private serviceUrl = 'https://jsonplaceholder.typicode.com/users'; constructor(private _http: HttpClient, From 74eb2f9237c414570bc05825d57b54b76ec8320e Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 12:41:21 +0530 Subject: [PATCH 07/13] pd button changes --- .../manage-pd/list-pd/add-pd/add-pd.component.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html index 43e2b6a27..46efa23f7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html @@ -207,12 +207,12 @@ - + - + +
- + From 80c7a6a9836b86fedb388d85c22339e81d986663 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 21 Dec 2018 12:55:03 +0530 Subject: [PATCH 08/13] UI changes --- .../manage-pd/list-pd/start-pd/start-pd.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html index 3c40f3481..7f6e2a2a5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html @@ -16,13 +16,13 @@
- - + +
{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }}
- Q{{formButton.pd_form_order}} + {{quesIndex+1}}
From de42101d1353d082fc5b65f8ae80b72d835b041d Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Fri, 21 Dec 2018 13:39:21 +0530 Subject: [PATCH 09/13] client , supplier , other family details forms changes : kdk --- .../client-info/client-info.component.html | 8 +- .../client-info/client-info.component.ts | 3 + .../family-details.component.html | 430 +++++++++++------- .../family-details.component.ts | 352 +++++++++++++- .../supplier-info.component.html | 7 +- .../supplier-info/supplier-info.component.ts | 4 +- 6 files changed, 633 insertions(+), 171 deletions(-) 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 f1a738b42..aea09fcdc 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 @@ -200,4 +200,10 @@
-
\ No newline at end of file +
+ +
+
{{ errorMessage }}
+
+ \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 67ec1a524..1da10a7a3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -101,6 +101,7 @@ export class ClientInfoComponent implements OnInit { }; noRecordsFound: Boolean = false; + errorMessage: any = ''; ngOnInit() { this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { @@ -135,10 +136,12 @@ export class ClientInfoComponent implements OnInit { }else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = data.msg; } }, err => { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = 'No Records Found , Something went Wrong!'; }) // this.getM_FreqOfPurchase(); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index f632b397b..56803b3fd 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -269,181 +269,277 @@ + - - \ No newline at end of file + +--> diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 93585e27d..5f32b8ba6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -254,4 +254,354 @@ export class FamilyDetailsComponent implements OnInit { // } // } -} \ No newline at end of file +} + + + + + + + +// =================== other family details multiple add + +// import { +// Component, +// OnInit, +// Inject, +// Input, Output +// } from '@angular/core'; + +// import { +// FormBuilder, +// FormGroup, +// Validators, +// FormArray, FormControl, AbstractControl, +// } from '@angular/forms'; + +// import { NotifierService } from 'angular-notifier'; + +// import { +// MatDialog, +// MatDialogRef, +// MAT_DIALOG_DATA +// } from '@angular/material'; +// /** Service */ +// import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +// import {ActivatedRoute, Router} from "@angular/router"; + +// @Component({ +// selector: 'app-family-details', +// templateUrl: './family-details.component.html', +// styleUrls: ['./family-details.component.scss'] +// }) +// export class FamilyDetailsComponent implements OnInit { +// //@Input() pdid: number; +// pageTitle: string ="Other Family Details"; +// pdid : string; +// form_id : number; + +// private notifier: NotifierService; +// public familyForm: FormGroup; +// public selectPerson; +// // selectPerson = [{ +// // name : 'person 1', +// // id : 111 +// // }, { +// // name : 'person 2', +// // id : 222 +// // }]; + +// earningStatus = [{ +// type: 'Earning', +// id: 1 +// }, { +// type: 'Non Earning', +// id: 2 +// }] + +// relationData: any = []; +// occupationData: any = []; +// //personMetData: any = []; +// ownerShipData: any = []; +// customerSegData: any = []; +// // earnMemberArrCount :any ; +// // nonEarnMemberArrCount :any ; +// count : number; +// constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, +// private router: Router, +// private _pd: PdTrigerService, +// @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { +// console.log(pd_all_details); +// this.selectPerson = this.pd_all_details.pdapplicants_detials; +// this.pdid = this.pd_all_details.pdmaster_details.pd_id; +// this.form_id = 6; +// this.notifier = notifier; +// } +// ngOnInit() { +// this.getMasterDetails('RELATIONSHIPS',1); +// this.getMasterDetails('OCCUPATIONMEMBERS',2); +// //this.getMasterDetails('PERSONSMET',3); +// this.getMasterDetails('RESIDENCEOWNERSHIP',4); +// this.getMasterDetails('CUSTOMERSEGMENT',5); +// this.initFamilyFormDetails(); +// let params: any = {}; +// params.pd_id = this.pdid; +// params.pd_form_id = '6'; +// this._pd.retriveForm(params).subscribe(data => { +// const control = this.familyForm.controls['nonEarningMembers']; +// const value = this.familyForm.controls['earningMembers']; +// if (data.status == 200) { +// this.initFamilyForm(data.records); +// // this.familyForm.controls.selected_person.setValue(data.records.selected_person); +// // this.familyForm.controls.residence_place.setValue(data.records.residence_place); +// // this.familyForm.controls.residence_city.setValue(data.records.residence_city); +// // this.familyForm.controls.residence_state.setValue(data.records.residence_state); +// // this.familyForm.controls.residence_pin.setValue(data.records.residence_pin); +// // this.familyForm.controls.residence_No_of_years.setValue(data.records.residence_No_of_years); +// // this.familyForm.controls.residence_ownership.setValue(data.records.residence_ownership); +// // this.familyForm.controls.ownershipOther.setValue(data.records.ownershipOther); +// // this.familyForm.controls.rent.setValue(data.records.rent); +// // this.familyForm.controls.total_number_of_family_members.setValue(data.records.total_number_of_family_members); +// // this.familyForm.controls.family_details_form_remark.setValue(data.records.family_details_form_remark); +// // this.generateFamilyMembersDetailsGetData(data.records.family_members_details); +// } else { +// // value.push(this.createMembers()); +// // control.push(this.createNonMembers()); +// } +// }); +// } + +// initgenerateFamilyMembersDetailsGet(val): FormGroup { +// return this.fb.group({ +// family_member_name : [val.family_member_name, Validators.compose([])], +// family_member_relationship : [val.family_member_relationship, Validators.compose([])], +// family_member_age : [val.family_member_age, Validators.compose([])], +// family_member_earning_status : [val.family_member_earning_status, Validators.compose([])], +// earning_segment: [val.earning_segment, Validators.compose([])], +// earning_gross_income_per_month: [val.earning_gross_income_per_month, Validators.compose([])], +// earning_name_of_the_employer_or_business: [val.earning_name_of_the_employer_or_business, Validators.compose([])], +// earning_number_of_years_in_employment_or_business: [val.earning_number_of_years_in_employment_or_business, Validators.compose([])], +// non_earning_occupation: [val.non_earning_occupation, Validators.compose([])], +// non_earning_if_others: [val.non_earning_if_others, Validators.compose([])], +// non_earning_if_retired_from: [val.non_earning_if_retired_from, Validators.compose([])], +// }) +// } + +// generateFamilyMembersDetailsGetData(data) { +// var result = Object.keys(data).map(function (key) { +// return data[key]; +// }); +// if (result.length > 0) { +// for (let val of result) { +// const control = this.familyForm.controls['family_members_details']; +// control.push(this.initgenerateFamilyMembersDetailsGet(val)); +// } +// } +// } + +// onSearchChange(e):void { +// e.preventDefault(); +// } +// public initFamilyFormDetails(): void { +// this.familyForm = this.fb.group({ +// family_details: this.fb.array([]), +// family_details_form_remark: [''] +// }) +// } + +// public noRecordsFound: Boolean = false; + +// public initFamilyForm(records): void { +// // let data = [...records]; +// let recordss = { +// "selected_person":"95", +// "residence_place":"check ", +// "residence_city":"check ", +// "residence_state":"check ", +// "residence_pin":"123456", +// "residence_No_of_years":"2", +// "residence_ownership":"1", +// "ownershipOther":"", +// "rent":"", +// "total_number_of_family_members":"2", +// "family_members_details":{ +// "1":{ +// "family_member_name":"name", +// "family_member_relationship":"1", +// "family_member_age":"21", +// "family_member_earning_status":"1", +// "earning_segment":"1", +// "earning_gross_income_per_month":"12000", +// "earning_name_of_the_employer_or_business":"check", +// "earning_number_of_years_in_employment_or_business":"2", +// "non_earning_occupation":"", +// "non_earning_if_others":"", +// "non_earning_if_retired_from":"" +// }, +// "2":{ +// "family_member_name":"chekc ", +// "family_member_relationship":"2", +// "family_member_age":"31", +// "family_member_earning_status":"2", +// "earning_segment":"", +// "earning_gross_income_per_month":"", +// "earning_name_of_the_employer_or_business":"", +// "earning_number_of_years_in_employment_or_business":"", +// "non_earning_occupation":"9", +// "non_earning_if_others":"others check ", +// "non_earning_if_retired_from":"" +// } +// }, +// "family_details_form_remark":"check remark" +// }; +// if(recordss === null) { +// this.fb.group({ +// selected_person: ['', Validators.compose([Validators.required])], +// residence_place: ['', Validators.compose([])], +// residence_city: ['', Validators.compose([])], +// residence_state: ['', Validators.compose([])], +// residence_pin: ['', Validators.compose([])], +// residence_No_of_years: ['', Validators.compose([])], +// residence_ownership: ['', Validators.compose([])], +// ownershipOther: [''], +// rent: [''], +// total_number_of_family_members: ['', Validators.compose([Validators.min(1), Validators.max(20)])], +// family_members_details: this.fb.array([this.addFamilyMemberDetails()]), +// }); +// } else { +// let formData: FormGroup = this.fb.group({ +// selected_person: ['1', Validators.compose([Validators.required])], +// residence_place: ['as', Validators.compose([])], +// residence_city: ['as', Validators.compose([])], +// residence_state: ['sa', Validators.compose([])], +// residence_pin: ['sa', Validators.compose([])], +// residence_No_of_years: ['sa', Validators.compose([])], +// residence_ownership: ['s', Validators.compose([])], +// ownershipOther: ['s'], +// rent: ['as'], +// total_number_of_family_members: ['1', Validators.compose([Validators.min(1), Validators.max(20)])], +// family_members_details: this.fb.array([]), +// }); + +// const control = this.familyForm.controls['family_details']; +// control.push(formData); +// console.log(this.familyForm.value); +// } +// this.noRecordsFound = true; +// } + +// addFamilyMemberDetails(): void { + +// } + +// addMoreApplicantFamilyDetails(e): void { +// e.stopPropagation(); +// this.initFamilyForm('chck'); +// } + +// getNumberOfFamilyMemberDetails(inx){ +// // alert(inx); +// let formData = this.familyForm.controls['family_details']['controls'][inx].controls; +// // alert(formData['total_number_of_family_members'].value); +// // alert(this.familyForm.controls.total_number_of_family_members.valid); +// if(formData['total_number_of_family_members'].valid){ +// let totalMem = formData['total_number_of_family_members'].value; +// const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; +// if(totalMem > control.length) { +// let len = totalMem - control.length; +// for(let i = 0; i < len; i++){ +// control.push(this.generateFamilyMembersDetailsGet()); +// } +// } else if (totalMem < control.length) { +// // control.controls.slice(0, totalMem); +// control.controls = []; +// for(let i = 0; i < totalMem; i++){ +// control.push(this.generateFamilyMembersDetailsGet()); +// } +// } +// } else { + +// } +// } + +// generateFamilyMembersDetailsGet(): FormGroup { +// return this.fb.group({ +// family_member_name : ['', Validators.compose([])], +// family_member_relationship : ['', Validators.compose([])], +// family_member_age : ['', Validators.compose([])], +// family_member_earning_status : ['', Validators.compose([])], +// earning_segment: ['', Validators.compose([])], +// earning_gross_income_per_month: ['', Validators.compose([])], +// earning_name_of_the_employer_or_business: ['', Validators.compose([])], +// earning_number_of_years_in_employment_or_business: ['', Validators.compose([])], +// non_earning_occupation: ['', Validators.compose([])], +// non_earning_if_others: ['', Validators.compose([])], +// non_earning_if_retired_from: ['', Validators.compose([])], +// }) +// } + +// // get all master details +// getMasterDetails(table:string,type:number){ +// this._pd.getAllMasterDatas(table).subscribe( +// data => { +// if (data.status == 200) { +// if(type==1){ +// this.relationData=data.records.filter(item => item.isactive == 1); +// } +// else if(type==2){ +// this.occupationData=data.records.filter(item => item.isactive == 1); +// } +// // else if(type==3){ +// // this.personMetData=data.records.filter(item => item.isactive == 1); +// // } +// else if(type==4){ +// this.ownerShipData=data.records.filter(item => item.isactive == 1); +// } +// else if(type==5){ +// this.customerSegData=data.records.filter(item => item.isactive == 1); +// } + +// } +// }); +// } + +// submitFamily() { +// if (!this.familyForm.valid) { +// return; +// } +// var records = this.familyForm.value; +// //To Remove The "Null" With Key also +// Object.keys(records).forEach((key) => (records[key] == null) && delete records[key]); +// // records.other_family_details = answerFormValues; +// records.pdid = this.pdid; +// records.formid = '6'; +// // records.fk_createdby = '251'; +// console.log(JSON.stringify(records)); +// this._pd.saveForm(records).subscribe(data => { +// this.notifier.notify('success', 'Saved Successfully.'); +// }, error => { +// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +// }); +// } +// // validateAllFormFields(formGroup: FormGroup) { +// // Object.keys(formGroup.controls).forEach(field => { +// // const control = formGroup.get(field); +// // if (control instanceof FormControl) { +// // control.markAsTouched({onlySelf: true}); +// // } else if (control instanceof FormGroup) { +// // this.validateAllFormFields(control); +// // } +// // }); +// // } + +// // /** On Key Press Event For Age */ +// // keyPress(event: any) { +// // const pattern = /[0-9]/; + +// // let inputChar = String.fromCharCode(event.charCode); +// // if (event.keyCode != 8 && !pattern.test(inputChar)) { +// // event.preventDefault(); +// // } +// // } + +// } \ No newline at end of file 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 bea4ae748..b43043049 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 @@ -131,4 +131,9 @@
-
\ No newline at end of file +
+
+
{{ errorMessage }}
+
+ \ No newline at end of file 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 0e9ab8f5b..9dad4a868 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 @@ -74,8 +74,8 @@ export class SupplierInfoComponent implements OnInit { }; noRecordsFound: Boolean = false; + errorMessage: any = ''; ngOnInit() { - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { if(data.dataStatus){ // let datas = { @@ -100,10 +100,12 @@ export class SupplierInfoComponent implements OnInit { }else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = data.msg; } }, err => { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = 'No Records Found , Something went Wrong!'; }) // this.getM_FreqOfPurchase(); From deb9a48b865f4b03c1c15cd729e8aea6ee77c170 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 15:04:25 +0530 Subject: [PATCH 10/13] general form changes --- .../forms/general-info/general-info.component.html | 13 ++++++++++++- .../forms/general-info/general-info.component.ts | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index 495143ec5..e9660370b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -35,8 +35,9 @@ {{relation.controls.applicant_name.value | titlecase}} + - + @@ -66,7 +67,17 @@ +
+ + +
+ +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts index 6dd11f334..7f18d0981 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.ts @@ -127,7 +127,7 @@ export class GeneralInfoComponent implements OnInit { return this._fb.group({ pd_co_applicant_id: [elementValue.pd_co_applicant_id], applicant_name: [elementValue.applicant_name], - company_name: [elementValue.company_name], + company_name: [elementValue.company_name,], exist_status:[elementValue.exist_status==1 && elementValue.pd_co_applicant_id > 0 ? true : false] }); } @@ -192,6 +192,18 @@ export class GeneralInfoComponent implements OnInit { } } + // remove other details + removeOthers(index, item: any){ + console.log(item) + if(item.pd_co_applicant_id==0){ + let relationControl = this._generalForm.controls['applicant_relation']; + relationControl.removeAt(index); + // remove related to details + let pos_name=this.fetch_related_details.indexOf(item.applicant_name); + this.fetch_related_details.splice(pos_name, 1); + } + } + // submit form details submitGeneralForm(formData:any) { if (this._generalForm.invalid) { From 86902dfc639b0660dd703a50b5f69df965bbb4c0 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 15:05:11 +0530 Subject: [PATCH 11/13] merge : kms --- .../client-info/client-info.component.html | 8 +- .../client-info/client-info.component.ts | 3 + .../family-details.component.html | 430 +++++++++++------- .../family-details.component.ts | 352 +++++++++++++- .../supplier-info.component.html | 7 +- .../supplier-info/supplier-info.component.ts | 4 +- .../list-pd/start-pd/start-pd.component.html | 6 +- 7 files changed, 636 insertions(+), 174 deletions(-) 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 f1a738b42..aea09fcdc 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 @@ -200,4 +200,10 @@ - \ No newline at end of file + + +
+
{{ errorMessage }}
+
+ \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 67ec1a524..1da10a7a3 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -101,6 +101,7 @@ export class ClientInfoComponent implements OnInit { }; noRecordsFound: Boolean = false; + errorMessage: any = ''; ngOnInit() { this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { @@ -135,10 +136,12 @@ export class ClientInfoComponent implements OnInit { }else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = data.msg; } }, err => { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = 'No Records Found , Something went Wrong!'; }) // this.getM_FreqOfPurchase(); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index f632b397b..56803b3fd 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -269,181 +269,277 @@ + - - \ No newline at end of file + +--> diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index 93585e27d..5f32b8ba6 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -254,4 +254,354 @@ export class FamilyDetailsComponent implements OnInit { // } // } -} \ No newline at end of file +} + + + + + + + +// =================== other family details multiple add + +// import { +// Component, +// OnInit, +// Inject, +// Input, Output +// } from '@angular/core'; + +// import { +// FormBuilder, +// FormGroup, +// Validators, +// FormArray, FormControl, AbstractControl, +// } from '@angular/forms'; + +// import { NotifierService } from 'angular-notifier'; + +// import { +// MatDialog, +// MatDialogRef, +// MAT_DIALOG_DATA +// } from '@angular/material'; +// /** Service */ +// import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +// import {ActivatedRoute, Router} from "@angular/router"; + +// @Component({ +// selector: 'app-family-details', +// templateUrl: './family-details.component.html', +// styleUrls: ['./family-details.component.scss'] +// }) +// export class FamilyDetailsComponent implements OnInit { +// //@Input() pdid: number; +// pageTitle: string ="Other Family Details"; +// pdid : string; +// form_id : number; + +// private notifier: NotifierService; +// public familyForm: FormGroup; +// public selectPerson; +// // selectPerson = [{ +// // name : 'person 1', +// // id : 111 +// // }, { +// // name : 'person 2', +// // id : 222 +// // }]; + +// earningStatus = [{ +// type: 'Earning', +// id: 1 +// }, { +// type: 'Non Earning', +// id: 2 +// }] + +// relationData: any = []; +// occupationData: any = []; +// //personMetData: any = []; +// ownerShipData: any = []; +// customerSegData: any = []; +// // earnMemberArrCount :any ; +// // nonEarnMemberArrCount :any ; +// count : number; +// constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, +// private router: Router, +// private _pd: PdTrigerService, +// @Inject(MAT_DIALOG_DATA) public pd_all_details: any) { +// console.log(pd_all_details); +// this.selectPerson = this.pd_all_details.pdapplicants_detials; +// this.pdid = this.pd_all_details.pdmaster_details.pd_id; +// this.form_id = 6; +// this.notifier = notifier; +// } +// ngOnInit() { +// this.getMasterDetails('RELATIONSHIPS',1); +// this.getMasterDetails('OCCUPATIONMEMBERS',2); +// //this.getMasterDetails('PERSONSMET',3); +// this.getMasterDetails('RESIDENCEOWNERSHIP',4); +// this.getMasterDetails('CUSTOMERSEGMENT',5); +// this.initFamilyFormDetails(); +// let params: any = {}; +// params.pd_id = this.pdid; +// params.pd_form_id = '6'; +// this._pd.retriveForm(params).subscribe(data => { +// const control = this.familyForm.controls['nonEarningMembers']; +// const value = this.familyForm.controls['earningMembers']; +// if (data.status == 200) { +// this.initFamilyForm(data.records); +// // this.familyForm.controls.selected_person.setValue(data.records.selected_person); +// // this.familyForm.controls.residence_place.setValue(data.records.residence_place); +// // this.familyForm.controls.residence_city.setValue(data.records.residence_city); +// // this.familyForm.controls.residence_state.setValue(data.records.residence_state); +// // this.familyForm.controls.residence_pin.setValue(data.records.residence_pin); +// // this.familyForm.controls.residence_No_of_years.setValue(data.records.residence_No_of_years); +// // this.familyForm.controls.residence_ownership.setValue(data.records.residence_ownership); +// // this.familyForm.controls.ownershipOther.setValue(data.records.ownershipOther); +// // this.familyForm.controls.rent.setValue(data.records.rent); +// // this.familyForm.controls.total_number_of_family_members.setValue(data.records.total_number_of_family_members); +// // this.familyForm.controls.family_details_form_remark.setValue(data.records.family_details_form_remark); +// // this.generateFamilyMembersDetailsGetData(data.records.family_members_details); +// } else { +// // value.push(this.createMembers()); +// // control.push(this.createNonMembers()); +// } +// }); +// } + +// initgenerateFamilyMembersDetailsGet(val): FormGroup { +// return this.fb.group({ +// family_member_name : [val.family_member_name, Validators.compose([])], +// family_member_relationship : [val.family_member_relationship, Validators.compose([])], +// family_member_age : [val.family_member_age, Validators.compose([])], +// family_member_earning_status : [val.family_member_earning_status, Validators.compose([])], +// earning_segment: [val.earning_segment, Validators.compose([])], +// earning_gross_income_per_month: [val.earning_gross_income_per_month, Validators.compose([])], +// earning_name_of_the_employer_or_business: [val.earning_name_of_the_employer_or_business, Validators.compose([])], +// earning_number_of_years_in_employment_or_business: [val.earning_number_of_years_in_employment_or_business, Validators.compose([])], +// non_earning_occupation: [val.non_earning_occupation, Validators.compose([])], +// non_earning_if_others: [val.non_earning_if_others, Validators.compose([])], +// non_earning_if_retired_from: [val.non_earning_if_retired_from, Validators.compose([])], +// }) +// } + +// generateFamilyMembersDetailsGetData(data) { +// var result = Object.keys(data).map(function (key) { +// return data[key]; +// }); +// if (result.length > 0) { +// for (let val of result) { +// const control = this.familyForm.controls['family_members_details']; +// control.push(this.initgenerateFamilyMembersDetailsGet(val)); +// } +// } +// } + +// onSearchChange(e):void { +// e.preventDefault(); +// } +// public initFamilyFormDetails(): void { +// this.familyForm = this.fb.group({ +// family_details: this.fb.array([]), +// family_details_form_remark: [''] +// }) +// } + +// public noRecordsFound: Boolean = false; + +// public initFamilyForm(records): void { +// // let data = [...records]; +// let recordss = { +// "selected_person":"95", +// "residence_place":"check ", +// "residence_city":"check ", +// "residence_state":"check ", +// "residence_pin":"123456", +// "residence_No_of_years":"2", +// "residence_ownership":"1", +// "ownershipOther":"", +// "rent":"", +// "total_number_of_family_members":"2", +// "family_members_details":{ +// "1":{ +// "family_member_name":"name", +// "family_member_relationship":"1", +// "family_member_age":"21", +// "family_member_earning_status":"1", +// "earning_segment":"1", +// "earning_gross_income_per_month":"12000", +// "earning_name_of_the_employer_or_business":"check", +// "earning_number_of_years_in_employment_or_business":"2", +// "non_earning_occupation":"", +// "non_earning_if_others":"", +// "non_earning_if_retired_from":"" +// }, +// "2":{ +// "family_member_name":"chekc ", +// "family_member_relationship":"2", +// "family_member_age":"31", +// "family_member_earning_status":"2", +// "earning_segment":"", +// "earning_gross_income_per_month":"", +// "earning_name_of_the_employer_or_business":"", +// "earning_number_of_years_in_employment_or_business":"", +// "non_earning_occupation":"9", +// "non_earning_if_others":"others check ", +// "non_earning_if_retired_from":"" +// } +// }, +// "family_details_form_remark":"check remark" +// }; +// if(recordss === null) { +// this.fb.group({ +// selected_person: ['', Validators.compose([Validators.required])], +// residence_place: ['', Validators.compose([])], +// residence_city: ['', Validators.compose([])], +// residence_state: ['', Validators.compose([])], +// residence_pin: ['', Validators.compose([])], +// residence_No_of_years: ['', Validators.compose([])], +// residence_ownership: ['', Validators.compose([])], +// ownershipOther: [''], +// rent: [''], +// total_number_of_family_members: ['', Validators.compose([Validators.min(1), Validators.max(20)])], +// family_members_details: this.fb.array([this.addFamilyMemberDetails()]), +// }); +// } else { +// let formData: FormGroup = this.fb.group({ +// selected_person: ['1', Validators.compose([Validators.required])], +// residence_place: ['as', Validators.compose([])], +// residence_city: ['as', Validators.compose([])], +// residence_state: ['sa', Validators.compose([])], +// residence_pin: ['sa', Validators.compose([])], +// residence_No_of_years: ['sa', Validators.compose([])], +// residence_ownership: ['s', Validators.compose([])], +// ownershipOther: ['s'], +// rent: ['as'], +// total_number_of_family_members: ['1', Validators.compose([Validators.min(1), Validators.max(20)])], +// family_members_details: this.fb.array([]), +// }); + +// const control = this.familyForm.controls['family_details']; +// control.push(formData); +// console.log(this.familyForm.value); +// } +// this.noRecordsFound = true; +// } + +// addFamilyMemberDetails(): void { + +// } + +// addMoreApplicantFamilyDetails(e): void { +// e.stopPropagation(); +// this.initFamilyForm('chck'); +// } + +// getNumberOfFamilyMemberDetails(inx){ +// // alert(inx); +// let formData = this.familyForm.controls['family_details']['controls'][inx].controls; +// // alert(formData['total_number_of_family_members'].value); +// // alert(this.familyForm.controls.total_number_of_family_members.valid); +// if(formData['total_number_of_family_members'].valid){ +// let totalMem = formData['total_number_of_family_members'].value; +// const control = this.familyForm.controls['family_details']['controls'][inx].controls.family_members_details; +// if(totalMem > control.length) { +// let len = totalMem - control.length; +// for(let i = 0; i < len; i++){ +// control.push(this.generateFamilyMembersDetailsGet()); +// } +// } else if (totalMem < control.length) { +// // control.controls.slice(0, totalMem); +// control.controls = []; +// for(let i = 0; i < totalMem; i++){ +// control.push(this.generateFamilyMembersDetailsGet()); +// } +// } +// } else { + +// } +// } + +// generateFamilyMembersDetailsGet(): FormGroup { +// return this.fb.group({ +// family_member_name : ['', Validators.compose([])], +// family_member_relationship : ['', Validators.compose([])], +// family_member_age : ['', Validators.compose([])], +// family_member_earning_status : ['', Validators.compose([])], +// earning_segment: ['', Validators.compose([])], +// earning_gross_income_per_month: ['', Validators.compose([])], +// earning_name_of_the_employer_or_business: ['', Validators.compose([])], +// earning_number_of_years_in_employment_or_business: ['', Validators.compose([])], +// non_earning_occupation: ['', Validators.compose([])], +// non_earning_if_others: ['', Validators.compose([])], +// non_earning_if_retired_from: ['', Validators.compose([])], +// }) +// } + +// // get all master details +// getMasterDetails(table:string,type:number){ +// this._pd.getAllMasterDatas(table).subscribe( +// data => { +// if (data.status == 200) { +// if(type==1){ +// this.relationData=data.records.filter(item => item.isactive == 1); +// } +// else if(type==2){ +// this.occupationData=data.records.filter(item => item.isactive == 1); +// } +// // else if(type==3){ +// // this.personMetData=data.records.filter(item => item.isactive == 1); +// // } +// else if(type==4){ +// this.ownerShipData=data.records.filter(item => item.isactive == 1); +// } +// else if(type==5){ +// this.customerSegData=data.records.filter(item => item.isactive == 1); +// } + +// } +// }); +// } + +// submitFamily() { +// if (!this.familyForm.valid) { +// return; +// } +// var records = this.familyForm.value; +// //To Remove The "Null" With Key also +// Object.keys(records).forEach((key) => (records[key] == null) && delete records[key]); +// // records.other_family_details = answerFormValues; +// records.pdid = this.pdid; +// records.formid = '6'; +// // records.fk_createdby = '251'; +// console.log(JSON.stringify(records)); +// this._pd.saveForm(records).subscribe(data => { +// this.notifier.notify('success', 'Saved Successfully.'); +// }, error => { +// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); +// }); +// } +// // validateAllFormFields(formGroup: FormGroup) { +// // Object.keys(formGroup.controls).forEach(field => { +// // const control = formGroup.get(field); +// // if (control instanceof FormControl) { +// // control.markAsTouched({onlySelf: true}); +// // } else if (control instanceof FormGroup) { +// // this.validateAllFormFields(control); +// // } +// // }); +// // } + +// // /** On Key Press Event For Age */ +// // keyPress(event: any) { +// // const pattern = /[0-9]/; + +// // let inputChar = String.fromCharCode(event.charCode); +// // if (event.keyCode != 8 && !pattern.test(inputChar)) { +// // event.preventDefault(); +// // } +// // } + +// } \ No newline at end of file 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 bea4ae748..b43043049 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 @@ -131,4 +131,9 @@ - \ No newline at end of file + +
+
{{ errorMessage }}
+
+ \ No newline at end of file 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 0e9ab8f5b..9dad4a868 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 @@ -74,8 +74,8 @@ export class SupplierInfoComponent implements OnInit { }; noRecordsFound: Boolean = false; + errorMessage: any = ''; ngOnInit() { - this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => { if(data.dataStatus){ // let datas = { @@ -100,10 +100,12 @@ export class SupplierInfoComponent implements OnInit { }else { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = data.msg; } }, err => { this.notifier.notify('warning', 'No Category Records Found.!'); this.noRecordsFound = false; + this.errorMessage = 'No Records Found , Something went Wrong!'; }) // this.getM_FreqOfPurchase(); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html index 3c40f3481..7f6e2a2a5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html @@ -16,13 +16,13 @@
- - + +
{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }}
- Q{{formButton.pd_form_order}} + {{quesIndex+1}}
From c82f0388905349f2061eaf24d53f65fa63f7df77 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 15:26:28 +0530 Subject: [PATCH 12/13] change general form --- .../start-pd/forms/general-info/general-info.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html index e9660370b..25f21ceb7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/general-info/general-info.component.html @@ -37,7 +37,7 @@ - + From e945a07cbf0d2c99e43afcb965007c5dde7684fe Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 21 Dec 2018 15:54:09 +0530 Subject: [PATCH 13/13] start pd border colr change --- .../manage-pd/list-pd/start-pd/start-pd.component.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.scss index 38778876d..ce04f2137 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.scss @@ -60,7 +60,7 @@ mat-card .child_mat_card > mat-card { transition: box-shadow 0.5s, transform 0.5s; &:hover { cursor: pointer; - background-color: #e00201 !important; + // background-color: #e00201 !important; transform: scale(1); box-shadow: 5px 20px 30px rgba(0, 0, 0, 0.2); }