@vendure/admin-ui-plugin 2.0.0-next.2 → 2.0.0-next.21
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 +2 -0
- package/lib/admin-ui/239.e2e63f2ccd517604.js.map +1 -0
- package/lib/admin-ui/26.5cc3bfffe8943e16.js +2 -0
- package/lib/admin-ui/26.5cc3bfffe8943e16.js.map +1 -0
- package/lib/admin-ui/316.265d65a6a9d1b4c0.js +2 -0
- package/lib/admin-ui/{316.07f9c805e4c95dc8.js.map → 316.265d65a6a9d1b4c0.js.map} +1 -1
- package/lib/admin-ui/356.975f7f2d201afda5.js +2 -0
- package/lib/admin-ui/356.975f7f2d201afda5.js.map +1 -0
- package/lib/admin-ui/3rdpartylicenses.txt +23 -0
- package/lib/admin-ui/407.a3fde1da25c0935c.js +12 -0
- package/lib/admin-ui/407.a3fde1da25c0935c.js.map +1 -0
- package/lib/admin-ui/451.a7fd4069c4f4c687.js +65 -0
- package/lib/admin-ui/451.a7fd4069c4f4c687.js.map +1 -0
- package/lib/admin-ui/600.17470a2c90aa79d8.js +2 -0
- package/lib/admin-ui/600.17470a2c90aa79d8.js.map +1 -0
- package/lib/admin-ui/625.3c0c5821b952b58e.js +2 -0
- package/lib/admin-ui/{625.adebc6a7222bde82.js.map → 625.3c0c5821b952b58e.js.map} +1 -1
- package/lib/admin-ui/i18n-messages/cs.json +50 -3
- package/lib/admin-ui/i18n-messages/de.json +53 -3
- package/lib/admin-ui/i18n-messages/en.json +55 -8
- package/lib/admin-ui/i18n-messages/es.json +50 -3
- package/lib/admin-ui/i18n-messages/fr.json +50 -3
- package/lib/admin-ui/i18n-messages/it.json +50 -3
- package/lib/admin-ui/i18n-messages/pl.json +50 -3
- package/lib/admin-ui/i18n-messages/pt_BR.json +50 -3
- package/lib/admin-ui/i18n-messages/pt_PT.json +50 -3
- package/lib/admin-ui/i18n-messages/ru.json +50 -3
- package/lib/admin-ui/i18n-messages/uk.json +50 -3
- package/lib/admin-ui/i18n-messages/zh_Hans.json +50 -3
- package/lib/admin-ui/i18n-messages/zh_Hant.json +50 -3
- package/lib/admin-ui/index.html +2 -2
- package/lib/admin-ui/main.65109179713dd228.js +2944 -0
- package/lib/admin-ui/main.65109179713dd228.js.map +1 -0
- package/lib/admin-ui/runtime.28bd5da02a9b1f7b.js +2 -0
- package/lib/admin-ui/{runtime.1dd1cbaf09547dd2.js.map → runtime.28bd5da02a9b1f7b.js.map} +1 -1
- package/lib/admin-ui/styles/_variables.scss +4 -0
- package/lib/admin-ui/styles/global/_forms.scss +8 -7
- package/lib/admin-ui/styles/global/_overrides.scss +11 -1
- package/lib/admin-ui/styles/global/_sass-overrides.scss +3 -0
- package/lib/admin-ui/styles/global/_utilities.scss +14 -0
- package/lib/admin-ui/styles/styles.scss +1 -0
- package/lib/admin-ui/styles/theme/default.scss +13 -1
- package/lib/admin-ui/styles/ui-extension-theme.scss +1 -0
- package/lib/admin-ui/{styles.fb1aaa9a9baed129.css → styles.88d3f0120bfc894a.css} +2 -2
- package/lib/admin-ui/styles.88d3f0120bfc894a.css.map +1 -0
- package/package.json +4 -4
- package/lib/admin-ui/239.a68e402e10b798f1.js +0 -2
- package/lib/admin-ui/239.a68e402e10b798f1.js.map +0 -1
- package/lib/admin-ui/26.477d6446134d960e.js +0 -2
- package/lib/admin-ui/26.477d6446134d960e.js.map +0 -1
- package/lib/admin-ui/316.07f9c805e4c95dc8.js +0 -2
- package/lib/admin-ui/349.abe4847f7fe9b3da.js +0 -2
- package/lib/admin-ui/349.abe4847f7fe9b3da.js.map +0 -1
- package/lib/admin-ui/356.3a6951fe80b5a001.js +0 -2
- package/lib/admin-ui/356.3a6951fe80b5a001.js.map +0 -1
- package/lib/admin-ui/600.8f0165a8d1255cd0.js +0 -2
- package/lib/admin-ui/600.8f0165a8d1255cd0.js.map +0 -1
- package/lib/admin-ui/625.adebc6a7222bde82.js +0 -2
- package/lib/admin-ui/849.cc032ddf77c67cc3.js +0 -2
- package/lib/admin-ui/849.cc032ddf77c67cc3.js.map +0 -1
- package/lib/admin-ui/main.0b0d9a8ae6759254.js +0 -2740
- package/lib/admin-ui/main.0b0d9a8ae6759254.js.map +0 -1
- package/lib/admin-ui/runtime.1dd1cbaf09547dd2.js +0 -2
- package/lib/admin-ui/styles.fb1aaa9a9baed129.css.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[407],{2407:(_l,rt,s)=>{s.r(rt),s.d(rt,{AddManualPaymentDialogComponent:()=>ue,CancelOrderDialogComponent:()=>me,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:()=>et,OrderCustomFieldsCardComponent:()=>z,OrderDetailComponent:()=>Se,OrderEditResultType:()=>J,OrderEditorComponent:()=>Ne,OrderEditsPreviewDialogComponent:()=>Me,OrderGuard:()=>H,OrderHistoryComponent:()=>Le,OrderListComponent:()=>Je,OrderModule:()=>Ue,OrderPaymentCardComponent:()=>we,OrderProcessEdgeComponent:()=>be,OrderProcessGraphComponent:()=>Ae,OrderProcessGraphDialogComponent:()=>Oe,OrderProcessNodeComponent:()=>ne,OrderResolver:()=>U,OrderStateSelectDialogComponent:()=>he,OrderTableComponent:()=>j,OrderTransitionService:()=>N,PaymentDetailComponent:()=>re,PaymentStateLabelComponent:()=>qe,RefundOrderDialogComponent:()=>Te,RefundStateLabelComponent:()=>Fe,SelectAddressDialogComponent:()=>W,SelectCustomerDialogComponent:()=>ge,SelectShippingMethodDialogComponent:()=>fe,SettleRefundDialogComponent:()=>Ie,SimpleItemListComponent:()=>$,modifyingOrderBreadcrumb:()=>At,orderBreadcrumb:()=>Re,orderRoutes:()=>bt});var a=s(587),e=s(3184),d=s(8098),I=s(309),He=s(4652),L=s(8660),Z=s(7890),w=s(8318),f=s(7514),m=s(6362),v=s(4187);function Ot(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 Tt(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 a.cw({method:new a.NI("",a.kI.required),transactionId:new a.NI("",a.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,Ot,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,Tt,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,a._Y,a.JL,a.sg,He.h,L.w9,a.JJ,a.u,Z.y,a.Fj,w.n],pipes:[f.X$,m.Ov,v.k],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0});var g=s(8270),p=s(2748),pe=s(1353);function It(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.cancel-order"))}function Lt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",19),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.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 qt(r,n){if(1&r&&e._uU(0),2&r){const t=e.oxw().$implicit;e.Oqu(t.quantity)}}function Ft(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,Lt,1,3,"input",17),e.YNc(15,qt,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 wt(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 St(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 Mt(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 Nt(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,St,3,3,"ng-container",6),e.YNc(5,Mt,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 me{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(l=>l.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)}}me.\u0275fac=function(n){return new(n||me)(e.Y36(d.Dp7))},me.\u0275cmp=e.Xpm({type:me,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,It,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,Ft,17,17,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e.YNc(24,wt,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,Nt,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,m.sg,m.O5,Z.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,p.EeQ,a._,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 _e=s(253),ot=s(9319),Ve=s(8977),h=s(2673),S=s(635),it=s(4874),B=s(4447);function Jt(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 _e.x}ngOnInit(){var n;this.availableCouponCodes$=(0,ot.z)(this.couponCodeInput$.pipe((0,Ve.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,it.O)([]))),this.control||(this.control=new a.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,Jt,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,a.JJ,a.oH,L.ir,B.Y],pipes:[m.Ov],styles:[""],changeDetection:0});var Ut=s(6562),D=s(9295),Dt=s(1057),q=s(745),Qe=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 at=s(8147),ct=s(2448),ke=s(9667),dt=s(1480);function Qt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-address"))}function kt(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 Et(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,kt,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 Yt(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,Et,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 jt(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 Rt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-tabs"),e.YNc(1,Yt,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,jt,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 $t(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,l,c,u,_,x,y,A,O,oe,ie,le,ae,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===(l=this.currentAddress)||void 0===l?void 0:l.streetLine1)&&void 0!==c?c:"",a.kI.required],streetLine2:[null!==(_=null===(u=this.currentAddress)||void 0===u?void 0:u.streetLine2)&&void 0!==_?_:""],city:[null!==(y=null===(x=this.currentAddress)||void 0===x?void 0:x.city)&&void 0!==y?y:"",a.kI.required],province:[null!==(O=null===(A=this.currentAddress)||void 0===A?void 0:A.province)&&void 0!==O?O:""],postalCode:[null!==(ie=null===(oe=this.currentAddress)||void 0===oe?void 0:oe.postalCode)&&void 0!==ie?ie:"",a.kI.required],countryCode:[null!==(ae=null===(le=this.currentAddress)||void 0===le?void 0:le.countryCode)&&void 0!==ae?ae:"",a.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,Qe.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,Dt.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(a.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,Qt,2,3,"ng-template",0),e.YNc(1,Rt,7,5,"clr-tabs",1),e.ALo(2,"async"),e.YNc(3,$t,6,7,"ng-template",2)),2&n&&(e.xp6(1),e.Q6J("ngIf",e.lcZ(2,1,t.addresses$)))},directives:[I.q,m.O5,p.gKI,p.dl,p.S4y,p.Iq$,p.Qs7,p.tam,p.UkA,at.m,m.sg,ct.C,ke.b,dt.C,a.JL,a.sg,w.n],pipes:[f.X$,m.Ov],styles:[""],changeDetection:0});var Be=s(1989),st=s(3158);function Ht(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 Vt(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 Bt(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 Gt(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,Vt,5,3,"ng-template",5),e.YNc(4,Bt,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 Wt(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 Xt(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 _e.x,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.customerForm=this.formBuilder.group({title:"",firstName:["",a.kI.required],lastName:["",a.kI.required],phoneNumber:"",emailAddress:["",[a.kI.required,a.kI.email]]})}ngOnInit(){this.customers$=(0,ot.z)((0,q.of)([]),this.input$.pipe((0,Be.b)(200),(0,Ve.x)(),(0,Qe.b)(()=>this.isLoading=!0),(0,h.w)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,st.K)(()=>(0,q.of)([])),(0,Qe.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(a.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,Ht,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,Gt,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,Wt,17,16,"ng-template",2),e.NdJ("clrIfActiveChange",function(i){return t.createNew=i}),e.qZA()(),e.YNc(12,Xt,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,a.JJ,a.On,L.mR,p.qvL,B.Y,L.ir,a._Y,a.JL,a.sg,He.h,Z.y,a.Fj,a.u,w.n],pipes:[f.X$,m.Ov],styles:[""],changeDetection:0});var X=s(7368),Ge=s(2702);function Kt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-shipping-method"))}function zt(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 en(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,zt,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 tn(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,Kt,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,en,15,20,"vdr-radio-card",2),e.qZA(),e.YNc(3,tn,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,at.m,m.sg,ct.C,X.W,m.O5,Ge._,w.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var C=s(9720),P=s(591),nn=s(1944),ut=s(3945);var on=s(1339),M=s(858);function ln(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-state"))}function an(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 cn(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 dn=function(r){return{state:r}};function sn(r,n){if(1&r){const t=e.EpF();e.YNc(0,cn,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,dn,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,ln,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,an,4,6,"option",2),e.qZA()(),e.YNc(7,sn,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,a.EJ,p.otW,a.JJ,a.On,m.sg,a.YN,a.Kr,w.n,m.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,st.K)(l=>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 rn(r){return(0,nn.e)((n,t)=>{let o,l,i=!1;const c=()=>{o=n.subscribe((0,ut.x)(t,void 0,void 0,u=>{l||(l=new _e.x,r(l).subscribe((0,ut.x)(t,()=>o?c():i=!0))),l&&l.next(u)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,on.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),We=s(3146),Ee=s(5886),Q=s(735),k=s(1519),E=s(8854),De=s(5111),pt=s(5983),Ye=s(2231);function un(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 pn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,un,2,4,"div",15),e.BQk()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function mn(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 l=e.CHM(t).ngIf;return e.oxw().addItemClick(l)}),e._uU(28),e.ALo(29,"translate"),e.qZA()(),e.YNc(30,pn,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 a.cw({}),this.selectedVariantId$=new _e.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 a.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,mn,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:[pt.e,m.O5,Z.y,a.qQ,a.wV,a.Fj,a.JJ,a.On,m.sg,Ye.M],pipes:[f.X$,m.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 _n=function(r){return{count:r}};function gn(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,_n,t.getRefundedCount())))}}class Y{getRefundedCount(){var n,t;const o=null!==(t=null===(n=this.payments)||void 0===n?void 0:n.reduce((i,l)=>[...i,...l.refunds],[]))&&void 0!==t?t:[];return this.line.items.filter(i=>{if(null===i.refundId&&!i.cancelled)return!1;if(i.refundId){const l=o.find(c=>c.id===i.refundId);return"Failed"!==(null==l?void 0:l.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,gn,3,6,"span",0),2&n&&e.Q6J("ngIf",t.getRefundedCount())},directives:[m.O5,p.qvL,mt.Lv],pipes:[f.X$],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});var je=s(2651);function fn(r,n){1&r&&e._UZ(0,"clr-icon",9)}function hn(r,n){1&r&&e._UZ(0,"clr-icon",10)}function xn(r,n){1&r&&e._UZ(0,"clr-icon",11)}function vn(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 Cn=function(r,n){return{total:r,count:n}};function yn(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,Cn,t.line.quantity,t.fulfilledCount))," ")}}function Zn(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 bn(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 An=function(r){return{count:r}};function On(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,bn,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,An,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 Tn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown",1)(1,"button",2),e.YNc(2,fn,1,0,"clr-icon",3),e.YNc(3,hn,1,0,"clr-icon",4),e.YNc(4,xn,1,0,"clr-icon",5),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",6),e.YNc(6,vn,3,3,"label",7),e.YNc(7,yn,3,7,"label",7),e.YNc(8,Zn,3,3,"label",7),e.YNc(9,On,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,l)=>{var c,u;return i+(null!==(u=null===(c=l.summary.find(_=>_.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 l;const c=i.summary.find(u=>u.orderLine.id===n.id);return{count:null!==(l=null==c?void 0:c.quantity)&&void 0!==l?l:0,fulfillment:i}}))&&void 0!==o?o:[]}}function In(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 Ln(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 qn(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),l=e.oxw().$implicit;return e.oxw().draftInputBlur(l,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 Fn(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 wn(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,Fn,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 Sn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,wn,6,4,"vdr-dropdown",23),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Mn(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 Nn(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td",35)(2,"div",36),e.YNc(3,Mn,2,4,"div",37),e.qZA()()()),2&r){const t=e.oxw().ngIf;e.xp6(3),e.Q6J("ngForOf",t)}}function Jn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Nn,4,1,"tr",23),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Un(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"tr",11)(2,"td",12),e.YNc(3,In,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,Ln,2,1,"ng-container",18),e.YNc(17,qn,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,Sn,2,1,"ng-container",23),e.qZA()(),e.YNc(29,Jn,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 Dn(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 Pn(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 Qn(r,n){if(1&r&&(e.TgZ(0,"tr",44)(1,"td",45)(2,"a",46),e._uU(3),e.qZA(),e.YNc(4,Pn,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 kn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Qn,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,Tn,10,7,"vdr-dropdown",0),2&n&&e.Q6J("ngIf",t.fulfilledCount||"PartiallyDelivered"===t.orderState)},directives:[m.O5,Q.J,k.U,p.qvL,E.N,p.MgK,m.sg,X.W],pipes:[f.X$,je.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 a.cw({}),o=this.orderLineCustomFields.map(i=>{const l=n.customFields[i.name];return t.addControl(i.name,new a.NI(l)),{config:i,formGroup:t,value:l}}).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(l=>l.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,Un,30,35,"ng-container",1),e.YNc(21,Dn,13,13,"tr",2),e.YNc(22,kn,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:[m.sg,m.O5,Z.y,p.qvL,Y,K,Q.J,k.U,E.N,C.yS,Ye.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 Xe=s(458),_t=s(837);function En(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 Yn(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 jn(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 Rn(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,En,4,3,"button",7),e.YNc(9,Yn,4,4,"button",8),e.YNc(10,jn,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 $n(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 Hn(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 Vn(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 Bn(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 Gn(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,Bn,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 Wn(r,n){1&r&&e._UZ(0,"clr-icon",33)}function Xn(r,n){1&r&&e._UZ(0,"clr-icon",34)}function Kn(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 zn(r,n){1&r&&e._UZ(0,"clr-icon",33)}function er(r,n){1&r&&e._UZ(0,"clr-icon",34)}function tr(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 nr(r,n){1&r&&e._UZ(0,"clr-icon",33)}function rr(r,n){1&r&&e._UZ(0,"clr-icon",34)}function or(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 ir(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 lr(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,Hn,3,3,"button",16),e.YNc(7,Vn,5,4,"div",0),e.qZA(),e.YNc(8,Gn,21,16,"ng-container",0),e.qZA(),e.TgZ(9,"div",17)(10,"div",18)(11,"div",19),e.YNc(12,Wn,1,0,"clr-icon",20),e.YNc(13,Xn,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,Kn,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,zn,1,0,"clr-icon",20),e.YNc(25,er,1,0,"clr-icon",21),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"div",23),e.YNc(29,tr,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,nr,1,0,"clr-icon",20),e.YNc(36,rr,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,or,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,ir,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(a.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,Rn,11,12,"div",0),2&n&&e.Q6J("ngIf",t.customFieldsConfig.length)},directives:[m.O5,_t.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,l,c,u,_){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=u,this.orderTransitionService=_,this.detailForm=new a.cw({}),this.fetchHistory=new _e.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,Ut.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,$n,19,11,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,lr,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:[m.O5,b.Kk,b.BN,We.V,Ee.G,b.mz,p.qvL,Q.J,k.U,E.N,De.H,xe,j,p.MgK,G,m.sg,Xe.d,ke.b,z],pipes:[m.Ov,f.X$,m.Zx,v.k],styles:[""],changeDetection:0});var ar=s(8931);function cr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.fulfill-order"))}function dr(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 sr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().fulfillmentQuantities[l.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 ur(r,n){if(1&r&&(e.TgZ(0,"tr",9)(1,"td",10),e.YNc(2,dr,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,sr,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 pr(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 a.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,l=o===d.TvZ.INHERIT?t:o===d.TvZ.TRUE,c=this.getUnfulfilledCount(n);return l?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(l=>l.summary).flat().filter(l=>l.orderLine.id===n.id).reduce((l,c)=>l+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 mr(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,cr,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,ur,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,pr,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,m.sg,m.O5,Z.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,ke.b,ar.q,a.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,mr,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,m.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});var R=s(234);function _r(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 ${}function gr(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 fr(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 hr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,fr,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))}}$.\u0275fac=function(n){return new(n||$)},$.\u0275cmp=e.Xpm({type:$,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,_r,5,3,"li",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.items))},directives:[m.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 a.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,l;return{name:null!==(l=null===(i=this.order.lines.find(c=>c.id===o.orderLine.id))||void 0===i?void 0:i.productVariant.name)&&void 0!==l?l:"",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 a.NI(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,R.isObject)(n)}}function xr(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,gr,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,hr,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,m.O5,$,m.sg,Ye.M],pipes:[f.X$,je.H],styles:[""],changeDetection:0});const gt=function(r){return{state:r}};function vr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw(2).transitionState.emit(l)}),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,gt,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function Cr(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,gt,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function yr(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 Zr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",15),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).transitionState.emit(l)}),e.YNc(2,Cr,6,10,"ng-container",16),e.YNc(3,yr,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 br(r,n){if(1&r&&(e.TgZ(0,"div",8),e.YNc(1,vr,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,Zr,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 Ar(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 Or(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 Tr(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 Ir(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,xr,1,2,"vdr-fulfillment-detail",5),e.qZA(),e.YNc(9,br,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,m.O5,te,Q.J,k.U,p.qvL,E.N,m.sg,De.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 l of this.modification.orderItems||[]){const c=this.getOrderLineAndItem(l.id);if(c){const{line:u,item:_}=c;if(_.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,Ar,3,4,"vdr-labeled-data",1),e.YNc(4,Or,4,8,"vdr-labeled-data",2),e.YNc(5,Tr,3,4,"vdr-labeled-data",1),e.YNc(6,Ir,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,m.O5,m.sg,$],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var Ke=s(73),ze=s(6317);const et=72;function Lr(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 ze.X(!1),this.activeTarget$=new ze.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 l=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*et+("bottom"===n?l: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,Lr,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:[m.PC,m.O5,p.qvL],pipes:[m.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,Qe.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),l=Math.abs(t.y-o.y),c=Math.sqrt(Math.pow(i,2)+Math.pow(l,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 qr(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 l=e.CHM(t).$implicit;return e.oxw().onMouseOver(l.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 Fr(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:[m.PC,p.qvL],pipes:[m.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 Ae{constructor(n){this.changeDetector=n,this.setActiveState$=new ze.X(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*et}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Be.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,l]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 _=o.get(u);_&&l.to.push(_)}}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 l=this.getNodeFor(i.name);t&&l&&t!==l&&(this.edges.push({to:l,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}}function wr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.order-state-diagram"))}Ae.\u0275fac=function(n){return new(n||Ae)(e.Y36(e.sBO))},Ae.\u0275cmp=e.Xpm({type:Ae,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,qr,3,5,"ng-container",0),e.YNc(1,Fr,2,3,"ng-container",0)),2&n&&(e.Q6J("ngForOf",t.nodes),e.xp6(1),e.Q6J("ngForOf",t.edges))},directives:[m.sg,ne,be],pipes:[m.Ov],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});class Oe{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}}Oe.\u0275fac=function(n){return new(n||Oe)(e.Y36(d.iHG))},Oe.\u0275cmp=e.Xpm({type:Oe,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(n,t){1&n&&(e.YNc(0,wr,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,Ae],pipes:[f.X$],styles:[""],changeDetection:0});var ft=s(7283);function Sr(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 Mr(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 Nr(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,Mr,6,8,"div",35),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(5),e.Q6J("ngForOf",t)}}function Jr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Nr,6,1,"vdr-dropdown",26),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function Ur(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",38),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].quantity=i})("input",function(){e.CHM(t);const i=e.oxw().$implicit,l=e.oxw();return l.handleZeroQuantity(l.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 Dr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.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 Pr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.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 Qr(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,Jr,2,1,"ng-container",26),e.qZA()(),e.TgZ(19,"td",27),e.YNc(20,Ur,1,2,"input",28),e.qZA(),e.TgZ(21,"td",29)(22,"div",30),e.YNc(23,Dr,1,2,"input",31),e.qZA()(),e.TgZ(24,"td",29)(25,"div",30),e.YNc(26,Pr,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 kr(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 Er=function(r,n){return{min:r,max:n}};function Yr(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,Er,e.xi3(3,4,0,t.order.currencyCode),e.xi3(4,7,t.settledPaymentsTotal,t.order.currencyCode)))," ")}}function jr(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 Rr=function(r){return{amount:r}};function $r(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,Rr,e.xi3(3,4,t.refundTotal,t.order.currencyCode)))," ")}}function Hr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-selected-items")," ")}function Vr(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,$r,4,9,"ng-container",45),e.YNc(5,Hr,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],l=i.refund&&i.quantity||0;return t+o.proratedUnitPriceWithTax*l},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(_=>_.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 Br(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.settle-refund"))}function Gr(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,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.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,Qr,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,kr,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,Yr,5,13,"div",15),e.YNc(67,jr,3,3,"div",16),e.qZA()()()(),e.YNc(68,Vr,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,m.sg,Y,m.O5,Q.J,k.U,p.qvL,E.N,Z.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,a.Wl,p.KKC,p.MgK,L.w9,p.dTv,a.EJ,p.otW,a.YN,a.Kr,p.PEh,p.G55,ft.K,p.xRP,w.n],pipes:[f.X$,pe.M,v.k,m.H9,m.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 Wr=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,Br,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,Gr,6,7,"ng-template",3)),2&n&&(e.xp6(2),e.hij(" ",e.xi3(3,3,"order.settle-refund-manual-instructions",e.VKq(8,Wr,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,a.Fj,p.xRP,a.JJ,a.On,w.n],pipes:[f.X$],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0});var ht=s(8276),Xr=s(2505),Kr=s(2355),zr=s(4664);function eo(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 to(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,eo,3,4,"vdr-labeled-data",1),e.YNc(8,to,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,m.O5,Ge._],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var no=s(7388);function ro(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 oo(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 io(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 lo(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 xt=function(r,n){return{from:r,to:n}};function ao(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"order.history-order-transition",e.WLB(4,xt,t.data.from,t.data.to))," ")}}function co(r,n){if(1&r&&(e.ynx(0),e.YNc(1,io,3,3,"div",17),e.YNc(2,lo,3,3,"div",17),e.YNc(3,ao,2,7,"ng-template",18),e.BQk()),2&r){const t=e.oxw().$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 so(r,n){1&r&&(e.TgZ(0,"vdr-chip",23),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-settled")))}function uo(r,n){1&r&&(e.TgZ(0,"vdr-chip",24),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 po(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,so,3,3,"vdr-chip",20),e.YNc(7,uo,3,3,"vdr-chip",21),e.TgZ(8,"vdr-history-entry-detail"),e._UZ(9,"vdr-modification-detail",22),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(3);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 mo(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,10,11,"ng-container",19),e.BQk()),2&r){const t=e.oxw().$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 _o(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-payment-detail",27),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.Q6J("payment",t)("currencyCode",o.order.currencyCode)}}function go(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,_o,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw(2).$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 vt=function(r,n,t){return{from:r,to:n,id:t}};function fo(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.hij(" ",e.xi3(1,1,"order.history-payment-transition",e.kEZ(4,vt,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function ho(r,n){if(1&r&&(e.ynx(0),e.YNc(1,go,7,8,"ng-container",25),e.YNc(2,fo,2,8,"ng-template",null,26,e.W1O),e.BQk()),2&r){const t=e.MAs(3),o=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function xo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-refund-transition",e.kEZ(4,vt,t.data.from,t.data.to,t.data.refundId))," ")}}function vo(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",28),e.ALo(2,"translate"),e._uU(3),e.qZA(),e.TgZ(4,"vdr-labeled-data",28),e.ALo(5,"translate"),e._UZ(6,"vdr-simple-item-list",29),e.qZA(),e.TgZ(7,"vdr-labeled-data",28),e.ALo(8,"translate"),e._uU(9),e.qZA()()),2&r){const t=n.ngIf,o=e.oxw(2).$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 Co=function(r){return{count:r}};function yo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,vo,10,12,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,2,"order.history-items-cancelled",e.VKq(5,Co,t.data.orderItemIds.length))," "),e.xp6(2),e.Q6J("ngIf",o.getCancelledItems(t))}}function Zo(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function bo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,Zo,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$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 Ao(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(2).$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 Oo(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(2).$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 To(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-fulfillment-transition",e.WLB(4,xt,t.data.from,t.data.to))," ")}}function Io(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function Lo(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Ao,6,7,"ng-container",19),e.YNc(2,Oo,6,7,"ng-container",19),e.YNc(3,To,3,7,"ng-container",19),e.YNc(4,Io,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$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 qo(r,n){1&r&&(e.TgZ(0,"span",43),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.public")))}function Fo(r,n){1&r&&(e.TgZ(0,"span",44),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.private")))}function wo(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",31)(2,"div",32),e.YNc(3,qo,3,3,"span",33),e.YNc(4,Fo,3,3,"span",34),e._uU(5),e.qZA(),e._UZ(6,"div",35),e.TgZ(7,"vdr-dropdown")(8,"button",36),e._UZ(9,"clr-icon",37),e.qZA(),e.TgZ(10,"vdr-dropdown-menu",38)(11,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().updateNote.emit(i)}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",40),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",41),e.TgZ(17,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().deleteNote.emit(i)}),e.ALo(18,"hasPermission"),e._UZ(19,"clr-icon",42),e._uU(20),e.ALo(21,"translate"),e.qZA()()()(),e.BQk()}if(2&r){const t=e.oxw().$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 So=function(r){return["/marketing","promotions",r]};function Mo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"a",45),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"order.history-coupon-code-applied"),": "),e.xp6(3),e.Q6J("routerLink",e.VKq(5,So,t.data.promotionId)),e.xp6(1),e.Oqu(t.data.couponCode)}}function No(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"span",46),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-coupon-code-removed"),": "),e.xp6(4),e.Oqu(t.data.couponCode)}}function Jo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",14),e.NdJ("expandClick",function(){e.CHM(t);const i=e.oxw();return i.expanded=!i.expanded}),e.ynx(1,15),e.YNc(2,co,4,3,"ng-container",16),e.YNc(3,mo,5,4,"ng-container",16),e.YNc(4,ho,4,2,"ng-container",16),e.YNc(5,xo,3,8,"ng-container",16),e.YNc(6,yo,4,7,"ng-container",16),e.YNc(7,bo,4,4,"ng-container",16),e.YNc(8,Lo,5,4,"ng-container",16),e.YNc(9,wo,22,15,"ng-container",16),e.YNc(10,Mo,6,7,"ng-container",16),e.YNc(11,No,6,4,"ng-container",16),e.BQk(),e.qZA()}if(2&r){const t=n.$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)}}class Le{constructor(){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}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 l of i.items)if(o.includes(l.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,l])=>({name:i,quantity:l}))}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 Uo(r,n){1&r&&e._UZ(0,"clr-icon",2)}Le.\u0275fac=function(n){return new(n||Le)},Le.\u0275cmp=e.Xpm({type:Le,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"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick",4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],["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"]],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,ro,3,3,"span",7),e.YNc(17,oo,3,3,"span",8),e.qZA()(),e.YNc(18,Jo,12,17,"vdr-timeline-entry",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:[Kr._,Z.y,a.Fj,a.JJ,a.On,p.PEh,a.Wl,p.KKC,p.MgK,m.O5,m.sg,m.RF,m.n9,B.Y,zr.C,Ze,re,X.W,$,te,Q.J,k.U,p.qvL,E.N,De.H,C.yS],pipes:[f.X$,v.k,no.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 qe{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}}function Do(r,n){1&r&&e._UZ(0,"clr-icon",2)}qe.\u0275fac=function(n){return new(n||qe)},qe.\u0275cmp=e.Xpm({type:qe,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,Uo,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,m.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});class Fe{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}}function Po(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 Qo(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 ko(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 Eo(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 Yo(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 jo(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,Qo,3,4,"vdr-labeled-data",12),e.YNc(17,ko,3,4,"vdr-labeled-data",12),e.YNc(18,Eo,3,4,"vdr-labeled-data",12),e.qZA(),e.YNc(19,Yo,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 Ro(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")," "))}Fe.\u0275fac=function(n){return new(n||Fe)},Fe.\u0275cmp=e.Xpm({type:Fe,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,Do,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,m.O5,p.qvL],pipes:[f.X$,M.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});const $o=function(r){return{state:r}};function Ho(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,$o,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function Vo(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 Bo(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",20),e.NdJ("click",function(){const l=e.CHM(t).$implicit,c=e.oxw(2);return c.transitionPaymentState.emit({payment:c.payment,state:l})}),e.YNc(2,Ho,6,10,"ng-container",21),e.YNc(3,Vo,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 Go(r,n){if(1&r&&(e.TgZ(0,"div",14),e.YNc(1,Ro,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,Bo,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 we{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 Wo(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 Xo(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 Ko(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 zo(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 ei(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-order")," ")}function ti(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,zo,3,3,"ng-container",19),e.YNc(3,ei,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)}}we.\u0275fac=function(n){return new(n||we)},we.\u0275cmp=e.Xpm({type:we,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,Po,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,jo,20,23,"ng-container",7),e.YNc(11,Go,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:[m.O5,qe,re,m.sg,p.qvL,mt.Lv,Fe,X.W,Ge._,Q.J,k.U,E.N,De.H],pipes:[f.X$,je.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 ni=function(r){return{state:r}};function ri(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).transitionToState(l)}),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,ni,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function oi(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"div",13),e.YNc(2,ri,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 ii(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,Wo,4,7,"button",7),e.YNc(12,Xo,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,Ko,6,3,"ng-container",0),e.YNc(21,ti,5,2,"button",12),e.YNc(22,oi,4,3,"ng-container",0),e.ALo(23,"async"),e._UZ(24,"div",13),e.TgZ(25,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().manuallyTransitionToState(l)}),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 li(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 ai(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 ci(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 di(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 si(r,n){if(1&r&&(e.ynx(0),e.YNc(1,di,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 ui(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 pi(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,li,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,ai,3,3,"h6",0),e._UZ(37,"vdr-formatted-address",37),e.YNc(38,ci,3,3,"h6",0),e._UZ(39,"vdr-formatted-address",37),e.qZA()()(),e.YNc(40,si,2,1,"ng-container",0),e.YNc(41,ui,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 Se extends d.UT_{constructor(n,t,o,i,l,c,u,_){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=u,this.orderTransitionService=_,this.detailForm=new a.cw({}),this.fetchHistory=new _e.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,it.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(Oe,{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((l,c)=>[...l,...c.summary],[]);let i=!0;for(const l of n.lines)o.filter(u=>u.orderLine.id===l.id).reduce((u,_)=>u+_.quantity,0)<l.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 l=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(l))&&void 0!==o?o:[]){const _=null!==(i=u.refunds.filter(y=>"Failed"!==y.state))&&void 0!==i?i:[],x=(0,R.summate)(_,"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,Ke.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,Ke.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(me,{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 l=i.cancelOrder;switch(l.__typename){case"Order":return this.refetchOrder(l).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(l.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){}}Se.\u0275fac=function(n){return new(n||Se)(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))},Se.\u0275cmp=e.Xpm({type:Se,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,ii,29,21,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,pi,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:[m.O5,b.Kk,b.BN,We.V,Ee.G,p.qvL,b.mz,ht.W,Q.J,k.U,E.N,De.H,m.sg,j,Xr.C,Le,z,Xe.d,ke.b,we,ye],pipes:[m.Ov,f.X$,v.k,M.N,m.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,mi=s(2814),Pe=s(8951),Ct=s(9196);function _i(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.confirm-modifications"))}function gi(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 fi(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,gi,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 hi(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 Me{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})}}Me.\u0275fac=function(n){return new(n||Me)},Me.\u0275cmp=e.Xpm({type:Me,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,_i,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,fi,11,9,"div",3),e.YNc(9,hi,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,m.O5,p.dTv,p.MgK,Z.y,a.EJ,p.otW,a.JJ,a.On,m.sg,a.YN,a.Kr,a.Fj,p.XE5,a.Q7,w.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var xi=s(7122);function vi(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 l=e.CHM(t).ngIf;return e.oxw().transitionToPriorState(l)}),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 Ci(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 yi(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 yt=function(r){return[r]};function Zi(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,yt,t)))("compact",!0)}}function bi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",29)(1,"td",30),e.YNc(2,yi,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,Zi,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 Ai(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 Oi(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,yt,o)))("compact",!0)}}function Ti(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,Oi,2,5,"ng-container",47),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function Ii(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",44)(1,"td",30),e.YNc(2,Ai,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 l=e.CHM(t).index;return e.oxw(2).removeAddedItem(l)}),e._UZ(17,"clr-icon",46),e.qZA()(),e.YNc(18,Ti,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 Li(r,n){1&r&&e._UZ(0,"td")}function qi(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,Li,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 Fi(r,n){1&r&&e._UZ(0,"td")}function wi(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 Si(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 l=e.CHM(t).index;return e.oxw(2).removeSurcharge(l)}),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,Fi,1,0,"td",0),e.TgZ(10,"td",40),e.YNc(11,wi,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 Mi(r,n){1&r&&e._UZ(0,"td")}function Ni(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 Ji(r,n){if(1&r&&(e.TgZ(0,"div",56),e.YNc(1,Ni,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 Ui(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 Di(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,Ji,10,7,"div",54),e.YNc(3,Ui,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 Pi(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 Qi=function(r){return{rate:r}};function ki(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,l;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,Qi,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==(l=o.surchargeForm.get("price"))?null:l.value)),e.xp6(1),e.hij(" ",e.lcZ(23,23,"order.add-surcharge")," ")}}function Ei(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 Yi(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 tt=function(r){return{count:r}};function ji(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,tt,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))," ")}}function Ri(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,tt,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))," ")}}function $i(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,tt,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))," ")}}function Hi(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 Vi(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 Bi(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,Ci,3,3,"th",0),e.TgZ(20,"th"),e._uU(21),e.ALo(22,"translate"),e.qZA()()(),e.TgZ(23,"tbody"),e.YNc(24,bi,26,35,"tr",8),e.YNc(25,Ii,26,27,"tr",9),e.YNc(26,qi,15,14,"tr",10),e.YNc(27,Si,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,Mi,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,Di,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,Pi,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,ki,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,Ei,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,Yi,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,ji,3,6,"li",0),e.YNc(80,Ri,3,6,"li",0),e.YNc(81,$i,3,6,"li",0),e.YNc(82,Hi,3,3,"li",0),e.YNc(83,Vi,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 l=e.CHM(t).ngIf;return e.oxw().previewAndModify(l)}),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 Ne extends d.UT_{constructor(n,t,o,i,l,c,u,_){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=u,this.orderTransitionService=_,this.detailForm=new a.cw({}),this.couponCodesControl=new a.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,Pe.R)(this.destroy$)).subscribe(n=>{var t,o,i,l,c,u,_,x,y,A,O,oe,ie,le,ae,ce,de,T;n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm=new a.cw({description:new a.NI("",a.kI.required),sku:new a.NI(""),price:new a.NI(0,a.kI.required),priceIncludesTax:new a.NI(!0),taxRate:new a.NI(0),taxDescription:new a.NI("")}),this.shippingAddressForm||(this.shippingAddressForm=new a.cw({fullName:new a.NI(null===(t=n.shippingAddress)||void 0===t?void 0:t.fullName),company:new a.NI(null===(o=n.shippingAddress)||void 0===o?void 0:o.company),streetLine1:new a.NI(null===(i=n.shippingAddress)||void 0===i?void 0:i.streetLine1),streetLine2:new a.NI(null===(l=n.shippingAddress)||void 0===l?void 0:l.streetLine2),city:new a.NI(null===(c=n.shippingAddress)||void 0===c?void 0:c.city),province:new a.NI(null===(u=n.shippingAddress)||void 0===u?void 0:u.province),postalCode:new a.NI(null===(_=n.shippingAddress)||void 0===_?void 0:_.postalCode),countryCode:new a.NI(null===(x=n.shippingAddress)||void 0===x?void 0:x.countryCode),phoneNumber:new a.NI(null===(y=n.shippingAddress)||void 0===y?void 0:y.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress)),this.billingAddressForm||(this.billingAddressForm=new a.cw({fullName:new a.NI(null===(A=n.billingAddress)||void 0===A?void 0:A.fullName),company:new a.NI(null===(O=n.billingAddress)||void 0===O?void 0:O.company),streetLine1:new a.NI(null===(oe=n.billingAddress)||void 0===oe?void 0:oe.streetLine1),streetLine2:new a.NI(null===(ie=n.billingAddress)||void 0===ie?void 0:ie.streetLine2),city:new a.NI(null===(le=n.billingAddress)||void 0===le?void 0:le.city),province:new a.NI(null===(ae=n.billingAddress)||void 0===ae?void 0:ae.province),postalCode:new a.NI(null===(ce=n.billingAddress)||void 0===ce?void 0:ce.postalCode),countryCode:new a.NI(null===(de=n.billingAddress)||void 0===de?void 0:de.countryCode),phoneNumber:new a.NI(null===(T=n.billingAddress)||void 0===T?void 0:T.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress)),this.orderLineCustomFieldsFormArray=new a.Oe([]);for(const F of n.lines){const se=new a.cw({});for(const{name:V}of this.orderLineCustomFields)se.addControl(V,new a.NI(F.customFields[V]));se.valueChanges.pipe((0,Pe.R)(this.destroy$)).subscribe(V=>{let $e=this.modifyOrderInput.adjustOrderLines.find(ml=>ml.orderLineId===F.id);$e||($e={orderLineId:F.id,quantity:F.quantity},this.modifyOrderInput.adjustOrderLines.push($e)),this.orderLineCustomFields.length&&($e.customFields=V)}),this.orderLineCustomFieldsFormArray.push(se)}}),this.addItemCustomFieldsFormArray=new a.Oe([]),this.addItemCustomFieldsForm=new a.cw({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new a.NI);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,Ct.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(l=>l.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(l=>l.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 l=null===(t=this.modifyOrderInput.addItems)||void 0===t?void 0:t.find(c=>this.isMatchingAddItemRow(c,n,i));if(l?l.quantity++:(l={productVariantId:n.productVariantId,quantity:1},i&&(l.customFields=i),null===(o=this.modifyOrderInput.addItems)||void 0===o||o.push(l)),i){const c=new a.cw({});for(const[u,_]of Object.entries(i))c.addControl(u,new a.NI(_));this.addItemCustomFieldsFormArray.push(c),c.valueChanges.pipe((0,Pe.R)(this.destroy$)).subscribe(u=>{l&&(l.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,mi.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}}),l=n.totalWithTax;this.dataService.order.modifyOrder(i).pipe((0,h.w)(({modifyOrder:c})=>{switch(c.__typename){case"Order":return this.modalService.fromComponent(Me,{size:"xl",closable:!1,locals:{originalTotalWithTax:l,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:_})=>{if("Order"===_.__typename){const y=0<_.totalWithTax-l?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,y).pipe((0,Ke.h)(!0))}return this.notificationService.error(_.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 a.cw({});for(const l of this.addressCustomFields){const c=l.name,u=null===(o=t.customFields)||void 0===o?void 0:o[c];i.addControl(c,new a.NI(u))}n.addControl("customFields",i)}}setFormValues(n,t){}}Ne.\u0275fac=function(n){return new(n||Ne)(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))},Ne.\u0275cmp=e.Xpm({type:Ne,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,vi,10,7,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,Bi,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:[m.O5,b.Kk,b.BN,We.V,Ee.G,b.mz,m.sg,Z.y,Y,K,_t.y,p.q0d,p.qvL,Ye.M,p.bZL,p.twP,p.GmI,p.dxz,p.UJ5,p.Nz$,p.DbV,p.r6y,pt.e,G,a._Y,a.JL,a.sg,He.h,a.Fj,a.JJ,a.u,ft.K,a.Wl,p.KKC,xi.K,a.qQ,a.Fd,a.wV,dt.C,p.MgK,p.XE5,a.Q7,a.On,p.PEh],pipes:[m.Ov,f.X$,pe.M,v.k,m.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 Zt=s(6646),nt=s(116),Gi=s(6852),Wi=s(9416),Xi=s(365),Ki=s(901),zi=s(8899),el=s(6826);function tl(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).selectFilterPreset(l.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 nl(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",17),e.YNc(1,tl,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 rl(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 ol(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),l=i.item;return i.clear(l)}),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 il=function(){return["./draft/create"]};function ll(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,il)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"catalog.create-draft-order")," "))}const al=function(){return["CreateOrder"]};function cl(r,n){1&r&&(e.ynx(0),e.YNc(1,ll,4,5,"a",23),e.BQk()),2&r&&(e.xp6(1),e.Q6J("vdrIfPermissions",e.DdM(1,al)))}const dl=function(r){return["./",r,"modify"]},sl=function(r){return["./draft",r]},ul=function(r){return["./",r]};function pl(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,dl,t.id):"Draft"===t.state?e.VKq(21,sl,t.id):e.VKq(23,ul,t.id))}}class Je extends d.t7C{constructor(n,t,o,i,l){var c;super(i,l),this.serverConfigService=n,this.dataService=t,this.localStorageService=o,this.searchControl=new a.NI(""),this.searchOrderCodeControl=new a.NI(""),this.searchLastNameControl=new a.NI(""),this.orderStates=this.serverConfigService.getOrderProcessStates().map(_=>_.name),this.filterPresets=[{name:"open",label:(0,g.J)("order.filter-preset-open"),config:{active:!1,states:this.orderStates.filter(_=>"Delivered"!==_&&"Cancelled"!==_&&"Shipped"!==_&&"Draft"!==_)}},{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((_,x)=>this.dataService.order.getOrders({take:_,skip:x}).refetchOnChannelChange(),_=>_.orders,(_,x)=>this.createQueryOptions(_,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(_=>"Created"===_.name))||void 0===c?void 0:c.to.includes("Draft")),this.canCreateDraftOrder||(this.filterPresets=this.filterPresets.filter(_=>"draft"!==_.name))}ngOnInit(){var n;super.ngOnInit(),this.activePreset$=this.route.queryParamMap.pipe((0,S.U)(i=>i.get("filter")||"open"),(0,Ve.x)());const t=(0,Zt.T)(this.searchControl.valueChanges).pipe((0,nt.h)(i=>2<i.length||0===i.length),(0,Be.b)(250));(0,Zt.T)(t,this.route.queryParamMap).pipe((0,Pe.R)(this.destroy$)).subscribe(i=>{this.refresh()});const o=this.route.snapshot.queryParamMap;this.customFilterForm=new a.cw({states:new a.NI(null!==(n=o.getAll("states"))&&void 0!==n?n:[]),placedAtStart:new a.NI(o.get("placedAtStart")),placedAtEnd:new a.NI(o.get("placedAtEnd"))})}selectFilterPreset(n){var t;const o=null!==(t=this.localStorageService.get("orderListLastCustomFilters"))&&void 0!==t?t:{},l="custom"===n?o:{states:void 0,placedAtStart:void 0,placedAtEnd:void 0};this.setQueryParam(Object.assign({filter:n,page:1},l),{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 l;const c=this.filterPresets.find(x=>x.name===i);let u={},_=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!==(l=x.getAll("states"))&&void 0!==l?l:[],A=x.get("placedAtStart"),O=x.get("placedAtEnd");y.length&&(u.state={in:y}),A&&O?u.orderPlacedAt={between:{start:A,end:O}}:A?u.orderPlacedAt={after:A}:O&&(u.orderPlacedAt={before:O})}return o&&(u={customerLastName:{contains:o},transactionId:{contains:o},code:{contains:o}},_=d.FnJ.OR),{options:{skip:n,take:t,filter:Object.assign({},null!=u?u:{}),sort:{updatedAt:d.Asd.DESC},filterOperator:_}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}Je.\u0275fac=function(n){return new(n||Je)(e.Y36(d.iHG),e.Y36(d.DoR),e.Y36(d.n2A),e.Y36(C.F0),e.Y36(C.gz))},Je.\u0275cmp=e.Xpm({type:Je,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,nl,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,rl,3,5,"ng-template",7),e.YNc(14,ol,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,cl,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,pl,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,m.O5,m.sg,p.qvL,Z.y,a.Fj,a.JJ,a.oH,a._Y,a.JL,a.sg,L.w9,a.u,L.ir,L.mR,p.MgK,Gi.I,b.mz,ht.W,Wi.H,C.yS,Xi.Q,Ki.E,Xe.d,Ee.G,zi.v],pipes:[m.Ov,f.X$,M.N,v.k,el.e,je.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,nt.h)(c=>c instanceof C.wM)),l=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,Pe.R)(i),(0,nt.h)(R.notNullOrUndefined),(0,Ct.d)(1));return l.pipe((0,D.q)(1),(0,S.U)(()=>l))}}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 H{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:l})=>this.router.parseUrl(`/orders/draft/${l.id}`)))}}H.\u0275fac=function(n){return new(n||H)(e.LFG(d.DoR),e.LFG(C.F0))},H.\u0275prov=e.Yz7({token:H,factory:H.\u0275fac,providedIn:"root"});const bt=[{path:"",component:Je,data:{breadcrumb:(0,g.J)("breadcrumb.orders")}},{path:"draft/:id",component:ee,resolve:{entity:U},canActivate:[H],canDeactivate:[d.TSp],data:{breadcrumb:Re}},{path:":id",component:Se,resolve:{entity:U},canActivate:[H],canDeactivate:[d.TSp],data:{breadcrumb:Re}},{path:":id/modify",component:Ne,resolve:{entity:U},data:{breadcrumb:At}}];function Re(r,n){return(0,d.YWC)({entity:r.entity,id:n.id,breadcrumbKey:"breadcrumb.orders",getName:t=>t.code,route:""})}function At(r,n){return Re(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 Ue{}Ue.\u0275fac=function(n){return new(n||Ue)},Ue.\u0275mod=e.oAB({type:Ue}),Ue.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(bt)]]})}}]);
|
|
12
|
+
//# sourceMappingURL=407.a3fde1da25c0935c.js.map
|