From: Jane Sandberg Date: Sun, 20 Jan 2019 04:30:01 +0000 (-0800) Subject: Rename Current Reservations to Manage Reservations X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=29ea7ada308791bc43075186d765ef7f0ebc740d;p=working%2FEvergreen.git Rename Current Reservations to Manage Reservations Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.html b/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.html deleted file mode 100644 index e9a663885c..0000000000 --- a/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.html +++ /dev/null @@ -1,45 +0,0 @@ -{{gridSource | json }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.ts deleted file mode 100644 index f151b76995..0000000000 --- a/Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import {GridComponent} from '@eg/share/grid/grid.component'; -import { GridDataSource } from '@eg/share/grid/grid'; -import {AuthService} from '@eg/core/auth.service'; -import {IdlObject} from '@eg/core/idl.service'; -import {PcrudService} from '@eg/core/pcrud.service'; -import {Pager} from '@eg/share/util/pager'; -import {ToastService} from '@eg/share/toast/toast.service'; -import { Router, ActivatedRoute, ParamMap } from '@angular/router'; -import {StringComponent} from '@eg/share/string/string.component'; -import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; -import {NetService} from '@eg/core/net.service'; -import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; - - -@Component({ - selector: 'eg-current-reservations', - templateUrl: './current-reservations.component.html', -}) -export class CurrentReservationsComponent implements OnInit { - - gridSource: GridDataSource; - patronId: number; - numRowsSelected: number; - - @ViewChild('grid') grid: GridComponent; - @ViewChild('editDialog') editDialog: FmRecordEditorComponent; - @ViewChild('successString') successString: StringComponent; - @ViewChild('confirmCancelReservationDialog') - private cancelReservationDialog: ConfirmDialogComponent; - - editSelected: (rows: IdlObject[]) => void; - cancelSelected: (rows: IdlObject[]) => void; - viewByPatron: (rows: IdlObject[]) => void; - - constructor( - private route: ActivatedRoute, - private router: Router, - private toast: ToastService, - private pcrud: PcrudService, - private auth: AuthService, - private net: NetService - ){ - this.gridSource = new GridDataSource(); - - this.gridSource.getRows = (pager: Pager, sort: any[]) => { - const orderBy: any = {}; - if (sort.length) { - orderBy.bresv = sort[0].name + ' ' + sort[0].dir; - } - return this.pcrud.search('bresv', {"usr" : (this.patronId ? this.patronId : {">" : 1})}, { - order_by: orderBy, - limit: pager.limit, - offset: pager.offset, - flesh: 1, - flesh_fields: {'bresv' : ['usr', 'capture_staff', 'target_resource', 'target_resource_type', 'current_resource', 'request_lib', 'pickup_lib']}}); - } - } - - ngOnInit() { - this.route.paramMap.subscribe((params: ParamMap) => { - this.patronId = +params.get('patron_id'); - }); - - this.editSelected = (idlThings: IdlObject[]) => { - const editOneThing = (thing: IdlObject) => { - if (!thing) return; - this.showEditDialog(thing).then( - () => editOneThing(idlThings.shift())); - } - editOneThing(idlThings.shift()); }; - - this.cancelSelected = (reservations: IdlObject[]) => { - let reservationIds = reservations.map(reservation => reservation.id()); - this.numRowsSelected = reservationIds.length; - this.cancelReservationDialog.open() - .then( - confirmed => {this.net.request( - 'open-ils.booking', - 'open-ils.booking.reservations.cancel', - this.auth.token(), reservationIds) - .subscribe( - (res) => alert("RES: " + JSON.stringify(res)), - (err) => alert("ERR: " + JSON.stringify(err)) - ); - }, - dismissed => console.log('user cancelled')); - this.grid.reload(); - } - - this.viewByPatron = (reservations: IdlObject[]) => { - let patronIds = reservations.map(reservation => reservation.usr().id()); - this.router.navigate(['/staff', 'booking', 'current_reservations', 'by_patron', patronIds[0]]); - } - - this.editDialog.mode = 'update'; // this fmeditor is not used for creating objects, just updates - } - - showEditDialog(idlThing: IdlObject) { - this.editDialog.recId = idlThing.id(); - return this.editDialog.open({size: 'lg'}).then( - ok => { - this.successString.current() - .then(str => this.toast.success(str)); - this.grid.reload(); - }, - err => {} - ); - } - -} - diff --git a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.html b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.html new file mode 100644 index 0000000000..e9a663885c --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.html @@ -0,0 +1,45 @@ +{{gridSource | json }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts new file mode 100644 index 0000000000..f921f664c7 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts @@ -0,0 +1,112 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import {GridComponent} from '@eg/share/grid/grid.component'; +import { GridDataSource } from '@eg/share/grid/grid'; +import {AuthService} from '@eg/core/auth.service'; +import {IdlObject} from '@eg/core/idl.service'; +import {PcrudService} from '@eg/core/pcrud.service'; +import {Pager} from '@eg/share/util/pager'; +import {ToastService} from '@eg/share/toast/toast.service'; +import { Router, ActivatedRoute, ParamMap } from '@angular/router'; +import {StringComponent} from '@eg/share/string/string.component'; +import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; +import {NetService} from '@eg/core/net.service'; +import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; + + +@Component({ + selector: 'eg-manage-reservations', + templateUrl: './manage-reservations.component.html', +}) +export class ManageReservationsComponent implements OnInit { + + gridSource: GridDataSource; + patronId: number; + numRowsSelected: number; + + @ViewChild('grid') grid: GridComponent; + @ViewChild('editDialog') editDialog: FmRecordEditorComponent; + @ViewChild('successString') successString: StringComponent; + @ViewChild('confirmCancelReservationDialog') + private cancelReservationDialog: ConfirmDialogComponent; + + editSelected: (rows: IdlObject[]) => void; + cancelSelected: (rows: IdlObject[]) => void; + viewByPatron: (rows: IdlObject[]) => void; + + constructor( + private route: ActivatedRoute, + private router: Router, + private toast: ToastService, + private pcrud: PcrudService, + private auth: AuthService, + private net: NetService + ){ + this.gridSource = new GridDataSource(); + + this.gridSource.getRows = (pager: Pager, sort: any[]) => { + const orderBy: any = {}; + if (sort.length) { + orderBy.bresv = sort[0].name + ' ' + sort[0].dir; + } + return this.pcrud.search('bresv', {"usr" : (this.patronId ? this.patronId : {">" : 1})}, { + order_by: orderBy, + limit: pager.limit, + offset: pager.offset, + flesh: 1, + flesh_fields: {'bresv' : ['usr', 'capture_staff', 'target_resource', 'target_resource_type', 'current_resource', 'request_lib', 'pickup_lib']}}); + } + } + + ngOnInit() { + this.route.paramMap.subscribe((params: ParamMap) => { + this.patronId = +params.get('patron_id'); + }); + + this.editSelected = (idlThings: IdlObject[]) => { + const editOneThing = (thing: IdlObject) => { + if (!thing) return; + this.showEditDialog(thing).then( + () => editOneThing(idlThings.shift())); + } + editOneThing(idlThings.shift()); }; + + this.cancelSelected = (reservations: IdlObject[]) => { + let reservationIds = reservations.map(reservation => reservation.id()); + this.numRowsSelected = reservationIds.length; + this.cancelReservationDialog.open() + .then( + confirmed => {this.net.request( + 'open-ils.booking', + 'open-ils.booking.reservations.cancel', + this.auth.token(), reservationIds) + .subscribe( + (res) => alert("RES: " + JSON.stringify(res)), + (err) => alert("ERR: " + JSON.stringify(err)) + ); + }, + dismissed => console.log('user cancelled')); + this.grid.reload(); + } + + this.viewByPatron = (reservations: IdlObject[]) => { + let patronIds = reservations.map(reservation => reservation.usr().id()); + this.router.navigate(['/staff', 'booking', 'manage_reservations', 'by_patron', patronIds[0]]); + } + + this.editDialog.mode = 'update'; // this fmeditor is not used for creating objects, just updates + } + + showEditDialog(idlThing: IdlObject) { + this.editDialog.recId = idlThing.id(); + return this.editDialog.open({size: 'lg'}).then( + ok => { + this.successString.current() + .then(str => this.toast.success(str)); + this.grid.reload(); + }, + err => {} + ); + } + +} + diff --git a/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts index edbf957c31..9167b8ae9b 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts @@ -1,11 +1,11 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; -import { CurrentReservationsComponent } from './current-reservations.component'; -import { PullListComponent } from './pull-list.component'; +import {ManageReservationsComponent} from './manage-reservations.component'; +import {PullListComponent} from './pull-list.component'; const routes: Routes = [{ - path: 'current_reservations', - component: CurrentReservationsComponent + path: 'manage_reservations', + component: ManageReservationsComponent },{ path: 'pull_list', component: PullListComponent diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index 525550f904..740ee50fcd 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -465,7 +465,7 @@
  • - + [% l('Manage Reservations') %]