@vendure/admin-ui-plugin 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin-ui/72.ffa88451e7e9adcc.js +86 -0
- package/lib/admin-ui/72.ffa88451e7e9adcc.js.map +1 -0
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/{main.9b722ee7f83b9fe1.js → main.f3d5cd2440e2a365.js} +2 -2
- package/lib/admin-ui/{main.9b722ee7f83b9fe1.js.map → main.f3d5cd2440e2a365.js.map} +1 -1
- package/lib/admin-ui/{runtime.8a9e26f14af4c1b3.js → runtime.828dc4521ad86b23.js} +2 -2
- package/lib/admin-ui/{runtime.8a9e26f14af4c1b3.js.map → runtime.828dc4521ad86b23.js.map} +1 -1
- package/package.json +5 -5
- package/lib/admin-ui/72.09c197e199f1dc00.js +0 -86
- package/lib/admin-ui/72.09c197e199f1dc00.js.map +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[72],{5072:(Gd,Ze,s)=>{s.r(Ze),s.d(Ze,{AddManualPaymentDialogComponent:()=>ae,CancelOrderDialogComponent:()=>le,CouponCodeSelectorComponent:()=>K,DraftOrderDetailComponent:()=>fe,DraftOrderVariantSelectorComponent:()=>pe,FulfillOrderDialogComponent:()=>ge,FulfillmentCardComponent:()=>Ce,FulfillmentDetailComponent:()=>ee,FulfillmentStateLabelComponent:()=>ye,GET_COUPON_CODE_SELECTOR_PROMOTION_LIST:()=>At,GET_CUSTOMER_ADDRESSES:()=>Id,GET_ORDER_STATE:()=>Et,GET_SELLER_ORDERS:()=>It,LineFulfillmentComponent:()=>z,LineRefundsComponent:()=>V,ModificationDetailComponent:()=>he,NODE_HEIGHT:()=>Be,ORDER_DETAIL_QUERY:()=>Za,OrderCustomFieldsCardComponent:()=>_e,OrderDataTableComponent:()=>Z,OrderDetailComponent:()=>De,OrderEditResultType:()=>w,OrderEditorComponent:()=>Fe,OrderEditsPreviewDialogComponent:()=>xe,OrderGuard:()=>T,OrderHistoryComponent:()=>Te,OrderHistoryEntryHostComponent:()=>we,OrderListComponent:()=>$e,OrderModificationSummaryComponent:()=>oe,OrderModule:()=>ie,OrderPaymentCardComponent:()=>ke,OrderProcessEdgeComponent:()=>Oe,OrderProcessGraphComponent:()=>ve,OrderProcessGraphDialogComponent:()=>be,OrderProcessNodeComponent:()=>te,OrderStateSelectDialogComponent:()=>me,OrderTableComponent:()=>L,OrderTotalColumnComponent:()=>N,OrderTransitionService:()=>Y,PaymentDetailComponent:()=>re,PaymentForRefundSelectorComponent:()=>ne,PaymentStateLabelComponent:()=>Ee,RefundDetailComponent:()=>Ae,RefundOrderDialogComponent:()=>Ie,RefundStateLabelComponent:()=>Re,SET_ORDER_CUSTOMER_MUTATION:()=>el,SelectAddressDialogComponent:()=>q,SelectCustomerDialogComponent:()=>H,SelectShippingMethodDialogComponent:()=>B,SellerOrdersCardComponent:()=>Se,SettleRefundDialogComponent:()=>Ge,SimpleItemListComponent:()=>X,createRoutes:()=>Rt,getRefundablePayments:()=>Ve});var l=s(1200),C=s(6960);function Ve(r){return(r||[]).filter(t=>"Settled"===t.state).map((t,o)=>{const i=t.amount-(0,C.summate)(t.refunds.filter(a=>"Failed"!==a.state),"total");return{...t,refundableAmount:i,amountToRefundControl:new l.Ku(0,{nonNullable:!0,validators:[l.AQ.min(0),l.AQ.max(i)]}),selected:0===o}})}var d=s(6652),M=s(9456),e=s(9568),S=s(868),P=s(1128),y=s(8540),E=s(5540),v=s(5416),m=s(9904),p=s(9784),g=s(7036);function kt(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.add-payment-to-order"))}function wt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",8),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.submit())}),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"localeCurrency"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,4,"common.cancel")),e.yG2(2),e.E7m("disabled",t.form.invalid||t.form.pristine),e.yG2(),e.CAO(" ",e.kDX(5,6,"order.add-payment")," (",e.g7$(6,8,t.outstandingAmount,t.currencyCode),") ")}}M.Ip`
|
|
2
|
-
query GetAddManualPaymentMethodList($options: PaymentMethodListOptions!) {
|
|
3
|
-
paymentMethods(options: $options) {
|
|
4
|
-
items {
|
|
5
|
-
id
|
|
6
|
-
createdAt
|
|
7
|
-
updatedAt
|
|
8
|
-
name
|
|
9
|
-
code
|
|
10
|
-
description
|
|
11
|
-
enabled
|
|
12
|
-
}
|
|
13
|
-
totalItems
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`;class ae{constructor(n){this.dataService=n,this.form=new l.k1({method:new l.yM("",l.AQ.required),transactionId:new l.yM("",l.AQ.required)})}ngOnInit(){this.paymentMethods$=this.dataService.query(d.yIk,{options:{take:999}}).mapSingle(n=>n.paymentMethods.items)}submit(){const n=this.form.value;this.resolveWith({method:n.method,transactionId:n.transactionId})}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||ae)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:ae,selectors:[["vdr-add-manual-payment-dialog"]],decls:10,vars:11,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","method",3,"label"],["bindLabel","code","appendTo","body","autofocus","","bindValue","code","formControlName","method",3,"items","addTag"],["for","transactionId",3,"label"],["id","transactionId","type","text","formControlName","transactionId"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,kt,2,3,"ng-template",0),e.I0R(1,"form",1)(2,"vdr-form-field",2),e.wVc(3,"translate"),e.wR5(4,"ng-select",3),e.wVc(5,"async"),e.C$Y(),e.I0R(6,"vdr-form-field",4),e.wVc(7,"translate"),e.wR5(8,"input",5),e.C$Y()(),e.yuY(9,wt,7,11,"ng-template",6)),2&t&&(e.yG2(),e.E7m("formGroup",o.form),e.yG2(),e.E7m("label",e.kDX(3,5,"order.payment-method")),e.yG2(2),e.E7m("items",e.kDX(5,7,o.paymentMethods$))("addTag",!0),e.yG2(2),e.E7m("label",e.kDX(7,9,"order.transaction-id")))},dependencies:[l.sz,l.ot,l.ue,l.u,l.uW,l.Wo,S.UT,P._,y.w,E.E,v.a,m.a,p.sD,g.u],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0})}var u=s(9808),_=s(2510),j=s(632);function Tt(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.cancel-order"))}function St(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",19),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.kNx(c.lineQuantities[a.id],i)||(c.lineQuantities[a.id]=i),e.CGJ(i)}),e.qCj("input",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.checkIfAllSelected())}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.OKB("ngModel",o.lineQuantities[t.id]),e.E7m("disabled",o.cancelAll)("max",t.quantity)}}function Dt(r,n){if(1&r&&e.OEk(0),2&r){const t=e.GaO().$implicit;e.cNF(t.quantity)}}function xt(r,n){if(1&r&&(e.I0R(0,"tr",10)(1,"td",11),e.wR5(2,"img",12),e.wVc(3,"assetPreview"),e.C$Y(),e.I0R(4,"td",13),e.OEk(5),e.C$Y(),e.I0R(6,"td",14),e.OEk(7),e.C$Y(),e.I0R(8,"td",15),e.OEk(9),e.C$Y(),e.I0R(10,"td",15),e.OEk(11),e.wVc(12,"localeCurrency"),e.C$Y(),e.I0R(13,"td",16),e.yuY(14,St,1,3,"input",17)(15,Dt,1,1,"ng-template",null,18,e.gJz),e.C$Y()()),2&r){const t=n.$implicit,o=e.Gew(16),i=e.GaO();e.eAK("is-disabled",i.cancelAll)("is-cancelled",0===t.quantity),e.yG2(2),e.E7m("src",e.g7$(3,11,t.featuredAsset,"tiny"),e.K6U),e.yG2(3),e.cNF(t.productVariant.name),e.yG2(2),e.cNF(t.productVariant.sku),e.yG2(2),e.cNF(t.quantity),e.yG2(2),e.oRS(" ",e.g7$(12,14,t.unitPriceWithTax,i.order.currencyCode)," "),e.yG2(3),e.E7m("ngIf",t.quantity>0&&!i.order.active)("ngIfElse",o)}}function Ft(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"clr-radio-wrapper")(2,"input",20),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.cancelAll,i)||(a.cancelAll=i),e.CGJ(i)}),e.qCj("ngModelChange",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.radioChanged())}),e.C$Y(),e.I0R(3,"label"),e.OEk(4),e.wVc(5,"translate"),e.C$Y()(),e.I0R(6,"clr-radio-wrapper")(7,"input",20),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.cancelAll,i)||(a.cancelAll=i),e.CGJ(i)}),e.qCj("ngModelChange",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.radioChanged())}),e.C$Y(),e.I0R(8,"label"),e.OEk(9),e.wVc(10,"translate"),e.C$Y()(),e.k70()}if(2&r){const t=e.GaO();e.yG2(2),e.E7m("value",!0),e.OKB("ngModel",t.cancelAll),e.yG2(2),e.cNF(e.kDX(5,6,"order.cancel-entire-order")),e.yG2(3),e.E7m("value",!1),e.OKB("ngModel",t.cancelAll),e.yG2(2),e.cNF(e.kDX(10,8,"order.cancel-specified-items"))}}function $t(r,n){1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-selected-items")," "))}function Yt(r,n){1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-order")," "))}function Mt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",21),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",22),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.yuY(4,$t,3,3,"ng-container",6)(5,Yt,3,3,"ng-container",6),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,4,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.reason||!t.order.active&&0===t.selectionCount),e.yG2(),e.E7m("ngIf",!t.order.active),e.yG2(),e.E7m("ngIf",t.order.active)}}class le{get selectionCount(){return Object.values(this.lineQuantities).reduce((n,t)=>n+t,0)}constructor(n){this.i18nService=n,this.cancelAll=!0,this.lineQuantities={},this.reasons=(0,d.g$r)().cancellationReasons??[(0,u.s)("order.cancel-reason-customer-request"),(0,u.s)("order.cancel-reason-not-available")],this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:t.quantity}),{})}radioChanged(){if(this.cancelAll)for(const n of this.order.lines)this.lineQuantities[n.id]=n.quantity;else for(const n of this.order.lines)this.lineQuantities[n.id]=0}checkIfAllSelected(){for(const[n,t]of Object.entries(this.lineQuantities)){const o=this.order.lines.find(i=>i.id===n)?.quantity;if(o&&t<o)return}this.cancelAll=!0}select(){this.resolveWith({orderId:this.order.id,lines:this.getLineInputs(),reason:this.reason,cancelShipping:this.cancelAll})}cancel(){this.resolveWith()}getLineInputs(){if(!this.order.active)return Object.entries(this.lineQuantities).map(([n,t])=>({orderLineId:n,quantity:t})).filter(n=>0<n.quantity)}static#e=this.\u0275fac=function(t){return new(t||le)(e.GI1(d.WYg))};static#t=this.\u0275cmp=e.In1({type:le,selectors:[["vdr-cancel-order-dialog"]],decls:30,vars:23,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-lines"],[1,"table"],["class","order-line",3,"is-disabled","is-cancelled",4,"ngFor","ngForOf"],[1,"cancellation-details"],[4,"ngIf"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","addTag","ngModel","ngModelChange"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input",4,"ngIf","ngIfElse"],["nonEditable",""],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input"],["type","radio","clrRadio","","name","options",3,"value","ngModel","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,Tt,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e.wR5(6,"th"),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.I0R(16,"th"),e.OEk(17),e.wVc(18,"translate"),e.C$Y(),e.I0R(19,"th"),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()(),e.yuY(22,xt,17,17,"tr",4),e.C$Y()(),e.I0R(23,"div",5),e.yuY(24,Ft,11,10,"ng-container",6),e.I0R(25,"label",7),e.OEk(26),e.wVc(27,"translate"),e.C$Y(),e.I0R(28,"ng-select",8),e.iHE("ngModelChange",function(a){return e.kNx(o.reason,a)||(o.reason=a),a}),e.C$Y()()(),e.yuY(29,Mt,6,6,"ng-template",9)),2&t&&(e.yG2(8),e.cNF(e.kDX(9,11,"order.product-name")),e.yG2(3),e.cNF(e.kDX(12,13,"order.product-sku")),e.yG2(3),e.cNF(e.kDX(15,15,"order.quantity")),e.yG2(3),e.cNF(e.kDX(18,17,"order.unit-price")),e.yG2(3),e.cNF(e.kDX(21,19,"order.cancel")),e.yG2(2),e.E7m("ngForOf",o.order.lines),e.yG2(2),e.E7m("ngIf",!0!==o.order.active),e.yG2(2),e.cNF(e.kDX(27,21,"order.cancellation-reason")),e.yG2(2),e.E7m("items",o.reasons)("addTag",!0),e.OKB("ngModel",o.reason))},dependencies:[_.ojz,_.Cgz,_.WK0,m.ay,m.u_,l.ot,l.O4,l.ye,l.ue,l.Gu,l._t,l._G,S.UT,y.w,E.E,v.a,p.sD,j.w,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .cancellation-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}"],changeDetection:0})}var Q=s(5116),et=s(8580),Ne=s(7396),tt=s(6845),f=s(5208),R=s(9752),nt=s(532),D=s(2092);function Pt(r,n){if(1&r&&(e.I0R(0,"div",2)(1,"vdr-chip",3),e.OEk(2),e.C$Y(),e.I0R(3,"span"),e.OEk(4),e.C$Y()()),2&r){const t=n.item;e.yG2(2),e.cNF(t.code),e.yG2(2),e.cNF(t.promotionName)}}const At=M.Ip`
|
|
17
|
-
query GetCouponCodeSelectorPromotionList($options: PromotionListOptions) {
|
|
18
|
-
promotions(options: $options) {
|
|
19
|
-
items {
|
|
20
|
-
id
|
|
21
|
-
name
|
|
22
|
-
couponCode
|
|
23
|
-
}
|
|
24
|
-
totalItems
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`;class K{constructor(n){this.dataService=n,this.addCouponCode=new e._w7,this.removeCouponCode=new e._w7,this.couponCodeInput$=new Q.E}ngOnInit(){this.availableCouponCodes$=(0,et.W)(this.couponCodeInput$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,f.G)(n=>this.dataService.query(d.MNc,{options:{take:10,skip:0,filter:{couponCode:{contains:n}}}}).single$),(0,R.k)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,nt.W)([]))),this.control||(this.control=new l.yM(this.couponCodes??[]))}remove(n){this.removeCouponCode.emit(n)}static#e=this.\u0275fac=function(t){return new(t||K)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:K,selectors:[["vdr-coupon-code-selector"]],inputs:{couponCodes:"couponCodes",control:"control"},outputs:{addCouponCode:"addCouponCode",removeCouponCode:"removeCouponCode"},decls:3,vars:9,consts:[["appendTo","body","bindLabel","code","bindValue","code","typeToSearchText","",3,"items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl","add","remove"],["ng-option-tmp",""],[1,"flex","items-center"],[1,"mr-1"]],template:function(t,o){1&t&&(e.I0R(0,"ng-select",0),e.qCj("add",function(a){return o.addCouponCode.emit(a.code)})("remove",function(a){return o.remove(a.code)}),e.wVc(1,"async"),e.yuY(2,Pt,5,2,"ng-template",1),e.C$Y()),2&t&&e.E7m("items",e.kDX(1,7,o.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",o.couponCodeInput$)("formControl",o.control)},dependencies:[l.ue,l.ug,S.UT,S.kn,D.g,m.a],changeDetection:0})}var rt=s(80),Vt=s(64),x=s(9128),Nt=s(8904),O=s(7980),de=s(7616),se=s(1485),ot=s(4648),it=s(1760),at=s(660);function Lt(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-address"))}function Xt(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",7),e.wR5(1,"vdr-formatted-address",8),e.C$Y()),2&r){const t=n.$implicit;e.E7m("item",t),e.yG2(),e.E7m("address",t)}}function jt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab-content")(1,"vdr-radio-card-fieldset",5),e.qCj("selectItem",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.selectedAddress=i)}),e.yuY(2,Xt,2,2,"vdr-radio-card",6),e.C$Y()()}if(2&r){const t=e.GaO(2).ngIf,o=e.GaO();e.yG2(),e.E7m("idFn",o.addressIdFn)("selectedItemId",o.selectedAddress&&o.addressIdFn(o.selectedAddress)),e.yG2(),e.E7m("ngForOf",t)}}function Qt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",3),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,jt,3,3,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"order.existing-address")),e.yG2(2),e.E7m("clrIfActive",t.useExisting)}}function Kt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content"),e.wR5(1,"vdr-address-form",9),e.wVc(2,"async"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("formGroup",t.addressForm)("availableCountries",e.kDX(2,2,t.availableCountries$))}}function qt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs"),e.yuY(1,Qt,5,4,"clr-tab",1),e.I0R(2,"clr-tab")(3,"button",3),e.OEk(4),e.wVc(5,"translate"),e.C$Y(),e.yuY(6,Kt,3,4,"ng-template",4),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customerId&&t.length),e.yG2(3),e.cNF(e.kDX(5,3,"customer.create-new-address")),e.yG2(2),e.E7m("clrIfActive",o.createNew)}}function Ht(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&!t.selectedAddress||t.createNew&&t.addressForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class q{constructor(n,t){this.dataService=n,this.formBuilder=t,this.useExisting=!0,this.createNew=!1}ngOnInit(){this.addressForm=this.formBuilder.group({fullName:[this.currentAddress?.fullName??""],company:[this.currentAddress?.company??""],streetLine1:[this.currentAddress?.streetLine1??"",l.AQ.required],streetLine2:[this.currentAddress?.streetLine2??""],city:[this.currentAddress?.city??"",l.AQ.required],province:[this.currentAddress?.province??""],postalCode:[this.currentAddress?.postalCode??"",l.AQ.required],countryCode:[this.currentAddress?.countryCode??"",l.AQ.required],phoneNumber:[this.currentAddress?.phoneNumber??""]}),this.useExisting=!!this.customerId,this.addresses$=this.customerId?this.dataService.query(d.sTc,{customerId:this.customerId}).mapSingle(({customer:n})=>n?.addresses??[]).pipe((0,de.y)(n=>{this.currentAddress&&(this.selectedAddress=n.find(t=>t.streetLine1===this.currentAddress?.streetLine1&&t.postalCode===this.currentAddress?.postalCode)),0===n.length&&(this.createNew=!0,this.useExisting=!1)})):(0,O.of)([]),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(({countries:n})=>n.items)}trackByFn(n){return n.id}addressIdFn(n){return n.streetLine1+n.postalCode}cancel(){this.resolveWith()}select(){if(this.useExisting&&this.selectedAddress&&this.resolveWith({...(0,Nt.g)(this.selectedAddress,["fullName","company","streetLine1","streetLine2","city","province","phoneNumber","postalCode"]),countryCode:this.selectedAddress.country.code}),this.createNew&&this.addressForm.valid){const n=this.addressForm.value;this.resolveWith(n)}}static#e=this.\u0275fac=function(t){return new(t||q)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:q,selectors:[["vdr-select-address-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[4,"ngIf"],["vdrDialogButtons",""],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"block","mt-4",3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],[3,"item"],[3,"address"],[3,"formGroup","availableCountries"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,Lt,2,3,"ng-template",0)(1,qt,7,5,"clr-tabs",1),e.wVc(2,"async"),e.yuY(3,Ht,6,7,"ng-template",2)),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,1,o.addresses$)))},dependencies:[_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.ay,m.u_,l.u,l.uW,E.E,v.a,se.o,ot.w,it.W,at.e,m.a,p.sD],changeDetection:0})}var lt=s(9923);function Bt(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO();e.cNF(e.kDX(1,1,t.title))}}function Jt(r,n){1&r&&e.C_f(0)}function Wt(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-form-field",7),e.wVc(1,"translate"),e.I0R(2,"textarea",8),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.note,i)||(a.note=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=e.GaO(2);e.E7m("label",e.kDX(1,2,"common.add-note")),e.yG2(2),e.OKB("ngModel",t.note)}}function Ut(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Jt,1,0,"ng-container",5)(2,Wt,3,4,"vdr-form-field",6),e.k70()),2&r){const t=e.GaO(),o=e.Gew(4);e.yG2(),e.E7m("ngTemplateOutlet",o),e.yG2(),e.E7m("ngIf",t.includeNoteInput)}}function zt(r,n){1&r&&e.C_f(0)}function Zt(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"div",12),e.yuY(2,zt,1,0,"ng-container",5),e.C$Y()()),2&r){e.GaO(2);const t=e.Gew(4);e.yG2(2),e.E7m("ngTemplateOutlet",t)}}function en(r,n){if(1&r&&(e.I0R(0,"clr-tab-content")(1,"form",13)(2,"vdr-form-field",14),e.wVc(3,"translate"),e.wR5(4,"input",15),e.C$Y(),e.I0R(5,"vdr-form-field",16),e.wVc(6,"translate"),e.wR5(7,"input",17),e.C$Y(),e.I0R(8,"vdr-form-field",18),e.wVc(9,"translate"),e.wR5(10,"input",19),e.C$Y(),e.I0R(11,"vdr-form-field",20),e.wVc(12,"translate"),e.wR5(13,"input",21),e.C$Y(),e.I0R(14,"vdr-form-field",22),e.wVc(15,"translate"),e.wR5(16,"input",23),e.C$Y()()()),2&r){const t=e.GaO(3);e.yG2(),e.E7m("formGroup",t.customerForm),e.yG2(),e.E7m("label",e.kDX(3,6,"customer.title")),e.yG2(3),e.E7m("label",e.kDX(6,8,"customer.first-name")),e.yG2(3),e.E7m("label",e.kDX(9,10,"customer.last-name")),e.yG2(3),e.E7m("label",e.kDX(12,12,"customer.email-address")),e.yG2(3),e.E7m("label",e.kDX(15,14,"customer.phone-number"))}}function tn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tab")(1,"button",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,en,17,16,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO(2);return e.kNx(a.createNew,i)||(a.createNew=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO(2);e.yG2(2),e.cNF(e.kDX(3,2,"customer.create-new-customer")),e.yG2(2),e.E7m("clrIfActive",t.createNew)}}function nn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"clr-tabs",9)(1,"clr-tab")(2,"button",10),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.yuY(5,Zt,3,1,"ng-template",11),e.iHE("clrIfActiveChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.useExisting,i)||(a.useExisting=i),e.CGJ(i)}),e.C$Y(),e.yuY(6,tn,5,4,"clr-tab",1),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(3),e.cNF(e.kDX(4,3,"order.existing-customer")),e.yG2(2),e.E7m("clrIfActive",t.useExisting),e.yG2(),e.E7m("ngIf",t.canCreateNew)}}function rn(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function on(r,n){if(1&r&&(e.I0R(0,"span",27),e.wR5(1,"clr-icon",28),e.I0R(2,"span",29),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-chip"),e.OEk(5),e.C$Y()()),2&r){const t=n.item;e.yG2(3),e.CAO("",t.firstName," ",t.lastName,""),e.yG2(2),e.cNF(t.emailAddress)}}function an(r,n){if(1&r){const t=e.KQA();e.I0R(0,"ng-select",24),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.selectedCustomer,i)||(a.selectedCustomer=i),e.CGJ(i)}),e.wVc(1,"async"),e.yuY(2,rn,6,3,"ng-template",25)(3,on,6,3,"ng-template",26),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("items",e.kDX(1,9,t.customers$))("addTag",!1)("multiple",!0)("hideSelected",!0)("trackByFn",t.trackByFn)("minTermLength",2)("loading",t.isLoading)("typeahead",t.input$),e.OKB("ngModel",t.selectedCustomer)}}function ln(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",30),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",31),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",t.useExisting&&0===t.selectedCustomer.length||t.createNew&&t.customerForm.invalid),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class H{constructor(n,t){this.dataService=n,this.formBuilder=t,this.canCreateNew=!0,this.includeNoteInput=!1,this.title=(0,u.s)("order.set-customer-for-order"),this.isLoading=!1,this.input$=new Q.E,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.note="",this.customerForm=this.formBuilder.group({title:"",firstName:["",l.AQ.required],lastName:["",l.AQ.required],phoneNumber:"",emailAddress:["",[l.AQ.required,l.AQ.email]]})}ngOnInit(){this.customers$=(0,et.W)((0,O.of)([]),this.input$.pipe((0,Ne.o)(200),(0,tt.a)(),(0,de.y)(()=>this.isLoading=!0),(0,f.G)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,lt.a)(()=>(0,O.of)([])),(0,de.y)(()=>this.isLoading=!1)))))}trackByFn(n){return n.id}cancel(){this.resolveWith()}select(){if(this.useExisting&&1===this.selectedCustomer.length)this.resolveWith({...this.selectedCustomer[0],note:this.note});else if(this.createNew&&this.customerForm.valid){const n=this.customerForm.value;this.resolveWith({...n,note:this.note})}}static#e=this.\u0275fac=function(t){return new(t||H)(e.GI1(d.Aj0),e.GI1(l.KE))};static#t=this.\u0275cmp=e.In1({type:H,selectors:[["vdr-select-customer-dialog"]],decls:6,vars:2,consts:[["vdrDialogTitle",""],[4,"ngIf"],["class","pt-1",4,"ngIf"],["customerSelect",""],["vdrDialogButtons",""],[4,"ngTemplateOutlet"],["class","mt-4",3,"label",4,"ngIf"],[1,"mt-4",3,"label"],[3,"ngModel","ngModelChange"],[1,"pt-1"],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"mt-4"],[3,"formGroup"],["for","title",3,"label"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["appendTo","body","bindLabel","name",3,"items","addTag","multiple","hideSelected","trackByFn","minTermLength","loading","typeahead","ngModel","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],[1,"item-row"],["shape","user",1,"is-solid"],[1,"mx-1"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&e.yuY(0,Bt,2,3,"ng-template",0)(1,Ut,3,2,"ng-container",1)(2,nn,7,5,"clr-tabs",2)(3,an,4,11,"ng-template",null,3,e.gJz)(5,ln,6,7,"ng-template",4),2&t&&(e.yG2(),e.E7m("ngIf",!o.canCreateNew),e.yG2(),e.E7m("ngIf",o.canCreateNew))},dependencies:[_.o3d,_.gxU,_.o1y,_._IX,_.k1p,_.wfG,_.M9m,_.ULu,m.u_,m.XV,l.sz,l.ot,l.ue,l.u,l._G,l.uW,l.Wo,S.UT,S.kn,S.Ar,D.g,P._,y.w,E.E,v.a,m.a,p.sD],styles:[".item-row[_ngcontent-%COMP%]{display:flex;align-items:center}clr-tabs[_ngcontent-%COMP%]{display:block}"],changeDetection:0})}var h=s(2524),ce=s(7196);function dn(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-shipping-method"))}function sn(r,n){if(1&r&&e.wR5(0,"vdr-object-tree",9),2&r){const t=e.GaO().$implicit;e.E7m("value",t.metadata)}}function cn(r,n){if(1&r&&(e.I0R(0,"vdr-radio-card",4)(1,"div",5)(2,"vdr-labeled-data",6),e.wVc(3,"translate"),e.OEk(4),e.C$Y(),e.I0R(5,"div",7)(6,"vdr-labeled-data",6),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y(),e.I0R(10,"vdr-labeled-data",6),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y()(),e.yuY(14,sn,1,1,"vdr-object-tree",8),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.E7m("item",t),e.yG2(2),e.E7m("label",e.kDX(3,8,"settings.shipping-method")),e.yG2(2),e.oRS(" ",t.name," "),e.yG2(2),e.E7m("label",e.kDX(7,10,"common.price")),e.yG2(2),e.oRS(" ",e.g7$(9,12,t.price,o.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(11,15,"common.price-with-tax")),e.yG2(2),e.oRS(" ",e.g7$(13,17,t.priceWithTax,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.metadata)}}function mn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.selectedMethod),e.yG2(),e.oRS(" ",e.kDX(5,5,"common.okay")," ")}}class B{ngOnInit(){this.currentSelectionId&&(this.selectedMethod=this.eligibleShippingMethods.find(n=>n.id===this.currentSelectionId))}methodIdFn(n){return n.id}cancel(){this.resolveWith()}select(){this.selectedMethod&&this.resolveWith(this.selectedMethod.id)}static#e=this.\u0275fac=function(t){return new(t||B)};static#t=this.\u0275cmp=e.In1({type:B,selectors:[["vdr-select-shipping-method-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[3,"idFn","selectedItemId","selectItem"],[3,"item",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"item"],[1,"result-details"],[3,"label"],[1,"price-row"],[3,"value",4,"ngIf"],[3,"value"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,dn,2,3,"ng-template",0),e.I0R(1,"vdr-radio-card-fieldset",1),e.qCj("selectItem",function(a){return o.selectedMethod=a}),e.yuY(2,cn,15,20,"vdr-radio-card",2),e.C$Y(),e.yuY(3,mn,6,7,"ng-template",3)),2&t&&(e.yG2(),e.E7m("idFn",o.methodIdFn)("selectedItemId",null==o.selectedMethod?null:o.selectedMethod.id),e.yG2(),e.E7m("ngForOf",o.eligibleShippingMethods))},dependencies:[m.ay,m.u_,E.E,v.a,h.a,ce.W,it.W,at.e,p.sD,g.u],changeDetection:0})}var F=s(3200),un=s(356),_n=s(8256),dt=s(7724);var fn=s(8296),$=s(5032);function gn(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.select-state"))}function yn(r,n){if(1&r&&(e.I0R(0,"option",4),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"stateI18nToken"),e.C$Y()),2&r){const t=n.$implicit;e.E7m("value",t),e.yG2(),e.oRS(" ",e.kDX(2,2,e.kDX(3,4,t))," ")}}function Cn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"common.cancel")," "))}const hn=r=>({state:r});function On(r,n){if(1&r){const t=e.KQA();e.yuY(0,Cn,3,3,"button",5),e.I0R(1,"button",6),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("ngIf",t.cancellable),e.yG2(),e.E7m("disabled",!t.selectedState),e.yG2(),e.oRS(" ",e.g7$(3,3,"order.transition-to-state",e.S45(10,hn,e.kDX(4,6,e.kDX(5,8,t.selectedState))))," ")}}class me{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||me)};static#t=this.\u0275cmp=e.In1({type:me,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["name","state",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"value"],["type","submit","class","btn btn-secondary",3,"click",4,"ngIf"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(t,o){1&t&&(e.yuY(0,gn,2,3,"ng-template",0),e.I0R(1,"p"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-form-field")(5,"select",1),e.iHE("ngModelChange",function(a){return e.kNx(o.selectedState,a)||(o.selectedState=a),a}),e.yuY(6,yn,4,6,"option",2),e.C$Y()(),e.yuY(7,On,6,12,"ng-template",3)),2&t&&(e.yG2(2),e.cNF(e.kDX(3,3,o.message)),e.yG2(3),e.OKB("ngModel",o.selectedState),e.yG2(),e.E7m("ngForOf",o.nextStates))},dependencies:[m.ay,m.u_,l.wd,l.GO,l.GC,l.ue,l._G,P._,y.w,E.E,v.a,p.sD,$.Q],changeDetection:0})}class Y{constructor(n,t,o,i){this.dataService=n,this.modalService=t,this.notificationService=o,this.i18nService=i}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,f.G)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,u.s)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,lt.a)(a=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(me,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,f.G)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return F.k;throw new Error("An order state must be selected")}),function pn(r){return(0,_n.i)((n,t)=>{let o,a,i=!1;const c=()=>{o=n.subscribe((0,dt.e)(t,void 0,void 0,G=>{a||(a=new Q.E,(0,un.Uv)(r(a)).subscribe((0,dt.e)(t,()=>o?c():i=!0))),a&&a.next(G)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,fn.o)(2e3),(0,x.U)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:d.YjR.ORDER_STATE_TRANSITION}},sort:{createdAt:d._8$.DESC}}).mapSingle(t=>t.order).pipe((0,R.k)(t=>{const o=t?.history.items.find(i=>"Modifying"===i.data.to);if(o)return o.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,R.k)(({transitionOrderToState:o})=>{switch(o?.__typename){case"Order":return o?.state;case"OrderStateTransitionError":throw this.notificationService.error(o?.transitionError),new Error(o?.transitionError)}}))}static#e=this.\u0275fac=function(t){return new(t||Y)(e.CoB(d.Aj0),e.CoB(d.Ajm),e.CoB(d.gnT),e.CoB(d.WYg))};static#t=this.\u0275prov=e.wxM({token:Y,factory:Y.\u0275fac,providedIn:"root"})}var b=s(900),Le=s(7856),Xe=s(8008),ue=s(5752),Ye=s(4311),je=s(6744),st=s(6539),Me=s(6500),ct=s(5556),Qe=s(4788),Ke=s(4956),I=s(8084),mt=s(5536);function vn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.editable=!0)}),e.wR5(1,"clr-icon",10),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.edit")," "))}function bn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",11),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onUpdateClick())}),e.wR5(1,"clr-icon",12),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}if(2&r){const t=e.GaO(2);e.E7m("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.yG2(2),e.oRS(" ",e.kDX(3,2,"common.update")," ")}}function In(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.onCancelClick())}),e.wR5(1,"clr-icon",13),e.OEk(2),e.wVc(3,"translate"),e.C$Y()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"common.cancel")," "))}function Gn(r,n){if(1&r&&(e.I0R(0,"div",1)(1,"div",2),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",3)(5,"div",4),e.wR5(6,"vdr-tabbed-custom-fields",5),e.C$Y()(),e.I0R(7,"div",6),e.yuY(8,vn,4,3,"button",7)(9,bn,4,4,"button",8)(10,In,4,3,"button",7),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,10,"common.custom-fields")," "),e.yG2(3),e.eAK("editable",t.editable),e.yG2(),e.E7m("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.yG2(2),e.E7m("ngIf",!t.editable),e.yG2(),e.E7m("ngIf",t.editable),e.yG2(),e.E7m("ngIf",t.editable)}}class _e{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e._w7,this.editable=!1}ngOnInit(){this.customFieldForm=this.formBuilder.group({});for(const n of this.customFieldsConfig)this.customFieldForm.addControl(n.name,this.formBuilder.control(this.customFieldValues[n.name]))}onUpdateClick(){this.updateClick.emit(this.customFieldForm.value),this.customFieldForm.markAsPristine(),this.editable=!1}onCancelClick(){this.customFieldForm.dirty?this.modalService.dialog({title:(0,u.s)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,u.s)("common.keep-editing")},{type:"danger",label:(0,u.s)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}static#e=this.\u0275fac=function(t){return new(t||_e)(e.GI1(l.KE),e.GI1(d.Ajm))};static#t=this.\u0275cmp=e.In1({type:_e,selectors:[["vdr-order-custom-fields-card"]],inputs:{customFieldsConfig:"customFieldsConfig",customFieldValues:"customFieldValues"},outputs:{updateClick:"updateClick"},decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text","custom-field-form"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly","compact"],[1,"card-footer"],["class","btn btn-sm btn-secondary",3,"click",4,"ngIf"],["class","btn btn-sm btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","pencil"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["shape","check"],["shape","times"]],template:function(t,o){1&t&&e.yuY(0,Gn,11,12,"div",0),2&t&&e.E7m("ngIf",o.customFieldsConfig.length)},dependencies:[_.o3d,m.u_,mt.w,p.sD],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0})}var k=s(656),J=s(8168),W=s(3428),U=s(4024),Pe=s(7800),ut=s(4944),A=s(9604);function En(r,n){1&r&&e.wR5(0,"clr-icon",9)}function Rn(r,n){1&r&&e.wR5(0,"clr-icon",10)}function kn(r,n){1&r&&e.wR5(0,"clr-icon",11)}function wn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-all")," "))}const Tn=(r,n)=>({total:r,count:n});function Sn(r,n){if(1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.oRS(" ",e.g7$(2,1,"order.line-fulfillment-partial",e.IBC(4,Tn,t.line.quantity,t.fulfilledCount))," ")}}function Dn(r,n){1&r&&(e.I0R(0,"label",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.line-fulfillment-none")," "))}function xn(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",15),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",t.fulfillment.trackingCode," ")}}const Fn=r=>({count:r});function $n(r,n){if(1&r&&(e.I0R(0,"div",13)(1,"div",14),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-labeled-data",15),e.wVc(6,"translate"),e.OEk(7),e.wVc(8,"localeDate"),e.C$Y(),e.I0R(9,"vdr-labeled-data",15),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.yuY(12,xn,3,4,"vdr-labeled-data",16),e.C$Y()),2&r){const t=n.$implicit;e.yG2(2),e.MjK(" ",e.kDX(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.g7$(4,10,"order.item-count",e.S45(20,Fn,t.count)),") "),e.yG2(3),e.E7m("label",e.kDX(6,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(8,15,t.fulfillment.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(10,18,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",t.fulfillment.method," "),e.yG2(),e.E7m("ngIf",t.fulfillment.trackingCode)}}function Yn(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown",1)(1,"button",2),e.yuY(2,En,1,0,"clr-icon",3)(3,Rn,1,0,"clr-icon",4)(4,kn,1,0,"clr-icon",5),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",6),e.yuY(6,wn,3,3,"label",7)(7,Sn,3,7,"label",7)(8,Dn,3,3,"label",7)(9,$n,13,22,"div",8),e.C$Y()()),2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(2),e.E7m("ngIf","full"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","partial"===t.fulfillmentStatus),e.yG2(),e.E7m("ngIf","none"===t.fulfillmentStatus),e.yG2(),e.E7m("ngForOf",t.fulfillments)}}class z{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.quantity),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){return n.fulfillmentLines?.reduce((t,o)=>t+o.quantity,0)??0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){return n.fulfillmentLines?.map(t=>{const o=this.allOrderFulfillments?.find(i=>i.id===t.fulfillmentId);if(o)return{count:t.quantity,fulfillment:o}}).filter(C.notNullOrUndefined)??[]}static#e=this.\u0275fac=function(t){return new(t||z)};static#t=this.\u0275cmp=e.In1({type:z,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",allOrderFulfillments:"allOrderFulfillments",orderState:"orderState"},features:[e.SYr],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&e.yuY(0,Yn,10,7,"vdr-dropdown",0),2&t&&e.E7m("ngIf",o.fulfilledCount||"PartiallyDelivered"===o.orderState)},dependencies:[_.o3d,_.ojz,m.ay,m.u_,J.i,W.m,U.q,h.a,p.sD,A.m],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-700)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-700)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-700)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0})}var _t=s(6019);const Mn=r=>({count:r});function Pn(r,n){if(1&r&&(e.I0R(0,"span",1),e.wVc(1,"translate"),e.wR5(2,"clr-icon",2),e.C$Y()),2&r){const t=e.GaO();e.E7m("title",e.g7$(1,1,"order.refunded-count",e.S45(4,Mn,t.getRefundedCount())))}}class V{getRefundedCount(){return(this.payments?.reduce((t,o)=>[...t,...o.refunds],[]).filter(t=>"Failed"!==t.state).reduce((t,o)=>[...t,...o.lines],[])??[]).filter(t=>t.orderLineId===this.line.id).reduce((t,o)=>t+o.quantity,0)}static#e=this.\u0275fac=function(t){return new(t||V)};static#t=this.\u0275cmp=e.In1({type:V,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(t,o){1&t&&e.yuY(0,Pn,3,6,"span",0),2&t&&e.E7m("ngIf",o.getRefundedCount())},dependencies:[_.o3d,m.u_,_t.CM,p.sD],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0})}class N extends d.Mrq{constructor(){super(...arguments),this.orderable=!1}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(N)))(o||N)}})();static#t=this.\u0275cmp=e.In1({type:N,selectors:[["vdr-order-total-column"]],exportAs:["row"],features:[e.eg9],decls:0,vars:0,template:function(t,o){},encapsulation:2})}var An=s(3508),Vn=s(9508),Nn=s(6832),Ln=s(288),Xn=s(9076);function jn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"th",18)(1,"input",19),e.qCj("change",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onToggleAllClick())}),e.C$Y()()}if(2&r){const t=e.GaO();e.yG2(),e.E7m("checked",null==t.selectionManager?null:t.selectionManager.areAllCurrentItemsSelected())}}function Qn(r,n){1&r&&e.wR5(0,"clr-icon",29)}function Kn(r,n){1&r&&e.wR5(0,"clr-icon",30)}function qn(r,n){1&r&&e.wR5(0,"clr-icon",31)}function Hn(r,n){if(1&r&&(e.I0R(0,"div",32),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.cNF(t.sortOrder)}}function Bn(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"button",24),e.qCj("click",function(){const a=e.usT(t).ngIf;return e.CGJ(a.toggleSortOrder())}),e.yuY(2,Qn,1,0,"clr-icon",25)(3,Kn,1,0,"clr-icon",26)(4,qn,1,0,"clr-icon",27),e.C$Y(),e.yuY(5,Hn,2,1,"div",28),e.C$Y()}if(2&r){const t=n.ngIf;e.yG2(),e.eAK("active",t.sortOrder),e.yG2(),e.E7m("ngIf",!t.sortOrder),e.yG2(),e.E7m("ngIf","ASC"===t.sortOrder),e.yG2(),e.E7m("ngIf","DESC"===t.sortOrder),e.yG2(),e.E7m("ngIf",t.sortOrder)}}function Jn(r,n){if(1&r&&(e.I0R(0,"th")(1,"div",20)(2,"vdr-ui-extension-point",21)(3,"span"),e.OEk(4),e.C$Y()(),e.yuY(5,Bn,6,6,"div",22),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("expand",t.expand),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("locationId",o.id)("metadata",t.id)("topPx",-6)("leftPx",-24),e.yG2(2),e.cNF(t.heading),e.yG2(),e.E7m("ngIf",t.sort)}}function Wn(r,n){1&r&&e.C_f(0)}function Un(r,n){1&r&&e.C_f(0)}function zn(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",41),2&r){const t=n.$implicit,o=e.GaO(3);e.E7m("filterWithValue",t)("filters",o.filters)}}function Zn(r,n){if(1&r&&e.wR5(0,"vdr-data-table-filters",42),2&r){const t=e.GaO(3);e.E7m("filters",t.filters)}}function er(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",38),e.yuY(2,zn,1,2,"vdr-data-table-filters",39)(3,Zn,1,1,"vdr-data-table-filters",40),e.C$Y(),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",t.filters.activeFilters),e.yG2(),e.E7m("ngIf",t.filters.length)}}function tr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"tr")(1,"th",33)(2,"button",34),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.toggleSearchFilterRow())}),e.wVc(3,"translate"),e.wR5(4,"clr-icon",35),e.C$Y(),e.I0R(5,"div",36),e.yuY(6,Wn,1,0,"ng-container",37)(7,Un,1,0,"ng-container",37)(8,er,4,2,"ng-container",8),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(),e.eAK("active",t.showSearchFilterRow),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.eAK("active",t.showSearchFilterRow),e.E7m("title",e.kDX(3,11,"common.search-and-filter-list")),e.yG2(3),e.eAK("hidden",!t.showSearchFilterRow),e.yG2(),e.E7m("ngTemplateOutlet",null==t.searchComponent?null:t.searchComponent.template),e.yG2(),e.E7m("ngTemplateOutlet",t.customSearchTemplate),e.yG2(),e.E7m("ngIf",t.filters)}}function nr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"td",18)(1,"input",45),e.qCj("click",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.onRowClick(a,i))}),e.C$Y()()}if(2&r){const t=e.GaO(),o=t.index,i=t.$implicit,a=e.GaO();e.eAK("active",a.activeIndex===o),e.yG2(),e.E7m("checked",null==a.selectionManager?null:a.selectionManager.isSelected(i))}}function rr(r,n){1&r&&e.C_f(0)}const or=r=>({rowItem:r});function ir(r,n){if(1&r&&(e.SAx(0),e.yuY(1,rr,1,0,"ng-container",48),e.k70()),2&r){const t=n.ngIf,o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngComponentOutlet",t.config.component)("ngComponentOutletInputs",e.S45(3,or,o))("ngComponentOutletInjector",t.injector)}}function ar(r,n){1&r&&e.C_f(0)}const lr=(r,n)=>({item:r,index:n});function dr(r,n){if(1&r&&e.yuY(0,ar,1,0,"ng-container",49),2&r){const t=e.GaO().$implicit,o=e.GaO(),i=o.$implicit,a=o.index;e.E7m("ngTemplateOutlet",t.template)("ngTemplateOutletContext",e.IBC(2,lr,i,a))}}function sr(r,n){if(1&r&&(e.I0R(0,"td")(1,"div",20),e.yuY(2,ir,2,5,"ng-container",46)(3,dr,1,5,"ng-template",null,47,e.gJz),e.C$Y()()),2&r){const t=n.$implicit,o=e.Gew(4),i=e.GaO().index,a=e.GaO();e.eAK("active",a.activeIndex===i),e.yG2(),e.E7m("ngClass",t.align),e.yG2(),e.E7m("ngIf",a.customComponents.get(t.id))("ngIfElse",o)}}function cr(r,n){if(1&r&&(e.I0R(0,"tr"),e.yuY(1,nr,2,3,"td",43)(2,sr,5,5,"td",44),e.wR5(3,"td"),e.C$Y()),2&r){const t=n.index,o=e.GaO();e.yG2(),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(),e.eAK("active",o.activeIndex===t)}}function mr(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.wR5(2,"vdr-empty-placeholder",50),e.wVc(3,"translate"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(),e.e48("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.yG2(),e.E7m("emptyStateLabel",e.kDX(3,2,"order.order-is-empty"))}}function ur(r,n){if(1&r&&(e.I0R(0,"tr",51)(1,"td",52),e.OEk(2),e.C$Y(),e.I0R(3,"td",53),e.OEk(4),e.C$Y(),e.wR5(5,"td",54),e.I0R(6,"td",55),e.OEk(7),e.wVc(8,"localeCurrency"),e.I0R(9,"div",14),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeCurrency"),e.C$Y()(),e.wR5(13,"td"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(t.sku),e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-4),e.yG2(2),e.oRS(" ",e.g7$(8,6,t.priceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(10,9,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(12,11,t.price,o.order.currencyCode)," ")}}function _r(r,n){if(1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.C$Y()),2&r){const t=n.ngIf;e.yG2(),e.cNF(t)}}function pr(r,n){if(1&r&&(e.I0R(0,"tr",57)(1,"td",2)(2,"a",58),e.OEk(3),e.C$Y(),e.yuY(4,_r,2,1,"vdr-chip",8),e.C$Y(),e.I0R(5,"td",2),e.OEk(6),e.wVc(7,"localeCurrency"),e.I0R(8,"div",14),e.wVc(9,"translate"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()(),e.wR5(12,"td"),e.C$Y()),2&r){const t=e.GaO().$implicit,o=e.GaO();e.yG2(),e.e48("colspan",o.visibleSortedColumns.length-1),e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(),e.E7m("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.yG2(2),e.oRS(" ",e.g7$(7,7,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(9,10,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(11,12,t.amount,o.order.currencyCode)," ")}}function fr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,pr,13,15,"tr",56),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("ngIf","OTHER"!==t.type)}}function gr(r,n){if(1&r&&(e.I0R(0,"vdr-chip",59),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}const yr=[[["vdr-bulk-action-menu"]]],Cr=(r,n,t,o)=>({id:r,itemsPerPage:n,currentPage:t,totalItems:o}),hr=["vdr-bulk-action-menu"];class Z extends d.qu{get allColumns(){return[...this.columns??[],...this.customFieldColumns??[],...this.totalColumns??[]]}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=(()=>{let n;return function(o){return(n||(n=e.otF(Z)))(o||Z)}})();static#t=this.\u0275cmp=e.In1({type:Z,selectors:[["vdr-order-data-table"]],contentQueries:function(t,o,i){if(1&t&&e.szK(i,N,4),2&t){let a;e.wto(a=e.Gqi())&&(o.totalColumns=a)}},inputs:{order:"order"},features:[e.eg9],ngContentSelectors:hr,decls:60,vars:70,consts:[[1,"bulk-actions"],[1,"table-wrapper"],[1,""],[1,"heading-row"],["class","selection-col",4,"ngIf"],[3,"expand",4,"ngFor","ngForOf"],[1,"column-picker"],[3,"uiLanguage","columns","reorder","resetColumns"],[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"sub-total"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["class","shipping-method-name",4,"ngFor","ngForOf"],[1,"total"],[1,"selection-col"],["type","checkbox","clrCheckbox","",3,"checked","change"],[1,"cell-content",3,"ngClass"],["api","dataTable","display","block",3,"locationId","metadata","topPx","leftPx"],["class","sort-toggle",4,"ngIf"],[1,"sort-toggle"],[3,"click"],["shape","two-way-arrows left",4,"ngIf"],["shape","arrow up",4,"ngIf"],["shape","arrow down",4,"ngIf"],["class","sort-label",4,"ngIf"],["shape","two-way-arrows left"],["shape","arrow up"],["shape","arrow down"],[1,"sort-label"],[1,"filter-row"],[1,"button-ghost","toggle-search-filter-row",3,"title","click"],["shape","search"],[1,"filter-row-wrapper"],[4,"ngTemplateOutlet"],[1,"filters"],["class","mt-1",3,"filterWithValue","filters",4,"ngFor","ngForOf"],["class","mt-1",3,"filters",4,"ngIf"],[1,"mt-1",3,"filterWithValue","filters"],[1,"mt-1",3,"filters"],["class","selection-col",3,"active",4,"ngIf"],[3,"active",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"checked","click"],[4,"ngIf","ngIfElse"],["defaultComponent",""],[4,"ngComponentOutlet","ngComponentOutletInputs","ngComponentOutletInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"emptyStateLabel"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle","sku"],[1,"align-middle"],[1,"align-middle","total"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],[3,"routerLink"],[1,"shipping-method-name"]],template:function(t,o){1&t&&(e.kPM(yr),e.I0R(0,"div",0),e._Xx(1),e.C$Y(),e.I0R(2,"div",1)(3,"table",2)(4,"thead")(5,"tr",3),e.yuY(6,jn,2,1,"th",4)(7,Jn,6,9,"th",5),e.I0R(8,"th")(9,"div",6)(10,"vdr-data-table-colum-picker",7),e.qCj("reorder",function(a){return o.onColumnReorder(a)})("resetColumns",function(){return o.onColumnsReset()}),e.wVc(11,"async"),e.C$Y()()()(),e.yuY(12,tr,9,13,"tr",8),e.C$Y(),e.I0R(13,"tbody"),e.yuY(14,cr,4,4,"tr",9),e.wVc(15,"paginate"),e.SAx(16),e.yuY(17,mr,4,4,"tr",8),e.k70(),e.yuY(18,ur,14,14,"tr",10)(19,fr,2,1,"ng-container",11),e.I0R(20,"tr",12)(21,"td",2),e.OEk(22),e.wVc(23,"translate"),e.C$Y(),e.wR5(24,"td"),e.I0R(25,"td",13),e.OEk(26),e.wVc(27,"localeCurrency"),e.I0R(28,"div",14),e.wVc(29,"translate"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y()(),e.wR5(32,"td"),e.C$Y(),e.I0R(33,"tr",15)(34,"td",2),e.OEk(35),e.wVc(36,"translate"),e.C$Y(),e.I0R(37,"td"),e.yuY(38,gr,2,1,"vdr-chip",16),e.C$Y(),e.I0R(39,"td",13),e.OEk(40),e.wVc(41,"localeCurrency"),e.I0R(42,"div",14),e.wVc(43,"translate"),e.OEk(44),e.wVc(45,"localeCurrency"),e.C$Y()(),e.wR5(46,"td"),e.C$Y(),e.I0R(47,"tr",17)(48,"td",2),e.OEk(49),e.wVc(50,"translate"),e.C$Y(),e.wR5(51,"td"),e.I0R(52,"td",13),e.OEk(53),e.wVc(54,"localeCurrency"),e.I0R(55,"div",14),e.wVc(56,"translate"),e.OEk(57),e.wVc(58,"localeCurrency"),e.C$Y()(),e.wR5(59,"td"),e.C$Y()()()()),2&t&&(e.yG2(3),e.eAK("no-select",o.disableSelect),e.yG2(),e.eAK("items-selected",null==o.selectionManager?null:o.selectionManager.selection.length),e.yG2(2),e.E7m("ngIf",o.selectionManager),e.yG2(),e.E7m("ngForOf",o.visibleSortedColumns),e.yG2(3),e.E7m("uiLanguage",e.kDX(11,30,o.uiLanguage$))("columns",o.sortedColumns),e.yG2(2),e.E7m("ngIf",o.searchComponent||o.customSearchTemplate||(null==o.filters?null:o.filters.length)),e.yG2(2),e.E7m("ngForOf",e.g7$(15,32,o.items,e.WuN(65,Cr,o.id,o.itemsPerPage,o.currentPage,o.totalItems)))("ngForTrackBy",o.trackByFn),e.yG2(3),e.E7m("ngIf",!(null!=o.items&&o.items.length)),e.yG2(),e.E7m("ngForOf",o.order.surcharges),e.yG2(),e.E7m("ngForOf",o.order.discounts),e.yG2(3),e.cNF(e.kDX(23,35,"order.sub-total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(27,37,o.order.subTotalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(29,40,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(31,42,o.order.subTotal,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(36,45,"order.shipping")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(),e.E7m("ngForOf",o.order.shippingLines),e.yG2(2),e.oRS(" ",e.g7$(41,47,o.order.shippingWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(43,50,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(45,52,o.order.shipping,o.order.currencyCode)," "),e.yG2(5),e.cNF(e.kDX(50,55,"order.total")),e.yG2(2),e.e48("colspan",o.visibleSortedColumns.length-2),e.yG2(2),e.oRS(" ",e.g7$(54,57,o.order.totalWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(56,60,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(58,62,o.order.total,o.order.currencyCode)," "))},dependencies:[_.o3d,_.y6l,m.QF,m.ov,m.ay,m.u_,m.XV,k.ER,D.g,y.w,An.A,Vn.K,Nn.Q,Ln.E,m.a,Xn.as,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{text-align:center}@media screen and (min-width: 992px){tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th[_ngcontent-%COMP%]:last-of-type, td[_ngcontent-%COMP%]:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr[_ngcontent-%COMP%]:first-of-type th[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr[_ngcontent-%COMP%]:last-of-type td[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-row-separator)}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper[_ngcontent-%COMP%]{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table[_ngcontent-%COMP%]{width:100%}table.no-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}.column-picker[_ngcontent-%COMP%]{width:24px}.sort-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:var(--color-primary-700)}.sort-toggle[_ngcontent-%COMP%] .sort-label[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row[_ngcontent-%COMP%]{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row[_ngcontent-%COMP%]{left:8px}}.toggle-search-filter-row.active[_ngcontent-%COMP%]{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row[_ngcontent-%COMP%]{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}th.filter-row.active[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border)}th.filter-row[_ngcontent-%COMP%] .filters[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden[_ngcontent-%COMP%]{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link[_ngcontent-%COMP%]{display:block;width:100%;height:100%}td.active[_ngcontent-%COMP%]{background-color:var(--color-table-row-active-bg)}.cell-content[_ngcontent-%COMP%]{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left[_ngcontent-%COMP%]{justify-content:flex-start}.cell-content.center[_ngcontent-%COMP%]{justify-content:center}.cell-content.right[_ngcontent-%COMP%]{justify-content:flex-end}.selection-col[_ngcontent-%COMP%]{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder[_ngcontent-%COMP%]{width:100%}.table-footer[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count[_ngcontent-%COMP%]{display:none}}","[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}"],changeDetection:0})}function Or(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function vr(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function br(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function Ir(r,n){if(1&r&&(e.wR5(0,"img",14),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Gr(r,n){1&r&&(e.I0R(0,"div",15),e.wR5(1,"clr-icon",16),e.C$Y())}function Er(r,n){if(1&r&&(e.I0R(0,"div",11),e.yuY(1,Ir,2,4,"img",12)(2,Gr,2,0,"ng-template",null,13,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function Rr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function kr(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function wr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()()),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,3,t.unitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,6,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,8,t.unitPrice,o.order.currencyCode)," ")}}function Tr(r,n){if(1&r&&(e.I0R(0,"div",25),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO(2).item;e.E7m("title",e.kDX(1,2,"order.original-quantity-at-checkout")),e.yG2(2),e.oRS(" ",t.orderPlacedQuantity," ")}}function Sr(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",23),e.yuY(2,Tr,3,4,"div",24),e.I0R(3,"div"),e.OEk(4),e.C$Y()(),e.k70()),2&r){const t=e.GaO().item;e.yG2(2),e.E7m("ngIf",t.orderPlacedQuantity&&t.quantity!==t.orderPlacedQuantity),e.yG2(2),e.cNF(t.quantity)}}function Dr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",23)(1,"input",26,27),e.qCj("blur",function(){e.usT(t);const i=e.Gew(2),a=e.GaO().item,c=e.GaO();return e.CGJ(c.draftInputBlur(a,i.valueAsNumber))}),e.C$Y(),e.I0R(3,"button",28),e.qCj("click",function(){e.usT(t);const i=e.GaO().item,a=e.GaO();return e.CGJ(a.remove.emit({lineId:i.id}))}),e.wR5(4,"clr-icon",29),e.C$Y()()}if(2&r){const t=e.GaO().item;e.yG2(),e.E7m("value",t.quantity)}}function xr(r,n){if(1&r&&(e.yuY(0,Sr,5,2,"ng-container",19)(1,Dr,5,1,"ng-template",null,20,e.gJz),e.wR5(3,"vdr-line-refunds",21)(4,"vdr-line-fulfillment",22)),2&r){const t=n.item,o=e.Gew(2),i=e.GaO();e.E7m("ngIf",!i.isDraft)("ngIfElse",o),e.yG2(3),e.E7m("line",t)("payments",i.order.payments),e.yG2(),e.E7m("line",t)("orderState",i.order.state)("allOrderFulfillments",i.order.fulfillments)}}function Fr(r,n){if(1&r&&e.wR5(0,"vdr-dt2-custom-field-column",30),2&r){const t=n.$implicit;e.E7m("customField",t)}}function $r(r,n){if(1&r&&(e.I0R(0,"div",34)(1,"a",35),e.OEk(2),e.C$Y(),e.I0R(3,"div",36),e.OEk(4),e.wVc(5,"localeCurrency"),e.I0R(6,"div",18),e.wVc(7,"translate"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()),2&r){const t=n.$implicit,o=e.GaO(4);e.yG2(),e.E7m("routerLink",o.getPromotionLink(t)),e.yG2(),e.cNF(t.description),e.yG2(2),e.oRS(" ",e.g7$(5,5,t.amountWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(7,8,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(9,10,t.amount,o.order.currencyCode)," ")}}function Yr(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",32),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,$r,10,13,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.promotions-applied")," "),e.yG2(3),e.E7m("ngForOf",t)}}function Mr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Yr,6,4,"vdr-dropdown",31),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function Pr(r,n){if(1&r&&(e.I0R(0,"div",17),e.OEk(1),e.wVc(2,"localeCurrency"),e.I0R(3,"div",18),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y()(),e.yuY(7,Mr,2,1,"ng-container",31)),2&r){const t=n.item,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,4,t.linePriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("title",e.kDX(4,7,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(6,9,t.linePrice,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",o.getLineDiscounts(t))}}class L{constructor(){this.isDraft=!1,this.adjust=new e._w7,this.remove=new e._w7,this.orderLineCustomFieldsVisible=!1,this.customFieldsForLine={}}get visibleOrderLineCustomFields(){return this.orderLineCustomFieldsVisible?this.orderLineCustomFields:[]}get showElided(){return!this.orderLineCustomFieldsVisible&&0<this.orderLineCustomFields.length}ngOnInit(){this.orderLineCustomFieldsVisible=this.orderLineCustomFields.length<2,this.getLineCustomFields()}draftInputBlur(n,t){n.quantity!==t&&this.adjust.emit({lineId:n.id,quantity:t})}toggleOrderLineCustomFields(){this.orderLineCustomFieldsVisible=!this.orderLineCustomFieldsVisible}getLineDiscounts(n){return n.discounts.filter(t=>t.type===d.yKQ.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new l.k1({}),o=this.orderLineCustomFields.map(i=>{const a=n.customFields[i.name];return t.addControl(i.name,new l.yM(a)),{config:i,formGroup:t,value:a}}).filter(i=>!!this.orderLineCustomFieldsVisible||null!=i.value);this.customFieldsForLine[n.id]=o}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(a=>a.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=function(t){return new(t||L)};static#t=this.\u0275cmp=e.In1({type:L,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields",isDraft:"isDraft"},outputs:{adjust:"adjust",remove:"remove"},decls:29,vars:36,consts:[["id","order-detail-list",3,"items","order"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading"],["id","product-sku",3,"heading","optional"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"customField",4,"ngFor","ngForOf"],["id","total",3,"heading","optional"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"unit-price"],[1,"net-price",3,"title"],[4,"ngIf","ngIfElse"],["draft",""],[3,"line","payments"],[3,"line","orderState","allOrderFulfillments"],[1,"flex"],["class","order-placed-quantity",3,"title",4,"ngIf"],[1,"order-placed-quantity",3,"title"],["type","number","min","0",1,"draft-qty",3,"value","blur"],["qtyInput",""],[1,"icon-button",3,"click"],["shape","trash"],[3,"customField"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-order-data-table",0)(1,"vdr-dt2-column",1),e.wVc(2,"translate"),e.yuY(3,Or,1,1,"ng-template"),e.C$Y(),e.I0R(4,"vdr-dt2-column",2),e.wVc(5,"translate"),e.yuY(6,vr,2,4,"ng-template"),e.C$Y(),e.I0R(7,"vdr-dt2-column",3),e.wVc(8,"translate"),e.yuY(9,br,2,4,"ng-template"),e.C$Y(),e.I0R(10,"vdr-dt2-column",4),e.wVc(11,"translate"),e.yuY(12,Er,4,2,"ng-template"),e.C$Y(),e.I0R(13,"vdr-dt2-column",5),e.wVc(14,"translate"),e.yuY(15,Rr,1,1,"ng-template"),e.C$Y(),e.I0R(16,"vdr-dt2-column",6),e.wVc(17,"translate"),e.yuY(18,kr,1,1,"ng-template"),e.C$Y(),e.I0R(19,"vdr-dt2-column",7),e.wVc(20,"translate"),e.yuY(21,wr,7,11,"ng-template"),e.C$Y(),e.I0R(22,"vdr-dt2-column",8),e.wVc(23,"translate"),e.yuY(24,xr,5,7,"ng-template"),e.C$Y(),e.yuY(25,Fr,1,1,"vdr-dt2-custom-field-column",9),e.I0R(26,"vdr-order-total-column",10),e.wVc(27,"translate"),e.yuY(28,Pr,8,12,"ng-template"),e.C$Y()()),2&t&&(e.E7m("items",o.order.lines)("order",o.order),e.yG2(),e.E7m("heading",e.kDX(2,18,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(5,20,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(8,22,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(11,24,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(14,26,"order.product-name")),e.yG2(3),e.E7m("heading",e.kDX(17,28,"order.product-sku"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(20,30,"order.unit-price")),e.yG2(3),e.E7m("heading",e.kDX(23,32,"order.quantity"))("optional",!1),e.yG2(3),e.E7m("ngForOf",o.orderLineCustomFields),e.yG2(),e.E7m("heading",e.kDX(27,34,"order.total"))("optional",!1))},dependencies:[_.o3d,m.ay,m.u_,k.ER,y.w,J.i,W.m,U.q,Pe.M,ut.K,z,V,Z,N,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-inline-start:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}var qe=s(1488),pt=s(5388);function Ar(r,n){if(1&r&&(e.I0R(0,"div",16),e.wR5(1,"vdr-custom-field-control",17),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(3);e.yG2(),e.E7m("compact",!0)("readonly",!1)("customField",t)("customFieldsFormGroup",o.customFieldsFormGroup)}}function Vr(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ar,2,4,"div",15),e.k70()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("ngForOf",t.orderLineCustomFields)}}function Nr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",1)(1,"div",5),e.wR5(2,"img",6),e.wVc(3,"assetPreview"),e.I0R(4,"div",7)(5,"div"),e.OEk(6),e.C$Y(),e.I0R(7,"div",8),e.OEk(8),e.C$Y()(),e.I0R(9,"div",9)(10,"div",8),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"div",8),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.wR5(16,"div",10),e.I0R(17,"div",7)(18,"div"),e.OEk(19),e.wVc(20,"localeCurrency"),e.C$Y(),e.I0R(21,"div",11),e.wVc(22,"translate"),e.OEk(23),e.wVc(24,"localeCurrency"),e.C$Y()(),e.I0R(25,"div")(26,"input",12),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.quantity,i)||(a.quantity=i),e.CGJ(i)}),e.C$Y()(),e.I0R(27,"button",13),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.addItemClick(a))}),e.OEk(28),e.wVc(29,"translate"),e.C$Y()(),e.yuY(30,Vr,2,1,"ng-container",14),e.C$Y()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("src",e.g7$(3,15,t.featuredAsset||t.product.featuredAsset,32),e.K6U),e.yG2(4),e.cNF(null==t?null:t.name),e.yG2(2),e.cNF(null==t?null:t.sku),e.yG2(3),e.CAO(" ",e.kDX(12,18,"catalog.stock-on-hand"),": ",t.stockOnHand," "),e.yG2(3),e.CAO(" ",e.kDX(15,20,"catalog.stock-allocated"),": ",t.stockAllocated," "),e.yG2(5),e.cNF(e.g7$(20,22,null==t?null:t.priceWithTax,o.currencyCode)),e.yG2(2),e.E7m("title",e.kDX(22,25,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(24,27,null==t?null:t.price,o.currencyCode)," "),e.yG2(3),e.E7m("disabled",!t),e.OKB("ngModel",o.quantity),e.yG2(),e.E7m("disabled",!t),e.yG2(),e.oRS(" ",e.kDX(29,30,"order.add-item-to-order")," "),e.yG2(2),e.E7m("ngIf",o.orderLineCustomFields.length)}}class pe{constructor(n){this.dataService=n,this.addItem=new e._w7,this.customFieldsFormGroup=new l.k1({}),this.selectedVariantId$=new Q.E,this.quantity=1}ngOnInit(){this.selectedVariant$=this.selectedVariantId$.pipe((0,f.G)(n=>n?this.dataService.product.getProductVariant(n).mapSingle(({productVariant:t})=>t):[void 0]));for(const n of this.orderLineCustomFields)this.customFieldsFormGroup.addControl(n.name,new l.yM(""))}addItemClick(n){n&&(this.addItem.emit({productVariantId:n.id,quantity:this.quantity,customFields:this.orderLineCustomFields.length?this.customFieldsFormGroup.value:void 0}),this.selectedVariantId$.next(void 0),this.customFieldsFormGroup.reset())}static#e=this.\u0275fac=function(t){return new(t||pe)(e.GI1(d.Aj0))};static#t=this.\u0275cmp=e.In1({type:pe,selectors:[["vdr-draft-order-variant-selector"]],inputs:{currencyCode:"currencyCode",orderLineCustomFields:"orderLineCustomFields"},outputs:{addItem:"addItem"},decls:8,vars:6,consts:[[1,"card"],[1,"card-block"],[1,"card-title"],[3,"productSelected"],["class","card-block",4,"ngIf"],[1,"variant-details"],[1,"mr-2",3,"src"],[1,"details"],[1,"small"],[1,"details","ml-4"],[1,"flex-spacer"],[1,"small",3,"title"],["type","number","min","0",3,"disabled","ngModel","ngModelChange"],[1,"btn","btn-small","btn-primary",3,"disabled","click"],[4,"ngIf"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"h4",2),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"vdr-product-variant-selector",3),e.qCj("productSelected",function(a){return o.selectedVariantId$.next(a.productVariantId)}),e.C$Y()(),e.yuY(6,Nr,31,32,"div",4),e.wVc(7,"async"),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,2,"order.add-item-to-order")),e.yG2(3),e.E7m("ngIf",e.kDX(7,4,o.selectedVariant$)))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._G,qe.E,y.w,pt.k,m.a,p.sD,j.w,g.u],styles:[".variant-details[_ngcontent-%COMP%]{display:flex;align-items:center}.variant-details[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details[_ngcontent-%COMP%] .details[_ngcontent-%COMP%]{font-size:.65rem;line-height:.7rem}.variant-details[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:48px;margin:0 6px}.variant-details[_ngcontent-%COMP%] .small[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}function Lr(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e.wR5(3,"vdr-order-state-label",2),e.C$Y()(),e.I0R(4,"vdr-ab-right"),e.wR5(5,"vdr-action-bar-items",3),e.I0R(6,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.completeOrder())}),e.wR5(7,"clr-icon",5),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"vdr-action-bar-dropdown-menu",6)(11,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.deleteOrder())}),e.wR5(12,"clr-icon",8),e.OEk(13),e.wVc(14,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf;e.yG2(3),e.E7m("state",t.state),e.yG2(3),e.E7m("disabled",!t.customer||!t.lines.length||!t.shippingLines.length),e.yG2(2),e.oRS(" ",e.kDX(9,5,"order.complete-draft-order")," "),e.yG2(2),e.E7m("alwaysShow",!0),e.yG2(3),e.oRS(" ",e.kDX(14,7,"order.delete-draft-order")," ")}}function Xr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function jr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Qr(r,n){if(1&r&&e.yuY(0,Xr,1,0,"clr-icon",22)(1,jr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.customer),e.yG2(),e.E7m("ngIf",t.customer)}}function Kr(r,n){if(1&r&&e.wR5(0,"vdr-customer-label",26),2&r){const t=e.GaO().ngIf;e.E7m("customer",t.customer)}}function qr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Hr(r,n){1&r&&e.wR5(0,"clr-icon",25)}function Br(r,n){if(1&r&&e.yuY(0,qr,1,0,"clr-icon",22)(1,Hr,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.billingAddress.streetLine1),e.yG2(),e.E7m("ngIf",t.billingAddress.streetLine1)}}function Jr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.billingAddress)}}function Wr(r,n){1&r&&e.wR5(0,"clr-icon",24)}function Ur(r,n){1&r&&e.wR5(0,"clr-icon",25)}function zr(r,n){if(1&r&&e.yuY(0,Wr,1,0,"clr-icon",22)(1,Ur,1,0,"clr-icon",23),2&r){const t=e.GaO().ngIf;e.E7m("ngIf",!t.shippingAddress.streetLine1||!t.shippingLines.length),e.yG2(),e.E7m("ngIf",t.shippingAddress.streetLine1&&t.shippingLines.length)}}function Zr(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",27),2&r){const t=e.GaO().ngIf;e.E7m("address",t.shippingAddress)}}function eo(r,n){if(1&r&&(e.I0R(0,"div"),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t.shippingMethod.name," ")}}function to(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.displayCouponCodeInput=!i.displayCouponCodeInput)}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.set-coupon-codes")," "))}function no(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"label"),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"vdr-coupon-code-selector",28),e.qCj("addCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.applyCouponCode(i))})("removeCouponCode",function(i){e.usT(t);const a=e.GaO(2);return e.CGJ(a.removeCouponCode(i))}),e.C$Y()()}if(2&r){const t=e.GaO().ngIf;e.yG2(2),e.cNF(e.kDX(3,2,"order.set-coupon-codes")),e.yG2(2),e.E7m("couponCodes",t.couponCodes)}}function ro(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",29),2&r){const t=n.ngIf;e.E7m("entity",t)}}function oo(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.kDX(5,4,t.taxRate/100)),e.yG2(3),e.cNF(e.g7$(8,6,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,9,t.taxTotal,o.currencyCode))}}function io(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"table",30)(2,"thead")(3,"tr")(4,"th"),e.OEk(5),e.wVc(6,"translate"),e.C$Y(),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y()()(),e.I0R(16,"tbody"),e.yuY(17,oo,12,12,"tr",15),e.C$Y()(),e.k70()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.cNF(e.kDX(6,5,"common.description")),e.yG2(3),e.cNF(e.kDX(9,7,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(12,9,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(15,11,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary)}}function ao(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",9),e.wVc(3,"translate"),e.yuY(4,Qr,2,2,"ng-template",10)(5,Kr,1,1,"vdr-customer-label",11),e.I0R(6,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setCustomer())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y()(),e.I0R(9,"vdr-card",9),e.wVc(10,"translate"),e.yuY(11,Br,2,2,"ng-template",10)(12,Jr,1,1,"vdr-formatted-address",13),e.I0R(13,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setBillingAddress())}),e.OEk(14),e.wVc(15,"translate"),e.C$Y()(),e.I0R(16,"vdr-card",9),e.wVc(17,"translate"),e.yuY(18,zr,2,2,"ng-template",10)(19,Zr,1,1,"vdr-formatted-address",13),e.I0R(20,"button",14),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingAddress())}),e.OEk(21),e.wVc(22,"translate"),e.C$Y(),e.yuY(23,eo,2,1,"div",15),e.I0R(24,"button",12),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.setShippingMethod())}),e.OEk(25),e.wVc(26,"translate"),e.C$Y()(),e.I0R(27,"vdr-card"),e.yuY(28,to,3,3,"button",16)(29,no,5,4,"div",0),e.C$Y(),e.I0R(30,"vdr-card"),e.yuY(31,ro,1,1,"vdr-page-entity-info",17),e.wVc(32,"async"),e.C$Y()(),e.I0R(33,"vdr-page-block")(34,"vdr-card")(35,"vdr-draft-order-variant-selector",18),e.qCj("addItem",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addItemToOrder(i))}),e.C$Y(),e.I0R(36,"vdr-order-table",19),e.qCj("adjust",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.adjustOrderLine(i))})("remove",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.removeOrderLine(i))}),e.C$Y()(),e.I0R(37,"vdr-card",9),e.wVc(38,"translate"),e.yuY(39,io,18,13,"ng-container",0),e.C$Y(),e.wR5(40,"vdr-custom-detail-component-host",20),e.I0R(41,"vdr-order-custom-fields-card",21),e.qCj("updateClick",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateCustomFields(i))}),e.C$Y()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,25,"order.customer")),e.yG2(3),e.E7m("ngIf",t.customer),e.yG2(2),e.oRS(" ",e.kDX(8,27,"order.set-customer-for-order")," "),e.yG2(2),e.E7m("title",e.kDX(10,29,"order.billing-address")),e.yG2(3),e.E7m("ngIf",t.billingAddress),e.yG2(2),e.oRS(" ",e.kDX(15,31,"order.set-billing-address")," "),e.yG2(2),e.E7m("title",e.kDX(17,33,"order.shipping")),e.yG2(3),e.E7m("ngIf",t.shippingAddress),e.yG2(2),e.oRS(" ",e.kDX(22,35,"order.set-shipping-address")," "),e.yG2(2),e.E7m("ngForOf",t.shippingLines),e.yG2(2),e.oRS(" ",e.kDX(26,37,"order.set-shipping-method")," "),e.yG2(3),e.E7m("ngIf",0===t.couponCodes.length&&!o.displayCouponCodeInput),e.yG2(),e.E7m("ngIf",t.couponCodes.length||o.displayCouponCodeInput),e.yG2(2),e.E7m("ngIf",e.kDX(32,39,o.entity$)),e.yG2(4),e.E7m("orderLineCustomFields",o.orderLineCustomFields)("currencyCode",t.currencyCode),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields)("isDraft",!0),e.yG2(),e.E7m("title",e.kDX(38,41,"order.tax-summary")),e.yG2(2),e.E7m("ngIf",t.taxSummary.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("customFieldsConfig",o.customFields)("customFieldValues",t.customFields)}}class fe extends d.uJQ{constructor(n,t,o,i,a){super(),this.changeDetector=n,this.dataService=t,this.notificationService=o,this.modalService=i,this.orderTransitionService=a,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.k1({}),this.fetchHistory=new Q.E,this.displayCouponCodeInput=!1}ngOnInit(){this.init(),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.eligibleShippingMethods$=this.entity$.pipe((0,f.G)(n=>this.dataService.order.getDraftOrderEligibleShippingMethods(n.id).mapSingle(({eligibleShippingMethodsForDraftOrder:t})=>t)))}ngOnDestroy(){this.destroy()}addItemToOrder(n){this.dataService.order.addItemToDraftOrder(this.id,n).subscribe(t=>{"Order"!==t.addItemToDraftOrder.__typename&&this.notificationService.error(t.addItemToDraftOrder.message)})}adjustOrderLine(n){this.dataService.order.adjustDraftOrderLine(this.id,{orderLineId:n.lineId,quantity:n.quantity}).subscribe(t=>{"Order"!==t.adjustDraftOrderLine.__typename&&this.notificationService.error(t.adjustDraftOrderLine.message)})}removeOrderLine(n){this.dataService.order.removeDraftOrderLine(this.id,n.lineId).subscribe(t=>{"Order"!==t.removeDraftOrderLine.__typename&&this.notificationService.error(t.removeDraftOrderLine.message)})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}setCustomer(){this.modalService.fromComponent(H).subscribe(n=>{if(this.hasId(n))this.dataService.order.setCustomerForDraftOrder(this.id,{customerId:n.id}).pipe((0,f.G)(()=>this.dataService.query(d.sTc,{customerId:n.id}).single$),(0,f.G)(({customer:t})=>{const o=t?.addresses?.find(a=>a.defaultShippingAddress),i=t?.addresses?.find(a=>a.defaultBillingAddress);return(0,rt.y)([o?this.dataService.order.setDraftOrderShippingAddress(this.id,this.mapToAddressInput(o)):this.dataService.order.unsetDraftOrderShippingAddress(this.id),i?this.dataService.order.setDraftOrderBillingAddress(this.id,this.mapToAddressInput(i)):this.dataService.order.unsetDraftOrderBillingAddress(this.id)])})).subscribe();else if(n){const{note:t,...o}=n;this.dataService.order.setCustomerForDraftOrder(this.id,{input:o}).subscribe()}})}mapToAddressInput(n){return{fullName:n.fullName,company:n.company,streetLine1:n.streetLine1,streetLine2:n.streetLine2,city:n.city,province:n.province,postalCode:n.postalCode,countryCode:n.country.code,phoneNumber:n.phoneNumber,defaultShippingAddress:n.defaultShippingAddress,defaultBillingAddress:n.defaultBillingAddress}}setShippingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.shippingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingAddress(this.id,n).subscribe()})}setBillingAddress(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(q,{locals:{customerId:n.customer?.id,currentAddress:n.billingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderBillingAddress(this.id,n).subscribe()})}applyCouponCode(n){this.dataService.order.applyCouponCodeToDraftOrder(this.id,n).subscribe()}removeCouponCode(n){this.dataService.order.removeCouponCodeFromDraftOrder(this.id,n).subscribe()}setShippingMethod(){(0,Vt.E)(this.entity$,this.eligibleShippingMethods$).pipe((0,x.U)(1),(0,f.G)(([n,t])=>this.modalService.fromComponent(B,{locals:{eligibleShippingMethods:t,currencyCode:n.currencyCode,currentSelectionId:n.shippingLines?.[0]?.shippingMethod.id}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingMethod(this.id,n).subscribe()})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe()}deleteOrder(){this.dataService.order.deleteDraftOrder(this.id).subscribe(({deleteDraftOrder:n})=>{n.result===d.yuD.DELETED?(this.notificationService.success((0,u.s)("common.notify-delete-success"),{entity:"Order"}),this.router.navigate(["/orders"])):n.message&&this.notificationService.error(n.message)})}completeOrder(){this.dataService.order.transitionToState(this.id,"ArrangingPayment").subscribe(({transitionOrderToState:n})=>{"Order"===n?.__typename?this.router.navigate(["/orders",this.id]):"OrderStateTransitionError"===n?.__typename&&this.notificationService.error(n.transitionError)})}hasId(n){return"object"==typeof n&&!!n.id}setFormValues(n){}static#e=this.\u0275fac=function(t){return new(t||fe)(e.GI1(e.kD9),e.GI1(d.Aj0),e.GI1(d.gnT),e.GI1(d.Ajm),e.GI1(Y))};static#t=this.\u0275cmp=e.In1({type:fe,selectors:[["vdr-draft-order-detail"]],features:[e.eg9],decls:5,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"state"],["locationId","draft-order-detail"],[1,"btn","btn-primary",3,"disabled","click"],["shape","check"],["locationId","draft-order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click"],["shape","trash",1,"is-danger"],[3,"title"],["vdrCardControls",""],["class","block mb-2",3,"customer",4,"ngIf"],[1,"button-small",3,"click"],["class","block mb-2",3,"address",4,"ngIf"],[1,"button-small","mr-2",3,"click"],[4,"ngFor","ngForOf"],["class","button-small",3,"click",4,"ngIf"],[3,"entity",4,"ngIf"],[3,"orderLineCustomFields","currencyCode","addItem"],[3,"order","orderLineCustomFields","isDraft","adjust","remove"],["locationId","draft-order-detail",3,"entity$","detailForm"],[3,"customFieldsConfig","customFieldValues","updateClick"],["shape","unknown-status","class","is-warning",4,"ngIf"],["shape","check","class","is-success",4,"ngIf"],["shape","unknown-status",1,"is-warning"],["shape","check",1,"is-success"],[1,"block","mb-2",3,"customer"],[1,"block","mb-2",3,"address"],[3,"couponCodes","addCouponCode","removeCouponCode"],[3,"entity"],[1,"table"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block"),e.yuY(1,Lr,15,9,"vdr-action-bar",0),e.wVc(2,"async"),e.C$Y(),e.yuY(3,ao,42,43,"vdr-page-detail-layout",0),e.wVc(4,"async")),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,2,o.entity$)),e.yG2(2),e.E7m("ngIf",e.kDX(4,4,o.entity$)))},dependencies:[_.o3d,_.ojz,m.ay,m.u_,b.iK,b.Ix,b.eu,Le.O,Xe.G,ue.Q,Ye.a,se.o,je.o,st.K,Me.m,ct.k,Qe.g,Ke.e,I.u,I.M,_e,L,pe,K,m.a,m.Bz,p.sD,g.u],changeDetection:0})}var lo=s(204);function so(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.fulfill-order"))}function co(r,n){if(1&r&&(e.wR5(0,"img",17),e.wVc(1,"assetPreview")),2&r){const t=e.GaO().$implicit;e.E7m("src",e.g7$(1,1,t.featuredAsset,"tiny"),e.K6U)}}function mo(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",18),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.kNx(c.fulfillmentQuantities[a.id].fulfillCount,i)||(c.fulfillmentQuantities[a.id].fulfillCount=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("disabled",0===o.getUnfulfilledCount(t)),e.OKB("ngModel",o.fulfillmentQuantities[t.id].fulfillCount),e.E7m("max",o.fulfillmentQuantities[t.id].max)}}function uo(r,n){if(1&r&&(e.I0R(0,"tr",9)(1,"td",10),e.yuY(2,co,2,4,"img",11),e.C$Y(),e.I0R(3,"td",12),e.OEk(4),e.C$Y(),e.I0R(5,"td",13),e.OEk(6),e.C$Y(),e.I0R(7,"td",14),e.OEk(8),e.C$Y(),e.I0R(9,"td",14),e.OEk(10),e.C$Y(),e.I0R(11,"td",15),e.yuY(12,mo,1,3,"input",16),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("ignore",0===o.getUnfulfilledCount(t)),e.yG2(2),e.E7m("ngIf",t.featuredAsset),e.yG2(2),e.cNF(t.productVariant.name),e.yG2(2),e.cNF(t.productVariant.sku),e.yG2(2),e.cNF(o.getUnfulfilledCount(t)),e.yG2(2),e.cNF(t.productVariant.stockOnHand),e.yG2(2),e.E7m("ngIf",o.fulfillmentQuantities[t.id])}}function _o(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",19),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",20),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.create-fulfillment")," ")}}class ge{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new l.yM,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,o)=>{const i=this.getFulfillableCount(o,n.trackInventory);return{...t,[o.id]:{fulfillCount:i,max:i}}},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>t.code===this.order.shippingLines[0]?.shippingMethod?.fulfillmentHandlerCode)||n[0],this.fulfillmentHandler=(0,d.kt8)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,a=o===d.w1i.INHERIT?t:o===d.w1i.TRUE,c=this.getUnfulfilledCount(n);return a?Math.min(c,i):c}getUnfulfilledCount(n){const t=this.order.fulfillments?.filter(o=>"Cancelled"!==o.state).map(o=>o.lines).flat().filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0;return n.quantity-t}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((i,{fulfillCount:a})=>i+a,0),t=Object.values(this.fulfillmentQuantities).every(({fulfillCount:i,max:a})=>i<=a);return(0,d.W2F)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n&&t}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,d.iMd)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||ge)(e.GI1(d.Aj0),e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ge,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,so,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e.wR5(6,"th"),e.I0R(7,"th"),e.OEk(8),e.wVc(9,"translate"),e.C$Y(),e.I0R(10,"th"),e.OEk(11),e.wVc(12,"translate"),e.C$Y(),e.I0R(13,"th"),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.I0R(16,"th"),e.OEk(17),e.wVc(18,"translate"),e.C$Y(),e.I0R(19,"th"),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()(),e.yuY(22,uo,13,8,"tr",4),e.C$Y()(),e.I0R(23,"div",5),e.wR5(24,"vdr-formatted-address",6),e.I0R(25,"h6"),e.OEk(26),e.wVc(27,"translate"),e.C$Y(),e.OEk(28),e.I0R(29,"strong"),e.OEk(30),e.wVc(31,"localeCurrency"),e.C$Y(),e.wR5(32,"vdr-configurable-input",7),e.C$Y()(),e.yuY(33,_o,6,7,"ng-template",8)),2&t&&(e.yG2(8),e.cNF(e.kDX(9,14,"order.product-name")),e.yG2(3),e.cNF(e.kDX(12,16,"order.product-sku")),e.yG2(3),e.cNF(e.kDX(15,18,"order.unfulfilled")),e.yG2(3),e.cNF(e.kDX(18,20,"catalog.stock-on-hand")),e.yG2(3),e.cNF(e.kDX(21,22,"order.fulfill")),e.yG2(2),e.E7m("ngForOf",o.order.lines),e.yG2(2),e.E7m("address",o.order.shippingAddress),e.yG2(2),e.cNF(e.kDX(27,24,"order.shipping-method")),e.yG2(2),e.oRS(" ",null==o.order.shippingLines[0]||null==o.order.shippingLines[0].shippingMethod?null:o.order.shippingLines[0].shippingMethod.name," "),e.yG2(2),e.cNF(e.g7$(31,26,o.order.shipping,o.order.currencyCode)),e.yG2(2),e.E7m("operationDefinition",o.fulfillmentHandlerDef)("operation",o.fulfillmentHandler)("formControl",o.fulfillmentHandlerControl)("removable",!1))},dependencies:[m.ay,m.u_,l.ot,l.O4,l.ue,l.Gu,l._t,l._G,l.ug,lo.K,y.w,E.E,v.a,se.o,p.sD,j.w,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0})}function po(r,n){if(1&r&&(e.I0R(0,"div",5),e.OEk(1),e.C$Y()),2&r){const t=e.GaO().$implicit;e.yG2(),e.cNF(t.quantity)}}function fo(r,n){1&r&&e.wR5(0,"clr-icon",6)}function go(r,n){if(1&r&&(e.I0R(0,"li",2),e.yuY(1,po,2,1,"div",3)(2,fo,1,0,"clr-icon",4),e.OEk(3),e.C$Y()),2&r){const t=n.$implicit;e.E7m("title",t.name),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.E7m("ngIf",null!=t.quantity),e.yG2(),e.oRS(" ",t.name," ")}}class X{static#e=this.\u0275fac=function(t){return new(t||X)};static#t=this.\u0275cmp=e.In1({type:X,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],["class","quantity",4,"ngIf"],["shape","times","size","12",4,"ngIf"],[1,"quantity"],["shape","times","size","12"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"ul"),e.yuY(2,go,4,4,"li",1),e.C$Y()()),2&t&&(e.yG2(2),e.E7m("ngForOf",o.items))},dependencies:[_.o3d,m.ay,m.u_],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0})}function yo(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.tracking-code")),e.yG2(2),e.oRS(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function Co(r,n){if(1&r&&e.wR5(0,"vdr-custom-field-control",5),2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function ho(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Co,1,4,"vdr-custom-field-control",4),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.customFieldFormGroup.get(t.name))}}class ee{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new l.k1({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){return this.fulfillment?.lines.map(n=>({name:this.order.lines.find(t=>t.id===n.orderLineId)?.productVariant.name??"",quantity:n.quantity}))??[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new l.yM(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,C.isObject)(n)}static#e=this.\u0275fac=function(t){return new(t||ee)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:ee,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.SYr],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeDate"),e.C$Y(),e.I0R(4,"vdr-labeled-data",0),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.yuY(7,yo,3,4,"vdr-labeled-data",1),e.I0R(8,"vdr-labeled-data",0),e.wVc(9,"translate"),e.wR5(10,"vdr-simple-item-list",2),e.C$Y(),e.yuY(11,ho,2,1,"ng-container",3)),2&t&&(e.E7m("label",e.kDX(1,8,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(3,10,null==o.fulfillment?null:o.fulfillment.createdAt,"medium"),"\n"),e.yG2(2),e.E7m("label",e.kDX(5,13,"order.fulfillment-method")),e.yG2(2),e.oRS(" ",null==o.fulfillment?null:o.fulfillment.method,"\n"),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.trackingCode),e.yG2(),e.E7m("label",e.kDX(9,15,"order.contents")),e.yG2(2),e.E7m("items",o.items),e.yG2(),e.E7m("ngForOf",o.customFieldConfig))},dependencies:[m.ay,m.u_,qe.E,h.a,X,p.sD,A.m],changeDetection:0})}function Oo(r,n){1&r&&e.wR5(0,"clr-icon",2)}class ye{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||ye)};static#t=this.\u0275cmp=e.In1({type:ye,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,Oo,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Delivered"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0})}function vo(r,n){if(1&r&&e.wR5(0,"vdr-fulfillment-detail",7),2&r){const t=e.GaO();e.E7m("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}const ft=r=>({state:r});function bo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",14),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y(),e.k70()}if(2&r){const t=n.ngIf;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.set-fulfillment-state",e.S45(8,ft,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Io(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",18),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,ft,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Go(r,n){1&r&&(e.wR5(0,"clr-icon",19),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-fulfillment")," "))}function Eo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",15),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionState.emit(a))}),e.yuY(2,Io,6,10,"ng-container",16)(3,Go,3,3,"ng-template",null,17,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Ro(r,n){if(1&r&&(e.I0R(0,"div",8),e.yuY(1,bo,6,10,"ng-container",9),e.I0R(2,"vdr-dropdown")(3,"button",10),e.wR5(4,"clr-icon",11),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",12),e.yuY(6,Eo,5,2,"ng-container",13),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.nextSuggestedState()),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class Ce{constructor(){this.transitionState=new e._w7}nextSuggestedState(){if(!this.fulfillment)return;const{nextStates:n}=this.fulfillment,t=o=>n.includes(o)?o:n[0];switch(this.fulfillment?.state){case"Pending":return t("Shipped");case"Shipped":return t("Delivered");default:return n.find(o=>"Cancelled"!==o)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}static#e=this.\u0275fac=function(t){return new(t||Ce)};static#t=this.\u0275cmp=e.In1({type:Ce,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.I0R(5,"div",2),e.wR5(6,"vdr-fulfillment-state-label",3),e.C$Y()(),e.I0R(7,"div",4),e.yuY(8,vo,1,2,"vdr-fulfillment-detail",5),e.C$Y(),e.yuY(9,Ro,7,2,"div",6),e.C$Y()),2&t&&(e.yG2(3),e.cNF(e.kDX(4,4,"order.fulfillment")),e.yG2(3),e.E7m("state",null==o.fulfillment?null:o.fulfillment.state),e.yG2(2),e.E7m("ngIf",!!o.fulfillment),e.yG2(),e.E7m("ngIf",null==o.fulfillment?null:o.fulfillment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,J.i,W.m,U.q,ue.Q,ee,ye,p.sD,$.Q],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0})}function ko(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.note")),e.yG2(2),e.cNF(t.modification.note)}}function wo(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();let i;e.E7m("label",e.kDX(1,3,"order.surcharges")),e.yG2(2),e.CAO(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.g7$(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function To(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.added-items")),e.yG2(2),e.E7m("items",t.getAddedItems())}}function So(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.removed-items")),e.yG2(2),e.E7m("items",t.getRemovedItems())}}function Do(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.wR5(2,"vdr-simple-item-list",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.modified-items")),e.yG2(2),e.E7m("items",t.getModifiedItems())}}class he{constructor(){this.addedItems=new Map,this.removedItems=new Map,this.modifiedItems=new Set}ngOnChanges(){const{added:n,removed:t,modified:o}=this.getModifiedLines();this.addedItems=n,this.removedItems=t,this.modifiedItems=o}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedItems(){return[...this.modifiedItems].map(n=>({name:n.productVariant.name}))}getModifiedLines(){const n=new Map,t=new Map,o=new Set;for(const i of this.modification.lines||[]){const a=this.order.lines.find(c=>c.id===i.orderLineId);a&&(0===i.quantity?o.add(a):i.quantity<0?t.set(a,-i.quantity):n.set(a,i.quantity))}return{added:n,removed:t,modified:o}}static#e=this.\u0275fac=function(t){return new(t||he)};static#t=this.\u0275cmp=e.In1({type:he,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.SYr],decls:8,vars:9,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.yuY(3,ko,3,4,"vdr-labeled-data",1)(4,wo,4,8,"vdr-labeled-data",2)(5,To,3,4,"vdr-labeled-data",1)(6,So,3,4,"vdr-labeled-data",1)(7,Do,3,4,"vdr-labeled-data",1)),2&t&&(e.E7m("label",e.kDX(1,7,"common.ID")),e.yG2(2),e.cNF(o.modification.id),e.yG2(),e.E7m("ngIf",o.modification.note),e.yG2(),e.E7m("ngForOf",o.modification.surcharges),e.yG2(),e.E7m("ngIf",o.getAddedItems().length),e.yG2(),e.E7m("ngIf",o.getRemovedItems().length),e.yG2(),e.E7m("ngIf",o.getModifiedItems().length))},dependencies:[m.ay,m.u_,h.a,X,p.sD,g.u],changeDetection:0})}var gt=s(7552),He=s(5623);const Be=72;function xo(r,n){if(1&r&&(e.I0R(0,"div",3),e.wR5(1,"div",4)(2,"clr-icon",5),e.I0R(3,"div",6),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y()()),2&r){const t=e.GaO();e.yG2(4),e.oRS(" ",e.kDX(5,1,e.kDX(6,3,t.cancelledState))," ")}}class te{constructor(n){this.elementRef=n,this.active$=new He.g(!1),this.activeTarget$=new He.g(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){this.elementRef.nativeElement.getBoundingClientRect();const o=this.elementRef.nativeElement.querySelector(".node")?.getBoundingClientRect().height??0;return{x:10,y:this.index*Be+("bottom"===n?o:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}static#e=this.\u0275fac=function(t){return new(t||te)(e.GI1(e.GMv))};static#t=this.\u0275cmp=e.In1({type:te,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.SYr],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.I0R(2,"div",1),e.wVc(3,"async"),e.OEk(4),e.wVc(5,"translate"),e.wVc(6,"stateI18nToken"),e.C$Y(),e.yuY(7,xo,7,5,"div",2),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,7,o.active$)),e.E7m("ngStyle",o.getStyle()),e.yG2(2),e.eAK("active-target",e.kDX(3,9,o.activeTarget$)),e.yG2(2),e.oRS(" ",e.kDX(5,11,e.kDX(6,13,o.node.name))," "),e.yG2(3),e.E7m("ngIf",o.isCancellable))},dependencies:[_.o3d,m.u_,m.Qt,m.a,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-inline-start:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-inline-start:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0})}class Oe{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,de.y)(n=>this.to.activeTarget$.next(n)))}getStyle(){const n=this.from.index<this.to.index?"down":"up",t=this.from.getPos("down"===n?"bottom":"top"),o=this.to.getPos("down"===n?"top":"bottom"),i=Math.abs(t.x-o.x),a=Math.abs(t.y-o.y),c=Math.sqrt(i**2+a**2);return{"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":c,"width.px":1,..."up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{}}}static#e=this.\u0275fac=function(t){return new(t||Oe)};static#t=this.\u0275cmp=e.In1({type:Oe,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(t,o){1&t&&(e.I0R(0,"div",0),e.wVc(1,"async"),e.wR5(2,"clr-icon",1),e.C$Y()),2&t&&(e.eAK("active",e.kDX(1,5,o.active$)),e.E7m("ngStyle",o.getStyle()),e.e48("data-from",o.from.node.name)("data-to",o.to.node.name))},dependencies:[_.o3d,m.Qt,m.a],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0})}function Fo(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"vdr-order-process-node",1),e.qCj("mouseenter",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.onMouseOver(a.name))})("mouseleave",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.onMouseOut())}),e.wVc(2,"async"),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=n.index,i=e.GaO();e.yG2(),e.E7m("node",t)("index",o)("active",e.kDX(2,3,i.activeState$)===t.name)}}function $o(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"vdr-order-process-edge",2),e.k70()),2&r){const t=n.$implicit;e.yG2(),e.E7m("from",t.from)("to",t.to)("index",t.index)}}class ve{constructor(n){this.changeDetector=n,this.setActiveState$=new He.g(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*Be}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ne.o)(150))}ngOnChanges(n){this.populateNodes()}ngAfterViewInit(){setTimeout(()=>this.populateEdges())}onMouseOver(n){this.setActiveState$.next(n)}onMouseOut(){this.setActiveState$.next(this.initialState)}getNodeFor(n){if(this.nodeComponents)return this.nodeComponents.find(t=>t.node.name===n)}populateNodes(){const n=new Map;for(const t of this.states)n.set(t.name,{name:t.name,to:[]});for(const[t,o]of n.entries()){const i=this.states.find(a=>a.name===t)?.to??[];for(const a of i){const c=n.get(a);c&&o.to.push(c)}}this.nodes=[...n.values()].filter(t=>"Cancelled"!==t.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let o=0;for(const i of n.to){const a=this.getNodeFor(i.name);t&&a&&t!==a&&(this.edges.push({to:a,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}static#e=this.\u0275fac=function(t){return new(t||ve)(e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:ve,selectors:[["vdr-order-process-graph"]],viewQuery:function(t,o){if(1&t&&e.CC$(te,5),2&t){let i;e.wto(i=e.Gqi())&&(o.nodeComponents=i)}},hostVars:2,hostBindings:function(t,o){2&t&&e.m4B("height",o.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.SYr],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(t,o){1&t&&e.yuY(0,Fo,3,5,"ng-container",0)(1,$o,2,3,"ng-container",0),2&t&&(e.E7m("ngForOf",o.nodes),e.yG2(),e.E7m("ngForOf",o.edges))},dependencies:[m.ay,te,Oe,m.a],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0})}function Yo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.order-state-diagram"))}class be{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}static#e=this.\u0275fac=function(t){return new(t||be)(e.GI1(d.ctz))};static#t=this.\u0275cmp=e.In1({type:be,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(t,o){1&t&&(e.yuY(0,Yo,2,3,"ng-template",0),e.wR5(1,"vdr-order-process-graph",1)),2&t&&(e.yG2(),e.E7m("states",o.states)("initialState",o.activeState))},dependencies:[v.a,ve,p.sD],changeDetection:0})}var Je=s(3412),We=s(6644),Mo=s(7288);function Po(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-select-toggle",6),e.iHE("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit;return e.kNx(a.selected,i)||(a.selected=i),e.CGJ(i)}),e.qCj("selectedChange",function(i){e.usT(t);const a=e.GaO().$implicit,c=e.GaO();return e.CGJ(c.paymentSelected.emit({payment:a,selected:i}))}),e.wVc(1,"translate"),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("title",e.kDX(1,4,"order.refund-this-payment"))("label",e.kDX(2,6,"order.refund-this-payment"))("disabled",1===o.refundablePayments.length),e.OKB("selected",t.selected)}}function Ao(r,n){if(1&r&&(e.I0R(0,"vdr-card",1),e.wVc(1,"translate"),e.yuY(2,Po,3,8,"ng-template",2),e.I0R(3,"div",3)(4,"vdr-labeled-data",4),e.wVc(5,"translate"),e.OEk(6),e.C$Y(),e.I0R(7,"vdr-labeled-data",4),e.wVc(8,"translate"),e.OEk(9),e.C$Y(),e.I0R(10,"vdr-labeled-data",4),e.wVc(11,"translate"),e.OEk(12),e.wVc(13,"localeCurrency"),e.C$Y(),e.I0R(14,"vdr-labeled-data",4),e.wVc(15,"translate"),e.OEk(16),e.wVc(17,"localeCurrency"),e.C$Y()(),e.I0R(18,"vdr-form-field",4),e.wVc(19,"translate"),e.wR5(20,"vdr-currency-input",5),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO();e.eAK("selected",t.selected)("unselected",!t.selected),e.E7m("title",e.kDX(1,17,"order.payment")),e.yG2(4),e.E7m("label",e.kDX(5,19,"order.payment-method")),e.yG2(2),e.oRS(" ",t.method," "),e.yG2(),e.E7m("label",e.kDX(8,21,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," "),e.yG2(),e.E7m("label",e.kDX(11,23,"order.payment-amount")),e.yG2(2),e.oRS(" ",e.g7$(13,25,t.amount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(15,28,"order.refundable-amount")),e.yG2(2),e.oRS(" ",e.g7$(17,30,t.refundableAmount,o.order.currencyCode)," "),e.yG2(2),e.E7m("label",e.kDX(19,33,"order.refund-amount")),e.yG2(2),e.E7m("readonly",!t.selected)("currencyCode",o.order.currencyCode)("formControl",t.amountToRefundControl)}}class ne{constructor(){this.paymentSelected=new e._w7}static#e=this.\u0275fac=function(t){return new(t||ne)};static#t=this.\u0275cmp=e.In1({type:ne,selectors:[["vdr-payment-for-refund-selector"]],inputs:{refundablePayments:"refundablePayments",order:"order"},outputs:{paymentSelected:"paymentSelected"},decls:1,vars:1,consts:[[3,"title","selected","unselected",4,"ngFor","ngForOf"],[3,"title"],["vdrCardControls",""],[1,"form-grid"],[3,"label"],[3,"readonly","currencyCode","formControl"],["size","small",3,"title","label","disabled","selected","selectedChange"]],template:function(t,o){1&t&&e.yuY(0,Ao,21,35,"vdr-card",0),2&t&&e.E7m("ngForOf",o.refundablePayments)},dependencies:[m.ay,l.ue,l.ug,Je.Y,P._,y.w,Mo.u,h.a,I.u,I.M,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"]})}function Vo(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.refund-and-cancel-order"))}function No(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function Lo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function Xo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function jo(r,n){if(1&r&&(e.wR5(0,"img",26),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Qo(r,n){1&r&&(e.I0R(0,"div",27),e.wR5(1,"clr-icon",28),e.C$Y())}function Ko(r,n){if(1&r&&(e.I0R(0,"div",23),e.yuY(1,jo,2,4,"img",24)(2,Qo,2,0,"ng-template",null,25,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function qo(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Ho(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function Bo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency")),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,1,t.unitPriceWithTax,o.order.currencyCode)," ")}}function Jo(r,n){if(1&r&&(e.I0R(0,"div",34),e.OEk(1),e.I0R(2,"div",35),e.OEk(3),e.wVc(4,"currency"),e.wVc(5,"number"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO(3).item,i=e.GaO();e.yG2(),e.oRS(" ",t.description," "),e.yG2(2),e.oRS(" ",e.g7$(4,2,e.g7$(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function Wo(r,n){if(1&r&&(e.I0R(0,"vdr-dropdown")(1,"div",30)(2,"button",31),e.wR5(3,"clr-icon",32),e.C$Y()(),e.I0R(4,"vdr-dropdown-menu"),e.yuY(5,Jo,6,8,"div",33),e.C$Y()()),2&r){const t=e.GaO().ngIf;e.yG2(5),e.E7m("ngForOf",t)}}function Uo(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Wo,6,1,"vdr-dropdown",29),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}function zo(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency"),e.yuY(2,Uo,2,1,"ng-container",29)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",e.g7$(1,2,t.proratedUnitPriceWithTax,o.order.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.discounts)}}function Zo(r,n){if(1&r&&(e.OEk(0),e.wR5(1,"vdr-line-refunds",36)),2&r){const t=n.item,o=e.GaO();e.oRS(" ",t.quantity," "),e.yG2(),e.E7m("line",t)("payments",o.order.payments)}}function ei(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",38),e.qCj("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.CGJ(c.onRefundQuantityChange(a.id,i))}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function ti(r,n){if(1&r&&e.yuY(0,ei,1,2,"input",37),2&r){const t=n.item,o=e.GaO();e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function ni(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",43),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO().item,c=e.GaO();return e.kNx(c.lineQuantities[a.id].cancel,i)||(c.lineQuantities[a.id].cancel=i),e.CGJ(i)}),e.C$Y()}if(2&r){const t=e.GaO().item,o=e.GaO();e.E7m("disabled",0===o.lineQuantities[t.id].quantity),e.OKB("ngModel",o.lineQuantities[t.id].cancel)}}function ri(r,n){if(1&r&&(e.I0R(0,"div",39)(1,"label",40),e.yuY(2,ni,1,2,"input",41),e.I0R(3,"span",42),e.OEk(4),e.wVc(5,"translate"),e.C$Y()()()),2&r){const t=n.item,o=e.GaO();e.yG2(2),e.E7m("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.yG2(2),e.cNF(e.kDX(5,2,"order.return-to-stock"))}}function oi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"label",44)(1,"input",45),e.qCj("change",function(){const a=e.usT(t).$implicit,c=e.GaO();return e.CGJ(c.toggleShippingRefund(a.id))}),e.C$Y(),e.I0R(2,"div",42),e.OEk(3),e.wVc(4,"translate"),e.I0R(5,"span"),e.OEk(6),e.C$Y(),e.I0R(7,"span",42),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()}if(2&r){const t=n.$implicit,o=e.GaO();e.yG2(3),e.oRS(" ",e.kDX(4,3,"order.refund-shipping")," "),e.yG2(3),e.oRS("",t.shippingMethod.name,":"),e.yG2(2),e.oRS("",e.g7$(9,5,t.discountedPriceWithTax,o.order.currencyCode)," ")}}const ii=(r,n)=>({min:r,max:n});function ai(r,n){if(1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"currency"),e.wVc(5,"localeCurrency"),e.C$Y()()),2&r){const t=e.GaO(2);e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.refund-total-error",e.IBC(12,ii,e.g7$(4,6,0,t.order.currencyCode),e.g7$(5,9,t.totalRefundableAmount,t.order.currencyCode)))," ")}}function li(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-total-warning")," "))}function di(r,n){1&r&&(e.I0R(0,"clr-alert",51)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-cancellation-reason-required")," "))}const si=r=>({amount:r});function ci(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"div",46),e.yuY(2,ai,6,15,"clr-alert",47)(3,li,4,5,"clr-alert",47)(4,di,4,5,"clr-alert",47),e.C$Y(),e.I0R(5,"div",48)(6,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(7),e.wVc(8,"translate"),e.C$Y(),e.I0R(9,"button",50),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.select())}),e.OEk(10),e.wVc(11,"translate"),e.wVc(12,"localeCurrency"),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf",t.refundTotal<0||t.totalRefundableAmount<t.refundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal<t.refundTotal||t.refundTotal<t.amountToRefundTotal),e.yG2(),e.E7m("ngIf",t.amountToRefundTotal&&!t.reason),e.yG2(3),e.cNF(e.kDX(8,6,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.canSubmit()),e.yG2(),e.oRS(" ",e.g7$(11,8,"order.refund-with-amount",e.S45(14,si,e.g7$(12,11,t.amountToRefundTotal,t.order.currencyCode)))," ")}}class Ie{constructor(n){this.i18nService=n,this.lineQuantities={},this.refundablePayments=[],this.refundShippingLineIds=[],this.reasons=(0,d.g$r)().cancellationReasons??[(0,u.s)("order.refund-reason-customer-request"),(0,u.s)("order.refund-reason-not-available")],this.manuallySetRefundTotal=!1,this.refundTotal=0,this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}get totalRefundableAmount(){return(0,C.summate)(this.refundablePayments,"refundableAmount")}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}lineCanBeRefundedOrCancelled(n){return(this.order.payments?.reduce((o,i)=>[...o,...i.refunds],[]).filter(o=>"Failed"!==o.state).reduce((o,i)=>[...o,...i.lines],[]).filter(o=>o.orderLineId===n.id).reduce((o,i)=>o+i.quantity,0)??0)<n.orderPlacedQuantity}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:{quantity:0,refund:!0,cancel:!1}}),{}),this.refundablePayments=Ve(this.order.payments)}updateRefundTotal(){if(!this.manuallySetRefundTotal){const o=this.order.lines.reduce((a,c)=>{const ze=this.lineQuantities[c.id].quantity||0;return a+c.proratedUnitPriceWithTax*ze},0),i=this.order.shippingLines.reduce((a,c)=>this.refundShippingLineIds.includes(c.id)?a+c.discountedPriceWithTax:a,0);this.refundTotal=o+i}const n=this.refundablePayments.filter(o=>o.selected);let t=0;for(const o of n){const i=Math.min(o.refundableAmount,this.refundTotal-t);o.amountToRefundControl.setValue(i),t+=i}}toggleShippingRefund(n){const t=this.refundShippingLineIds.indexOf(n);-1===t?this.refundShippingLineIds.push(n):this.refundShippingLineIds.splice(t,1),this.updateRefundTotal()}onRefundQuantityChange(n,t){this.manuallySetRefundTotal=!1;const o=this.lineQuantities[n];if(o){const i=o.quantity;0===t?o.cancel=!1:0===i&&t>0&&(o.cancel=!0),o.quantity=t,this.updateRefundTotal()}}onPaymentSelected(n,t){if(t){const o=this.refundTotal-this.refundablePayments.filter(i=>i.id!==n.id).reduce((i,a)=>i+a.amountToRefundControl.value,0);0<o&&n.amountToRefundControl.setValue(Math.min(o,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return 0<this.refundTotal&&this.amountToRefundTotal===this.refundTotal&&!!this.reason}select(){const n=this.getOrderLineInput(()=>!0),t=this.getOrderLineInput(o=>o.cancel);this.resolveWith({refunds:this.refundablePayments.filter(o=>o.selected&&0<o.amountToRefundControl.value).map(o=>({lines:n,reason:this.reason,paymentId:o.id,amount:o.amountToRefundControl.value,shipping:0,adjustment:0})),cancel:{lines:t,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShippingLineIds.length>0}})}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,o])=>0<o.quantity&&n(o)).map(([t,o])=>({orderLineId:t,quantity:o.quantity}))}static#e=this.\u0275fac=function(t){return new(t||Ie)(e.GI1(d.WYg))};static#t=this.\u0275cmp=e.In1({type:Ie,selectors:[["vdr-refund-order-dialog"]],decls:50,vars:60,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],["id","refund-order",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading","hiddenByDefault"],["id","prorated-unit-price",3,"heading"],["id","quantity",3,"heading"],["id","refund-quantity",3,"heading","optional"],["id","cancel",3,"heading","optional"],[1,"refund-details","mt-4"],["class","flex mb-2",4,"ngFor","ngForOf"],[1,"mb-2",3,"label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","placeholder","addTag","ngModel","ngModelChange"],[3,"label","readOnlyToggle","readOnlyToggleChange"],[3,"readonly","currencyCode","ngModel","ngModelChange"],[1,""],[3,"refundablePayments","order","paymentSelected"],["vdrDialogButtons",""],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],[3,"line","payments"],["type","number","min","0",3,"ngModel","max","ngModelChange",4,"ngIf"],["type","number","min","0",3,"ngModel","max","ngModelChange"],[1,"cancel-checkbox-wrapper"],[1,"flex","center"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],[1,"ml-1"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[1,"flex","mb-2"],["type","checkbox","clrCheckbox","",3,"change"],[1,"errors"],[3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[3,"clrAlertType","clrAlertClosable"]],template:function(t,o){1&t&&(e.yuY(0,Vo,2,3,"ng-template",0),e.I0R(1,"div",1)(2,"vdr-data-table-2",2)(3,"vdr-dt2-column",3),e.wVc(4,"translate"),e.yuY(5,No,1,1,"ng-template"),e.C$Y(),e.I0R(6,"vdr-dt2-column",4),e.wVc(7,"translate"),e.yuY(8,Lo,2,4,"ng-template"),e.C$Y(),e.I0R(9,"vdr-dt2-column",5),e.wVc(10,"translate"),e.yuY(11,Xo,2,4,"ng-template"),e.C$Y(),e.I0R(12,"vdr-dt2-column",6),e.wVc(13,"translate"),e.yuY(14,Ko,4,2,"ng-template"),e.C$Y(),e.I0R(15,"vdr-dt2-column",7),e.wVc(16,"translate"),e.yuY(17,qo,1,1,"ng-template"),e.C$Y(),e.I0R(18,"vdr-dt2-column",8),e.wVc(19,"translate"),e.yuY(20,Ho,1,1,"ng-template"),e.C$Y(),e.I0R(21,"vdr-dt2-column",9),e.wVc(22,"translate"),e.yuY(23,Bo,2,4,"ng-template"),e.C$Y(),e.I0R(24,"vdr-dt2-column",10),e.wVc(25,"translate"),e.yuY(26,zo,3,5,"ng-template"),e.C$Y(),e.I0R(27,"vdr-dt2-column",11),e.wVc(28,"translate"),e.yuY(29,Zo,2,3,"ng-template"),e.C$Y(),e.I0R(30,"vdr-dt2-column",12),e.wVc(31,"translate"),e.yuY(32,ti,1,1,"ng-template"),e.C$Y(),e.I0R(33,"vdr-dt2-column",13),e.wVc(34,"translate"),e.yuY(35,ri,6,4,"ng-template"),e.C$Y()(),e.I0R(36,"div",14)(37,"div")(38,"vdr-card"),e.yuY(39,oi,10,8,"label",15),e.I0R(40,"vdr-form-field",16),e.wVc(41,"translate"),e.I0R(42,"ng-select",17),e.iHE("ngModelChange",function(a){return e.kNx(o.reason,a)||(o.reason=a),a}),e.wVc(43,"translate"),e.C$Y()(),e.I0R(44,"vdr-form-field",18),e.qCj("readOnlyToggleChange",function(a){return o.manuallySetRefundTotal=!a}),e.wVc(45,"translate"),e.I0R(46,"vdr-currency-input",19),e.iHE("ngModelChange",function(a){return e.kNx(o.refundTotal,a)||(o.refundTotal=a),a}),e.qCj("ngModelChange",function(){return o.updateRefundTotal()}),e.C$Y()()()(),e.I0R(47,"div",20)(48,"vdr-payment-for-refund-selector",21),e.qCj("paymentSelected",function(a){return o.onPaymentSelected(a.payment,a.selected)}),e.C$Y()()()(),e.yuY(49,ci,13,16,"ng-template",22)),2&t&&(e.yG2(2),e.E7m("items",o.order.lines),e.yG2(),e.E7m("heading",e.kDX(4,32,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(7,34,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(10,36,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(13,38,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(16,40,"order.product-name"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(19,42,"order.product-sku")),e.yG2(3),e.E7m("heading",e.kDX(22,44,"order.unit-price"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(25,46,"order.prorated-unit-price")),e.yG2(3),e.E7m("heading",e.kDX(28,48,"order.quantity")),e.yG2(3),e.E7m("heading",e.kDX(31,50,"order.refund"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(34,52,"order.return-to-stock"))("optional",!1),e.yG2(6),e.E7m("ngForOf",o.order.shippingLines),e.yG2(),e.E7m("label",e.kDX(41,54,"order.refund-cancellation-reason")),e.yG2(2),e.E7m("items",o.reasons)("placeholder",e.kDX(43,56,"order.refund-cancellation-reason-required"))("addTag",!0),e.OKB("ngModel",o.reason),e.yG2(2),e.E7m("label",e.kDX(45,58,"order.refund-total"))("readOnlyToggle",!0),e.yG2(2),e.E7m("readonly",!o.manuallySetRefundTotal)("currencyCode",o.order.currencyCode),e.OKB("ngModel",o.refundTotal),e.yG2(2),e.E7m("refundablePayments",o.refundablePayments)("order",o.order))},dependencies:[_.c0g,_.KMj,_.o3d,_.ojz,_.y6l,m.ay,m.u_,l.ot,l.O4,l.SU,l.ue,l.Gu,l._t,l._G,S.UT,Je.Y,P._,y.w,E.E,v.a,J.i,W.m,U.q,We.q,Pe.M,I.u,V,ne,m.hl,m.cf,p.sD,j.w,A.m,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)} .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details[_ngcontent-%COMP%]{flex-direction:row}}.refund-details[_ngcontent-%COMP%] vdr-card.unselected[_ngcontent-%COMP%]{opacity:.8}.refund-details[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1}.errors[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-inline-start:12px}vdr-card.faded[_ngcontent-%COMP%]{opacity:.8}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}function mi(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.settle-refund"))}function ui(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",4),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y(),e.I0R(3,"button",5),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.submit())}),e.OEk(4),e.wVc(5,"translate"),e.C$Y()}if(2&r){const t=e.GaO();e.yG2(),e.cNF(e.kDX(2,3,"common.cancel")),e.yG2(2),e.E7m("disabled",!t.transactionId),e.yG2(),e.oRS(" ",e.kDX(5,5,"order.settle-refund")," ")}}const _i=r=>({method:r});class Ge{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}static#e=this.\u0275fac=function(t){return new(t||Ge)};static#t=this.\u0275cmp=e.In1({type:Ge,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModel","ngModelChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.yuY(0,mi,2,3,"ng-template",0),e.I0R(1,"p",1),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"clr-input-container")(5,"label"),e.OEk(6),e.wVc(7,"translate"),e.C$Y(),e.I0R(8,"input",2),e.iHE("ngModelChange",function(a){return e.kNx(o.transactionId,a)||(o.transactionId=a),a}),e.C$Y()(),e.yuY(9,ui,6,7,"ng-template",3)),2&t&&(e.yG2(2),e.oRS(" ",e.g7$(3,3,"order.settle-refund-manual-instructions",e.S45(8,_i,o.refund.method)),"\n"),e.yG2(4),e.cNF(e.kDX(7,6,"order.transaction-id")),e.yG2(2),e.OKB("ngModel",o.transactionId))},dependencies:[_.ojz,_.Ga0,_.UJB,l.ot,l.ue,l._G,y.w,E.E,v.a,p.sD],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0})}var yt=s(4204);function pi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Ee{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Ee)};static#t=this.\u0275cmp=e.In1({type:Ee,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,pi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function fi(r,n){1&r&&e.wR5(0,"clr-icon",2)}class Re{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}static#e=this.\u0275fac=function(t){return new(t||Re)};static#t=this.\u0275cmp=e.In1({type:Re,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-chip",0),e.wVc(1,"translate"),e.yuY(2,fi,1,0,"clr-icon",1),e.OEk(3),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()),2&t&&(e.E7m("title",e.kDX(1,4,"order.payment-state"))("colorType",o.chipColorType),e.yG2(2),e.E7m("ngIf","Settled"===o.state),e.yG2(),e.oRS(" ",e.kDX(4,6,e.kDX(5,8,o.state)),"\n"))},dependencies:[_.o3d,m.u_,D.g,p.sD,$.Q],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}function gi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.error-message")),e.yG2(2),e.oRS(" ",t.payment.errorMessage,"\n")}}function yi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.payment.transactionId,"\n")}}class re{static#e=this.\u0275fac=function(t){return new(t||re)};static#t=this.\u0275cmp=e.In1({type:re,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y(),e.I0R(3,"vdr-labeled-data",0),e.wVc(4,"translate"),e.OEk(5),e.wVc(6,"localeCurrency"),e.C$Y(),e.yuY(7,gi,3,4,"vdr-labeled-data",1)(8,yi,3,4,"vdr-labeled-data",1),e.I0R(9,"vdr-labeled-data",0),e.wVc(10,"translate"),e.wR5(11,"vdr-object-tree",2),e.C$Y()),2&t&&(e.E7m("label",e.kDX(1,8,"order.payment-method")),e.yG2(2),e.oRS(" ",o.payment.method,"\n"),e.yG2(),e.E7m("label",e.kDX(4,10,"order.amount")),e.yG2(2),e.oRS(" ",e.g7$(6,12,o.payment.amount,o.currencyCode),"\n"),e.yG2(2),e.E7m("ngIf",o.payment.errorMessage),e.yG2(),e.E7m("ngIf",o.payment.transactionId),e.yG2(),e.E7m("label",e.kDX(10,15,"order.payment-metadata")),e.yG2(2),e.E7m("value",o.payment.metadata))},dependencies:[m.u_,h.a,ce.W,p.sD,g.u],changeDetection:0})}function Ci(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"localeCurrency"),e.k70()),2&r){const t=e.GaO();e.yG2(),e.cNF(e.g7$(2,1,t.payment.amount,t.currencyCode))}}function hi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.transactionId," ")}}function Oi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-reason")),e.yG2(2),e.oRS(" ",t.reason," ")}}function vi(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",13),e.wVc(1,"translate"),e.wR5(2,"vdr-object-tree",15),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.refund-metadata")),e.yG2(2),e.E7m("value",t.metadata)}}function bi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div",16)(1,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO().$implicit,a=e.GaO();return e.CGJ(a.settleRefund.emit(i))}),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()}2&r&&(e.yG2(2),e.oRS(" ",e.kDX(3,1,"order.settle-refund")," "))}function Ii(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",9)(2,"div",10),e.wR5(3,"clr-icon",11),e.OEk(4),e.wVc(5,"translate"),e.wR5(6,"div",12)(7,"vdr-refund-state-label",4),e.C$Y(),e.I0R(8,"div",5)(9,"vdr-labeled-data",13),e.wVc(10,"translate"),e.OEk(11),e.wVc(12,"localeDate"),e.C$Y(),e.I0R(13,"vdr-labeled-data",13),e.wVc(14,"translate"),e.OEk(15),e.wVc(16,"localeCurrency"),e.C$Y(),e.yuY(17,hi,3,4,"vdr-labeled-data",14)(18,Oi,3,4,"vdr-labeled-data",14)(19,vi,3,4,"vdr-labeled-data",14),e.C$Y(),e.yuY(20,bi,4,3,"div",8),e.C$Y(),e.k70()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(4),e.CAO(" ",e.kDX(5,11,"order.refund")," #",t.id," "),e.yG2(3),e.E7m("state",t.state),e.yG2(2),e.E7m("label",e.kDX(10,13,"common.created-at")),e.yG2(2),e.oRS(" ",e.g7$(12,15,t.createdAt,"medium")," "),e.yG2(2),e.E7m("label",e.kDX(14,18,"order.refund-total")),e.yG2(2),e.oRS(" ",e.g7$(16,20,t.total,o.currencyCode)," "),e.yG2(2),e.E7m("ngIf",t.transactionId),e.yG2(),e.E7m("ngIf",t.reason),e.yG2(),e.E7m("ngIf",o.refundHasMetadata(t)),e.yG2(),e.E7m("ngIf","Pending"===t.state)}}function Gi(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.settlePayment.emit(i.payment))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.settle-payment")," "))}const Ei=r=>({state:r});function Ri(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"clr-icon",25),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.k70()),2&r){const t=e.GaO().$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,Ei,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function ki(r,n){1&r&&(e.wR5(0,"clr-icon",26),e.OEk(1),e.wVc(2,"translate")),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.cancel-payment")," "))}function wi(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",22),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(2);return e.CGJ(c.transitionPaymentState.emit({payment:c.payment,state:a}))}),e.yuY(2,Ri,6,10,"ng-container",23)(3,ki,3,3,"ng-template",null,24,e.gJz),e.C$Y(),e.k70()}if(2&r){const t=n.$implicit,o=e.Gew(4);e.yG2(2),e.E7m("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Ti(r,n){if(1&r&&(e.I0R(0,"div",16),e.yuY(1,Gi,3,3,"button",18),e.I0R(2,"vdr-dropdown")(3,"button",19),e.wR5(4,"clr-icon",20),e.C$Y(),e.I0R(5,"vdr-dropdown-menu",21),e.yuY(6,wi,5,2,"ng-container",7),e.C$Y()()()),2&r){const t=e.GaO();e.yG2(),e.E7m("ngIf",t.payment.nextStates.includes("Settled")),e.yG2(5),e.E7m("ngForOf",t.nextOtherStates())}}class ke{constructor(){this.settlePayment=new e._w7,this.transitionPaymentState=new e._w7,this.settleRefund=new e._w7}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}static#e=this.\u0275fac=function(t){return new(t||ke)};static#t=this.\u0275cmp=e.In1({type:ke,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],[1,"refund-wrapper","card-block"],[1,"card-header","payment-header","refund-header"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"div",1)(2,"div"),e.OEk(3),e.wVc(4,"translate"),e.yuY(5,Ci,3,4,"ng-container",2),e.C$Y(),e.I0R(6,"div",3),e.wR5(7,"vdr-payment-state-label",4),e.C$Y()(),e.I0R(8,"div",5),e.wR5(9,"vdr-payment-detail",6),e.C$Y(),e.yuY(10,Ii,21,23,"ng-container",7)(11,Ti,7,2,"div",8),e.C$Y()),2&t&&(e.yG2(3),e.oRS(" ",e.kDX(4,7,"order.payment")," "),e.yG2(2),e.E7m("ngIf",o.payment.amount),e.yG2(2),e.E7m("state",o.payment.state),e.yG2(2),e.E7m("payment",o.payment)("currencyCode",o.currencyCode),e.yG2(),e.E7m("ngForOf",o.payment.refunds),e.yG2(),e.E7m("ngIf",o.payment.nextStates.length))},dependencies:[_.o3d,m.ay,m.u_,_t.CM,J.i,W.m,U.q,ue.Q,h.a,ce.W,Ee,Re,re,p.sD,$.Q,A.m,g.u],styles:["[_nghost-%COMP%]{display:block}.payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon[_ngcontent-%COMP%]{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}"],changeDetection:0})}var Ct=s(2212),Si=s(6112);const Di=["portal"];class we{constructor(n){this.historyEntryComponentService=n,this.expandClick=new e._w7}ngOnInit(){const n=this.historyEntryComponentService.getComponent(this.entry.type),t=this.portalRef.createComponent(n);t.instance.entry=this.entry,t.instance.order=this.order,this.instance=t.instance,this.componentRef=t}ngOnDestroy(){this.componentRef?.destroy()}static#e=this.\u0275fac=function(t){return new(t||we)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:we,selectors:[["vdr-order-history-entry-host"]],viewQuery:function(t,o){if(1&t&&e.CC$(Di,7,e.y8U),2&t){let i;e.wto(i=e.Gqi())&&(o.portalRef=i.first)}},inputs:{entry:"entry",order:"order",expanded:"expanded"},outputs:{expandClick:"expandClick"},exportAs:["historyEntry"],decls:3,vars:6,consts:[[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],["portal",""]],template:function(t,o){1&t&&(e.I0R(0,"vdr-timeline-entry",0),e.qCj("expandClick",function(){return o.expandClick.emit()}),e.wR5(1,"div",null,1),e.C$Y()),2&t&&e.E7m("displayType",o.instance.getDisplayType(o.entry))("iconShape",o.instance.getIconShape&&o.instance.getIconShape(o.entry))("createdAt",o.entry.createdAt)("name",o.instance.getName&&o.instance.getName(o.entry))("featured",o.instance.isFeatured(o.entry))("collapsed",!o.expanded&&!o.instance.isFeatured(o.entry))},dependencies:[Ct.Y],encapsulation:2})}var ht=s(3040);function xi(r,n){1&r&&(e.I0R(0,"span",12),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-only-visible-to-administrators")," "))}function Fi(r,n){1&r&&(e.I0R(0,"span",13),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.note-visible-to-customer")," "))}function $i(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-history-entry-host",16),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("order",o.order)("entry",t)("expanded",o.expanded)}}function Yi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-fulfilled")," "))}function Mi(r,n){1&r&&(e.I0R(0,"div",11),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.history-order-cancelled")," "))}const Ot=(r,n)=>({from:r,to:n});function Pi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-order-transition",e.IBC(4,Ot,t.data.from,t.data.to))," ")}}function Ai(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Yi,3,3,"div",21)(2,Mi,3,3,"div",21)(3,Pi,2,7,"ng-template",22),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"===t.data.to),e.yG2(),e.E7m("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function Vi(r,n){1&r&&(e.I0R(0,"vdr-chip",28),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-settled")))}function Ni(r,n){1&r&&(e.I0R(0,"vdr-chip",29),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.modification-not-settled")))}function Li(r,n){if(1&r&&(e.I0R(0,"div",24),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"strong"),e.OEk(4),e.wVc(5,"localeCurrency"),e.C$Y(),e.yuY(6,Vi,3,3,"vdr-chip",25)(7,Ni,3,3,"vdr-chip",26),e.I0R(8,"vdr-history-entry-detail"),e.wR5(9,"vdr-modification-detail",27),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.oRS(" ",e.kDX(2,6,"order.modify-order-price-difference"),": "),e.yG2(3),e.cNF(e.g7$(5,8,t.priceChange,o.order.currencyCode)),e.yG2(2),e.E7m("ngIf",t.isSettled),e.yG2(),e.E7m("ngIf",!t.isSettled),e.yG2(2),e.E7m("order",o.order)("modification",t)}}function Xi(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Li,10,11,"div",23),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,2,"order.history-order-modified")," "),e.yG2(2),e.E7m("ngIf",o.getModification(t.data.modificationId))}}function ji(r,n){if(1&r&&(e.I0R(0,"vdr-chip",34),e.OEk(1),e.wVc(2,"localeCurrency"),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.cNF(e.g7$(2,1,t.amount,o.order.currencyCode))}}function Qi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-payment-detail",35),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(5);e.yG2(),e.E7m("payment",t)("currencyCode",o.order.currencyCode)}}function Ki(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24),e.yuY(5,ji,3,4,"vdr-chip",32)(6,Qi,2,2,"vdr-history-entry-detail",33),e.C$Y(),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-payment-settled")," "),e.yG2(3),e.E7m("ngIf",o.getPayment(t)),e.yG2(),e.E7m("ngIf",o.getPayment(t))}}const vt=(r,n,t)=>({from:r,to:n,id:t});function qi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.oRS(" ",e.g7$(1,1,"order.history-payment-transition",e.uAc(4,vt,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function Hi(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ki,7,5,"ng-container",30)(2,qi,2,8,"ng-template",null,31,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function Bi(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",24)(5,"vdr-chip",37),e.OEk(6),e.wVc(7,"localeCurrency"),e.C$Y(),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.wR5(14,"vdr-simple-item-list",39),e.C$Y()()(),e.k70()),2&r){const t=n.ngIf,o=e.GaO(4).$implicit,i=e.GaO();e.yG2(2),e.CAO("",e.kDX(3,7,"order.refund")," #",t.id,""),e.yG2(4),e.cNF(e.g7$(7,9,t.total,i.order.currencyCode)),e.yG2(3),e.E7m("label",e.kDX(10,12,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(13,14,"order.contents")),e.yG2(2),e.E7m("items",i.getCancelledItems(t.lines))}}function Ji(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Bi,15,16,"ng-container",33),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf",o.getRefund(t))}}function Wi(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r){const t=e.GaO(3).$implicit;e.oRS(" ",e.g7$(1,1,"order.history-refund-transition",e.uAc(4,vt,t.data.from,t.data.to,t.data.refundId))," ")}}function Ui(r,n){if(1&r&&(e.SAx(0),e.yuY(1,Ji,2,1,"ng-container",30)(2,Wi,2,8,"ng-template",null,36,e.gJz),e.k70()),2&r){const t=e.Gew(3),o=e.GaO(2).$implicit;e.yG2(),e.E7m("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function zi(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",38),e.wVc(2,"translate"),e.OEk(3),e.C$Y(),e.I0R(4,"vdr-labeled-data",38),e.wVc(5,"translate"),e.wR5(6,"vdr-simple-item-list",39),e.C$Y(),e.I0R(7,"vdr-labeled-data",38),e.wVc(8,"translate"),e.OEk(9),e.C$Y()()),2&r){const t=n.ngIf,o=e.GaO(3).$implicit;e.yG2(),e.E7m("label",e.kDX(2,6,"order.cancellation-reason")),e.yG2(2),e.oRS(" ",o.data.reason," "),e.yG2(),e.E7m("label",e.kDX(5,8,"order.contents")),e.yG2(2),e.E7m("items",t),e.yG2(),e.E7m("label",e.kDX(8,10,"order.shipping-cancelled")),e.yG2(2),e.oRS(" ",o.data.shippingCancelled," ")}}const Zi=r=>({count:r});function ea(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,zi,10,12,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.g7$(2,2,"order.history-items-cancelled",e.S45(5,Zi,o.getCancelledQuantity(t)))," "),e.yG2(2),e.E7m("ngIf",o.getCancelledItems(t.data.lines))}}function ta(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function na(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.yuY(3,ta,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-fulfillment-created")," "),e.yG2(2),e.E7m("ngIf",o.getFulfillment(t))}}function ra(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-delivered")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function oa(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.OEk(4),e.wVc(5,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit,o=e.GaO();let i;e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.history-fulfillment-shipped")," "),e.yG2(2),e.CAO(" ",e.kDX(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function ia(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.oRS(" ",e.g7$(2,1,"order.history-fulfillment-transition",e.IBC(4,Ot,t.data.from,t.data.to))," ")}}function aa(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-fulfillment-detail",40),e.C$Y()),2&r){const t=n.ngIf,o=e.GaO(4);e.yG2(),e.E7m("fulfillmentId",t.id)("order",o.order)}}function la(r,n){if(1&r&&(e.SAx(0),e.yuY(1,ra,6,7,"ng-container",33)(2,oa,6,7,"ng-container",33)(3,ia,3,7,"ng-container",33)(4,aa,2,2,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit,o=e.GaO();e.yG2(),e.E7m("ngIf","Delivered"===t.data.to),e.yG2(),e.E7m("ngIf","Shipped"===t.data.to),e.yG2(),e.E7m("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.yG2(),e.E7m("ngIf",o.getFulfillment(t))}}function da(r,n){1&r&&(e.I0R(0,"span",53),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.public")))}function sa(r,n){1&r&&(e.I0R(0,"span",54),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"common.private")))}function ca(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"div",41)(2,"div",42),e.yuY(3,da,3,3,"span",43)(4,sa,3,3,"span",44),e.OEk(5),e.C$Y(),e.wR5(6,"div",45),e.I0R(7,"vdr-dropdown")(8,"button",46),e.wR5(9,"clr-icon",47),e.C$Y(),e.I0R(10,"vdr-dropdown-menu",48)(11,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.updateNote.emit(i))}),e.wVc(12,"hasPermission"),e.wR5(13,"clr-icon",50),e.OEk(14),e.wVc(15,"translate"),e.C$Y(),e.wR5(16,"div",51),e.I0R(17,"button",49),e.qCj("click",function(){e.usT(t);const i=e.GaO(2).$implicit,a=e.GaO();return e.CGJ(a.deleteNote.emit(i))}),e.wVc(18,"hasPermission"),e.wR5(19,"clr-icon",52),e.OEk(20),e.wVc(21,"translate"),e.C$Y()()()(),e.k70()}if(2&r){const t=e.GaO(2).$implicit;e.yG2(3),e.E7m("ngIf",t.isPublic),e.yG2(),e.E7m("ngIf",!t.isPublic),e.yG2(),e.oRS(" ",t.data.note," "),e.yG2(6),e.E7m("disabled",!e.kDX(12,7,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(15,9,"common.edit")," "),e.yG2(3),e.E7m("disabled",!e.kDX(18,11,"UpdateOrder")),e.yG2(3),e.oRS(" ",e.kDX(21,13,"common.delete")," ")}}const ma=r=>["/marketing","promotions",r];function ua(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"a",55),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,3,"order.history-coupon-code-applied"),": "),e.yG2(3),e.E7m("routerLink",e.S45(5,ma,t.data.promotionId)),e.yG2(),e.cNF(t.data.couponCode)}}function _a(r,n){if(1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.I0R(3,"vdr-chip")(4,"span",56),e.OEk(5),e.C$Y()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(),e.oRS(" ",e.kDX(2,2,"order.history-coupon-code-removed"),": "),e.yG2(4),e.cNF(t.data.couponCode)}}const bt=r=>["/customer","customers",r];function pa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,bt,t.data.previousCustomerId)),e.yG2(3),e.cNF(t.data.previousCustomerName)}}function fa(r,n){if(1&r&&(e.I0R(0,"a",58),e.wR5(1,"clr-icon",59),e.I0R(2,"span"),e.OEk(3),e.C$Y(),e.wR5(4,"clr-icon",60),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.E7m("routerLink",e.S45(2,bt,t.data.newCustomerId)),e.yG2(3),e.cNF(t.data.newCustomerName)}}const ga=r=>({newCustomerName:r});function ya(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.I0R(4,"div",41)(5,"div",42),e.OEk(6),e.C$Y(),e.wR5(7,"div",45),e.I0R(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.wVc(10,"translate"),e.yuY(11,pa,5,4,"a",57),e.C$Y(),e.I0R(12,"vdr-labeled-data",38),e.wVc(13,"translate"),e.yuY(14,fa,5,4,"a",57),e.C$Y()()(),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,6,"order.history-customer-updated",e.S45(13,ga,t.data.newCustomerName))," "),e.yG2(4),e.oRS(" ",t.data.note," "),e.yG2(3),e.E7m("label",e.kDX(10,9,"order.previous-customer")),e.yG2(2),e.E7m("ngIf",t.data.previousCustomerId),e.yG2(),e.E7m("label",e.kDX(13,11,"order.new-customer")),e.yG2(2),e.E7m("ngIf",t.data.newCustomerId)}}function Ca(r,n){if(1&r&&(e.I0R(0,"vdr-history-entry-detail"),e.wR5(1,"vdr-object-tree",61),e.C$Y()),2&r){const t=e.GaO(3).$implicit;e.yG2(),e.E7m("value",t.data)}}function ha(r,n){if(1&r&&(e.SAx(0),e.I0R(1,"div",11),e.OEk(2),e.wVc(3,"translate"),e.C$Y(),e.yuY(4,Ca,2,1,"vdr-history-entry-detail",33),e.k70()),2&r){const t=e.GaO(2).$implicit;e.yG2(2),e.oRS(" ",e.kDX(3,2,t.type)," "),e.yG2(2),e.E7m("ngIf",t.data)}}function Oa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-timeline-entry",17),e.qCj("expandClick",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.expanded=!i.expanded)}),e.SAx(1,18),e.yuY(2,Ai,4,3,"ng-container",19)(3,Xi,5,4,"ng-container",19)(4,Hi,4,2,"ng-container",19)(5,Ui,4,2,"ng-container",19)(6,ea,4,7,"ng-container",19)(7,na,4,4,"ng-container",19)(8,la,5,4,"ng-container",19)(9,ca,22,15,"ng-container",19)(10,ua,6,7,"ng-container",19)(11,_a,6,4,"ng-container",19)(12,ya,15,15,"ng-container",19)(13,ha,5,4,"ng-container",20),e.k70(),e.C$Y()}if(2&r){const t=e.GaO().$implicit,o=e.GaO();e.E7m("displayType",o.getDisplayType(t))("iconShape",o.getTimelineIcon(t))("createdAt",t.createdAt)("name",o.getName(t))("featured",o.isFeatured(t))("collapsed",!o.expanded&&!o.isFeatured(t)),e.yG2(),e.E7m("ngSwitch",t.type),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_MODIFIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CANCELLATION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_NOTE),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_COUPON_REMOVED),e.yG2(),e.E7m("ngSwitchCase",o.type.ORDER_CUSTOMER_UPDATED)}}function va(r,n){if(1&r&&(e.SAx(0),e.yuY(1,$i,1,3,"vdr-order-history-entry-host",14)(2,Oa,14,18,"ng-template",null,15,e.gJz),e.k70()),2&r){const t=n.$implicit,o=e.Gew(3),i=e.GaO();e.yG2(),e.E7m("ngIf",i.hasCustomComponent(t.type))("ngIfElse",o)}}class Te{constructor(n){this.historyEntryComponentService=n,this.addNote=new e._w7,this.updateNote=new e._w7,this.deleteNote=new e._w7,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=d.YjR}hasCustomComponent(n){return!!this.historyEntryComponentService.getComponent(n)}getDisplayType(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type!==d.YjR.ORDER_PAYMENT_TRANSITION||"Declined"!==n.data.to&&"Cancelled"!==n.data.to?n.type===d.YjR.ORDER_CANCELLATION||n.type===d.YjR.ORDER_REFUND_TRANSITION?"warning":"default":"error"}getTimelineIcon(n){if(n.type===d.YjR.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to||n.type===d.YjR.ORDER_REFUND_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===d.YjR.ORDER_NOTE?"note":n.type===d.YjR.ORDER_MODIFIED?"pencil":n.type===d.YjR.ORDER_CUSTOMER_UPDATED?"switch":n.type!==d.YjR.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case d.YjR.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case d.YjR.ORDER_REFUND_TRANSITION:return"Settled"===n.data.to;case d.YjR.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case d.YjR.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case d.YjR.ORDER_NOTE:case d.YjR.ORDER_MODIFIED:case d.YjR.ORDER_CUSTOMER_UPDATED:return!0;default:return!1}}getFulfillment(n){if((n.type===d.YjR.ORDER_FULFILLMENT||n.type===d.YjR.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===d.YjR.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getRefund(n){if(n.type===d.YjR.ORDER_REFUND_TRANSITION&&this.order.payments)return this.order.payments.reduce((o,i)=>o.concat(i.refunds),[]).find(o=>o.id===n.data.refundId)}getCancelledQuantity(n){return n.data.lines.reduce((t,o)=>t+o.quantity,0)}getCancelledItems(n){const t=new Map;for(const o of this.order.lines){const i=n.find(a=>a.orderLineId===o.id);if(i){t.get(o.productVariant.name);t.set(o.productVariant.name,i.quantity)}}return Array.from(t.entries()).map(([o,i])=>({name:o,quantity:i}))}getModification(n){return this.order.modifications.find(t=>t.id===n)}getName(n){const{administrator:t}=n;if(t)return`${t.firstName} ${t.lastName}`;{const o=this.order.customer;if(o)return`${o.firstName} ${o.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}static#e=this.\u0275fac=function(t){return new(t||Te)(e.GI1(d.gDp))};static#t=this.\u0275cmp=e.In1({type:Te,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:20,vars:22,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured","isFirst"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"order","entry","expanded","expandClick",4,"ngIf","ngIfElse"],["defaultComponents",""],[3,"order","entry","expanded","expandClick"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["class","title",4,"ngIf"],[3,"ngIf"],["class","flex items-center",4,"ngIf"],[1,"flex","items-center"],["colorType","success","class","mx-1",4,"ngIf"],["colorType","error","class","mx-1",4,"ngIf"],[3,"order","modification"],["colorType","success",1,"mx-1"],["colorType","error",1,"mx-1"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],["class","mr-1",4,"ngIf"],[4,"ngIf"],[1,"mr-1"],[3,"payment","currencyCode"],["regularRefundTransition",""],["colorType","warning",1,"mr-1"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"button-small","ml-1"],["shape","ellipsis-vertical","size","12"],["vdrPosition","bottom-right"],["vdrDropdownItem","",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"],["class","button-ghost",3,"routerLink",4,"ngIf"],[1,"button-ghost",3,"routerLink"],["shape","user",1,"is-solid"],["shape","arrow right"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"div",0)(1,"vdr-timeline-entry",1)(2,"div",2)(3,"textarea",3),e.iHE("ngModelChange",function(a){return e.kNx(o.note,a)||(o.note=a),a}),e.C$Y(),e.I0R(4,"button",4),e.qCj("click",function(){return o.addNoteToOrder()}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()(),e.I0R(7,"div",5)(8,"clr-checkbox-wrapper")(9,"input",6),e.iHE("ngModelChange",function(a){return e.kNx(o.noteIsPrivate,a)||(o.noteIsPrivate=a),a}),e.C$Y(),e.I0R(10,"label"),e.OEk(11),e.wVc(12,"translate"),e.C$Y()(),e.yuY(13,xi,3,3,"span",7)(14,Fi,3,3,"span",8),e.C$Y()(),e.yuY(15,va,4,2,"ng-container",9),e.I0R(16,"vdr-timeline-entry",10)(17,"div",11),e.OEk(18),e.wVc(19,"translate"),e.C$Y()()()),2&t&&(e.eAK("expanded",o.expanded),e.yG2(),e.E7m("featured",!0)("isFirst",!0),e.yG2(2),e.OKB("ngModel",o.note),e.yG2(),e.E7m("disabled",!o.note),e.yG2(),e.oRS(" ",e.kDX(6,16,"common.add-note")," "),e.yG2(4),e.OKB("ngModel",o.noteIsPrivate),e.yG2(2),e.cNF(e.kDX(12,18,"order.note-is-private")),e.yG2(2),e.E7m("ngIf",o.noteIsPrivate),e.yG2(),e.E7m("ngIf",!o.noteIsPrivate),e.yG2(),e.E7m("ngForOf",o.history),e.yG2(),e.E7m("isLast",!0)("createdAt",o.order.createdAt)("featured",!0),e.yG2(2),e.oRS(" ",e.kDX(19,20,"order.history-order-created")," "))},dependencies:[_.o3d,_.ojz,_.y6l,_.eiS,m.ay,m.u_,m.Ko,m.Wm,m.UZ,l.ot,l.SU,l.ue,l._G,k.ER,D.g,y.w,J.i,W.m,U.q,ue.Q,h.a,ce.W,Ct.Y,Si.E,ee,re,X,he,we,p.sD,ht.G,g.u],styles:["[_nghost-%COMP%]{display:block}.entry-list[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-700)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-700)}"],changeDetection:0})}var ba=s(4392);const It=M.Ip`
|
|
28
|
-
query GetSellerOrders($orderId: ID!) {
|
|
29
|
-
order(id: $orderId) {
|
|
30
|
-
id
|
|
31
|
-
sellerOrders {
|
|
32
|
-
id
|
|
33
|
-
code
|
|
34
|
-
state
|
|
35
|
-
orderPlacedAt
|
|
36
|
-
currencyCode
|
|
37
|
-
totalWithTax
|
|
38
|
-
channels {
|
|
39
|
-
id
|
|
40
|
-
code
|
|
41
|
-
seller {
|
|
42
|
-
id
|
|
43
|
-
name
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`;function Ia(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=n.ngIf;e.E7m("label",e.kDX(1,2,"common.seller")),e.yG2(2),e.oRS(" ",t.name," ")}}function Ga(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",5),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y()),2&r){const t=e.GaO().$implicit;e.E7m("label",e.kDX(1,2,"order.total")),e.yG2(2),e.oRS(" ",e.g7$(3,4,t.totalWithTax,t.currencyCode)," ")}}const Ea=r=>["seller-orders",r];function Ra(r,n){if(1&r&&(e.I0R(0,"div")(1,"a",3),e.OEk(2),e.wR5(3,"clr-icon",4),e.C$Y(),e.I0R(4,"vdr-labeled-data",5),e.wVc(5,"translate"),e.wR5(6,"vdr-order-state-label",6),e.C$Y(),e.yuY(7,Ia,3,4,"vdr-labeled-data",7)(8,Ga,4,7,"vdr-labeled-data",7),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO();e.yG2(),e.E7m("routerLink",e.S45(8,Ea,t.id)),e.yG2(),e.oRS("",t.code," "),e.yG2(2),e.E7m("label",e.kDX(5,6,"order.state")),e.yG2(2),e.E7m("state",t.state),e.yG2(),e.E7m("ngIf",o.getSeller(t)),e.yG2(),e.E7m("ngIf",o.getSeller(t))}}class Se{constructor(n,t,o){this.router=n,this.dataService=t,this.channelService=o}ngOnInit(){this.sellerOrders$=this.dataService.query(It,{orderId:this.orderId}).mapSingle(({order:n})=>n?.sellerOrders??[])}getSeller(n){return n.channels.find(o=>o.code!==ba.G8)?.seller}navigateToSellerOrder(n){this.router.navigate(["/orders",n.id])}static#e=this.\u0275fac=function(t){return new(t||Se)(e.GI1(k.E5),e.GI1(d.Aj0),e.GI1(d.mMI))};static#t=this.\u0275cmp=e.In1({type:Se,selectors:[["vdr-seller-orders-card"]],inputs:{orderId:"orderId"},decls:5,vars:6,consts:[[3,"title"],[1,"form-grid"],[4,"ngFor","ngForOf"],[1,"button-ghost","mb-1",3,"routerLink"],["shape","arrow right"],[3,"label"],[3,"state"],[3,"label",4,"ngIf"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-card",0),e.wVc(1,"translate"),e.I0R(2,"div",1),e.yuY(3,Ra,9,10,"div",2),e.wVc(4,"async"),e.C$Y()()),2&t&&(e.E7m("title",e.kDX(1,2,"order.seller-orders")),e.yG2(3),e.E7m("ngForOf",e.kDX(4,4,o.sellerOrders$)))},dependencies:[_.o3d,m.ay,m.u_,k.ER,Ye.a,h.a,I.u,m.a,p.sD,g.u],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}function ka(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.addManualPayment(i))}),e.OEk(1),e.wVc(2,"translate"),e.wVc(3,"localeCurrency"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.yG2(),e.CAO(" ",e.kDX(2,2,"order.add-payment-to-order")," (",e.g7$(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function wa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",9),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToState("ArrangingAdditionalPayment"))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.arrange-additional-payment")," "))}function Ta(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",10),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.fulfillOrder())}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO().ngIf,o=e.GaO();e.E7m("disabled",!o.canAddFulfillment(t)),e.yG2(),e.oRS(" ",e.kDX(2,2,"order.fulfill-order")," ")}}function Sa(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.transitionToModifying())}),e.wR5(2,"clr-icon",11),e.OEk(3),e.wVc(4,"translate"),e.C$Y(),e.wR5(5,"div",6),e.k70()}2&r&&(e.yG2(3),e.oRS(" ",e.kDX(4,1,"order.modify-order")," "))}function Da(r,n){1&r&&(e.SAx(0),e.OEk(1),e.wVc(2,"translate"),e.k70()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.refund-and-cancel-order")," "))}function xa(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.oRS(" ",e.kDX(1,1,"order.cancel-order")," ")}function Fa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){e.usT(t);const i=e.GaO().ngIf,a=e.GaO();return e.CGJ(a.cancelOrRefund(i))}),e.wR5(1,"clr-icon",12),e.yuY(2,Da,3,3,"ng-container",13)(3,xa,2,3,"ng-template",null,14,e.gJz),e.C$Y()}if(2&r){const t=e.Gew(4),o=e.GaO().ngIf,i=e.GaO();e.yG2(2),e.E7m("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}const $a=r=>({state:r});function Ya(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",7),e.qCj("click",function(){const a=e.usT(t).$implicit,c=e.GaO(3);return e.CGJ(c.transitionToState(a))}),e.wR5(1,"clr-icon",16),e.OEk(2),e.wVc(3,"translate"),e.wVc(4,"translate"),e.wVc(5,"stateI18nToken"),e.C$Y()}if(2&r){const t=n.$implicit;e.yG2(2),e.oRS(" ",e.g7$(3,1,"order.transition-to-state",e.S45(8,$a,e.kDX(4,4,e.kDX(5,6,t))))," ")}}function Ma(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"div",6),e.yuY(2,Ya,6,10,"button",15),e.wVc(3,"async"),e.k70()),2&r){const t=e.GaO(2);e.yG2(2),e.E7m("ngForOf",e.kDX(3,1,t.nextStates$))}}function Pa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar"),e.wR5(1,"vdr-ab-left"),e.I0R(2,"vdr-ab-right"),e.wR5(3,"vdr-action-bar-items",1),e.yuY(4,ka,4,7,"button",2)(5,wa,3,3,"button",2)(6,Ta,3,4,"button",3),e.I0R(7,"vdr-action-bar-dropdown-menu",4),e.yuY(8,Sa,6,3,"ng-container",0)(9,Fa,5,2,"button",5)(10,Ma,4,3,"ng-container",0),e.wVc(11,"async"),e.wR5(12,"div",6),e.I0R(13,"button",7),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.manuallyTransitionToState(a))}),e.wR5(14,"clr-icon",8),e.OEk(15),e.wVc(16,"translate"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();let i;e.yG2(4),e.E7m("ngIf","Aggregate"!==t.type&&("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&"ArrangingPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type),e.yG2(),e.E7m("alwaysShow",!0),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Modifying")),e.yG2(),e.E7m("ngIf","Aggregate"!==t.type&&t.nextStates.includes("Cancelled")),e.yG2(),e.E7m("ngIf",null==(i=e.kDX(11,8,o.nextStates$))?null:i.length),e.yG2(5),e.oRS(" ",e.kDX(16,10,"order.manually-transition-to-state")," ")}}function Aa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.openStateDiagram())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",34),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.order-state-diagram"))}function Va(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",33),e.qCj("click",function(){e.usT(t);const i=e.GaO(3);return e.CGJ(i.setOrderCustomer())}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",36),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.assign-order-to-another-customer"))}const Na=()=>["UpdateOrder","ReadCustomer"];function La(r,n){1&r&&e.yuY(0,Va,3,3,"button",35),2&r&&e.E7m("vdrIfPermissions",e.q4q(1,Na))}function Xa(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",37),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.shipping-address")),e.yG2(2),e.E7m("address",t.shippingAddress)}}function ja(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",39),e.wVc(1,"translate"),e.wR5(2,"vdr-formatted-address",38),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.billing-address")),e.yG2(2),e.E7m("address",t.billingAddress)}}function Qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-order-payment-card",41),e.qCj("settlePayment",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settlePayment(i))})("transitionPaymentState",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.transitionPaymentState(i))})("settleRefund",function(i){e.usT(t);const a=e.GaO(3);return e.CGJ(a.settleRefund(i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("currencyCode",o.currencyCode)("payment",t)}}function Ka(r,n){if(1&r&&(e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.yuY(2,Qa,1,2,"vdr-order-payment-card",40),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("title",e.kDX(1,2,"order.payments")),e.yG2(2),e.E7m("ngForOf",t.payments)}}function qa(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-fulfillment-card",43),e.qCj("transitionState",function(i){const c=e.usT(t).$implicit,G=e.GaO(3);return e.CGJ(G.transitionFulfillment(c.id,i))}),e.C$Y()}if(2&r){const t=n.$implicit,o=e.GaO(2).ngIf;e.E7m("fulfillment",t)("order",o)}}function Ha(r,n){if(1&r&&(e.I0R(0,"vdr-card"),e.yuY(1,qa,1,2,"vdr-fulfillment-card",42),e.C$Y()),2&r){const t=e.GaO().ngIf;e.yG2(),e.E7m("ngForOf",t.fulfillments)}}function Ba(r,n){if(1&r&&e.wR5(0,"vdr-page-entity-info",44),2&r){const t=n.ngIf;e.E7m("entity",t)}}function Ja(r,n){if(1&r&&e.wR5(0,"vdr-seller-orders-card",45),2&r){const t=e.GaO().ngIf;e.E7m("orderId",t.id)}}function Wa(r,n){if(1&r&&(e.I0R(0,"tr")(1,"td"),e.OEk(2),e.C$Y(),e.I0R(3,"td"),e.OEk(4),e.wVc(5,"percent"),e.C$Y(),e.I0R(6,"td"),e.OEk(7),e.wVc(8,"localeCurrency"),e.C$Y(),e.I0R(9,"td"),e.OEk(10),e.wVc(11,"localeCurrency"),e.C$Y()()),2&r){const t=n.$implicit,o=e.GaO().ngIf;e.yG2(2),e.cNF(t.description),e.yG2(2),e.cNF(e.g7$(5,4,t.taxRate/100,"0.0-3")),e.yG2(3),e.cNF(e.g7$(8,7,t.taxBase,o.currencyCode)),e.yG2(3),e.cNF(e.g7$(11,10,t.taxTotal,o.currencyCode))}}function Ua(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-card",17),e.wVc(1,"translate"),e.wR5(2,"vdr-tabbed-custom-fields",46),e.wVc(3,"hasPermission"),e.I0R(4,"button",47),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.updateCustomFields())}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()()}if(2&r){const t=e.GaO(2);let o;e.E7m("title",e.kDX(1,6,"common.custom-fields")),e.yG2(2),e.E7m("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get("customFields"))("readonly",!e.kDX(3,8,"UpdateOrder")),e.yG2(2),e.E7m("disabled",(null==(o=t.detailForm.get("customFields"))?null:o.pristine)||(null==(o=t.detailForm.get("customFields"))?null:o.invalid)),e.yG2(),e.oRS(" ",e.kDX(6,10,"common.update")," ")}}function za(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",17),e.wVc(3,"translate"),e.yuY(4,Aa,3,3,"ng-template",18),e.wR5(5,"vdr-order-state-label",19),e.C$Y(),e.I0R(6,"vdr-card",17),e.wVc(7,"translate"),e.yuY(8,La,1,2,"ng-template",18),e.wR5(9,"vdr-customer-label",20),e.yuY(10,Xa,3,4,"vdr-labeled-data",21)(11,ja,3,4,"vdr-labeled-data",22),e.C$Y(),e.yuY(12,Ka,3,4,"vdr-card",23)(13,Ha,2,1,"vdr-card",0),e.I0R(14,"vdr-card"),e.yuY(15,Ba,1,1,"vdr-page-entity-info",24),e.wVc(16,"async"),e.C$Y()(),e.I0R(17,"vdr-page-block"),e.yuY(18,Ja,1,1,"vdr-seller-orders-card",25),e.I0R(19,"vdr-card",26),e.wR5(20,"vdr-order-table",27),e.C$Y(),e.I0R(21,"vdr-card",28),e.wVc(22,"translate"),e.I0R(23,"table",29)(24,"thead")(25,"tr")(26,"th"),e.OEk(27),e.wVc(28,"translate"),e.C$Y(),e.I0R(29,"th"),e.OEk(30),e.wVc(31,"translate"),e.C$Y(),e.I0R(32,"th"),e.OEk(33),e.wVc(34,"translate"),e.C$Y(),e.I0R(35,"th"),e.OEk(36),e.wVc(37,"translate"),e.C$Y()()(),e.I0R(38,"tbody"),e.yuY(39,Wa,12,13,"tr",30),e.C$Y()()(),e.yuY(40,Ua,7,12,"vdr-card",23),e.wR5(41,"vdr-custom-detail-component-host",31),e.I0R(42,"vdr-card",17),e.wVc(43,"translate"),e.I0R(44,"vdr-order-history",32),e.qCj("addNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addNote(i))})("updateNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.updateNote(i))})("deleteNote",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.deleteNote(i))}),e.wVc(45,"async"),e.C$Y()()()()}if(2&r){const t=n.ngIf,o=e.GaO();e.yG2(2),e.E7m("title",e.kDX(3,26,"order.state")),e.yG2(3),e.E7m("state",t.state),e.yG2(),e.E7m("title",e.kDX(7,28,"order.customer")),e.yG2(3),e.E7m("customer",t.customer),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.yG2(),e.E7m("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.yG2(),e.E7m("ngIf",null==t.payments?null:t.payments.length),e.yG2(),e.E7m("ngIf",null==t.fulfillments?null:t.fulfillments.length),e.yG2(2),e.E7m("ngIf",e.kDX(16,30,o.entity$)),e.yG2(3),e.E7m("ngIf",t.sellerOrders.length),e.yG2(),e.E7m("paddingX",!1),e.yG2(),e.E7m("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.yG2(),e.E7m("title",e.kDX(22,32,"order.tax-summary"))("paddingX",!1),e.yG2(6),e.cNF(e.kDX(28,34,"common.description")),e.yG2(3),e.cNF(e.kDX(31,36,"order.tax-rate")),e.yG2(3),e.cNF(e.kDX(34,38,"order.tax-base")),e.yG2(3),e.cNF(e.kDX(37,40,"order.tax-total")),e.yG2(3),e.E7m("ngForOf",t.taxSummary),e.yG2(),e.E7m("ngIf",o.customFields.length),e.yG2(),e.E7m("entity$",o.entity$)("detailForm",o.detailForm),e.yG2(),e.E7m("title",e.kDX(43,42,"order.order-history")),e.yG2(2),e.E7m("order",t)("history",e.kDX(45,44,o.history$))}}const Za=M.Ip`
|
|
50
|
-
query OrderDetailQuery($id: ID!) {
|
|
51
|
-
order(id: $id) {
|
|
52
|
-
...OrderDetail
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
${d.WG$}
|
|
56
|
-
`,el=M.Ip`
|
|
57
|
-
mutation SetOrderCustomer($input: SetOrderCustomerInput!) {
|
|
58
|
-
setOrderCustomer(input: $input) {
|
|
59
|
-
id
|
|
60
|
-
customer {
|
|
61
|
-
id
|
|
62
|
-
firstName
|
|
63
|
-
lastName
|
|
64
|
-
emailAddress
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
`;class De extends d.uJQ{constructor(n,t,o,i,a,c){super(),this.changeDetector=n,this.dataService=t,this.notificationService=o,this.modalService=i,this.orderTransitionService=a,this.formBuilder=c,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.WC({customFields:this.formBuilder.group((0,d.iQc)(this.customFields))}),this.fetchHistory=new Q.E,this.defaultStates=["AddingItems","ArrangingPayment","PaymentAuthorized","PaymentSettled","PartiallyShipped","Shipped","PartiallyDelivered","Delivered","Cancelled","Modifying","ArrangingAdditionalPayment"]}ngOnInit(){this.init(),this.entity$.pipe((0,x.U)(1)).subscribe(n=>{"Modifying"===n.state&&this.router.navigate(["./","modify"],{relativeTo:this.route})}),this.history$=this.fetchHistory.pipe((0,nt.W)(null),(0,f.G)(()=>this.dataService.order.getOrderHistory(this.id,{sort:{createdAt:d._8$.DESC}}).mapStream(n=>n.order?.history.items))),this.nextStates$=this.entity$.pipe((0,R.k)(n=>this.defaultStates.includes(n.state)?n.nextStates.filter(o=>!this.defaultStates.includes(o)):n.nextStates))}ngOnDestroy(){this.destroy()}openStateDiagram(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(be,{closable:!0,locals:{activeState:n.state}}))).subscribe()}setOrderCustomer(){this.modalService.fromComponent(H,{locals:{canCreateNew:!1,includeNoteInput:!0,title:(0,u.s)("order.assign-order-to-another-customer")}}).pipe((0,f.G)(n=>function t(o){return"object"==typeof o&&!!o.id}(n)?this.dataService.mutate(d.iqv,{input:{customerId:n.id,orderId:this.id,note:n.note}}):F.k),(0,f.G)(n=>this.refetchOrder(n))).subscribe(n=>{n&&this.notificationService.success((0,u.s)("order.set-customer-success"))})}transitionToState(n){this.dataService.order.transitionToState(this.id,n).subscribe(({transitionOrderToState:t})=>{switch(t?.__typename){case"Order":this.notificationService.success((0,u.s)("order.transitioned-to-state-success"),{state:n}),this.fetchHistory.next();break;case"OrderStateTransitionError":this.notificationService.error(t.transitionError)}})}manuallyTransitionToState(n){this.orderTransitionService.manuallyTransitionToState({orderId:n.id,nextStates:n.nextStates,cancellable:!0,message:(0,u.s)("order.manually-transition-to-state-message"),retry:0}).subscribe()}transitionToModifying(){this.dataService.order.transitionToState(this.id,"Modifying").subscribe(({transitionOrderToState:n})=>{switch(n?.__typename){case"Order":this.router.navigate(["./modify"],{relativeTo:this.route});break;case"OrderStateTransitionError":this.notificationService.error(n.transitionError)}})}updateCustomFields(){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:this.detailForm.value.customFields}).subscribe(()=>{this.notificationService.success((0,u.s)("common.notify-update-success"),{entity:"Order"})})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}settlePayment(n){this.dataService.order.settlePayment(n.id).subscribe(({settlePayment:t})=>{switch(t.__typename){case"Payment":"Settled"===t.state?this.notificationService.success((0,u.s)("order.settle-payment-success")):this.notificationService.error((0,u.s)("order.settle-payment-error")),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"OrderStateTransitionError":case"PaymentStateTransitionError":case"SettlePaymentError":this.notificationService.error(t.message)}})}transitionPaymentState({payment:n,state:t}){"Cancelled"===t?this.dataService.order.cancelPayment(n.id).subscribe(({cancelPayment:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,u.s)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.transitionError);break;case"CancelPaymentError":this.notificationService.error(o.paymentErrorMessage)}}):this.dataService.order.transitionPaymentToState(n.id,t).subscribe(({transitionPaymentToState:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,u.s)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.message)}})}canAddFulfillment(n){const t=(n.fulfillments??[]).filter(i=>"Cancelled"!==i.state).reduce((i,a)=>[...i,...a.lines],[]);let o=!0;for(const i of n.lines)t.filter(c=>c.orderLineId===i.id).reduce((c,G)=>c+G.quantity,0)<i.quantity&&(o=!1);return!o&&!this.hasUnsettledModifications(n)&&0===this.outstandingPaymentAmount(n)&&(n.nextStates.includes("Shipped")||n.nextStates.includes("PartiallyShipped")||n.nextStates.includes("Delivered"))}hasUnsettledModifications(n){return 0<n.modifications.filter(t=>!t.isSettled).length}getOutstandingModificationAmount(n){return(0,C.summate)(n.modifications.filter(t=>!t.isSettled),"priceChange")}outstandingPaymentAmount(n){const t=i=>"Cancelled"!==i.state&&"Declined"!==i.state&&"Error"!==i.state;let o=0;for(const i of n.payments?.filter(t)??[]){const a=i.refunds.filter(G=>"Failed"!==G.state)??[],c=(0,C.summate)(a,"total");o+=i.amount-c}return n.totalWithTax-o}addManualPayment(n){const t=n.state;this.modalService.fromComponent(ae,{closable:!0,locals:{outstandingAmount:this.outstandingPaymentAmount(n),currencyCode:n.currencyCode}}).pipe((0,f.G)(o=>o?this.dataService.order.addManualPaymentToOrder({orderId:this.id,transactionId:o.transactionId,method:o.method,metadata:o.metadata||{}}):F.k),(0,f.G)(({addManualPaymentToOrder:o})=>{switch(o.__typename){case"Order":return this.notificationService.success((0,u.s)("order.add-payment-to-order-success")),"ArrangingAdditionalPayment"===t?this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates):(0,O.of)("PaymentSettled");case"ManualPaymentStateError":return this.notificationService.error(o.message),F.k;default:return F.k}})).subscribe(o=>{o&&this.refetchOrder({result:o})})}fulfillOrder(){this.entity$.pipe((0,x.U)(1),(0,f.G)(n=>this.modalService.fromComponent(ge,{size:"xl",locals:{order:n}})),(0,f.G)(n=>n?this.dataService.order.createFulfillment(n):(0,O.of)(void 0)),(0,f.G)(n=>this.refetchOrder(n).pipe((0,gt.e)(n)))).subscribe(n=>{if(n){const{addFulfillmentToOrder:t}=n;switch(t.__typename){case"Fulfillment":this.notificationService.success((0,u.s)("order.create-fulfillment-success"));break;case"EmptyOrderLineSelectionError":case"InsufficientStockOnHandError":case"ItemsAlreadyFulfilledError":case"InvalidFulfillmentHandlerError":this.notificationService.error(t.message);break;case"FulfillmentStateTransitionError":this.notificationService.error(t.transitionError);break;case"CreateFulfillmentError":this.notificationService.error(t.fulfillmentHandlerError);break;case void 0:this.notificationService.error(JSON.stringify(t));break;default:(0,C.assertNever)(t)}}})}transitionFulfillment(n,t){this.dataService.order.transitionFulfillmentToState(n,t).pipe((0,f.G)(o=>this.refetchOrder(o))).subscribe(()=>{this.notificationService.success((0,u.s)("order.successfully-updated-fulfillment"))})}cancelOrRefund(n){const t=this.orderHasSettledPayments(n);"PaymentAuthorized"!==n.state&&!0!==n.active&&t?this.refundOrder(n):this.cancelOrder(n)}settleRefund(n){this.modalService.fromComponent(Ge,{size:"md",locals:{refund:n}}).pipe((0,f.G)(t=>t?this.dataService.order.settleRefund({transactionId:t,id:n.id},this.id):(0,O.of)(void 0))).subscribe(t=>{t&&this.notificationService.success((0,u.s)("order.settle-refund-success"))})}addNote(n){const{note:t,isPublic:o}=n;this.dataService.order.addNoteToOrder({id:this.id,note:t,isPublic:o}).pipe((0,f.G)(i=>this.refetchOrder(i))).subscribe(i=>{this.notificationService.success((0,u.s)("common.notify-create-success"),{entity:"Note"})})}updateNote(n){this.modalService.fromComponent(d.W6x,{closable:!0,locals:{displayPrivacyControls:!0,note:n.data.note,noteIsPrivate:!n.isPublic}}).pipe((0,f.G)(t=>t?this.dataService.order.updateOrderNote({noteId:n.id,isPublic:!t.isPrivate,note:t.note}):F.k)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,u.s)("common.notify-update-success"),{entity:"Note"})})}deleteNote(n){return this.modalService.dialog({title:(0,u.s)("common.confirm-delete-note"),body:n.data.note,buttons:[{type:"secondary",label:(0,u.s)("common.cancel")},{type:"danger",label:(0,u.s)("common.delete"),returnValue:!0}]}).pipe((0,f.G)(t=>t?this.dataService.order.deleteOrderNote(n.id):F.k)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,u.s)("common.notify-delete-success"),{entity:"Note"})})}orderHasSettledPayments(n){return!!n.payments?.find(t=>"Settled"===t.state)}cancelOrder(n){this.modalService.fromComponent(le,{size:"xl",locals:{order:n}}).pipe((0,f.G)(t=>t?this.dataService.order.cancelOrder(t):(0,O.of)(void 0)),(0,f.G)(t=>this.refetchOrder(t))).subscribe(t=>{t&&this.notificationService.success((0,u.s)("order.cancelled-order-success"))})}refundOrder(n){this.modalService.fromComponent(Ie,{size:"xl",locals:{order:n}}).pipe((0,f.G)(t=>t?t.cancel.lines?.length?this.dataService.order.cancelOrder(t.cancel).pipe((0,R.k)(o=>{const i=o.cancelOrder;switch(i.__typename){case"Order":return this.refetchOrder(i).subscribe(),this.notificationService.success((0,u.s)("order.cancelled-order-items-success"),{count:(0,C.summate)(t.cancel.lines,"quantity")}),t;case"CancelActiveOrderError":case"QuantityTooGreatError":case"MultipleOrderError":case"OrderStateTransitionError":case"EmptyOrderLineSelectionError":return void this.notificationService.error(i.message)}})):[t]:(0,O.of)(void 0)),(0,f.G)(t=>t?t.refunds.length?(0,rt.y)(t.refunds.map(o=>this.dataService.order.refundOrder(o).pipe((0,R.k)(i=>i.refundOrder)))):[void 0]:(0,O.of)(void 0))).subscribe(t=>{for(const o of t??[])if(o)switch(o.__typename){case"Refund":"Failed"===o.state?this.notificationService.error((0,u.s)("order.refund-order-failed")):this.notificationService.success((0,u.s)("order.refund-order-success"));break;case"AlreadyRefundedError":case"NothingToRefundError":case"PaymentOrderMismatchError":case"RefundOrderStateError":case"RefundStateTransitionError":this.notificationService.error(o.message)}this.refetchOrder(t?.[0]).subscribe()})}refetchOrder(n){return this.fetchHistory.next(),n?this.dataService.order.getOrder(this.id).single$:(0,O.of)(void 0)}setFormValues(n){this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n)}static#e=this.\u0275fac=function(t){return new(t||De)(e.GI1(e.kD9),e.GI1(d.Aj0),e.GI1(d.gnT),e.GI1(d.Ajm),e.GI1(Y),e.GI1(l.im))};static#t=this.\u0275cmp=e.In1({type:De,selectors:[["vdr-order-detail"]],features:[e.eg9],decls:5,vars:6,consts:[[4,"ngIf"],["locationId","order-detail"],["class","button primary mr-1",3,"click",4,"ngIf"],["class","button primary mr-1",3,"disabled","click",4,"ngIf"],["locationId","order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click",4,"ngIf"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",3,"click"],["shape","step-forward-2",1,"is-warning"],[1,"button","primary","mr-1",3,"click"],[1,"button","primary","mr-1",3,"disabled","click"],["shape","pencil"],["shape","error-standard",1,"is-error"],[4,"ngIf","ngIfElse"],["cancelOnly",""],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["shape","step-forward-2"],[3,"title"],["vdrCardControls",""],[3,"state"],[3,"customer"],["class","mt-2",3,"label",4,"ngIf"],[3,"label",4,"ngIf"],[3,"title",4,"ngIf"],[3,"entity",4,"ngIf"],["class","mb-2",3,"orderId",4,"ngIf"],[3,"paddingX"],[3,"order","orderLineCustomFields"],[3,"title","paddingX"],[1,"table"],[4,"ngFor","ngForOf"],["locationId","order-detail",3,"entity$","detailForm"],[3,"order","history","addNote","updateNote","deleteNote"],[1,"button-small",3,"title","click"],["shape","list"],["class","button-small",3,"title","click",4,"vdrIfPermissions"],["shape","switch"],[1,"mt-2",3,"label"],[1,"mt-1",3,"address"],[3,"label"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund",4,"ngFor","ngForOf"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund"],[3,"fulfillment","order","transitionState",4,"ngFor","ngForOf"],[3,"fulfillment","order","transitionState"],[3,"entity"],[1,"mb-2",3,"orderId"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly"],[1,"button","primary",3,"disabled","click"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block"),e.yuY(1,Pa,17,12,"vdr-action-bar",0),e.wVc(2,"async"),e.C$Y(),e.yuY(3,za,46,46,"vdr-page-detail-layout",0),e.wVc(4,"async")),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,2,o.entity$)),e.yG2(2),e.E7m("ngIf",e.kDX(4,4,o.entity$)))},dependencies:[_.o3d,m.ay,m.u_,b.iK,b.Ix,b.eu,Le.O,Xe.G,ue.Q,Ye.a,se.o,h.a,yt.e,je.o,mt.w,st.K,Me.m,ct.k,Qe.g,Ke.e,I.u,I.M,ke,Te,Ce,L,Se,m.a,m.Bz,p.sD,ht.G,$.Q,g.u],styles:[".shipping-address[_ngcontent-%COMP%]{list-style-type:none;line-height:1.3em}.order-cards[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{margin-top:6px;color:var(--color-text-200)}vdr-order-payment-card[_ngcontent-%COMP%] + vdr-order-payment-card[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 2)}"],changeDetection:0})}var tl=s(8699),Gt=s(6516),nl=s(9176);function rl(r,n){if(1&r&&(e.I0R(0,"div",4),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.oRS(" ",t," ")}}const Ue=r=>({count:r});function ol(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.yuY(2,rl,2,1,"div",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.g7$(1,2,"order.modification-adjusting-lines",e.S45(5,Ue,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))),e.yG2(2),e.E7m("ngForOf",t.adjustedLines)}}function il(r,n){if(1&r&&(e.I0R(0,"div"),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.CAO(" ",t.productVariant.name," x ",t.quantity," ")}}function al(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.yuY(2,il,2,2,"div",5),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.g7$(1,2,"order.modification-adding-items",e.S45(5,Ue,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))),e.yG2(2),e.E7m("ngForOf",t.addedLines)}}function ll(r,n){if(1&r&&(e.I0R(0,"div",4),e.OEk(1),e.wVc(2,"localeCurrency"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(2);e.yG2(),e.CAO(" ",t.description,": ",e.g7$(2,2,t.price,o.orderSnapshot.currencyCode)," ")}}function dl(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.yuY(2,ll,3,5,"div",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.g7$(1,2,"order.modification-adding-surcharges",e.S45(5,Ue,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))),e.yG2(2),e.E7m("ngForOf",t.modifyOrderInput.surcharges)}}function sl(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=n.ngIf;e.E7m("label",e.kDX(1,2,"order.modification-updating-shipping-address")),e.yG2(2),e.oRS(" ",t,"\n")}}function cl(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=n.ngIf;e.E7m("label",e.kDX(1,2,"order.modification-updating-billing-address")),e.yG2(2),e.oRS(" ",t,"\n")}}function ml(r,n){if(1&r&&(e.I0R(0,"div",4),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.cNF(t)}}function ul(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.yuY(2,ml,2,1,"div",3),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.set-coupon-codes")),e.yG2(2),e.E7m("ngForOf",t.couponCodeChanges)}}function _l(r,n){if(1&r&&(e.I0R(0,"div",4),e.OEk(1),e.C$Y()),2&r){const t=n.$implicit;e.yG2(),e.cNF(t)}}function pl(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",2),e.wVc(1,"translate"),e.yuY(2,_l,2,1,"div",3),e.C$Y()),2&r){const t=e.GaO().ngIf;e.E7m("label",e.kDX(1,2,"order.shipping-method")),e.yG2(2),e.E7m("ngForOf",t)}}function fl(r,n){if(1&r&&(e.SAx(0),e.yuY(1,pl,3,4,"vdr-labeled-data",0),e.k70()),2&r){const t=n.ngIf;e.yG2(),e.E7m("ngIf",t.length)}}class oe{get adjustedLines(){return(this.modifyOrderInput.adjustOrderLines||[]).map(n=>{const t=this.orderSnapshot.lines.find(o=>o.id===n.orderLineId);if(t){const o=n.quantity-t.quantity;return o?`${0===o?"":o>0?"+":"-"}${Math.abs(o)} ${t.productVariant.name}`:t.productVariant.name}}).filter(C.notNullOrUndefined)}getModifiedFields(n){return n.dirty?Object.entries(n.controls).map(([t,o])=>{if(o.dirty)return t}).filter(C.notNullOrUndefined).join(", "):""}getUpdatedShippingMethodLines(){return Object.entries(this.updatedShippingMethods||{}).map(([n,t])=>{const o=this.orderSnapshot.shippingLines.find(c=>c.id===n);if(!o)return;return`${o.shippingMethod.name||o.shippingMethod.code} -> ${t.name||t.code}`}).filter(C.notNullOrUndefined)}get couponCodeChanges(){const n=this.orderSnapshot.couponCodes||[],t=this.couponCodesControl.value||[];return[...t.filter(a=>!n.includes(a)).map(a=>`+ ${a}`),...n.filter(a=>!t.includes(a)).map(a=>`- ${a}`)]}static#e=this.\u0275fac=function(t){return new(t||oe)};static#t=this.\u0275cmp=e.In1({type:oe,selectors:[["vdr-order-modification-summary"]],inputs:{orderSnapshot:"orderSnapshot",modifyOrderInput:"modifyOrderInput",addedLines:"addedLines",shippingAddressForm:"shippingAddressForm",billingAddressForm:"billingAddressForm",updatedShippingMethods:"updatedShippingMethods",couponCodesControl:"couponCodesControl"},decls:7,vars:7,consts:[[3,"label",4,"ngIf"],[4,"ngIf"],[3,"label"],["class","mb-1",4,"ngFor","ngForOf"],[1,"mb-1"],[4,"ngFor","ngForOf"]],template:function(t,o){1&t&&e.yuY(0,ol,3,7,"vdr-labeled-data",0)(1,al,3,7,"vdr-labeled-data",0)(2,dl,3,7,"vdr-labeled-data",0)(3,sl,3,4,"vdr-labeled-data",0)(4,cl,3,4,"vdr-labeled-data",0)(5,ul,3,4,"vdr-labeled-data",0)(6,fl,2,1,"ng-container",1),2&t&&(e.E7m("ngIf",null==o.modifyOrderInput.adjustOrderLines?null:o.modifyOrderInput.adjustOrderLines.length),e.yG2(),e.E7m("ngIf",null==o.modifyOrderInput.addItems?null:o.modifyOrderInput.addItems.length),e.yG2(),e.E7m("ngIf",null==o.modifyOrderInput.surcharges?null:o.modifyOrderInput.surcharges.length),e.yG2(),e.E7m("ngIf",o.getModifiedFields(o.shippingAddressForm)),e.yG2(),e.E7m("ngIf",o.getModifiedFields(o.billingAddressForm)),e.yG2(),e.E7m("ngIf",o.couponCodeChanges.length),e.yG2(),e.E7m("ngIf",o.getUpdatedShippingMethodLines()))},dependencies:[m.ay,m.u_,h.a,p.sD,g.u],changeDetection:0})}function gl(r,n){1&r&&(e.OEk(0),e.wVc(1,"translate")),2&r&&e.cNF(e.kDX(1,1,"order.confirm-modifications"))}function yl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-payment-for-refund-selector",10),e.qCj("paymentSelected",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.onPaymentSelected(i.payment,i.selected))}),e.C$Y()}if(2&r){const t=e.GaO();e.E7m("refundablePayments",t.refundablePayments)("order",t.order)}}function Cl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-form-field",7),e.wVc(1,"translate"),e.I0R(2,"textarea",11),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.refundNote,i)||(a.refundNote=i),e.CGJ(i)}),e.C$Y()()}if(2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.refund-cancellation-reason")),e.yG2(2),e.OKB("ngModel",t.refundNote)}}function hl(r,n){1&r&&(e.I0R(0,"clr-alert",18)(1,"clr-alert-item"),e.OEk(2),e.wVc(3,"translate"),e.C$Y()()),2&r&&(e.E7m("clrAlertType","danger")("clrAlertClosable",!1),e.yG2(2),e.oRS(" ",e.kDX(3,3,"order.refund-total-warning")," "))}function Ol(r,n){if(1&r){const t=e.KQA();e.I0R(0,"div")(1,"div",12),e.yuY(2,hl,4,5,"clr-alert",13),e.C$Y(),e.I0R(3,"div",14)(4,"clr-alert",15)(5,"clr-alert-item"),e.OEk(6),e.wVc(7,"translate"),e.wVc(8,"localeCurrency"),e.C$Y()(),e.I0R(9,"button",16),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.cancel())}),e.OEk(10),e.wVc(11,"translate"),e.C$Y(),e.I0R(12,"button",17),e.qCj("click",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.submit())}),e.OEk(13),e.wVc(14,"translate"),e.C$Y()()()}if(2&r){const t=e.GaO();e.yG2(2),e.E7m("ngIf",t.priceDifference<0&&!t.refundsCoverDifference()),e.yG2(2),e.E7m("clrAlertType","primary")("clrAlertClosable",!1),e.yG2(2),e.MjK(" ",e.kDX(7,9,"order.modify-order-price-difference")," ",0<t.priceDifference?"+":"","",e.g7$(8,11,t.priceDifference,t.order.currencyCode)," "),e.yG2(4),e.oRS(" ",e.kDX(11,14,"common.cancel")," "),e.yG2(2),e.E7m("disabled",t.priceDifference<0&&!t.refundsCoverDifference()),e.yG2(),e.oRS(" ",e.kDX(14,16,"common.confirm")," ")}}var w,r;(r=w||(w={}))[r.Refund=0]="Refund",r[r.Payment=1]="Payment",r[r.PriceUnchanged=2]="PriceUnchanged",r[r.Cancel=3]="Cancel";class xe{get priceDifference(){return this.order.totalWithTax-this.orderSnapshot.totalWithTax}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}ngOnInit(){this.refundNote=this.modifyOrderInput.note||"",this.refundablePayments=Ve(this.order.payments||[]),this.refundablePayments.forEach(n=>{n.amountToRefundControl.addValidators(l.AQ.max(-1*this.priceDifference))}),this.priceDifference<0&&this.refundablePayments.length&&this.onPaymentSelected(this.refundablePayments[0],!0)}onPaymentSelected(n,t){if(t){const o=-1*this.priceDifference-this.refundablePayments.filter(i=>i.id!==n.id).reduce((i,a)=>i+a.amountToRefundControl.value,0);0<o&&n.amountToRefundControl.setValue(Math.min(o,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}refundsCoverDifference(){return-1*this.priceDifference===this.amountToRefundTotal}cancel(){this.resolveWith({result:w.Cancel})}submit(){0<this.priceDifference?this.resolveWith({result:w.Payment}):this.priceDifference<0?this.resolveWith({result:w.Refund,refunds:this.refundablePayments.filter(n=>n.selected&&0<n.amountToRefundControl.value).map(n=>({reason:this.refundNote||this.modifyOrderInput.note,paymentId:n.id,amount:n.amountToRefundControl.value}))}):this.resolveWith({result:w.PriceUnchanged})}static#e=this.\u0275fac=function(t){return new(t||xe)};static#t=this.\u0275cmp=e.In1({type:xe,selectors:[["vdr-order-edits-preview-dialog"]],decls:14,vars:18,consts:[["vdrDialogTitle",""],[1,"order-edits-preview-table",3,"order","orderLineCustomFields"],[1,"payments-wrapper","mb-2"],[1,"flex-spacer"],["class","",3,"refundablePayments","order","paymentSelected",4,"ngIf"],[3,"title"],[3,"orderSnapshot","modifyOrderInput","addedLines","shippingAddressForm","billingAddressForm","couponCodesControl","updatedShippingMethods"],[3,"label"],[3,"label",4,"ngIf"],["vdrDialogButtons",""],[1,"",3,"refundablePayments","order","paymentSelected"],["name","refundNote","required","",3,"ngModel","ngModelChange"],[1,"errors"],["class","mb-1",3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],[1,"",3,"clrAlertType","clrAlertClosable"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[1,"mb-1",3,"clrAlertType","clrAlertClosable"]],template:function(t,o){1&t&&(e.yuY(0,gl,2,3,"ng-template",0),e.wR5(1,"vdr-order-table",1),e.I0R(2,"div",2)(3,"div",3),e.yuY(4,yl,1,2,"vdr-payment-for-refund-selector",4),e.C$Y(),e.I0R(5,"div",3)(6,"vdr-card",5),e.wVc(7,"translate"),e.wR5(8,"vdr-order-modification-summary",6),e.I0R(9,"vdr-labeled-data",7),e.wVc(10,"translate"),e.OEk(11),e.C$Y(),e.yuY(12,Cl,3,4,"vdr-form-field",8),e.C$Y()()(),e.yuY(13,Ol,15,18,"ng-template",9)),2&t&&(e.yG2(),e.E7m("order",o.order)("orderLineCustomFields",o.orderLineCustomFields),e.yG2(3),e.E7m("ngIf",o.priceDifference<0),e.yG2(2),e.E7m("title",e.kDX(7,14,"order.modify-order")),e.yG2(2),e.E7m("orderSnapshot",o.orderSnapshot)("modifyOrderInput",o.modifyOrderInput)("addedLines",o.addedLines)("shippingAddressForm",o.shippingAddressForm)("billingAddressForm",o.billingAddressForm)("couponCodesControl",o.couponCodesControl)("updatedShippingMethods",o.updatedShippingMethods),e.yG2(),e.E7m("label",e.kDX(10,16,"order.note")),e.yG2(2),e.oRS(" ",o.modifyOrderInput.note||"-"," "),e.yG2(),e.E7m("ngIf",o.priceDifference<0))},dependencies:[_.c0g,_.KMj,m.u_,l.ot,l.ue,l.eJ,l._G,P._,y.w,E.E,v.a,h.a,I.u,L,ne,oe,p.sD,g.u],styles:[".order-edits-preview-table .table-wrapper{max-width:initial!important}.payments-wrapper[_ngcontent-%COMP%]{display:flex;gap:calc(var(--space-unit) * 2)}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}var vl=s(3848),bl=s(8992);function Il(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-action-bar")(1,"vdr-ab-left"),e.wR5(2,"div",1),e.C$Y(),e.I0R(3,"vdr-ab-right")(4,"button",2),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.transitionToPriorState(a))}),e.OEk(5),e.wVc(6,"translate"),e.C$Y()()()}2&r&&(e.yG2(5),e.oRS(" ",e.kDX(6,1,"order.cancel-modification")," "))}function Gl(r,n){1&r&&(e.I0R(0,"div",51),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.oRS(" ",e.kDX(2,1,"order.no-modifications-made")," "))}function El(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",52),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.editingShippingAddress=!i.editingShippingAddress)}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",53),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.edit-shipping-address"))}function Rl(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",54),2&r){const t=e.GaO(2);e.E7m("address",t.shippingAddressForm.value)}}function kl(r,n){if(1&r&&(e.wR5(0,"vdr-address-form",55),e.wVc(1,"async")),2&r){const t=e.GaO(2);e.E7m("formGroup",t.shippingAddressForm)("availableCountries",e.kDX(1,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function wl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",52),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.editingBillingAddress=!i.editingBillingAddress)}),e.wVc(1,"translate"),e.wR5(2,"clr-icon",53),e.C$Y()}2&r&&e.E7m("title",e.kDX(1,1,"order.edit-billing-address"))}function Tl(r,n){if(1&r&&e.wR5(0,"vdr-formatted-address",54),2&r){const t=e.GaO(2);e.E7m("address",t.billingAddressForm.value)}}function Sl(r,n){if(1&r&&(e.wR5(0,"vdr-address-form",55),e.wVc(1,"async")),2&r){const t=e.GaO(2);e.E7m("formGroup",t.billingAddressForm)("availableCountries",e.kDX(1,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function Dl(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function xl(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}function Fl(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.updatedAt,"short")," ")}}function $l(r,n){if(1&r&&(e.wR5(0,"img",59),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Yl(r,n){1&r&&(e.I0R(0,"div",60),e.wR5(1,"clr-icon",61),e.C$Y())}function Ml(r,n){if(1&r&&(e.I0R(0,"div",56),e.yuY(1,$l,2,4,"img",57)(2,Yl,2,0,"ng-template",null,58,e.gJz),e.C$Y()),2&r){const t=n.item,o=e.Gew(3);e.yG2(),e.E7m("ngIf",t.featuredAsset)("ngIfElse",o)}}function Pl(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.name," ")}}function Al(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.productVariant.sku," ")}}function Vl(r,n){if(1&r&&(e.I0R(0,"div",62)(1,"div"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y(),e.I0R(4,"div",63),e.wVc(5,"translate"),e.OEk(6),e.wVc(7,"localeCurrency"),e.C$Y()()),2&r){const t=n.item,o=e.GaO().ngIf;e.yG2(2),e.cNF(e.g7$(3,3,t.unitPriceWithTax,o.currencyCode)),e.yG2(2),e.E7m("title",e.kDX(5,6,"order.net-price")),e.yG2(2),e.oRS(" ",e.g7$(7,8,t.unitPrice,o.currencyCode)," ")}}function Nl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",68),e.qCj("click",function(){e.usT(t);const i=e.GaO().item,a=e.GaO(2);return e.CGJ(a.removeAddedItem(i.id))}),e.wR5(1,"clr-icon",69),e.C$Y()}}function Ll(r,n){if(1&r){const t=e.KQA();e.I0R(0,"input",64),e.qCj("input",function(i){const c=e.usT(t).item,G=e.GaO(2);return e.CGJ(G.updateLineQuantity(c,i.target.value))}),e.C$Y(),e.yuY(1,Nl,2,0,"button",65),e.wR5(2,"vdr-line-refunds",66)(3,"vdr-line-fulfillment",67)}if(2&r){const t=n.item,o=e.GaO().ngIf,i=e.GaO();e.E7m("value",i.getInitialLineQuantity(t.id)),e.yG2(),e.E7m("ngIf",i.isAddedLine(t)),e.yG2(),e.E7m("line",t)("payments",o.payments),e.yG2(),e.E7m("line",t)("allOrderFulfillments",o.fulfillments)("orderState",o.state)}}function Xl(r,n){if(1&r&&e.wR5(0,"vdr-custom-field-control",71),2&r){const t=n.index,o=e.GaO().$implicit,i=e.GaO(2);e.E7m("compact",!0)("entityName","OrderLine")("customField",o)("customFieldsFormGroup",i.orderLineCustomFieldsFormArray.at(t))}}function jl(r,n){if(1&r&&(e.I0R(0,"vdr-dt2-column",70),e.wVc(1,"customFieldLabel"),e.wVc(2,"async"),e.yuY(3,Xl,1,4,"ng-template"),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(2);e.E7m("id",t.name)("heading",e.g7$(1,3,t,e.kDX(2,6,o.uiLanguage$)))("hiddenByDefault",!0)}}function Ql(r,n){if(1&r&&(e.wR5(0,"img",75),e.wVc(1,"assetPreview")),2&r){const t=n.ngIf;e.E7m("src",e.g7$(1,1,t,"tiny"),e.K6U)}}function Kl(r,n){if(1&r&&(e.I0R(0,"div",72),e.yuY(1,Ql,2,4,"img",73),e.I0R(2,"div")(3,"strong",74),e.OEk(4),e.C$Y(),e.I0R(5,"small"),e.OEk(6),e.C$Y(),e.I0R(7,"div"),e.OEk(8),e.wVc(9,"localeCurrency"),e.C$Y()()()),2&r){const t=e.GaO().ngIf,o=e.GaO();e.yG2(),e.E7m("ngIf",o.addItemSelectedVariant.productAsset),e.yG2(3),e.cNF(o.addItemSelectedVariant.productVariantName),e.yG2(2),e.cNF(o.addItemSelectedVariant.sku),e.yG2(2),e.oRS(" ",e.g7$(9,4,o.getSelectedItemPrice(o.addItemSelectedVariant),t.currencyCode)," ")}}function ql(r,n){if(1&r&&(e.SAx(0),e.wR5(1,"vdr-custom-field-control",77),e.k70()),2&r){const t=n.$implicit,o=e.GaO(3);e.yG2(),e.E7m("readonly",!o.addItemSelectedVariant)("customField",t)("customFieldsFormGroup",o.addItemCustomFieldsForm)("compact",!0)}}function Hl(r,n){if(1&r&&(e.I0R(0,"div",36),e.yuY(1,ql,2,4,"ng-container",76),e.C$Y()),2&r){const t=e.GaO(2);e.yG2(),e.E7m("ngForOf",t.orderLineCustomFields)}}function Bl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"button",78),e.qCj("click",function(){e.usT(t);const i=e.GaO(2);return e.CGJ(i.addItemToOrder(i.addItemSelectedVariant))}),e.OEk(1),e.wVc(2,"translate"),e.C$Y()}if(2&r){const t=e.GaO(2);e.E7m("disabled",!t.addItemSelectedVariant||t.addItemCustomFieldsForm.invalid),e.yG2(),e.oRS(" ",e.kDX(2,2,"order.add-item-to-order")," ")}}function Jl(r,n){if(1&r){const t=e.KQA();e.SAx(0),e.I0R(1,"div"),e.OEk(2),e.C$Y(),e.I0R(3,"div",79),e.OEk(4),e.wVc(5,"localeCurrency"),e.C$Y(),e.I0R(6,"button",68),e.qCj("click",function(){e.usT(t);const i=e.GaO().$implicit,a=e.GaO(2);return e.CGJ(a.setShippingMethod(i.id))}),e.OEk(7),e.wVc(8,"translate"),e.C$Y(),e.k70()}if(2&r){const t=n.ngIf,o=e.GaO(2).ngIf;e.yG2(2),e.oRS("",t.name,":"),e.yG2(2),e.oRS(" ",e.g7$(5,3,t.price,o.currencyCode)," "),e.yG2(3),e.oRS(" ",e.kDX(8,6,"order.set-shipping-method")," ")}}function Wl(r,n){if(1&r&&(e.I0R(0,"div",9),e.yuY(1,Jl,9,8,"ng-container",0),e.C$Y()),2&r){const t=n.$implicit,o=e.GaO(2);e.yG2(),e.E7m("ngIf",o.getShippingLineDetails(t))}}const Ul=r=>({rate:r});function zl(r,n){if(1&r){const t=e.KQA();e.I0R(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",3),e.wVc(3,"translate"),e.wR5(4,"vdr-order-modification-summary",4),e.yuY(5,Gl,3,3,"div",5),e.I0R(6,"div",6)(7,"vdr-form-field",7),e.wVc(8,"translate"),e.I0R(9,"textarea",8),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.note,i)||(a.note=i),e.CGJ(i)}),e.C$Y()(),e.I0R(10,"label",9)(11,"input",10),e.iHE("ngModelChange",function(i){e.usT(t);const a=e.GaO();return e.kNx(a.recalculateShipping,i)||(a.recalculateShipping=i),e.CGJ(i)}),e.C$Y(),e.I0R(12,"div",11),e.OEk(13),e.wVc(14,"translate"),e.C$Y()(),e.I0R(15,"button",12),e.qCj("click",function(){const a=e.usT(t).ngIf,c=e.GaO();return e.CGJ(c.previewAndModify(a))}),e.OEk(16),e.wVc(17,"translate"),e.C$Y()()(),e.I0R(18,"vdr-card",3),e.wVc(19,"translate"),e.wR5(20,"vdr-coupon-code-selector",13),e.C$Y(),e.I0R(21,"vdr-card",3),e.wVc(22,"translate"),e.yuY(23,El,3,3,"ng-template",14)(24,Rl,1,1,"vdr-formatted-address",15)(25,kl,2,5,"vdr-address-form",16),e.C$Y(),e.I0R(26,"vdr-card",3),e.wVc(27,"translate"),e.yuY(28,wl,3,3,"ng-template",14)(29,Tl,1,1,"vdr-formatted-address",15)(30,Sl,2,5,"vdr-address-form",16),e.C$Y()(),e.I0R(31,"vdr-page-block")(32,"vdr-card",17)(33,"vdr-data-table-2",18)(34,"vdr-dt2-column",19),e.wVc(35,"translate"),e.yuY(36,Dl,1,1,"ng-template"),e.C$Y(),e.I0R(37,"vdr-dt2-column",20),e.wVc(38,"translate"),e.yuY(39,xl,2,4,"ng-template"),e.C$Y(),e.I0R(40,"vdr-dt2-column",21),e.wVc(41,"translate"),e.yuY(42,Fl,2,4,"ng-template"),e.C$Y(),e.I0R(43,"vdr-dt2-column",22),e.wVc(44,"translate"),e.yuY(45,Ml,4,2,"ng-template"),e.C$Y(),e.I0R(46,"vdr-dt2-column",23),e.wVc(47,"translate"),e.yuY(48,Pl,1,1,"ng-template"),e.C$Y(),e.I0R(49,"vdr-dt2-column",24),e.wVc(50,"translate"),e.yuY(51,Al,1,1,"ng-template"),e.C$Y(),e.I0R(52,"vdr-dt2-column",25),e.wVc(53,"translate"),e.yuY(54,Vl,8,11,"ng-template"),e.C$Y(),e.I0R(55,"vdr-dt2-column",26),e.wVc(56,"translate"),e.yuY(57,Ll,4,7,"ng-template"),e.C$Y(),e.yuY(58,jl,4,8,"vdr-dt2-column",27),e.C$Y()(),e.I0R(59,"vdr-card",3),e.wVc(60,"translate"),e.I0R(61,"vdr-product-variant-selector",28),e.qCj("productSelected",function(i){e.usT(t);const a=e.GaO();return e.CGJ(a.addItemSelectedVariant=i)}),e.C$Y(),e.I0R(62,"div",29)(63,"div"),e.yuY(64,Kl,10,7,"div",30)(65,Hl,2,1,"div",31),e.C$Y(),e.wR5(66,"div",32),e.I0R(67,"div"),e.yuY(68,Bl,3,4,"button",33),e.C$Y()()(),e.I0R(69,"vdr-card",3),e.wVc(70,"translate"),e.yuY(71,Wl,2,1,"div",34),e.C$Y(),e.I0R(72,"vdr-card",3),e.wVc(73,"translate"),e.I0R(74,"form",35),e.qCj("submit",function(){e.usT(t);const i=e.GaO();return e.CGJ(i.addSurcharge(i.surchargeForm.value))}),e.I0R(75,"div",36)(76,"vdr-form-field",37),e.wVc(77,"translate"),e.wR5(78,"input",38),e.C$Y(),e.I0R(79,"vdr-form-field",39),e.wVc(80,"translate"),e.wR5(81,"input",40),e.C$Y(),e.I0R(82,"vdr-form-field",41),e.wVc(83,"translate"),e.wR5(84,"vdr-currency-input",42),e.C$Y(),e.I0R(85,"vdr-form-field",43),e.wVc(86,"translate"),e.wR5(87,"input",44),e.C$Y(),e.I0R(88,"vdr-form-field",45),e.wVc(89,"translate"),e.I0R(90,"vdr-affixed-input",46),e.wR5(91,"input",47),e.C$Y()(),e.I0R(92,"vdr-form-field",48),e.wVc(93,"translate"),e.wR5(94,"input",49),e.C$Y()(),e.I0R(95,"button",50),e.OEk(96),e.wVc(97,"translate"),e.C$Y()()()()()}if(2&r){const t=n.ngIf,o=e.GaO();let i,a;e.yG2(2),e.E7m("title",e.kDX(3,58,"order.modification-summary")),e.yG2(2),e.E7m("orderSnapshot",o.orderSnapshot)("modifyOrderInput",o.modifyOrderInput)("addedLines",o.addedLines)("shippingAddressForm",o.shippingAddressForm)("billingAddressForm",o.billingAddressForm)("couponCodesControl",o.couponCodesControl)("updatedShippingMethods",o.updatedShippingMethods),e.yG2(),e.E7m("ngIf",!o.hasModifications()),e.yG2(2),e.E7m("label",e.kDX(8,60,"order.note")),e.yG2(2),e.OKB("ngModel",o.note),e.E7m("disabled",!o.hasModifications()),e.yG2(2),e.OKB("ngModel",o.recalculateShipping),e.E7m("disabled",!o.hasModifications()),e.yG2(2),e.cNF(e.kDX(14,62,"order.modification-recalculate-shipping")),e.yG2(2),e.E7m("disabled",!o.hasModifications()),e.yG2(),e.oRS(" ",e.kDX(17,64,"order.preview-changes")," "),e.yG2(2),e.E7m("title",e.kDX(19,66,"order.set-coupon-codes")),e.yG2(2),e.E7m("control",o.couponCodesControl),e.yG2(),e.E7m("title",e.kDX(22,68,"order.shipping-address")),e.yG2(3),e.E7m("ngIf",!o.editingShippingAddress),e.yG2(),e.E7m("ngIf",o.editingShippingAddress),e.yG2(),e.E7m("title",e.kDX(27,70,"order.billing-address")),e.yG2(3),e.E7m("ngIf",!o.editingBillingAddress),e.yG2(),e.E7m("ngIf",o.editingBillingAddress),e.yG2(2),e.E7m("paddingX",!1),e.yG2(),e.E7m("items",t.lines.concat(o.addedLines)),e.yG2(),e.E7m("heading",e.kDX(35,72,"common.id"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(38,74,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(41,76,"common.updated-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(44,78,"common.image")),e.yG2(3),e.E7m("heading",e.kDX(47,80,"order.product-name"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(50,82,"order.product-sku")),e.yG2(3),e.E7m("heading",e.kDX(53,84,"order.unit-price")),e.yG2(3),e.E7m("heading",e.kDX(56,86,"order.quantity"))("optional",!1),e.yG2(3),e.E7m("ngForOf",o.orderLineCustomFields),e.yG2(),e.E7m("title",e.kDX(60,88,"order.add-item-to-order")),e.yG2(5),e.E7m("ngIf",o.addItemSelectedVariant),e.yG2(),e.E7m("ngIf",o.addItemSelectedVariant),e.yG2(3),e.E7m("ngIf",o.addItemSelectedVariant),e.yG2(),e.E7m("title",e.kDX(70,90,"order.shipping")),e.yG2(2),e.E7m("ngForOf",t.shippingLines),e.yG2(),e.E7m("title",e.kDX(73,92,"order.add-surcharge")),e.yG2(2),e.E7m("formGroup",o.surchargeForm),e.yG2(2),e.E7m("label",e.kDX(77,94,"common.description")),e.yG2(3),e.E7m("label",e.kDX(80,96,"order.product-sku")),e.yG2(3),e.E7m("label",e.kDX(83,98,"common.price")),e.yG2(2),e.E7m("currencyCode",t.currencyCode),e.yG2(),e.E7m("label",e.g7$(86,100,"catalog.price-includes-tax-at",e.S45(109,Ul,null!==(i=null==(i=o.surchargeForm.get("taxRate"))?null:i.value)&&void 0!==i?i:0))),e.yG2(3),e.E7m("label",e.kDX(89,103,"order.tax-rate")),e.yG2(4),e.E7m("label",e.kDX(93,105,"order.tax-description")),e.yG2(3),e.E7m("disabled",o.surchargeForm.invalid||o.surchargeForm.pristine||0===(null==(a=o.surchargeForm.get("price"))?null:a.value)||!(null!=(a=o.surchargeForm.get("description"))&&a.value)),e.yG2(),e.oRS(" ",e.kDX(97,107,"order.add-surcharge")," ")}}class Fe extends d.uJQ{constructor(n,t,o,i,a){super(),this.dataService=n,this.notificationService=t,this.modalService=o,this.orderTransitionService=i,this.changeDetectorRef=a,this.detailForm=new l.k1({}),this.couponCodesControl=new l.Ku([]),this.modifyOrderInput={dryRun:!0,orderId:"",addItems:[],adjustOrderLines:[],surcharges:[],note:"",refunds:[],updateShippingAddress:{},updateBillingAddress:{}},this.surchargeForm=new l.WC({description:new l.Ku("",l.AQ.minLength(1)),sku:new l.Ku(""),price:new l.Ku(0),priceIncludesTax:new l.Ku(!0),taxRate:new l.Ku(0),taxDescription:new l.Ku("")}),this.shippingAddressForm=new l.WC({fullName:new l.Ku(""),company:new l.Ku(""),streetLine1:new l.Ku(""),streetLine2:new l.Ku(""),city:new l.Ku(""),province:new l.Ku(""),postalCode:new l.Ku(""),countryCode:new l.Ku(""),phoneNumber:new l.Ku("")}),this.billingAddressForm=new l.WC({fullName:new l.Ku(""),company:new l.Ku(""),streetLine1:new l.Ku(""),streetLine2:new l.Ku(""),city:new l.Ku(""),province:new l.Ku(""),postalCode:new l.Ku(""),countryCode:new l.Ku(""),phoneNumber:new l.Ku("")}),this.note="",this.recalculateShipping=!0,this.editingShippingAddress=!1,this.editingBillingAddress=!1,this.updatedShippingMethods={},this.addedVariants=new Map}ngOnInit(){this.init(),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.modifyOrderInput.orderId=this.route.snapshot.paramMap.get("id"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.entity$.pipe((0,x.U)(1)).subscribe(n=>{this.orderSnapshot=this.createOrderSnapshot(n),n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm.reset();for(const[t,o]of Object.entries(this.shippingAddressForm.controls))o.setValue(n.shippingAddress?.[t]);this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress);for(const[t,o]of Object.entries(this.billingAddressForm.controls))o.setValue(n.billingAddress?.[t]);this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress),this.orderLineCustomFieldsFormArray=new l.Qn([]);for(const t of n.lines){const o=new l.k1({});for(const{name:i}of this.orderLineCustomFields)o.addControl(i,new l.yM(t.customFields[i]));o.valueChanges.pipe((0,Gt.a)(this.destroy$)).subscribe(i=>{let a=this.modifyOrderInput.adjustOrderLines.find(c=>c.orderLineId===t.id);a||(a={orderLineId:t.id,quantity:t.quantity},this.modifyOrderInput.adjustOrderLines.push(a)),this.orderLineCustomFields.length&&(a.customFields=i)}),this.orderLineCustomFieldsFormArray.push(o)}}),this.addItemCustomFieldsFormArray=new l.Qn([]),this.addItemCustomFieldsForm=new l.k1({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new l.yM);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,nl.C)(1)),this.dataService.order.getOrderHistory(this.id,{take:1,sort:{createdAt:d._8$.DESC},filter:{type:{eq:d.YjR.ORDER_STATE_TRANSITION}}}).single$.subscribe(({order:n})=>{this.previousState=n?.history.items[0].data.from}),this.uiLanguage$=this.dataService.client.uiState().stream$.pipe((0,R.k)(({uiState:n})=>n.language))}ngOnDestroy(){this.destroy()}get addedLines(){const n=t=>"SinglePrice"===t.__typename?t.value:0;return(this.modifyOrderInput.addItems||[]).map(t=>{const o=this.addedVariants.get(t.productVariantId);if(o)return{id:this.getIdForAddedItem(t),featuredAsset:o.productAsset,productVariant:{id:o.productVariantId,name:o.productVariantName,sku:o.sku},unitPrice:n(o.price),unitPriceWithTax:n(o.priceWithTax),quantity:t.quantity}}).filter(C.notNullOrUndefined)}getIdForAddedItem(n){return`added-${n.productVariantId}-${JSON.stringify(n.customFields||{})}`}transitionToPriorState(n){this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates).subscribe(t=>{this.router.navigate([".."],{relativeTo:this.route})})}hasModifications(){const{addItems:n,adjustOrderLines:t,surcharges:o}=this.modifyOrderInput;return!!n?.length||!!o?.length||!!t?.length||this.shippingAddressForm.dirty&&this.shippingAddressForm.valid||this.billingAddressForm.dirty&&this.billingAddressForm.valid||this.couponCodesControl.dirty||Object.entries(this.updatedShippingMethods).length>0}isLineModified(n){return!!this.modifyOrderInput.adjustOrderLines?.find(t=>t.orderLineId===n.id&&t.quantity!==n.quantity)}getInitialLineQuantity(n){const t=this.modifyOrderInput.adjustOrderLines?.find(a=>a.orderLineId===n);if(t)return t.quantity;const o=this.modifyOrderInput.addItems?.find(a=>this.getIdForAddedItem(a)===n);if(o)return o.quantity??1;const i=this.orderSnapshot.lines.find(a=>a.id===n);return i?i.quantity:1}updateLineQuantity(n,t){const{adjustOrderLines:o}=this.modifyOrderInput;if(this.isAddedLine(n)){const i=this.modifyOrderInput.addItems?.find(a=>a.productVariantId===n.productVariant.id);i&&(i.quantity=+t)}else{let i=o?.find(a=>a.orderLineId===n.id);i&&+t===n.quantity&&o?.splice(o?.indexOf(i),1),i||(i={orderLineId:n.id,quantity:+t},o?.push(i)),i.quantity=+t}}isAddedLine(n){return n.id.startsWith("added-")}updateAddedItemQuantity(n,t){const o=this.modifyOrderInput.addItems?.find(i=>i.productVariantId===n.productVariant.id);o&&(o.quantity=+t)}trackByProductVariantId(n,t){return t.productVariant.id}getSelectedItemPrice(n){return"SinglePrice"===n?.priceWithTax.__typename?n.priceWithTax.value:0}addItemToOrder(n){if(!n)return;const t=this.orderLineCustomFields.length?this.addItemCustomFieldsForm.value:void 0;let o=this.modifyOrderInput.addItems?.find(i=>this.isMatchingAddItemRow(i,n,t));if(o?o.quantity++:(o={productVariantId:n.productVariantId,quantity:1},t&&(o.customFields=t),this.modifyOrderInput.addItems?.push(o)),t){const i=new l.k1({});for(const[a,c]of Object.entries(t))i.addControl(a,new l.yM(c));this.addItemCustomFieldsFormArray.push(i),i.valueChanges.pipe((0,Gt.a)(this.destroy$)).subscribe(a=>{o&&(o.customFields=a)})}this.addItemCustomFieldsForm.reset({}),this.addItemSelectedVariant=void 0,this.addedVariants.set(n.productVariantId,n)}getShippingLineDetails(n){const t=this.updatedShippingMethods[n.id];return t?{name:t.name||t.code,price:t.priceWithTax}:{name:n.shippingMethod.name||n.shippingMethod.code,price:n.discountedPriceWithTax}}setShippingMethod(n){const t=this.updatedShippingMethods[n]??this.entity?.shippingLines.find(o=>o.id===n)?.shippingMethod;t&&this.dataService.order.getDraftOrderEligibleShippingMethods(this.id).mapSingle(({eligibleShippingMethodsForDraftOrder:o})=>o).pipe((0,f.G)(o=>this.modalService.fromComponent(B,{locals:{eligibleShippingMethods:o,currencyCode:this.entity?.currencyCode,currentSelectionId:t.id}}).pipe((0,R.k)(i=>{if(i)return o.find(a=>a.id===i)})))).subscribe(o=>{o&&(this.updatedShippingMethods[n]=o,this.changeDetectorRef.markForCheck())})}isMatchingAddItemRow(n,t,o){return n.productVariantId===t.productVariantId&&JSON.stringify(n.customFields)===JSON.stringify(o)}removeAddedItem(n){this.modifyOrderInput.addItems=this.modifyOrderInput.addItems?.filter(t=>this.getIdForAddedItem(t)!==n)}getSurchargePrices(n){const t=n.priceIncludesTax?n.price:Math.round(n.price*((100+(n.taxRate||0))/100));return{price:n.priceIncludesTax?Math.round(n.price/((100+(n.taxRate||0))/100)):n.price,priceWithTax:t}}addSurcharge(n){this.modifyOrderInput.surcharges?.push(n),this.surchargeForm.reset({price:0,priceIncludesTax:!0,taxRate:0})}removeSurcharge(n){this.modifyOrderInput.surcharges?.splice(n,1)}previewAndModify(n){const o={...{...this.modifyOrderInput,adjustOrderLines:this.modifyOrderInput.adjustOrderLines.map(i=>(0,d.YN$)((0,tl.Q)(i),this.orderLineCustomFields))},...this.billingAddressForm.dirty?{updateBillingAddress:this.billingAddressForm.value}:{},...this.shippingAddressForm.dirty?{updateShippingAddress:this.shippingAddressForm.value}:{},dryRun:!0,couponCodes:this.couponCodesControl.dirty?this.couponCodesControl.value:void 0,note:this.note??"",options:{recalculateShipping:this.recalculateShipping}};Object.entries(this.updatedShippingMethods).length&&(o.shippingMethodIds=n.shippingLines.map(i=>this.updatedShippingMethods[i.id]?this.updatedShippingMethods[i.id].id:i.shippingMethod.id)),this.dataService.order.modifyOrder(o).pipe((0,f.G)(({modifyOrder:i})=>{switch(i.__typename){case"Order":return this.modalService.fromComponent(xe,{size:"xl",closable:!1,locals:{order:i,orderSnapshot:this.orderSnapshot,orderLineCustomFields:this.orderLineCustomFields,modifyOrderInput:o,addedLines:this.addedLines,shippingAddressForm:this.shippingAddressForm,billingAddressForm:this.billingAddressForm,couponCodesControl:this.couponCodesControl,updatedShippingMethods:this.updatedShippingMethods}});case"InsufficientStockError":case"NegativeQuantityError":case"NoChangesSpecifiedError":case"OrderLimitError":case"OrderModificationStateError":case"PaymentMethodMissingError":case"RefundPaymentIdMissingError":case"CouponCodeLimitError":case"CouponCodeExpiredError":case"IneligibleShippingMethodError":case"CouponCodeInvalidError":return this.notificationService.error(i.message),(0,O.of)(!1);case null:case void 0:return(0,O.of)(!1);default:(0,C.assertNever)(i)}}),(0,f.G)(i=>{if(!i||i.result===w.Cancel)return this.dataService.order.getOrder(this.id).mapSingle(()=>!1);{const a={...o,dryRun:!1};return i.result===w.Refund&&(a.refunds=i.refunds),this.dataService.order.modifyOrder(a).pipe((0,f.G)(({modifyOrder:c})=>{if("Order"===c.__typename){const ze=0<c.totalWithTax-this.orderSnapshot.totalWithTax?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,ze).pipe((0,gt.e)(!0))}return this.notificationService.error(c.message),F.k}))}})).subscribe(i=>{i&&this.router.navigate(["../"],{relativeTo:this.route})})}addAddressCustomFieldsFormGroup(n,t){if(t&&this.addressCustomFields.length){const o=new l.k1({});for(const i of this.addressCustomFields){const a=i.name,c=t.customFields?.[a];o.addControl(a,new l.yM(c))}n.addControl("customFields",o)}}createOrderSnapshot(n){return{totalWithTax:n.totalWithTax,currencyCode:n.currencyCode,couponCodes:n.couponCodes,lines:[...n.lines].map(t=>({...t})),shippingLines:[...n.shippingLines].map(t=>({...t}))}}setFormValues(n,t){}static#e=this.\u0275fac=function(t){return new(t||Fe)(e.GI1(d.Aj0),e.GI1(d.gnT),e.GI1(d.Ajm),e.GI1(Y),e.GI1(e.kD9))};static#t=this.\u0275cmp=e.In1({type:Fe,selectors:[["vdr-order-editor"]],features:[e.eg9],decls:4,vars:4,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[1,"btn","btn-secondary",3,"click"],[3,"title"],[3,"orderSnapshot","modifyOrderInput","addedLines","shippingAddressForm","billingAddressForm","couponCodesControl","updatedShippingMethods"],["class","no-modifications",4,"ngIf"],[1,"summary-controls"],[3,"label"],["name","note","required","",3,"ngModel","disabled","ngModelChange"],[1,"flex","items-center"],["type","checkbox",3,"ngModel","disabled","ngModelChange"],[1,"ml-1"],[1,"btn","btn-primary","mt-2",3,"disabled","click"],[3,"control"],["vdrCardControls",""],[3,"address",4,"ngIf"],[3,"formGroup","availableCountries","customFields",4,"ngIf"],[3,"paddingX"],["id","modify-order",1,"order-table",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"id","heading","hiddenByDefault",4,"ngFor","ngForOf"],[1,"mb-4",3,"productSelected"],[1,"flex"],["class","flex mb-4",4,"ngIf"],["class","form-grid",4,"ngIf"],[1,"flex-spacer"],["class","btn btn-secondary",3,"disabled","click",4,"ngIf"],["class","flex items-center",4,"ngFor","ngForOf"],[3,"formGroup","submit"],[1,"form-grid"],["for","description",3,"label"],["id","description","type","text","formControlName","description"],["for","sku",3,"label"],["id","sku","type","text","formControlName","sku"],["for","price",3,"label"],["id","price","formControlName","price",3,"currencyCode"],["for","priceIncludesTax",3,"label"],["id","priceIncludesTax","type","checkbox","clrCheckbox","","formControlName","priceIncludesTax"],["for","taxRate",3,"label"],["suffix","%"],["id","taxRate","type","number","min","0","max","100","formControlName","taxRate"],["for","taxDescription",3,"label"],["id","taxDescription","type","text","formControlName","taxDescription"],[1,"btn","btn-secondary","mt-2",3,"disabled"],[1,"no-modifications"],[1,"button-small",3,"title","click"],["shape","edit"],[3,"address"],[3,"formGroup","availableCountries","customFields"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],["imagePlaceholder",""],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"text-center"],[1,"net-price",3,"title"],["type","number","min","0",1,"draft-qty","mr-1",3,"value","input"],["class","button-small",3,"click",4,"ngIf"],[3,"line","payments"],[3,"line","allOrderFulfillments","orderState"],[1,"button-small",3,"click"],["shape","trash"],[3,"id","heading","hiddenByDefault"],[3,"compact","entityName","customField","customFieldsFormGroup"],[1,"flex","mb-4"],["class","mr-4 add-item-thumb",3,"src",4,"ngIf"],[1,"mr-4"],[1,"mr-4","add-item-thumb",3,"src"],[4,"ngFor","ngForOf"],["entityName","OrderLine",3,"readonly","customField","customFieldsFormGroup","compact"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"mx-1"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block"),e.yuY(1,Il,7,3,"vdr-action-bar",0),e.wVc(2,"async"),e.C$Y(),e.yuY(3,zl,98,111,"vdr-page-detail-layout",0)),2&t&&(e.yG2(),e.E7m("ngIf",e.kDX(2,2,o.entity$)),e.yG2(2),e.E7m("ngIf",o.entity))},dependencies:[_.o3d,_.ojz,_.y6l,m.ay,m.u_,l.sz,l.ot,l.O4,l.SU,l.ue,l.u,l.eJ,l.Gu,l._t,l._G,l.uW,l.Wo,b.iK,b.Ix,b.eu,vl.A,Je.Y,qe.E,P._,y.w,se.o,pt.k,ot.w,We.q,Pe.M,Me.m,Qe.g,Ke.e,I.u,I.M,z,V,K,oe,m.a,p.sD,bl.s,j.w,A.m,g.u],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}.order-table[_ngcontent-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}.order-table[_ngcontent-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}.order-table[_ngcontent-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.order-table[_ngcontent-%COMP%] tr.modified[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{text-align:start}.add-item-thumb[_ngcontent-%COMP%]{max-width:50px}.no-modifications[_ngcontent-%COMP%]{color:var(--color-grey-400)}.summary-controls[_ngcontent-%COMP%]{border-top:1px solid var(--color-weight-200);margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 1)}"],changeDetection:0})}var Zl=s(3252),ed=s(4184),td=s(6248);const nd=()=>["./draft/create"];function rd(r,n){1&r&&(e.I0R(0,"a",17),e.wR5(1,"clr-icon",18),e.OEk(2),e.wVc(3,"translate"),e.C$Y()),2&r&&(e.E7m("routerLink",e.q4q(4,nd)),e.yG2(2),e.oRS(" ",e.kDX(3,2,"catalog.create-draft-order")," "))}const od=()=>["CreateOrder"];function id(r,n){1&r&&(e.SAx(0),e.yuY(1,rd,4,5,"a",16),e.k70()),2&r&&(e.yG2(),e.E7m("vdrIfPermissions",e.q4q(1,od)))}function ad(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item;e.oRS(" ",t.id," ")}}function ld(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.createdAt,"short")," ")}}const dd=r=>["./draft",r],sd=r=>["./",r];function cd(r,n){if(1&r&&(e.I0R(0,"a",19)(1,"span"),e.OEk(2),e.C$Y(),e.wR5(3,"clr-icon",20),e.C$Y()),2&r){const t=n.item;e.E7m("routerLink","Draft"===t.state?e.S45(2,dd,t.id):e.S45(4,sd,t.id)),e.yG2(2),e.cNF(t.code)}}function md(r,n){if(1&r&&(e.I0R(0,"vdr-customer-label",21),e.qCj("click",function(o){return o.stopPropagation()}),e.C$Y()),2&r){const t=n.item;e.E7m("customer",t.customer)}}function ud(r,n){1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.order-type-regular")))}function _d(r,n){1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.order-type-aggregate")))}function pd(r,n){1&r&&(e.I0R(0,"vdr-chip"),e.OEk(1),e.wVc(2,"translate"),e.C$Y()),2&r&&(e.yG2(),e.cNF(e.kDX(2,1,"order.order-type-seller")))}function fd(r,n){if(1&r&&e.yuY(0,ud,3,3,"vdr-chip",1)(1,_d,3,3,"vdr-chip",1)(2,pd,3,3,"vdr-chip",1),2&r){const t=n.item,o=e.GaO();e.E7m("ngIf",t.type===o.OrderType.Regular),e.yG2(),e.E7m("ngIf",t.type===o.OrderType.Aggregate),e.yG2(),e.E7m("ngIf",t.type===o.OrderType.Seller)}}function gd(r,n){if(1&r&&e.wR5(0,"vdr-order-state-label",22),2&r){const t=n.item;e.E7m("state",t.state)}}function yd(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeCurrency")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.totalWithTax,t.currencyCode)," ")}}function Cd(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"timeAgo")),2&r){const t=n.item;e.oRS(" ",e.kDX(1,1,t.updatedAt)," ")}}function hd(r,n){if(1&r&&(e.OEk(0),e.wVc(1,"localeDate")),2&r){const t=n.item;e.oRS(" ",e.g7$(1,1,t.orderPlacedAt,"short")," ")}}function Od(r,n){if(1&r&&e.OEk(0),2&r){const t=n.item,o=e.GaO();e.oRS(" ",o.getShippingNames(t)," ")}}function vd(r,n){if(1&r&&e.wR5(0,"vdr-dt2-custom-field-column",23),2&r){const t=n.$implicit,o=e.GaO();e.E7m("customField",t)("sorts",o.sorts)}}class $e extends d.Qb0{constructor(n,t){super(),this.serverConfigService=n,this.channelService=t,this.dataTableListId="order-list",this.orderStates=this.serverConfigService.getOrderProcessStates().map(o=>o.name),this.OrderType=d.aOe,this.customFields=this.getCustomFieldConfig("Order"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilter({name:"active",type:{kind:"boolean"},label:(0,u.s)("order.filter-is-active"),filterField:"active"}).addFilter({name:"totalWithTax",type:{kind:"number",inputType:"currency",currencyCode:"USD"},label:(0,u.s)("order.total"),filterField:"totalWithTax"}).addFilter({name:"state",type:{kind:"select",options:this.orderStates.map(o=>({value:o,label:(0,d.i4M)(o)}))},label:(0,u.s)("order.state"),filterField:"state"}).addFilter({name:"type",type:{kind:"select",options:[{value:d.aOe.Regular,label:(0,u.s)("order.order-type-regular")},{value:d.aOe.Aggregate,label:(0,u.s)("order.order-type-aggregate")},{value:d.aOe.Seller,label:(0,u.s)("order.order-type-seller")}]},label:(0,u.s)("order.order-type"),filterField:"type"}).addFilter({name:"orderPlacedAt",type:{kind:"dateRange"},label:(0,u.s)("order.placed-at"),filterField:"orderPlacedAt"}).addFilter({name:"customerLastName",type:{kind:"text"},label:(0,u.s)("customer.last-name"),filterField:"customerLastName"}).addFilter({name:"transactionId",type:{kind:"text"},label:(0,u.s)("order.transaction-id"),filterField:"transactionId"}).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().defaultSort("updatedAt","DESC").addSort({name:"id"}).addSort({name:"createdAt"}).addSort({name:"updatedAt"}).addSort({name:"orderPlacedAt"}).addSort({name:"customerLastName"}).addSort({name:"state"}).addSort({name:"totalWithTax"}).addCustomFieldSorts(this.customFields).connectToRoute(this.route),this.canCreateDraftOrder=!1,this.activeChannelIsDefaultChannel=!1,super.configure({document:d.sx,getItems:o=>o.orders,setVariables:(o,i)=>this.createQueryOptions(o,i,this.searchTermControl.value),refreshListOnChanges:[this.filters.valueChanges,this.sorts.valueChanges]}),this.canCreateDraftOrder=!!this.serverConfigService.getOrderProcessStates().find(o=>"Created"===o.name)?.to.includes("Draft")}ngOnInit(){super.ngOnInit();const n=this.channelService.defaultChannelIsActive$.pipe((0,de.y)(t=>this.activeChannelIsDefaultChannel=t));super.refreshListOnChanges(this.filters.valueChanges,this.sorts.valueChanges,n)}createQueryOptions(n,t,o){let i=this.filters.createFilterInput();return this.activeChannelIsDefaultChannel&&(i={...i??{}}),o&&(i={code:{contains:o},customerLastName:{contains:o},transactionId:{contains:o}}),{options:{skip:n,take:t,filter:{...i??{}},filterOperator:o?d.Ccb.OR:d.Ccb.AND,sort:this.sorts.createSortInput()}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static#e=this.\u0275fac=function(t){return new(t||$e)(e.GI1(d.ctz),e.GI1(d.mMI))};static#t=this.\u0275cmp=e.In1({type:$e,selectors:[["vdr-order-list"]],features:[e.eg9],decls:45,vars:61,consts:[["locationId","order-list"],[4,"ngIf"],[1,"mt-2",3,"id","items","itemsPerPage","totalItems","currentPage","filters","pageChange","itemsPerPageChange","visibleColumnsChange"],["locationId","order-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault","sort"],["id","created-at",3,"heading","hiddenByDefault"],["id","code",3,"heading","optional"],["id","customer",3,"heading","sort"],["id","order-type",3,"heading","hiddenByDefault"],["id","state",3,"heading","sort"],["id","total",3,"heading","sort"],["id","updated-at",3,"heading"],["id","placed-at",3,"heading","sort"],["id","shipping",3,"heading"],[3,"customField","sorts",4,"ngFor","ngForOf"],["class","btn",3,"routerLink",4,"vdrIfPermissions"],[1,"btn",3,"routerLink"],["shape","plus"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],[3,"customer","click"],[3,"state"],[3,"customField","sorts"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-right"),e.wR5(3,"vdr-action-bar-items",0),e.yuY(4,id,2,2,"ng-container",1),e.wR5(5,"vdr-action-bar-dropdown-menu",0),e.C$Y()()(),e.I0R(6,"vdr-data-table-2",2),e.qCj("pageChange",function(a){return o.setPageNumber(a)})("itemsPerPageChange",function(a){return o.setItemsPerPage(a)})("visibleColumnsChange",function(a){return o.setVisibleColumns(a)}),e.wVc(7,"async"),e.wVc(8,"async"),e.wVc(9,"async"),e.wVc(10,"async"),e.wR5(11,"vdr-bulk-action-menu",3)(12,"vdr-dt2-search",4),e.wVc(13,"translate"),e.I0R(14,"vdr-dt2-column",5),e.wVc(15,"translate"),e.yuY(16,ad,1,1,"ng-template"),e.C$Y(),e.I0R(17,"vdr-dt2-column",6),e.wVc(18,"translate"),e.yuY(19,ld,2,4,"ng-template"),e.C$Y(),e.I0R(20,"vdr-dt2-column",7),e.wVc(21,"translate"),e.yuY(22,cd,4,6,"ng-template"),e.C$Y(),e.I0R(23,"vdr-dt2-column",8),e.wVc(24,"translate"),e.yuY(25,md,1,1,"ng-template"),e.C$Y(),e.I0R(26,"vdr-dt2-column",9),e.wVc(27,"translate"),e.yuY(28,fd,3,3,"ng-template"),e.C$Y(),e.I0R(29,"vdr-dt2-column",10),e.wVc(30,"translate"),e.yuY(31,gd,1,1,"ng-template"),e.C$Y(),e.I0R(32,"vdr-dt2-column",11),e.wVc(33,"translate"),e.yuY(34,yd,2,4,"ng-template"),e.C$Y(),e.I0R(35,"vdr-dt2-column",12),e.wVc(36,"translate"),e.yuY(37,Cd,2,3,"ng-template"),e.C$Y(),e.I0R(38,"vdr-dt2-column",13),e.wVc(39,"translate"),e.yuY(40,hd,2,4,"ng-template"),e.C$Y(),e.I0R(41,"vdr-dt2-column",14),e.wVc(42,"translate"),e.yuY(43,Od,1,1,"ng-template"),e.C$Y(),e.yuY(44,vd,1,2,"vdr-dt2-custom-field-column",15),e.C$Y()),2&t&&(e.yG2(4),e.E7m("ngIf",o.canCreateDraftOrder),e.yG2(2),e.E7m("id",o.dataTableListId)("items",e.kDX(7,31,o.items$))("itemsPerPage",e.kDX(8,33,o.itemsPerPage$))("totalItems",e.kDX(9,35,o.totalItems$))("currentPage",e.kDX(10,37,o.currentPage$))("filters",o.filters),e.yG2(5),e.E7m("hostComponent",o)("selectionManager",o.selectionManager),e.yG2(),e.E7m("searchTermControl",o.searchTermControl)("searchTermPlaceholder",e.kDX(13,39,"order.search-by-order-filters")),e.yG2(2),e.E7m("heading",e.kDX(15,41,"common.id"))("hiddenByDefault",!0)("sort",o.sorts.get("id")),e.yG2(3),e.E7m("heading",e.kDX(18,43,"common.created-at"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(21,45,"common.code"))("optional",!1),e.yG2(3),e.E7m("heading",e.kDX(24,47,"order.customer"))("sort",o.sorts.get("customerLastName")),e.yG2(3),e.E7m("heading",e.kDX(27,49,"order.order-type"))("hiddenByDefault",!0),e.yG2(3),e.E7m("heading",e.kDX(30,51,"order.state"))("sort",o.sorts.get("state")),e.yG2(3),e.E7m("heading",e.kDX(33,53,"order.total"))("sort",o.sorts.get("totalWithTax")),e.yG2(3),e.E7m("heading",e.kDX(36,55,"common.updated-at")),e.yG2(3),e.E7m("heading",e.kDX(39,57,"order.placed-at"))("sort",o.sorts.get("orderPlacedAt")),e.yG2(3),e.E7m("heading",e.kDX(42,59,"order.shipping")),e.yG2(3),e.E7m("ngForOf",o.customFields))},dependencies:[_.o3d,m.ay,m.u_,k.ER,b.iK,b.eu,Le.O,D.g,Xe.G,Ye.a,yt.e,je.o,Zl.C,We.q,Pe.M,ed.u,ut.K,Me.m,m.a,p.sD,td.Q,A.m,g.u],styles:[".search-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:baseline;width:100%;max-width:100vw;margin-bottom:6px}.filter-presets[_ngcontent-%COMP%]{max-width:90vw;overflow-x:auto}.search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}.custom-filters[_ngcontent-%COMP%]{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded[_ngcontent-%COMP%]{max-height:initial}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%}ng-select[_ngcontent-%COMP%]{flex:1;min-width:200px;height:36px}ng-select[_ngcontent-%COMP%] .ng-select-container{height:36px}"],changeDetection:0})}function bd(r,n){if(1&r&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.C$Y()),2&r){const t=e.GaO();e.E7m("label",e.kDX(1,2,"order.transaction-id")),e.yG2(2),e.oRS(" ",t.refund.transactionId,"\n")}}class Ae{static#e=this.\u0275fac=function(t){return new(t||Ae)};static#t=this.\u0275cmp=e.In1({type:Ae,selectors:[["vdr-refund-detail"]],inputs:{refund:"refund",currencyCode:"currencyCode"},decls:8,vars:12,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,o){1&t&&(e.I0R(0,"vdr-labeled-data",0),e.wVc(1,"translate"),e.OEk(2),e.wVc(3,"localeCurrency"),e.C$Y(),e.yuY(4,bd,3,4,"vdr-labeled-data",1),e.I0R(5,"vdr-labeled-data",0),e.wVc(6,"translate"),e.wR5(7,"vdr-object-tree",2),e.C$Y()),2&t&&(e.E7m("label",e.kDX(1,5,"order.amount")),e.yG2(2),e.oRS(" ",e.g7$(3,7,o.refund.total,o.currencyCode),"\n"),e.yG2(2),e.E7m("ngIf",o.refund.transactionId),e.yG2(),e.E7m("label",e.kDX(6,10,"order.payment-metadata")),e.yG2(2),e.E7m("value",o.refund.metadata))},dependencies:[m.u_,h.a,ce.W,p.sD,g.u],changeDetection:0})}const Id=M.Ip`
|
|
69
|
-
query GetCustomerAddresses($customerId: ID!) {
|
|
70
|
-
customer(id: $customerId) {
|
|
71
|
-
id
|
|
72
|
-
addresses {
|
|
73
|
-
...Address
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
${d.Ssf}
|
|
78
|
-
`,Et=M.Ip`
|
|
79
|
-
query GetOrderState($id: ID!) {
|
|
80
|
-
order(id: $id) {
|
|
81
|
-
id
|
|
82
|
-
state
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
`;class T{constructor(n,t){this.dataService=n,this.router=t}canActivate(n,t){const o=t.url.includes("orders/draft"),i=t.url.includes("/modify"),a=n.paramMap.get("id");return o?"create"!==a||this.dataService.order.createDraftOrder().pipe((0,R.k)(({createDraftOrder:c})=>this.router.parseUrl(`/orders/draft/${c.id}`))):this.dataService.query(Et,{id:a}).single$.pipe((0,R.k)(({order:c})=>!("Modifying"===c?.state&&!i)||this.router.parseUrl(`/orders/${a}/modify`)))}static#e=this.\u0275fac=function(t){return new(t||T)(e.CoB(d.Aj0),e.CoB(k.E5))};static#t=this.\u0275prov=e.wxM({token:T,factory:T.\u0275fac,providedIn:"root"})}const Rt=r=>[{path:"",component:d.Y3i,data:{locationId:"order-list",breadcrumb:(0,u.s)("breadcrumb.orders")},children:r.getPageTabRoutes("order-list")},{path:"draft/:id",component:d.Y3i,canActivate:[T],data:{locationId:"draft-order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("draft-order-detail")},{path:":id",component:d.Y3i,canActivate:[T],data:{locationId:"order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":aggregateOrderId/seller-orders/:id",component:d.Y3i,canActivate:[T],data:{locationId:"order-detail",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":id/modify",component:d.Y3i,canActivate:[T],data:{locationId:"modify-order",breadcrumb:{label:(0,u.s)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("modify-order")}];class ie{static#e=this.hasRegisteredTabsAndBulkActions=!1;constructor(n){ie.hasRegisteredTabsAndBulkActions||(n.registerPageTab({priority:0,location:"order-list",tab:(0,u.s)("order.orders"),route:"",component:$e}),n.registerPageTab({priority:0,location:"order-detail",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:De,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>t?.type===d.aOe.Seller&&t?.aggregateOrder?[{label:`${t?.aggregateOrder?.code}`,link:["/orders/",t?.aggregateOrder?.id]},{label:(0,u.s)("breadcrumb.seller-orders"),link:["/orders/",t?.aggregateOrder?.id]},{label:`${t?.code}`,link:[t?.id]}]:[{label:`${t?.code}`,link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"draft-order-detail",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:fe,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>[{label:(0,u.s)("order.draft-order"),link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"modify-order",tab:(0,u.s)("order.order"),route:"",component:(0,d.AtG)({component:Fe,query:d.Mru,entityKey:"order",getBreadcrumbs:t=>[{label:t?.code||"order",link:["/orders/",t?.id]},{label:(0,u.s)("breadcrumb.modifying-order"),link:[t?.id]}]})}),ie.hasRegisteredTabsAndBulkActions=!0)}static#t=this.\u0275fac=function(t){return new(t||ie)(e.CoB(d.ucf))};static#n=this.\u0275mod=e.a4G({type:ie});static#r=this.\u0275inj=e.s3X({providers:[{provide:k.w9,useFactory:n=>Rt(n),multi:!0,deps:[d.ucf]}],imports:[d.kTg,k.qQ.forChild([])]})}}}]);
|
|
86
|
-
//# sourceMappingURL=72.09c197e199f1dc00.js.map
|