import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
import {Observable, from, empty, throwError} from 'rxjs';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {EventService} from '@eg/core/event.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
leadListName: String;
selections: IdlObject[];
+ @ViewChild('fail', { static: true }) private fail: AlertDialogComponent;
+
constructor(
private idl: IdlService,
+ private evt: EventService,
private net: NetService,
private auth: AuthService,
private modal: NgbModal
this.grid.context.getSelectedRows()[0].id(),
this.selectionListName
).subscribe(
- new_id => this.close(new_id),
- err => throwError(err)
+ (res) => {
+ if (this.evt.parse(res)) {
+ console.error(res);
+ this.fail.open();
+ } else {
+ console.log(res);
+ }
+ },
+ (err) => {
+ console.error(err);
+ this.fail.open();
+ },
+ () => this.close(true)
);
}
}
import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
import {Observable, from, empty, throwError} from 'rxjs';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {EventService} from '@eg/core/event.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
selectionListName: String;
+ @ViewChild('fail', { static: true }) private fail: AlertDialogComponent;
+
constructor(
private idl: IdlService,
+ private evt: EventService,
private net: NetService,
private auth: AuthService,
private modal: NgbModal
'open-ils.acq.picklist.create',
this.auth.token(), picklist
).subscribe(
- new_id => this.close(new_id),
- err => throwError(err)
+ (res) => {
+ if (this.evt.parse(res)) {
+ console.error(res);
+ this.fail.open();
+ } else {
+ console.log(res);
+ }
+ },
+ (err) => {
+ console.error(err);
+ this.fail.open();
+ },
+ () => this.close(true)
);
}
}
import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
import {Observable, forkJoin, from, empty, throwError} from 'rxjs';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {EventService} from '@eg/core/event.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
@Input() grid: any;
listNames: string[];
+ @ViewChild('fail', { static: true }) private fail: AlertDialogComponent;
+
constructor(
private idl: IdlService,
+ private evt: EventService,
private net: NetService,
private auth: AuthService,
private modal: NgbModal
observables.push( that.deleteList(r) );
});
forkJoin(observables).subscribe(
- results => this.close(results),
- err => throwError(err)
+ (res) => {
+ if (this.evt.parse(res)) {
+ console.error(res);
+ this.fail.open();
+ } else {
+ console.log(res);
+ }
+ },
+ (err) => {
+ console.error(err);
+ this.fail.open();
+ },
+ () => this.close(true)
);
}
}
import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
import {Observable, forkJoin, from, empty, throwError} from 'rxjs';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {EventService} from '@eg/core/event.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
leadList: number;
selectedLists: IdlObject[];
+ @ViewChild('fail', { static: true }) private fail: AlertDialogComponent;
+
constructor(
private idl: IdlService,
+ private evt: EventService,
private net: NetService,
private auth: AuthService,
private modal: NgbModal
this.auth.token(), this.leadList,
this.selectedLists.map( list => list.id() ).filter(function(p) { return p != that.leadList; })
).subscribe(
- (res) => console.log('res',res),
- (err) => throwError(err),
+ (res) => {
+ if (this.evt.parse(res)) {
+ console.error(res);
+ this.fail.open();
+ } else {
+ console.log(res);
+ }
+ },
+ (err) => {
+ console.error(err);
+ this.fail.open();
+ },
() => this.close(true)
);
}