From: Jason Etheridge Date: Wed, 14 Dec 2022 05:58:29 +0000 (-0500) Subject: item and patron stat cat admin pages X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fcollab%2Fphasefx%2Fstat-cat-admin-wip-alternative;p=working%2FEvergreen.git item and patron stat cat admin pages Leverages the BasicAdminPage component, with some tweaks. Changes to the BasicAdminPage and AdminPage components all default to off, so should not affect existing interfaces: * add an option to hide the Clear Filters action from subordinate admin pages (when you follow config fields) * add an option to propagate recordLabel to the fmEditor component, and also use said label within the admin page * add an option to propagate orgDefaultAllowed to the fmEditor component For the stat cat and entry admin pages specifically, we leverage these to: * hide Clear Filters so that we don't let the user get into a situation where they try to create a new stat cat entry but have a blank and unsettable stat cat field (because we mark that field as read-only in the fmEditor) * default the Owner field for new stat cats and entries to the workstation library * use Item and Patron instead of Asset and Actor in various labels (at least until we're ready to make that change wholesale in the IDL) Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.spec.ts b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.spec.ts index 7a5cb9ddfe..e2b4794515 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.spec.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.spec.ts @@ -30,10 +30,13 @@ class MockAdminPageComponent { @Input() configLinkBasePath: string; @Input() defaultNewRecord: IdlObject; @Input() disableOrgFilter: boolean; + @Input() hideClearFilters: boolean; @Input() fieldOrder: string; @Input() idlClass: string; @Input() persistKeyPfx: string; @Input() readonlyFields: string; + @Input() recordLabel: string; + @Input() orgDefaultAllowed: string; } describe('Component: BasicAdminPage', () => { diff --git a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts index 1f63253b7f..f2d7fa2cf5 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts @@ -11,14 +11,17 @@ import {tap, switchMap} from 'rxjs/operators'; @Component({ template: ` - + - + @@ -32,6 +35,9 @@ export class BasicAdminPageComponent implements OnInit { persistKeyPfx: string; fieldOrder = ''; readonlyFields = ''; + recordLabel = ''; + orgDefaultAllowed = ''; + hideClearFilters: boolean; defaultNewRecordIdl: IdlObject; configLinkBasePath = '/staff/admin'; @@ -75,6 +81,9 @@ export class BasicAdminPageComponent implements OnInit { this.disableOrgFilter = data['disableOrgFilter']; this.fieldOrder = data['fieldOrder']; this.readonlyFields = data['readonlyFields']; + this.recordLabel = data['recordLabel']; + this.orgDefaultAllowed = data['orgDefaultAllowed']; + this.hideClearFilters = data['hideClearFilters']; this.defaultNewRecord = data['defaultNewRecord']; } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html index 92d22f03e4..b5eb8734b6 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html @@ -72,6 +72,10 @@ routerLink="/staff/admin/local/config/standing_penalty"> + + import('./negative-balances/negative-balances.module').then(m => m.NegativeBalancesModule) }, { + path: 'asset/stat_cat', + component: BasicAdminPageComponent, + data: [{ + schema: 'asset', + table: 'stat_cat', + readonlyFields: 'id', + orgDefaultAllowed: 'owner', + recordLabel: $localize `Item Statistical Category`, + fieldOrder: 'name,owner,required,opac_visible,checkout_archive,sip_field,sip_format'}] +}, { + path: 'asset/stat_cat_entry', + component: BasicAdminPageComponent, + data: [{ + schema: 'asset', + table: 'stat_cat_entry', + readonlyFields: 'id,stat_cat', + orgDefaultAllowed: 'owner', + recordLabel: $localize `Item Statistical Category Entry`, + hideClearFilters: true, + fieldOrder: 'stat_cat,value,owner'}] +}, { + path: 'actor/stat_cat', + component: BasicAdminPageComponent, + data: [{ + schema: 'actor', + table: 'stat_cat', + readonlyFields: 'id', + orgDefaultAllowed: 'owner', + recordLabel: $localize `Patron Statistical Category`, + fieldOrder: 'name,owner,required,opac_visible,usr_summary,allow_freetext,checkout_archive,sip_field,sip_format'}] +}, { + path: 'actor/stat_cat_entry', + component: BasicAdminPageComponent, + data: [{ + schema: 'actor', + table: 'stat_cat_entry', + readonlyFields: 'id,stat_cat', + orgDefaultAllowed: 'owner', + recordLabel: $localize `Patron Statistical Category Entry`, + hideClearFilters: true, + fieldOrder: 'stat_cat,value,owner'}] +}, { path: ':schema/:table', component: BasicAdminPageComponent } diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html index 817a0181fd..7457638a5d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html @@ -1,19 +1,19 @@ -{{idlClassDef.label}} Update Succeeded +{{recordLabel || idlClassDef.label}} Update Succeeded -Update of {{idlClassDef.label}} failed +Update of {{recordLabel || idlClassDef.label}} failed -Delete of {{idlClassDef.label}} failed or was not allowed +Delete of {{recordLabel || idlClassDef.label}} failed or was not allowed -{{idlClassDef.label}} Successfully Deleted +{{recordLabel || idlClassDef.label}} Successfully Deleted -{{idlClassDef.label}} Successfully Created +{{recordLabel || idlClassDef.label}} Successfully Created -Failed to create new {{idlClassDef.label}} +Failed to create new {{recordLabel || idlClassDef.label}} @@ -32,7 +32,7 @@
Filters Applied: {{gridFilters | json}} - Clear Filters @@ -57,7 +57,7 @@ (onRowActivate)="showEditDialog($event)" [filterable]="true" [stickyHeader]="true"> + label="New {{recordLabel || idlClassDef.label}}" i18n-label (onClick)="createNew()"> @@ -77,10 +77,12 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts index 7098c70f2d..aac070f23f 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts @@ -79,6 +79,15 @@ export class AdminPageComponent implements OnInit { // Optional comma-separated list of read-only fields @Input() readonlyFields: string; + // Optional record label to use instead of the IDL label + @Input() recordLabel: string; + + // optional flag to hide the Clear Filters action for gridFilters + @Input() hideClearFilters: boolean; + + // optional list of org fields which are allowed a default if unset + @Input() orgDefaultAllowed: string; + // Optional template containing help/about text which will // be added to the page, above the grid. @Input() helpTemplate: TemplateRef;