From: Jeff Davis Date: Thu, 19 May 2022 23:32:38 +0000 (-0700) Subject: LP#1945385: use eg-admin-page for circ limit sets admin UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=88050cd6ef8753a3a0283b4d9323fc728b9b4e2e;p=working%2FEvergreen.git LP#1945385: use eg-admin-page for circ limit sets admin UI Signed-off-by: Jeff Davis Signed-off-by: Jennifer Pringle Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.html index 58340e758b..44fc39beca 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.html @@ -1,26 +1,14 @@ - - - - - - + - - - - - + + + diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.ts index f38a9dfbc2..ce28023b6e 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.component.ts @@ -1,123 +1,7 @@ -import {Pager} from '@eg/share/util/pager'; -import {Component, OnInit, Input, ViewChild} from '@angular/core'; -import {GridComponent} from '@eg/share/grid/grid.component'; -import {GridDataSource} from '@eg/share/grid/grid'; -import {Router} from '@angular/router'; -import {IdlObject} from '@eg/core/idl.service'; -import {PcrudService} from '@eg/core/pcrud.service'; -import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; -import {StringComponent} from '@eg/share/string/string.component'; -import {ToastService} from '@eg/share/toast/toast.service'; +import {Component} from '@angular/core'; @Component({ templateUrl: './circ_limit_set.component.html' }) -export class CircLimitSetComponent implements OnInit { - - recId: number; - gridDataSource: GridDataSource; - initDone = false; - cspSource: GridDataSource = new GridDataSource(); - - @ViewChild('editDialog', {static: true}) editDialog: FmRecordEditorComponent; - @ViewChild('grid', {static: true}) grid: GridComponent; - @ViewChild('updateSuccessString', {static: true}) updateSuccessString: StringComponent; - @ViewChild('updateFailedString', {static: true}) updateFailedString: StringComponent; - @ViewChild('deleteFailedString', {static: true}) deleteFailedString: StringComponent; - @ViewChild('deleteSuccessString', {static: true}) deleteSuccessString: StringComponent; - @ViewChild('createSuccessString', {static: true}) createSuccessString: StringComponent; - @ViewChild('createErrString', {static: true}) createErrString: StringComponent; - - @Input() dialogSize: 'sm' | 'lg' = 'lg'; - - constructor( - private pcrud: PcrudService, - private toast: ToastService, - private router: Router - ) { - this.gridDataSource = new GridDataSource(); - } - - ngOnInit() { - this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { - const orderBy: any = {}; - const searchOps = { - offset: pager.offset, - limit: pager.limit, - order_by: orderBy - }; - return this.pcrud.retrieveAll('ccls', searchOps, {fleshSelectors: true}); - }; - - this.grid.onRowActivate.subscribe( - (set: IdlObject) => { - const idToEdit = set.id(); - this.navigateToEditPage(idToEdit); - } - ); - } - - deleteSelected = (idlThings: IdlObject[]) => { - idlThings.forEach(idlThing => idlThing.isdeleted(true)); - this.pcrud.autoApply(idlThings).subscribe( - val => { - this.deleteSuccessString.current() - .then(str => this.toast.success(str)); - }, - err => { - this.deleteFailedString.current() - .then(str => this.toast.danger(str)); - }, - () => this.grid.reload() - ); - } - - editSelected(sets: IdlObject[]) { - const idToEdit = sets[0].id(); - this.navigateToEditPage(idToEdit); - } - - navigateToEditPage(id: any) { - this.router.navigate(['/staff/admin/local/config/circ_limit_set/' + id]); - } - - createNew() { - this.editDialog.mode = 'create'; - this.editDialog.recordId = null; - this.editDialog.record = null; - this.editDialog.open({size: this.dialogSize}).subscribe( - ok => { - this.createSuccessString.current() - .then(str => this.toast.success(str)); - this.grid.reload(); - }, - rejection => { - if (!rejection.dismissed) { - this.createErrString.current() - .then(str => this.toast.danger(str)); - } - } - ); - } - - showEditDialog(standingPenalty: IdlObject): Promise { - this.editDialog.mode = 'update'; - this.editDialog.recordId = standingPenalty['id'](); - return new Promise((resolve, reject) => { - this.editDialog.open({size: this.dialogSize}).subscribe( - result => { - this.updateSuccessString.current() - .then(str => this.toast.success(str)); - this.grid.reload(); - resolve(result); - }, - error => { - this.updateFailedString.current() - .then(str => this.toast.danger(str)); - reject(error); - } - ); - }); - } -} +export class CircLimitSetComponent { } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.module.ts index e7cf75a9f1..814969165d 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set.module.ts @@ -4,6 +4,7 @@ import {CircLimitSetComponent} from './circ_limit_set.component'; import {CircLimitSetEditComponent} from './circ_limit_set_edit.component'; import {CircLimitSetRoutingModule} from './circ_limit_set_routing.module'; import {ItemLocationSelectModule} from '@eg/share/item-location-select/item-location-select.module'; +import {AdminPageModule} from '@eg/staff/share/admin-page/admin-page.module'; @NgModule({ declarations: [ @@ -12,6 +13,7 @@ import {ItemLocationSelectModule} from '@eg/share/item-location-select/item-loca ], imports: [ AdminCommonModule, + AdminPageModule, CircLimitSetRoutingModule, ItemLocationSelectModule, ], diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set_edit.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set_edit.component.ts index a8dd48e2ae..be81a1c3ee 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set_edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/circ_limit_set/circ_limit_set_edit.component.ts @@ -25,7 +25,7 @@ export class CircLimitSetEditComponent implements OnInit { selectedLimitGroup: any; locId = 0; - circTab: 'limitSet' | 'linked' = 'limitSet'; + circTab: 'limitSet' | 'linked' = 'linked'; @ViewChild('addingSuccess', {static: true}) addingSuccess: StringComponent; @ViewChild('removingSuccess', {static: true}) removingSuccess: StringComponent;