From: Jane Sandberg Date: Wed, 12 Dec 2018 23:59:34 +0000 (-0800) Subject: Adding a cancel action X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1f00d34b7acd6487529cfd9da333a94d9ee164c5;p=working%2FEvergreen.git Adding a cancel action 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 index b4c8f7e62d..3c24204d8b 100644 --- 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 @@ -5,6 +5,7 @@ + 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 index 554c8d507e..29958b5ba0 100644 --- 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 @@ -1,6 +1,7 @@ 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'; @@ -8,6 +9,7 @@ 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'; @Component({ selector: 'eg-current-reservations', @@ -23,11 +25,14 @@ export class CurrentReservationsComponent implements OnInit { @ViewChild('successString') successString: StringComponent; editSelected: (rows: IdlObject[]) => void; + cancelSelected: (rows: IdlObject[]) => void; constructor( private route: ActivatedRoute, private toast: ToastService, - private pcrud: PcrudService + private pcrud: PcrudService, + private auth: AuthService, + private net: NetService ){ this.gridSource = new GridDataSource(); @@ -58,6 +63,19 @@ export class CurrentReservationsComponent implements OnInit { } editOneThing(idlThings.shift()); }; + this.cancelSelected = (reservations: IdlObject[]) => { + let reservationIds = reservations.map(reservation => reservation.id()); + 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)) + ); + this.grid.reload(); + } + } showEditDialog(idlThing: IdlObject) {