From: Galen Charlton Date: Mon, 20 Jan 2020 23:01:05 +0000 (-0500) Subject: implement save search as default button X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fea8a69fe522e843698789588250377c7b2b601c;p=working%2FEvergreen.git implement save search as default button Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html index 0580d41a39..3a5e477f1f 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html @@ -72,7 +72,11 @@
- + +
+
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts index c745c01151..2ef2da401c 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts @@ -5,6 +5,7 @@ import {StaffCommonModule} from '@eg/staff/common.module'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AcqSearchTerm} from './acq-search.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; @Component({ selector: 'eg-acq-search-form', @@ -15,6 +16,7 @@ import {AcqSearchTerm} from './acq-search.service'; export class AcqSearchFormComponent implements OnInit, AfterViewInit { @Input() initialSearchTerms: AcqSearchTerm[] = []; + @Input() defaultSearchSetting = ''; @Output() searchSubmitted = new EventEmitter(); @@ -31,6 +33,7 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit { private router: Router, private route: ActivatedRoute, private pcrud: PcrudService, + private store: ServerStoreService, private idl: IdlService, ) {} @@ -77,7 +80,16 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit { this.searchTerms = JSON.parse(JSON.stringify(this.initialSearchTerms)); // deep copy this.submitSearch(); } else { - this.addSearchTerm(); + this.store.getItem(this.defaultSearchSetting).then( + defaultSearch => { + if (defaultSearch) { + this.searchTerms = JSON.parse(JSON.stringify(defaultSearch)); + this.submitSearch(); + } else { + this.addSearchTerm(); + } + } + ); } } @@ -118,4 +130,8 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit { submitSearch() { this.searchSubmitted.emit(this.searchTerms); } + + saveSearchAsDefault() { + return this.store.setItem(this.defaultSearchSetting, this.searchTerms); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html index 0f778bc50d..e85c382d29 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html @@ -1,4 +1,4 @@ - + + + diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html index b9e83a525d..6ee6bda227 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html @@ -1,4 +1,4 @@ - +