From a7648627377a02e3f49cc1d11ed3e3b41b8ee881 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 26 Mar 2020 14:14:10 -0400 Subject: [PATCH] new provder modal Signed-off-by: Galen Charlton --- .../staff/acq/provider/acq-provider.component.html | 19 +++++++++++-- .../staff/acq/provider/acq-provider.component.ts | 31 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html index 8a92b77cc8..e5a41537b9 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html @@ -1,5 +1,7 @@ + +
@@ -12,8 +14,15 @@
- - +
@@ -66,3 +75,9 @@
+ + + diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts index 7f189061f7..daecf55b94 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts @@ -6,6 +6,10 @@ import {IdlService, IdlObject} from '@eg/core/idl.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AcqProviderSummaryPaneComponent} from './summary-pane.component'; import {ProviderRecordService} from './provider-record.service'; +import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; +import {StringComponent} from '@eg/share/string/string.component'; +import {ToastService} from '@eg/share/toast/toast.service'; +import {AuthService} from '@eg/core/auth.service'; @Component({ templateUrl: './acq-provider.component.html' @@ -19,6 +23,9 @@ export class AcqProviderComponent implements OnInit, AfterViewInit { validTabTypes = ['details', 'addresses', 'contacts', 'attributes', 'holdings', 'edi_accounts', 'purchase_orders', 'invoices']; defaultTabType = 'details'; @ViewChild('acqSearchProviderSummary', { static: true }) providerSummaryPane: AcqProviderSummaryPaneComponent; + @ViewChild('createDialog', { static: true }) createDialog: FmRecordEditorComponent; + @ViewChild('createString', { static: false }) createString: StringComponent; + @ViewChild('createErrString', { static: false }) createErrString: StringComponent; onTabChange: ($event: NgbTabChangeEvent) => void; @@ -27,9 +34,11 @@ export class AcqProviderComponent implements OnInit, AfterViewInit { constructor( private router: Router, private route: ActivatedRoute, + private auth: AuthService, private pcrud: PcrudService, private idl: IdlService, private providerRecord: ProviderRecordService, + private toast: ToastService, ) { } @@ -82,4 +91,26 @@ export class AcqProviderComponent implements OnInit, AfterViewInit { ngAfterViewInit() {} + createNew() { + this.createDialog.mode = 'create'; + const provider = this.idl.create('acqpro'); + provider.active(true); + provider.owner(this.auth.user().ws_ou()); + provider.default_copy_count(1); + this.createDialog.record = provider; + this.createDialog.recordId = null; + this.createDialog.open({size: 'lg'}).subscribe( + ok => { + this.createString.current() + .then(str => this.toast.success(str)); + this.onDesireSummarize(ok.id()); + }, + rejection => { + if (!rejection.dismissed) { + this.createErrString.current() + .then(str => this.toast.danger(str)); + } + } + ); + } } -- 2.11.0