From 25b1845898b89aca7d600a5a4dd4d30982be20ca Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 26 Mar 2021 17:58:51 -0400 Subject: [PATCH] EDI attr sets: start work Signed-off-by: Galen Charlton --- .../admin/acq/admin-acq-splash.component.html | 2 + .../acq/edi_attr_set/edi-attr-sets.component.html | 76 +++++++++++++++ .../acq/edi_attr_set/edi-attr-sets.component.ts | 103 +++++++++++++++++++++ .../admin/acq/edi_attr_set/edi-attr-sets.module.ts | 23 +++++ .../staff/admin/acq/edi_attr_set/routing.module.ts | 15 +++ .../eg2/src/app/staff/admin/acq/routing.module.ts | 4 + 6 files changed, 223 insertions(+) create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.component.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/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 600539a3c6..59790a3337 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 @@ -25,6 +25,8 @@ + + + + + +{{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/edi_attr_set/edi-attr-sets.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.component.ts new file mode 100644 index 0000000000..6deea86bab --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.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: './edi-attr-sets.component.html' +}) + +export class EdiAttrSetsComponent extends AdminPageComponent implements OnInit { + idlClass = 'aeas'; + 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 = 'name,code,year,org,active,currency_type,balance_stop_percentage,balance_warning_percentage,propagate,rollover'; + this.defaultNewRecord = this.idl.create('aeas'); + + 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/edi_attr_set/edi-attr-sets.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.module.ts new file mode 100644 index 0000000000..0804e4bd78 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/edi-attr-sets.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 {EdiAttrSetsRoutingModule} from './routing.module'; +import {EdiAttrSetsComponent} from './edi-attr-sets.component'; + +@NgModule({ + declarations: [ + EdiAttrSetsComponent + ], + imports: [ + StaffCommonModule, + AdminCommonModule, + EdiAttrSetsRoutingModule + ], + exports: [ + ], + providers: [ + ] +}) + +export class EdiAttrSetsModule { +} diff --git a/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/routing.module.ts new file mode 100644 index 0000000000..416fc5b768 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/admin/acq/edi_attr_set/routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {EdiAttrSetsComponent} from './edi-attr-sets.component'; + +const routes: Routes = [{ + path: '', + component: EdiAttrSetsComponent +}]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) + +export class EdiAttrSetsRoutingModule {} 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 00d83a4d45..a1a011e22e 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,10 @@ const routes: Routes = [{ path: 'claim_type', redirectTo: 'claiming' // from legacy auto-generated admin page }, { + path: 'edi_attr_set', + loadChildren: () => + import('./edi_attr_set/edi-attr-sets.module').then(m => m.EdiAttrSetsModule) +}, { path: 'funds', loadChildren: () => import('./funds/funds.module').then(m => m.FundsModule) -- 2.11.0