diff --git a/src/app/pay-in/pay-in.component.html b/src/app/pay-in/pay-in.component.html index 319fe18..d79759e 100644 --- a/src/app/pay-in/pay-in.component.html +++ b/src/app/pay-in/pay-in.component.html @@ -52,6 +52,7 @@ ngModelOptions="{standalone: true}" [onLabel]="'Yes'" [offLabel]="'No'" + (valueChange)="setBalance()" > @@ -77,6 +78,7 @@ ngModelOptions="{standalone: true}" [onLabel]="'Yes'" [offLabel]="'No'" + (valueChange)="setOffsetBalance()" > @@ -88,16 +90,16 @@ - + -

-

+

-

- + - + diff --git a/src/app/pay-in/pay-in.component.ts b/src/app/pay-in/pay-in.component.ts index 833459a..3ba531a 100644 --- a/src/app/pay-in/pay-in.component.ts +++ b/src/app/pay-in/pay-in.component.ts @@ -32,7 +32,7 @@ export class PayInComponent implements OnInit { public gridData: PayInListResult = { data: [], total: 0}; public incomeFormGroup: FormGroup; - private editedRowIndex: number; + public editedRowIndex: number; public showBalance = true; public showOffsetBalance = true; @@ -43,7 +43,10 @@ export class PayInComponent implements OnInit { ngOnInit(): void { this.pis.getPayInList(new PayInListFilterModel()).subscribe( ( resp: PayInListResult) => { - this.gridData = resp; + this.gridData.total = resp.total; + resp.data.forEach(v => { + this.gridData.data.push(new PayInModel(v)); + }); } ); } @@ -139,4 +142,21 @@ export class PayInComponent implements OnInit { public gotoLoan(id: string): void { this.router.navigate(['/edit-loan', id]); } + + public setBalance(): void{ + if ( this.showBalance ){ + this.incomeFormGroup.get('Balance').setValue(0); + }else{ + this.incomeFormGroup.get('Balance').setValue(-1); + } + } + + public setOffsetBalance(): void{ + if ( this.showOffsetBalance ){ + this.incomeFormGroup.get('OffsetBalance').setValue(0); + }else{ + this.incomeFormGroup.get('OffsetBalance').setValue(-1); + } + } + }