-import {Component, OnInit, Renderer2} from '@angular/core';
+import {Component, OnInit, AfterViewInit, Directive, ElementRef, Renderer2} from '@angular/core';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {StringComponent} from '@eg/share/string/string.component';
import {Router} from '@angular/router';
@Component({
export class StaffSplashComponent implements OnInit {
+ @ViewChild('noPermissionString', { static: true }) noPermissionString: StringComponent;
catSearchQuery: string;
constructor(
private renderer: Renderer2,
- private router: Router
+ private pcrud: PcrudService,
+ private auth: AuthService,
+ private org: OrgService,
+ private router: Router,
+ private toast: ToastService
) {}
ngOnInit() {
- // Focus catalog search form
- this.renderer.selectRootElement('#catalog-search-input').focus();
+ // munge the results so that we don't need to
+ // care if there are gaps in the page_col or col_pos
+ // sequences
+ filteredPortalEntries.forEach((col) => {
+ if (col !== undefined) {
+ const filtered = col.filter(x => x !== undefined);
+ this.portalEntries.push(filtered);
+ filtered.forEach((entry) => {
+ if (entry.entry_type() === 'header') {
+ this.portalHeaders[this.portalEntries.length - 1] = entry;
+ }
+ });
+ }
+ });
+ // supply an empty header entry in case a column was
+ // defined without a header
+ this.portalEntries.forEach((col, i) => {
+ if (this.portalHeaders.length <= i) {
+ this.portalHeaders[i] = undefined;
+ }
+ });
+ }
+ );
+
+ if (this.router.url === '/staff/no_permission') {
+ this.noPermissionString.current()
+ .then(str => {
+ this.toast.danger(str);
+ this.router.navigate(['/staff']);
+ });
+ }
}
searchCatalog(): void {