LP1840773 SCKO Angular
authorBill Erickson <berickxx@gmail.com>
Wed, 22 Jun 2022 21:31:09 +0000 (17:31 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 22 Jun 2022 21:32:08 +0000 (17:32 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/scko/holds.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/scko/holds.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/scko/items.component.ts
Open-ILS/src/eg2/src/app/scko/routing.module.ts
Open-ILS/src/eg2/src/app/scko/scko.module.ts
Open-ILS/src/eg2/src/app/scko/summary.component.html

diff --git a/Open-ILS/src/eg2/src/app/scko/holds.component.html b/Open-ILS/src/eg2/src/app/scko/holds.component.html
new file mode 100644 (file)
index 0000000..0834559
--- /dev/null
@@ -0,0 +1,27 @@
+<div id='oils-selfck-circ-table-div'>
+  <table id='oils-selfck-circ-table' class='oils-selfck-item-table'>
+    <thead>
+      <tr>
+        <td class="rounded-left" id='oils-self-circ-pic-cell'></td>
+        <td i18n>Title</td>
+        <td i18n>Author</td>
+        <td class="rounded-right" i18n>Status</td>
+      </tr>
+    </thead>
+    <tbody class='oils-selfck-item-table'>
+           <tr *ngFor="let hold of holds">
+        <td><img src="/opac/extras/ac/jacket/small/r/{{hold.record_id}}"/></td>
+        <td>{{hold.title}}</td>
+        <td>{{hold.author}}</td>
+        <td>
+          <ng-container *ngIf="hold.hold_status == 4" i18n>
+            Ready for Pickup
+          </ng-container>
+          <ng-container *ngIf="hold.hold_status != 4" i18n>
+            #{{hold.relative_queue_position}} in line with {{hold.potentials}} copie(s)
+          </ng-container>
+        </td>
+      </tr>
+    </tbody>
+  </table>
+</div>
diff --git a/Open-ILS/src/eg2/src/app/scko/holds.component.ts b/Open-ILS/src/eg2/src/app/scko/holds.component.ts
new file mode 100644 (file)
index 0000000..bed7a26
--- /dev/null
@@ -0,0 +1,63 @@
+import {Component, OnInit, ViewEncapsulation} from '@angular/core';
+import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
+import {tap} from 'rxjs/operators';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {NetService} from '@eg/core/net.service';
+import {IdlObject} from '@eg/core/idl.service';
+import {SckoService} from './scko.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
+
+@Component({
+  templateUrl: 'holds.component.html'
+})
+
+export class SckoHoldsComponent implements OnInit {
+
+    holds: IdlObject[] = [];
+
+    constructor(
+        private router: Router,
+        private route: ActivatedRoute,
+        private net: NetService,
+        private auth: AuthService,
+        private pcrud: PcrudService,
+        public  scko: SckoService
+    ) {}
+
+    ngOnInit() {
+
+        if (!this.scko.patronSummary) {
+            this.router.navigate(['/scko']);
+            return;
+        }
+
+        const orderBy = [
+           {shelf_time: {nulls: 'last'}},
+           {capture_time: {nulls: 'last'}},
+           {request_time: {nulls: 'last'}}
+        ];
+
+        const filters = {
+            usr_id: this.scko.patronSummary.id,
+            fulfillment_time: null
+        };
+
+        let first = true;
+        this.net.request(
+            'open-ils.circ',
+            'open-ils.circ.hold.wide_hash.stream',
+            this.auth.token(), filters, orderBy, 1000, 0, {}
+        ).subscribe(holdData => {
+
+            if (first) { // First response is the hold count.
+                first = false;
+                return;
+            }
+
+            this.holds.push(holdData);
+        });
+    }
+}
+
+
index 54a9186..fd76733 100644 (file)
@@ -48,16 +48,16 @@ export class SckoItemsComponent implements OnInit {
         .then(data => {
             const ids = data.out.concat(data.overdue).concat(data.long_overdue);
 
-                       return this.pcrud.search('circ', {id: ids}, {
-                               flesh: CIRC_FLESH_DEPTH,
-                               flesh_fields: CIRC_FLESH_FIELDS,
-                               order_by : {circ : 'due_date'},
+            return this.pcrud.search('circ', {id: ids}, {
+                flesh: CIRC_FLESH_DEPTH,
+                flesh_fields: CIRC_FLESH_FIELDS,
+                order_by : {circ : 'due_date'},
 
-                               select: {bre : ['id']}
+                select: {bre : ['id']}
 
-                       }).pipe(tap(circ => {
-                               this.circs.push(circ);
-                       })).toPromise();
+            }).pipe(tap(circ => {
+                this.circs.push(circ);
+            })).toPromise();
         });
     }
 
index 02e4930..82378e2 100644 (file)
@@ -3,6 +3,7 @@ import {RouterModule, Routes} from '@angular/router';
 import {SckoComponent} from './scko.component';
 import {SckoCheckoutComponent} from './checkout.component';
 import {SckoItemsComponent} from './items.component';
+import {SckoHoldsComponent} from './holds.component';
 
 const routes: Routes = [{
   path: '',
@@ -13,7 +14,10 @@ const routes: Routes = [{
   }, {
     path: 'items',
     component: SckoItemsComponent
-  }]
+   }, {
+    path: 'holds',
+    component: SckoHoldsComponent
+ }]
 }];
 
 @NgModule({
index b3823c4..6b4ef7f 100644 (file)
@@ -12,6 +12,7 @@ import {SckoBannerComponent} from './banner.component';
 import {SckoSummaryComponent} from './summary.component';
 import {SckoCheckoutComponent} from './checkout.component';
 import {SckoItemsComponent} from './items.component';
+import {SckoHoldsComponent} from './holds.component';
 
 @NgModule({
   declarations: [
@@ -20,6 +21,7 @@ import {SckoItemsComponent} from './items.component';
     SckoSummaryComponent,
     SckoCheckoutComponent,
     SckoItemsComponent,
+    SckoHoldsComponent
   ],
   imports: [
     EgCommonModule,
index 20d22b0..cdcb24a 100644 (file)
@@ -64,7 +64,7 @@
       total holds.
     </div>
     <div class="mt-2">
-      <a href='javascript:void(0);' id='oils-selfck-hold-details-link'>
+      <a routerLink="/scko/holds" id='oils-selfck-hold-details-link'>
         <button type="button" class="scko-button" i18n>View Holds</button>
       </a>
     </div>