From: Jane Sandberg Date: Mon, 1 Apr 2019 17:03:05 +0000 (-0700) Subject: LP1816475: Fixing the return screens X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7a497c0863bea9fba39d5a7c64fe5897929117a6;p=working%2FEvergreen.git LP1816475: Fixing the return screens Signed-off-by: Jane Sandberg --- diff --git a/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html b/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html index 9fd3187bee..93288f79ef 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html +++ b/Open-ILS/src/eg2/src/app/staff/booking/reservations-grid.component.html @@ -40,7 +40,7 @@ idlClass="bresv" datetimeFields="start_time,end_time" hiddenFields="xact_finish,cancel_time,booking_interval" - [fieldOptions]="{start_time:{validator:startTimeShouldBeFuture}}" + [fieldOptions]="{start_time:{validator:startTimeShouldBeFuture},end_time:{validator:endTimeShouldBeAfterStartTime}}" [readonlyFields]="listReadOnlyFields()"> string; startTimeShouldBeFuture: (fieldName: string, value: Moment, record: IdlObject) => string; + endTimeShouldBeAfterStartTime: (fieldName: string, value: Moment, record: IdlObject) => string; handleRowActivate: (row: IdlObject) => void; @@ -247,6 +248,12 @@ export class ReservationsGridComponent implements OnInit { } return ''; }; + this.endTimeShouldBeAfterStartTime = (fieldName: string, value: Moment, record: IdlObject) => { + if (Moment(value) <= Moment(record['start_time'])) { + return 'End time must be after start time'; + } + return ''; + }; this.handleRowActivate = (row: IdlObject) => { if (this.status) { diff --git a/Open-ILS/src/eg2/src/app/staff/booking/return.component.html b/Open-ILS/src/eg2/src/app/staff/booking/return.component.html index 1cb7e685ec..eb903beace 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/return.component.html +++ b/Open-ILS/src/eg2/src/app/staff/booking/return.component.html @@ -2,7 +2,6 @@ - @@ -18,10 +17,10 @@

Ready for return

- +

Returned today

- +
@@ -35,11 +34,12 @@

Ready for return

- +

Returned today

- +
+ diff --git a/Open-ILS/src/eg2/src/app/staff/booking/return.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/return.component.ts index b00a672a63..51054e2853 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/return.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/return.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, QueryList, ViewChildren } from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import { NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap'; import {Observable} from 'rxjs'; @@ -29,10 +29,8 @@ export class ReturnComponent implements OnInit { noSelectedRows: (rows: IdlObject[]) => boolean; handleTabChange: ($event: NgbTabChangeEvent) => void; - @ViewChild('patronReady') patronReady: ReservationsGridComponent; - @ViewChild('patronReturned') patronReturned: ReservationsGridComponent; - @ViewChild('resourceReady') resourceReady: ReservationsGridComponent; - @ViewChild('resourceReturned') resourceReturned: ReservationsGridComponent; + @ViewChildren('readyGrid') readyGrids: QueryList; + @ViewChildren('returnedGrid') returnedGrids: QueryList; constructor( private auth: AuthService, @@ -60,8 +58,8 @@ export class ReturnComponent implements OnInit { }).subscribe( (resp) => { this.patronBarcode = resp.card().barcode(); - this.patronReady.reloadGrid(); - this.patronReturned.reloadGrid(); + this.readyGrids.forEach (readyGrid => readyGrid.reloadGrid()); + this.returnedGrids.forEach (returnedGrid => returnedGrid.reloadGrid()); }, (err) => { console.debug(err); } ); } else { @@ -91,8 +89,8 @@ export class ReturnComponent implements OnInit { }).subscribe((resp) => { if (resp.curr_rsrcs()[0].usr()) { this.patronId = resp.curr_rsrcs()[0].usr(); - this.resourceReady.reloadGrid(); - this.resourceReturned.reloadGrid(); + this.readyGrids.forEach (readyGrid => readyGrid.reloadGrid()); + this.returnedGrids.forEach (returnedGrid => returnedGrid.reloadGrid()); } }); } @@ -100,12 +98,15 @@ export class ReturnComponent implements OnInit { this.noSelectedRows = (rows: IdlObject[]) => (rows.length === 0); this.handleTabChange = ($event) => { - this.store.setItem('eg.booking.return.tab', $event.nextId); - this.router.navigate(['/staff', 'booking', 'return']); - this.resourceBarcode = null; - this.patronBarcode = null; - this.patronId = null; + this.store.setItem('eg.booking.return.tab', $event.nextId) + .then(() => { + this.router.navigate(['/staff', 'booking', 'return']); + this.resourceBarcode = null; + this.patronBarcode = null; + this.patronId = null; + }); }; } } +