From 4089788245d46feb8a625c6769900a2def2980ce Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 30 Mar 2021 12:55:03 -0400 Subject: [PATCH] LP1904036 post code handling / addr populating Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/edit.component.html | 4 ++++ .../src/app/staff/circ/patron/edit.component.ts | 26 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html index 73ffee8541..bcd8ba5546 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html @@ -15,6 +15,10 @@ + + +
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts index 55728cd4b8..ab855bbdfd 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts @@ -20,6 +20,7 @@ import {SecondaryGroupsDialogComponent} from './secondary-groups.component'; import {ServerStoreService} from '@eg/core/server-store.service'; import {EditToolbarComponent, VisibilityLevel} from './edit-toolbar.component'; import {PatronSearchFieldSet} from '@eg/staff/share/patron/search.component'; +import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; const COMMON_USER_SETTING_TYPES = [ 'circ.holds_behind_desk', @@ -121,6 +122,8 @@ export class EditComponent implements OnInit, AfterViewInit { private profileSelect: ProfileSelectComponent; @ViewChild('secondaryGroupsDialog') private secondaryGroupsDialog: SecondaryGroupsDialogComponent; + @ViewChild('addrAlert') private addrAlert: AlertDialogComponent; + autoId = -1; patron: IdlObject; @@ -679,6 +682,10 @@ export class EditComponent implements OnInit, AfterViewInit { // TODO address_alert(obj); break; + case 'post_code': + this.handlePostCodeChange(obj, value); + break; + case 'barcode': this.handleBarcodeChange(value); break; @@ -691,6 +698,25 @@ export class EditComponent implements OnInit, AfterViewInit { this.adjustSaveSate(); } + handlePostCodeChange(addr: IdlObject, postCode: any) { + this.net.request( + 'open-ils.search', 'open-ils.search.zip', postCode + ).subscribe(resp => { + if (!resp) return; + + ['city', 'state', 'county'].forEach(field => { + if (resp[field]) { + addr[field](resp[field]); + } + }); + + if (resp.alert) { + this.addrAlert.dialogBody = resp.alert; + this.addrAlert.open(); + } + }); + } + handleUsernameChange(value: any) { this.dupeUsername = false; -- 2.11.0