Combobox templates for funds dropdowns.
Signed-off-by: Stephanie Leary <stephanie.leary@equinoxoli.org>
@Input() entryId: any;
@Input() entryLabel: string;
@Input() selected: boolean;
+ @Input() classNames?: string[];
constructor(@Host() private combobox: ComboboxComponent) {}
this.combobox.startId = this.entryId;
}
this.combobox.addEntry(
- {id: this.entryId, label: this.entryLabel});
+ {id: this.entryId, label: this.entryLabel, classNames: this.classNames});
}
}
<ng-template #defaultDisplayTemplate let-r="result">
- <span id="{{domId}}-{{r.id}}" [ngClass]="classNames.join(' ')">{{r.label}}</span>
+ <span id="{{domId}}-{{r.id}}" [ngClass]="classNames">{{r.label}}</span>
</ng-template>
<ng-template #acqfTemplate egIdlClass="acqf" let-r="result">
- <span id="{{domId}}-{{r.id}}" [ngClass]="classNames.join(' ')">{{r.fm.code()}} ({{r.fm.year()}}) ({{getOrgShortname(r.fm.org())}})</span>
+ <span id="{{domId}}-{{r.id}}" [ngClass]="classNames">{{r.fm.code()}} ({{r.fm.year()}}) ({{getOrgShortname(r.fm.org())}})</span>
</ng-template>
<ng-template #acplTemplate egIdlClass="acpl" let-r="result">
- <span id="{{domId}}-{{r.id}}" [ngClass]="classNames.join(' ')">
+ <span id="{{domId}}-{{r.id}}" [ngClass]="classNames">
{{r.fm.name()}} ({{getOrgShortname(r.fm.owning_lib())}})
</span>
</ng-template>
userdata?: any; // opaque external value; ignored by this component.
fm?: IdlObject;
disabled?: boolean;
+ classNames?: string[]; // optional array of classes for CSS
}
@Directive({
// Placeholder text for selector input
@Input() placeholder = '';
- // Optional array of CSS class names
- @Input() classNames?: string[];
-
@Input() persistKey: string; // TODO
@Input() allowFreeText = false;
</div>
<ng-template #fundTmpl let-r="result" i18n>
- <span [ngClass]="{'fund-balance-state-stop': checkFundBalance(r.fm.id()) === 'stop',
- 'fund-balance-state-warning': checkFundBalance(r.fm.id()) === 'warning'}">{{r.label}}</span>
+ <span [ngClass]="{'text-bg-danger': checkFundBalance(r.fm.id()) === 'stop',
+ 'text-bg-warning': checkFundBalance(r.fm.id()) === 'warning'}">{{r.label}}</span>
</ng-template>
<eg-combobox idlClass="acqf" [selectedId]="charge.fund()"
(onChange)="charge.fund($event ? $event.id : null)"
i18n-placeholder placeholder="Fund..."
- [asyncSupportsEmptyTermClick]="true"
[displayTemplate]="fundTmpl"
+ [asyncSupportsEmptyTermClick]="true"
[required]="true" [readOnly]="!charge.isnew() && !charge.ischanged()"
[idlQuerySort]="{acqf: 'year DESC, code'}"
[idlQueryAnd]="{org: owners, active: 't'}">
<br>
<i>Fund actually debited is
<eg-combobox idlClass="acqf" [selectedId]="charge.fund_debit().fund()"
- [readOnly]="true"></eg-combobox></i>
+ [displayTemplate]="fundTmpl" [readOnly]="true"></eg-combobox></i>
</span>
</div>
<div class="flex-2 p-2">
</div>
</ng-container>
+<!-- r.fm.id() makes sense in copy-attrs.component because there's a lot of setup there, but do we have the fund ID at all in this component?? -->
<ng-template #fundTmpl let-r="result" i18n>
- <span [ngClass]="{'fund-balance-state-stop': checkFundBalance(r.fm.id()) === 'stop',
- 'fund-balance-state-warning': checkFundBalance(r.fm.id()) === 'warning'}">{{r.label}}</span>
+ <span id="eg-combobox-{{autoId}}-{{r.id}}" [ngClass]="{'text-bg-danger': checkFundBalance(r.fm.id()) === 'stop',
+ 'text-bg-warning': checkFundBalance(r.fm.id()) === 'warning'}">{{r.label}}</span>
</ng-template>
\ No newline at end of file
@Component({
templateUrl: 'charges.component.html',
- selector: 'eg-acq-po-charges'
+ selector: 'eg-acq-po-charges',
+ styleUrls: ['./summary.component.css']
})
export class PoChargesComponent implements OnInit, OnDestroy {
margin-inline-start: .25ch;
vertical-align: sub;
}
+
+.dropdown-item .text-bg-danger {
+ background-color: #f8d7da;
+ color: #58151c !important;
+ font-weight: 600;
+ padding: 0 1rem 0 .25rem;
+}
+
+.dropdown-item .text-bg-danger::before {
+ content: "\e160";
+ font-family: "Material Icons";
+ font-weight: normal;
+ vertical-align: sub;
+}
+
+.dropdown-item.active .text-bg-danger {
+ background-color: #f1aeb5;
+}
+
+.dropdown-item .text-bg-warning {
+ background-color: #ffe69c !important;
+ color: #723809;
+ font-weight: 600;
+ padding: 0 1rem 0 .25rem;
+}
+
+.dropdown-item .text-bg-warning::before {
+ content: "\e002";
+ font-family: "Material Icons";
+ font-weight: normal;
+ vertical-align: sub;
+}
+
+.dropdown-item.active .text-bg-warning {
+ background-color: #ffda6a;
+}
+
<!-- canceled -->
<ng-container *ngIf="po().cancel_reason()">
<span class="text-bg-danger">
- <span class="material-icons" aria-label="danger" title="danger" i18n-aria-label i18n-title>report</span>
+ <span class="material-icons" aria-label="Stop" title="danger" i18n-aria-label i18n-title>report</span>
<span i18n>{{po().cancel_reason().label()}} => {{po().cancel_reason().description()}}</span>
</span>
</ng-container>
<!-- activation warnings -->
<ng-container *ngIf='activationWarnings.length'>
<span class="text-bg-warning">
- <span class="material-icons" aria-label="warning" title="warning" i18n-aria-label i18n-title>warning</span>
+ <span class="material-icons" aria-hidden="true" title="warning" i18n-aria-label i18n-title>warning</span>
<span i18n> (Warning: </span>
<ng-container *ngFor="let evt of activationWarnings">
<ng-container