From 7eac0511093859bd33659561ecf1d3a7275b3314 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Wed, 31 Oct 2018 18:04:20 +0530 Subject: [PATCH] entity , template list bug changes : kdk --- .../entity-edit-billing-info.component.html | 2 +- .../entity-edit-billing-info.component.ts | 2 +- .../entity-edit-region.component.html | 2 +- .../entity-edit-tat.component.html | 60 ++++++- .../entity-edit-tat.component.ts | 155 ++++++++++++++++-- ...ntity-edit-vendor-city-info.component.html | 2 +- .../entity-edit-vendor-city-info.component.ts | 3 +- .../entity-edit/entity.edit.component.html | 8 +- .../entity-list/entity.list.component.ts | 4 +- .../questions/edit/edit.component.html | 6 +- .../questions/list/list.component.html | 5 +- .../template/questions/list/list.component.ts | 4 +- .../templates.list.component.html | 4 +- .../templates.list.component.ts | 4 +- 14 files changed, 226 insertions(+), 35 deletions(-) diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.html index 1d27932de..28ffe3d7d 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.html @@ -14,7 +14,7 @@ Pan: {{data.pan}}, Gst: {{data.gstno}}
- Contact Person Info, Contact Person Info, Contact Person Info +
{{conts.contact_person}} - {{conts.contact_email}} - {{conts.contact_mobile_no}} ,
diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.ts index bfabea685..4f0e1423c 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.ts +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-billing-info/entity-edit-billing-info.component.ts @@ -213,7 +213,7 @@ export class DialogAddEditBillingInfo implements OnInit { //To Remove The "Null" With Key also Object.keys(billingInfoFormValues).forEach((key) => (billingInfoFormValues[key] == null) && delete billingInfoFormValues[key]); - alert(billingInfoFormValues); + // alert(billingInfoFormValues); this.entityService.updateEntityIdBillingInfoDetails(billingInfoFormValues).subscribe( dataresult => { if (dataresult.status == 200) { diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-region/entity-edit-region.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-region/entity-edit-region.component.html index d9dd8b47d..bcca26bbe 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-region/entity-edit-region.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-region/entity-edit-region.component.html @@ -46,7 +46,7 @@
- +
diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.html index 6222fc96d..d075294b9 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.html @@ -1 +1,59 @@ -

Tat info

\ No newline at end of file + +
+
+
+ + + {{pd.name}} + + PD Type Required.! + + + {{pdName.name}} + +
+
+ + + {{prdct.name}} + + Product Required.! + + + {{prdcName.name}} + +
+
+ + + {{city.name}} + + City Required.! + + + {{cityName.name}} + +
+
+ + + + TAT 1 Value Required.! + + + + +
+
+
+ + +
+
+ +
\ No newline at end of file diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.ts index ac780819d..f0e5f73dc 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.ts +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-tat/entity-edit-tat.component.ts @@ -20,16 +20,25 @@ export class EntityEditTatComponent implements OnInit { public noRocordsFound: boolean; public entityVendorCityRecord: any; public errorMessage; + submitted: Boolean; - @Input() public entityId: number; - public m_city: any = []; + tatForm: FormGroup; + + @Input() public entityId: number; public selectedArr: any = []; + public selectedProductArr: any = []; + public selectedCityArr: any = []; + // toppings1 = new FormControl(); + // toppings2 = new FormControl(); + // toppings3 = new FormControl(); + // toppings4 = new FormControl(); - toppings1 = new FormControl(); - - toppingList1: any[] = [{'id': 1,'name':'Extra cheese'}, {'id': 2, 'name':'Mushroom'}, { 'id': 3, 'name':'Onion'}]; + toppingList1: any[] = [{ 'id': 1, 'name': 'Extra cheese' }, { 'id': 2, 'name': 'Mushroom' }, { 'id': 3, 'name': 'Onion' }]; + m_pdType = [{ 'id': 1, 'name': 'PD Type 1' }, { 'id': 2, 'name': 'PD Type 2' }]; + m_product = [{ 'id': 1, 'name': 'Product 1' }, { 'id': 2, 'name': 'Product 2' }, { 'id': 3, 'name': 'Product 3' }]; + m_city = [{ 'id': 1, 'name': 'City 1' }, { 'id': 2, 'name': 'City 2' }, { 'id': 3, 'name': 'City 3' }]; /** * Notifier service */ @@ -39,24 +48,43 @@ export class EntityEditTatComponent implements OnInit { private entityService: EntityService, private mastersService: MastersService, private _formBuilder: FormBuilder) { - this.notifier = notifier; - } + this.notifier = notifier; + this.tatForm = this._formBuilder.group({ + toppings1: ['', Validators.compose([Validators.required])], + toppings2: ['', Validators.compose([Validators.required])], + toppings3: ['', Validators.compose([Validators.required])], + toppings4: ['', Validators.compose([Validators.required])], + toppings5: ['', Validators.compose([Validators.required])] + }) + } ngOnInit() { - this.getEntityIdCityDetails(); - this.getCityMasters(); - this.toppings1.setValue([3]); + } - selectedItem: any; + get f() { return this.tatForm.controls }; - selected(e){ + selectedItem: any; + + selectedPD(e) { this.selectedArr = [...e.value]; - this.selectedItem = this.m_city.filter(val => this.selectedArr.indexOf(val.city_id) > -1) + this.selectedItem = this.m_pdType.filter(val => this.selectedArr.indexOf(val.id) > -1) } - getEntityIdCityDetails(){ - this.entityService.getEntityIdCityInfoDetails(this.entityId).subscribe( + selectedProductItem: any; + selectedProduct(e) { + this.selectedProductArr = [...e.value]; + this.selectedProductItem = this.m_product.filter(val => this.selectedProductArr.indexOf(val.id) > -1) + } + + selectedCityItem: any; + selectedCity(e) { + this.selectedCityArr = [...e.value]; + this.selectedCityItem = this.m_city.filter(val => this.selectedCityArr.indexOf(val.id) > -1) + } + + getEntityIdCityDetails() { + this.entityService.getEntityIdCityInfoDetails(this.entityId).subscribe( data => { if (data) { if (data.records) { @@ -84,4 +112,101 @@ export class EntityEditTatComponent implements OnInit { ); } + resultApi = ['123', '211']; + + check() { + let arr1 = this.tatForm.controls['toppings1'].value; + let arr2 = this.tatForm.controls['toppings2'].value; + let arr3 = this.tatForm.controls['toppings3'].value; + alert(arr1); + let array1 = [...arr1]; + let array2 = [...arr2]; + let array3 = [...arr3]; + let result1 = array1.reduce((a1, v1, i1) => + a1.concat(array2.map(w => v1 + "" + w)), []).reduce((a2, v2, i3) => + a2.concat(array3.map(u => v2 + "" + u)), []); + + let exist = this.resultApi.filter(a => result1.indexOf(a) > -1); + alert(result1); + alert(exist); + } + +// { +// alert("a.id = "+a.id+" id ="+id); +// if(a.id == id) +// { +// return a +// } +// else{ +// return -1 +// }} + + getIdPdName(id) { + let pdF = this.m_pdType.filter(a => a.id == id); + return pdF[0].name; + } + + getIdProductName(id) { + let pdF = this.m_product.filter(a => a.id == id); + return pdF[0].name; + } + + getIdCityName(id) { + let pdF = this.m_city.filter(a => a.id == id); + return pdF[0].name; + } + + public existValArray:any = []; + + onSubmit() { + this.submitted = true; + if (this.tatForm.invalid) { + return + } else { + let arr1 = this.tatForm.controls['toppings1'].value; + let arr2 = this.tatForm.controls['toppings2'].value; + let arr3 = this.tatForm.controls['toppings3'].value + + let array1 = [...arr1]; + let array2 = [...arr2]; + let array3 = [...arr3]; + let result1 = array1.reduce((a1, v1, i1) => + a1.concat(array2.map(w => v1 + "" + w)), []).reduce((a2, v2, i3) => + a2.concat(array3.map(u => v2 + "" + u)), []); + + let exist = this.resultApi.filter(a => result1.indexOf(a) > -1); + if(exist){ + + alert(result1); + alert(exist); + + this.existValArray = []; + + exist.forEach(a=>{ + let pdName = this.getIdPdName(a[0]); + let productName = this.getIdProductName(a[1]); + let cityName = this.getIdCityName(a[2]); + this.existValArray.push(`${pdName}, ${productName}, ${cityName}`); + }); + + } else { + + } + } + + } + } + + + +// var array1=["A","B","C","D"]; +// var array2=["1","2","3"]; +// var array3=["#","$","@"]; +// var result1 = array1.reduce( (a1, v1, i1) => +// a1.concat(array2.map(w => v1+w)),[]).reduce((a2, v2, i3)=> +// a2.concat(array3.map(u=> v2+u)),[]) +// console.log(result1); +// var valueApi = ["B1$","C2#"]; +// var exist = result1.filter(a => valueApi.indexOf(a) > -1); +// console.log("exit :" + exist); diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.html index 8034c6fea..f8cc44638 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.html @@ -7,7 +7,7 @@ - + {{cit.name}} diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.ts b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.ts index 3027434d1..9da70da57 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.ts +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component.ts @@ -84,9 +84,10 @@ export class EntityEditVendorCityInfoComponent implements OnInit { selectedCityName:any; getNameofCityId(arg) { + let arrs = [...arg]; this.selectedCityName = this.m_city.filter(val => arrs.indexOf(val.city_id) > -1) - } +} getCityMasters() { this.mastersService.getAllMasterData('CITY').subscribe( diff --git a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html index 164d895e5..faebe9a2e 100644 --- a/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html +++ b/ng6-seed/src/app/settings/entity/entity-edit/entity.edit.component.html @@ -233,7 +233,13 @@ - + +
diff --git a/ng6-seed/src/app/template/questions/list/list.component.html b/ng6-seed/src/app/template/questions/list/list.component.html index 82654ad40..4665b1381 100644 --- a/ng6-seed/src/app/template/questions/list/list.component.html +++ b/ng6-seed/src/app/template/questions/list/list.component.html @@ -45,11 +45,12 @@ -
+ + -
+