basket list display wip
authorBill Erickson <berickxx@gmail.com>
Tue, 13 Nov 2018 19:52:34 +0000 (14:52 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 30 Nov 2018 16:34:20 +0000 (11:34 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.html
Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
Open-ILS/src/eg2/src/app/staff/catalog/routing.module.ts

index be1f5bb..2485a39 100644 (file)
@@ -10,6 +10,7 @@
   </div>
   <div class="col-lg-8 pl-1">
     <select class="form-control" 
+        [disabled]="!basketCount()"
         [(ngModel)]="basketAction" (change)="applyAction()">
       <option value='' [disabled]="true" i18n>Basket Actions...</option>
       <option value="view" i18n>View Basket</option>
@@ -17,7 +18,7 @@
       <option value="print"  [disabled]="true" i18n>Print Title Details</option>
       <option value="email"  [disabled]="true" i18n>Email Title Details</option>
       <option value="bucket" [disabled]="true" i18n>Add Basket to Bucket</option>
-      <option value="clear"  [disabled]="true" i18n>Clear Bucket</option>
+      <option value="clear"  [disabled]="true" i18n>Clear Basket</option>
     </select>
   </div>
 </div>
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.html
new file mode 100644 (file)
index 0000000..7a64033
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="row">
+  <div class="col-lg-4">
+    <h3 i18n>Basket View</h3>
+  </div>
+  <div class="col-lg-8">
+    <div class="float-right">
+      <eg-catalog-result-pagination></eg-catalog-result-pagination>
+    </div>
+  </div>
+</div>
+<div class="row" 
+    *ngFor="let summary of searchContext.result.records; let idx = index">
+  <div class="col-lg-12">
+    <ng-container *ngIf="summary">
+      <eg-catalog-result-record [summary]="summary" [index]="idx">
+      </eg-catalog-result-record>
+    </ng-container>
+  </div>
+</div>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/basket/basket.component.ts
new file mode 100644 (file)
index 0000000..50affa8
--- /dev/null
@@ -0,0 +1,60 @@
+import {Component, OnInit, OnDestroy, Input} from '@angular/core';
+import {Router} from '@angular/router';
+import {Observable} from 'rxjs/Observable';
+import {Subscription} from 'rxjs/Subscription';
+import {BibRecordService} from '@eg/share/catalog/bib-record.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+import {StaffCatalogService} from '../catalog.service';
+import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
+import {BasketService} from '@eg/share/catalog/basket.service';
+
+@Component({
+  selector: 'eg-catalog-basket',
+  templateUrl: 'basket.component.html'
+})
+export class BasketComponent implements OnInit, OnDestroy {
+
+    searchContext: CatalogSearchContext;
+
+    constructor(
+        private router: Router,
+        private bib: BibRecordService,
+        private cat: CatalogService,
+        private staffCat: StaffCatalogService,
+        private basket: BasketService
+    ) {}
+
+    ngOnInit() {
+        this.searchContext = this.staffCat.searchContext;
+
+        this.basket.getRecordIds().then(ids => {
+
+            // Bypass the standard catalog search by providing a 
+            // search result object of our own.
+            // Map our list of IDs into a search results object
+            // the search context can understand.
+            const result = {
+                count: ids.length,
+                ids: ids.map(id => [id])
+            };
+
+            this.searchContext.reset();
+            this.cat.applyResultData(this.searchContext, result);
+            this.cat.fetchBibSummaries(this.searchContext)
+                .then(ok => this.fleshSearchResults());
+
+        });
+    }
+
+    ngOnDestroy() {
+    }
+
+    fleshSearchResults(): void {
+        const records = this.searchContext.result.records;
+        if (!records || records.length === 0) { return; }
+        // Flesh the creator / editor fields with the user object.
+        this.bib.fleshBibUsers(records.map(r => r.record));
+    }
+}
+
+
index e490da2..172a829 100644 (file)
@@ -15,6 +15,7 @@ import {RecordPaginationComponent} from './record/pagination.component';
 import {RecordActionsComponent} from './record/actions.component';
 import {HoldingsService} from '@eg/staff/share/holdings.service';
 import {BasketActionsComponent} from './basket-actions.component';
+import {BasketComponent} from './basket/basket.component';
 
 @NgModule({
   declarations: [
@@ -28,7 +29,8 @@ import {BasketActionsComponent} from './basket-actions.component';
     ResultPaginationComponent,
     RecordPaginationComponent,
     RecordActionsComponent,
-    BasketActionsComponent
+    BasketActionsComponent,
+    BasketComponent
   ],
   imports: [
     StaffCommonModule,
index 0e3c96f..d92bcf6 100644 (file)
@@ -4,6 +4,7 @@ import {CatalogComponent} from './catalog.component';
 import {ResultsComponent} from './result/results.component';
 import {RecordComponent} from './record/record.component';
 import {CatalogResolver} from './resolver.service';
+import {BasketComponent} from './basket/basket.component';
 
 const routes: Routes = [{
   path: '',
@@ -13,6 +14,9 @@ const routes: Routes = [{
     path: 'search',
     component: ResultsComponent
   }, {
+    path: 'basket',
+    component: BasketComponent
+  }, {
     path: 'record/:id',
     component: RecordComponent
   }, {