From 8a12f20d2e5058377e01c1645853588ee0e3b40c Mon Sep 17 00:00:00 2001 From: Patrick Sun Date: Sat, 10 Apr 2021 17:14:52 +1000 Subject: [PATCH] PayIn List works with no filter. --- src/app/models/pay-in-list-result.model.ts | 7 +++ src/app/models/pay-in-list.filter.model.ts | 12 ++++++ src/app/pay-in/pay-in.component.html | 17 +++++--- src/app/pay-in/pay-in.component.scss | 12 ++++++ src/app/pay-in/pay-in.component.ts | 50 ++++++++++++---------- src/app/service/pay-in.service.ts | 17 ++++++++ 6 files changed, 87 insertions(+), 28 deletions(-) create mode 100644 src/app/models/pay-in-list-result.model.ts create mode 100644 src/app/models/pay-in-list.filter.model.ts create mode 100644 src/app/service/pay-in.service.ts diff --git a/src/app/models/pay-in-list-result.model.ts b/src/app/models/pay-in-list-result.model.ts new file mode 100644 index 0000000..0de52c9 --- /dev/null +++ b/src/app/models/pay-in-list-result.model.ts @@ -0,0 +1,7 @@ +import {GridDataResult} from '@progress/kendo-angular-grid'; +import {PayInModel} from './pay-in.model'; + +export class PayInListResult implements GridDataResult { + public data: PayInModel[]; + public total: number; +} diff --git a/src/app/models/pay-in-list.filter.model.ts b/src/app/models/pay-in-list.filter.model.ts new file mode 100644 index 0000000..4b060c7 --- /dev/null +++ b/src/app/models/pay-in-list.filter.model.ts @@ -0,0 +1,12 @@ +export class PayInListFilterModel { + LoanIds: string[]; + Uploads: string[]; + Take: number; + Skip: number; + TsFrom: Date; + TsTo: Date; + IdFrom: number; + IdTo: number; + IncomeFrom: number; + IncomeTo: number; +} diff --git a/src/app/pay-in/pay-in.component.html b/src/app/pay-in/pay-in.component.html index b3e760a..8e1c498 100644 --- a/src/app/pay-in/pay-in.component.html +++ b/src/app/pay-in/pay-in.component.html @@ -1,4 +1,4 @@ - - -   Show Uploads   +
+
+ +
+
+ + +
+
- + - + diff --git a/src/app/pay-in/pay-in.component.scss b/src/app/pay-in/pay-in.component.scss index ba606f0..54daec3 100644 --- a/src/app/pay-in/pay-in.component.scss +++ b/src/app/pay-in/pay-in.component.scss @@ -1,5 +1,15 @@ kendo-grid { height: calc(100vh - 48px); + + .add-new-tool-bar{ + width:30%; + display: inline-block; + } + + .filter-panel-wrapper{ + display: inline-block; + text-align:right; + } } .balance { @@ -7,3 +17,5 @@ kendo-grid { margin-left: 0px !important; width: calc(100% - 60px) !important; } + + diff --git a/src/app/pay-in/pay-in.component.ts b/src/app/pay-in/pay-in.component.ts index 6c28fa2..dd8a9d3 100644 --- a/src/app/pay-in/pay-in.component.ts +++ b/src/app/pay-in/pay-in.component.ts @@ -1,6 +1,9 @@ import {Component, Input, OnInit} from '@angular/core'; import {PayInModel} from '../models/pay-in.model'; import {FormControl, FormGroup, Validators} from '@angular/forms'; +import {PayInListFilterModel} from '../models/pay-in-list.filter.model'; +import {PayInService} from '../service/pay-in.service'; +import {PayInListResult} from '../models/pay-in-list-result.model'; const createFormGroup = dataItem => new FormGroup({ Id: new FormControl({value: dataItem.Id, disabled: true}, Validators.required), @@ -17,31 +20,32 @@ const createFormGroup = dataItem => new FormGroup({ styleUrls: ['./pay-in.component.scss'] }) export class PayInComponent implements OnInit { - @Input() public AllPayIn: PayInModel[] = []; - public formGroup: FormGroup; + @Input() loanFilter: string[] = []; + @Input() uploadsFilter: string[] = []; + @Input() allowAddNew = false; // TODO: + @Input() allowEdit = false; // TODO: + @Input() pageSize = 10; + @Input() skip = 0; + @Input() dateStart = new Date('1900-01-01'); + @Input() dateEnd = new Date('2038-12-31'); + + public gridData: PayInListResult = { data: [], total: 0}; + public incomeFormGroup: FormGroup; private editedRowIndex: number; - public trailIncome: FormGroup; public showBalance = true; public showOffsetBalance = true; - public splitButtonItems: Array = [{ - text: 'Keep Text Only', - icon: 'paste-plain-text', - click: () => { console.log('Keep Text Only click handler'); } - }, { - text: 'Paste as HTML', - icon: 'paste-as-html' - }, { - text: 'Paste Markdown', - icon: 'paste-markdown' - }, { - text: 'Set Default Paste' - }]; - - constructor() { } + + constructor(private pis: PayInService) { } ngOnInit(): void { + this.pis.getPayInList(new PayInListFilterModel()).subscribe( + ( resp: PayInListResult) => { + console.log(resp); + this.gridData = resp; + } + ); } @@ -59,7 +63,7 @@ export class PayInComponent implements OnInit { // this.showBalance = balance >= 0 ; // this.showOffsetBalance = offsetBalance >= 0 ; - this.formGroup = createFormGroup({ + this.incomeFormGroup = createFormGroup({ Id: 0, Trail: 168, Ts: new Date(), @@ -67,7 +71,7 @@ export class PayInComponent implements OnInit { OffsetBalance: offsetBalance }); - sender.addRow(this.formGroup); + sender.addRow(this.incomeFormGroup); } public editHandler({ sender, rowIndex, dataItem }): void { @@ -75,9 +79,9 @@ export class PayInComponent implements OnInit { this.showBalance = dataItem.Balance >= 0 ; this.showOffsetBalance = dataItem.OffsetBalance >= 0 ; - this.formGroup = createFormGroup(dataItem); + this.incomeFormGroup = createFormGroup(dataItem); this.editedRowIndex = rowIndex; - sender.editRow(rowIndex, this.formGroup); + sender.editRow(rowIndex, this.incomeFormGroup); } @@ -133,6 +137,6 @@ export class PayInComponent implements OnInit { private closeEditor(grid, rowIndex = this.editedRowIndex): void{ grid.closeRow(rowIndex); this.editedRowIndex = undefined; - this.formGroup = undefined; + this.incomeFormGroup = undefined; } } diff --git a/src/app/service/pay-in.service.ts b/src/app/service/pay-in.service.ts new file mode 100644 index 0000000..97af5ca --- /dev/null +++ b/src/app/service/pay-in.service.ts @@ -0,0 +1,17 @@ +import {Injectable} from '@angular/core'; +import {Observable} from 'rxjs'; +import {PayInListFilterModel} from '../models/pay-in-list.filter.model'; +import {HttpClient} from '@angular/common/http'; +import {AuthService} from './auth.service'; +import {PayInListResult} from '../models/pay-in-list-result.model'; + + + +@Injectable({providedIn: 'root'}) +export class PayInService { + constructor(private http: HttpClient, private auth: AuthService ){ } + + public getPayInList(filter: PayInListFilterModel): Observable { + return this.http.post(this.auth.getUrl('pay-in-list/'), filter); + } +}