<option value='' [disabled]="true" i18n>Basket Actions...</option>
<option value="view" i18n>View Basket</option>
<option value="hold" [disabled]="true" i18n>Place Hold</option>
- <option value="print" [disabled]="true" i18n>Print Title Details</option>
- <option value="email" [disabled]="true" i18n>Email Title Details</option>
+ <option value="print" i18n>Print Title Details</option>
+ <option value="email" i18n>Email Title Details</option>
<option value="bucket" i18n>Add Basket to Bucket</option>
<option value="clear" i18n>Clear Basket</option>
</select>
import {BasketService} from '@eg/share/catalog/basket.service';
import {Subscription} from 'rxjs/Subscription';
import {Router} from '@angular/router';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PrintService} from '@eg/share/print/print.service';
import {RecordBucketDialogComponent}
from '@eg/staff/share/buckets/record-bucket-dialog.component';
constructor(
private router: Router,
+ private net: NetService,
+ private auth: AuthService,
+ private printer: PrintService,
private basket: BasketService
) {
this.basketAction = '';
return this.basket.recordCount();
}
+ // TODO: confirmation dialogs?
+
applyAction() {
console.debug('Performing basket action', this.basketAction);
this.basket.removeAllRecordIds();
break;
+ case 'print':
+ this.basket.getRecordIds().then(ids => {
+ this.net.request(
+ 'open-ils.search',
+ 'open-ils.search.biblio.record.print', ids
+ ).subscribe(
+ at_event => {
+ // check for event..
+ const html = at_event.template_output().data();
+ this.printer.print({
+ text: html,
+ printContext: 'default'
+ });
+ }
+ );
+ });
+ break;
+
+ case 'email':
+ this.basket.getRecordIds().then(ids => {
+ this.net.request(
+ 'open-ils.search',
+ 'open-ils.search.biblio.record.email',
+ this.auth.token(), ids
+ ).toPromise(); // fire-and-forget
+ });
+ break;
+
case 'bucket':
this.basket.getRecordIds().then(ids => {
this.addToBucketDialog.recordId = ids;