import {IdlObject, IdlService} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
+import {OrgService} from '@eg/core/org.service';
import {LineitemService, COPY_ORDER_DISPOSITION} from './lineitem.service';
import {ComboboxComponent, ComboboxEntry} from '@eg/share/combobox/combobox.component';
import {ItemLocationService} from '@eg/share/item-location-select/item-location-select.service';
private idl: IdlService,
private net: NetService,
private auth: AuthService,
+ private org: OrgService,
private loc: ItemLocationService,
private liService: LineitemService
) {}
}
}
+ // copied from combobox to get the label right for funds
+ getOrgShortname(ou: any) {
+ if (typeof ou === 'object') {
+ return ou.shortname();
+ } else {
+ return this.org.get(ou).shortname();
+ }
+ }
+
// Tell our inputs about the values we know we need
// Values will be pre-cached in the liService
+ //
+ // TODO: figure out a better way to do this so that we
+ // don't need to duplicate the code to format
+ // the display labels for funds correctly
setInitialOptions(copy: IdlObject) {
if (copy.fund()) {
const fund = this.liService.fundCache[copy.fund()];
- this.fundEntries = [{id: fund.id(), label: fund.code(), fm: fund}];
+ this.fundEntries = [{
+ id: fund.id(),
+ label: fund.code() + ' (' + fund.year() + ')' +
+ ' (' + this.getOrgShortname(fund.org()) + ')',
+ fm: fund
+ }];
}
if (copy.circ_modifier()) {