All files / projects/organization-management/src/app/components/user-budget user-budget.component.html

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 602x                                                                                                                      
<div *ngIf="budget">
  <dl class="row dl-horizontal dl-separator">
    <dt class="col-7">{{ 'account.user.new.order_spend_limit.label' | translate }}</dt>
    <dd *ngIf="budget.orderSpentLimit; else noLimit" class="col-5 font-weight-bold text-right">
      {{ budget.orderSpentLimit | ishPrice }}
    </dd>
    <ng-template #noLimit>
      <dd class="col-5 font-weight-bold text-right">{{ 'account.budget.unlimited' | translate }}</dd>
    </ng-template>
  </dl>
 
  <ng-container *ngIf="budget.budget; else noBudget">
    <dl class="row dl-horizontal dl-separator">
      <dt class="col-7">{{ 'account.budget.label' | translate : { '0': budget.budgetPeriod } }}</dt>
      <dd class="col-5 font-weight-bold text-right">{{ budget.budget | ishPrice }}</dd>
    </dl>
    <dl class="row dl-horizontal dl-separator">
      <dt class="col-7">{{ 'account.budget.already_spent.label' | translate }}</dt>
      <dd class="col-5 font-weight-bold text-right">{{ usedBudget | ishPrice }}</dd>
    </dl>
    <div [ngbPopover]="BudgetPopover" placement="top" data-testing-id="user-budget-popover">
      <div class="progress" [ngClass]="progressBarClass">
        <div
          class="progress-bar"
          [ngClass]="{ 'bg-danger': usedBudgetPercentage * 100 > 90 }"
          [ngStyle]="{ width: usedBudgetPercentage | percent }"
          role="progressbar"
          [attr.aria-label]="'account.budget.already_spent.label' | translate"
          [attr.aria-valuetext]="usedBudgetPercentage | percent"
        >
          <span class="progress-display">{{ usedBudgetPercentage | percent }}</span>
          <ng-template #BudgetPopover>
            <div class="row">
              <div class="col-md-6 mb-2">{{ 'account.budget.label' | translate : { '0': budget.budgetPeriod } }}:</div>
              <div class="col-md-6 text-right">{{ budget.budget | ishPrice }}</div>
            </div>
            <div class="row">
              <div class="col-md-6 mb-2">{{ 'account.budget.already_spent.label' | translate }}:</div>
              <div class="col-md-6 text-right">{{ usedBudget | ishPrice }} ({{ usedBudgetPercentage | percent }})</div>
            </div>
            <div class="row">
              <div class="col-md-6 mb-2">{{ 'account.budget.left.label' | translate }}:</div>
              <div class="col-md-6 text-right">
                {{ budget.remainingBudget | ishPrice }} ({{ remainingBudgetPercentage | percent }})
              </div>
            </div>
          </ng-template>
        </div>
      </div>
    </div>
  </ng-container>
</div>
 
<ng-template #noBudget>
  <dl class="row dl-horizontal dl-separator">
    <dt class="col-7">{{ 'account.user.budget.label' | translate }}</dt>
    <dd class="col-5 font-weight-bold text-right">{{ 'account.budget.unlimited' | translate }}</dd>
  </dl>
</ng-template>