From: Bill Erickson Date: Fri, 24 Jun 2022 19:02:30 +0000 (-0400) Subject: LP1840773 SCKO Angular X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=462524abf33be03317ee4fe616d1a1e147cdf4e3;p=working%2FEvergreen.git LP1840773 SCKO Angular Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/scko/scko.component.html b/Open-ILS/src/eg2/src/app/scko/scko.component.html index ebec821fbf..1b8360ac60 100644 --- a/Open-ILS/src/eg2/src/app/scko/scko.component.html +++ b/Open-ILS/src/eg2/src/app/scko/scko.component.html @@ -1,6 +1,17 @@ + + + + +
+
+
{{scko.statusDisplayText}}
+
+
+
@@ -19,6 +30,8 @@ cancelButtonText="Logout"> + + diff --git a/Open-ILS/src/eg2/src/app/scko/scko.component.ts b/Open-ILS/src/eg2/src/app/scko/scko.component.ts index 7da2bcf835..1cea153b4e 100644 --- a/Open-ILS/src/eg2/src/app/scko/scko.component.ts +++ b/Open-ILS/src/eg2/src/app/scko/scko.component.ts @@ -5,6 +5,7 @@ import {NetService} from '@eg/core/net.service'; import {SckoService} from './scko.service'; import {ServerStoreService} from '@eg/core/server-store.service'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; +import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; @Component({ templateUrl: 'scko.component.html', @@ -15,6 +16,7 @@ import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; export class SckoComponent implements OnInit, AfterViewInit { @ViewChild('logoutDialog') logoutDialog: ConfirmDialogComponent; + @ViewChild('alertDialog') alertDialog: ConfirmDialogComponent; constructor( private router: Router, @@ -35,6 +37,7 @@ export class SckoComponent implements OnInit, AfterViewInit { ngAfterViewInit() { this.scko.logoutDialog = this.logoutDialog; + this.scko.alertDialog = this.alertDialog; } } diff --git a/Open-ILS/src/eg2/src/app/scko/scko.module.ts b/Open-ILS/src/eg2/src/app/scko/scko.module.ts index 67ebe36a80..da4f188a14 100644 --- a/Open-ILS/src/eg2/src/app/scko/scko.module.ts +++ b/Open-ILS/src/eg2/src/app/scko/scko.module.ts @@ -32,7 +32,8 @@ import {SckoFinesComponent} from './fines.component'; SckoRoutingModule ], providers: [ - SckoService + SckoService, + AudioService ] }) diff --git a/Open-ILS/src/eg2/src/app/scko/scko.service.ts b/Open-ILS/src/eg2/src/app/scko/scko.service.ts index c3c8e28f7c..c5a215fe05 100644 --- a/Open-ILS/src/eg2/src/app/scko/scko.service.ts +++ b/Open-ILS/src/eg2/src/app/scko/scko.service.ts @@ -8,7 +8,10 @@ import {IdlService, IdlObject} from '@eg/core/idl.service'; import {StoreService} from '@eg/core/store.service'; import {PatronService, PatronSummary, PatronStats} from '@eg/staff/share/patron/patron.service'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; +import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; import {PrintService} from '@eg/share/print/print.service'; +import {AudioService} from '@eg/share/util/audio.service'; +import {StringService} from '@eg/share/string/string.service'; interface CheckoutStat { override?: boolean; @@ -27,11 +30,16 @@ export class SckoService { patronTimeoutId: number; logoutWarningTimeout = 20; logoutWarningTimerId: number; + statusDisplayText = ''; + + alertAudio = false; + alertPopup = false; sessionCheckouts: any[] = []; // We get this from the main scko component. logoutDialog: ConfirmDialogComponent; + alertDialog: AlertDialogComponent; constructor( private router: Router, @@ -41,6 +49,8 @@ export class SckoService { private evt: EventService, public auth: AuthService, private printer: PrintService, + private audio: AudioService, + private strings: StringService, private patrons: PatronService, ) {} @@ -83,6 +93,9 @@ export class SckoService { this.patronPasswordRequired = sets['circ.selfcheck.patron_password_required']; + this.alertAudio = sets['circ.selfcheck.alert.sound']; + this.alertPopup = sets['circ.selfcheck.alert.popup']; + this.patronIdleTimeout = Number(sets['circ.selfcheck.patron_login_timeout'] || 160); @@ -265,6 +278,24 @@ export class SckoService { }); } + notifyPatron(text: string, sound: string, popup?: boolean, stringArgs?: any) { + this.statusDisplayText = ''; + + if (this.alertAudio && sound) { + this.audio.play(sound); + } + + if (!text) { return; } + + this.strings.interpolate(text, stringArgs).then(str => { + this.statusDisplayText = str; + + if (this.alertPopup && popup && str) { + this.alertDialog.dialogBody = str; + this.alertDialog.open().toPromise(); + } + }); + } handleCheckoutResult(result: any, barcode: string, action: string): Promise { @@ -281,19 +312,17 @@ export class SckoService { return; } - if (evt.textcode === 'SUCCESS') { - - if (action === 'checkout') { + let alertText = ''; + let alertSound = ''; - return Promise.resolve({}); - - } else if (action === 'renew') { - - return Promise.resolve({}); - } + if (evt.textcode === 'SUCCESS') { + alertText = `scko.${action}.success`; + alertSound = `success.scko.${action}`; + this.notifyPatron; + return Promise.resolve({}); } - return Promise.resolve({}); // TODO + return Promise.resolve({}); } } diff --git a/Open-ILS/web/audio/notifications/error/scko/error.wav b/Open-ILS/web/audio/notifications/error/scko/error.wav new file mode 100644 index 0000000000..76c4ecfb45 Binary files /dev/null and b/Open-ILS/web/audio/notifications/error/scko/error.wav differ diff --git a/Open-ILS/web/audio/notifications/success/scko/success.wav b/Open-ILS/web/audio/notifications/success/scko/success.wav new file mode 100644 index 0000000000..eb83e16393 Binary files /dev/null and b/Open-ILS/web/audio/notifications/success/scko/success.wav differ