LP1816475: Pull list screen complete
authorJane Sandberg <sandbej@linnbenton.edu>
Sat, 6 Apr 2019 01:29:18 +0000 (18:29 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 17 Apr 2019 20:41:53 +0000 (13:41 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.html
Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.ts
Open-ILS/src/eg2/src/app/staff/nav.component.html
Open-ILS/src/templates/staff/navbar.tt2

index af326d9..2152be0 100644 (file)
@@ -1,4 +1,3 @@
-{{dataSource | json }}
 <eg-staff-banner bannerText="Booking Pull List" i18n-bannerText>
 </eg-staff-banner>
 <eg-title i18n-prefix i18n-suffix prefix="Booking" suffix="Pull List"></eg-title>
@@ -9,7 +8,9 @@
       <div class="input-group-prepend">
         <label for="ou" class="input-group-text" i18n>Library:</label>
       </div>
-      <eg-org-select domId="ou" [applyDefault]="true" (onChange)="fill_grid()">
+      <eg-org-select domId="ou" [applyDefault]="true"
+        (onChange)="fill_grid($event.id())"
+        [disableOrgs]="disableOrgs()" [hideOrgs]="disableOrgs()">
       </eg-org-select>
     </div>
   </div>
     </div>
   </div>
 </div>
-<eg-grid [dataSource]="dataSource"
-  [sortable]="true" persistKey="booking.pull_list" >
+<eg-grid [dataSource]="dataSource" [useLocalSort]="true"
+  [sortable]="true" persistKey="booking.pull_list">
   <eg-grid-column name="id" [hidden]="true" [index]="true" i18n-label label="ID" path="id"></eg-grid-column>
+  <eg-grid-column label="Shelving location" path="shelving_location" i18n-label></eg-grid-column>
+  <eg-grid-column label="Call number" path="call_number" i18n-label></eg-grid-column>
+  <eg-grid-column label="Call number sortkey" path="call_number_sortkey" i18n-label></eg-grid-column>
   <eg-grid-column name="barcode" label="Barcode" i18n-label path="current_resource.barcode"></eg-grid-column>
   <eg-grid-column name="title" label="Title or name" i18n-label path="target_resource_type.name"></eg-grid-column>
   <eg-grid-column label="Reservation start time" [datePlusTime]="true" path="reservations.0.start_time" i18n-label></eg-grid-column>
index 11a13a2..e8d63e8 100644 (file)
@@ -1,41 +1,63 @@
 import { Component, Input, OnInit } from '@angular/core';
-import { GridDataSource } from '@eg/share/grid/grid';
+import { Observable } from 'rxjs'
+import { AuthService } from '@eg/core/auth.service';
+import { GridColumn, GridDataSource } from '@eg/share/grid/grid';
+import {IdlObject} from '@eg/core/idl.service';
 import { NetRequest, NetService } from '@eg/core/net.service';
+import {OrgService} from '@eg/core/org.service';
 import { Pager } from '@eg/share/util/pager';
-import { AuthService } from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+
 
 @Component({
-  selector: 'eg-pull-list',
-  templateUrl: './pull-list.component.html'
+    templateUrl: './pull-list.component.html'
 })
 
 export class PullListComponent implements OnInit {
-  @Input( ) daysHence: number;
-
-  public dataSource: GridDataSource;
-  private auth: AuthService;
-
-  constructor(
-    private net: NetService,
-    egAuth: AuthService
-  ) {
-    this.auth = egAuth;
-    this.daysHence = 5;
-  }
-
-  fill_grid () {
-    this.net.request(
-      'open-ils.booking', 'open-ils.booking.reservations.get_pull_list',
-      this.auth.token(), null,
-      (86400 * this.daysHence), // convert seconds to days
-      4
-    ).subscribe( data => {
-      this.dataSource.data = data;
-    });
-  }
-
-  ngOnInit() {
-    this.dataSource = new GridDataSource();
-    this.fill_grid();
-  }
+    public daysHence = 5;
+    public dataSource: GridDataSource;
+
+    public disableOrgs: () => number[];
+    public fill_grid: (orgId?: number) => void;
+
+    constructor(
+        private auth: AuthService,
+        private net: NetService,
+        private org: OrgService,
+        private pcrud: PcrudService
+    ) { }
+
+
+    ngOnInit() {
+        this.disableOrgs = () => {return this.org.filterList({canHaveVolumes : false}, true);}
+
+        this.fill_grid = (orgId = this.auth.user().ws_ou()) => {
+            this.net.request(
+                'open-ils.booking', 'open-ils.booking.reservations.get_pull_list',
+                this.auth.token(), null,
+                (86400 * this.daysHence), // convert seconds to days
+                orgId
+            ).subscribe( data => {
+                data.forEach(resource => { // shouldn't this be streamable?
+                    if (resource['target_resource_type'].catalog_item()) {
+                        this.pcrud.search('acp', {
+                                'barcode': resource['current_resource'].barcode()
+                            }, {
+                                limit: 1,
+                                flesh: 1,
+                                flesh_fields: {'acp' : ['call_number', 'location' ]}
+                        }).subscribe( (acp) => {
+                            resource['call_number'] = acp.call_number().label();
+                            resource['call_number_sortkey'] = acp.call_number().label_sortkey();
+                            resource['shelving_location'] = acp.location().name();
+                        });
+                    }
+                });
+                this.dataSource.data = data;
+            });
+        }
+        this.dataSource = new GridDataSource();
+        this.fill_grid(this.auth.user().ws_ou());
+    }
 }
+
index 0fab3aa..e710c34 100644 (file)
             <span class="material-icons">add</span>
             <span i18n>Create Reservations</span>
           </a>
-          <a class="dropdown-item" href="/eg/staff/booking/legacy/booking/pull_list">
+          <a class="dropdown-item" href="staff/booking/pull_list">
             <span class="material-icons">list</span>
             <span i18n>Pull List</span>
           </a>
index 7ed79f1..226e12b 100644 (file)
             </a>
           </li>
           <li>
-            <a href="./booking/legacy/booking/pull_list" target="_self">
+            <a href="/eg2/staff/booking/pull_list" target="_self">
               <span class="glyphicon glyphicon-th-list"></span>
               [% l('Pull List') %]
             </a>