entity , template list bug changes : kdk

This commit is contained in:
dineshkumarkannan 2018-10-31 18:04:20 +05:30
parent b1e47083ea
commit 7eac051109
14 changed files with 226 additions and 35 deletions

View File

@ -14,7 +14,7 @@
Pan: {{data.pan}}, Gst: {{data.gstno}}
</div>
<div>
Contact Person Info, Contact Person Info, Contact Person Info
<div *ngFor="let conts of data.contacts; let last = last">{{conts.contact_person}} - {{conts.contact_email}} - {{conts.contact_mobile_no}} <span *ngIf="!last">,</span></div>
</div>
</div>
<div fxFlex="20%">

View File

@ -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) {

View File

@ -46,7 +46,7 @@
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1" color="primary" matTooltip="Add More Region Information" matTooltipPosition="above" (click)="addRegionFormData(null, $event); false"><mat-icon>add</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="reset();false"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</form>

View File

@ -1 +1,59 @@
<h1>Tat info</h1>
<mat-card>
<form [formGroup]="tatForm" (submit)="onSubmit()">
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
<div fxFlex="23.5%">
<mat-form-field>
<mat-select (selectionChange)="selectedPD($event)" placeholder="PD Type" formControlName="toppings1" multiple>
<mat-option *ngFor="let pd of m_pdType" [value]="pd.id">{{pd.name}}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.toppings1.hasError('required')" class="mat-text-warn">PD Type Required.!</mat-error>
</mat-form-field>
<mat-chip-list fxLayout="row wrap" fxLayout.xs="column">
<mat-chip *ngFor="let pdName of selectedItem" >{{pdName.name}}</mat-chip>
</mat-chip-list>
</div>
<div fxFlex="23.5%">
<mat-form-field>
<mat-select (selectionChange)="selectedProduct($event)" placeholder="Product" formControlName="toppings2" multiple>
<mat-option *ngFor="let prdct of m_product" [value]="prdct.id">{{prdct.name}}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.toppings2.hasError('required')" class="mat-text-warn">Product Required.!</mat-error>
</mat-form-field>
<mat-chip-list fxLayout="row wrap" fxLayout.xs="column">
<mat-chip *ngFor="let prdcName of selectedProductItem" >{{prdcName.name}}</mat-chip>
</mat-chip-list>
</div>
<div fxFlex="23.5%">
<mat-form-field>
<mat-select (selectionChange)="selectedCity($event)" placeholder="City" formControlName="toppings3" multiple>
<mat-option *ngFor="let city of m_city" [value]="city.id">{{city.name}}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.toppings3.hasError('required')" class="mat-text-warn">City Required.!</mat-error>
</mat-form-field>
<mat-chip-list fxLayout="row wrap" fxLayout.xs="column">
<mat-chip *ngFor="let cityName of selectedCityItem" >{{cityName.name}}</mat-chip>
</mat-chip-list>
</div>
<div fxFlex="23.5%">
<mat-form-field>
<input placeholder="TAT Value 1" matInput formControlName="toppings4">
</mat-form-field>
<mat-error *ngIf="submitted && f.toppings4.hasError('required')" class="mat-text-warn">TAT 1 Value Required.!</mat-error>
<mat-form-field>
<input placeholder="TAT Value 2" matInput formControlName="toppings5">
</mat-form-field>
<!--<mat-error *ngIf="submitted && ques['controls'].question_weightage.hasError('required')" class="mat-text-warn">Ques. WT is Required.!</mat-error>-->
</div>
</div>
<div fxLayout="row" fxLayoutAlign="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</form>
<!--<div *ngIf="valArray.length > 0">
<h5><b>Note : </b> This following Combincation already exist for this Entity with different Tat Values.</h5>
<ul>
<li *ngFor="let val of valArray">{{ val }}</li>
</ul>
</div>-->
</mat-card>

View File

@ -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);

View File

@ -7,7 +7,7 @@
<!--
{{ selectedCityName | json }}-->
<mat-chip-list>
<mat-chip-list *ngIf="selectedCityName">
<mat-chip *ngFor="let cit of selectedCityName" >{{cit.name}}</mat-chip>
</mat-chip-list>

View File

@ -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(

View File

@ -233,7 +233,13 @@
<app-entity-edit-vendor-city-info [entityId]="entity_id">
</app-entity-edit-vendor-city-info>
</ng-template>
</mat-tab>
</mat-tab>
<!--<mat-tab label="TAT Information">
<ng-template matTabContent>
<app-entity-edit-tat [entityId]="entity_id">
</app-entity-edit-tat>
</ng-template>
</mat-tab>-->
<!--<mat-tab label="Category">
<ng-template matTabContent>
<app-template-edit-category [questionId]="question_id">

View File

@ -74,9 +74,9 @@ export class EntityListComponent implements OnInit {
if (data) {
if (data.records) {
this.enityList = data.records;
this.questionListData = data.records;
// this.questionListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.questionListData;
this.dataSource.data = this.enityList;
} else {
this.enityList = [];
this.dataLength = null;

View File

@ -39,9 +39,9 @@
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<mat-checkbox formControlName="isactive" [ngModel]="f.isactive.value === 1 ? true : false"
(ngModelChange)="f.get('isactive').value = $event ? 1 : 0">Active/InActive</mat-checkbox>
<!--<mat-checkbox formControlName="isactive" [ngModel]="f.isactive.value === 1 ? true : false"
(ngModelChange)="f.isactive.value = $event ? 1 : 0">Active/InActive</mat-checkbox>
-->
</div>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="answers" class="example-full-width">

View File

@ -45,11 +45,12 @@
<mat-row style="align-items: normal !important;" *matRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
<div *ngIf="productList.length > 0">
<mat-paginator #paginator class="mat-elevation-z1" [length]="productList.length" [pageIndex]="pageIndex" [pageSize]="pageSize"
[pageSizeOptions]="[5, 10, 25, 50, 100]" (page)="pageEvent = $event; pageChange($event)" showFirstLastButtons>
</mat-paginator>
</div>
<!---- <ng-container *ngIf="productList.length > 0">
<div style="padding: 0 12px;">

View File

@ -67,9 +67,9 @@ export class ListComponent implements OnInit {
if (data) {
if (data.records) {
this.productList = data.records;
this.questionListData = data.records;
// this.questionListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.questionListData;
this.dataSource.data = this.productList;
} else {
this.productList = [];
this.dataLength = null;

View File

@ -32,8 +32,8 @@
</ng-container>
<ng-container matColumnDef="lender_details">
<mat-cell fxFlex="65%" *matCellDef="let template;">
<div *ngIf="template.lender_details.length > 0">
<span *ngFor="let lender of template.lender_details ; let last = last"> {{lender.full_name}} - {{lender.product_name}} - {{lender.customer_segment_name}} <i *ngIf="!last">,<br></i></span>
<div *ngIf="template.lender_details.length > 0" class="text-line-limit">
<span *ngFor="let lender of template.lender_details ; let last = last" > {{lender.full_name}} - {{lender.product_name}} - {{lender.customer_segment_name}} <i *ngIf="!last">,<br></i></span>
</div>
</mat-cell>
</ng-container>

View File

@ -71,9 +71,9 @@ export class TemplateListComponent implements OnInit, OnDestroy {
if (data) {
if (data.records) {
this.templateList = data.records;
this.templateListData = data.records;
// this.templateListData = data.records;
this.dataLength = data.records.length;
this.dataSource.data = this.templateListData;
this.dataSource.data = this.templateList;
} else {
this.templateList = [];
this.dataLength = null;