@vendure/admin-ui-plugin 2.0.0-next.21 → 2.0.0-next.23
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/165.6aeb6ecf722558ee.js.map +1 -1
- package/lib/admin-ui/{239.e2e63f2ccd517604.js → 239.bc59928cd01c7e91.js} +2 -2
- package/lib/admin-ui/{239.e2e63f2ccd517604.js.map → 239.bc59928cd01c7e91.js.map} +1 -1
- package/lib/admin-ui/26.6407e52b6e31b210.js +2 -0
- package/lib/admin-ui/26.6407e52b6e31b210.js.map +1 -0
- package/lib/admin-ui/{316.265d65a6a9d1b4c0.js → 316.d7ad74308299e698.js} +2 -2
- package/lib/admin-ui/{316.265d65a6a9d1b4c0.js.map → 316.d7ad74308299e698.js.map} +1 -1
- package/lib/admin-ui/{356.975f7f2d201afda5.js → 356.35ca041b6f7a6cc0.js} +2 -2
- package/lib/admin-ui/{356.975f7f2d201afda5.js.map → 356.35ca041b6f7a6cc0.js.map} +1 -1
- package/lib/admin-ui/430.827b68efffc7eada.js +65 -0
- package/lib/admin-ui/430.827b68efffc7eada.js.map +1 -0
- package/lib/admin-ui/496.e4c426e8cc0f3034.js +12 -0
- package/lib/admin-ui/496.e4c426e8cc0f3034.js.map +1 -0
- package/lib/admin-ui/625.ce0752367b2918a3.js +2 -0
- package/lib/admin-ui/625.ce0752367b2918a3.js.map +1 -0
- package/lib/admin-ui/654.d4c38af0c765576f.js +2 -0
- package/lib/admin-ui/654.d4c38af0c765576f.js.map +1 -0
- package/lib/admin-ui/i18n-messages/de.json +3 -1
- package/lib/admin-ui/i18n-messages/en.json +3 -1
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/main.75464c18bab13b01.js +2954 -0
- package/lib/admin-ui/main.75464c18bab13b01.js.map +1 -0
- package/lib/admin-ui/runtime.2d88c9597f145c74.js +2 -0
- package/lib/admin-ui/{runtime.28bd5da02a9b1f7b.js.map → runtime.2d88c9597f145c74.js.map} +1 -1
- package/lib/admin-ui/styles/_variables.scss +1 -0
- package/lib/src/plugin.js +2 -1
- package/lib/src/plugin.js.map +1 -1
- package/package.json +4 -4
- package/lib/admin-ui/26.5cc3bfffe8943e16.js +0 -2
- package/lib/admin-ui/26.5cc3bfffe8943e16.js.map +0 -1
- package/lib/admin-ui/407.a3fde1da25c0935c.js +0 -12
- package/lib/admin-ui/407.a3fde1da25c0935c.js.map +0 -1
- package/lib/admin-ui/451.a7fd4069c4f4c687.js +0 -65
- package/lib/admin-ui/451.a7fd4069c4f4c687.js.map +0 -1
- package/lib/admin-ui/600.17470a2c90aa79d8.js +0 -2
- package/lib/admin-ui/600.17470a2c90aa79d8.js.map +0 -1
- package/lib/admin-ui/625.3c0c5821b952b58e.js +0 -2
- package/lib/admin-ui/625.3c0c5821b952b58e.js.map +0 -1
- package/lib/admin-ui/main.65109179713dd228.js +0 -2944
- package/lib/admin-ui/main.65109179713dd228.js.map +0 -1
- package/lib/admin-ui/runtime.28bd5da02a9b1f7b.js +0 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[496],{7496:(Ca,ot,s)=>{s.r(ot),s.d(ot,{AddManualPaymentDialogComponent:()=>ue,CancelOrderDialogComponent:()=>_e,CouponCodeSelectorComponent:()=>G,DraftOrderDetailComponent:()=>ee,DraftOrderVariantSelectorComponent:()=>xe,FulfillOrderDialogComponent:()=>ve,FulfillmentCardComponent:()=>ye,FulfillmentDetailComponent:()=>te,FulfillmentStateLabelComponent:()=>Ce,GET_CUSTOMER_ADDRESSES:()=>lt,LineFulfillmentComponent:()=>K,LineRefundsComponent:()=>Y,ModificationDetailComponent:()=>Ze,NODE_HEIGHT:()=>tt,OrderCustomFieldsCardComponent:()=>z,OrderDetailComponent:()=>Me,OrderEditResultType:()=>J,OrderEditorComponent:()=>Je,OrderEditsPreviewDialogComponent:()=>Ne,OrderGuard:()=>$,OrderHistoryComponent:()=>qe,OrderHistoryEntryHostComponent:()=>Le,OrderListComponent:()=>Ue,OrderModule:()=>De,OrderPaymentCardComponent:()=>Se,OrderProcessEdgeComponent:()=>be,OrderProcessGraphComponent:()=>Oe,OrderProcessGraphDialogComponent:()=>Ae,OrderProcessNodeComponent:()=>ne,OrderResolver:()=>U,OrderStateSelectDialogComponent:()=>he,OrderTableComponent:()=>j,OrderTransitionService:()=>N,PaymentDetailComponent:()=>re,PaymentStateLabelComponent:()=>Fe,RefundOrderDialogComponent:()=>Te,RefundStateLabelComponent:()=>we,SelectAddressDialogComponent:()=>W,SelectCustomerDialogComponent:()=>ge,SelectShippingMethodDialogComponent:()=>fe,SettleRefundDialogComponent:()=>Ie,SimpleItemListComponent:()=>H,modifyingOrderBreadcrumb:()=>Tt,orderBreadcrumb:()=>$e,orderRoutes:()=>At});var l=s(587),e=s(3184),d=s(9950),I=s(309),Be=s(4652),L=s(8660),Z=s(7890),w=s(8318),f=s(7514),_=s(6362),v=s(4187);function It(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.add-payment-to-order"))}function Lt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.form.invalid||t.form.pristine),e.xp6(1),e.AsE(" ",e.lcZ(5,6,"order.add-payment")," (",e.xi3(6,8,t.outstandingAmount,t.currencyCode),") ")}}class ue{constructor(n){this.dataService=n,this.form=new l.cw({method:new l.NI("",l.kI.required),transactionId:new l.NI("",l.kI.required)})}ngOnInit(){this.paymentMethods$=this.dataService.settings.getPaymentMethods(999).mapSingle(n=>n.paymentMethods.items)}submit(){const n=this.form.value;this.resolveWith({method:n.method,transactionId:n.transactionId})}cancel(){this.resolveWith()}}ue.\u0275fac=function(n){return new(n||ue)(e.Y36(d.DoR))},ue.\u0275cmp=e.Xpm({type:ue,selectors:[["vdr-add-manual-payment-dialog"]],decls:10,vars:11,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","method",3,"label"],["bindLabel","code","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(n,t){1&n&&(e.YNc(0,It,2,3,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"ng-select",3),e.ALo(5,"async"),e.qZA(),e.TgZ(6,"vdr-form-field",4),e.ALo(7,"translate"),e._UZ(8,"input",5),e.qZA()(),e.YNc(9,Lt,7,11,"ng-template",6)),2&n&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,5,"order.payment-method")),e.xp6(2),e.Q6J("items",e.lcZ(5,7,t.paymentMethods$))("addTag",!0),e.xp6(2),e.Q6J("label",e.lcZ(7,9,"order.transaction-id")))},directives:[I.q,l._Y,l.JL,l.sg,Be.h,L.w9,l.JJ,l.u,Z.y,l.Fj,w.n],pipes:[f.X$,_.Ov,v.k],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0});var g=s(8270),p=s(2748),pe=s(1353);function qt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.cancel-order"))}function Ft(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",19),e.NdJ("ngModelChange",function(i){e.CHM(t);const a=e.oxw().$implicit;return e.oxw().lineQuantities[a.id]=i})("input",function(){return e.CHM(t),e.oxw(2).checkIfAllSelected()}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id])("disabled",o.cancelAll)("max",t.quantity)}}function wt(r,n){if(1&r&&e._uU(0),2&r){const t=e.oxw().$implicit;e.Oqu(t.quantity)}}function St(r,n){if(1&r&&(e.TgZ(0,"tr",10)(1,"td",11),e._UZ(2,"img",12),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",13),e._uU(5),e.qZA(),e.TgZ(6,"td",14),e._uU(7),e.qZA(),e.TgZ(8,"td",15),e._uU(9),e.qZA(),e.TgZ(10,"td",15),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA(),e.TgZ(13,"td",16),e.YNc(14,Ft,1,3,"input",17),e.YNc(15,wt,1,1,"ng-template",null,18,e.W1O),e.qZA()()),2&r){const t=n.$implicit,o=e.MAs(16),i=e.oxw();e.ekj("is-disabled",i.cancelAll)("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("src",e.xi3(3,11,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",e.xi3(12,14,t.unitPriceWithTax,i.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.quantity>0&&!i.order.active)("ngIfElse",o)}}function Mt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"clr-radio-wrapper")(2,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(3,"label"),e._uU(4),e.ALo(5,"translate"),e.qZA()(),e.TgZ(6,"clr-radio-wrapper")(7,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(8,"label"),e._uU(9),e.ALo(10,"translate"),e.qZA()(),e.BQk()}if(2&r){const t=e.oxw();e.xp6(2),e.Q6J("value",!0)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(5,6,"order.cancel-entire-order")),e.xp6(3),e.Q6J("value",!1)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(10,8,"order.cancel-specified-items"))}}function Nt(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-selected-items")," "))}function Jt(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-order")," "))}function Ut(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",21),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,Nt,3,3,"ng-container",6),e.YNc(5,Jt,3,3,"ng-container",6),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.reason||!t.order.active&&0===t.selectionCount),e.xp6(1),e.Q6J("ngIf",!t.order.active),e.xp6(1),e.Q6J("ngIf",t.order.active)}}class _e{constructor(n){var t;this.i18nService=n,this.cancelAll=!0,this.lineQuantities={},this.reasons=null!==(t=(0,d.hq7)().cancellationReasons)&&void 0!==t?t:[(0,g.J)("order.cancel-reason-customer-request"),(0,g.J)("order.cancel-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get selectionCount(){return Object.values(this.lineQuantities).reduce((n,t)=>n+t,0)}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},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(){var n;for(const[t,o]of Object.entries(this.lineQuantities)){const i=null===(n=this.order.lines.find(a=>a.id===t))||void 0===n?void 0:n.quantity;if(i&&o<i)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)}}_e.\u0275fac=function(n){return new(n||_e)(e.Y36(d.Dp7))},_e.\u0275cmp=e.Xpm({type:_e,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(n,t){1&n&&(e.YNc(0,qt,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,St,17,17,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e.YNc(24,Mt,11,10,"ng-container",6),e.TgZ(25,"label",7),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"ng-select",8),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.qZA()()(),e.YNc(29,Ut,6,6,"ng-template",9)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,11,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,13,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,15,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,17,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,19,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("ngIf",!0!==t.order.active),e.xp6(2),e.Oqu(e.lcZ(27,21,"order.cancellation-reason")),e.xp6(2),e.Q6J("items",t.reasons)("addTag",!0)("ngModel",t.reason))},directives:[I.q,_.sg,_.O5,Z.y,l.qQ,l.wV,l.Fd,l.Fj,l.JJ,l.On,p.EeQ,l._,p.asN,p.MgK,L.w9,w.n],pipes:[f.X$,pe.M,v.k],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-left: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 me=s(253),it=s(9319),Ge=s(8977),h=s(2673),S=s(635),at=s(4874),B=s(4447);function Dt(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA(),e._uU(2)),2&r){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(1),e.hij(" ",t.promotionName," ")}}class G{constructor(n){this.dataService=n,this.addCouponCode=new e.vpe,this.removeCouponCode=new e.vpe,this.couponCodeInput$=new me.x}ngOnInit(){var n;this.availableCouponCodes$=(0,it.z)(this.couponCodeInput$.pipe((0,Ge.x)(),(0,h.w)(t=>this.dataService.promotion.getPromotions(10,0,{couponCode:{contains:t}}).single$),(0,S.U)(({promotions:t})=>t.items.map(o=>({code:o.couponCode,promotionName:o.name}))),(0,at.O)([]))),this.control||(this.control=new l.NI(null!==(n=this.couponCodes)&&void 0!==n?n:[]))}}G.\u0275fac=function(n){return new(n||G)(e.Y36(d.DoR))},G.\u0275cmp=e.Xpm({type:G,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",""]],template:function(n,t){1&n&&(e.TgZ(0,"ng-select",0),e.NdJ("add",function(i){return t.addCouponCode.emit(i.code)})("remove",function(i){return t.removeCouponCode.emit(null==i.value?null:i.value.code)}),e.ALo(1,"async"),e.YNc(2,Dt,3,2,"ng-template",1),e.qZA()),2&n&&e.Q6J("items",e.lcZ(1,7,t.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",t.couponCodeInput$)("formControl",t.control)},directives:[L.w9,l.JJ,l.oH,L.ir,B.Y],pipes:[_.Ov],styles:[""],changeDetection:0});var Pt=s(6562),D=s(9295),Qt=s(1057),q=s(745),ke=s(9337);const lt=s(727).Ps`
|
|
2
|
+
query GetCustomerAddresses($customerId: ID!) {
|
|
3
|
+
customer(id: $customerId) {
|
|
4
|
+
id
|
|
5
|
+
addresses {
|
|
6
|
+
...Address
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
${d.UYy}
|
|
11
|
+
`;var ct=s(8147),dt=s(2448),Ee=s(9667),st=s(1480);function Et(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-address"))}function Yt(r,n){if(1&r&&(e.TgZ(0,"vdr-radio-card",7),e._UZ(1,"vdr-formatted-address",8),e.qZA()),2&r){const t=n.$implicit;e.Q6J("item",t),e.xp6(1),e.Q6J("address",t)}}function jt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-tab-content")(1,"vdr-radio-card-fieldset",5),e.NdJ("selectItem",function(i){e.CHM(t);return e.oxw(3).selectedAddress=i}),e.YNc(2,Yt,2,2,"vdr-radio-card",6),e.qZA()()}if(2&r){const t=e.oxw(2).ngIf,o=e.oxw();e.xp6(1),e.Q6J("idFn",o.addressIdFn)("selectedItemId",o.selectedAddress&&o.addressIdFn(o.selectedAddress)),e.xp6(1),e.Q6J("ngForOf",t)}}function Rt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-tab")(1,"button",3),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,jt,3,3,"ng-template",4),e.NdJ("clrIfActiveChange",function(i){e.CHM(t);return e.oxw(2).useExisting=i}),e.qZA()}if(2&r){const t=e.oxw(2);e.xp6(2),e.Oqu(e.lcZ(3,2,"order.existing-address")),e.xp6(2),e.Q6J("clrIfActive",t.useExisting)}}function Ht(r,n){if(1&r&&(e.TgZ(0,"clr-tab-content"),e._UZ(1,"vdr-address-form",9),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.addressForm)("availableCountries",e.lcZ(2,2,t.availableCountries$))}}function $t(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-tabs"),e.YNc(1,Rt,5,4,"clr-tab",1),e.TgZ(2,"clr-tab")(3,"button",3),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.YNc(6,Ht,3,4,"ng-template",4),e.NdJ("clrIfActiveChange",function(i){e.CHM(t);return e.oxw().createNew=i}),e.qZA()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.customerId&&t.length),e.xp6(3),e.Oqu(e.lcZ(5,3,"customer.create-new-address")),e.xp6(2),e.Q6J("clrIfActive",o.createNew)}}function Vt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.useExisting&&!t.selectedAddress||t.createNew&&t.addressForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.okay")," ")}}class W{constructor(n,t){this.dataService=n,this.formBuilder=t,this.useExisting=!0,this.createNew=!1}ngOnInit(){var n,t,o,i,a,c,u,m,x,y,O,A,oe,ie,ae,le,ce,de;this.addressForm=this.formBuilder.group({fullName:[null!==(t=null===(n=this.currentAddress)||void 0===n?void 0:n.fullName)&&void 0!==t?t:""],company:[null!==(i=null===(o=this.currentAddress)||void 0===o?void 0:o.company)&&void 0!==i?i:""],streetLine1:[null!==(c=null===(a=this.currentAddress)||void 0===a?void 0:a.streetLine1)&&void 0!==c?c:"",l.kI.required],streetLine2:[null!==(m=null===(u=this.currentAddress)||void 0===u?void 0:u.streetLine2)&&void 0!==m?m:""],city:[null!==(y=null===(x=this.currentAddress)||void 0===x?void 0:x.city)&&void 0!==y?y:"",l.kI.required],province:[null!==(A=null===(O=this.currentAddress)||void 0===O?void 0:O.province)&&void 0!==A?A:""],postalCode:[null!==(ie=null===(oe=this.currentAddress)||void 0===oe?void 0:oe.postalCode)&&void 0!==ie?ie:"",l.kI.required],countryCode:[null!==(le=null===(ae=this.currentAddress)||void 0===ae?void 0:ae.countryCode)&&void 0!==le?le:"",l.kI.required],phoneNumber:[null!==(de=null===(ce=this.currentAddress)||void 0===ce?void 0:ce.phoneNumber)&&void 0!==de?de:""]}),this.useExisting=!!this.customerId,this.addresses$=this.customerId?this.dataService.query(lt,{customerId:this.customerId}).mapSingle(({customer:T})=>{var F;return null!==(F=null==T?void 0:T.addresses)&&void 0!==F?F:[]}).pipe((0,ke.b)(T=>{this.currentAddress&&(this.selectedAddress=T.find(F=>{var se,V;return F.streetLine1===(null===(se=this.currentAddress)||void 0===se?void 0:se.streetLine1)&&F.postalCode===(null===(V=this.currentAddress)||void 0===V?void 0:V.postalCode)})),0===T.length&&(this.createNew=!0,this.useExisting=!1)})):(0,q.of)([]),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(({countries:T})=>T.items)}trackByFn(n){return n.id}addressIdFn(n){return n.streetLine1+n.postalCode}cancel(){this.resolveWith()}select(){if(this.useExisting&&this.selectedAddress&&this.resolveWith(Object.assign(Object.assign({},(0,Qt.e)(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)}}}W.\u0275fac=function(n){return new(n||W)(e.Y36(d.DoR),e.Y36(l.qu))},W.\u0275cmp=e.Xpm({type:W,selectors:[["vdr-select-address-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[4,"ngIf"],["vdrDialogButtons",""],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],[1,"block","mt4",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(n,t){1&n&&(e.YNc(0,Et,2,3,"ng-template",0),e.YNc(1,$t,7,5,"clr-tabs",1),e.ALo(2,"async"),e.YNc(3,Vt,6,7,"ng-template",2)),2&n&&(e.xp6(1),e.Q6J("ngIf",e.lcZ(2,1,t.addresses$)))},directives:[I.q,_.O5,p.gKI,p.dl,p.S4y,p.Iq$,p.Qs7,p.tam,p.UkA,ct.m,_.sg,dt.C,Ee.b,st.C,l.JL,l.sg,w.n],pipes:[f.X$,_.Ov],styles:[""],changeDetection:0});var We=s(1989),ut=s(3158);function Bt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.set-customer-for-order"))}function Gt(r,n){if(1&r&&(e._UZ(0,"clr-icon",7),e.TgZ(1,"span",8),e._uU(2),e.qZA(),e.TgZ(3,"vdr-chip"),e._uU(4),e.qZA()),2&r){const t=n.item;e.xp6(2),e.AsE("",t.firstName," ",t.lastName,""),e.xp6(2),e.Oqu(t.emailAddress)}}function Wt(r,n){if(1&r&&(e._UZ(0,"clr-icon",7),e.TgZ(1,"span",8),e._uU(2),e.qZA(),e.TgZ(3,"vdr-chip"),e._uU(4),e.qZA()),2&r){const t=n.item;e.xp6(2),e.AsE("",t.firstName," ",t.lastName,""),e.xp6(2),e.Oqu(t.emailAddress)}}function Xt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-tab-content")(1,"ng-select",4),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().selectedCustomer=i}),e.ALo(2,"async"),e.YNc(3,Gt,5,3,"ng-template",5),e.YNc(4,Wt,5,3,"ng-template",6),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("items",e.lcZ(2,9,t.customers$))("addTag",!1)("multiple",!0)("hideSelected",!0)("trackByFn",t.trackByFn)("minTermLength",2)("loading",t.isLoading)("typeahead",t.input$)("ngModel",t.selectedCustomer)}}function Kt(r,n){if(1&r&&(e.TgZ(0,"clr-tab-content")(1,"form",9)(2,"vdr-form-field",10),e.ALo(3,"translate"),e._UZ(4,"input",11),e.qZA(),e.TgZ(5,"vdr-form-field",12),e.ALo(6,"translate"),e._UZ(7,"input",13),e.qZA(),e.TgZ(8,"vdr-form-field",14),e.ALo(9,"translate"),e._UZ(10,"input",15),e.qZA(),e.TgZ(11,"vdr-form-field",16),e.ALo(12,"translate"),e._UZ(13,"input",17),e.qZA(),e.TgZ(14,"vdr-form-field",18),e.ALo(15,"translate"),e._UZ(16,"input",19),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("formGroup",t.customerForm),e.xp6(1),e.Q6J("label",e.lcZ(3,6,"customer.title")),e.xp6(3),e.Q6J("label",e.lcZ(6,8,"customer.first-name")),e.xp6(3),e.Q6J("label",e.lcZ(9,10,"customer.last-name")),e.xp6(3),e.Q6J("label",e.lcZ(12,12,"customer.email-address")),e.xp6(3),e.Q6J("label",e.lcZ(15,14,"customer.phone-number"))}}function zt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",21),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.useExisting&&0===t.selectedCustomer.length||t.createNew&&t.customerForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.okay")," ")}}class ge{constructor(n,t){this.dataService=n,this.formBuilder=t,this.isLoading=!1,this.input$=new me.x,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.customerForm=this.formBuilder.group({title:"",firstName:["",l.kI.required],lastName:["",l.kI.required],phoneNumber:"",emailAddress:["",[l.kI.required,l.kI.email]]})}ngOnInit(){this.customers$=(0,it.z)((0,q.of)([]),this.input$.pipe((0,We.b)(200),(0,Ge.x)(),(0,ke.b)(()=>this.isLoading=!0),(0,h.w)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,ut.K)(()=>(0,q.of)([])),(0,ke.b)(()=>this.isLoading=!1)))))}trackByFn(n){return n.id}cancel(){this.resolveWith()}select(){if(this.useExisting&&1===this.selectedCustomer.length&&this.resolveWith(this.selectedCustomer[0]),this.createNew&&this.customerForm.valid){const n=this.customerForm.value;this.resolveWith(n)}}}ge.\u0275fac=function(n){return new(n||ge)(e.Y36(d.DoR),e.Y36(l.qu))},ge.\u0275cmp=e.Xpm({type:ge,selectors:[["vdr-select-customer-dialog"]],decls:13,vars:8,consts:[["vdrDialogTitle",""],["clrTabLink",""],[3,"clrIfActive","clrIfActiveChange"],["vdrDialogButtons",""],["appendTo","body","bindLabel","name",1,"mt4",3,"items","addTag","multiple","hideSelected","trackByFn","minTermLength","loading","typeahead","ngModel","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],["shape","user",1,"is-solid"],[1,"ml2","mr2"],[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"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,Bt,2,3,"ng-template",0),e.TgZ(1,"clr-tabs")(2,"clr-tab")(3,"button",1),e._uU(4),e.ALo(5,"translate"),e.qZA(),e.YNc(6,Xt,5,11,"ng-template",2),e.NdJ("clrIfActiveChange",function(i){return t.useExisting=i}),e.qZA(),e.TgZ(7,"clr-tab")(8,"button",1),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.YNc(11,Kt,17,16,"ng-template",2),e.NdJ("clrIfActiveChange",function(i){return t.createNew=i}),e.qZA()(),e.YNc(12,zt,6,7,"ng-template",3)),2&n&&(e.xp6(4),e.Oqu(e.lcZ(5,4,"order.existing-customer")),e.xp6(2),e.Q6J("clrIfActive",t.useExisting),e.xp6(3),e.Oqu(e.lcZ(10,6,"customer.create-new-customer")),e.xp6(2),e.Q6J("clrIfActive",t.createNew))},directives:[I.q,p.gKI,p.dl,p.S4y,p.Iq$,p.Qs7,p.tam,p.UkA,L.w9,l.JJ,l.On,L.mR,p.qvL,B.Y,L.ir,l._Y,l.JL,l.sg,Be.h,Z.y,l.Fj,l.u,w.n],pipes:[f.X$,_.Ov],styles:[""],changeDetection:0});var X=s(7368),Ye=s(2702);function en(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-shipping-method"))}function tn(r,n){if(1&r&&e._UZ(0,"vdr-object-tree",9),2&r){const t=e.oxw().$implicit;e.Q6J("value",t.metadata)}}function nn(r,n){if(1&r&&(e.TgZ(0,"vdr-radio-card",4)(1,"div",5)(2,"vdr-labeled-data",6),e.ALo(3,"translate"),e._uU(4),e.qZA(),e.TgZ(5,"div",7)(6,"vdr-labeled-data",6),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA(),e.TgZ(10,"vdr-labeled-data",6),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.YNc(14,tn,1,1,"vdr-object-tree",8),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw();e.Q6J("item",t),e.xp6(2),e.Q6J("label",e.lcZ(3,8,"settings.shipping-method")),e.xp6(2),e.hij(" ",t.name," "),e.xp6(2),e.Q6J("label",e.lcZ(7,10,"common.price")),e.xp6(2),e.hij(" ",e.xi3(9,12,t.price,o.currencyCode)," "),e.xp6(2),e.Q6J("label",e.lcZ(11,15,"common.price-with-tax")),e.xp6(2),e.hij(" ",e.xi3(13,17,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.metadata)}}function rn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedMethod),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.okay")," ")}}class fe{constructor(){}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)}}fe.\u0275fac=function(n){return new(n||fe)},fe.\u0275cmp=e.Xpm({type:fe,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(n,t){1&n&&(e.YNc(0,en,2,3,"ng-template",0),e.TgZ(1,"vdr-radio-card-fieldset",1),e.NdJ("selectItem",function(i){return t.selectedMethod=i}),e.YNc(2,nn,15,20,"vdr-radio-card",2),e.qZA(),e.YNc(3,rn,6,7,"ng-template",3)),2&n&&(e.xp6(1),e.Q6J("idFn",t.methodIdFn)("selectedItemId",null==t.selectedMethod?null:t.selectedMethod.id),e.xp6(1),e.Q6J("ngForOf",t.eligibleShippingMethods))},directives:[I.q,ct.m,_.sg,dt.C,X.W,_.O5,Ye._,w.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var C=s(9720),P=s(591),on=s(1944),pt=s(3945);var ln=s(1339),M=s(858);function cn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-state"))}function dn(r,n){if(1&r&&(e.TgZ(0,"option",4),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA()),2&r){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.hij(" ",e.lcZ(2,2,e.lcZ(3,4,t))," ")}}function sn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"common.cancel")," "))}const un=function(r){return{state:r}};function pn(r,n){if(1&r){const t=e.EpF();e.YNc(0,sn,3,3,"button",5),e.TgZ(1,"button",6),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("ngIf",t.cancellable),e.xp6(1),e.Q6J("disabled",!t.selectedState),e.xp6(1),e.hij(" ",e.xi3(3,3,"order.transition-to-state",e.VKq(10,un,e.lcZ(4,6,e.lcZ(5,8,t.selectedState))))," ")}}class he{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}}he.\u0275fac=function(n){return new(n||he)},he.\u0275cmp=e.Xpm({type:he,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["clrSelect","","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(n,t){1&n&&(e.YNc(0,cn,2,3,"ng-template",0),e.TgZ(1,"p"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-select-container")(5,"select",1),e.NdJ("ngModelChange",function(i){return t.selectedState=i}),e.YNc(6,dn,4,6,"option",2),e.qZA()(),e.YNc(7,pn,6,12,"ng-template",3)),2&n&&(e.xp6(2),e.Oqu(e.lcZ(3,3,t.message)),e.xp6(3),e.Q6J("ngModel",t.selectedState),e.xp6(1),e.Q6J("ngForOf",t.nextStates))},directives:[I.q,p.dTv,Z.y,l.EJ,p.otW,l.JJ,l.On,_.sg,l.YN,l.Kr,w.n,_.O5],pipes:[f.X$,M.N],styles:[""],changeDetection:0});class N{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,h.w)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,g.J)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,ut.K)(a=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(he,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,h.w)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return P.E;throw new Error("An order state must be selected")}),function an(r){return(0,on.e)((n,t)=>{let o,a,i=!1;const c=()=>{o=n.subscribe((0,pt.x)(t,void 0,void 0,u=>{a||(a=new me.x,r(a).subscribe((0,pt.x)(t,()=>o?c():i=!0))),a&&a.next(u)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,ln.g)(2e3),(0,D.q)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:d.iYD.ORDER_STATE_TRANSITION}},sort:{createdAt:d.Asd.DESC}}).mapSingle(t=>t.order).pipe((0,S.U)(t=>{const o=null==t?void 0: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,S.U)(({transitionOrderToState:o})=>{switch(null==o?void 0:o.__typename){case"Order":return null==o?void 0:o.state;case"OrderStateTransitionError":throw this.notificationService.error(null==o?void 0:o.transitionError),new Error(null==o?void 0:o.transitionError)}}))}}N.\u0275fac=function(n){return new(n||N)(e.LFG(d.DoR),e.LFG(d.Z7U),e.LFG(d.gqp),e.LFG(d.Dp7))},N.\u0275prov=e.Yz7({token:N,factory:N.\u0275fac,providedIn:"root"});var b=s(7346),Xe=s(3146),je=s(5886),Q=s(735),k=s(1519),E=s(8854),Pe=s(5111),_t=s(5983),Re=s(2231);function _n(r,n){if(1&r&&(e.TgZ(0,"div",16),e._UZ(1,"vdr-custom-field-control",17),e.qZA()),2&r){const t=n.$implicit,o=e.oxw(3);e.xp6(1),e.Q6J("compact",!0)("readonly",!1)("customField",t)("customFieldsFormGroup",o.customFieldsFormGroup)}}function mn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,_n,2,4,"div",15),e.BQk()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function gn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",1)(1,"div",5),e._UZ(2,"img",6),e.ALo(3,"assetPreview"),e.TgZ(4,"div",7)(5,"div"),e._uU(6),e.qZA(),e.TgZ(7,"div",8),e._uU(8),e.qZA()(),e.TgZ(9,"div",9)(10,"div",8),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"div",8),e._uU(14),e.ALo(15,"translate"),e.qZA()(),e._UZ(16,"div",10),e.TgZ(17,"div",7)(18,"div"),e._uU(19),e.ALo(20,"localeCurrency"),e.qZA(),e.TgZ(21,"div",11),e.ALo(22,"translate"),e._uU(23),e.ALo(24,"localeCurrency"),e.qZA()(),e.TgZ(25,"div")(26,"input",12),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().quantity=i}),e.qZA()(),e.TgZ(27,"button",13),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().addItemClick(a)}),e._uU(28),e.ALo(29,"translate"),e.qZA()(),e.YNc(30,mn,2,1,"ng-container",14),e.qZA()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(2),e.Q6J("src",e.xi3(3,15,t.featuredAsset||t.product.featuredAsset,32),e.LSH),e.xp6(4),e.Oqu(null==t?null:t.name),e.xp6(2),e.Oqu(null==t?null:t.sku),e.xp6(3),e.AsE(" ",e.lcZ(12,18,"catalog.stock-on-hand"),": ",t.stockOnHand," "),e.xp6(3),e.AsE(" ",e.lcZ(15,20,"catalog.stock-allocated"),": ",t.stockAllocated," "),e.xp6(5),e.Oqu(e.xi3(20,22,null==t?null:t.priceWithTax,o.currencyCode)),e.xp6(2),e.Q6J("title",e.lcZ(22,25,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(24,27,null==t?null:t.price,o.currencyCode)," "),e.xp6(3),e.Q6J("disabled",!t)("ngModel",o.quantity),e.xp6(1),e.Q6J("disabled",!t),e.xp6(1),e.hij(" ",e.lcZ(29,30,"order.add-item-to-order")," "),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length)}}class xe{constructor(n){this.dataService=n,this.addItem=new e.vpe,this.customFieldsFormGroup=new l.cw({}),this.selectedVariantId$=new me.x,this.quantity=1}ngOnInit(){this.selectedVariant$=this.selectedVariantId$.pipe((0,h.w)(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.NI(""))}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())}}xe.\u0275fac=function(n){return new(n||xe)(e.Y36(d.DoR))},xe.\u0275cmp=e.Xpm({type:xe,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,"mr2",3,"src"],[1,"details"],[1,"small"],[1,"details","ml4"],[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(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"h4",2),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"vdr-product-variant-selector",3),e.NdJ("productSelected",function(i){return t.selectedVariantId$.next(i.productVariantId)}),e.qZA()(),e.YNc(6,gn,31,32,"div",4),e.ALo(7,"async"),e.qZA()),2&n&&(e.xp6(3),e.Oqu(e.lcZ(4,2,"order.add-item-to-order")),e.xp6(3),e.Q6J("ngIf",e.lcZ(7,4,t.selectedVariant$)))},directives:[_t.e,_.O5,Z.y,l.qQ,l.wV,l.Fj,l.JJ,l.On,_.sg,Re.M],pipes:[f.X$,_.Ov,pe.M,v.k],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});var mt=s(1588);const fn=function(r){return{count:r}};function hn(r,n){if(1&r&&(e.TgZ(0,"span",1),e.ALo(1,"translate"),e._UZ(2,"clr-icon",2),e.qZA()),2&r){const t=e.oxw();e.Q6J("title",e.xi3(1,1,"order.refunded-count",e.VKq(4,fn,t.getRefundedCount())))}}class Y{getRefundedCount(){var n,t;const o=null!==(t=null===(n=this.payments)||void 0===n?void 0:n.reduce((i,a)=>[...i,...a.refunds],[]))&&void 0!==t?t:[];return this.line.items.filter(i=>{if(null===i.refundId&&!i.cancelled)return!1;if(i.refundId){const a=o.find(c=>c.id===i.refundId);return"Failed"!==(null==a?void 0:a.state)}return!1}).length}}Y.\u0275fac=function(n){return new(n||Y)},Y.\u0275cmp=e.Xpm({type:Y,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(n,t){1&n&&e.YNc(0,hn,3,6,"span",0),2&n&&e.Q6J("ngIf",t.getRefundedCount())},directives:[_.O5,p.qvL,mt.Lv],pipes:[f.X$],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});var He=s(2651);function xn(r,n){1&r&&e._UZ(0,"clr-icon",9)}function vn(r,n){1&r&&e._UZ(0,"clr-icon",10)}function Cn(r,n){1&r&&e._UZ(0,"clr-icon",11)}function yn(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-all")," "))}const Zn=function(r,n){return{total:r,count:n}};function bn(r,n){if(1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.line-fulfillment-partial",e.WLB(4,Zn,t.line.quantity,t.fulfilledCount))," ")}}function On(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-none")," "))}function An(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",15),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",t.fulfillment.trackingCode," ")}}const Tn=function(r){return{count:r}};function In(r,n){if(1&r&&(e.TgZ(0,"div",13)(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"vdr-labeled-data",15),e.ALo(6,"translate"),e._uU(7),e.ALo(8,"localeDate"),e.qZA(),e.TgZ(9,"vdr-labeled-data",15),e.ALo(10,"translate"),e._uU(11),e.qZA(),e.YNc(12,An,3,4,"vdr-labeled-data",16),e.qZA()),2&r){const t=n.$implicit;e.xp6(2),e.lnq(" ",e.lcZ(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.xi3(4,10,"order.item-count",e.VKq(20,Tn,t.count)),") "),e.xp6(3),e.Q6J("label",e.lcZ(6,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(8,15,t.fulfillment.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(10,18,"order.fulfillment-method")),e.xp6(2),e.hij(" ",t.fulfillment.method," "),e.xp6(1),e.Q6J("ngIf",t.fulfillment.trackingCode)}}function Ln(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown",1)(1,"button",2),e.YNc(2,xn,1,0,"clr-icon",3),e.YNc(3,vn,1,0,"clr-icon",4),e.YNc(4,Cn,1,0,"clr-icon",5),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",6),e.YNc(6,yn,3,3,"label",7),e.YNc(7,bn,3,7,"label",7),e.YNc(8,On,3,3,"label",7),e.YNc(9,In,13,22,"div",8),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class K{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.items.length),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.reduce((i,a)=>{var c,u;return i+(null!==(u=null===(c=a.summary.find(m=>m.orderLine.id===n.id))||void 0===c?void 0:c.quantity)&&void 0!==u?u:0)},0))&&void 0!==o?o:0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(i=>{var a;const c=i.summary.find(u=>u.orderLine.id===n.id);return{count:null!==(a=null==c?void 0:c.quantity)&&void 0!==a?a:0,fulfillment:i}}))&&void 0!==o?o:[]}}function qn(r,n){if(1&r&&(e._UZ(0,"img",24),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function Fn(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",t.quantity," ")}}function wn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",25)(1,"input",26,27),e.NdJ("blur",function(){e.CHM(t);const i=e.MAs(2),a=e.oxw().$implicit;return e.oxw().draftInputBlur(a,i.valueAsNumber)}),e.qZA(),e.TgZ(3,"button",28),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().remove.emit({lineId:i.id})}),e._UZ(4,"clr-icon",29),e.qZA()()}if(2&r){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("value",t.quantity)}}function Sn(r,n){if(1&r&&(e.TgZ(0,"div",32)(1,"a",33),e._uU(2),e.qZA(),e.TgZ(3,"div",34),e._uU(4),e.ALo(5,"localeCurrency"),e.TgZ(6,"div",7),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw(4);e.xp6(1),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(2),e.hij(" ",e.xi3(5,5,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(7,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(9,10,t.amount,o.order.currencyCode)," ")}}function Mn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",30),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,Sn,10,13,"div",31),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.promotions-applied")," "),e.xp6(3),e.Q6J("ngForOf",t)}}function Nn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Mn,6,4,"vdr-dropdown",23),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Jn(r,n){if(1&r&&(e.TgZ(0,"div",38),e._UZ(1,"vdr-custom-field-control",39),e.qZA()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("compact",!0)("readonly",!0)("customField",t.config)("customFieldsFormGroup",t.formGroup)}}function Un(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td",35)(2,"div",36),e.YNc(3,Jn,2,4,"div",37),e.qZA()()()),2&r){const t=e.oxw().ngIf;e.xp6(3),e.Q6J("ngForOf",t)}}function Dn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Un,4,1,"tr",23),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Pn(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"tr",11)(2,"td",12),e.YNc(3,qn,2,4,"img",13),e.qZA(),e.TgZ(4,"td",14),e._uU(5),e.qZA(),e.TgZ(6,"td",15),e._uU(7),e.qZA(),e.TgZ(8,"td",16),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",7),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()(),e.TgZ(15,"td",17),e.YNc(16,Fn,2,1,"ng-container",18),e.YNc(17,wn,5,1,"ng-template",null,19,e.W1O),e._UZ(19,"vdr-line-refunds",20)(20,"vdr-line-fulfillment",21),e.qZA(),e.TgZ(21,"td",22),e._uU(22),e.ALo(23,"localeCurrency"),e.TgZ(24,"div",7),e.ALo(25,"translate"),e._uU(26),e.ALo(27,"localeCurrency"),e.qZA(),e.YNc(28,Nn,2,1,"ng-container",23),e.qZA()(),e.YNc(29,Dn,2,1,"ng-container",23),e.BQk()),2&r){const t=n.$implicit,o=e.MAs(18),i=e.oxw();e.xp6(1),e.ekj("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(10,19,t.unitPriceWithTax,i.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,24,t.unitPrice,i.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",!i.isDraft)("ngIfElse",o),e.xp6(3),e.Q6J("line",t)("payments",i.order.payments),e.xp6(1),e.Q6J("line",t)("orderState",i.order.state),e.xp6(2),e.hij(" ",e.xi3(23,27,t.linePriceWithTax,i.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(25,30,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(27,32,t.linePrice,i.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",i.getLineDiscounts(t)),e.xp6(1),e.Q6J("ngIf",i.customFieldsForLine[t.id])}}function Qn(r,n){if(1&r&&(e.TgZ(0,"tr",40)(1,"td",41),e._uU(2),e.qZA(),e.TgZ(3,"td",15),e._uU(4),e.qZA(),e._UZ(5,"td",42),e.TgZ(6,"td",22),e._uU(7),e.ALo(8,"localeCurrency"),e.TgZ(9,"div",7),e.ALo(10,"translate"),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.hij(" ",e.xi3(8,5,t.priceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(10,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(12,10,t.price,o.order.currencyCode)," ")}}function kn(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA()),2&r){const t=n.ngIf;e.xp6(1),e.Oqu(t)}}function En(r,n){if(1&r&&(e.TgZ(0,"tr",44)(1,"td",45)(2,"a",46),e._uU(3),e.qZA(),e.YNc(4,kn,2,1,"vdr-chip",23),e.qZA(),e.TgZ(5,"td",6),e._uU(6),e.ALo(7,"localeCurrency"),e.TgZ(8,"div",7),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(2),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(1),e.Q6J("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.xp6(2),e.hij(" ",e.xi3(7,6,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(9,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(11,11,t.amount,o.order.currencyCode)," ")}}function Yn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,En,12,14,"tr",43),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("ngIf","OTHER"!==t.type)}}K.\u0275fac=function(n){return new(n||K)},K.\u0275cmp=e.Xpm({type:K,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",orderState:"orderState"},features:[e.TTD],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(n,t){1&n&&e.YNc(0,Ln,10,7,"vdr-dropdown",0),2&n&&e.Q6J("ngIf",t.fulfilledCount||"PartiallyDelivered"===t.orderState)},directives:[_.O5,Q.J,k.U,p.qvL,E.N,p.MgK,_.sg,X.W],pipes:[f.X$,He.H],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-500)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-500)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-500)}.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});class j{constructor(){this.isDraft=!1,this.adjust=new e.vpe,this.remove=new e.vpe,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.S2X.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new l.cw({}),o=this.orderLineCustomFields.map(i=>{const a=n.customFields[i.name];return t.addControl(i.name,new l.NI(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(", "):""}}j.\u0275fac=function(n){return new(n||j)},j.\u0275cmp=e.Xpm({type:j,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields",isDraft:"isDraft"},outputs:{adjust:"adjust",remove:"remove"},decls:61,vars:61,consts:[[1,"order-table","table"],[4,"ngFor","ngForOf"],["class","surcharge",4,"ngFor","ngForOf"],[1,"sub-total"],[1,"left","clr-align-middle"],["colspan","4"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["colspan","3"],[1,"total"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],[4,"ngIf","ngIfElse"],["draft",""],[3,"line","payments"],[3,"line","orderState"],[1,"align-middle","total"],[4,"ngIf"],[3,"src"],[1,"flex"],["type","number","min","0",1,"draft-qty",3,"value","blur"],["qtyInput",""],[1,"icon-button",3,"click"],["shape","trash"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"],["colspan","6",1,"custom-fields-row"],[1,"order-line-custom-fields"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],["colspan","2",1,"align-middle"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],["colspan","5",1,"left","clr-align-middle"],[3,"routerLink"]],template:function(n,t){1&n&&(e.TgZ(0,"table",0)(1,"thead")(2,"tr"),e._UZ(3,"th"),e.TgZ(4,"th"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"tbody"),e.YNc(20,Pn,30,35,"ng-container",1),e.YNc(21,Qn,13,13,"tr",2),e.YNc(22,Yn,2,1,"ng-container",1),e.TgZ(23,"tr",3)(24,"td",4),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"td",5),e.TgZ(28,"td",6),e._uU(29),e.ALo(30,"localeCurrency"),e.TgZ(31,"div",7),e.ALo(32,"translate"),e._uU(33),e.ALo(34,"localeCurrency"),e.qZA()()(),e.TgZ(35,"tr",8)(36,"td",4),e._uU(37),e.ALo(38,"translate"),e.qZA(),e.TgZ(39,"td",6),e._uU(40),e.qZA(),e._UZ(41,"td",9),e.TgZ(42,"td",6),e._uU(43),e.ALo(44,"localeCurrency"),e.TgZ(45,"div",7),e.ALo(46,"translate"),e._uU(47),e.ALo(48,"localeCurrency"),e.qZA()()(),e.TgZ(49,"tr",10)(50,"td",4),e._uU(51),e.ALo(52,"translate"),e.qZA(),e._UZ(53,"td",5),e.TgZ(54,"td",6),e._uU(55),e.ALo(56,"localeCurrency"),e.TgZ(57,"div",7),e.ALo(58,"translate"),e._uU(59),e.ALo(60,"localeCurrency"),e.qZA()()()()()),2&n&&(e.xp6(5),e.Oqu(e.lcZ(6,21,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(9,23,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(12,25,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(15,27,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,29,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.Q6J("ngForOf",t.order.surcharges),e.xp6(1),e.Q6J("ngForOf",t.order.discounts),e.xp6(3),e.Oqu(e.lcZ(26,31,"order.sub-total")),e.xp6(4),e.hij(" ",e.xi3(30,33,t.order.subTotalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(32,36,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(34,38,t.order.subTotal,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(38,41,"order.shipping")),e.xp6(3),e.Oqu(t.getShippingNames(t.order)),e.xp6(3),e.hij(" ",e.xi3(44,43,t.order.shippingWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(46,46,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(48,48,t.order.shipping,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(52,51,"order.total")),e.xp6(4),e.hij(" ",e.xi3(56,53,t.order.totalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(58,56,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(60,58,t.order.total,t.order.currencyCode)," "))},directives:[_.sg,_.O5,Z.y,p.qvL,Y,K,Q.J,k.U,E.N,C.yS,Re.M,B.Y],pipes:[f.X$,pe.M,v.k],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-right: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)}.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} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-left:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0});var Ke=s(458),gt=s(837);function jn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){e.CHM(t);return e.oxw(2).editable=!0}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.edit")," "))}function Rn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onUpdateClick()}),e._UZ(1,"clr-icon",12),e._uU(2),e.ALo(3,"translate"),e.qZA()}if(2&r){const t=e.oxw(2);e.Q6J("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.xp6(2),e.hij(" ",e.lcZ(3,2,"common.update")," ")}}function Hn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onCancelClick()}),e._UZ(1,"clr-icon",13),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.cancel")," "))}function $n(r,n){if(1&r&&(e.TgZ(0,"div",1)(1,"div",2),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",3)(5,"div",4),e._UZ(6,"vdr-tabbed-custom-fields",5),e.qZA()(),e.TgZ(7,"div",6),e.YNc(8,jn,4,3,"button",7),e.YNc(9,Rn,4,4,"button",8),e.YNc(10,Hn,4,3,"button",7),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,10,"common.custom-fields")," "),e.xp6(3),e.ekj("editable",t.editable),e.xp6(1),e.Q6J("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.xp6(2),e.Q6J("ngIf",!t.editable),e.xp6(1),e.Q6J("ngIf",t.editable),e.xp6(1),e.Q6J("ngIf",t.editable)}}class z{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e.vpe,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,g.J)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,g.J)("common.keep-editing")},{type:"danger",label:(0,g.J)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}}function Vn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e._UZ(5,"vdr-order-state-label",3),e.qZA()(),e.TgZ(6,"vdr-ab-right")(7,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().completeOrder()}),e._UZ(8,"clr-icon",5),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"vdr-dropdown")(12,"button",6),e._UZ(13,"clr-icon",7),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",8)(15,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().deleteOrder()}),e._UZ(16,"clr-icon",10),e._uU(17),e.ALo(18,"translate"),e.qZA()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("entity",e.lcZ(4,5,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(2),e.Q6J("disabled",!t.customer||!t.lines.length||!t.shippingLines.length),e.xp6(2),e.hij(" ",e.lcZ(10,7,"order.complete-draft-order")," "),e.xp6(8),e.hij(" ",e.lcZ(18,9,"order.delete-draft-order")," ")}}function Bn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.displayCouponCodeInput=!i.displayCouponCodeInput}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.set-coupon-codes")," "))}function Gn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-coupon-code-selector",31),e.NdJ("addCouponCode",function(i){return e.CHM(t),e.oxw(2).applyCouponCode(i)})("removeCouponCode",function(i){return e.CHM(t),e.oxw(2).removeCouponCode(i)}),e.qZA()()}if(2&r){const t=e.oxw().ngIf;e.xp6(2),e.Oqu(e.lcZ(3,2,"order.set-coupon-codes")),e.xp6(2),e.Q6J("couponCodes",t.couponCodes)}}function Wn(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.ALo(5,"percent"),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw(2).ngIf;e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(e.lcZ(5,4,t.taxRate/100)),e.xp6(3),e.Oqu(e.xi3(8,6,t.taxBase,o.currencyCode)),e.xp6(3),e.Oqu(e.xi3(11,9,t.taxTotal,o.currencyCode))}}function Xn(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"h4"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"table",32)(5,"thead")(6,"tr")(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"tbody"),e.YNc(20,Wn,12,12,"tr",28),e.qZA()(),e.BQk()),2&r){const t=e.oxw().ngIf;e.xp6(2),e.Oqu(e.lcZ(3,6,"order.tax-summary")),e.xp6(6),e.Oqu(e.lcZ(9,8,"common.description")),e.xp6(3),e.Oqu(e.lcZ(12,10,"order.tax-rate")),e.xp6(3),e.Oqu(e.lcZ(15,12,"order.tax-base")),e.xp6(3),e.Oqu(e.lcZ(18,14,"order.tax-total")),e.xp6(3),e.Q6J("ngForOf",t.taxSummary)}}function Kn(r,n){1&r&&e._UZ(0,"clr-icon",33)}function zn(r,n){1&r&&e._UZ(0,"clr-icon",34)}function er(r,n){if(1&r&&e._UZ(0,"vdr-customer-label",35),2&r){const t=e.oxw().ngIf;e.Q6J("customer",t.customer)}}function tr(r,n){1&r&&e._UZ(0,"clr-icon",33)}function nr(r,n){1&r&&e._UZ(0,"clr-icon",34)}function rr(r,n){if(1&r&&e._UZ(0,"vdr-formatted-address",36),2&r){const t=e.oxw().ngIf;e.Q6J("address",t.billingAddress)}}function or(r,n){1&r&&e._UZ(0,"clr-icon",33)}function ir(r,n){1&r&&e._UZ(0,"clr-icon",34)}function ar(r,n){if(1&r&&e._UZ(0,"vdr-formatted-address",36),2&r){const t=e.oxw().ngIf;e.Q6J("address",t.shippingAddress)}}function lr(r,n){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=n.$implicit;e.xp6(1),e.hij(" ",t.shippingMethod.name," ")}}function cr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",11)(2,"div",12)(3,"vdr-draft-order-variant-selector",13),e.NdJ("addItem",function(i){return e.CHM(t),e.oxw().addItemToOrder(i)}),e.qZA(),e.TgZ(4,"vdr-order-table",14),e.NdJ("adjust",function(i){return e.CHM(t),e.oxw().adjustOrderLine(i)})("remove",function(i){return e.CHM(t),e.oxw().removeOrderLine(i)}),e.qZA(),e.TgZ(5,"div",15),e.YNc(6,Bn,3,3,"button",16),e.YNc(7,Gn,5,4,"div",0),e.qZA(),e.YNc(8,Xn,21,16,"ng-container",0),e.qZA(),e.TgZ(9,"div",17)(10,"div",18)(11,"div",19),e.YNc(12,Kn,1,0,"clr-icon",20),e.YNc(13,zn,1,0,"clr-icon",21),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"div",22)(17,"div",23),e.YNc(18,er,1,1,"vdr-customer-label",24),e.TgZ(19,"button",25),e.NdJ("click",function(){return e.CHM(t),e.oxw().setCustomer()}),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.TgZ(22,"div",22)(23,"h4",26),e.YNc(24,tr,1,0,"clr-icon",20),e.YNc(25,nr,1,0,"clr-icon",21),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"div",23),e.YNc(29,rr,1,1,"vdr-formatted-address",27),e.TgZ(30,"button",25),e.NdJ("click",function(){return e.CHM(t),e.oxw().setBillingAddress()}),e._uU(31),e.ALo(32,"translate"),e.qZA()()()(),e.TgZ(33,"div",18)(34,"div",19),e.YNc(35,or,1,0,"clr-icon",20),e.YNc(36,ir,1,0,"clr-icon",21),e._uU(37),e.ALo(38,"translate"),e.qZA(),e.TgZ(39,"div",22)(40,"div",23),e.YNc(41,ar,1,1,"vdr-formatted-address",27),e.TgZ(42,"button",25),e.NdJ("click",function(){return e.CHM(t),e.oxw().setShippingAddress()}),e._uU(43),e.ALo(44,"translate"),e.qZA()()(),e.TgZ(45,"div",22)(46,"div",23),e.YNc(47,lr,2,1,"div",28),e.TgZ(48,"button",25),e.NdJ("click",function(){return e.CHM(t),e.oxw().setShippingMethod()}),e._uU(49),e.ALo(50,"translate"),e.qZA()()()(),e.TgZ(51,"vdr-order-custom-fields-card",29),e.NdJ("updateClick",function(i){return e.CHM(t),e.oxw().updateCustomFields(i)}),e.qZA()()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("orderLineCustomFields",o.orderLineCustomFields)("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("order",t)("orderLineCustomFields",o.orderLineCustomFields)("isDraft",!0),e.xp6(2),e.Q6J("ngIf",0===t.couponCodes.length&&!o.displayCouponCodeInput),e.xp6(1),e.Q6J("ngIf",t.couponCodes.length||o.displayCouponCodeInput),e.xp6(1),e.Q6J("ngIf",t.taxSummary.length),e.xp6(4),e.Q6J("ngIf",!t.customer),e.xp6(1),e.Q6J("ngIf",t.customer),e.xp6(1),e.hij(" ",e.lcZ(15,27,"order.customer")," "),e.xp6(4),e.Q6J("ngIf",t.customer),e.xp6(2),e.hij(" ",e.lcZ(21,29,"order.set-customer-for-order")," "),e.xp6(4),e.Q6J("ngIf",!t.billingAddress.streetLine1),e.xp6(1),e.Q6J("ngIf",t.billingAddress.streetLine1),e.xp6(1),e.hij(" ",e.lcZ(27,31,"order.billing-address")," "),e.xp6(3),e.Q6J("ngIf",t.billingAddress),e.xp6(2),e.hij(" ",e.lcZ(32,33,"order.set-billing-address")," "),e.xp6(4),e.Q6J("ngIf",!t.shippingAddress.streetLine1||!t.shippingLines.length),e.xp6(1),e.Q6J("ngIf",t.shippingAddress.streetLine1&&t.shippingLines.length),e.xp6(1),e.hij(" ",e.lcZ(38,35,"order.shipping")," "),e.xp6(4),e.Q6J("ngIf",t.shippingAddress),e.xp6(2),e.hij(" ",e.lcZ(44,37,"order.set-shipping-address")," "),e.xp6(4),e.Q6J("ngForOf",t.shippingLines),e.xp6(2),e.hij(" ",e.lcZ(50,39,"order.set-shipping-method")," "),e.xp6(2),e.Q6J("customFieldsConfig",o.customFields)("customFieldValues",t.customFields)}}z.\u0275fac=function(n){return new(n||z)(e.Y36(l.qu),e.Y36(d.Z7U))},z.\u0275cmp=e.Xpm({type:z,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(n,t){1&n&&e.YNc(0,$n,11,12,"div",0),2&n&&e.Q6J("ngIf",t.customFieldsConfig.length)},directives:[_.O5,gt.y,p.qvL],pipes:[f.X$],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});class ee extends d.UT_{constructor(n,t,o,i,a,c,u,m){super(t,n,o,a),this.changeDetector=i,this.dataService=a,this.notificationService=c,this.modalService=u,this.orderTransitionService=m,this.detailForm=new l.cw({}),this.fetchHistory=new me.x,this.displayCouponCodeInput=!1}ngOnInit(){this.init(),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.eligibleShippingMethods$=this.entity$.pipe((0,h.w)(n=>this.dataService.order.getDraftOrderEligibleShippingMethods(n.id).mapSingle(({eligibleShippingMethodsForDraftOrder:t})=>t))),this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine")}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(ge).subscribe(n=>{this.hasId(n)?this.dataService.order.setCustomerForDraftOrder(this.id,{customerId:n.id}).subscribe():n&&this.dataService.order.setCustomerForDraftOrder(this.id,{input:n}).subscribe()})}setShippingAddress(){this.entity$.pipe((0,D.q)(1),(0,h.w)(n=>{var t,o;return this.modalService.fromComponent(W,{locals:{customerId:null===(t=n.customer)||void 0===t?void 0:t.id,currentAddress:null!==(o=n.shippingAddress)&&void 0!==o?o:void 0}})})).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingAddress(this.id,n).subscribe()})}setBillingAddress(){this.entity$.pipe((0,D.q)(1),(0,h.w)(n=>{var t,o;return this.modalService.fromComponent(W,{locals:{customerId:null===(t=n.customer)||void 0===t?void 0:t.id,currentAddress:null!==(o=n.billingAddress)&&void 0!==o?o: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,Pt.a)(this.entity$,this.eligibleShippingMethods$).pipe((0,D.q)(1),(0,h.w)(([n,t])=>{var o,i;return this.modalService.fromComponent(fe,{locals:{eligibleShippingMethods:t,currencyCode:n.currencyCode,currentSelectionId:null===(i=null===(o=n.shippingLines)||void 0===o?void 0:o[0])||void 0===i?void 0:i.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.PcR.DELETED?(this.notificationService.success((0,g.J)("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"===(null==n?void 0:n.__typename)?this.router.navigate(["/orders",this.id]):"OrderStateTransitionError"===(null==n?void 0:n.__typename)&&this.notificationService.error(n.transitionError)})}hasId(n){return"object"==typeof n&&!!n.id}setFormValues(n){}}ee.\u0275fac=function(n){return new(n||ee)(e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(N))},ee.\u0275cmp=e.Xpm({type:ee,selectors:[["vdr-draft-order-detail"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"btn","btn-primary",3,"disabled","click"],["shape","check"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],["shape","trash",1,"is-danger"],[1,"clr-row"],[1,"clr-col-lg-8"],[3,"orderLineCustomFields","currencyCode","addItem"],[3,"order","orderLineCustomFields","isDraft","adjust","remove"],[1,"flex"],["class","btn btn-link btn-sm mr2",3,"click",4,"ngIf"],[1,"clr-col-lg-4","order-cards"],[1,"card"],[1,"card-header"],["shape","unknown-status","class","is-warning",4,"ngIf"],["shape","check","class","is-success",4,"ngIf"],[1,"card-block"],[1,"card-text"],["class","block mb2",3,"customer",4,"ngIf"],[1,"btn","btn-link","btn-sm",3,"click"],[1,"card-title"],["class","block mb2",3,"address",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"customFieldsConfig","customFieldValues","updateClick"],[1,"btn","btn-link","btn-sm","mr2",3,"click"],[3,"couponCodes","addCouponCode","removeCouponCode"],[1,"table"],["shape","unknown-status",1,"is-warning"],["shape","check",1,"is-success"],[1,"block","mb2",3,"customer"],[1,"block","mb2",3,"address"]],template:function(n,t){1&n&&(e.YNc(0,Vn,19,11,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,cr,52,41,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[_.O5,b.Kk,b.BN,Xe.V,je.G,b.mz,p.qvL,Q.J,k.U,E.N,Pe.H,xe,j,p.MgK,G,_.sg,Ke.d,Ee.b,z],pipes:[_.Ov,f.X$,_.Zx,v.k],styles:[""],changeDetection:0});var dr=s(8931);function sr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.fulfill-order"))}function ur(r,n){if(1&r&&(e._UZ(0,"img",17),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function pr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(t);const a=e.oxw().$implicit;return e.oxw().fulfillmentQuantities[a.id].fulfillCount=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.getUnfulfilledCount(t))("ngModel",o.fulfillmentQuantities[t.id].fulfillCount)("max",o.fulfillmentQuantities[t.id].max)}}function _r(r,n){if(1&r&&(e.TgZ(0,"tr",9)(1,"td",10),e.YNc(2,ur,2,4,"img",11),e.qZA(),e.TgZ(3,"td",12),e._uU(4),e.qZA(),e.TgZ(5,"td",13),e._uU(6),e.qZA(),e.TgZ(7,"td",14),e._uU(8),e.qZA(),e.TgZ(9,"td",14),e._uU(10),e.qZA(),e.TgZ(11,"td",15),e.YNc(12,pr,1,3,"input",16),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw();e.ekj("ignore",0===o.getUnfulfilledCount(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(o.getUnfulfilledCount(t)),e.xp6(2),e.Oqu(t.productVariant.stockOnHand),e.xp6(2),e.Q6J("ngIf",o.fulfillmentQuantities[t.id])}}function mr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.canSubmit()),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.create-fulfillment")," ")}}class ve{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new l.NI,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 Object.assign(Object.assign({},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=>{var o,i;return t.code===(null===(i=null===(o=this.order.shippingLines[0])||void 0===o?void 0:o.shippingMethod)||void 0===i?void 0:i.fulfillmentHandlerCode)})||n[0],this.fulfillmentHandler=(0,d.miO)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,a=o===d.TvZ.INHERIT?t:o===d.TvZ.TRUE,c=this.getUnfulfilledCount(n);return a?Math.min(c,i):c}getUnfulfilledCount(n){var t,o;const i=null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(a=>a.summary).flat().filter(a=>a.orderLine.id===n.id).reduce((a,c)=>a+c.quantity,0))&&void 0!==o?o:0;return n.quantity-i}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((o,{fulfillCount:i})=>o+i,0);return(0,d.dOS)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,d.RnJ)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}}function gr(r,n){1&r&&e._UZ(0,"clr-icon",2)}ve.\u0275fac=function(n){return new(n||ve)(e.Y36(d.DoR),e.Y36(e.sBO))},ve.\u0275cmp=e.Xpm({type:ve,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(n,t){1&n&&(e.YNc(0,sr,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,_r,13,8,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e._UZ(24,"vdr-formatted-address",6),e.TgZ(25,"h6"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e._uU(28),e.TgZ(29,"strong"),e._uU(30),e.ALo(31,"localeCurrency"),e.qZA(),e._UZ(32,"vdr-configurable-input",7),e.qZA()(),e.YNc(33,mr,6,7,"ng-template",8)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,14,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,16,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,18,"order.unfulfilled")),e.xp6(3),e.Oqu(e.lcZ(18,20,"catalog.stock-on-hand")),e.xp6(3),e.Oqu(e.lcZ(21,22,"order.fulfill")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("address",t.order.shippingAddress),e.xp6(2),e.Oqu(e.lcZ(27,24,"order.shipping-method")),e.xp6(2),e.hij(" ",null==t.order.shippingLines[0]||null==t.order.shippingLines[0].shippingMethod?null:t.order.shippingLines[0].shippingMethod.name," "),e.xp6(2),e.Oqu(e.xi3(31,26,t.order.shipping,t.order.currencyCode)),e.xp6(2),e.Q6J("operationDefinition",t.fulfillmentHandlerDef)("operation",t.fulfillmentHandler)("formControl",t.fulfillmentHandlerControl)("removable",!1))},directives:[I.q,_.sg,_.O5,Z.y,l.qQ,l.wV,l.Fd,l.Fj,l.JJ,l.On,Ee.b,dr.q,l.oH,w.n],pipes:[f.X$,pe.M,v.k],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}}.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-left: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});class Ce{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}}Ce.\u0275fac=function(n){return new(n||Ce)},Ce.\u0275cmp=e.Xpm({type:Ce,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(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,gr,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Delivered"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[B.Y,_.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});var R=s(234);function fr(r,n){if(1&r&&(e.TgZ(0,"li",2)(1,"div",3),e._uU(2),e.qZA(),e._UZ(3,"clr-icon",4),e._uU(4),e.qZA()),2&r){const t=n.$implicit;e.Q6J("title",t.name),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",t.name," ")}}class H{}function hr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function xr(r,n){if(1&r&&e._UZ(0,"vdr-custom-field-control",5),2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function vr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,xr,1,4,"vdr-custom-field-control",4),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.customFieldFormGroup.get(t.name))}}H.\u0275fac=function(n){return new(n||H)},H.\u0275cmp=e.Xpm({type:H,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],[1,"quantity"],["shape","times","size","12"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"ul"),e.YNc(2,fr,5,3,"li",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.items))},directives:[_.sg,p.qvL],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-left: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});class te{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new l.cw({})}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(){var n,t;return null!==(t=null===(n=this.fulfillment)||void 0===n?void 0:n.summary.map(o=>{var i,a;return{name:null!==(a=null===(i=this.order.lines.find(c=>c.id===o.orderLine.id))||void 0===i?void 0:i.productVariant.name)&&void 0!==a?a:"",quantity:o.quantity}}))&&void 0!==t?t:[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new l.NI(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,R.isObject)(n)}}function Cr(r,n){if(1&r&&e._UZ(0,"vdr-fulfillment-detail",7),2&r){const t=e.oxw();e.Q6J("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}te.\u0275fac=function(n){return new(n||te)(e.Y36(d.iHG))},te.\u0275cmp=e.Xpm({type:te,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.TTD],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(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeDate"),e.qZA(),e.TgZ(4,"vdr-labeled-data",0),e.ALo(5,"translate"),e._uU(6),e.qZA(),e.YNc(7,hr,3,4,"vdr-labeled-data",1),e.TgZ(8,"vdr-labeled-data",0),e.ALo(9,"translate"),e._UZ(10,"vdr-simple-item-list",2),e.qZA(),e.YNc(11,vr,2,1,"ng-container",3)),2&n&&(e.Q6J("label",e.lcZ(1,8,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(3,10,null==t.fulfillment?null:t.fulfillment.createdAt,"medium"),"\n"),e.xp6(2),e.Q6J("label",e.lcZ(5,13,"order.fulfillment-method")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.method,"\n"),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.trackingCode),e.xp6(1),e.Q6J("label",e.lcZ(9,15,"order.contents")),e.xp6(2),e.Q6J("items",t.items),e.xp6(1),e.Q6J("ngForOf",t.customFieldConfig))},directives:[X.W,_.O5,H,_.sg,Re.M],pipes:[f.X$,He.H],styles:[""],changeDetection:0});const ft=function(r){return{state:r}};function yr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw(2).transitionState.emit(a)}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA(),e.BQk()}if(2&r){const t=n.ngIf;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.set-fulfillment-state",e.VKq(8,ft,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function Zr(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",18),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,ft,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function br(r,n){1&r&&(e._UZ(0,"clr-icon",19),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-fulfillment")," "))}function Or(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",15),e.NdJ("click",function(){const a=e.CHM(t).$implicit;return e.oxw(2).transitionState.emit(a)}),e.YNc(2,Zr,6,10,"ng-container",16),e.YNc(3,br,3,3,"ng-template",null,17,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Ar(r,n){if(1&r&&(e.TgZ(0,"div",8),e.YNc(1,yr,6,10,"ng-container",9),e.TgZ(2,"vdr-dropdown")(3,"button",10),e._UZ(4,"clr-icon",11),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",12),e.YNc(6,Or,5,2,"ng-container",13),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.nextSuggestedState()),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class ye{constructor(){this.transitionState=new e.vpe}nextSuggestedState(){var n;if(!this.fulfillment)return;const{nextStates:t}=this.fulfillment,o=i=>t.includes(i)?i:t[0];switch(null===(n=this.fulfillment)||void 0===n?void 0:n.state){case"Pending":return o("Shipped");case"Shipped":return o("Delivered");default:return t.find(i=>"Cancelled"!==i)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}}function Tr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.note")),e.xp6(2),e.Oqu(t.modification.note)}}function Ir(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();let i;e.Q6J("label",e.lcZ(1,3,"order.surcharges")),e.xp6(2),e.AsE(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.xi3(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function Lr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.added-items")),e.xp6(2),e.Q6J("items",t.getAddedItems())}}function qr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.removed-items")),e.xp6(2),e.Q6J("items",t.getRemovedItems())}}ye.\u0275fac=function(n){return new(n||ye)},ye.\u0275cmp=e.Xpm({type:ye,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","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"div",2),e._UZ(6,"vdr-fulfillment-state-label",3),e.qZA()(),e.TgZ(7,"div",4),e.YNc(8,Cr,1,2,"vdr-fulfillment-detail",5),e.qZA(),e.YNc(9,Ar,7,2,"div",6),e.qZA()),2&n&&(e.xp6(3),e.Oqu(e.lcZ(4,4,"order.fulfillment")),e.xp6(3),e.Q6J("state",null==t.fulfillment?null:t.fulfillment.state),e.xp6(2),e.Q6J("ngIf",!!t.fulfillment),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.nextStates.length))},directives:[Ce,_.O5,te,Q.J,k.U,p.qvL,E.N,_.sg,Pe.H],pipes:[f.X$,M.N],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});class Ze{constructor(){this.addedItems=new Map,this.removedItems=new Map}ngOnChanges(){const{added:n,removed:t}=this.getModifiedLines();this.addedItems=n,this.removedItems=t}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}))}getModifiedLines(){var n,t;const o=new Map,i=new Map;for(const a of this.modification.orderItems||[]){const c=this.getOrderLineAndItem(a.id);if(c){const{line:u,item:m}=c;if(m.cancelled){const x=null!==(n=i.get(u))&&void 0!==n?n:0;i.set(u,x+1)}else{const x=null!==(t=o.get(u))&&void 0!==t?t:0;o.set(u,x+1)}}}return{added:o,removed:i}}getOrderLineAndItem(n){for(const t of this.order.lines){const o=t.items.find(i=>i.id===n);if(o)return{line:t,item:o}}}}Ze.\u0275fac=function(n){return new(n||Ze)},Ze.\u0275cmp=e.Xpm({type:Ze,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.TTD],decls:7,vars:8,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.YNc(3,Tr,3,4,"vdr-labeled-data",1),e.YNc(4,Ir,4,8,"vdr-labeled-data",2),e.YNc(5,Lr,3,4,"vdr-labeled-data",1),e.YNc(6,qr,3,4,"vdr-labeled-data",1)),2&n&&(e.Q6J("label",e.lcZ(1,6,"common.ID")),e.xp6(2),e.Oqu(t.modification.id),e.xp6(1),e.Q6J("ngIf",t.modification.note),e.xp6(1),e.Q6J("ngForOf",t.modification.surcharges),e.xp6(1),e.Q6J("ngIf",t.getAddedItems().length),e.xp6(1),e.Q6J("ngIf",t.getRemovedItems().length))},directives:[X.W,_.O5,_.sg,H],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var ze=s(73),et=s(6317);const tt=72;function Fr(r,n){if(1&r&&(e.TgZ(0,"div",3),e._UZ(1,"div",4)(2,"clr-icon",5),e.TgZ(3,"div",6),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA()()),2&r){const t=e.oxw();e.xp6(4),e.hij(" ",e.lcZ(5,1,e.lcZ(6,3,t.cancelledState))," ")}}class ne{constructor(n){this.elementRef=n,this.active$=new et.X(!1),this.activeTarget$=new et.X(!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"){var t,o;this.elementRef.nativeElement.getBoundingClientRect();const a=null!==(o=null===(t=this.elementRef.nativeElement.querySelector(".node"))||void 0===t?void 0:t.getBoundingClientRect().height)&&void 0!==o?o:0;return{x:10,y:this.index*tt+("bottom"===n?a:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}}ne.\u0275fac=function(n){return new(n||ne)(e.Y36(e.SBq))},ne.\u0275cmp=e.Xpm({type:ne,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.TTD],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(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e.TgZ(2,"div",1),e.ALo(3,"async"),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA(),e.YNc(7,Fr,7,5,"div",2),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,7,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.xp6(2),e.ekj("active-target",e.lcZ(3,9,t.activeTarget$)),e.xp6(2),e.hij(" ",e.lcZ(5,11,e.lcZ(6,13,t.node.name))," "),e.xp6(3),e.Q6J("ngIf",t.isCancellable))},directives:[_.PC,_.O5,p.qvL],pipes:[_.Ov,f.X$,M.N],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-left:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-left: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 be{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,ke.b)(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(Math.pow(i,2)+Math.pow(a,2));return Object.assign({"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"}:{})}}function wr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-order-process-node",1),e.NdJ("mouseenter",function(){const a=e.CHM(t).$implicit;return e.oxw().onMouseOver(a.name)})("mouseleave",function(){return e.CHM(t),e.oxw().onMouseOut()}),e.ALo(2,"async"),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=n.index,i=e.oxw();e.xp6(1),e.Q6J("node",t)("index",o)("active",e.lcZ(2,3,i.activeState$)===t.name)}}function Sr(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-order-process-edge",2),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("from",t.from)("to",t.to)("index",t.index)}}be.\u0275fac=function(n){return new(n||be)},be.\u0275cmp=e.Xpm({type:be,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(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e._UZ(2,"clr-icon",1),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,5,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.uIk("data-from",t.from.node.name)("data-to",t.to.node.name))},directives:[_.PC,p.qvL],pipes:[_.Ov],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});class Oe{constructor(n){this.changeDetector=n,this.setActiveState$=new et.X(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*tt}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,We.b)(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(){var n,t;const o=new Map;for(const i of this.states)o.set(i.name,{name:i.name,to:[]});for(const[i,a]of o.entries()){const c=null!==(t=null===(n=this.states.find(u=>u.name===i))||void 0===n?void 0:n.to)&&void 0!==t?t:[];for(const u of c){const m=o.get(u);m&&a.to.push(m)}}this.nodes=[...o.values()].filter(i=>"Cancelled"!==i.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()}}function Mr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.order-state-diagram"))}Oe.\u0275fac=function(n){return new(n||Oe)(e.Y36(e.sBO))},Oe.\u0275cmp=e.Xpm({type:Oe,selectors:[["vdr-order-process-graph"]],viewQuery:function(n,t){if(1&n&&e.Gf(ne,5),2&n){let o;e.iGM(o=e.CRH())&&(t.nodeComponents=o)}},hostVars:2,hostBindings:function(n,t){2&n&&e.Udp("height",t.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.TTD],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(n,t){1&n&&(e.YNc(0,wr,3,5,"ng-container",0),e.YNc(1,Sr,2,3,"ng-container",0)),2&n&&(e.Q6J("ngForOf",t.nodes),e.xp6(1),e.Q6J("ngForOf",t.edges))},directives:[_.sg,ne,be],pipes:[_.Ov],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});class Ae{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}}Ae.\u0275fac=function(n){return new(n||Ae)(e.Y36(d.iHG))},Ae.\u0275cmp=e.Xpm({type:Ae,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(n,t){1&n&&(e.YNc(0,Mr,2,3,"ng-template",0),e._UZ(1,"vdr-order-process-graph",1)),2&n&&(e.xp6(1),e.Q6J("states",t.states)("initialState",t.activeState))},directives:[I.q,Oe],pipes:[f.X$],styles:[""],changeDetection:0});var ht=s(7283);function Nr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.refund-and-cancel-order"))}function Jr(r,n){if(1&r&&(e.TgZ(0,"div",36),e._uU(1),e.TgZ(2,"div",37),e._uU(3),e.ALo(4,"currency"),e.ALo(5,"number"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw(3).$implicit,i=e.oxw();e.xp6(1),e.hij(" ",t.description," "),e.xp6(2),e.hij(" ",e.xi3(4,2,e.xi3(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function Ur(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",32)(2,"button",33),e._UZ(3,"clr-icon",34),e.qZA()(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,Jr,6,8,"div",35),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(5),e.Q6J("ngForOf",t)}}function Dr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Ur,6,1,"vdr-dropdown",26),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Pr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",38),e.NdJ("ngModelChange",function(i){e.CHM(t);const a=e.oxw().$implicit;return e.oxw().lineQuantities[a.id].quantity=i})("input",function(){e.CHM(t);const i=e.oxw().$implicit,a=e.oxw();return a.handleZeroQuantity(a.lineQuantities[i.id])}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function Qr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const a=e.oxw().$implicit;return e.oxw().lineQuantities[a.id].refund=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].refund)}}function kr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const a=e.oxw().$implicit;return e.oxw().lineQuantities[a.id].cancel=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].cancel)}}function Er(r,n){if(1&r&&(e.TgZ(0,"tr",18)(1,"td",19),e._UZ(2,"img",20),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",21),e._uU(5),e.qZA(),e.TgZ(6,"td",22),e._uU(7),e.qZA(),e.TgZ(8,"td",23),e._uU(9),e._UZ(10,"vdr-line-refunds",24),e.qZA(),e.TgZ(11,"td",23),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA(),e.TgZ(14,"td",23)(15,"div",25),e._uU(16),e.ALo(17,"localeCurrency"),e.YNc(18,Dr,2,1,"ng-container",26),e.qZA()(),e.TgZ(19,"td",27),e.YNc(20,Pr,1,2,"input",28),e.qZA(),e.TgZ(21,"td",29)(22,"div",30),e.YNc(23,Qr,1,2,"input",31),e.qZA()(),e.TgZ(24,"td",29)(25,"div",30),e.YNc(26,kr,1,2,"input",31),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Q6J("src",e.xi3(3,12,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",t.quantity," "),e.xp6(1),e.Q6J("line",t)("payments",o.order.payments),e.xp6(2),e.hij(" ",e.xi3(13,15,t.unitPriceWithTax,o.order.currencyCode)," "),e.xp6(4),e.hij(" ",e.xi3(17,18,t.proratedUnitPriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.discounts),e.xp6(2),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function Yr(r,n){if(1&r&&(e.TgZ(0,"option",40),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();e.Q6J("ngValue",t)("disabled","Settled"!==t.state),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,5,t.amount,o.order.currencyCode)," ")}}const jr=function(r,n){return{min:r,max:n}};function Rr(r,n){if(1&r&&(e.TgZ(0,"div",41),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"currency"),e.ALo(4,"localeCurrency"),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-total-error",e.WLB(10,jr,e.xi3(3,4,0,t.order.currencyCode),e.xi3(4,7,t.settledPaymentsTotal,t.order.currencyCode)))," ")}}function Hr(r,n){1&r&&(e.TgZ(0,"div",42),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-total-warning")," "))}const $r=function(r){return{amount:r}};function Vr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-with-amount",e.VKq(7,$r,e.xi3(3,4,t.refundTotal,t.order.currencyCode)))," ")}}function Br(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-selected-items")," ")}function Gr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",43),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",44),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,Vr,4,9,"ng-container",45),e.YNc(5,Br,2,3,"ng-template",null,46,e.W1O),e.qZA()}if(2&r){const t=e.MAs(6),o=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!o.canSubmit()),e.xp6(1),e.Q6J("ngIf",o.isRefunding())("ngIfElse",t)}}class Te{constructor(n){var t;this.i18nService=n,this.lineQuantities={},this.refundShipping=!1,this.adjustment=0,this.reasons=null!==(t=(0,d.hq7)().cancellationReasons)&&void 0!==t?t:[(0,g.J)("order.refund-reason-customer-request"),(0,g.J)("order.refund-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get refundTotal(){return this.order.lines.reduce((t,o)=>{const i=this.lineQuantities[o.id],a=i.refund&&i.quantity||0;return t+o.proratedUnitPriceWithTax*a},0)+(this.refundShipping?this.order.shippingWithTax:0)+this.adjustment}get settledPaymentsTotal(){return this.settledPayments.map(n=>n.amount-(0,R.summate)(n.refunds.filter(i=>"Failed"!==i.state),"total")).reduce((n,t)=>n+t,0)}lineCanBeRefundedOrCancelled(n){var t,o;const i=null!==(o=null===(t=this.order.payments)||void 0===t?void 0:t.reduce((c,u)=>[...c,...u.refunds],[]))&&void 0!==o?o:[];return 0<n.items.filter(c=>{if(c.cancelled)return!1;if(null==c.refundId)return!0;const u=i.find(m=>m.id===c.refundId);return"Failed"===(null==u?void 0:u.state)}).length}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},n),{[t.id]:{quantity:0,refund:!1,cancel:!1}}),{}),this.settledPayments=(this.order.payments||[]).filter(n=>"Settled"===n.state),this.settledPayments.length&&(this.selectedPayment=this.settledPayments[0])}handleZeroQuantity(n){0===(null==n?void 0:n.quantity)&&(n.cancel=!1,n.refund=!1)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.refund,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return this.isRefunding()?!!(this.selectedPayment&&this.reason&&0<this.refundTotal&&this.refundTotal<=this.settledPaymentsTotal):!!this.isCancelling()&&!!this.reason}select(){const n=this.selectedPayment;if(n){const t=this.getOrderLineInput(i=>i.refund),o=this.getOrderLineInput(i=>i.cancel);this.resolveWith({refund:{lines:t,reason:this.reason,shipping:this.refundShipping?this.order.shippingWithTax:0,adjustment:this.adjustment,paymentId:n.id},cancel:{lines:o,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShipping}})}}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}))}}function Wr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.settle-refund"))}function Xr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.transactionId),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.settle-refund")," ")}}Te.\u0275fac=function(n){return new(n||Te)(e.Y36(d.Dp7))},Te.\u0275cmp=e.Xpm({type:Te,selectors:[["vdr-refund-order-dialog"]],decls:69,vars:76,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",4,"ngFor","ngForOf"],[1,"refund-details","mt4"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"disabled","items","placeholder","addTag","ngModel","ngModelChange"],["clrSelect","","name","options",3,"ngModel","disabled","ngModelChange"],[3,"ngValue","disabled",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"ngModel","disabled","ngModelChange"],["clrInput","",3,"disabled","currencyCode","ngModel","ngModelChange"],[1,"totals"],[1,"order-total"],[1,"refund-total"],["class","refund-total-error",4,"ngIf"],["class","refund-total-warning",4,"ngIf"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[3,"line","payments"],[1,"prorated-wrapper"],[4,"ngIf"],[1,"align-middle","quantity-col"],["type","number","min","0",3,"ngModel","max","ngModelChange","input",4,"ngIf"],[1,"align-middle"],[1,"cancel-checkbox-wrapper"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],["type","number","min","0",3,"ngModel","max","ngModelChange","input"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[3,"ngValue","disabled"],[1,"refund-total-error"],[1,"refund-total-warning"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[4,"ngIf","ngIfElse"],["cancelling",""]],template:function(n,t){1&n&&(e.YNc(0,Nr,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.TgZ(22,"th"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.TgZ(25,"th"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"th"),e._uU(29),e.ALo(30,"translate"),e.qZA()()(),e.YNc(31,Er,27,21,"tr",4),e.qZA()(),e.TgZ(32,"div",5)(33,"div")(34,"label",6),e._uU(35),e.ALo(36,"translate"),e.qZA(),e.TgZ(37,"ng-select",7),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.ALo(38,"translate"),e.qZA()(),e.TgZ(39,"div")(40,"clr-select-container")(41,"label"),e._uU(42),e.ALo(43,"translate"),e.qZA(),e.TgZ(44,"select",8),e.NdJ("ngModelChange",function(i){return t.selectedPayment=i}),e.YNc(45,Yr,3,8,"option",9),e.qZA()(),e.TgZ(46,"clr-checkbox-wrapper")(47,"input",10),e.NdJ("ngModelChange",function(i){return t.refundShipping=i}),e.qZA(),e.TgZ(48,"label"),e._uU(49),e.ALo(50,"translate"),e.ALo(51,"localeCurrency"),e.qZA()(),e.TgZ(52,"clr-input-container")(53,"label"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.TgZ(56,"vdr-currency-input",11),e.NdJ("ngModelChange",function(i){return t.adjustment=i}),e.qZA()(),e.TgZ(57,"div",12)(58,"div",13),e._uU(59),e.ALo(60,"translate"),e.ALo(61,"localeCurrency"),e.qZA(),e.TgZ(62,"div",14),e._uU(63),e.ALo(64,"translate"),e.ALo(65,"localeCurrency"),e.qZA(),e.YNc(66,Rr,5,13,"div",15),e.YNc(67,Hr,3,3,"div",16),e.qZA()()()(),e.YNc(68,Gr,7,6,"ng-template",17)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,37,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,39,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,41,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,43,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,45,"order.prorated-unit-price")),e.xp6(3),e.Oqu(e.lcZ(24,47,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(27,49,"order.refund")),e.xp6(3),e.Oqu(e.lcZ(30,51,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.ekj("faded",!t.isRefunding()&&!t.isCancelling()),e.xp6(3),e.Oqu(e.lcZ(36,53,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("disabled",!t.isRefunding()&&!t.isCancelling())("items",t.reasons)("placeholder",e.lcZ(38,55,"order.refund-cancellation-reason-required"))("addTag",!0)("ngModel",t.reason),e.xp6(5),e.Oqu(e.lcZ(43,57,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment)("disabled",!t.isRefunding()),e.xp6(1),e.Q6J("ngForOf",t.settledPayments),e.xp6(2),e.Q6J("ngModel",t.refundShipping)("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(50,59,"order.refund-shipping")," (",e.xi3(51,61,t.order.shippingWithTax,t.order.currencyCode),") "),e.xp6(5),e.Oqu(e.lcZ(55,64,"order.refund-adjustment")),e.xp6(2),e.Q6J("disabled",!t.isRefunding())("currencyCode",t.order.currencyCode)("ngModel",t.adjustment),e.xp6(1),e.ekj("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(60,66,"order.payment-amount"),": ",e.xi3(61,68,t.selectedPayment.amount,t.order.currencyCode)," "),e.xp6(4),e.AsE(" ",e.lcZ(64,71,"order.refund-total"),": ",e.xi3(65,73,t.refundTotal,t.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.refundTotal<0||t.settledPaymentsTotal<t.refundTotal),e.xp6(1),e.Q6J("ngIf",t.selectedPayment.amount<t.refundTotal))},directives:[I.q,_.sg,Y,_.O5,Q.J,k.U,p.qvL,E.N,Z.y,l.qQ,l.wV,l.Fd,l.Fj,l.JJ,l.On,l.Wl,p.KKC,p.MgK,L.w9,p.dTv,l.EJ,p.otW,l.YN,l.Kr,p.PEh,p.G55,ht.K,p.xRP,w.n],pipes:[f.X$,pe.M,v.k,_.H9,_.JJ],styles:["[_nghost-%COMP%]{height:100%;display:flex;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)}.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;justify-content:space-between}.refund-details.faded[_ngcontent-%COMP%]{opacity:.5}.totals[_ngcontent-%COMP%]{margin-top:48px}.totals[_ngcontent-%COMP%] .refund-total[_ngcontent-%COMP%]{font-size:18px}.totals[_ngcontent-%COMP%] .refund-total-error[_ngcontent-%COMP%]{color:var(--color-error-500)}.totals[_ngcontent-%COMP%] .refund-total-warning[_ngcontent-%COMP%]{color:var(--color-warning-600);max-width:250px}.totals.disabled[_ngcontent-%COMP%]{color:var(--color-grey-300)}.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-left:12px}"],changeDetection:0});const Kr=function(r){return{method:r}};class Ie{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}}Ie.\u0275fac=function(n){return new(n||Ie)},Ie.\u0275cmp=e.Xpm({type:Ie,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(n,t){1&n&&(e.YNc(0,Wr,2,3,"ng-template",0),e.TgZ(1,"p",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-input-container")(5,"label"),e._uU(6),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"input",2),e.NdJ("ngModelChange",function(i){return t.transactionId=i}),e.qZA()(),e.YNc(9,Xr,6,7,"ng-template",3)),2&n&&(e.xp6(2),e.hij(" ",e.xi3(3,3,"order.settle-refund-manual-instructions",e.VKq(8,Kr,t.refund.method)),"\n"),e.xp6(4),e.Oqu(e.lcZ(7,6,"order.transaction-id")),e.xp6(2),e.Q6J("ngModel",t.transactionId))},directives:[I.q,p.G55,p.MgK,Z.y,l.Fj,p.xRP,l.JJ,l.On,w.n],pipes:[f.X$],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0});var xt=s(8276),zr=s(2505),vt=s(2355);const eo=["portal"];class Le{constructor(n,t){this.componentFactoryResolver=n,this.historyEntryComponentService=t,this.expandClick=new e.vpe}ngOnInit(){const n=this.historyEntryComponentService.getComponent(this.entry.type),t=this.componentFactoryResolver.resolveComponentFactory(n),o=this.portalRef.createComponent(t);o.instance.entry=this.entry,o.instance.order=this.order,this.instance=o.instance,this.componentRef=o}ngOnDestroy(){var n;null===(n=this.componentRef)||void 0===n||n.destroy()}}Le.\u0275fac=function(n){return new(n||Le)(e.Y36(e._Vd),e.Y36(d.GwB))},Le.\u0275cmp=e.Xpm({type:Le,selectors:[["vdr-order-history-entry-host"]],viewQuery:function(n,t){if(1&n&&e.Gf(eo,7,e.s_b),2&n){let o;e.iGM(o=e.CRH())&&(t.portalRef=o.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(n,t){1&n&&(e.TgZ(0,"vdr-timeline-entry",0),e.NdJ("expandClick",function(){return t.expandClick.emit()}),e._UZ(1,"div",null,1),e.qZA()),2&n&&e.Q6J("displayType",t.instance.getDisplayType(t.entry))("iconShape",t.instance.getIconShape&&t.instance.getIconShape(t.entry))("createdAt",t.entry.createdAt)("name",t.instance.getName&&t.instance.getName(t.entry))("featured",t.instance.isFeatured(t.entry))("collapsed",!t.expanded&&!t.instance.isFeatured(t.entry))},directives:[vt._],encapsulation:2});var to=s(4664);function no(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.error-message")),e.xp6(2),e.hij(" ",t.payment.errorMessage,"\n")}}function ro(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.payment.transactionId,"\n")}}class re{}re.\u0275fac=function(n){return new(n||re)},re.\u0275cmp=e.Xpm({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(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.TgZ(3,"vdr-labeled-data",0),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.YNc(7,no,3,4,"vdr-labeled-data",1),e.YNc(8,ro,3,4,"vdr-labeled-data",1),e.TgZ(9,"vdr-labeled-data",0),e.ALo(10,"translate"),e._UZ(11,"vdr-object-tree",2),e.qZA()),2&n&&(e.Q6J("label",e.lcZ(1,8,"order.payment-method")),e.xp6(2),e.hij(" ",t.payment.method,"\n"),e.xp6(1),e.Q6J("label",e.lcZ(4,10,"order.amount")),e.xp6(2),e.hij(" ",e.xi3(6,12,t.payment.amount,t.currencyCode),"\n"),e.xp6(2),e.Q6J("ngIf",t.payment.errorMessage),e.xp6(1),e.Q6J("ngIf",t.payment.transactionId),e.xp6(1),e.Q6J("label",e.lcZ(10,15,"order.payment-metadata")),e.xp6(2),e.Q6J("value",t.payment.metadata))},directives:[X.W,_.O5,Ye._],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var oo=s(7388);function io(r,n){1&r&&(e.TgZ(0,"span",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-only-visible-to-administrators")," "))}function ao(r,n){1&r&&(e.TgZ(0,"span",13),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-visible-to-customer")," "))}function lo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-order-history-entry-host",16),e.NdJ("expandClick",function(){e.CHM(t);const i=e.oxw(2);return i.expanded=!i.expanded}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("order",o.order)("entry",t)("expanded",o.expanded)}}function co(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-fulfilled")," "))}function so(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-cancelled")," "))}const Ct=function(r,n){return{from:r,to:n}};function uo(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(3).$implicit;e.hij(" ",e.xi3(1,1,"order.history-order-transition",e.WLB(4,Ct,t.data.from,t.data.to))," ")}}function po(r,n){if(1&r&&(e.ynx(0),e.YNc(1,co,3,3,"div",21),e.YNc(2,so,3,3,"div",21),e.YNc(3,uo,2,7,"ng-template",22),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function _o(r,n){1&r&&(e.TgZ(0,"vdr-chip",27),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-settled")))}function mo(r,n){1&r&&(e.TgZ(0,"vdr-chip",28),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-not-settled")))}function go(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"strong"),e._uU(4),e.ALo(5,"localeCurrency"),e.qZA(),e.YNc(6,_o,3,3,"vdr-chip",24),e.YNc(7,mo,3,3,"vdr-chip",25),e.TgZ(8,"vdr-history-entry-detail"),e._UZ(9,"vdr-modification-detail",26),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.hij(" ",e.lcZ(2,6,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(5,8,t.priceChange,o.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.isSettled),e.xp6(1),e.Q6J("ngIf",!t.isSettled),e.xp6(2),e.Q6J("order",o.order)("modification",t)}}function fo(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,go,10,11,"ng-container",23),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.history-order-modified")," "),e.xp6(2),e.Q6J("ngIf",o.getModification(t.data.modificationId))}}function ho(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-payment-detail",31),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(5);e.xp6(1),e.Q6J("payment",t)("currencyCode",o.order.currencyCode)}}function xo(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.YNc(6,ho,2,2,"vdr-history-entry-detail",23),e.BQk()),2&r){const t=e.oxw(3).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,4,"order.history-payment-settled")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,6,"order.transaction-id"),": ",null==(i=o.getPayment(t))?null:i.transactionId," "),e.xp6(2),e.Q6J("ngIf",o.getPayment(t))}}const yt=function(r,n,t){return{from:r,to:n,id:t}};function vo(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(3).$implicit,o=e.oxw();let i;e.hij(" ",e.xi3(1,1,"order.history-payment-transition",e.kEZ(4,yt,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function Co(r,n){if(1&r&&(e.ynx(0),e.YNc(1,xo,7,8,"ng-container",29),e.YNc(2,vo,2,8,"ng-template",null,30,e.W1O),e.BQk()),2&r){const t=e.MAs(3),o=e.oxw(2).$implicit;e.xp6(1),e.Q6J("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function yo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-refund-transition",e.kEZ(4,yt,t.data.from,t.data.to,t.data.refundId))," ")}}function Zo(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",32),e.ALo(2,"translate"),e._uU(3),e.qZA(),e.TgZ(4,"vdr-labeled-data",32),e.ALo(5,"translate"),e._UZ(6,"vdr-simple-item-list",33),e.qZA(),e.TgZ(7,"vdr-labeled-data",32),e.ALo(8,"translate"),e._uU(9),e.qZA()()),2&r){const t=n.ngIf,o=e.oxw(3).$implicit;e.xp6(1),e.Q6J("label",e.lcZ(2,6,"order.cancellation-reason")),e.xp6(2),e.hij(" ",o.data.reason," "),e.xp6(1),e.Q6J("label",e.lcZ(5,8,"order.contents")),e.xp6(2),e.Q6J("items",t),e.xp6(1),e.Q6J("label",e.lcZ(8,10,"order.shipping-cancelled")),e.xp6(2),e.hij(" ",o.data.shippingCancelled," ")}}const bo=function(r){return{count:r}};function Oo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,Zo,10,12,"vdr-history-entry-detail",23),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,2,"order.history-items-cancelled",e.VKq(5,bo,t.data.orderItemIds.length))," "),e.xp6(2),e.Q6J("ngIf",o.getCancelledItems(t))}}function Ao(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",34),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function To(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,Ao,2,2,"vdr-history-entry-detail",23),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-fulfillment-created")," "),e.xp6(2),e.Q6J("ngIf",o.getFulfillment(t))}}function Io(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(3).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-delivered")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function Lo(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(3).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-shipped")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function qo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw(3).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-fulfillment-transition",e.WLB(4,Ct,t.data.from,t.data.to))," ")}}function Fo(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",34),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function wo(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Io,6,7,"ng-container",23),e.YNc(2,Lo,6,7,"ng-container",23),e.YNc(3,qo,3,7,"ng-container",23),e.YNc(4,Fo,2,2,"vdr-history-entry-detail",23),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Shipped"===t.data.to),e.xp6(1),e.Q6J("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.xp6(1),e.Q6J("ngIf",o.getFulfillment(t))}}function So(r,n){1&r&&(e.TgZ(0,"span",47),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.public")))}function Mo(r,n){1&r&&(e.TgZ(0,"span",48),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.private")))}function No(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",35)(2,"div",36),e.YNc(3,So,3,3,"span",37),e.YNc(4,Mo,3,3,"span",38),e._uU(5),e.qZA(),e._UZ(6,"div",39),e.TgZ(7,"vdr-dropdown")(8,"button",40),e._UZ(9,"clr-icon",41),e.qZA(),e.TgZ(10,"vdr-dropdown-menu",42)(11,"button",43),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2).$implicit;return e.oxw().updateNote.emit(i)}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",44),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",45),e.TgZ(17,"button",43),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2).$implicit;return e.oxw().deleteNote.emit(i)}),e.ALo(18,"hasPermission"),e._UZ(19,"clr-icon",46),e._uU(20),e.ALo(21,"translate"),e.qZA()()()(),e.BQk()}if(2&r){const t=e.oxw(2).$implicit;e.xp6(3),e.Q6J("ngIf",t.isPublic),e.xp6(1),e.Q6J("ngIf",!t.isPublic),e.xp6(1),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(12,7,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(15,9,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(18,11,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(21,13,"common.delete")," ")}}const Jo=function(r){return["/marketing","promotions",r]};function Uo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"a",49),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"order.history-coupon-code-applied"),": "),e.xp6(3),e.Q6J("routerLink",e.VKq(5,Jo,t.data.promotionId)),e.xp6(1),e.Oqu(t.data.couponCode)}}function Do(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"span",50),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-coupon-code-removed"),": "),e.xp6(4),e.Oqu(t.data.couponCode)}}function Po(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-object-tree",51),e.qZA()),2&r){const t=e.oxw(3).$implicit;e.xp6(1),e.Q6J("value",t.data)}}function Qo(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Po,2,1,"vdr-history-entry-detail",23),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,2,t.type)," "),e.xp6(2),e.Q6J("ngIf",t.data)}}function ko(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",17),e.NdJ("expandClick",function(){e.CHM(t);const i=e.oxw(2);return i.expanded=!i.expanded}),e.ynx(1,18),e.YNc(2,po,4,3,"ng-container",19),e.YNc(3,fo,5,4,"ng-container",19),e.YNc(4,Co,4,2,"ng-container",19),e.YNc(5,yo,3,8,"ng-container",19),e.YNc(6,Oo,4,7,"ng-container",19),e.YNc(7,To,4,4,"ng-container",19),e.YNc(8,wo,5,4,"ng-container",19),e.YNc(9,No,22,15,"ng-container",19),e.YNc(10,Uo,6,7,"ng-container",19),e.YNc(11,Do,6,4,"ng-container",19),e.YNc(12,Qo,5,4,"ng-container",20),e.BQk(),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("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.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_MODIFIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_CANCELLATION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_NOTE),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_REMOVED)}}function Eo(r,n){if(1&r&&(e.ynx(0),e.YNc(1,lo,1,3,"vdr-order-history-entry-host",14),e.YNc(2,ko,13,17,"ng-template",null,15,e.W1O),e.BQk()),2&r){const t=n.$implicit,o=e.MAs(3),i=e.oxw();e.xp6(1),e.Q6J("ngIf",i.hasCustomComponent(t.type))("ngIfElse",o)}}class qe{constructor(n){this.historyEntryComponentService=n,this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=d.iYD}hasCustomComponent(n){return!!this.historyEntryComponentService.getComponent(n)}getDisplayType(n){if(n.type===d.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===d.iYD.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type===d.iYD.ORDER_PAYMENT_TRANSITION&&("Declined"===n.data.to||"Cancelled"===n.data.to)||n.type===d.iYD.ORDER_CANCELLATION?"error":n.type===d.iYD.ORDER_REFUND_TRANSITION?"warning":"default"}getTimelineIcon(n){if(n.type===d.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===d.iYD.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===d.iYD.ORDER_NOTE?"note":n.type===d.iYD.ORDER_MODIFIED?"pencil":n.type!==d.iYD.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case d.iYD.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case d.iYD.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case d.iYD.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case d.iYD.ORDER_NOTE:case d.iYD.ORDER_MODIFIED:return!0;default:return!1}}getFulfillment(n){if((n.type===d.iYD.ORDER_FULFILLMENT||n.type===d.iYD.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===d.iYD.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getCancelledItems(n){const t=new Map,o=n.data.orderItemIds;for(const i of this.order.lines)for(const a of i.items)if(o.includes(a.id)){const c=t.get(i.productVariant.name);null!=c?t.set(i.productVariant.name,c+1):t.set(i.productVariant.name,1)}return Array.from(t.entries()).map(([i,a])=>({name:i,quantity:a}))}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}}function Yo(r,n){1&r&&e._UZ(0,"clr-icon",2)}qe.\u0275fac=function(n){return new(n||qe)(e.Y36(d.GwB))},qe.\u0275cmp=e.Xpm({type:qe,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:23,vars:24,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured"],[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"],[4,"ngIf"],["colorType","success",4,"ngIf"],["colorType","error",4,"ngIf"],[3,"order","modification"],["colorType","success"],["colorType","error"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],[3,"payment","currencyCode"],[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,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",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"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0)(4,"vdr-timeline-entry",1)(5,"div",2)(6,"textarea",3),e.NdJ("ngModelChange",function(i){return t.note=i}),e.qZA(),e.TgZ(7,"button",4),e.NdJ("click",function(){return t.addNoteToOrder()}),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"div",5)(11,"clr-checkbox-wrapper")(12,"input",6),e.NdJ("ngModelChange",function(i){return t.noteIsPrivate=i}),e.qZA(),e.TgZ(13,"label"),e._uU(14),e.ALo(15,"translate"),e.qZA()(),e.YNc(16,io,3,3,"span",7),e.YNc(17,ao,3,3,"span",8),e.qZA()(),e.YNc(18,Eo,4,2,"ng-container",9),e.TgZ(19,"vdr-timeline-entry",10)(20,"div",11),e._uU(21),e.ALo(22,"translate"),e.qZA()()()),2&n&&(e.xp6(1),e.Oqu(e.lcZ(2,16,"order.order-history")),e.xp6(2),e.ekj("expanded",t.expanded),e.xp6(1),e.Q6J("featured",!0),e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(9,18,"common.add-note")," "),e.xp6(4),e.Q6J("ngModel",t.noteIsPrivate),e.xp6(2),e.Oqu(e.lcZ(15,20,"order.note-is-private")),e.xp6(2),e.Q6J("ngIf",t.noteIsPrivate),e.xp6(1),e.Q6J("ngIf",!t.noteIsPrivate),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0)("createdAt",t.order.createdAt)("featured",!0),e.xp6(2),e.hij(" ",e.lcZ(22,22,"order.history-order-created")," "))},directives:[vt._,Z.y,l.Fj,l.JJ,l.On,p.PEh,l.Wl,p.KKC,p.MgK,_.O5,_.sg,Le,_.RF,_.n9,B.Y,to.C,Ze,re,X.W,H,te,Q.J,k.U,p.qvL,E.N,Pe.H,C.yS,_.ED,Ye._],pipes:[f.X$,v.k,oo.j],styles:["[_nghost-%COMP%]{margin-top:48px;display:block}.entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.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-500)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-500)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap}.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-500)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});class Fe{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}}function jo(r,n){1&r&&e._UZ(0,"clr-icon",2)}Fe.\u0275fac=function(n){return new(n||Fe)},Fe.\u0275cmp=e.Xpm({type:Fe,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(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Yo,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[B.Y,_.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});class we{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}}function Ro(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.BQk()),2&r){const t=e.oxw();e.xp6(1),e.hij("#",t.payment.transactionId,"")}}function Ho(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.transactionId," ")}}function $o(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-reason")),e.xp6(2),e.hij(" ",t.reason," ")}}function Vo(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._UZ(2,"vdr-object-tree",13),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-metadata")),e.xp6(2),e.Q6J("value",t.metadata)}}function Bo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",14)(1,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().settleRefund.emit(i)}),e._uU(2),e.ALo(3,"translate"),e.qZA()()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"order.settle-refund")," "))}function Go(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",1),e._UZ(2,"clr-icon",9),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"div",10)(6,"vdr-refund-state-label",4),e.qZA(),e.TgZ(7,"div",5)(8,"vdr-labeled-data",11),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeDate"),e.qZA(),e.TgZ(12,"vdr-labeled-data",11),e.ALo(13,"translate"),e._uU(14),e.ALo(15,"localeCurrency"),e.qZA(),e.YNc(16,Ho,3,4,"vdr-labeled-data",12),e.YNc(17,$o,3,4,"vdr-labeled-data",12),e.YNc(18,Vo,3,4,"vdr-labeled-data",12),e.qZA(),e.YNc(19,Bo,4,3,"div",8),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(3),e.AsE(" ",e.lcZ(4,11,"order.refund")," #",t.id," "),e.xp6(3),e.Q6J("state",t.state),e.xp6(2),e.Q6J("label",e.lcZ(9,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(11,15,t.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(13,18,"order.refund-total")),e.xp6(2),e.hij(" ",e.xi3(15,20,t.total,o.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.transactionId),e.xp6(1),e.Q6J("ngIf",t.reason),e.xp6(1),e.Q6J("ngIf",o.refundHasMetadata(t)),e.xp6(1),e.Q6J("ngIf","Pending"===t.state)}}function Wo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.settlePayment.emit(i.payment)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.settle-payment")," "))}we.\u0275fac=function(n){return new(n||we)},we.\u0275cmp=e.Xpm({type:we,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(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,jo,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[B.Y,_.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});const Xo=function(r){return{state:r}};function Ko(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",23),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Xo,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function zo(r,n){1&r&&(e._UZ(0,"clr-icon",24),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-payment")," "))}function ei(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",20),e.NdJ("click",function(){const a=e.CHM(t).$implicit,c=e.oxw(2);return c.transitionPaymentState.emit({payment:c.payment,state:a})}),e.YNc(2,Ko,6,10,"ng-container",21),e.YNc(3,zo,3,3,"ng-template",null,22,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function ti(r,n){if(1&r&&(e.TgZ(0,"div",14),e.YNc(1,Wo,3,3,"button",16),e.TgZ(2,"vdr-dropdown")(3,"button",17),e._UZ(4,"clr-icon",18),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",19),e.YNc(6,ei,5,2,"ng-container",7),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.includes("Settled")),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class Se{constructor(){this.settlePayment=new e.vpe,this.transitionPaymentState=new e.vpe,this.settleRefund=new e.vpe}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}}function ni(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().addManualPayment(i)}),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();e.xp6(1),e.AsE(" ",e.lcZ(2,2,"order.add-payment-to-order")," (",e.xi3(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function ri(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToState("ArrangingAdditionalPayment")}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.arrange-additional-payment")," "))}function oi(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToModifying()}),e._UZ(2,"clr-icon",17),e._uU(3),e.ALo(4,"translate"),e.qZA(),e._UZ(5,"div",13),e.BQk()}2&r&&(e.xp6(3),e.hij(" ",e.lcZ(4,1,"order.modify-order")," "))}function ii(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-and-cancel-order")," "))}function ai(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-order")," ")}function li(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().cancelOrRefund(i)}),e._UZ(1,"clr-icon",18),e.YNc(2,ii,3,3,"ng-container",19),e.YNc(3,ai,2,3,"ng-template",null,20,e.W1O),e.qZA()}if(2&r){const t=e.MAs(4),o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}Se.\u0275fac=function(n){return new(n||Se)},Se.\u0275cmp=e.Xpm({type:Se,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"],["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","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.YNc(5,Ro,2,1,"ng-container",2),e.qZA(),e.TgZ(6,"div",3),e._UZ(7,"vdr-payment-state-label",4),e.qZA()(),e.TgZ(8,"div",5),e._UZ(9,"vdr-payment-detail",6),e.qZA(),e.YNc(10,Go,20,23,"ng-container",7),e.YNc(11,ti,7,2,"div",8),e.qZA()),2&n&&(e.xp6(3),e.hij(" ",e.lcZ(4,7,"order.payment")," "),e.xp6(2),e.Q6J("ngIf",t.payment.transactionId),e.xp6(2),e.Q6J("state",t.payment.state),e.xp6(2),e.Q6J("payment",t.payment)("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("ngForOf",t.payment.refunds),e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.length))},directives:[_.O5,Fe,re,_.sg,p.qvL,mt.Lv,we,X.W,Ye._,Q.J,k.U,E.N,Pe.H],pipes:[f.X$,He.H,v.k,M.N],styles:[".payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.refund-icon[_ngcontent-%COMP%]{margin-right:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0});const ci=function(r){return{state:r}};function di(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){const a=e.CHM(t).$implicit;return e.oxw(3).transitionToState(a)}),e._UZ(1,"clr-icon",22),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=n.$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,ci,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function si(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"div",13),e.YNc(2,di,6,10,"button",21),e.ALo(3,"async"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngForOf",e.lcZ(3,1,t.nextStates$))}}function ui(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e.TgZ(5,"vdr-order-state-label",3)(6,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().openStateDiagram()}),e.ALo(7,"translate"),e._UZ(8,"clr-icon",5),e.qZA()()()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",6),e.YNc(11,ni,4,7,"button",7),e.YNc(12,ri,3,3,"button",7),e.TgZ(13,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().fulfillOrder()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dropdown")(17,"button",9),e._UZ(18,"clr-icon",10),e.qZA(),e.TgZ(19,"vdr-dropdown-menu",11),e.YNc(20,oi,6,3,"ng-container",0),e.YNc(21,li,5,2,"button",12),e.YNc(22,si,4,3,"ng-container",0),e.ALo(23,"async"),e._UZ(24,"div",13),e.TgZ(25,"button",14),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().manuallyTransitionToState(a)}),e._UZ(26,"clr-icon",15),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();let i;e.xp6(3),e.Q6J("entity",e.lcZ(4,11,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(1),e.Q6J("title",e.lcZ(7,13,"order.order-state-diagram")),e.xp6(5),e.Q6J("ngIf",("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.xp6(1),e.Q6J("ngIf",!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&"ArrangingPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.xp6(1),e.Q6J("disabled",!o.canAddFulfillment(t)),e.xp6(1),e.hij(" ",e.lcZ(15,15,"order.fulfill-order")," "),e.xp6(6),e.Q6J("ngIf",t.nextStates.includes("Modifying")),e.xp6(1),e.Q6J("ngIf",t.nextStates.includes("Cancelled")),e.xp6(1),e.Q6J("ngIf",null==(i=e.lcZ(23,17,o.nextStates$))?null:i.length),e.xp6(5),e.hij(" ",e.lcZ(28,19,"order.manually-transition-to-state")," ")}}function pi(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.ALo(5,"percent"),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(e.lcZ(5,4,t.taxRate/100)),e.xp6(3),e.Oqu(e.xi3(8,6,t.taxBase,o.currencyCode)),e.xp6(3),e.Oqu(e.xi3(11,9,t.taxTotal,o.currencyCode))}}function _i(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.shipping-address")," "))}function mi(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.billing-address")," "))}function gi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-order-payment-card",39),e.NdJ("settlePayment",function(i){return e.CHM(t),e.oxw(3).settlePayment(i)})("transitionPaymentState",function(i){return e.CHM(t),e.oxw(3).transitionPaymentState(i)})("settleRefund",function(i){return e.CHM(t),e.oxw(3).settleRefund(i)}),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw(2).ngIf;e.Q6J("currencyCode",o.currencyCode)("payment",t)}}function fi(r,n){if(1&r&&(e.ynx(0),e.YNc(1,gi,1,2,"vdr-order-payment-card",38),e.BQk()),2&r){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t.payments)}}function hi(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-fulfillment-card",40),e.NdJ("transitionState",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).transitionFulfillment(c.id,i)}),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(1),e.Q6J("fulfillment",t)("order",o)}}function xi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",23)(2,"div",24),e._UZ(3,"vdr-order-table",25),e.TgZ(4,"h4"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"table",26)(8,"thead")(9,"tr")(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.TgZ(22,"tbody"),e.YNc(23,pi,12,12,"tr",27),e.qZA()(),e._UZ(24,"vdr-custom-detail-component-host",28),e.TgZ(25,"vdr-order-history",29),e.NdJ("addNote",function(i){return e.CHM(t),e.oxw().addNote(i)})("updateNote",function(i){return e.CHM(t),e.oxw().updateNote(i)})("deleteNote",function(i){return e.CHM(t),e.oxw().deleteNote(i)}),e.ALo(26,"async"),e.qZA()(),e.TgZ(27,"div",30)(28,"vdr-order-custom-fields-card",31),e.NdJ("updateClick",function(i){return e.CHM(t),e.oxw().updateCustomFields(i)}),e.qZA(),e.TgZ(29,"div",32)(30,"div",33),e._uU(31),e.ALo(32,"translate"),e.qZA(),e.TgZ(33,"div",34)(34,"div",35),e._UZ(35,"vdr-customer-label",36),e.YNc(36,_i,3,3,"h6",0),e._UZ(37,"vdr-formatted-address",37),e.YNc(38,mi,3,3,"h6",0),e._UZ(39,"vdr-formatted-address",37),e.qZA()()(),e.YNc(40,fi,2,1,"ng-container",0),e.YNc(41,hi,2,2,"ng-container",27),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.xp6(2),e.Oqu(e.lcZ(6,22,"order.tax-summary")),e.xp6(6),e.Oqu(e.lcZ(12,24,"common.description")),e.xp6(3),e.Oqu(e.lcZ(15,26,"order.tax-rate")),e.xp6(3),e.Oqu(e.lcZ(18,28,"order.tax-base")),e.xp6(3),e.Oqu(e.lcZ(21,30,"order.tax-total")),e.xp6(3),e.Q6J("ngForOf",t.taxSummary),e.xp6(1),e.Q6J("entity$",o.entity$)("detailForm",o.detailForm),e.xp6(1),e.Q6J("order",t)("history",e.lcZ(26,32,o.history$)),e.xp6(3),e.Q6J("customFieldsConfig",o.customFields)("customFieldValues",t.customFields),e.xp6(3),e.hij(" ",e.lcZ(32,34,"order.customer")," "),e.xp6(4),e.Q6J("customer",t.customer),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.xp6(1),e.Q6J("address",t.shippingAddress),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.xp6(1),e.Q6J("address",t.billingAddress),e.xp6(1),e.Q6J("ngIf",t.payments&&t.payments.length),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class Me extends d.UT_{constructor(n,t,o,i,a,c,u,m){super(t,n,o,a),this.changeDetector=i,this.dataService=a,this.notificationService=c,this.modalService=u,this.orderTransitionService=m,this.detailForm=new l.cw({}),this.fetchHistory=new me.x,this.defaultStates=["AddingItems","ArrangingPayment","PaymentAuthorized","PaymentSettled","PartiallyShipped","Shipped","PartiallyDelivered","Delivered","Cancelled","Modifying","ArrangingAdditionalPayment"]}ngOnInit(){this.init(),this.entity$.pipe((0,D.q)(1)).subscribe(n=>{"Modifying"===n.state&&this.router.navigate(["./","modify"],{relativeTo:this.route})}),this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.history$=this.fetchHistory.pipe((0,at.O)(null),(0,h.w)(()=>this.dataService.order.getOrderHistory(this.id,{sort:{createdAt:d.Asd.DESC}}).mapStream(n=>{var t;return null===(t=n.order)||void 0===t?void 0:t.history.items}))),this.nextStates$=this.entity$.pipe((0,S.U)(n=>this.defaultStates.includes(n.state)?n.nextStates.filter(o=>!this.defaultStates.includes(o)):n.nextStates))}ngOnDestroy(){this.destroy()}openStateDiagram(){this.entity$.pipe((0,D.q)(1),(0,h.w)(n=>this.modalService.fromComponent(Ae,{closable:!0,locals:{activeState:n.state}}))).subscribe()}transitionToState(n){this.dataService.order.transitionToState(this.id,n).subscribe(({transitionOrderToState:t})=>{switch(null==t?void 0:t.__typename){case"Order":this.notificationService.success((0,g.J)("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,g.J)("order.manually-transition-to-state-message"),retry:0}).subscribe()}transitionToModifying(){this.dataService.order.transitionToState(this.id,"Modifying").subscribe(({transitionOrderToState:n})=>{switch(null==n?void 0:n.__typename){case"Order":this.router.navigate(["./modify"],{relativeTo:this.route});break;case"OrderStateTransitionError":this.notificationService.error(n.transitionError)}})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe(()=>{this.notificationService.success((0,g.J)("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,g.J)("order.settle-payment-success")):this.notificationService.error((0,g.J)("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,g.J)("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,g.J)("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){var t;const o=(null!==(t=n.fulfillments)&&void 0!==t?t:[]).reduce((a,c)=>[...a,...c.summary],[]);let i=!0;for(const a of n.lines)o.filter(u=>u.orderLine.id===a.id).reduce((u,m)=>u+m.quantity,0)<a.quantity&&(i=!1);return!i&&!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,R.summate)(n.modifications.filter(t=>!t.isSettled),"priceChange")}outstandingPaymentAmount(n){var t,o,i;const a=u=>"Cancelled"!==u.state&&"Declined"!==u.state&&"Error"!==u.state;let c=0;for(const u of null!==(o=null===(t=n.payments)||void 0===t?void 0:t.filter(a))&&void 0!==o?o:[]){const m=null!==(i=u.refunds.filter(y=>"Failed"!==y.state))&&void 0!==i?i:[],x=(0,R.summate)(m,"total");c+=u.amount-x}return n.totalWithTax-c}addManualPayment(n){const t=n.state;this.modalService.fromComponent(ue,{closable:!0,locals:{outstandingAmount:this.outstandingPaymentAmount(n),currencyCode:n.currencyCode}}).pipe((0,h.w)(o=>o?this.dataService.order.addManualPaymentToOrder({orderId:this.id,transactionId:o.transactionId,method:o.method,metadata:o.metadata||{}}):P.E),(0,h.w)(({addManualPaymentToOrder:o})=>{switch(o.__typename){case"Order":return this.notificationService.success((0,g.J)("order.add-payment-to-order-success")),"ArrangingAdditionalPayment"===t?this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates):this.dataService.order.transitionToState(this.id,"PaymentSettled").pipe((0,ze.h)("PaymentSettled"));case"ManualPaymentStateError":return this.notificationService.error(o.message),P.E;default:return P.E}})).subscribe(o=>{o&&this.refetchOrder({result:o})})}fulfillOrder(){this.entity$.pipe((0,D.q)(1),(0,h.w)(n=>this.modalService.fromComponent(ve,{size:"xl",locals:{order:n}})),(0,h.w)(n=>n?this.dataService.order.createFulfillment(n):(0,q.of)(void 0)),(0,h.w)(n=>this.refetchOrder(n).pipe((0,ze.h)(n)))).subscribe(n=>{if(n){const{addFulfillmentToOrder:t}=n;switch(t.__typename){case"Fulfillment":this.notificationService.success((0,g.J)("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,R.assertNever)(t)}}})}transitionFulfillment(n,t){this.dataService.order.transitionFulfillmentToState(n,t).pipe((0,h.w)(o=>this.refetchOrder(o))).subscribe(()=>{this.notificationService.success((0,g.J)("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(Ie,{size:"md",locals:{refund:n}}).pipe((0,h.w)(t=>t?this.dataService.order.settleRefund({transactionId:t,id:n.id},this.id):(0,q.of)(void 0))).subscribe(t=>{t&&this.notificationService.success((0,g.J)("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,h.w)(i=>this.refetchOrder(i))).subscribe(i=>{this.notificationService.success((0,g.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(n){this.modalService.fromComponent(d.UlA,{closable:!0,locals:{displayPrivacyControls:!0,note:n.data.note,noteIsPrivate:!n.isPublic}}).pipe((0,h.w)(t=>t?this.dataService.order.updateOrderNote({noteId:n.id,isPublic:!t.isPrivate,note:t.note}):P.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,g.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(n){return this.modalService.dialog({title:(0,g.J)("common.confirm-delete-note"),body:n.data.note,buttons:[{type:"secondary",label:(0,g.J)("common.cancel")},{type:"danger",label:(0,g.J)("common.delete"),returnValue:!0}]}).pipe((0,h.w)(t=>t?this.dataService.order.deleteOrderNote(n.id):P.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,g.J)("common.notify-delete-success"),{entity:"Note"})})}orderHasSettledPayments(n){var t;return!!(null===(t=n.payments)||void 0===t?void 0:t.find(o=>"Settled"===o.state))}cancelOrder(n){this.modalService.fromComponent(_e,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>t?this.dataService.order.cancelOrder(t):(0,q.of)(void 0)),(0,h.w)(t=>this.refetchOrder(t))).subscribe(t=>{t&&this.notificationService.success((0,g.J)("order.cancelled-order-success"))})}refundOrder(n){this.modalService.fromComponent(Te,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>{var o;return t?(null===(o=t.cancel.lines)||void 0===o?void 0:o.length)?this.dataService.order.cancelOrder(t.cancel).pipe((0,S.U)(i=>{const a=i.cancelOrder;switch(a.__typename){case"Order":return this.refetchOrder(a).subscribe(),this.notificationService.success((0,g.J)("order.cancelled-order-success")),t;case"CancelActiveOrderError":case"QuantityTooGreatError":case"MultipleOrderError":case"OrderStateTransitionError":case"EmptyOrderLineSelectionError":return void this.notificationService.error(a.message)}})):[t]:(0,q.of)(void 0)}),(0,h.w)(t=>t?t.refund.lines.length?this.dataService.order.refundOrder(t.refund).pipe((0,S.U)(o=>o.refundOrder)):[void 0]:(0,q.of)(void 0))).subscribe(t=>{if(t)switch(t.__typename){case"Refund":this.refetchOrder(t).subscribe(),"Failed"===t.state?this.notificationService.error((0,g.J)("order.refund-order-failed")):this.notificationService.success((0,g.J)("order.refund-order-success"));break;case"AlreadyRefundedError":case"NothingToRefundError":case"PaymentOrderMismatchError":case"RefundOrderStateError":case"RefundStateTransitionError":this.notificationService.error(t.message)}})}refetchOrder(n){return this.fetchHistory.next(),n?this.dataService.order.getOrder(this.id).single$:(0,q.of)(void 0)}setFormValues(n){}}Me.\u0275fac=function(n){return new(n||Me)(e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(N))},Me.\u0275cmp=e.Xpm({type:Me,selectors:[["vdr-order-detail"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"icon-button",3,"title","click"],["shape","list"],["locationId","order-detail"],["class","btn btn-primary",3,"click",4,"ngIf"],[1,"btn","btn-primary",3,"disabled","click"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngIf"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],["shape","step-forward-2",1,"is-warning"],[1,"btn","btn-primary",3,"click"],["shape","pencil"],["shape","error-standard",1,"is-error"],[4,"ngIf","ngIfElse"],["cancelOnly",""],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["shape","step-forward-2"],[1,"clr-row"],[1,"clr-col-lg-8"],[3,"order","orderLineCustomFields"],[1,"table"],[4,"ngFor","ngForOf"],["locationId","order-detail",3,"entity$","detailForm"],[3,"order","history","addNote","updateNote","deleteNote"],[1,"clr-col-lg-4","order-cards"],[3,"customFieldsConfig","customFieldValues","updateClick"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text"],[3,"customer"],[3,"address"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund",4,"ngFor","ngForOf"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund"],[3,"fulfillment","order","transitionState"]],template:function(n,t){1&n&&(e.YNc(0,ui,29,21,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,xi,42,36,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[_.O5,b.Kk,b.BN,Xe.V,je.G,p.qvL,b.mz,xt.W,Q.J,k.U,E.N,Pe.H,_.sg,j,zr.C,qe,z,Ke.d,Ee.b,Se,ye],pipes:[_.Ov,f.X$,v.k,M.N,_.Zx],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)}"],changeDetection:0});var J,r,vi=s(2814),Qe=s(8951),Zt=s(9196);function Ci(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.confirm-modifications"))}function yi(r,n){if(1&r&&(e.TgZ(0,"option",9),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw(2);e.Q6J("ngValue",t),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,4,t.amount,o.order.currencyCode)," ")}}function Zi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"clr-select-container")(2,"label"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"select",5),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().selectedPayment=i}),e.YNc(6,yi,3,7,"option",6),e.qZA()(),e.TgZ(7,"label",7),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"textarea",8),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().refundNote=i}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,5,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment),e.xp6(1),e.Q6J("ngForOf",t.order.payments),e.xp6(2),e.Oqu(e.lcZ(9,7,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("ngModel",t.refundNote)}}function bi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.priceDifference<0&&!t.selectedPayment),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.confirm")," ")}}(r=J||(J={}))[r.Refund=0]="Refund",r[r.Payment=1]="Payment",r[r.PriceUnchanged=2]="PriceUnchanged",r[r.Cancel=3]="Cancel";class Ne{get priceDifference(){return this.order.totalWithTax-this.originalTotalWithTax}ngOnInit(){this.refundNote=this.modifyOrderInput.note||""}cancel(){this.resolveWith({result:J.Cancel})}submit(){0<this.priceDifference?this.resolveWith({result:J.Payment}):this.priceDifference<0?this.resolveWith({result:J.Refund,refundPaymentId:this.selectedPayment.id,refundNote:this.refundNote}):this.resolveWith({result:J.PriceUnchanged})}}Ne.\u0275fac=function(n){return new(n||Ne)},Ne.\u0275cmp=e.Xpm({type:Ne,selectors:[["vdr-order-edits-preview-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[3,"order","orderLineCustomFields"],[1,"h4"],[4,"ngIf"],["vdrDialogButtons",""],["clrSelect","","name","options",3,"ngModel","ngModelChange"],[3,"ngValue",4,"ngFor","ngForOf"],[1,"clr-control-label"],["name","refundNote","clrTextarea","","required","",3,"ngModel","ngModelChange"],[3,"ngValue"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,Ci,2,3,"ng-template",0),e._UZ(1,"vdr-order-table",1),e.TgZ(2,"h4",2),e._uU(3),e.ALo(4,"translate"),e.TgZ(5,"strong"),e._uU(6),e.ALo(7,"localeCurrency"),e.qZA()(),e.YNc(8,Zi,11,9,"div",3),e.YNc(9,bi,6,7,"ng-template",4)),2&n&&(e.xp6(1),e.Q6J("order",t.order)("orderLineCustomFields",t.orderLineCustomFields),e.xp6(2),e.hij(" ",e.lcZ(4,5,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(7,7,t.priceDifference,t.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.priceDifference<0))},directives:[I.q,j,_.O5,p.dTv,p.MgK,Z.y,l.EJ,p.otW,l.JJ,l.On,_.sg,l.YN,l.Kr,l.Fj,p.XE5,l.Q7,w.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var Oi=s(7122);function Ai(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e._UZ(5,"vdr-order-state-label",3),e.qZA()(),e.TgZ(6,"vdr-ab-right")(7,"button",4),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().transitionToPriorState(a)}),e._uU(8),e.ALo(9,"translate"),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("entity",e.lcZ(4,3,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(3),e.hij(" ",e.lcZ(9,5,"order.cancel-modification")," ")}}function Ti(r,n){1&r&&(e.TgZ(0,"th"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.custom-fields")))}function Ii(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}const bt=function(r){return[r]};function Li(r,n){if(1&r&&(e.TgZ(0,"td",42),e._UZ(1,"vdr-tabbed-custom-fields",43),e.qZA()),2&r){const t=e.oxw().index,o=e.oxw(2);e.xp6(1),e.Q6J("customFields",o.orderLineCustomFields)("customFieldsFormGroup",o.orderLineCustomFieldsFormArray.get(e.VKq(3,bt,t)))("compact",!0)}}function qi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",29)(1,"td",30),e.YNc(2,Ii,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateLineQuantity(c,i.target.value)}),e.qZA(),e._UZ(16,"vdr-line-refunds",37)(17,"vdr-line-fulfillment",38),e.qZA(),e.YNc(18,Li,2,5,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"localeCurrency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"localeCurrency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.ekj("is-cancelled",0===t.quantity)("modified",i.isLineModified(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,19,t.unitPriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,24,t.unitPrice,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(1),e.Q6J("line",t)("payments",o.payments),e.xp6(1),e.Q6J("line",t)("orderState",o.state),e.xp6(1),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,27,t.linePriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,30,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,32,t.linePrice,o.currencyCode)," ")}}function Fi(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.productAsset,"tiny"),e.LSH)}}function wi(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",48),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(2).index,i=e.oxw(2);e.xp6(1),e.Q6J("customField",t)("customFieldsFormGroup",i.addItemCustomFieldsFormArray.get(e.VKq(3,bt,o)))("compact",!0)}}function Si(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,wi,2,5,"ng-container",47),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function Mi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",44)(1,"td",30),e.YNc(2,Fi,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateAddedItemQuantity(c,i.target.value)}),e.qZA(),e.TgZ(16,"button",45),e.NdJ("click",function(){const a=e.CHM(t).index;return e.oxw(2).removeAddedItem(a)}),e._UZ(17,"clr-icon",46),e.qZA()(),e.YNc(18,Si,2,1,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"currency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"currency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",t.productAsset),e.xp6(2),e.Oqu(t.productVariantName),e.xp6(2),e.Oqu(t.sku),e.xp6(2),e.hij(" ",e.xi3(9,11,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,14,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,16,t.price,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,19,t.priceWithTax*t.quantity/100,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,24,t.price*t.quantity/100,o.currencyCode)," ")}}function Ni(r,n){1&r&&e._UZ(0,"td")}function Ji(r,n){if(1&r&&(e.TgZ(0,"tr",49)(1,"td",50),e._uU(2),e.qZA(),e.TgZ(3,"td",33),e._uU(4),e.qZA(),e._UZ(5,"td",51)(6,"td"),e.YNc(7,Ni,1,0,"td",0),e.TgZ(8,"td",40),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",16),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(10,6,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,11,t.price,o.currencyCode)," ")}}function Ui(r,n){1&r&&e._UZ(0,"td")}function Di(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"localeCurrency"),e.TgZ(3,"div",16),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(2).ngIf;e.xp6(1),e.hij(" ",e.xi3(2,3,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(4,6,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(6,8,t.price,o.currencyCode)," ")}}function Pi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",52)(1,"td",50),e._uU(2),e.TgZ(3,"button",45),e.NdJ("click",function(){const a=e.CHM(t).index;return e.oxw(2).removeSurcharge(a)}),e._UZ(4,"clr-icon",46),e.qZA()(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e._UZ(7,"td",51)(8,"td"),e.YNc(9,Ui,1,0,"td",0),e.TgZ(10,"td",40),e.YNc(11,Di,7,11,"ng-container",0),e.qZA()()}if(2&r){const t=n.$implicit,o=e.oxw(2);e.xp6(2),e.hij(" ",t.description," "),e.xp6(4),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Q6J("ngIf",o.getSurchargePrices(t))}}function Qi(r,n){1&r&&e._UZ(0,"td")}function ki(r,n){if(1&r&&(e._UZ(0,"img",59),e.ALo(1,"assetPreview")),2&r){const t=n.ngIf;e.Q6J("src",e.xi3(1,1,t,"tiny"),e.LSH)}}function Ei(r,n){if(1&r&&(e.TgZ(0,"div",56),e.YNc(1,ki,2,4,"img",57),e.TgZ(2,"div")(3,"strong",58),e._uU(4),e.qZA(),e.TgZ(5,"small"),e._uU(6),e.qZA(),e.TgZ(7,"div"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw(2).ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.addItemSelectedVariant.productAsset),e.xp6(3),e.Oqu(o.addItemSelectedVariant.productVariantName),e.xp6(2),e.Oqu(o.addItemSelectedVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,4,o.getSelectedItemPrice(o.addItemSelectedVariant),t.currencyCode)," ")}}function Yi(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",60),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(3);e.xp6(1),e.Q6J("readonly",!o.addItemSelectedVariant)("customField",t)("customFieldsFormGroup",o.addItemCustomFieldsForm)("compact",!0)}}function ji(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"vdr-product-variant-selector",53),e.NdJ("productSelected",function(i){e.CHM(t);return e.oxw(2).addItemSelectedVariant=i}),e.qZA(),e.YNc(2,Ei,10,7,"div",54),e.YNc(3,Yi,2,4,"ng-container",47),e.TgZ(4,"button",55),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.addItemToOrder(i.addItemSelectedVariant)}),e._uU(5),e.ALo(6,"translate"),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngIf",t.addItemSelectedVariant),e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields),e.xp6(1),e.Q6J("disabled",!t.addItemSelectedVariant||t.addItemCustomFieldsForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(6,4,"order.add-item-to-order")," ")}}function Ri(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-coupon-code-selector",61),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("control",t.couponCodesControl)}}const Hi=function(r){return{rate:r}};function $i(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"form",62),e.NdJ("submit",function(){e.CHM(t);const i=e.oxw(2);return i.addSurcharge(i.surchargeForm.value)}),e.TgZ(2,"vdr-form-field",63),e.ALo(3,"translate"),e._UZ(4,"input",64),e.qZA(),e.TgZ(5,"vdr-form-field",65),e.ALo(6,"translate"),e._UZ(7,"input",66),e.qZA(),e.TgZ(8,"vdr-form-field",67),e.ALo(9,"translate"),e._UZ(10,"vdr-currency-input",68),e.qZA(),e.TgZ(11,"vdr-form-field",69),e.ALo(12,"translate"),e._UZ(13,"input",70),e.qZA(),e.TgZ(14,"vdr-form-field",71),e.ALo(15,"translate"),e.TgZ(16,"vdr-affixed-input",72),e._UZ(17,"input",73),e.qZA()(),e.TgZ(18,"vdr-form-field",74),e.ALo(19,"translate"),e._UZ(20,"input",75),e.qZA(),e.TgZ(21,"button",76),e._uU(22),e.ALo(23,"translate"),e.qZA()()()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();let i,a;e.xp6(1),e.Q6J("formGroup",o.surchargeForm),e.xp6(1),e.Q6J("label",e.lcZ(3,10,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(6,12,"order.product-sku")),e.xp6(3),e.Q6J("label",e.lcZ(9,14,"common.price")),e.xp6(2),e.Q6J("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("label",e.xi3(12,16,"catalog.price-includes-tax-at",e.VKq(25,Hi,null==(i=o.surchargeForm.get("taxRate"))?null:i.value))),e.xp6(3),e.Q6J("label",e.lcZ(15,19,"order.tax-rate")),e.xp6(4),e.Q6J("label",e.lcZ(19,21,"order.tax-description")),e.xp6(3),e.Q6J("disabled",o.surchargeForm.invalid||o.surchargeForm.pristine||0===(null==(a=o.surchargeForm.get("price"))?null:a.value)),e.xp6(1),e.hij(" ",e.lcZ(23,23,"order.add-surcharge")," ")}}function Vi(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.shippingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function Bi(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.billingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}const nt=function(r){return{count:r}};function Gi(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-items",e.VKq(4,nt,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))," ")}}function Wi(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adjusting-lines",e.VKq(4,nt,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))," ")}}function Xi(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-surcharges",e.VKq(4,nt,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))," ")}}function Ki(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-shipping-address")," "))}function zi(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-billing-address")," "))}function ea(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",5)(2,"div",6)(3,"table",7)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.YNc(19,Ti,3,3,"th",0),e.TgZ(20,"th"),e._uU(21),e.ALo(22,"translate"),e.qZA()()(),e.TgZ(23,"tbody"),e.YNc(24,qi,26,35,"tr",8),e.YNc(25,Mi,26,27,"tr",9),e.YNc(26,Ji,15,14,"tr",10),e.YNc(27,Pi,12,4,"tr",11),e.TgZ(28,"tr",12)(29,"td",13),e._uU(30),e.ALo(31,"translate"),e.qZA(),e.TgZ(32,"td",14),e._uU(33),e.qZA(),e._UZ(34,"td",15),e.YNc(35,Qi,1,0,"td",0),e.TgZ(36,"td",14),e._uU(37),e.ALo(38,"localeCurrency"),e.TgZ(39,"div",16),e.ALo(40,"translate"),e._uU(41),e.ALo(42,"localeCurrency"),e.qZA()()()()(),e.TgZ(43,"h4",17),e._uU(44),e.ALo(45,"translate"),e.qZA(),e.TgZ(46,"clr-accordion")(47,"clr-accordion-panel")(48,"clr-accordion-title"),e._uU(49),e.ALo(50,"translate"),e.qZA(),e.YNc(51,ji,7,6,"clr-accordion-content",18),e.qZA(),e.TgZ(52,"clr-accordion-panel")(53,"clr-accordion-title"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.YNc(56,Ri,2,1,"clr-accordion-content",18),e.qZA(),e.TgZ(57,"clr-accordion-panel")(58,"clr-accordion-title"),e._uU(59),e.ALo(60,"translate"),e.qZA(),e.YNc(61,$i,24,27,"clr-accordion-content",18),e.qZA(),e.TgZ(62,"clr-accordion-panel")(63,"clr-accordion-title"),e._uU(64),e.ALo(65,"translate"),e.qZA(),e.YNc(66,Vi,3,5,"clr-accordion-content",18),e.qZA(),e.TgZ(67,"clr-accordion-panel")(68,"clr-accordion-title"),e._uU(69),e.ALo(70,"translate"),e.qZA(),e.YNc(71,Bi,3,5,"clr-accordion-content",18),e.qZA()()(),e.TgZ(72,"div",19)(73,"div",20)(74,"div",21),e._uU(75),e.ALo(76,"translate"),e.qZA(),e.TgZ(77,"div",22)(78,"ul"),e.YNc(79,Gi,3,6,"li",0),e.YNc(80,Wi,3,6,"li",0),e.YNc(81,Xi,3,6,"li",0),e.YNc(82,Ki,3,3,"li",0),e.YNc(83,zi,3,3,"li",0),e.qZA()(),e.TgZ(84,"div",22)(85,"label",23),e._uU(86),e.ALo(87,"translate"),e.qZA(),e.TgZ(88,"textarea",24),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().note=i}),e.qZA(),e.TgZ(89,"clr-checkbox-wrapper",25)(90,"input",26),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().recalculateShipping=i}),e.qZA(),e.TgZ(91,"label"),e._uU(92),e.ALo(93,"translate"),e.qZA()()(),e.TgZ(94,"div",27)(95,"button",28),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().previewAndModify(a)}),e._uU(96),e.ALo(97,"translate"),e.qZA()()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(8),e.Oqu(e.lcZ(9,35,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,37,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,39,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(18,41,"order.quantity")),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Oqu(e.lcZ(22,43,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.lines),e.xp6(1),e.Q6J("ngForOf",o.addedLines)("ngForTrackBy",o.trackByProductVariantId),e.xp6(1),e.Q6J("ngForOf",t.surcharges),e.xp6(1),e.Q6J("ngForOf",o.modifyOrderInput.surcharges),e.xp6(3),e.Oqu(e.lcZ(31,45,"order.shipping")),e.xp6(3),e.Oqu(null==t.shippingLines[0]||null==t.shippingLines[0].shippingMethod?null:t.shippingLines[0].shippingMethod.name),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(38,47,t.shippingWithTax,t.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(40,50,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(42,52,t.shipping,t.currencyCode)," "),e.xp6(3),e.Oqu(e.lcZ(45,55,"order.modifications")),e.xp6(5),e.Oqu(e.lcZ(50,57,"order.add-item-to-order")),e.xp6(5),e.Oqu(e.lcZ(55,59,"order.set-coupon-codes")),e.xp6(5),e.Oqu(e.lcZ(60,61,"order.add-surcharge")),e.xp6(5),e.Oqu(e.lcZ(65,63,"order.edit-shipping-address")),e.xp6(5),e.Oqu(e.lcZ(70,65,"order.edit-billing-address")),e.xp6(6),e.hij(" ",e.lcZ(76,67,"order.modification-summary")," "),e.xp6(4),e.Q6J("ngIf",null==o.modifyOrderInput.addItems?null:o.modifyOrderInput.addItems.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.adjustOrderLines?null:o.modifyOrderInput.adjustOrderLines.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.surcharges?null:o.modifyOrderInput.surcharges.length),e.xp6(1),e.Q6J("ngIf",o.shippingAddressForm.dirty),e.xp6(1),e.Q6J("ngIf",o.billingAddressForm.dirty),e.xp6(3),e.Oqu(e.lcZ(87,69,"order.note")),e.xp6(2),e.Q6J("ngModel",o.note),e.xp6(2),e.Q6J("ngModel",o.recalculateShipping),e.xp6(2),e.Oqu(e.lcZ(93,71,"order.modification-recalculate-shipping")),e.xp6(3),e.Q6J("disabled",!o.canPreviewChanges()),e.xp6(1),e.hij(" ",e.lcZ(97,73,"order.preview-changes")," ")}}class Je extends d.UT_{constructor(n,t,o,i,a,c,u,m){super(t,n,o,a),this.changeDetector=i,this.dataService=a,this.notificationService=c,this.modalService=u,this.orderTransitionService=m,this.detailForm=new l.cw({}),this.couponCodesControl=new l.NI,this.modifyOrderInput={dryRun:!0,orderId:"",addItems:[],adjustOrderLines:[],surcharges:[],note:"",updateShippingAddress:{},updateBillingAddress:{}},this.note="",this.recalculateShipping=!0,this.addedVariants=new Map}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 Object.assign(Object.assign({},o),{price:n(o.price),priceWithTax:n(o.priceWithTax),quantity:t.quantity})}).filter(R.notNullOrUndefined)}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,Qe.R)(this.destroy$)).subscribe(n=>{var t,o,i,a,c,u,m,x,y,O,A,oe,ie,ae,le,ce,de,T;n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm=new l.cw({description:new l.NI("",l.kI.required),sku:new l.NI(""),price:new l.NI(0,l.kI.required),priceIncludesTax:new l.NI(!0),taxRate:new l.NI(0),taxDescription:new l.NI("")}),this.shippingAddressForm||(this.shippingAddressForm=new l.cw({fullName:new l.NI(null===(t=n.shippingAddress)||void 0===t?void 0:t.fullName),company:new l.NI(null===(o=n.shippingAddress)||void 0===o?void 0:o.company),streetLine1:new l.NI(null===(i=n.shippingAddress)||void 0===i?void 0:i.streetLine1),streetLine2:new l.NI(null===(a=n.shippingAddress)||void 0===a?void 0:a.streetLine2),city:new l.NI(null===(c=n.shippingAddress)||void 0===c?void 0:c.city),province:new l.NI(null===(u=n.shippingAddress)||void 0===u?void 0:u.province),postalCode:new l.NI(null===(m=n.shippingAddress)||void 0===m?void 0:m.postalCode),countryCode:new l.NI(null===(x=n.shippingAddress)||void 0===x?void 0:x.countryCode),phoneNumber:new l.NI(null===(y=n.shippingAddress)||void 0===y?void 0:y.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress)),this.billingAddressForm||(this.billingAddressForm=new l.cw({fullName:new l.NI(null===(O=n.billingAddress)||void 0===O?void 0:O.fullName),company:new l.NI(null===(A=n.billingAddress)||void 0===A?void 0:A.company),streetLine1:new l.NI(null===(oe=n.billingAddress)||void 0===oe?void 0:oe.streetLine1),streetLine2:new l.NI(null===(ie=n.billingAddress)||void 0===ie?void 0:ie.streetLine2),city:new l.NI(null===(ae=n.billingAddress)||void 0===ae?void 0:ae.city),province:new l.NI(null===(le=n.billingAddress)||void 0===le?void 0:le.province),postalCode:new l.NI(null===(ce=n.billingAddress)||void 0===ce?void 0:ce.postalCode),countryCode:new l.NI(null===(de=n.billingAddress)||void 0===de?void 0:de.countryCode),phoneNumber:new l.NI(null===(T=n.billingAddress)||void 0===T?void 0:T.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress)),this.orderLineCustomFieldsFormArray=new l.Oe([]);for(const F of n.lines){const se=new l.cw({});for(const{name:V}of this.orderLineCustomFields)se.addControl(V,new l.NI(F.customFields[V]));se.valueChanges.pipe((0,Qe.R)(this.destroy$)).subscribe(V=>{let Ve=this.modifyOrderInput.adjustOrderLines.find(va=>va.orderLineId===F.id);Ve||(Ve={orderLineId:F.id,quantity:F.quantity},this.modifyOrderInput.adjustOrderLines.push(Ve)),this.orderLineCustomFields.length&&(Ve.customFields=V)}),this.orderLineCustomFieldsFormArray.push(se)}}),this.addItemCustomFieldsFormArray=new l.Oe([]),this.addItemCustomFieldsForm=new l.cw({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new l.NI);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,Zt.d)(1)),this.dataService.order.getOrderHistory(this.id,{take:1,sort:{createdAt:d.Asd.DESC},filter:{type:{eq:d.iYD.ORDER_STATE_TRANSITION}}}).single$.subscribe(({order:n})=>{this.previousState=null==n?void 0:n.history.items[0].data.from})}ngOnDestroy(){this.destroy()}transitionToPriorState(n){this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates).subscribe(t=>{this.router.navigate([".."],{relativeTo:this.route})})}canPreviewChanges(){const{addItems:n,adjustOrderLines:t,surcharges:o}=this.modifyOrderInput;return!!(null==n?void 0:n.length)||!!(null==o?void 0:o.length)||!!(null==t?void 0:t.length)||this.shippingAddressForm.dirty&&this.shippingAddressForm.valid||this.billingAddressForm.dirty&&this.billingAddressForm.valid||this.couponCodesControl.dirty}isLineModified(n){var t;return!!(null===(t=this.modifyOrderInput.adjustOrderLines)||void 0===t?void 0:t.find(o=>o.orderLineId===n.id&&o.quantity!==n.quantity))}updateLineQuantity(n,t){const{adjustOrderLines:o}=this.modifyOrderInput;let i=null==o?void 0:o.find(a=>a.orderLineId===n.id);i&&+t===n.quantity&&(null==o||o.splice(null==o?void 0:o.indexOf(i),1)),i||(i={orderLineId:n.id,quantity:+t},null==o||o.push(i)),i.quantity=+t}updateAddedItemQuantity(n,t){var o;const i=null===(o=this.modifyOrderInput.addItems)||void 0===o?void 0:o.find(a=>a.productVariantId===n.productVariantId);i&&(i.quantity=+t)}trackByProductVariantId(n,t){return t.productVariantId}getSelectedItemPrice(n){return"SinglePrice"===(null==n?void 0:n.priceWithTax.__typename)?n.priceWithTax.value:0}addItemToOrder(n){var t,o;if(!n)return;const i=this.orderLineCustomFields.length?this.addItemCustomFieldsForm.value:void 0;let a=null===(t=this.modifyOrderInput.addItems)||void 0===t?void 0:t.find(c=>this.isMatchingAddItemRow(c,n,i));if(a?a.quantity++:(a={productVariantId:n.productVariantId,quantity:1},i&&(a.customFields=i),null===(o=this.modifyOrderInput.addItems)||void 0===o||o.push(a)),i){const c=new l.cw({});for(const[u,m]of Object.entries(i))c.addControl(u,new l.NI(m));this.addItemCustomFieldsFormArray.push(c),c.valueChanges.pipe((0,Qe.R)(this.destroy$)).subscribe(u=>{a&&(a.customFields=u)})}this.addItemCustomFieldsForm.reset({}),this.addItemSelectedVariant=void 0,this.addedVariants.set(n.productVariantId,n)}isMatchingAddItemRow(n,t,o){return n.productVariantId===t.productVariantId&&JSON.stringify(n.customFields)===JSON.stringify(o)}removeAddedItem(n){this.modifyOrderInput.addItems.splice(n,1),-1<n&&this.addItemCustomFieldsFormArray.removeAt(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){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.push(n),this.surchargeForm.reset({price:0,priceIncludesTax:!0,taxRate:0})}removeSurcharge(n){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.splice(n,1)}previewAndModify(n){var t;const o=Object.assign(Object.assign({},this.modifyOrderInput),{adjustOrderLines:this.modifyOrderInput.adjustOrderLines.map(c=>(0,d.EJQ)((0,vi.I)(c),this.orderLineCustomFields))}),i=Object.assign(Object.assign(Object.assign(Object.assign({},o),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:null!==(t=this.note)&&void 0!==t?t:"",options:{recalculateShipping:this.recalculateShipping}}),a=n.totalWithTax;this.dataService.order.modifyOrder(i).pipe((0,h.w)(({modifyOrder:c})=>{switch(c.__typename){case"Order":return this.modalService.fromComponent(Ne,{size:"xl",closable:!1,locals:{originalTotalWithTax:a,order:c,orderLineCustomFields:this.orderLineCustomFields,modifyOrderInput:i}});case"InsufficientStockError":case"NegativeQuantityError":case"NoChangesSpecifiedError":case"OrderLimitError":case"OrderModificationStateError":case"PaymentMethodMissingError":case"RefundPaymentIdMissingError":case"CouponCodeLimitError":case"CouponCodeExpiredError":case"CouponCodeInvalidError":return this.notificationService.error(c.message),(0,q.of)(!1);case null:case void 0:return(0,q.of)(!1);default:(0,R.assertNever)(c)}}),(0,h.w)(c=>{if(!c||c.result===J.Cancel)return this.dataService.order.getOrder(this.id).mapSingle(()=>!1);{const u=Object.assign(Object.assign({},i),{dryRun:!1});return c.result===J.Refund&&(u.refund={paymentId:c.refundPaymentId,reason:c.refundNote}),this.dataService.order.modifyOrder(u).pipe((0,h.w)(({modifyOrder:m})=>{if("Order"===m.__typename){const y=0<m.totalWithTax-a?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,y).pipe((0,ze.h)(!0))}return this.notificationService.error(m.message),P.E}))}})).subscribe(c=>{c&&this.router.navigate(["../"],{relativeTo:this.route})})}addAddressCustomFieldsFormGroup(n,t){var o;if(t&&this.addressCustomFields.length){const i=new l.cw({});for(const a of this.addressCustomFields){const c=a.name,u=null===(o=t.customFields)||void 0===o?void 0:o[c];i.addControl(c,new l.NI(u))}n.addControl("customFields",i)}}setFormValues(n,t){}}Je.\u0275fac=function(n){return new(n||Je)(e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(N))},Je.\u0275cmp=e.Xpm({type:Je,selectors:[["vdr-order-editor"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"btn","btn-secondary",3,"click"],[1,"clr-row"],[1,"clr-col-lg-8"],[1,"order-table","table"],["class","order-line",3,"is-cancelled","modified",4,"ngFor","ngForOf"],["class","modified",4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],["class","surcharge modified",4,"ngFor","ngForOf"],[1,"shipping"],[1,"left","clr-align-middle"],[1,"clr-align-middle"],["colspan","3"],[1,"net-price",3,"title"],[1,"mb2"],[4,"clrIfExpanded"],[1,"clr-col-lg-4","order-cards"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"clr-control-label"],["name","note","clrTextarea","","required","",3,"ngModel","ngModelChange"],[1,""],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],[1,"card-footer"],[1,"btn","btn-primary",3,"disabled","click"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],["type","number","min","0",3,"value","input"],[3,"line","payments"],[3,"line","orderState"],["class","order-line-custom-field align-middle",4,"ngIf"],[1,"align-middle","total"],[3,"src"],[1,"order-line-custom-field","align-middle"],["entityName","OrderLine",3,"customFields","customFieldsFormGroup","compact"],[1,"modified"],[1,"icon-button",3,"click"],["shape","trash"],[4,"ngFor","ngForOf"],["entityName","OrderLine",3,"customField","customFieldsFormGroup","compact"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle"],[1,"surcharge","modified"],[1,"mb4",3,"productSelected"],["class","flex mb4",4,"ngIf"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"flex","mb4"],["class","mr4",3,"src",4,"ngIf"],[1,"mr4"],[1,"mr4",3,"src"],["entityName","OrderLine",3,"readonly","customField","customFieldsFormGroup","compact"],[3,"control"],[3,"formGroup","submit"],["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",3,"disabled"],[3,"formGroup","availableCountries","customFields"]],template:function(n,t){1&n&&(e.YNc(0,Ai,10,7,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,ea,98,75,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[_.O5,b.Kk,b.BN,Xe.V,je.G,b.mz,_.sg,Z.y,Y,K,gt.y,p.q0d,p.qvL,Re.M,p.bZL,p.twP,p.GmI,p.dxz,p.UJ5,p.Nz$,p.DbV,p.r6y,_t.e,G,l._Y,l.JL,l.sg,Be.h,l.Fj,l.JJ,l.u,ht.K,l.Wl,p.KKC,Oi.K,l.qQ,l.Fd,l.wV,st.C,p.MgK,p.XE5,l.Q7,l.On,p.PEh],pipes:[_.Ov,f.X$,pe.M,v.k,_.H9],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-right: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)}.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%] 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}"],changeDetection:0});var Ot=s(6646),rt=s(116),ta=s(6852),na=s(9416),ra=s(365),oa=s(901),ia=s(8899),aa=s(6826);function la(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){const a=e.CHM(t).$implicit;return e.oxw(2).selectFilterPreset(a.name)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.ekj("btn-primary",o===t.name),e.xp6(1),e.hij(" ",e.lcZ(2,3,t.label)," ")}}function ca(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",17),e.YNc(1,la,3,5,"button",18),e.TgZ(2,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().selectFilterPreset("custom")}),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"clr-icon",20),e.qZA()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngForOf",o.filterPresets),e.xp6(1),e.ekj("btn-primary","custom"===t),e.xp6(1),e.hij(" ",e.lcZ(4,4,"order.filter-custom")," ")}}function da(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate"),e.ALo(2,"stateI18nToken")),2&r){const t=n.item;e.Oqu(e.lcZ(1,1,e.lcZ(2,3,t)))}}function sa(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"span",21),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA(),e.TgZ(4,"span",22),e.NdJ("click",function(){const i=e.CHM(t),a=i.item;return i.clear(a)}),e._uU(5,"\xd7"),e.qZA()}if(2&r){const t=n.item;e.xp6(1),e.hij(" ",e.lcZ(2,1,e.lcZ(3,3,t)),"")}}const ua=function(){return["./draft/create"]};function pa(r,n){1&r&&(e.TgZ(0,"a",24),e._UZ(1,"clr-icon",25),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&r&&(e.Q6J("routerLink",e.DdM(4,ua)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"catalog.create-draft-order")," "))}const _a=function(){return["CreateOrder"]};function ma(r,n){1&r&&(e.ynx(0),e.YNc(1,pa,4,5,"a",23),e.BQk()),2&r&&(e.xp6(1),e.Q6J("vdrIfPermissions",e.DdM(1,_a)))}const ga=function(r){return["./",r,"modify"]},fa=function(r){return["./draft",r]},ha=function(r){return["./",r]};function xa(r,n){if(1&r&&(e.TgZ(0,"td",26),e._uU(1),e.qZA(),e.TgZ(2,"td",26),e._UZ(3,"vdr-customer-label",27),e.qZA(),e.TgZ(4,"td",26),e._UZ(5,"vdr-order-state-label",28),e.qZA(),e.TgZ(6,"td",26),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td",26),e._uU(10),e.ALo(11,"timeAgo"),e.qZA(),e.TgZ(12,"td",26),e._uU(13),e.ALo(14,"localeDate"),e.qZA(),e.TgZ(15,"td",26),e._uU(16),e.qZA(),e.TgZ(17,"td",29),e._UZ(18,"vdr-table-row-action",30),e.ALo(19,"translate"),e.qZA()),2&r){const t=n.item,o=e.oxw();e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Q6J("customer",t.customer),e.xp6(2),e.Q6J("state",t.state),e.xp6(2),e.Oqu(e.xi3(8,9,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.lcZ(11,12,t.updatedAt)),e.xp6(3),e.Oqu(e.xi3(14,14,t.orderPlacedAt,"medium")),e.xp6(3),e.Oqu(o.getShippingNames(t)),e.xp6(2),e.Q6J("label",e.lcZ(19,17,"common.open"))("linkTo","Modifying"===t.state?e.VKq(19,ga,t.id):"Draft"===t.state?e.VKq(21,fa,t.id):e.VKq(23,ha,t.id))}}class Ue extends d.t7C{constructor(n,t,o,i,a){var c;super(i,a),this.serverConfigService=n,this.dataService=t,this.localStorageService=o,this.searchControl=new l.NI(""),this.searchOrderCodeControl=new l.NI(""),this.searchLastNameControl=new l.NI(""),this.orderStates=this.serverConfigService.getOrderProcessStates().map(m=>m.name),this.filterPresets=[{name:"open",label:(0,g.J)("order.filter-preset-open"),config:{active:!1,states:this.orderStates.filter(m=>"Delivered"!==m&&"Cancelled"!==m&&"Shipped"!==m&&"Draft"!==m)}},{name:"shipped",label:(0,g.J)("order.filter-preset-shipped"),config:{active:!1,states:["Shipped"]}},{name:"completed",label:(0,g.J)("order.filter-preset-completed"),config:{active:!1,states:["Delivered","Cancelled"]}},{name:"active",label:(0,g.J)("order.filter-preset-active"),config:{active:!0}},{name:"draft",label:(0,g.J)("order.filter-preset-draft"),config:{active:!1,states:["Draft"]}}],this.canCreateDraftOrder=!1,super.setQueryFn((m,x)=>this.dataService.order.getOrders({take:m,skip:x}).refetchOnChannelChange(),m=>m.orders,(m,x)=>this.createQueryOptions(m,x,this.searchControl.value,this.route.snapshot.queryParamMap.get("filter")||"open"));const u=this.localStorageService.get("orderListLastCustomFilters");u&&this.setQueryParam(u,{replaceUrl:!0}),this.canCreateDraftOrder=!!(null===(c=this.serverConfigService.getOrderProcessStates().find(m=>"Created"===m.name))||void 0===c?void 0:c.to.includes("Draft")),this.canCreateDraftOrder||(this.filterPresets=this.filterPresets.filter(m=>"draft"!==m.name))}ngOnInit(){var n;super.ngOnInit(),this.activePreset$=this.route.queryParamMap.pipe((0,S.U)(i=>i.get("filter")||"open"),(0,Ge.x)());const t=(0,Ot.T)(this.searchControl.valueChanges).pipe((0,rt.h)(i=>2<i.length||0===i.length),(0,We.b)(250));(0,Ot.T)(t,this.route.queryParamMap).pipe((0,Qe.R)(this.destroy$)).subscribe(i=>{this.refresh()});const o=this.route.snapshot.queryParamMap;this.customFilterForm=new l.cw({states:new l.NI(null!==(n=o.getAll("states"))&&void 0!==n?n:[]),placedAtStart:new l.NI(o.get("placedAtStart")),placedAtEnd:new l.NI(o.get("placedAtEnd"))})}selectFilterPreset(n){var t;const o=null!==(t=this.localStorageService.get("orderListLastCustomFilters"))&&void 0!==t?t:{},a="custom"===n?o:{states:void 0,placedAtStart:void 0,placedAtEnd:void 0};this.setQueryParam(Object.assign({filter:n,page:1},a),{replaceUrl:!0})}applyCustomFilters(){const n=this.customFilterForm.value,t={states:n.states,placedAtStart:n.placedAtStart,placedAtEnd:n.placedAtEnd};this.setQueryParam(Object.assign({filter:"custom"},t)),this.customFilterForm.markAsPristine(),this.localStorageService.set("orderListLastCustomFilters",t)}createQueryOptions(n,t,o,i){var a;const c=this.filterPresets.find(x=>x.name===i);let u={},m=d.FnJ.AND;if(c)null!=c.config.active&&(u.active={eq:c.config.active}),c.config.states&&(u.state={in:c.config.states});else if("custom"===i){const x=this.route.snapshot.queryParamMap,y=null!==(a=x.getAll("states"))&&void 0!==a?a:[],O=x.get("placedAtStart"),A=x.get("placedAtEnd");y.length&&(u.state={in:y}),O&&A?u.orderPlacedAt={between:{start:O,end:A}}:O?u.orderPlacedAt={after:O}:A&&(u.orderPlacedAt={before:A})}return o&&(u={customerLastName:{contains:o},transactionId:{contains:o},code:{contains:o}},m=d.FnJ.OR),{options:{skip:n,take:t,filter:Object.assign({},null!=u?u:{}),sort:{updatedAt:d.Asd.DESC},filterOperator:m}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}Ue.\u0275fac=function(n){return new(n||Ue)(e.Y36(d.iHG),e.Y36(d.DoR),e.Y36(d.n2A),e.Y36(C.F0),e.Y36(C.gz))},Ue.\u0275cmp=e.Xpm({type:Ue,selectors:[["vdr-order-list"]],features:[e.qOj],decls:61,vars:64,consts:[[1,"search-form"],["class","filter-presets btn-group btn-outline-primary",4,"ngIf"],["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[1,"custom-filters"],[3,"formGroup"],[1,"flex","align-center"],["appendTo","body","formControlName","states",3,"items","addTag","multiple","placeholder","clearable","searchable"],["ng-option-tmp",""],["ng-label-tmp",""],[1,"btn","btn-secondary",3,"disabled","click"],["shape","filter"],[1,"flex"],["formControlName","placedAtStart"],["formControlName","placedAtEnd"],["locationId","order-list"],[4,"ngIf"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"filter-presets","btn-group","btn-outline-primary"],["class","btn",3,"btn-primary","click",4,"ngFor","ngForOf"],[1,"btn",3,"click"],["shape","angle down"],[1,"ng-value-label"],["aria-hidden","true",1,"ng-value-icon","right",3,"click"],["class","btn btn-primary mt1",3,"routerLink",4,"vdrIfPermissions"],[1,"btn","btn-primary","mt1",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"customer"],[3,"state"],[1,"right","align-middle"],["iconShape","shopping-cart",3,"label","linkTo"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e.YNc(3,ca,6,6,"div",1),e.ALo(4,"async"),e._UZ(5,"input",2),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"div",3),e.ALo(8,"async"),e.TgZ(9,"form",4)(10,"div",5)(11,"ng-select",6),e.ALo(12,"translate"),e.YNc(13,da,3,5,"ng-template",7),e.YNc(14,sa,6,5,"ng-template",8),e.qZA(),e.TgZ(15,"button",9),e.NdJ("click",function(){return t.applyCustomFilters()}),e._uU(16),e.ALo(17,"translate"),e._UZ(18,"clr-icon",10),e.qZA()(),e.TgZ(19,"div",11)(20,"div")(21,"label"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e._UZ(24,"vdr-datetime-picker",12),e.qZA(),e.TgZ(25,"div")(26,"label"),e._uU(27),e.ALo(28,"translate"),e.qZA(),e._UZ(29,"vdr-datetime-picker",13),e.qZA()()()()(),e.TgZ(30,"vdr-ab-right"),e._UZ(31,"vdr-action-bar-items",14),e.YNc(32,ma,2,2,"ng-container",15),e.qZA()(),e.TgZ(33,"vdr-data-table",16),e.NdJ("pageChange",function(i){return t.setPageNumber(i)})("itemsPerPageChange",function(i){return t.setItemsPerPage(i)}),e.ALo(34,"async"),e.ALo(35,"async"),e.ALo(36,"async"),e.ALo(37,"async"),e.TgZ(38,"vdr-dt-column"),e._uU(39),e.ALo(40,"translate"),e.qZA(),e.TgZ(41,"vdr-dt-column"),e._uU(42),e.ALo(43,"translate"),e.qZA(),e.TgZ(44,"vdr-dt-column"),e._uU(45),e.ALo(46,"translate"),e.qZA(),e.TgZ(47,"vdr-dt-column"),e._uU(48),e.ALo(49,"translate"),e.qZA(),e.TgZ(50,"vdr-dt-column"),e._uU(51),e.ALo(52,"translate"),e.qZA(),e.TgZ(53,"vdr-dt-column"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.TgZ(56,"vdr-dt-column"),e._uU(57),e.ALo(58,"translate"),e.qZA(),e._UZ(59,"vdr-dt-column"),e.YNc(60,xa,20,25,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("ngIf",e.lcZ(4,28,t.activePreset$)),e.xp6(2),e.Q6J("formControl",t.searchControl)("placeholder",e.lcZ(6,30,"order.search-by-order-filters")),e.xp6(2),e.ekj("expanded","custom"===e.lcZ(8,32,t.activePreset$)),e.xp6(2),e.Q6J("formGroup",t.customFilterForm),e.xp6(2),e.Q6J("items",t.orderStates)("addTag",!1)("multiple",!0)("placeholder",e.lcZ(12,34,"state.all-orders"))("clearable",!0)("searchable",!1),e.xp6(4),e.Q6J("disabled",t.customFilterForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(17,36,"order.apply-filters")," "),e.xp6(6),e.Oqu(e.lcZ(23,38,"order.placed-at-start")),e.xp6(5),e.Oqu(e.lcZ(28,40,"order.placed-at-end")),e.xp6(5),e.Q6J("ngIf",t.canCreateDraftOrder),e.xp6(1),e.Q6J("items",e.lcZ(34,42,t.items$))("itemsPerPage",e.lcZ(35,44,t.itemsPerPage$))("totalItems",e.lcZ(36,46,t.totalItems$))("currentPage",e.lcZ(37,48,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(40,50,"common.code")),e.xp6(3),e.Oqu(e.lcZ(43,52,"order.customer")),e.xp6(3),e.Oqu(e.lcZ(46,54,"order.state")),e.xp6(3),e.Oqu(e.lcZ(49,56,"order.total")),e.xp6(3),e.Oqu(e.lcZ(52,58,"common.updated-at")),e.xp6(3),e.Oqu(e.lcZ(55,60,"order.placed-at")),e.xp6(3),e.Oqu(e.lcZ(58,62,"order.shipping")))},directives:[b.Kk,b.BN,_.O5,_.sg,p.qvL,Z.y,l.Fj,l.JJ,l.oH,l._Y,l.JL,l.sg,L.w9,l.u,L.ir,L.mR,p.MgK,ta.I,b.mz,xt.W,na.H,C.yS,ra.Q,oa.E,Ke.d,je.G,ia.v],pipes:[_.Ov,f.X$,M.N,v.k,aa.e,He.H],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});class U{constructor(n,t){this.router=n,this.dataService=t}resolve(n,t){const o=n.paramMap.get("id"),i=this.router.events.pipe((0,rt.h)(c=>c instanceof C.wM)),a=this.dataService.order.getOrder(o).mapStream(c=>c.order).pipe((0,h.w)(c=>"Draft"===(null==c?void 0:c.state)&&n.component!==ee?(this.router.navigate(["/orders/draft",o]),P.E):[c]),(0,Qe.R)(i),(0,rt.h)(R.notNullOrUndefined),(0,Zt.d)(1));return a.pipe((0,D.q)(1),(0,S.U)(()=>a))}}U.\u0275fac=function(n){return new(n||U)(e.LFG(C.F0),e.LFG(d.DoR))},U.\u0275prov=e.Yz7({token:U,factory:U.\u0275fac,providedIn:"root"});class ${constructor(n,t){this.dataService=n,this.router=t}canActivate(n,t){const o=t.url.includes("orders/draft"),i=n.paramMap.get("id");return!o||"create"!==i||this.dataService.order.createDraftOrder().pipe((0,S.U)(({createDraftOrder:a})=>this.router.parseUrl(`/orders/draft/${a.id}`)))}}$.\u0275fac=function(n){return new(n||$)(e.LFG(d.DoR),e.LFG(C.F0))},$.\u0275prov=e.Yz7({token:$,factory:$.\u0275fac,providedIn:"root"});const At=[{path:"",component:Ue,data:{breadcrumb:(0,g.J)("breadcrumb.orders")}},{path:"draft/:id",component:ee,resolve:{entity:U},canActivate:[$],canDeactivate:[d.TSp],data:{breadcrumb:$e}},{path:":id",component:Me,resolve:{entity:U},canActivate:[$],canDeactivate:[d.TSp],data:{breadcrumb:$e}},{path:":id/modify",component:Je,resolve:{entity:U},data:{breadcrumb:Tt}}];function $e(r,n){return(0,d.YWC)({entity:r.entity,id:n.id,breadcrumbKey:"breadcrumb.orders",getName:t=>t.code,route:""})}function Tt(r,n){return $e(r,n).pipe((0,S.U)(t=>{const o=t.slice();return o[0].link[0]="../",o[1].link[0]="../orders",o.concat({label:(0,g.J)("breadcrumb.modifying"),link:[""]})}))}class De{}De.\u0275fac=function(n){return new(n||De)},De.\u0275mod=e.oAB({type:De}),De.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(At)]]})}}]);
|
|
12
|
+
//# sourceMappingURL=496.e4c426e8cc0f3034.js.map
|