Skip to content

Commit

Permalink
fix: issues after ux review
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Dec 10, 2024
1 parent b4bfac0 commit 8181e21
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<ish-error-message [error]="error$ | async" />
<ish-info-box class="infobox-wrapper" cssClass="infobox-widget">
<div class="d-flex align-items-start">
<h3 class="pr-2 mb-0">{{ 'account.requisitions.widget.budget_title' | translate }}</h3>
<h3 class="pr-2">{{ 'account.requisitions.widget.budget_title' | translate }}</h3>
<ish-budget-info />
</div>
<div class="loading-container">
<div *ngIf="(budgetLoading$ | async) !== true; else loading">
<div class="row">
<div class="col-12">
<ish-user-budget progressBarClass="background-inverse" [budget]="userBudget$ | async" />
</div>
<div *ngIf="(budgetLoading$ | async) !== true; else loading" class="row">
<div class="col-12">
<ish-user-budget progressBarClass="background-inverse" [budget]="userBudget$ | async" />
</div>
<div *ishIsAuthorizedTo="'APP_B2B_MANAGE_USERS'" class="row">
<div class="col">
<a routerLink="/account/organization/users">
{{ 'account.requisitions.widget.manage_budgets' | translate }}
</a>
</div>
</div>
<div *ishIsAuthorizedTo="'APP_B2B_MANAGE_USERS'" class="row">
<div class="col">
<a routerLink="/account/organization/users">
{{ 'account.requisitions.widget.manage_budgets' | translate }}
</a>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Price } from 'ish-core/models/price/price.model';
import { Price, PriceType } from 'ish-core/models/price/price.model';

export interface UserBudget {
budget: Price;
budgetPeriod: string;
orderSpentLimit: Price;
budgetPriceType?: PriceType;
remainingBudget?: Price;
spentBudget?: Price;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h3>{{ 'account.organization.org_settings.preferences.subtitle' | translate }}</
[form]="budgetTypeForm"
[fields]="fields"
[model]="model"
(click)="budgetTypeChangeConfirmationDialog.show()"
(modelChange)="openConfirmationDialog(budgetTypeChangeConfirmationDialog)"
/>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AccountFacade } from 'ish-core/facades/account.facade';
import { Customer } from 'ish-core/models/customer/customer.model';
import { PriceType } from 'ish-core/models/price/price.model';
import { whenTruthy } from 'ish-core/utils/operators';
import { ModalDialogComponent } from 'ish-shared/components/common/modal-dialog/modal-dialog.component';
import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils';

/**
Expand Down Expand Up @@ -59,11 +60,15 @@ export class OrganizationSettingsPageComponent implements OnInit {
this.model = pick(this.customer, 'budgetPriceType');
}

openConfirmationDialog(budgetTypeChangeConfirmationDialog: ModalDialogComponent<string>) {
if (this.model.budgetPriceType !== this.initialBudgetPriceType) {
budgetTypeChangeConfirmationDialog.show();
}
}

resetValue() {
if (this.initialBudgetPriceType !== this.budgetTypeForm.get('budgetPriceType').value) {
this.budgetTypeForm
.get('budgetPriceType')
.reset({ value: this.initialBudgetPriceType, disabled: false }, { emitEvent: false });
this.budgetTypeForm.get('budgetPriceType').reset({ value: this.initialBudgetPriceType, disabled: false });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div *ngIf="requisition?.userBudget" class="row">
<ish-info-box class="infobox-wrapper col-12">
<div class="d-flex align-items-start">
<h3 class="mt-1 pr-2">
<h3 class="pr-2">
{{ 'approval.detailspage.buyer_budget.heading' | translate }}
</h3>
<ish-lazy-budget-info />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export class RequisitionBuyerApprovalComponent implements OnChanges {
if (this.requisition) {
this.orderTotal = {
type: 'Money',
value: this.requisition.totals.total.gross,
value:
this.requisition?.userBudget?.budgetPriceType === 'gross'
? this.requisition?.totals?.total?.gross
: this.requisition?.totals?.total?.net,
currency: this.requisition.totals.total.currency,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div *ngIf="costCenter?.costCenterOwner.email === (userEmail$ | async)" class="row">
<ish-info-box class="infobox-wrapper col-12">
<div class="d-flex align-items-start">
<h3 class="mt-1 pr-2">
<h3 class="pr-2">
{{ 'approval.detailspage.costcenter.approval.heading' | translate }}
</h3>
<ish-lazy-budget-info />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export class RequisitionCostCenterApprovalComponent implements OnInit, OnChanges

this.orderTotal = {
type: 'Money',
value: this.requisition?.totals?.total?.gross,
value:
this.requisition?.userBudget?.budgetPriceType === 'gross'
? this.requisition?.totals?.total?.gross
: this.requisition?.totals?.total?.net,
currency: this.requisition?.totals?.total?.currency,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
type="radio"
[formControl]="formControl"
[value]="opt.value"
[id]="opt.value"
[id]="id + '_' + opt.value"
class="form-check-input"
[ngClass]="props.inputClass"
[attr.data-testing-id]="'radio-' + opt.label"
/>
<label class="form-check-label pr-3" [attr.for]="id">{{ opt.label }}</label>
<label class="form-check-label pr-3" [attr.for]="id + '_' + opt.value">{{ opt.label }}</label>
</ng-container>
</ng-container>

0 comments on commit 8181e21

Please sign in to comment.