Skip to content

Commit

Permalink
feat: show inactive flag for costcenterusers(#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiverDori authored and SGrueber committed Sep 30, 2022
1 parent 295e122 commit 752e38e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<ng-container *ishHasNotRole="'APP_B2B_ACCOUNT_OWNER'">
{{ buyer.firstName }} {{ buyer.lastName }}
</ng-container>
<span *ngIf="buyer.active === false" class="input-help">
<br />{{ 'account.user.list.status.inactive' | translate }}
</span>
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable, Subject, merge } from 'rxjs';
import { take, takeUntil, withLatestFrom } from 'rxjs/operators';

Expand Down Expand Up @@ -50,7 +51,11 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit {

private destroy$ = new Subject<void>();

constructor(private appFacade: AppFacade, private organizationManagementFacade: OrganizationManagementFacade) {}
constructor(
private appFacade: AppFacade,
private organizationManagementFacade: OrganizationManagementFacade,
private translateService: TranslateService
) {}

ngOnInit() {
this.loading$ = this.organizationManagementFacade.costCentersLoading$;
Expand All @@ -59,7 +64,6 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit {
this.organizationManagementFacade.usersError$
);
this.buyers$ = this.organizationManagementFacade.costCenterUnassignedBuyers$();

// set model and form fields
this.buyers$
.pipe(withLatestFrom(this.appFacade.currentCurrency$), take(1), takeUntil(this.destroy$))
Expand All @@ -70,10 +74,13 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit {
}

getModel(buyers: B2bUser[], currency: string) {
const inactivetext = this.translateService.instant('account.user.list.status.inactive');
return {
addBuyers: buyers.map(buyer => ({
selected: false,
name: `${buyer.firstName} ${buyer.lastName}`,
name: `${buyer.firstName} ${buyer.lastName} ${
!buyer.active ? `<p class="input-help">${inactivetext}</p>` : ''
} `,
login: buyer.login,
budgetValue: undefined,
currency,
Expand Down Expand Up @@ -102,7 +109,7 @@ export class CostCenterBuyersPageComponent implements OnDestroy, OnInit {
},
{
key: 'name',
type: 'ish-plain-text-field',
type: 'ish-html-text-field',
className: 'col-11 col-sm-10 col-md-3 list-item pb-0',
templateOptions: {
inputClass: 'col-form-label pb-0',
Expand Down

0 comments on commit 752e38e

Please sign in to comment.