Adding basic pull list
authorJane Sandberg <sandbej@linnbenton.edu>
Sun, 9 Dec 2018 00:01:02 +0000 (16:01 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Sun, 20 Jan 2019 02:01:51 +0000 (18:01 -0800)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/booking.module.ts
Open-ILS/src/eg2/src/app/staff/booking/current-reservations.component.ts
Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts

index baddf75..38b09a1 100644 (file)
@@ -2,13 +2,14 @@ import {NgModule} from '@angular/core';
 import {StaffCommonModule} from '@eg/staff/common.module';
 import {BookingRoutingModule} from './routing.module';
 import {CurrentReservationsComponent} from './current-reservations.component';
+import {PullListComponent} from './pull-list.component';
 
 @NgModule({
   imports: [
     StaffCommonModule,
     BookingRoutingModule,
   ],
-  declarations: [CurrentReservationsComponent]
+  declarations: [CurrentReservationsComponent, PullListComponent]
 })
 export class BookingModule { }
 
index 488124c..d6c9503 100644 (file)
@@ -3,7 +3,6 @@ import { Component, OnInit } from '@angular/core';
 @Component({
   selector: 'eg-current-reservations',
   templateUrl: './current-reservations.component.html',
-  styleUrls: ['./current-reservations.component.css']
 })
 export class CurrentReservationsComponent implements OnInit {
 
diff --git a/Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.html b/Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.html
new file mode 100644 (file)
index 0000000..ff10a81
--- /dev/null
@@ -0,0 +1,27 @@
+{{dataSource | json }}
+<eg-staff-banner bannerText="Booking Pull List" i18n-bannerText>
+</eg-staff-banner>
+<div class="row">
+  <div class="col-md-4">
+    <label for="ou" i18n>Library:</label>
+    <eg-org-select id="ou" [applyDefault]="true" (onChange)="fill_grid()">
+    </eg-org-select>
+  </div>
+  <div class="col-md-4">
+    <label for="days-hence" i18n>Number of days to fetch:</label>
+    <input type="number" class="form-control" id="days-hence" [(ngModel)]="daysHence" (ngModelChange)="fill_grid()">
+  </div>
+</div>
+<eg-grid [dataSource]="dataSource"
+  [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 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" path="reservations.0.start_time" i18n-label></eg-grid-column>
+  <eg-grid-column label="Reservation end time" path="reservations.0.end_time" i18n-label></eg-grid-column>
+  <eg-grid-column label="Reservation end time" path="reservations.0.end_time" i18n-label></eg-grid-column>
+  <eg-grid-column label="Patron first name" path="reservations.0.usr.first_given_name" i18n-label></eg-grid-column>
+  <eg-grid-column label="Patron last name" path="reservations.0.usr.family_name" i18n-label></eg-grid-column>
+
+</eg-grid>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/pull-list.component.ts
new file mode 100644 (file)
index 0000000..3171ae1
--- /dev/null
@@ -0,0 +1,41 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { GridDataSource } from '@eg/share/grid/grid';
+import { NetRequest, NetService } from '@eg/core/net.service';
+import { Pager } from '@eg/share/util/pager';
+import { AuthService } from '@eg/core/auth.service';
+
+@Component({
+  selector: 'eg-pull-list',
+  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();
+  }
+}
index b778137..edbf957 100644 (file)
@@ -1,11 +1,16 @@
 import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
 import { CurrentReservationsComponent } from './current-reservations.component';
+import { PullListComponent } from './pull-list.component';
 
 const routes: Routes = [{
   path: 'current_reservations',
   component: CurrentReservationsComponent
-}];
+  },{
+  path: 'pull_list',
+  component: PullListComponent
+  },
+  ];
 
 @NgModule({
   imports: [RouterModule.forChild(routes)],