import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { HistoryEntryType, } from '@vendure/admin-ui/core';
import * as i0 from "@angular/core";
import * as i1 from "@vendure/admin-ui/core";
import * as i2 from "@clr/angular";
import * as i3 from "@angular/common";
import * as i4 from "@angular/forms";
import * as i5 from "@angular/router";
import * as i6 from "../fulfillment-detail/fulfillment-detail.component";
import * as i7 from "../payment-detail/payment-detail.component";
import * as i8 from "../simple-item-list/simple-item-list.component";
import * as i9 from "../modification-detail/modification-detail.component";
import * as i10 from "./order-history-entry-host.component";
import * as i11 from "@ngx-translate/core";
export class OrderHistoryComponent {
    constructor(historyEntryComponentService) {
        this.historyEntryComponentService = historyEntryComponentService;
        this.addNote = new EventEmitter();
        this.updateNote = new EventEmitter();
        this.deleteNote = new EventEmitter();
        this.note = '';
        this.noteIsPrivate = true;
        this.expanded = false;
        this.type = HistoryEntryType;
    }
    hasCustomComponent(type) {
        return !!this.historyEntryComponentService.getComponent(type);
    }
    getDisplayType(entry) {
        if (entry.type === HistoryEntryType.ORDER_STATE_TRANSITION) {
            if (entry.data.to === 'Delivered') {
                return 'success';
            }
            if (entry.data.to === 'Cancelled') {
                return 'error';
            }
        }
        if (entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) {
            if (entry.data.to === 'Delivered') {
                return 'success';
            }
        }
        if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION) {
            if (entry.data.to === 'Declined' || entry.data.to === 'Cancelled') {
                return 'error';
            }
        }
        if (entry.type === HistoryEntryType.ORDER_CANCELLATION) {
            return 'error';
        }
        if (entry.type === HistoryEntryType.ORDER_REFUND_TRANSITION) {
            return 'warning';
        }
        return 'default';
    }
    getTimelineIcon(entry) {
        if (entry.type === HistoryEntryType.ORDER_STATE_TRANSITION) {
            if (entry.data.to === 'Delivered') {
                return ['success-standard', 'is-solid'];
            }
            if (entry.data.to === 'Cancelled') {
                return 'ban';
            }
        }
        if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION) {
            if (entry.data.to === 'Settled') {
                return 'credit-card';
            }
        }
        if (entry.type === HistoryEntryType.ORDER_NOTE) {
            return 'note';
        }
        if (entry.type === HistoryEntryType.ORDER_MODIFIED) {
            return 'pencil';
        }
        if (entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) {
            if (entry.data.to === 'Shipped') {
                return 'truck';
            }
            if (entry.data.to === 'Delivered') {
                return 'truck';
            }
        }
    }
    isFeatured(entry) {
        switch (entry.type) {
            case HistoryEntryType.ORDER_STATE_TRANSITION: {
                return (entry.data.to === 'Delivered' ||
                    entry.data.to === 'Cancelled' ||
                    entry.data.to === 'Settled');
            }
            case HistoryEntryType.ORDER_PAYMENT_TRANSITION:
                return entry.data.to === 'Settled' || entry.data.to === 'Cancelled';
            case HistoryEntryType.ORDER_FULFILLMENT_TRANSITION:
                return entry.data.to === 'Delivered' || entry.data.to === 'Shipped';
            case HistoryEntryType.ORDER_NOTE:
            case HistoryEntryType.ORDER_MODIFIED:
                return true;
            default:
                return false;
        }
    }
    getFulfillment(entry) {
        if ((entry.type === HistoryEntryType.ORDER_FULFILLMENT ||
            entry.type === HistoryEntryType.ORDER_FULFILLMENT_TRANSITION) &&
            this.order.fulfillments) {
            return this.order.fulfillments.find(f => f.id === entry.data.fulfillmentId);
        }
    }
    getPayment(entry) {
        if (entry.type === HistoryEntryType.ORDER_PAYMENT_TRANSITION && this.order.payments) {
            return this.order.payments.find(p => p.id === entry.data.paymentId);
        }
    }
    getCancelledQuantity(entry) {
        return entry.data.lines.reduce((total, line) => total + line.quantity, 0);
    }
    getCancelledItems(entry) {
        const itemMap = new Map();
        const cancellationLines = entry.data.lines;
        for (const line of this.order.lines) {
            const cancellationLine = cancellationLines.find(l => l.orderLineId === line.id);
            if (cancellationLine) {
                const count = itemMap.get(line.productVariant.name);
                itemMap.set(line.productVariant.name, cancellationLine.quantity);
            }
        }
        return Array.from(itemMap.entries()).map(([name, quantity]) => ({ name, quantity }));
    }
    getModification(id) {
        return this.order.modifications.find(m => m.id === id);
    }
    getName(entry) {
        const { administrator } = entry;
        if (administrator) {
            return `${administrator.firstName} ${administrator.lastName}`;
        }
        else {
            const customer = this.order.customer;
            if (customer) {
                return `${customer.firstName} ${customer.lastName}`;
            }
        }
        return '';
    }
    addNoteToOrder() {
        this.addNote.emit({ note: this.note, isPublic: !this.noteIsPrivate });
        this.note = '';
        this.noteIsPrivate = true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderHistoryComponent, deps: [{ token: i1.HistoryEntryComponentService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: OrderHistoryComponent, selector: "vdr-order-history", inputs: { order: "order", history: "history" }, outputs: { addNote: "addNote", updateNote: "updateNote", deleteNote: "deleteNote" }, ngImport: i0, template: "<div class=\"entry-list\" [class.expanded]=\"expanded\">\n    <vdr-timeline-entry iconShape=\"note\" displayType=\"muted\" [featured]=\"true\">\n        <div class=\"note-entry\">\n            <textarea [(ngModel)]=\"note\" name=\"note\" class=\"note\"></textarea>\n            <button class=\"btn btn-secondary\" [disabled]=\"!note\" (click)=\"addNoteToOrder()\">\n                {{ 'common.add-note' | translate }}\n            </button>\n        </div>\n        <div class=\"visibility-select\">\n            <clr-checkbox-wrapper>\n                <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"noteIsPrivate\" />\n                <label>{{ 'order.note-is-private' | translate }}</label>\n            </clr-checkbox-wrapper>\n            <span *ngIf=\"noteIsPrivate\" class=\"private\">\n                {{ 'order.note-only-visible-to-administrators' | translate }}\n            </span>\n            <span *ngIf=\"!noteIsPrivate\" class=\"public\">\n                {{ 'order.note-visible-to-customer' | translate }}\n            </span>\n        </div>\n    </vdr-timeline-entry>\n    <ng-container *ngFor=\"let entry of history\">\n        <vdr-order-history-entry-host\n            *ngIf=\"hasCustomComponent(entry.type); else defaultComponents\"\n            [order]=\"order\"\n            [entry]=\"entry\"\n            [expanded]=\"expanded\"\n            (expandClick)=\"expanded = !expanded\"\n        ></vdr-order-history-entry-host>\n        <ng-template #defaultComponents>\n            <vdr-timeline-entry\n                [displayType]=\"getDisplayType(entry)\"\n                [iconShape]=\"getTimelineIcon(entry)\"\n                [createdAt]=\"entry.createdAt\"\n                [name]=\"getName(entry)\"\n                [featured]=\"isFeatured(entry)\"\n                [collapsed]=\"!expanded && !isFeatured(entry)\"\n                (expandClick)=\"expanded = !expanded\"\n            >\n                <ng-container [ngSwitch]=\"entry.type\">\n                    <ng-container *ngSwitchCase=\"type.ORDER_STATE_TRANSITION\">\n                        <div class=\"title\" *ngIf=\"entry.data.to === 'Delivered'\">\n                            {{ 'order.history-order-fulfilled' | translate }}\n                        </div>\n                        <div class=\"title\" *ngIf=\"entry.data.to === 'Cancelled'\">\n                            {{ 'order.history-order-cancelled' | translate }}\n                        </div>\n                        <ng-template [ngIf]=\"entry.data.to !== 'Cancelled' && entry.data.to !== 'Delivered'\">\n                            {{\n                                'order.history-order-transition'\n                                    | translate: { from: entry.data.from, to: entry.data.to }\n                            }}\n                        </ng-template>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_MODIFIED\">\n                        <div class=\"title\">\n                            {{ 'order.history-order-modified' | translate }}\n                        </div>\n                        <ng-container *ngIf=\"getModification(entry.data.modificationId) as modification\">\n                            {{ 'order.modify-order-price-difference' | translate }}:\n                            <strong>{{\n                                modification.priceChange | localeCurrency: order.currencyCode\n                            }}</strong>\n                            <vdr-chip colorType=\"success\" *ngIf=\"modification.isSettled\">{{\n                                'order.modification-settled' | translate\n                            }}</vdr-chip>\n                            <vdr-chip colorType=\"error\" *ngIf=\"!modification.isSettled\">{{\n                                'order.modification-not-settled' | translate\n                            }}</vdr-chip>\n                            <vdr-history-entry-detail>\n                                <vdr-modification-detail\n                                    [order]=\"order\"\n                                    [modification]=\"modification\"\n                                ></vdr-modification-detail>\n                            </vdr-history-entry-detail>\n                        </ng-container>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_PAYMENT_TRANSITION\">\n                        <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularPaymentTransition\">\n                            <div class=\"title\">\n                                {{ 'order.history-payment-settled' | translate }}\n                            </div>\n                            {{ 'order.transaction-id' | translate }}: {{ getPayment(entry)?.transactionId }}\n                            <vdr-history-entry-detail *ngIf=\"getPayment(entry) as payment\">\n                                <vdr-payment-detail\n                                    [payment]=\"payment\"\n                                    [currencyCode]=\"order.currencyCode\"\n                                ></vdr-payment-detail>\n                            </vdr-history-entry-detail>\n                        </ng-container>\n                        <ng-template #regularPaymentTransition>\n                            {{\n                                'order.history-payment-transition'\n                                    | translate\n                                        : {\n                                              from: entry.data.from,\n                                              to: entry.data.to,\n                                              id: getPayment(entry)?.transactionId\n                                          }\n                            }}\n                        </ng-template>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_REFUND_TRANSITION\">\n                        {{\n                            'order.history-refund-transition'\n                                | translate\n                                    : { from: entry.data.from, to: entry.data.to, id: entry.data.refundId }\n                        }}\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_CANCELLATION\">\n                        {{\n                            'order.history-items-cancelled'\n                                | translate: { count: getCancelledQuantity(entry) }\n                        }}\n                        <vdr-history-entry-detail *ngIf=\"getCancelledItems(entry) as items\">\n                            <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n                                {{ entry.data.reason }}\n                            </vdr-labeled-data>\n                            <vdr-labeled-data [label]=\"'order.contents' | translate\">\n                                <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n                            </vdr-labeled-data>\n                            <vdr-labeled-data [label]=\"'order.shipping-cancelled' | translate\">\n                                {{ entry.data.shippingCancelled }}\n                            </vdr-labeled-data>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT\">\n                        {{ 'order.history-fulfillment-created' | translate }}\n                        <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n                            <vdr-fulfillment-detail\n                                [fulfillmentId]=\"fulfillment.id\"\n                                [order]=\"order\"\n                            ></vdr-fulfillment-detail>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT_TRANSITION\">\n                        <ng-container *ngIf=\"entry.data.to === 'Delivered'\">\n                            <div class=\"title\">\n                                {{ 'order.history-fulfillment-delivered' | translate }}\n                            </div>\n                            {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n                        </ng-container>\n                        <ng-container *ngIf=\"entry.data.to === 'Shipped'\">\n                            <div class=\"title\">\n                                {{ 'order.history-fulfillment-shipped' | translate }}\n                            </div>\n                            {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n                        </ng-container>\n                        <ng-container *ngIf=\"entry.data.to !== 'Delivered' && entry.data.to !== 'Shipped'\">\n                            {{\n                                'order.history-fulfillment-transition'\n                                    | translate: { from: entry.data.from, to: entry.data.to }\n                            }}\n                        </ng-container>\n                        <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n                            <vdr-fulfillment-detail\n                                [fulfillmentId]=\"fulfillment.id\"\n                                [order]=\"order\"\n                            ></vdr-fulfillment-detail>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_NOTE\">\n                        <div class=\"flex\">\n                            <div class=\"note-text\">\n                                <span *ngIf=\"entry.isPublic\" class=\"note-visibility public\">{{\n                                    'common.public' | translate\n                                }}</span>\n                                <span *ngIf=\"!entry.isPublic\" class=\"note-visibility private\">{{\n                                    'common.private' | translate\n                                }}</span>\n                                {{ entry.data.note }}\n                            </div>\n                            <div class=\"flex-spacer\"></div>\n                            <vdr-dropdown>\n                                <button class=\"icon-button\" vdrDropdownTrigger>\n                                    <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n                                </button>\n                                <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                                    <button\n                                        vdrDropdownItem\n                                        (click)=\"updateNote.emit(entry)\"\n                                        [disabled]=\"!('UpdateOrder' | hasPermission)\"\n                                    >\n                                        <clr-icon shape=\"edit\"></clr-icon>\n                                        {{ 'common.edit' | translate }}\n                                    </button>\n                                    <div class=\"dropdown-divider\"></div>\n                                    <button\n                                        vdrDropdownItem\n                                        (click)=\"deleteNote.emit(entry)\"\n                                        [disabled]=\"!('UpdateOrder' | hasPermission)\"\n                                    >\n                                        <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n                                        {{ 'common.delete' | translate }}\n                                    </button>\n                                </vdr-dropdown-menu>\n                            </vdr-dropdown>\n                        </div>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_COUPON_APPLIED\">\n                        {{ 'order.history-coupon-code-applied' | translate }}:\n                        <vdr-chip>\n                            <a [routerLink]=\"['/marketing', 'promotions', entry.data.promotionId]\">{{\n                                entry.data.couponCode\n                            }}</a>\n                        </vdr-chip>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_COUPON_REMOVED\">\n                        {{ 'order.history-coupon-code-removed' | translate }}:\n                        <vdr-chip\n                            ><span class=\"cancelled-coupon-code\">{{ entry.data.couponCode }}</span></vdr-chip\n                        >\n                    </ng-container>\n                    <ng-container *ngSwitchDefault>\n                        <div class=\"title\">\n                            {{ entry.type | translate }}\n                        </div>\n                        <vdr-history-entry-detail *ngIf=\"entry.data\">\n                            <vdr-object-tree [value]=\"entry.data\"></vdr-object-tree>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                </ng-container>\n            </vdr-timeline-entry>\n        </ng-template>\n    </ng-container>\n\n    <vdr-timeline-entry [isLast]=\"true\" [createdAt]=\"order.createdAt\" [featured]=\"true\">\n        <div class=\"title\">\n            {{ 'order.history-order-created' | translate }}\n        </div>\n    </vdr-timeline-entry>\n</div>\n", styles: [":host{display:block}.entry-list{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry{display:flex;align-items:center}.note-entry .note{flex:1}.note-entry button{margin:0}.visibility-select{display:flex;justify-content:space-between;align-items:baseline}.visibility-select .public{color:var(--color-warning-700)}.visibility-select .private{color:var(--color-success-700)}textarea.note{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text{color:var(--color-grey-800);white-space:pre-wrap}.cancelled-coupon-code{text-decoration:line-through}.note-visibility{text-transform:lowercase}.note-visibility.public{color:var(--color-warning-700)}.note-visibility.private{color:var(--color-success-700)}\n"], dependencies: [{ kind: "directive", type: i2.ClrIconCustomTag, selector: "clr-icon" }, { kind: "directive", type: i2.ClrLabel, selector: "label", inputs: ["for"] }, { kind: "directive", type: i2.ClrCheckbox, selector: "[clrCheckbox],[clrToggle]" }, { kind: "component", type: i2.ClrCheckboxWrapper, selector: "clr-checkbox-wrapper,clr-toggle-wrapper" }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i3.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.ChipComponent, selector: "vdr-chip", inputs: ["icon", "invert", "colorFrom", "colorType"], outputs: ["iconClick"] }, { kind: "directive", type: i1.FormFieldControlDirective, selector: "input, textarea, select" }, { kind: "component", type: i1.DropdownComponent, selector: "vdr-dropdown", inputs: ["manualToggle"] }, { kind: "component", type: i1.DropdownMenuComponent, selector: "vdr-dropdown-menu", inputs: ["vdrPosition", "customClasses"] }, { kind: "directive", type: i1.DropdownTriggerDirective, selector: "[vdrDropdownTrigger]" }, { kind: "directive", type: i1.DropdownItemDirective, selector: "[vdrDropdownItem]" }, { kind: "component", type: i1.LabeledDataComponent, selector: "vdr-labeled-data", inputs: ["label"] }, { kind: "component", type: i1.ObjectTreeComponent, selector: "vdr-object-tree", inputs: ["value", "isArrayItem"] }, { kind: "component", type: i1.TimelineEntryComponent, selector: "vdr-timeline-entry", inputs: ["displayType", "createdAt", "name", "featured", "iconShape", "isLast", "collapsed"], outputs: ["expandClick"] }, { kind: "component", type: i1.HistoryEntryDetailComponent, selector: "vdr-history-entry-detail" }, { kind: "component", type: i6.FulfillmentDetailComponent, selector: "vdr-fulfillment-detail", inputs: ["fulfillmentId", "order"] }, { kind: "component", type: i7.PaymentDetailComponent, selector: "vdr-payment-detail", inputs: ["payment", "currencyCode"] }, { kind: "component", type: i8.SimpleItemListComponent, selector: "vdr-simple-item-list", inputs: ["items"] }, { kind: "component", type: i9.ModificationDetailComponent, selector: "vdr-modification-detail", inputs: ["order", "modification"] }, { kind: "component", type: i10.OrderHistoryEntryHostComponent, selector: "vdr-order-history-entry-host", inputs: ["entry", "order", "expanded"], outputs: ["expandClick"], exportAs: ["historyEntry"] }, { kind: "pipe", type: i11.TranslatePipe, name: "translate" }, { kind: "pipe", type: i1.HasPermissionPipe, name: "hasPermission" }, { kind: "pipe", type: i1.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: OrderHistoryComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-order-history', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"entry-list\" [class.expanded]=\"expanded\">\n    <vdr-timeline-entry iconShape=\"note\" displayType=\"muted\" [featured]=\"true\">\n        <div class=\"note-entry\">\n            <textarea [(ngModel)]=\"note\" name=\"note\" class=\"note\"></textarea>\n            <button class=\"btn btn-secondary\" [disabled]=\"!note\" (click)=\"addNoteToOrder()\">\n                {{ 'common.add-note' | translate }}\n            </button>\n        </div>\n        <div class=\"visibility-select\">\n            <clr-checkbox-wrapper>\n                <input type=\"checkbox\" clrCheckbox [(ngModel)]=\"noteIsPrivate\" />\n                <label>{{ 'order.note-is-private' | translate }}</label>\n            </clr-checkbox-wrapper>\n            <span *ngIf=\"noteIsPrivate\" class=\"private\">\n                {{ 'order.note-only-visible-to-administrators' | translate }}\n            </span>\n            <span *ngIf=\"!noteIsPrivate\" class=\"public\">\n                {{ 'order.note-visible-to-customer' | translate }}\n            </span>\n        </div>\n    </vdr-timeline-entry>\n    <ng-container *ngFor=\"let entry of history\">\n        <vdr-order-history-entry-host\n            *ngIf=\"hasCustomComponent(entry.type); else defaultComponents\"\n            [order]=\"order\"\n            [entry]=\"entry\"\n            [expanded]=\"expanded\"\n            (expandClick)=\"expanded = !expanded\"\n        ></vdr-order-history-entry-host>\n        <ng-template #defaultComponents>\n            <vdr-timeline-entry\n                [displayType]=\"getDisplayType(entry)\"\n                [iconShape]=\"getTimelineIcon(entry)\"\n                [createdAt]=\"entry.createdAt\"\n                [name]=\"getName(entry)\"\n                [featured]=\"isFeatured(entry)\"\n                [collapsed]=\"!expanded && !isFeatured(entry)\"\n                (expandClick)=\"expanded = !expanded\"\n            >\n                <ng-container [ngSwitch]=\"entry.type\">\n                    <ng-container *ngSwitchCase=\"type.ORDER_STATE_TRANSITION\">\n                        <div class=\"title\" *ngIf=\"entry.data.to === 'Delivered'\">\n                            {{ 'order.history-order-fulfilled' | translate }}\n                        </div>\n                        <div class=\"title\" *ngIf=\"entry.data.to === 'Cancelled'\">\n                            {{ 'order.history-order-cancelled' | translate }}\n                        </div>\n                        <ng-template [ngIf]=\"entry.data.to !== 'Cancelled' && entry.data.to !== 'Delivered'\">\n                            {{\n                                'order.history-order-transition'\n                                    | translate: { from: entry.data.from, to: entry.data.to }\n                            }}\n                        </ng-template>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_MODIFIED\">\n                        <div class=\"title\">\n                            {{ 'order.history-order-modified' | translate }}\n                        </div>\n                        <ng-container *ngIf=\"getModification(entry.data.modificationId) as modification\">\n                            {{ 'order.modify-order-price-difference' | translate }}:\n                            <strong>{{\n                                modification.priceChange | localeCurrency: order.currencyCode\n                            }}</strong>\n                            <vdr-chip colorType=\"success\" *ngIf=\"modification.isSettled\">{{\n                                'order.modification-settled' | translate\n                            }}</vdr-chip>\n                            <vdr-chip colorType=\"error\" *ngIf=\"!modification.isSettled\">{{\n                                'order.modification-not-settled' | translate\n                            }}</vdr-chip>\n                            <vdr-history-entry-detail>\n                                <vdr-modification-detail\n                                    [order]=\"order\"\n                                    [modification]=\"modification\"\n                                ></vdr-modification-detail>\n                            </vdr-history-entry-detail>\n                        </ng-container>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_PAYMENT_TRANSITION\">\n                        <ng-container *ngIf=\"entry.data.to === 'Settled'; else regularPaymentTransition\">\n                            <div class=\"title\">\n                                {{ 'order.history-payment-settled' | translate }}\n                            </div>\n                            {{ 'order.transaction-id' | translate }}: {{ getPayment(entry)?.transactionId }}\n                            <vdr-history-entry-detail *ngIf=\"getPayment(entry) as payment\">\n                                <vdr-payment-detail\n                                    [payment]=\"payment\"\n                                    [currencyCode]=\"order.currencyCode\"\n                                ></vdr-payment-detail>\n                            </vdr-history-entry-detail>\n                        </ng-container>\n                        <ng-template #regularPaymentTransition>\n                            {{\n                                'order.history-payment-transition'\n                                    | translate\n                                        : {\n                                              from: entry.data.from,\n                                              to: entry.data.to,\n                                              id: getPayment(entry)?.transactionId\n                                          }\n                            }}\n                        </ng-template>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_REFUND_TRANSITION\">\n                        {{\n                            'order.history-refund-transition'\n                                | translate\n                                    : { from: entry.data.from, to: entry.data.to, id: entry.data.refundId }\n                        }}\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_CANCELLATION\">\n                        {{\n                            'order.history-items-cancelled'\n                                | translate: { count: getCancelledQuantity(entry) }\n                        }}\n                        <vdr-history-entry-detail *ngIf=\"getCancelledItems(entry) as items\">\n                            <vdr-labeled-data [label]=\"'order.cancellation-reason' | translate\">\n                                {{ entry.data.reason }}\n                            </vdr-labeled-data>\n                            <vdr-labeled-data [label]=\"'order.contents' | translate\">\n                                <vdr-simple-item-list [items]=\"items\"></vdr-simple-item-list>\n                            </vdr-labeled-data>\n                            <vdr-labeled-data [label]=\"'order.shipping-cancelled' | translate\">\n                                {{ entry.data.shippingCancelled }}\n                            </vdr-labeled-data>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT\">\n                        {{ 'order.history-fulfillment-created' | translate }}\n                        <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n                            <vdr-fulfillment-detail\n                                [fulfillmentId]=\"fulfillment.id\"\n                                [order]=\"order\"\n                            ></vdr-fulfillment-detail>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_FULFILLMENT_TRANSITION\">\n                        <ng-container *ngIf=\"entry.data.to === 'Delivered'\">\n                            <div class=\"title\">\n                                {{ 'order.history-fulfillment-delivered' | translate }}\n                            </div>\n                            {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n                        </ng-container>\n                        <ng-container *ngIf=\"entry.data.to === 'Shipped'\">\n                            <div class=\"title\">\n                                {{ 'order.history-fulfillment-shipped' | translate }}\n                            </div>\n                            {{ 'order.tracking-code' | translate }}: {{ getFulfillment(entry)?.trackingCode }}\n                        </ng-container>\n                        <ng-container *ngIf=\"entry.data.to !== 'Delivered' && entry.data.to !== 'Shipped'\">\n                            {{\n                                'order.history-fulfillment-transition'\n                                    | translate: { from: entry.data.from, to: entry.data.to }\n                            }}\n                        </ng-container>\n                        <vdr-history-entry-detail *ngIf=\"getFulfillment(entry) as fulfillment\">\n                            <vdr-fulfillment-detail\n                                [fulfillmentId]=\"fulfillment.id\"\n                                [order]=\"order\"\n                            ></vdr-fulfillment-detail>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_NOTE\">\n                        <div class=\"flex\">\n                            <div class=\"note-text\">\n                                <span *ngIf=\"entry.isPublic\" class=\"note-visibility public\">{{\n                                    'common.public' | translate\n                                }}</span>\n                                <span *ngIf=\"!entry.isPublic\" class=\"note-visibility private\">{{\n                                    'common.private' | translate\n                                }}</span>\n                                {{ entry.data.note }}\n                            </div>\n                            <div class=\"flex-spacer\"></div>\n                            <vdr-dropdown>\n                                <button class=\"icon-button\" vdrDropdownTrigger>\n                                    <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\n                                </button>\n                                <vdr-dropdown-menu vdrPosition=\"bottom-right\">\n                                    <button\n                                        vdrDropdownItem\n                                        (click)=\"updateNote.emit(entry)\"\n                                        [disabled]=\"!('UpdateOrder' | hasPermission)\"\n                                    >\n                                        <clr-icon shape=\"edit\"></clr-icon>\n                                        {{ 'common.edit' | translate }}\n                                    </button>\n                                    <div class=\"dropdown-divider\"></div>\n                                    <button\n                                        vdrDropdownItem\n                                        (click)=\"deleteNote.emit(entry)\"\n                                        [disabled]=\"!('UpdateOrder' | hasPermission)\"\n                                    >\n                                        <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\n                                        {{ 'common.delete' | translate }}\n                                    </button>\n                                </vdr-dropdown-menu>\n                            </vdr-dropdown>\n                        </div>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_COUPON_APPLIED\">\n                        {{ 'order.history-coupon-code-applied' | translate }}:\n                        <vdr-chip>\n                            <a [routerLink]=\"['/marketing', 'promotions', entry.data.promotionId]\">{{\n                                entry.data.couponCode\n                            }}</a>\n                        </vdr-chip>\n                    </ng-container>\n                    <ng-container *ngSwitchCase=\"type.ORDER_COUPON_REMOVED\">\n                        {{ 'order.history-coupon-code-removed' | translate }}:\n                        <vdr-chip\n                            ><span class=\"cancelled-coupon-code\">{{ entry.data.couponCode }}</span></vdr-chip\n                        >\n                    </ng-container>\n                    <ng-container *ngSwitchDefault>\n                        <div class=\"title\">\n                            {{ entry.type | translate }}\n                        </div>\n                        <vdr-history-entry-detail *ngIf=\"entry.data\">\n                            <vdr-object-tree [value]=\"entry.data\"></vdr-object-tree>\n                        </vdr-history-entry-detail>\n                    </ng-container>\n                </ng-container>\n            </vdr-timeline-entry>\n        </ng-template>\n    </ng-container>\n\n    <vdr-timeline-entry [isLast]=\"true\" [createdAt]=\"order.createdAt\" [featured]=\"true\">\n        <div class=\"title\">\n            {{ 'order.history-order-created' | translate }}\n        </div>\n    </vdr-timeline-entry>\n</div>\n", styles: [":host{display:block}.entry-list{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry{display:flex;align-items:center}.note-entry .note{flex:1}.note-entry button{margin:0}.visibility-select{display:flex;justify-content:space-between;align-items:baseline}.visibility-select .public{color:var(--color-warning-700)}.visibility-select .private{color:var(--color-success-700)}textarea.note{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text{color:var(--color-grey-800);white-space:pre-wrap}.cancelled-coupon-code{text-decoration:line-through}.note-visibility{text-transform:lowercase}.note-visibility.public{color:var(--color-warning-700)}.note-visibility.private{color:var(--color-success-700)}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.HistoryEntryComponentService }]; }, propDecorators: { order: [{
                type: Input
            }], history: [{
                type: Input
            }], addNote: [{
                type: Output
            }], updateNote: [{
                type: Output
            }], deleteNote: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 