From f040e6278cfcec4776e4f98fa192589bb5f1ea4c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 26 Mar 2021 18:21:30 -0400 Subject: [PATCH] currencies: start work Signed-off-by: Galen Charlton --- .../admin/acq/admin-acq-splash.component.html | 6 +- .../admin/acq/currency/currencies.component.html | 76 +++++++++++++++ .../admin/acq/currency/currencies.component.ts | 103 +++++++++++++++++++++ .../staff/admin/acq/currency/currencies.module.ts | 23 +++++ .../app/staff/admin/acq/currency/routing.module.ts | 15 +++ .../eg2/src/app/staff/admin/acq/routing.module.ts | 10 ++ 6 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.component.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/currency/routing.module.ts diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/admin-acq-splash.component.html b/Open-ILS/src/eg2/src/app/staff/admin/acq/admin-acq-splash.component.html index 355b74439a..a55101160a 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/acq/admin-acq-splash.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/admin-acq-splash.component.html @@ -9,8 +9,8 @@ routerLink="/staff/admin/acq/cancel_reason"> - + - + + + + +{{idlClassDef.label}} Update Succeeded + + +Update of {{idlClassDef.label}} failed + + +Delete of {{idlClassDef.label}} failed or was not allowed + + +{{idlClassDef.label}} Successfully Deleted + + +{{idlClassDef.label}} Successfully Created + + +Failed to create new {{idlClassDef.label}} + + + +
+
+ + + + +
+
+
+
+ + + + + + + + + + {{configLinkLabel(row, col)}} + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.component.ts new file mode 100644 index 0000000000..1b1c056293 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.component.ts @@ -0,0 +1,103 @@ +import {Component, Input, ViewChild, OnInit} from '@angular/core'; +import {Location} from '@angular/common'; +import {FormatService} from '@eg/core/format.service'; +import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid'; +import {GridComponent} from '@eg/share/grid/grid.component'; +import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component'; +import {Pager} from '@eg/share/util/pager'; +import {ActivatedRoute} from '@angular/router'; +import {IdlService, IdlObject} from '@eg/core/idl.service'; +import {ToastService} from '@eg/share/toast/toast.service'; +import {PcrudService} from '@eg/core/pcrud.service'; +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 {StringComponent} from '@eg/share/string/string.component'; + +@Component({ + templateUrl: './currencies.component.html' +}) + +export class CurrenciesComponent extends AdminPageComponent implements OnInit { + idlClass = 'acqct'; + classLabel: string; + + @ViewChild('grid', { static: true }) grid: GridComponent; + + cellTextGenerator: GridCellTextGenerator; + + constructor( + route: ActivatedRoute, + ngLocation: Location, + format: FormatService, + idl: IdlService, + org: OrgService, + auth: AuthService, + pcrud: PcrudService, + perm: PermService, + toast: ToastService, + private net: NetService + ) { + super(route, ngLocation, format, idl, org, auth, pcrud, perm, toast); + this.dataSource = new GridDataSource(); + } + + ngOnInit() { + this.cellTextGenerator = { + name: row => row.name() + }; + this.fieldOrder = 'code,name'; + this.defaultNewRecord = this.idl.create('acqct'); + + this.dataSource.getRows = (pager: Pager, sort: any[]) => { + const orderBy: any = {}; + if (sort.length) { + // Sort specified from grid + orderBy[this.idlClass] = sort[0].name + ' ' + sort[0].dir; + } else if (this.sortField) { + // Default sort field + orderBy[this.idlClass] = this.sortField; + } + + const searchOps = { + offset: pager.offset, + limit: pager.limit, + order_by: orderBy + }; + const reqOps = { + fleshSelectors: true, + }; + + if (!this.contextOrg && !Object.keys(this.dataSource.filters).length) { + // No org filter -- fetch all rows + return this.pcrud.retrieveAll( + this.idlClass, searchOps, reqOps); + } + + const search: any = new Array(); + const orgFilter: any = {}; + + if (this.orgField && (this.searchOrgs || this.contextOrg)) { + orgFilter[this.orgField] = + this.searchOrgs.orgIds || [this.contextOrg.id()]; + search.push(orgFilter); + } + + Object.keys(this.dataSource.filters).forEach(key => { + Object.keys(this.dataSource.filters[key]).forEach(key2 => { + search.push(this.dataSource.filters[key][key2]); + }); + }); + + return this.pcrud.search( + this.idlClass, search, searchOps, reqOps); + }; + + super.ngOnInit(); + + this.classLabel = this.idlClassDef.label; + this.includeOrgDescendants = true; + } + +} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.module.ts new file mode 100644 index 0000000000..54cd1ce654 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/currencies.module.ts @@ -0,0 +1,23 @@ +import {NgModule} from '@angular/core'; +import {StaffCommonModule} from '@eg/staff/common.module'; +import {AdminCommonModule} from '@eg/staff/admin/common.module'; +import {CurrenciesRoutingModule} from './routing.module'; +import {CurrenciesComponent} from './currencies.component'; + +@NgModule({ + declarations: [ + CurrenciesComponent + ], + imports: [ + StaffCommonModule, + AdminCommonModule, + CurrenciesRoutingModule + ], + exports: [ + ], + providers: [ + ] +}) + +export class CurrenciesModule { +} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/routing.module.ts new file mode 100644 index 0000000000..b906726fb7 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/currency/routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {CurrenciesComponent} from './currencies.component'; + +const routes: Routes = [{ + path: '', + component: CurrenciesComponent +}]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) + +export class CurrenciesRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/routing.module.ts index 0ae8e0a85e..254f650d65 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/acq/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/routing.module.ts @@ -32,6 +32,16 @@ const routes: Routes = [{ path: 'claim_type', redirectTo: 'claiming' // from legacy auto-generated admin page }, { + path: 'currency', + loadChildren: () => + import('./currency/currencies.module').then(m => m.CurrenciesModule) +}, { + path: 'currency_type', + redirectTo: 'currency' // from auto-generated admin page +}, { + path: 'exchange_rate', + redirectTo: 'currency' // from auto-generated admin page +}, { path: 'distribution_formula', loadChildren: () => import('./distribution_formula/distribution-formulas.module').then(m => m.DistributionFormulasModule) -- 2.11.0