import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core';
-import {Observable, throwError} from 'rxjs';
+import {Observable} from 'rxjs';
import {switchMap, map, tap} from 'rxjs/operators';
import {IdlObject} from '@eg/core/idl.service';
-import {NetService} from '@eg/core/net.service';
-import {EventService} from '@eg/core/event.service';
import {PcrudService} from '@eg/core/pcrud.service';
import {ToastService} from '@eg/share/toast/toast.service';
-import {AuthService} from '@eg/core/auth.service';
import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {StringComponent} from '@eg/share/string/string.component';
constructor(
private modal: NgbModal, // required for passing to parent
private toast: ToastService,
- private net: NetService,
private pcrud: PcrudService,
- private evt: EventService,
- private renderer: Renderer2,
- private auth: AuthService) {
+ private renderer: Renderer2) {
super(modal); // required for subclassing
}
this.numFailed = 0;
return this.getNextCopy()
- .pipe(switchMap(() => super.open(args)))
- .pipe(tap(() =>
- this.renderer.selectRootElement('#new-barcode-input').focus())
+ .pipe(switchMap(() => super.open(args)),
+ tap(() =>
+ this.renderer.selectRootElement('#new-barcode-input').focus())
);
}
if (this.ids.length === 0) {
this.close(this.numSucceeded > 0);
- return throwError(false);
}
this.newBarcode = '';
async (ok) => {
this.numSucceeded++;
this.toast.success(await this.successMsg.current());
- this.getNextCopy();
+ return this.getNextCopy().toPromise();
},
async (err) => {
this.numFailed++;