<eg-link-table-link i18n-label label="EDI Messages"
routerLink="/staff/admin/acq/edi_message"></eg-link-table-link>
<eg-link-table-link i18n-label label="EDI Attribute Sets"
- url="/eg/staff/admin/acq/edi_attr_set"></eg-link-table-link>
- <!-- TODO
routerLink="/staff/admin/acq/edi_attr_set"></eg-link-table-link>
- -->
<eg-link-table-link i18n-label label="Exchange Rates"
routerLink="/staff/admin/acq/exchange_rate"></eg-link-table-link>
<eg-link-table-link i18n-label label="Fund Administration"
--- /dev/null
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h3 *ngIf="mode === 'create'" class="modal-title" i18n>New EDI Attribute Set</h3>
+ <h3 *ngIf="mode === 'update'" class="modal-title" i18n>Modify EDI Attribute Set</h3>
+ <h3 *ngIf="mode === 'clone'" class="modal-title" i18n>Clone EDI Attribute Set (from {{clonedLabel}})</h3>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="close()">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <form #myForm="ngForm" role="form" class="form-validated">
+ <div class="form-group row mt-2" *ngIf="attrSet">
+ <label for="attr-set-label" class="col-sm-3 col-form-label" i18n>Attribute Set Label
+ </label>
+ <div class="col-sm-3">
+ <input class="form-control" type="text" id="attr-set-label"
+ required="required" pattern="[\s\S]*\S[\s\S]*"
+ [ngModel]="attrSet.label()" name="label"
+ (ngModelChange)="attrSet.label($event)">
+ </div>
+ </div>
+ <table class="table table-striped table-sm col-lg-10 offset-lg-1">
+ <thead>
+ <tr>
+ <td> </td>
+ <td i81n>Attribute</td>
+ <td i81n>Description</td>
+ </tr>
+ </thead>
+ <tr *ngFor="let inp of attrInputs">
+ <td><input type="checkbox" [(ngModel)]="inp.selected"
+ id="attr-map-{{inp.key}}" name="attr-map-{{inp.key}}"></td>
+ <td><label for="attr-map-{{inp.key}}">{{inp.key}}</label></td>
+ <td>{{inp.label}}</td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-info" [disabled]="!myForm?.valid || !(myForm?.dirty)"
+ (click)="save()" i18n>Save</button>
+ <button type="button" class="btn btn-warning"
+ (click)="close()" i18n>Cancel</button>
+ </div>
+</ng-template>
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {NgForm} from '@angular/forms';
+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 {PcrudService} from '@eg/core/pcrud.service';
+import {Pager} from '@eg/share/util/pager';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
+import {StringComponent} from '@eg/share/string/string.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {PermService} from '@eg/core/perm.service';
+
+@Component({
+ selector: 'eg-edi-attr-set-edit-dialog',
+ templateUrl: './edi-attr-set-edit-dialog.component.html'
+})
+
+export class EdiAttrSetEditDialogComponent
+ extends DialogComponent implements OnInit {
+
+ @Input() mode = 'create';
+ @Input() attrSetId: number;
+ @Input() cloneSource: number;
+ attrSet: IdlObject;
+ attrInputs: any = [];
+ clonedLabel = '';
+
+ constructor(
+ private idl: IdlService,
+ private evt: EventService,
+ private net: NetService,
+ private auth: AuthService,
+ private pcrud: PcrudService,
+ private perm: PermService,
+ private toast: ToastService,
+ private modal: NgbModal
+ ) {
+ super(modal);
+ }
+
+ ngOnInit() {
+ this.onOpen$.subscribe(() => this._initRecord());
+ }
+
+ private _initRecord() {
+ this.attrSet = null;
+ this.attrInputs = [];
+ this.clonedLabel = '';
+ if (this.mode === 'update') {
+ this.pcrud.retrieve('aeas', this.attrSetId, {
+ flesh: 1,
+ flesh_fields: { aeas: ['attr_maps'] }
+ }).subscribe(res => {
+ this.attrSet = res;
+ this._generateAttrInputs();
+ });
+ } else if (this.mode === 'clone') {
+ this.pcrud.retrieve('aeas', this.cloneSource, {
+ flesh: 1,
+ flesh_fields: { aeas: ['attr_maps'] }
+ }).subscribe(res => {
+ this.clonedLabel = res.label();
+ this.attrSet = this.idl.create('aeas');
+ this.attrSet.attr_maps([]);
+ res.attr_maps().forEach((m) => {
+ const newMap = this.idl.create('aeasm');
+ newMap.attr(m.attr());
+ this.attrSet.attr_maps().push(newMap);
+ });
+ this._generateAttrInputs();
+ });
+ } else if (this.mode === 'create') {
+ this.attrSet = this.idl.create('aeas');
+ this.attrSet.attr_maps([]);
+ this._generateAttrInputs();
+ }
+ }
+
+ _generateAttrInputs() {
+ const hasAttr: {[key: string]: boolean} = {};
+ const hasAttrId: {[key: string]: number} = {};
+ this.attrSet.attr_maps().forEach((m) => {
+ hasAttr[m.attr()] = true;
+ hasAttrId[m.attr()] = m.id();
+ });
+ this.pcrud.retrieveAll('aea', {order_by: {aea: 'key'}}).subscribe(attr => {
+ const inp = {
+ key: attr.key(),
+ label: attr.label(),
+ id: null,
+ selected: false
+ };
+ if (attr.key() in hasAttr) {
+ inp.selected = true;
+ inp.id = hasAttrId[attr.key()];
+ }
+ this.attrInputs.push(inp);
+ });
+ }
+
+ save() {
+ if (this.attrSet.id() === undefined || this.attrSet.id() === null) {
+ this.attrSet.isnew(true);
+ } else {
+ this.attrSet.ischanged(true);
+ }
+ this.pcrud.autoApply([this.attrSet]).subscribe(res => {
+ const setId = this.mode === 'update' ? res : res.id();
+ const updates: IdlObject[] = [];
+ if (this.mode === 'create' || this.mode === 'clone') {
+ this.attrInputs.forEach((inp) => {
+ if (inp.selected) {
+ const aesm = this.idl.create('aeasm');
+ aesm.attr(inp.key);
+ aesm.attr_set(setId);
+ aesm.isnew(true);
+ updates.push(aesm);
+ }
+ });
+ } else {
+ // updating an existing set
+ this.attrInputs.forEach((inp) => {
+ if (inp.id) {
+ if (!inp.selected) {
+ // used to be wanted, but no longer
+ const aesm = this.idl.create('aeasm');
+ aesm.id(inp.id);
+ aesm.isdeleted(true);
+ updates.push(aesm);
+ }
+ } else if (inp.selected) {
+ // no ID, must be newly checked
+ const aesm = this.idl.create('aeasm');
+ aesm.attr(inp.key);
+ aesm.attr_set(setId);
+ aesm.isnew(true);
+ updates.push(aesm);
+ }
+ });
+ }
+ this.pcrud.autoApply(updates).subscribe(
+ ret => this.close(true),
+ err => this.close(err),
+ () => this.close(true)
+ );
+ }, err => this.close(false));
+ }
+
+}
--- /dev/null
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h3 class="modal-title" i18n>Attribute Set {{attrSet?.label()}}: Providers</h3>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="close()">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <eg-edi-attr-set-providers [attrSetId]="attrSetId"></eg-edi-attr-set-providers>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-warning" *ngIf="!canUpdate"
+ (click)="close()" i18n>Close</button>
+ </div>
+</ng-template>
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {NgForm} from '@angular/forms';
+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 {PcrudService} from '@eg/core/pcrud.service';
+import {Pager} from '@eg/share/util/pager';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
+import {StringComponent} from '@eg/share/string/string.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {PermService} from '@eg/core/perm.service';
+import {EdiAttrSetProvidersComponent} from './edi-attr-set-providers.component';
+
+@Component({
+ selector: 'eg-edi-attr-set-providers-dialog',
+ templateUrl: './edi-attr-set-providers-dialog.component.html'
+})
+
+export class EdiAttrSetProvidersDialogComponent
+ extends DialogComponent implements OnInit {
+
+ @Input() attrSetId: number;
+
+ constructor(
+ private idl: IdlService,
+ private evt: EventService,
+ private net: NetService,
+ private auth: AuthService,
+ private pcrud: PcrudService,
+ private perm: PermService,
+ private toast: ToastService,
+ private modal: NgbModal
+ ) {
+ super(modal);
+ }
+
+ ngOnInit() { }
+
+}
--- /dev/null
+<eg-grid #grid [dataSource]="dataSource"
+ [sortable]="true" persistKey="disabled"
+ [filterable]="true" [stickyHeader]="true"
+ [disableSelect]="true" [cellTextGenerator]="cellTextGenerator">
+ <ng-template #nameTmpl let-row="row">
+ <a href="/eg2/staff/acq/provider/{{row.id()}}/edi_accounts" target="_blank">{{row.name()}}</a>
+ </ng-template>
+ <eg-grid-column path="name" i18n-label label="Provider Name" [cellTemplate]="nameTmpl"></eg-grid-column>
+ <eg-grid-column path="owner" i18n-label label="Owning Library" datatype="org_unit"></eg-grid-column>
+ <eg-grid-column path="id" i18n-label label="ID" [hidden]="true" [index]="true"></eg-grid-column>
+</eg-grid>
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {NgForm} from '@angular/forms';
+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 {PcrudService} from '@eg/core/pcrud.service';
+import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {Pager} from '@eg/share/util/pager';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
+import {StringComponent} from '@eg/share/string/string.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {PermService} from '@eg/core/perm.service';
+
+@Component({
+ selector: 'eg-edi-attr-set-providers',
+ templateUrl: './edi-attr-set-providers.component.html'
+})
+
+export class EdiAttrSetProvidersComponent
+ extends DialogComponent implements OnInit {
+
+ @Input() attrSetId: number;
+ @ViewChild('grid', { static: false }) grid: GridComponent;
+ attrSet: IdlObject;
+ dataSource: GridDataSource;
+ cellTextGenerator: GridCellTextGenerator;
+
+ constructor(
+ private idl: IdlService,
+ private evt: EventService,
+ private net: NetService,
+ private auth: AuthService,
+ private pcrud: PcrudService,
+ private perm: PermService,
+ private toast: ToastService,
+ private modal: NgbModal
+ ) {
+ super(modal);
+ this.dataSource = new GridDataSource();
+ }
+
+ ngOnInit() {
+ this.attrSet = null;
+ this._initRecord();
+ this.cellTextGenerator = {
+ name: row => row.name()
+ };
+ }
+
+ private _initRecord() {
+ this.attrSet = null;
+ let providerIds = [];
+ this.pcrud.retrieve('aeas', this.attrSetId, {
+ flesh: 1,
+ flesh_fields: { aeas: ['edi_accounts'] }
+ }).subscribe(res => {
+ this.attrSet = res;
+ providerIds = res.edi_accounts().map(r => r.provider());
+ this.dataSource.getRows = (pager: Pager, sort: any[]) => {
+
+ const idlClass = 'acqpro';
+ const orderBy: any = {};
+ if (sort.length) {
+ // Sort specified from grid
+ orderBy[idlClass] = sort[0].name + ' ' + sort[0].dir;
+ }
+
+ const searchOps = {
+ offset: pager.offset,
+ limit: pager.limit,
+ order_by: orderBy,
+ flesh: 1,
+ flesh_fields: {
+ acqpro: ['owner']
+ }
+ };
+ const reqOps = { };
+
+ const search: any = new Array();
+ search.push({ id: providerIds });
+ const orgFilter: any = {};
+
+ Object.keys(this.dataSource.filters).forEach(key => {
+ Object.keys(this.dataSource.filters[key]).forEach(key2 => {
+ search.push(this.dataSource.filters[key][key2]);
+ });
+ });
+
+ return this.pcrud.search(idlClass, search, searchOps, reqOps);
+ };
+ this.grid.reload();
+ });
+ }
+
+}
--- /dev/null
+<eg-staff-banner bannerText="EDI Attribute Sets" i18n-bannerText>
+</eg-staff-banner>
+
+<eg-title i18n-prefix prefix="EDI Attribute Sets"></eg-title>
+
+<ng-template #successStrTmpl i18n>{{idlClassDef.label}} Update Succeeded</ng-template>
+<eg-string #successString [template]="successStrTmpl"></eg-string>
+
+<ng-template #updateFailedStrTmpl i18n>Update of {{idlClassDef.label}} failed</ng-template>
+<eg-string #updateFailedString [template]="updateFailedStrTmpl"></eg-string>
+
+<ng-template #deleteFailedStrTmpl i18n>Delete of {{idlClassDef.label}} failed or was not allowed</ng-template>
+<eg-string #deleteFailedString [template]="deleteFailedStrTmpl"></eg-string>
+
+<ng-template #deleteSuccessStrTmpl i18n>{{idlClassDef.label}} Successfully Deleted</ng-template>
+<eg-string #deleteSuccessString [template]="deleteSuccessStrTmpl"></eg-string>
+
+<ng-template #createStrTmpl i18n>{{idlClassDef.label}} Successfully Created</ng-template>
+<eg-string #createString [template]="createStrTmpl"></eg-string>
+
+<ng-template #createErrStrTmpl i18n>Failed to create new {{idlClassDef.label}}</ng-template>
+<eg-string #createErrString [template]="createErrStrTmpl"></eg-string>
+
+<ng-container *ngIf="orgField">
+ <div class="row">
+ <div class="col-lg-6">
+ <ng-container *ngIf="orgField">
+ <eg-org-family-select
+ [limitPerms]="viewPerms"
+ [selectedOrgId]="contextOrg.id()"
+ [(ngModel)]="searchOrgs"
+ (ngModelChange)="grid.reload()">
+ </eg-org-family-select>
+ </ng-container>
+ </div>
+ </div>
+ <hr/>
+</ng-container>
+
+<!-- idlObject and fieldName applied programmatically -->
+<eg-translate #translator></eg-translate>
+
+<ng-container *ngIf="helpTemplate">
+ <ng-container *ngTemplateOutlet="helpTemplate"></ng-container>
+</ng-container>
+
+<ng-template #configFieldLink let-row="row" let-col="col">
+ <a i18n-title title="Link To {{col.label}}"
+ [attr.href]="configFieldLinkUrl(row, col)">{{configLinkLabel(row, col)}}</a>
+</ng-template>
+
+<eg-grid #grid idlClass="{{idlClass}}" [dataSource]="dataSource" hideFields="{{hideGridFields}}"
+ [sortable]="true" persistKey="{{persistKey}}" autoGeneratedColumnOrder="{{fieldOrder}}"
+ [filterable]="true" [stickyHeader]="true"
+ (onRowActivate)="editSelected([$event])"
+ [cellTextGenerator]="cellTextGenerator">
+ <eg-grid-toolbar-button [disabled]="!canCreate"
+ label="New {{idlClassDef.label}}" i18n-label (onClick)="createNew()">
+ </eg-grid-toolbar-button>
+ <eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelected($event)"
+ [disableOnRows]="notOneSelectedRow">
+ </eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Clone Selected" i18n-label (onClick)="cloneSelected($event)"
+ [disableOnRows]="notOneSelectedRow">
+ </eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Delete Selected" i18n-label (onClick)="deleteIfPossible($event)"
+ [disableOnRows]="notOneSelectedRow">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-column path="label"></eg-grid-column>
+ <eg-grid-column i18n-label label="# Providers Using Attribute Set" path="num_providers" name="num_providers"
+ [sortable]="false" [filterable]="false"></eg-grid-column>
+ <ng-template #ediAttrSetProvidersTmpl let-attrSet="row">
+ <button class="btn btn-outline-dark" (click)="openEdiAttrSetProvidersDialog(attrSet.id())" [disabled]="attrSet.num_providers < 1" i18n>View Providers</button>
+ </ng-template>
+ <eg-grid-column i18n-label label="View Providers" name="view_providers"
+ [sortable]="false" [filterable]="false" [cellTemplate]="ediAttrSetProvidersTmpl" [disableTooltip]="true"></eg-grid-column>
+ <eg-grid-column path="id" [hidden]="true"></eg-grid-column>
+
+
+</eg-grid>
+
+<eg-fm-record-editor #editDialog idlClass="{{idlClass}}"
+ [fieldOptions]="fieldOptions"
+ [fieldOrder]="fieldOrder"
+ [defaultNewRecord]="defaultNewRecord"
+ [preloadLinkedValues]="true"
+ [readonlyFields]="readonlyFields">
+</eg-fm-record-editor>
+
+<eg-edi-attr-set-providers-dialog #ediAttrSetProvidersDialog></eg-edi-attr-set-providers-dialog>
+<eg-edi-attr-set-edit-dialog #ediAttrSetEditDialog></eg-edi-attr-set-edit-dialog>
+
+<eg-confirm-dialog #confirmDel
+ dialogTitle="Delete?" i18n-dialogTitle
+ dialogBody="Delete EDI attribute set?" i18n-dialogBody>
+</eg-confirm-dialog>
+<eg-alert-dialog #alertDialog
+ i18n-dialogBody
+ dialogBody="EDI attribute set cannot be deleted: it is in use by at least one provider">
+</eg-alert-dialog>
--- /dev/null
+import {Component, Input, ViewChild, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
+import {FormatService} from '@eg/core/format.service';
+import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component';
+import {Pager} from '@eg/share/util/pager';
+import {ActivatedRoute} from '@angular/router';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {PermService} from '@eg/core/perm.service';
+import {AuthService} from '@eg/core/auth.service';
+import {NetService} from '@eg/core/net.service';
+import {Observable, of} from 'rxjs';
+import {map, mergeMap} from 'rxjs/operators';
+import {StringComponent} from '@eg/share/string/string.component';
+import {EdiAttrSetProvidersDialogComponent} from './edi-attr-set-providers-dialog.component';
+import {EdiAttrSetEditDialogComponent} from './edi-attr-set-edit-dialog.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
+
+@Component({
+ templateUrl: './edi-attr-sets.component.html'
+})
+
+export class EdiAttrSetsComponent extends AdminPageComponent implements OnInit {
+ idlClass = 'aeas';
+ classLabel: string;
+
+ @ViewChild('grid', { static: true }) grid: GridComponent;
+ @ViewChild('ediAttrSetProvidersDialog', { static: false }) ediAttrSetProvidersDialog: EdiAttrSetProvidersDialogComponent;
+ @ViewChild('ediAttrSetEditDialog', { static: false }) ediAttrSetEditDialog: EdiAttrSetEditDialogComponent;
+ @ViewChild('alertDialog', {static: false}) private alertDialog: AlertDialogComponent;
+ @ViewChild('confirmDel', { static: true }) confirmDel: ConfirmDialogComponent;
+
+ cellTextGenerator: GridCellTextGenerator;
+ notOneSelectedRow: (rows: IdlObject[]) => boolean;
+
+ constructor(
+ route: ActivatedRoute,
+ ngLocation: Location,
+ format: FormatService,
+ idl: IdlService,
+ org: OrgService,
+ auth: AuthService,
+ pcrud: PcrudService,
+ perm: PermService,
+ toast: ToastService,
+ private net: NetService
+ ) {
+ super(route, ngLocation, format, idl, org, auth, pcrud, perm, toast);
+ this.dataSource = new GridDataSource();
+ }
+
+ ngOnInit() {
+ this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length !== 1);
+ this.cellTextGenerator = {
+ view_providers: row => '',
+ num_providers: row => '',
+ };
+ this.fieldOrder = 'label';
+ this.defaultNewRecord = this.idl.create('aeas');
+
+ this.dataSource.getRows = (pager: Pager, sort: any[]) => {
+ const orderBy: any = {};
+ if (sort.length) {
+ // Sort specified from grid
+ orderBy[this.idlClass] = sort[0].name + ' ' + sort[0].dir;
+ } else if (this.sortField) {
+ // Default sort field
+ orderBy[this.idlClass] = this.sortField;
+ }
+
+ const searchOps = {
+ offset: pager.offset,
+ limit: pager.limit,
+ order_by: orderBy,
+ flesh: 1,
+ flesh_fields: {
+ aeas: ['edi_accounts']
+ }
+ };
+ const reqOps = { };
+
+ if (!this.contextOrg && !Object.keys(this.dataSource.filters).length) {
+ // No org filter -- fetch all rows
+ return this.pcrud.retrieveAll(
+ this.idlClass, searchOps, reqOps)
+ .pipe(mergeMap((row) => this.countProviders(row)));
+ }
+
+ const search: any = new Array();
+ const orgFilter: any = {};
+
+ if (this.orgField && (this.searchOrgs || this.contextOrg)) {
+ orgFilter[this.orgField] =
+ this.searchOrgs.orgIds || [this.contextOrg.id()];
+ search.push(orgFilter);
+ }
+
+ Object.keys(this.dataSource.filters).forEach(key => {
+ Object.keys(this.dataSource.filters[key]).forEach(key2 => {
+ search.push(this.dataSource.filters[key][key2]);
+ });
+ });
+
+ return this.pcrud.search(this.idlClass, search, searchOps, reqOps)
+ .pipe(mergeMap((row) => this.countProviders(row)));
+ };
+
+ super.ngOnInit();
+
+ this.classLabel = this.idlClassDef.label;
+ this.includeOrgDescendants = true;
+ }
+
+ countProviders(row: IdlObject): Observable<IdlObject> {
+ row['num_providers'] = (new Set( row.edi_accounts().map(r => r.provider()) )).size;
+ return of(row);
+ }
+
+ openEdiAttrSetProvidersDialog(id: number) {
+ this.ediAttrSetProvidersDialog.attrSetId = id;
+ this.ediAttrSetProvidersDialog.open({size: 'lg'});
+ }
+
+ deleteIfPossible(rows: IdlObject[]) {
+ if (rows.length > 0) {
+ if (rows[0].num_providers > 0) {
+ this.alertDialog.open();
+ } else {
+ this.confirmDel.open().subscribe(confirmed => {
+ if (!confirmed) { return; }
+ super.deleteSelected([ rows[0] ]);
+ });
+ }
+ }
+ }
+
+ showEditAttrSetDialog(successString: StringComponent, failString: StringComponent): Promise<any> {
+ return new Promise((resolve, reject) => {
+ this.ediAttrSetEditDialog.open({size: 'lg', scrollable: true}).subscribe(
+ result => {
+ this.successString.current()
+ .then(str => this.toast.success(str));
+ this.grid.reload();
+ resolve(result);
+ },
+ error => {
+ this.updateFailedString.current()
+ .then(str => this.toast.danger(str));
+ reject(error);
+ }
+ );
+ });
+ }
+
+ createNew() {
+ this.ediAttrSetEditDialog.mode = 'create';
+ this.showEditAttrSetDialog(this.createString, this.createErrString);
+ }
+
+ editSelected(rows: IdlObject[]) {
+ if (rows.length <= 0) { return; }
+ this.ediAttrSetEditDialog.mode = 'update';
+ this.ediAttrSetEditDialog.attrSetId = rows[0].id();
+ this.showEditAttrSetDialog(this.successString, this.updateFailedString);
+ }
+
+ cloneSelected(rows: IdlObject[]) {
+ if (rows.length <= 0) { return; }
+ this.ediAttrSetEditDialog.mode = 'clone';
+ this.ediAttrSetEditDialog.cloneSource = rows[0].id();
+ this.showEditAttrSetDialog(this.createString, this.createErrString);
+ }
+}
--- /dev/null
+import {NgModule} from '@angular/core';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {AdminCommonModule} from '@eg/staff/admin/common.module';
+import {EdiAttrSetsRoutingModule} from './routing.module';
+import {EdiAttrSetsComponent} from './edi-attr-sets.component';
+import {EdiAttrSetProvidersDialogComponent} from './edi-attr-set-providers-dialog.component';
+import {EdiAttrSetProvidersComponent} from './edi-attr-set-providers.component';
+import {EdiAttrSetEditDialogComponent} from './edi-attr-set-edit-dialog.component';
+
+@NgModule({
+ declarations: [
+ EdiAttrSetsComponent,
+ EdiAttrSetProvidersDialogComponent,
+ EdiAttrSetProvidersComponent,
+ EdiAttrSetEditDialogComponent
+ ],
+ imports: [
+ StaffCommonModule,
+ AdminCommonModule,
+ EdiAttrSetsRoutingModule
+ ],
+ exports: [
+ ],
+ providers: [
+ ]
+})
+
+export class EdiAttrSetsModule {
+}
--- /dev/null
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {EdiAttrSetsComponent} from './edi-attr-sets.component';
+
+const routes: Routes = [{
+ path: '',
+ component: EdiAttrSetsComponent
+}];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+
+export class EdiAttrSetsRoutingModule {}
path: 'claim_type',
redirectTo: 'claiming' // from legacy auto-generated admin page
}, {
+ path: 'edi_attr_set',
+ loadChildren: () =>
+ import('./edi_attr_set/edi-attr-sets.module').then(m => m.EdiAttrSetsModule)
+}, {
path: 'funds',
loadChildren: () =>
import('./funds/funds.module').then(m => m.FundsModule)