mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 2006: feature(checkout-complete-order): Added Error Feedback to reward checkout
feature(checkout-complete-order): Added Error Feedback to reward checkout Fixed Build Errors inside purchase-options Ref: #5416
This commit is contained in:
committed by
Lorenz Hilpert
parent
27aa694158
commit
b8e2d3f87b
@@ -6,7 +6,11 @@ import {
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { ButtonComponent } from '@isa/ui/buttons';
|
||||
import { CheckoutMetadataService, SelectedRewardShoppingCartResource, calculateTotalLoyaltyPoints } from '@isa/checkout/data-access';
|
||||
import {
|
||||
CheckoutMetadataService,
|
||||
SelectedRewardShoppingCartResource,
|
||||
calculateTotalLoyaltyPoints,
|
||||
} from '@isa/checkout/data-access';
|
||||
import {
|
||||
SelectedCustomerResource,
|
||||
CrmTabMetadataService,
|
||||
@@ -16,6 +20,7 @@ import { injectTabId } from '@isa/core/tabs';
|
||||
import { logger } from '@isa/core/logging';
|
||||
import { CheckoutCompletionOrchestratorService } from '../services';
|
||||
import { Router } from '@angular/router';
|
||||
import { injectFeedbackErrorDialog } from '@isa/ui/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'checkout-complete-order-button',
|
||||
@@ -31,6 +36,7 @@ export class CompleteOrderButtonComponent {
|
||||
tabId: this.#tabId(),
|
||||
}));
|
||||
#tabId = injectTabId();
|
||||
#errorFeedbackDialog = injectFeedbackErrorDialog();
|
||||
#tabMetadata = inject(CrmTabMetadataService);
|
||||
#checkoutMetadata = inject(CheckoutMetadataService);
|
||||
|
||||
@@ -45,7 +51,8 @@ export class CompleteOrderButtonComponent {
|
||||
isCompleted = signal(false);
|
||||
|
||||
primaryBonusCardPoints = computed(
|
||||
() => this.#primaryCustomerCardResource.primaryCustomerCard()?.totalPoints ?? 0,
|
||||
() =>
|
||||
this.#primaryCustomerCardResource.primaryCustomerCard()?.totalPoints ?? 0,
|
||||
);
|
||||
|
||||
totalPointsRequired = computed(() => {
|
||||
@@ -93,7 +100,12 @@ export class CompleteOrderButtonComponent {
|
||||
});
|
||||
|
||||
isDisabled = computed(() => {
|
||||
return this.isBusy() || this.isCompleted() || this.isLoading() || this.hasInsufficientPoints();
|
||||
return (
|
||||
this.isBusy() ||
|
||||
this.isCompleted() ||
|
||||
this.isLoading() ||
|
||||
this.hasInsufficientPoints()
|
||||
);
|
||||
});
|
||||
|
||||
shoppingCartId = computed(() => {
|
||||
@@ -140,7 +152,12 @@ export class CompleteOrderButtonComponent {
|
||||
|
||||
this.isCompleted.set(true);
|
||||
this.#logger.info('Order completed successfully', () => ({ orders }));
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
this.#errorFeedbackDialog({
|
||||
data: {
|
||||
errorMessage: 'Bestellung konnte nicht abgeschlossen werden.',
|
||||
},
|
||||
});
|
||||
this.#logger.error('Error completing order', error);
|
||||
} finally {
|
||||
this.isBusy.set(false);
|
||||
|
||||
Reference in New Issue
Block a user