LP1904036 Print service emits when queued
authorBill Erickson <berickxx@gmail.com>
Tue, 11 May 2021 15:31:33 +0000 (11:31 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 19 Jan 2022 17:00:30 +0000 (12:00 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/print/print.component.ts
Open-ILS/src/eg2/src/app/share/print/print.service.ts

index bf0fb3a..e8b0b96 100644 (file)
@@ -98,7 +98,10 @@ export class PrintComponent implements OnInit {
             this.applyTemplate(printReq).then(() => {
                 // Give templates a chance to render before printing
                 setTimeout(() => {
-                    this.dispatchPrint(printReq).then(__ => this.reset());
+                    this.dispatchPrint(printReq).then(__ => {
+                        this.reset();
+                        this.printer.printJobQueued$.emit(printReq);
+                    });
                 });
             });
         });
index 25ef206..ccd539f 100644 (file)
@@ -31,12 +31,18 @@ export class PrintService {
 
     onPrintRequest$: EventEmitter<PrintRequest>;
 
+    // Emitted after a print request has been delivered to Hatch or
+    // window.print() has completed.  Note window.print() returning
+    // is not necessarily an indication the job has completed.
+    printJobQueued$: EventEmitter<PrintRequest>;
+
     constructor(
         private locale: LocaleService,
         private auth: AuthService,
         private store: StoreService
     ) {
         this.onPrintRequest$ = new EventEmitter<PrintRequest>();
+               this.printJobQueued$ = new EventEmitter<PrintRequest>();
     }
 
     print(printReq: PrintRequest) {