]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record.component.ts
LP#1779158 Ang6 Vandelay UI Port
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / cat / vandelay / queued-record.component.ts
1 import {Component, OnInit, ViewChild} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';              
3 import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
4
5 @Component({
6   templateUrl: 'queued-record.component.html'
7 })
8 export class QueuedRecordComponent {
9
10     queueId: number;
11     queueType: string;
12     recordId: number;
13     recordTab: string;
14
15     constructor(
16         private router: Router,
17         private route: ActivatedRoute) {
18
19         this.route.paramMap.subscribe((params: ParamMap) => {                  
20             this.queueId = +params.get('id');
21             this.recordId = +params.get('recordId');
22             this.queueType = params.get('qtype');
23             this.recordTab = params.get('recordTab');
24         });
25     }
26
27     // Changing a tab in the UI means changing the route.
28     // Changing the route ultimately results in changing the tab.
29     onTabChange(evt: NgbTabChangeEvent) {
30         this.recordTab = evt.nextId;
31
32         // prevent tab changing until after route navigation
33         evt.preventDefault();
34
35         const url = 
36           `/staff/cat/vandelay/queue/${this.queueType}/${this.queueId}` +
37           `/record/${this.recordId}/${this.recordTab}`;
38
39         this.router.navigate([url]);
40     }
41 }
42