lp1793241: porting booking pull list to angular user/sandbergja/lp1793241-wip
authorJane Sandberg <sandbej@linnbenton.edu>
Sun, 2 Dec 2018 15:50:19 +0000 (07:50 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Sun, 2 Dec 2018 15:50:19 +0000 (07:50 -0800)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/routing.module.ts

diff --git a/Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.component.html b/Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.component.html
new file mode 100644 (file)
index 0000000..daa9f09
--- /dev/null
@@ -0,0 +1,26 @@
+{{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/pull-list.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.component.ts
new file mode 100644 (file)
index 0000000..e722afa
--- /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();
+  }
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.module.ts b/Open-ILS/src/eg2/src/app/staff/booking/pull-list/pull-list.module.ts
new file mode 100644 (file)
index 0000000..489f702
--- /dev/null
@@ -0,0 +1,20 @@
+import {NgModule} from '@angular/core';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {BookingRoutingModule} from '../routing.module';
+import {PullListComponent} from './pull-list.component';
+
+@NgModule({
+  declarations: [
+    PullListComponent
+  ],
+  imports: [
+    StaffCommonModule,
+    BookingRoutingModule,
+  ],
+  providers: [
+  ]
+})
+
+export class PullListModule {
+
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/booking/routing.module.ts
new file mode 100644 (file)
index 0000000..6de91de
--- /dev/null
@@ -0,0 +1,19 @@
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {PullListComponent} from './pull-list/pull-list.component';
+
+const routes: Routes = [
+  {
+    path: 'pull_list',
+    component: PullListComponent
+  }
+
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule],
+  providers: []
+})
+
+export class BookingRoutingModule {}
index b515f38..f15900f 100644 (file)
@@ -37,6 +37,9 @@ const routes: Routes = [{
     path: 'sandbox',
     loadChildren : '@eg/staff/sandbox/sandbox.module#SandboxModule'
   }, {
+    path: 'booking',
+    loadChildren : '@eg/staff/booking/routing.module#BookingRoutingModule'
+  }, {
     path: 'admin',
     loadChildren : '@eg/staff/admin/routing.module#AdminRoutingModule'
   }]