From: Jane Sandberg Date: Wed, 19 Dec 2018 23:10:14 +0000 (-0800) Subject: Adding a confirm dialog for canceling X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9ad8bbbbc452e78b035ab656c93284027dc93b6c;p=working%2FEvergreen.git Adding a confirm dialog for canceling 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 ea7fb201c0..26f5d8591c 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 @@ -37,3 +37,9 @@ idlClass="bresv" readonlyFields="usr,xact_start,xact_finish,request_time,capture_time,cancel_time,pickup_time,return_time,capture_staff"> + + + 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 acaf2eb763..f151b76995 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 @@ -10,6 +10,8 @@ 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', @@ -19,10 +21,13 @@ 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; @@ -67,14 +72,19 @@ export class CurrentReservationsComponent implements OnInit { 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.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(); }