staff portal: start making splash page dynamic
authorGalen Charlton <gmc@equinoxOLI.org>
Mon, 2 Aug 2021 23:06:44 +0000 (19:06 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Wed, 1 Sep 2021 18:42:30 +0000 (14:42 -0400)
TODO: multi-dimensional array won't handle gaps well

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/splash.component.html
Open-ILS/src/eg2/src/app/staff/splash.component.ts

index 450a3e5..16389b7 100644 (file)
   </div>
 
   <div class="row" id="splash-nav">
+    <div class="col-lg-4" *ngFor="let col of portalEntries">
+      <div class="card">
+        <ng-container *ngFor="let entry of col">
+          <div class="card-header" *ngIf="entry.entry_type() === 'header'">
+            <h2 class="panel-title text-center" i18n>{{entry.label()}}</h2>
+          </div>
+          <div class="list-group-item border-0 p-2" *ngIf="entry.entry_type() === 'menuitem'">
+             <a href="{{entry.target_url()}}" i18n>
+               <img src="{{entry.image_url()}}" alt="" role="presentation"/>
+               {{entry.label()}}
+             </a>
+           </div>
+        </ng-container>
+      </div>
+    </div>
+  </div>
+
+  <div class="row" id="splash-nav">
     <div class="col-lg-4">
       <div class="card">
         <div class="card-header">
index 6756b65..a847c3f 100644 (file)
@@ -1,4 +1,5 @@
 import {Component, OnInit, Renderer2} from '@angular/core';
+import {PcrudService} from '@eg/core/pcrud.service';
 import {Router} from '@angular/router';
 
 @Component({
@@ -8,14 +9,24 @@ import {Router} from '@angular/router';
 export class StaffSplashComponent implements OnInit {
 
     catSearchQuery: string;
+    portalEntries: any[][] = [];
 
     constructor(
         private renderer: Renderer2,
+        private pcrud: PcrudService,
         private router: Router
     ) {}
 
     ngOnInit() {
 
+        this.pcrud.search('cusppe', {owner: 1}).subscribe(item => {
+            const page_col = item.page_col() - 1;
+            if (this.portalEntries[page_col] === undefined) {
+                this.portalEntries[page_col] = [];
+            }
+            this.portalEntries[page_col][item.col_pos()] = item;
+        });
+
         // Focus catalog search form
         this.renderer.selectRootElement('#catalog-search-input').focus();
     }