From: Bill Erickson Date: Tue, 10 Nov 2020 17:04:39 +0000 (-0500) Subject: LP1901930 SIP account admin UI WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fa99d7c495b19b0c1500fddc20a0c9550db36f42;p=working%2FEvergreen.git LP1901930 SIP account admin UI WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.html index a0aa75590a..ad1357a1e8 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.html @@ -4,15 +4,8 @@ - + - diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.ts index 01889900b6..adea861b6e 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account-list.component.ts @@ -52,5 +52,9 @@ export class SipAccountListComponent implements OnInit { openAccount(row: any) { this.router.navigate([`/staff/admin/server/sip/account/${row.id()}`]); } + + deleteSelected(rows: any[]) { + // TODO + } } diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html index a395f1e84e..ae35b9afee 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html @@ -1,2 +1,20 @@ + + +
+
+ + + + + + + + +
+
-account diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts index 5e17854e81..32584d4562 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts @@ -1,4 +1,7 @@ import {Component, Input, ViewChild, OnInit} from '@angular/core'; +import {ActivatedRoute} from '@angular/router'; +import {Observable, of} from 'rxjs'; +import {map} from 'rxjs/operators'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {OrgService} from '@eg/core/org.service'; import {AuthService} from '@eg/core/auth.service'; @@ -8,14 +11,60 @@ import {StringComponent} from '@eg/share/string/string.component'; import {StringService} from '@eg/share/string/string.service'; import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; -import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; +import {ComboboxEntry, ComboboxComponent} from '@eg/share/combobox/combobox.component'; @Component({ templateUrl: './account.component.html' }) export class SipAccountComponent implements OnInit { + accountId: number; + account: IdlObject; + usrCboxSource: (term: string) => Observable; + usrCboxEntries: ComboboxEntry[]; + usrId: number; + + //@ViewChild() usrCbox: ComboboxComponent; + + constructor( + private route: ActivatedRoute, + private pcrud: PcrudService + ) {} + ngOnInit() { + this.route.paramMap.subscribe(map => { + this.accountId = Number(map.get('id')); + this.loadAccount(); + }); + + this.usrCboxSource = term => { + return this.pcrud.search('au', + { '-or': [ + {id: this.account.usr().id()}, + {usrname: {'ilike': `%${term}%`}} + ], + }, + {order_by: {au: 'usrname'}} + ).pipe(map(user => { + return {id: user.id(), label: user.usrname()}; + })); + }; + } + + loadAccount() { + this.pcrud.retrieve('sipacc', this.accountId, { + flesh: 1, + flesh_fields: {sipacc: ['usr', 'setting_group', 'workstation']} + }).subscribe(acc => { + this.account = acc; + this.usrId = acc.usr().id(); + this.usrCboxEntries = + [{id: acc.usr().id(), label: acc.usr().usrname()}]; + }); + } + + accountSaved() { + this.loadAccount(); } }