LP1984007 WIP Acq warning/stop percentage styles
authorStephanie Leary <stephanie.leary@equinoxoli.org>
Wed, 17 May 2023 18:46:31 +0000 (18:46 +0000)
committerStephanie Leary <stephanie.leary@equinoxoli.org>
Wed, 17 May 2023 18:46:31 +0000 (18:46 +0000)
Combobox templates for funds dropdowns.

Signed-off-by: Stephanie Leary <stephanie.leary@equinoxoli.org>
Open-ILS/src/eg2/src/app/share/combobox/combobox-entry.component.ts
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html
Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.html
Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.ts
Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.css
Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html

index 26015b7..3c4499b 100644 (file)
@@ -10,6 +10,7 @@ export class ComboboxEntryComponent implements OnInit {
     @Input() entryId: any;
     @Input() entryLabel: string;
     @Input() selected: boolean;
+    @Input() classNames?: string[];
 
     constructor(@Host() private combobox: ComboboxComponent) {}
 
@@ -18,7 +19,7 @@ export class ComboboxEntryComponent implements OnInit {
             this.combobox.startId = this.entryId;
         }
         this.combobox.addEntry(
-            {id: this.entryId, label: this.entryLabel});
+            {id: this.entryId, label: this.entryLabel, classNames: this.classNames});
     }
 }
 
index f93c977..c15e26e 100644 (file)
@@ -1,13 +1,13 @@
 
 <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>
index e75f31d..971fc72 100644 (file)
@@ -24,6 +24,7 @@ export interface ComboboxEntry {
   userdata?: any; // opaque external value; ignored by this component.
   fm?: IdlObject;
   disabled?: boolean;
+  classNames?: string[]; // optional array of classes for CSS
 }
 
 @Directive({
@@ -69,9 +70,6 @@ export class ComboboxComponent
     // Placeholder text for selector input
     @Input() placeholder = '';
 
-    // Optional array of CSS class names
-    @Input() classNames?: string[];
-
     @Input() persistKey: string; // TODO
 
     @Input() allowFreeText = false;
index f45c6f1..1f1601a 100644 (file)
 </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>
index 298917b..c8fbf51 100644 (file)
@@ -30,8 +30,8 @@
       <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'}">
@@ -40,7 +40,7 @@
         <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">
@@ -89,7 +89,8 @@
   </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
index 5da7fc8..7e14e08 100644 (file)
@@ -13,7 +13,8 @@ import {DisencumberChargeDialogComponent} from './disencumber-charge-dialog.comp
 
 @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 {
 
index e8c1d9d..e7e8b76 100644 (file)
@@ -5,3 +5,40 @@
   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;
+}
+
index e9e27a7..2324f8f 100644 (file)
@@ -46,7 +46,7 @@
             <!-- 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()}} =&gt; {{po().cancel_reason().description()}}</span>
               </span>
             </ng-container>
@@ -54,7 +54,7 @@
             <!-- 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