| ngModelOptions="{standalone: true}" | ngModelOptions="{standalone: true}" | ||||
| [onLabel]="'Yes'" | [onLabel]="'Yes'" | ||||
| [offLabel]="'No'" | [offLabel]="'No'" | ||||
| (valueChange)="setBalance()" | |||||
| > | > | ||||
| </kendo-switch> | </kendo-switch> | ||||
| ngModelOptions="{standalone: true}" | ngModelOptions="{standalone: true}" | ||||
| [onLabel]="'Yes'" | [onLabel]="'Yes'" | ||||
| [offLabel]="'No'" | [offLabel]="'No'" | ||||
| (valueChange)="setOffsetBalance()" | |||||
| > | > | ||||
| </kendo-switch> | </kendo-switch> | ||||
| </kendo-grid-column> | </kendo-grid-column> | ||||
| <kendo-grid-column field="UploadId" title="Uploads" width="100" format="{0:c}" editable="false"> | <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 kendoButton *ngIf="dataItem.UploadId > 0" (click)="showUpload(dataItem.UploadId)" icon="attachment"> {{ dataItem.UploadId }} | ||||
| </button> | </button> | ||||
| <p *ngIf="dataItem.Uploads <=0" > - </p> | |||||
| <p *ngIf="dataItem.UploadId <=0" > - </p> | |||||
| </ng-template> | </ng-template> | ||||
| </kendo-grid-column> | </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> | <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> | </ng-template> | ||||
| </kendo-grid-column> | </kendo-grid-column> | ||||
| public gridData: PayInListResult = { data: [], total: 0}; | public gridData: PayInListResult = { data: [], total: 0}; | ||||
| public incomeFormGroup: FormGroup; | public incomeFormGroup: FormGroup; | ||||
| private editedRowIndex: number; | |||||
| public editedRowIndex: number; | |||||
| public showBalance = true; | public showBalance = true; | ||||
| public showOffsetBalance = true; | public showOffsetBalance = true; | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.pis.getPayInList(new PayInListFilterModel()).subscribe( | this.pis.getPayInList(new PayInListFilterModel()).subscribe( | ||||
| ( resp: PayInListResult) => { | ( resp: PayInListResult) => { | ||||
| this.gridData = resp; | |||||
| this.gridData.total = resp.total; | |||||
| resp.data.forEach(v => { | |||||
| this.gridData.data.push(new PayInModel(v)); | |||||
| }); | |||||
| } | } | ||||
| ); | ); | ||||
| } | } | ||||
| public gotoLoan(id: string): void { | public gotoLoan(id: string): void { | ||||
| this.router.navigate(['/edit-loan', id]); | 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); | |||||
| } | |||||
| } | |||||
| } | } |