From 2babbfb27a93aa225a099e71cc5d34156befe8c8 Mon Sep 17 00:00:00 2001 From: Tiffany Little Date: Thu, 29 Dec 2022 16:03:08 -0500 Subject: [PATCH] LP1953181 Acq funds year dropdown Returns the fiscal year to a dropdown on the Funds screen, and removes the autofilter on the Year column. Signed-off-by: Tiffany Little --- .../admin/acq/funds/funds-manager.component.html | 10 +++++- .../admin/acq/funds/funds-manager.component.ts | 39 +++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.html b/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.html index dfc85b5372..0b678a845f 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.html @@ -28,6 +28,14 @@ + + +
@@ -70,7 +78,7 @@ - + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.ts index 5d5df0f72b..9cd317a455 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funds-manager.component.ts @@ -13,9 +13,11 @@ import {OrgService} from '@eg/core/org.service'; import {PermService} from '@eg/core/perm.service'; import {AuthService} from '@eg/core/auth.service'; import {NetService} from '@eg/core/net.service'; +import {StoreService} from '@eg/core/store.service'; import {StringComponent} from '@eg/share/string/string.component'; import {FundDetailsDialogComponent} from './fund-details-dialog.component'; import {FundRolloverDialogComponent} from './fund-rollover-dialog.component'; +import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; @Component({ selector: 'eg-funds-manager', @@ -34,6 +36,8 @@ export class FundsManagerComponent extends AdminPageComponent implements OnInit, cellTextGenerator: GridCellTextGenerator; canRollover = false; + selectedYear: number; + fiscalYears: ComboboxEntry[]; constructor( route: ActivatedRoute, @@ -47,13 +51,36 @@ export class FundsManagerComponent extends AdminPageComponent implements OnInit, private perm2: PermService, // need copy because perm is private to base // component toast: ToastService, - private net: NetService + private net: NetService, + private localStore: StoreService ) { super(route, ngLocation, format, idl, org, auth, pcrud, perm, toast); this.dataSource = new GridDataSource(); } ngOnInit() { + + this.selectedYear = this.localStore.getLocalItem('eg.acq.fiscal_year'); + + this.fiscalYears = null; + let maxYear = 0; + this.net.request( + 'open-ils.acq', + 'open-ils.acq.fund.org.years.retrieve', + this.auth.token(), + {}, + { limit_perm: 'VIEW_FUND' } + ).subscribe( + years => { + this.fiscalYears = years.map(y => { + if (this.selectedYear === null) { + if (maxYear < y) { this.selectedYear = y; } + } + return { id: y, label: y }; + }); + } + ); + this.cellTextGenerator = { name: row => row.name() }; @@ -113,6 +140,10 @@ export class FundsManagerComponent extends AdminPageComponent implements OnInit, search.push(orgFilter); } + if (this.selectedYear) { + search.push({year: this.selectedYear}); + } + Object.keys(this.dataSource.filters).forEach(key => { Object.keys(this.dataSource.filters[key]).forEach(key2 => { search.push(this.dataSource.filters[key][key2]); @@ -174,4 +205,10 @@ export class FundsManagerComponent extends AdminPageComponent implements OnInit, () => this.grid.reload() ); } + + yearChange(year: number) { + this.selectedYear = year; + this.localStore.setLocalItem('eg.acq.fiscal_year', this.selectedYear); + this.grid.reload(); + } } -- 2.11.0