| @@ -52,6 +52,7 @@ | |||
| ngModelOptions="{standalone: true}" | |||
| [onLabel]="'Yes'" | |||
| [offLabel]="'No'" | |||
| (valueChange)="setBalance()" | |||
| > | |||
| </kendo-switch> | |||
| @@ -77,6 +78,7 @@ | |||
| ngModelOptions="{standalone: true}" | |||
| [onLabel]="'Yes'" | |||
| [offLabel]="'No'" | |||
| (valueChange)="setOffsetBalance()" | |||
| > | |||
| </kendo-switch> | |||
| @@ -88,16 +90,16 @@ | |||
| </kendo-grid-column> | |||
| <kendo-grid-column field="UploadId" title="Uploads" width="100" format="{0:c}" editable="false"> | |||
| <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex" > | |||
| <ng-template kendoGridCellTemplate let-dataItem > | |||
| <button kendoButton *ngIf="dataItem.UploadId > 0" (click)="showUpload(dataItem.UploadId)" icon="attachment"> {{ dataItem.UploadId }} | |||
| </button> | |||
| <p *ngIf="dataItem.Uploads <=0" > - </p> | |||
| <p *ngIf="dataItem.UploadId <=0" > - </p> | |||
| </ng-template> | |||
| </kendo-grid-column> | |||
| <kendo-grid-column field="LoanId" title="Loan" width="80"> | |||
| <kendo-grid-column field="LoanId" title="Loan" width="80" editable="false"> | |||
| <ng-template kendoGridCellTemplate let-dataItem> | |||
| <button kendoButton [icon]="'page-properties'" (click)="gotoLoan(dataItem.LoanId)" > </button> | |||
| <button *ngIf="dataItem.LoanId != '' && dataItem.LoanId != undefined " kendoButton [icon]="'page-properties'" (click)="gotoLoan(dataItem.LoanId)" > </button> | |||
| </ng-template> | |||
| </kendo-grid-column> | |||
| @@ -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); | |||
| } | |||
| } | |||
| } | |||