messages on catalog in case of hold suspend failure
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 24 Aug 2022 20:58:49 +0000 (16:58 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 24 Aug 2022 20:58:49 +0000 (16:58 -0400)
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts

index bfe8b3d..45068f7 100644 (file)
@@ -9,6 +9,13 @@
     Please chose a date in the future">
 </eg-alert-dialog>
 
+<eg-alert-dialog #nextHourAlert
+  i18n-dialogTitle i18n-dialogBody
+  dialogTitle="Can Not Suspend"
+  dialogBody="Hold can not be suspended because the pickup library is either open
+    or does not have hours of operation defined.">
+</eg-alert-dialog>
+
 <div class="row">
   <div class="col-lg-1">
     <button class="btn btn-info label-with-material-icon"
index 85448a2..80d83b5 100644 (file)
@@ -100,7 +100,8 @@ export class HoldComponent implements OnInit {
     @ViewChild('smsCbox', {static: false}) smsCbox: ComboboxComponent;
 
     @ViewChild('activeDateAlert') private activeDateAlert: AlertDialogComponent;
-
+    @ViewChild('nextHourAlert') private nextHourAlert: AlertDialogComponent;
+    
     constructor(
         private router: Router,
         private route: ActivatedRoute,
@@ -706,22 +707,25 @@ export class HoldComponent implements OnInit {
     }
 
        nextOpenTime(){
+        this.activeDateStr = "";
                this.net.request('open-ils.actor',
             'open-ils.actor.org_unit.next_operating_hour',this.pickupLib
         ).subscribe(
             resp => {
                 console.log(resp);
-                if(resp){
+                if(resp && typeof resp === 'string'){
                     this.activeDateSelected(resp);
                 }
-                else{
+            },
+            error => {
+                console.log(error);
+            },
+            () => {
+                if(!this.activeDateStr){
                     this.suspend = false;
                     this.suspendTilOpen = false;
+                    this.nextHourAlert.open();
                 }
-            },
-            error => {
-                this.suspend = false;
-                this.suspendTilOpen = false;                
             }
         );
        }