@deenruv/admin-ui-plugin 1.0.0
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/README.md +5 -0
- package/lib/admin-ui/123.1d21e707f57ee3b4.js +33 -0
- package/lib/admin-ui/123.1d21e707f57ee3b4.js.map +1 -0
- package/lib/admin-ui/132.9c69fc8bd3b0cec4.js +2 -0
- package/lib/admin-ui/132.9c69fc8bd3b0cec4.js.map +1 -0
- package/lib/admin-ui/153.7eec6efd3edd54b4.js +321 -0
- package/lib/admin-ui/153.7eec6efd3edd54b4.js.map +1 -0
- package/lib/admin-ui/3rdpartylicenses.txt +1393 -0
- package/lib/admin-ui/473.fc9f902d000ba044.js +2 -0
- package/lib/admin-ui/473.fc9f902d000ba044.js.map +1 -0
- package/lib/admin-ui/53.7f3fee856943b03f.js +86 -0
- package/lib/admin-ui/53.7f3fee856943b03f.js.map +1 -0
- package/lib/admin-ui/625.64b1900ed11327c1.js +46 -0
- package/lib/admin-ui/625.64b1900ed11327c1.js.map +1 -0
- package/lib/admin-ui/697.ff9c92dd4b564093.js +73 -0
- package/lib/admin-ui/697.ff9c92dd4b564093.js.map +1 -0
- package/lib/admin-ui/99.b9d2442a2288abdb.js +379 -0
- package/lib/admin-ui/99.b9d2442a2288abdb.js.map +1 -0
- package/lib/admin-ui/assets/.gitkeep +0 -0
- package/lib/admin-ui/assets/logo-login.webp +0 -0
- package/lib/admin-ui/assets/logo-top.webp +0 -0
- package/lib/admin-ui/common.868070cec3f2418e.js +2 -0
- package/lib/admin-ui/common.868070cec3f2418e.js.map +1 -0
- package/lib/admin-ui/deenruv-ui-config.json +290 -0
- package/lib/admin-ui/favicon.ico +0 -0
- package/lib/admin-ui/fonts/fonts.scss +253 -0
- package/lib/admin-ui/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-cyrillic.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-greek-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-greek.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-latin-ext.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-latin.woff2 +0 -0
- package/lib/admin-ui/fonts/inter-vietnamese.woff2 +0 -0
- package/lib/admin-ui/i18n-messages/ar.json +814 -0
- package/lib/admin-ui/i18n-messages/cs.json +814 -0
- package/lib/admin-ui/i18n-messages/de.json +814 -0
- package/lib/admin-ui/i18n-messages/en.json +814 -0
- package/lib/admin-ui/i18n-messages/es.json +814 -0
- package/lib/admin-ui/i18n-messages/fa.json +814 -0
- package/lib/admin-ui/i18n-messages/fr.json +814 -0
- package/lib/admin-ui/i18n-messages/he.json +814 -0
- package/lib/admin-ui/i18n-messages/hr.json +814 -0
- package/lib/admin-ui/i18n-messages/it.json +814 -0
- package/lib/admin-ui/i18n-messages/nb.json +812 -0
- package/lib/admin-ui/i18n-messages/ne.json +814 -0
- package/lib/admin-ui/i18n-messages/pl.json +814 -0
- package/lib/admin-ui/i18n-messages/pt_BR.json +814 -0
- package/lib/admin-ui/i18n-messages/pt_PT.json +814 -0
- package/lib/admin-ui/i18n-messages/ru.json +814 -0
- package/lib/admin-ui/i18n-messages/sv.json +807 -0
- package/lib/admin-ui/i18n-messages/uk.json +814 -0
- package/lib/admin-ui/i18n-messages/zh_Hans.json +814 -0
- package/lib/admin-ui/i18n-messages/zh_Hant.json +814 -0
- package/lib/admin-ui/index.html +14 -0
- package/lib/admin-ui/inter-cyrillic-ext.f62cc866835dd717.woff2 +0 -0
- package/lib/admin-ui/inter-cyrillic.fd42267cbb1bfdb0.woff2 +0 -0
- package/lib/admin-ui/inter-greek-ext.f876a5a3ea45d9a5.woff2 +0 -0
- package/lib/admin-ui/inter-greek.0455348926d6f41d.woff2 +0 -0
- package/lib/admin-ui/inter-latin-ext.7df16007e26681f5.woff2 +0 -0
- package/lib/admin-ui/inter-latin.40c45725dc5f525d.woff2 +0 -0
- package/lib/admin-ui/inter-vietnamese.530676b65c9e977f.woff2 +0 -0
- package/lib/admin-ui/main.a1f6ce60f6b53c40.js +3241 -0
- package/lib/admin-ui/main.a1f6ce60f6b53c40.js.map +1 -0
- package/lib/admin-ui/polyfills.34e462102e9d0666.js +2 -0
- package/lib/admin-ui/polyfills.34e462102e9d0666.js.map +1 -0
- package/lib/admin-ui/polyfills.ts +66 -0
- package/lib/admin-ui/runtime.12183b5e8f8cfd14.js +2 -0
- package/lib/admin-ui/runtime.12183b5e8f8cfd14.js.map +1 -0
- package/lib/admin-ui/styles/_mixins.scss +60 -0
- package/lib/admin-ui/styles/_variables.scss +11 -0
- package/lib/admin-ui/styles/component/prosemirror.scss +511 -0
- package/lib/admin-ui/styles/global/_buttons.scss +147 -0
- package/lib/admin-ui/styles/global/_clarity.scss +140 -0
- package/lib/admin-ui/styles/global/_forms.scss +187 -0
- package/lib/admin-ui/styles/global/_global.scss +41 -0
- package/lib/admin-ui/styles/global/_overrides.scss +165 -0
- package/lib/admin-ui/styles/global/_sass-overrides.scss +8 -0
- package/lib/admin-ui/styles/global/_utilities.scss +155 -0
- package/lib/admin-ui/styles/rtl.scss +143 -0
- package/lib/admin-ui/styles/styles.scss +19 -0
- package/lib/admin-ui/styles/theme/dark.scss +591 -0
- package/lib/admin-ui/styles/theme/default.scss +254 -0
- package/lib/admin-ui/styles/ui-extension-theme.scss +13 -0
- package/lib/admin-ui/styles.2de83a2df5e76526.css +3 -0
- package/lib/admin-ui/styles.2de83a2df5e76526.css.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/src/api/metrics.resolver.d.ts +8 -0
- package/lib/src/api/metrics.resolver.js +41 -0
- package/lib/src/api/metrics.resolver.js.map +1 -0
- package/lib/src/config/metrics-strategies.d.ts +39 -0
- package/lib/src/config/metrics-strategies.js +92 -0
- package/lib/src/config/metrics-strategies.js.map +1 -0
- package/lib/src/constants.d.ts +7 -0
- package/lib/src/constants.js +286 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/plugin.d.ts +129 -0
- package/lib/src/plugin.js +332 -0
- package/lib/src/plugin.js.map +1 -0
- package/lib/src/service/metrics.service.d.ts +16 -0
- package/lib/src/service/metrics.service.js +144 -0
- package/lib/src/service/metrics.service.js.map +1 -0
- package/lib/src/types.d.ts +23 -0
- package/lib/src/types.js +14 -0
- package/lib/src/types.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkdeenruv_admin=self.webpackChunkdeenruv_admin||[]).push([[53],{53:(Od,Ke,s)=>{s.r(Ke),s.d(Ke,{AddManualPaymentDialogComponent:()=>ae,CancelOrderDialogComponent:()=>le,CouponCodeSelectorComponent:()=>U,DraftOrderDetailComponent:()=>fe,DraftOrderVariantSelectorComponent:()=>_e,FulfillOrderDialogComponent:()=>ge,FulfillmentCardComponent:()=>be,FulfillmentDetailComponent:()=>ee,FulfillmentStateLabelComponent:()=>he,GET_COUPON_CODE_SELECTOR_PROMOTION_LIST:()=>Nt,GET_CUSTOMER_ADDRESSES:()=>Td,GET_ORDER_STATE:()=>Ot,GET_SELLER_ORDERS:()=>It,LineFulfillmentComponent:()=>Z,LineRefundsComponent:()=>w,ModificationDetailComponent:()=>Ce,NODE_HEIGHT:()=>qe,ORDER_DETAIL_QUERY:()=>Ka,OrderCustomFieldsCardComponent:()=>ue,OrderDataTableComponent:()=>K,OrderDetailComponent:()=>ke,OrderEditResultType:()=>S,OrderEditorComponent:()=>$e,OrderEditsPreviewDialogComponent:()=>De,OrderGuard:()=>x,OrderHistoryComponent:()=>xe,OrderHistoryEntryHostComponent:()=>Se,OrderListComponent:()=>je,OrderModificationSummaryComponent:()=>ie,OrderModule:()=>oe,OrderPaymentCardComponent:()=>Me,OrderProcessEdgeComponent:()=>ve,OrderProcessGraphComponent:()=>ye,OrderProcessGraphDialogComponent:()=>Ie,OrderProcessNodeComponent:()=>te,OrderStateSelectDialogComponent:()=>me,OrderTableComponent:()=>A,OrderTotalColumnComponent:()=>V,OrderTransitionService:()=>E,PaymentDetailComponent:()=>re,PaymentForRefundSelectorComponent:()=>ne,PaymentStateLabelComponent:()=>Fe,RefundDetailComponent:()=>Ye,RefundOrderDialogComponent:()=>Te,RefundStateLabelComponent:()=>Re,SET_ORDER_CUSTOMER_MUTATION:()=>el,SelectAddressDialogComponent:()=>J,SelectCustomerDialogComponent:()=>H,SelectShippingMethodDialogComponent:()=>q,SellerOrdersCardComponent:()=>Ge,SettleRefundDialogComponent:()=>Oe,SimpleItemListComponent:()=>X,createRoutes:()=>Ft,getRefundablePayments:()=>we});var l=s(1217),b=s(7081);function we(r){return(r||[]).filter(t=>"Settled"===t.state).map((t,i)=>{const o=t.amount-(0,b.summate)(t.refunds.filter(a=>"Failed"!==a.state),"total");return{...t,refundableAmount:o,amountToRefundControl:new l.MJ(0,{nonNullable:!0,validators:[l.k0.min(0),l.k0.max(o)]}),selected:0===i}})}var d=s(9214),P=s(2985),e=s(1410),G=s(2810),N=s(4763),h=s(5889),F=s(5907),y=s(3240),c=s(4806),_=s(654),g=s(3932);function Rt(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.add-payment-to-order"))}function Mt(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",7),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",8),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.submit())}),e.EFF(4),e.nI1(5,"translate"),e.nI1(6,"localeCurrency"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,4,"common.cancel")),e.R7$(2),e.Y8G("disabled",t.form.invalid||t.form.pristine),e.R7$(),e.Lme(" ",e.bMT(5,6,"order.add-payment")," (",e.i5U(6,8,t.outstandingAmount,t.currencyCode),") ")}}P.J1`
|
|
2
|
+
query GetAddManualPaymentMethodList($options: PaymentMethodListOptions!) {
|
|
3
|
+
paymentMethods(options: $options) {
|
|
4
|
+
items {
|
|
5
|
+
id
|
|
6
|
+
createdAt
|
|
7
|
+
updatedAt
|
|
8
|
+
name
|
|
9
|
+
code
|
|
10
|
+
description
|
|
11
|
+
enabled
|
|
12
|
+
}
|
|
13
|
+
totalItems
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;class ae{constructor(n){this.dataService=n,this.form=new l.J3({method:new l.hs("",l.k0.required),transactionId:new l.hs("",l.k0.required)})}ngOnInit(){this.paymentMethods$=this.dataService.query(d.CRK,{options:{take:999}}).mapSingle(n=>n.paymentMethods.items)}submit(){const n=this.form.value;this.resolveWith({method:n.method,transactionId:n.transactionId})}cancel(){this.resolveWith()}static{this.\u0275fac=function(t){return new(t||ae)(e.rXU(d.uSP))}}static{this.\u0275cmp=e.VBU({type:ae,selectors:[["vdr-add-manual-payment-dialog"]],decls:10,vars:11,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","method",3,"label"],["bindLabel","code","appendTo","body","autofocus","","bindValue","code","formControlName","method",3,"items","addTag"],["for","transactionId",3,"label"],["id","transactionId","type","text","formControlName","transactionId"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,Rt,2,3,"ng-template",0),e.j41(1,"form",1)(2,"vdr-form-field",2),e.nI1(3,"translate"),e.nrm(4,"ng-select",3),e.nI1(5,"async"),e.k0s(),e.j41(6,"vdr-form-field",4),e.nI1(7,"translate"),e.nrm(8,"input",5),e.k0s()(),e.DNE(9,Mt,7,11,"ng-template",6)),2&t&&(e.R7$(),e.Y8G("formGroup",i.form),e.R7$(),e.Y8G("label",e.bMT(3,5,"order.payment-method")),e.R7$(2),e.Y8G("items",e.bMT(5,7,i.paymentMethods$))("addTag",!0),e.R7$(2),e.Y8G("label",e.bMT(7,9,"order.transaction-id")))},dependencies:[l.qT,l.me,l.BC,l.cb,l.j4,l.JD,G.vr,N.K,h.V,F.b,y.M,c.Jj,_.D9,g.u],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0})}}var p=s(9595),u=s(4677),L=s(229);function St(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.cancel-order"))}function xt(r,n){if(1&r){const t=e.RV6();e.j41(0,"input",19),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG().$implicit,m=e.XpG();return e.DH7(m.lineQuantities[a.id],o)||(m.lineQuantities[a.id]=o),e.Njj(o)}),e.bIt("input",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.checkIfAllSelected())}),e.k0s()}if(2&r){const t=e.XpG().$implicit,i=e.XpG();e.R50("ngModel",i.lineQuantities[t.id]),e.Y8G("disabled",i.cancelAll)("max",t.quantity)}}function Gt(r,n){if(1&r&&e.EFF(0),2&r){const t=e.XpG().$implicit;e.JRh(t.quantity)}}function kt(r,n){if(1&r&&(e.j41(0,"tr",11)(1,"td",12),e.nrm(2,"img",13),e.nI1(3,"assetPreview"),e.k0s(),e.j41(4,"td",14),e.EFF(5),e.k0s(),e.j41(6,"td",15),e.EFF(7),e.k0s(),e.j41(8,"td",16),e.EFF(9),e.k0s(),e.j41(10,"td",16),e.EFF(11),e.nI1(12,"localeCurrency"),e.k0s(),e.j41(13,"td",17),e.DNE(14,xt,1,3,"input",18)(15,Gt,1,1,"ng-template",null,0,e.C5r),e.k0s()()),2&r){const t=n.$implicit,i=e.sdS(16),o=e.XpG();e.AVh("is-disabled",o.cancelAll)("is-cancelled",0===t.quantity),e.R7$(2),e.Y8G("src",e.i5U(3,11,t.featuredAsset,"tiny"),e.B4B),e.R7$(3),e.JRh(t.productVariant.name),e.R7$(2),e.JRh(t.productVariant.sku),e.R7$(2),e.JRh(t.quantity),e.R7$(2),e.SpI(" ",e.i5U(12,14,t.unitPriceWithTax,o.order.currencyCode)," "),e.R7$(3),e.Y8G("ngIf",t.quantity>0&&!o.order.active)("ngIfElse",i)}}function Dt(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"clr-radio-wrapper")(2,"input",20),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.cancelAll,o)||(a.cancelAll=o),e.Njj(o)}),e.bIt("ngModelChange",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.radioChanged())}),e.k0s(),e.j41(3,"label"),e.EFF(4),e.nI1(5,"translate"),e.k0s()(),e.j41(6,"clr-radio-wrapper")(7,"input",20),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.cancelAll,o)||(a.cancelAll=o),e.Njj(o)}),e.bIt("ngModelChange",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.radioChanged())}),e.k0s(),e.j41(8,"label"),e.EFF(9),e.nI1(10,"translate"),e.k0s()(),e.bVm()}if(2&r){const t=e.XpG();e.R7$(2),e.Y8G("value",!0),e.R50("ngModel",t.cancelAll),e.R7$(2),e.JRh(e.bMT(5,6,"order.cancel-entire-order")),e.R7$(3),e.Y8G("value",!1),e.R50("ngModel",t.cancelAll),e.R7$(2),e.JRh(e.bMT(10,8,"order.cancel-specified-items"))}}function $t(r,n){1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.bVm()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.cancel-selected-items")," "))}function jt(r,n){1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.bVm()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.cancel-order")," "))}function Et(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",21),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",22),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.DNE(4,$t,3,3,"ng-container",7)(5,jt,3,3,"ng-container",7),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,4,"common.cancel")),e.R7$(2),e.Y8G("disabled",!t.reason||!t.order.active&&0===t.selectionCount),e.R7$(),e.Y8G("ngIf",!t.order.active),e.R7$(),e.Y8G("ngIf",t.order.active)}}class le{get selectionCount(){return Object.values(this.lineQuantities).reduce((n,t)=>n+t,0)}constructor(n){this.i18nService=n,this.cancelAll=!0,this.lineQuantities={},this.reasons=(0,d.WEc)().cancellationReasons??[(0,p.x)("order.cancel-reason-customer-request"),(0,p.x)("order.cancel-reason-not-available")],this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:t.quantity}),{})}radioChanged(){if(this.cancelAll)for(const n of this.order.lines)this.lineQuantities[n.id]=n.quantity;else for(const n of this.order.lines)this.lineQuantities[n.id]=0}checkIfAllSelected(){for(const[n,t]of Object.entries(this.lineQuantities)){const i=this.order.lines.find(o=>o.id===n)?.quantity;if(i&&t<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)}static{this.\u0275fac=function(t){return new(t||le)(e.rXU(d.W40))}}static{this.\u0275cmp=e.VBU({type:le,selectors:[["vdr-cancel-order-dialog"]],decls:30,vars:23,consts:[["nonEditable",""],["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,"ngModelChange","items","addTag","ngModel"],["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"],["type","number","min","0",3,"ngModelChange","input","ngModel","disabled","max"],["type","radio","clrRadio","","name","options",3,"ngModelChange","value","ngModel"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,St,2,3,"ng-template",1),e.j41(1,"div",2)(2,"div",3)(3,"table",4)(4,"thead")(5,"tr"),e.nrm(6,"th"),e.j41(7,"th"),e.EFF(8),e.nI1(9,"translate"),e.k0s(),e.j41(10,"th"),e.EFF(11),e.nI1(12,"translate"),e.k0s(),e.j41(13,"th"),e.EFF(14),e.nI1(15,"translate"),e.k0s(),e.j41(16,"th"),e.EFF(17),e.nI1(18,"translate"),e.k0s(),e.j41(19,"th"),e.EFF(20),e.nI1(21,"translate"),e.k0s()()(),e.DNE(22,kt,17,17,"tr",5),e.k0s()(),e.j41(23,"div",6),e.DNE(24,Dt,11,10,"ng-container",7),e.j41(25,"label",8),e.EFF(26),e.nI1(27,"translate"),e.k0s(),e.j41(28,"ng-select",9),e.mxI("ngModelChange",function(a){return e.DH7(i.reason,a)||(i.reason=a),a}),e.k0s()()(),e.DNE(29,Et,6,6,"ng-template",10)),2&t&&(e.R7$(8),e.JRh(e.bMT(9,11,"order.product-name")),e.R7$(3),e.JRh(e.bMT(12,13,"order.product-sku")),e.R7$(3),e.JRh(e.bMT(15,15,"order.quantity")),e.R7$(3),e.JRh(e.bMT(18,17,"order.unit-price")),e.R7$(3),e.JRh(e.bMT(21,19,"order.cancel")),e.R7$(2),e.Y8G("ngForOf",i.order.lines),e.R7$(2),e.Y8G("ngIf",!0!==i.order.active),e.R7$(2),e.JRh(e.bMT(27,21,"order.cancellation-reason")),e.R7$(2),e.Y8G("items",i.reasons)("addTag",!0),e.R50("ngModel",i.reason))},dependencies:[u.aZZ,u.fkp,u.cIb,c.Sq,c.bT,l.me,l.Q0,l.Fm,l.BC,l.VZ,l.zX,l.vS,G.vr,h.V,F.b,y.M,_.D9,L.H,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .cancellation-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}"],changeDetection:0})}}var B=s(6851),et=s(5655),Ve=s(5168),tt=s(9942),f=s(2430),R=s(5626),nt=s(7420),k=s(7145);function Pt(r,n){if(1&r&&(e.j41(0,"div",2)(1,"vdr-chip",3),e.EFF(2),e.k0s(),e.j41(3,"span"),e.EFF(4),e.k0s()()),2&r){const t=n.item;e.R7$(2),e.JRh(t.code),e.R7$(2),e.JRh(t.promotionName)}}const Nt=P.J1`
|
|
17
|
+
query GetCouponCodeSelectorPromotionList($options: PromotionListOptions) {
|
|
18
|
+
promotions(options: $options) {
|
|
19
|
+
items {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
couponCode
|
|
23
|
+
}
|
|
24
|
+
totalItems
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;class U{constructor(n){this.dataService=n,this.addCouponCode=new e.bkB,this.removeCouponCode=new e.bkB,this.couponCodeInput$=new B.B}ngOnInit(){this.availableCouponCodes$=(0,et.x)(this.couponCodeInput$.pipe((0,Ve.B)(200),(0,tt.F)(),(0,f.n)(n=>this.dataService.query(d.d7T,{options:{take:10,skip:0,filter:{couponCode:{contains:n}}}}).single$),(0,R.T)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,nt.Z)([]))),this.control||(this.control=new l.hs(this.couponCodes??[]))}static{this.\u0275fac=function(t){return new(t||U)(e.rXU(d.uSP))}}static{this.\u0275cmp=e.VBU({type:U,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,"add","remove","items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl"],["ng-option-tmp",""],[1,"flex","items-center"],[1,"mr-1"]],template:function(t,i){1&t&&(e.j41(0,"ng-select",0),e.nI1(1,"async"),e.bIt("add",function(a){return i.addCouponCode.emit(a.code)})("remove",function(a){return i.removeCouponCode.emit(null==a.value?null:a.value.code)}),e.DNE(2,Pt,5,2,"ng-template",1),e.k0s()),2&t&&e.Y8G("items",e.bMT(1,7,i.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",i.couponCodeInput$)("formControl",i.control)},dependencies:[l.BC,l.l_,G.vr,G.Uq,k.w,c.Jj],changeDetection:0})}}var Yt=s(4148),D=s(2913),wt=s(897),v=s(81),de=s(4117),se=s(2643),rt=s(2023),it=s(5334),ot=s(5160);function Vt(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.select-address"))}function At(r,n){if(1&r&&(e.j41(0,"vdr-radio-card",7),e.nrm(1,"vdr-formatted-address",8),e.k0s()),2&r){const t=n.$implicit;e.Y8G("item",t),e.R7$(),e.Y8G("address",t)}}function Xt(r,n){if(1&r){const t=e.RV6();e.j41(0,"clr-tab-content")(1,"vdr-radio-card-fieldset",5),e.bIt("selectItem",function(o){e.eBV(t);const a=e.XpG(3);return e.Njj(a.selectedAddress=o)}),e.DNE(2,At,2,2,"vdr-radio-card",6),e.k0s()()}if(2&r){const t=e.XpG(2).ngIf,i=e.XpG();e.R7$(),e.Y8G("idFn",i.addressIdFn)("selectedItemId",i.selectedAddress&&i.addressIdFn(i.selectedAddress)),e.R7$(),e.Y8G("ngForOf",t)}}function Lt(r,n){if(1&r){const t=e.RV6();e.j41(0,"clr-tab")(1,"button",3),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.DNE(4,Xt,3,3,"ng-template",4),e.mxI("clrIfActiveChange",function(o){e.eBV(t);const a=e.XpG(2);return e.DH7(a.useExisting,o)||(a.useExisting=o),e.Njj(o)}),e.k0s()}if(2&r){const t=e.XpG(2);e.R7$(2),e.JRh(e.bMT(3,2,"order.existing-address")),e.R7$(2),e.R50("clrIfActive",t.useExisting)}}function Bt(r,n){if(1&r&&(e.j41(0,"clr-tab-content"),e.nrm(1,"vdr-address-form",9),e.nI1(2,"async"),e.k0s()),2&r){const t=e.XpG(2);e.R7$(),e.Y8G("formGroup",t.addressForm)("availableCountries",e.bMT(2,2,t.availableCountries$))}}function Ut(r,n){if(1&r){const t=e.RV6();e.j41(0,"clr-tabs"),e.DNE(1,Lt,5,4,"clr-tab",1),e.j41(2,"clr-tab")(3,"button",3),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.DNE(6,Bt,3,4,"ng-template",4),e.mxI("clrIfActiveChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.createNew,o)||(a.createNew=o),e.Njj(o)}),e.k0s()()}if(2&r){const t=n.ngIf,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.customerId&&t.length),e.R7$(3),e.JRh(e.bMT(5,3,"customer.create-new-address")),e.R7$(2),e.R50("clrIfActive",i.createNew)}}function Jt(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",10),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",11),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"common.cancel")),e.R7$(2),e.Y8G("disabled",t.useExisting&&!t.selectedAddress||t.createNew&&t.addressForm.invalid),e.R7$(),e.SpI(" ",e.bMT(5,5,"common.okay")," ")}}class J{constructor(n,t){this.dataService=n,this.formBuilder=t,this.useExisting=!0,this.createNew=!1}ngOnInit(){this.addressForm=this.formBuilder.group({fullName:[this.currentAddress?.fullName??""],company:[this.currentAddress?.company??""],streetLine1:[this.currentAddress?.streetLine1??"",l.k0.required],streetLine2:[this.currentAddress?.streetLine2??""],city:[this.currentAddress?.city??"",l.k0.required],province:[this.currentAddress?.province??""],postalCode:[this.currentAddress?.postalCode??"",l.k0.required],countryCode:[this.currentAddress?.countryCode??"",l.k0.required],phoneNumber:[this.currentAddress?.phoneNumber??""]}),this.useExisting=!!this.customerId,this.addresses$=this.customerId?this.dataService.query(d.uWB,{customerId:this.customerId}).mapSingle(({customer:n})=>n?.addresses??[]).pipe((0,de.M)(n=>{this.currentAddress&&(this.selectedAddress=n.find(t=>t.streetLine1===this.currentAddress?.streetLine1&&t.postalCode===this.currentAddress?.postalCode)),0===n.length&&(this.createNew=!0,this.useExisting=!1)})):(0,v.of)([]),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(({countries:n})=>n.items)}trackByFn(n){return n.id}addressIdFn(n){return n.streetLine1+n.postalCode}cancel(){this.resolveWith()}select(){if(this.useExisting&&this.selectedAddress&&this.resolveWith({...(0,wt.U)(this.selectedAddress,["fullName","company","streetLine1","streetLine2","city","province","phoneNumber","postalCode"]),countryCode:this.selectedAddress.country.code}),this.createNew&&this.addressForm.valid){const n=this.addressForm.value;this.resolveWith(n)}}static{this.\u0275fac=function(t){return new(t||J)(e.rXU(d.uSP),e.rXU(l.ze))}}static{this.\u0275cmp=e.VBU({type:J,selectors:[["vdr-select-address-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[4,"ngIf"],["vdrDialogButtons",""],["clrTabLink",""],[3,"clrIfActiveChange","clrIfActive"],[1,"block","mt-4",3,"selectItem","idFn","selectedItemId"],[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,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,Vt,2,3,"ng-template",0)(1,Ut,7,5,"clr-tabs",1),e.nI1(2,"async"),e.DNE(3,Jt,6,7,"ng-template",2)),2&t&&(e.R7$(),e.Y8G("ngIf",e.bMT(2,1,i.addresses$)))},dependencies:[u.fnt,u.SE,u.NvB,u._yY,u.BXK,u.ZMF,u.Ak8,c.Sq,c.bT,l.cb,l.j4,F.b,y.M,se.W,rt.O,it.b,ot.N,c.Jj,_.D9],changeDetection:0})}}var at=s(1221);function Ht(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r){const t=e.XpG();e.JRh(e.bMT(1,1,t.title))}}function qt(r,n){1&r&&e.eu8(0)}function Wt(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-form-field",7),e.nI1(1,"translate"),e.j41(2,"textarea",8),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG(2);return e.DH7(a.note,o)||(a.note=o),e.Njj(o)}),e.k0s()()}if(2&r){const t=e.XpG(2);e.Y8G("label",e.bMT(1,2,"common.add-note")),e.R7$(2),e.R50("ngModel",t.note)}}function Qt(r,n){if(1&r&&(e.qex(0),e.DNE(1,qt,1,0,"ng-container",5)(2,Wt,3,4,"vdr-form-field",6),e.bVm()),2&r){const t=e.XpG(),i=e.sdS(4);e.R7$(),e.Y8G("ngTemplateOutlet",i),e.R7$(),e.Y8G("ngIf",t.includeNoteInput)}}function zt(r,n){1&r&&e.eu8(0)}function Zt(r,n){if(1&r&&(e.j41(0,"clr-tab-content")(1,"div",12),e.DNE(2,zt,1,0,"ng-container",5),e.k0s()()),2&r){e.XpG(2);const t=e.sdS(4);e.R7$(2),e.Y8G("ngTemplateOutlet",t)}}function Kt(r,n){if(1&r&&(e.j41(0,"clr-tab-content")(1,"form",13)(2,"vdr-form-field",14),e.nI1(3,"translate"),e.nrm(4,"input",15),e.k0s(),e.j41(5,"vdr-form-field",16),e.nI1(6,"translate"),e.nrm(7,"input",17),e.k0s(),e.j41(8,"vdr-form-field",18),e.nI1(9,"translate"),e.nrm(10,"input",19),e.k0s(),e.j41(11,"vdr-form-field",20),e.nI1(12,"translate"),e.nrm(13,"input",21),e.k0s(),e.j41(14,"vdr-form-field",22),e.nI1(15,"translate"),e.nrm(16,"input",23),e.k0s()()()),2&r){const t=e.XpG(3);e.R7$(),e.Y8G("formGroup",t.customerForm),e.R7$(),e.Y8G("label",e.bMT(3,6,"customer.title")),e.R7$(3),e.Y8G("label",e.bMT(6,8,"customer.first-name")),e.R7$(3),e.Y8G("label",e.bMT(9,10,"customer.last-name")),e.R7$(3),e.Y8G("label",e.bMT(12,12,"customer.email-address")),e.R7$(3),e.Y8G("label",e.bMT(15,14,"customer.phone-number"))}}function en(r,n){if(1&r){const t=e.RV6();e.j41(0,"clr-tab")(1,"button",10),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.DNE(4,Kt,17,16,"ng-template",11),e.mxI("clrIfActiveChange",function(o){e.eBV(t);const a=e.XpG(2);return e.DH7(a.createNew,o)||(a.createNew=o),e.Njj(o)}),e.k0s()}if(2&r){const t=e.XpG(2);e.R7$(2),e.JRh(e.bMT(3,2,"customer.create-new-customer")),e.R7$(2),e.R50("clrIfActive",t.createNew)}}function tn(r,n){if(1&r){const t=e.RV6();e.j41(0,"clr-tabs",9)(1,"clr-tab")(2,"button",10),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.DNE(5,Zt,3,1,"ng-template",11),e.mxI("clrIfActiveChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.useExisting,o)||(a.useExisting=o),e.Njj(o)}),e.k0s(),e.DNE(6,en,5,4,"clr-tab",2),e.k0s()}if(2&r){const t=e.XpG();e.R7$(3),e.JRh(e.bMT(4,3,"order.existing-customer")),e.R7$(2),e.R50("clrIfActive",t.useExisting),e.R7$(),e.Y8G("ngIf",t.canCreateNew)}}function nn(r,n){if(1&r&&(e.j41(0,"span",27),e.nrm(1,"clr-icon",28),e.j41(2,"span",29),e.EFF(3),e.k0s(),e.j41(4,"vdr-chip"),e.EFF(5),e.k0s()()),2&r){const t=n.item;e.R7$(3),e.Lme("",t.firstName," ",t.lastName,""),e.R7$(2),e.JRh(t.emailAddress)}}function rn(r,n){if(1&r&&(e.j41(0,"span",27),e.nrm(1,"clr-icon",28),e.j41(2,"span",29),e.EFF(3),e.k0s(),e.j41(4,"vdr-chip"),e.EFF(5),e.k0s()()),2&r){const t=n.item;e.R7$(3),e.Lme("",t.firstName," ",t.lastName,""),e.R7$(2),e.JRh(t.emailAddress)}}function on(r,n){if(1&r){const t=e.RV6();e.j41(0,"ng-select",24),e.nI1(1,"async"),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.selectedCustomer,o)||(a.selectedCustomer=o),e.Njj(o)}),e.DNE(2,nn,6,3,"ng-template",25)(3,rn,6,3,"ng-template",26),e.k0s()}if(2&r){const t=e.XpG();e.Y8G("items",e.bMT(1,9,t.customers$))("addTag",!1)("multiple",!0)("hideSelected",!0)("trackByFn",t.trackByFn)("minTermLength",2)("loading",t.isLoading)("typeahead",t.input$),e.R50("ngModel",t.selectedCustomer)}}function an(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",30),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",31),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"common.cancel")),e.R7$(2),e.Y8G("disabled",t.useExisting&&0===t.selectedCustomer.length||t.createNew&&t.customerForm.invalid),e.R7$(),e.SpI(" ",e.bMT(5,5,"common.okay")," ")}}class H{constructor(n,t){this.dataService=n,this.formBuilder=t,this.canCreateNew=!0,this.includeNoteInput=!1,this.title=(0,p.x)("order.set-customer-for-order"),this.isLoading=!1,this.input$=new B.B,this.selectedCustomer=[],this.useExisting=!0,this.createNew=!1,this.note="",this.customerForm=this.formBuilder.group({title:"",firstName:["",l.k0.required],lastName:["",l.k0.required],phoneNumber:"",emailAddress:["",[l.k0.required,l.k0.email]]})}ngOnInit(){this.customers$=(0,et.x)((0,v.of)([]),this.input$.pipe((0,Ve.B)(200),(0,tt.F)(),(0,de.M)(()=>this.isLoading=!0),(0,f.n)(n=>this.dataService.customer.getCustomerList(10,0,n).mapStream(({customers:t})=>t.items).pipe((0,at.W)(()=>(0,v.of)([])),(0,de.M)(()=>this.isLoading=!1)))))}trackByFn(n){return n.id}cancel(){this.resolveWith()}select(){if(this.useExisting&&1===this.selectedCustomer.length)this.resolveWith({...this.selectedCustomer[0],note:this.note});else if(this.createNew&&this.customerForm.valid){const n=this.customerForm.value;this.resolveWith({...n,note:this.note})}}static{this.\u0275fac=function(t){return new(t||H)(e.rXU(d.uSP),e.rXU(l.ze))}}static{this.\u0275cmp=e.VBU({type:H,selectors:[["vdr-select-customer-dialog"]],decls:6,vars:2,consts:[["customerSelect",""],["vdrDialogTitle",""],[4,"ngIf"],["class","pt-1",4,"ngIf"],["vdrDialogButtons",""],[4,"ngTemplateOutlet"],["class","mt-4",3,"label",4,"ngIf"],[1,"mt-4",3,"label"],[3,"ngModelChange","ngModel"],[1,"pt-1"],["clrTabLink",""],[3,"clrIfActiveChange","clrIfActive"],[1,"mt-4"],[3,"formGroup"],["for","title",3,"label"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["appendTo","body","bindLabel","name",3,"ngModelChange","items","addTag","multiple","hideSelected","trackByFn","minTermLength","loading","typeahead","ngModel"],["ng-label-tmp",""],["ng-option-tmp",""],[1,"item-row"],["shape","user",1,"is-solid"],[1,"mx-1"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(t,i){1&t&&e.DNE(0,Ht,2,3,"ng-template",1)(1,Qt,3,2,"ng-container",2)(2,tn,7,5,"clr-tabs",3)(3,on,4,11,"ng-template",null,0,e.C5r)(5,an,6,7,"ng-template",4),2&t&&(e.R7$(),e.Y8G("ngIf",!i.canCreateNew),e.R7$(),e.Y8G("ngIf",i.canCreateNew))},dependencies:[u.U4n,u.fnt,u.SE,u.NvB,u._yY,u.BXK,u.ZMF,u.Ak8,c.bT,c.T3,l.qT,l.me,l.BC,l.cb,l.vS,l.j4,l.JD,G.vr,G.Uq,G.ZZ,k.w,N.K,h.V,F.b,y.M,c.Jj,_.D9],styles:[".item-row[_ngcontent-%COMP%]{display:flex;align-items:center}clr-tabs[_ngcontent-%COMP%]{display:block}"],changeDetection:0})}}var C=s(945),ce=s(1195);function ln(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.select-shipping-method"))}function dn(r,n){if(1&r&&e.nrm(0,"vdr-object-tree",9),2&r){const t=e.XpG().$implicit;e.Y8G("value",t.metadata)}}function sn(r,n){if(1&r&&(e.j41(0,"vdr-radio-card",4)(1,"div",5)(2,"vdr-labeled-data",6),e.nI1(3,"translate"),e.EFF(4),e.k0s(),e.j41(5,"div",7)(6,"vdr-labeled-data",6),e.nI1(7,"translate"),e.EFF(8),e.nI1(9,"localeCurrency"),e.k0s(),e.j41(10,"vdr-labeled-data",6),e.nI1(11,"translate"),e.EFF(12),e.nI1(13,"localeCurrency"),e.k0s()(),e.DNE(14,dn,1,1,"vdr-object-tree",8),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG();e.Y8G("item",t),e.R7$(2),e.Y8G("label",e.bMT(3,8,"settings.shipping-method")),e.R7$(2),e.SpI(" ",t.name," "),e.R7$(2),e.Y8G("label",e.bMT(7,10,"common.price")),e.R7$(2),e.SpI(" ",e.i5U(9,12,t.price,i.currencyCode)," "),e.R7$(2),e.Y8G("label",e.bMT(11,15,"common.price-with-tax")),e.R7$(2),e.SpI(" ",e.i5U(13,17,t.priceWithTax,i.currencyCode)," "),e.R7$(2),e.Y8G("ngIf",t.metadata)}}function cn(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",10),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",11),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"common.cancel")),e.R7$(2),e.Y8G("disabled",!t.selectedMethod),e.R7$(),e.SpI(" ",e.bMT(5,5,"common.okay")," ")}}class q{ngOnInit(){this.currentSelectionId&&(this.selectedMethod=this.eligibleShippingMethods.find(n=>n.id===this.currentSelectionId))}methodIdFn(n){return n.id}cancel(){this.resolveWith()}select(){this.selectedMethod&&this.resolveWith(this.selectedMethod.id)}static{this.\u0275fac=function(t){return new(t||q)}}static{this.\u0275cmp=e.VBU({type:q,selectors:[["vdr-select-shipping-method-dialog"]],decls:4,vars:3,consts:[["vdrDialogTitle",""],[3,"selectItem","idFn","selectedItemId"],[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,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,ln,2,3,"ng-template",0),e.j41(1,"vdr-radio-card-fieldset",1),e.bIt("selectItem",function(a){return i.selectedMethod=a}),e.DNE(2,sn,15,20,"vdr-radio-card",2),e.k0s(),e.DNE(3,cn,6,7,"ng-template",3)),2&t&&(e.R7$(),e.Y8G("idFn",i.methodIdFn)("selectedItemId",null==i.selectedMethod?null:i.selectedMethod.id),e.R7$(),e.Y8G("ngForOf",i.eligibleShippingMethods))},dependencies:[c.Sq,c.bT,F.b,y.M,C.B,ce.T,it.b,ot.N,_.D9,g.u],changeDetection:0})}}var $=s(9103),mn=s(6294),pn=s(6030),lt=s(4576);var _n=s(5591),j=s(1860);const fn=r=>({state:r});function gn(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.select-state"))}function hn(r,n){if(1&r&&(e.j41(0,"option",4),e.EFF(1),e.nI1(2,"stateI18nToken"),e.nI1(3,"translate"),e.k0s()),2&r){const t=n.$implicit;e.Y8G("value",t),e.R7$(),e.SpI(" ",e.bMT(3,4,e.bMT(2,2,t))," ")}}function bn(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",7),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"common.cancel")," "))}function Cn(r,n){if(1&r){const t=e.RV6();e.DNE(0,bn,3,3,"button",5),e.j41(1,"button",6),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(2),e.nI1(3,"stateI18nToken"),e.nI1(4,"translate"),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.Y8G("ngIf",t.cancellable),e.R7$(),e.Y8G("disabled",!t.selectedState),e.R7$(),e.SpI(" ",e.i5U(5,7,"order.transition-to-state",e.eq3(10,fn,e.bMT(4,5,e.bMT(3,3,t.selectedState))))," ")}}class me{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}static{this.\u0275fac=function(t){return new(t||me)}}static{this.\u0275cmp=e.VBU({type:me,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["name","state",3,"ngModelChange","ngModel"],[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,"click","disabled"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(t,i){1&t&&(e.DNE(0,gn,2,3,"ng-template",0),e.j41(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"vdr-form-field")(5,"select",1),e.mxI("ngModelChange",function(a){return e.DH7(i.selectedState,a)||(i.selectedState=a),a}),e.DNE(6,hn,4,6,"option",2),e.k0s()(),e.DNE(7,Cn,6,12,"ng-template",3)),2&t&&(e.R7$(2),e.JRh(e.bMT(3,3,i.message)),e.R7$(3),e.R50("ngModel",i.selectedState),e.R7$(),e.Y8G("ngForOf",i.nextStates))},dependencies:[c.Sq,c.bT,l.xH,l.y7,l.wz,l.BC,l.vS,N.K,h.V,F.b,y.M,_.D9,j.p],changeDetection:0})}}class E{constructor(n,t,i,o){this.dataService=n,this.modalService=t,this.notificationService=i,this.i18nService=o}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,f.n)(i=>{const o={orderId:n,nextStates:t,message:this.i18nService.translate((0,p.x)("order.unable-to-transition-to-state-try-another"),{state:i}),cancellable:!1,retry:10};return i?this.transitionToStateOrThrow(n,i).pipe((0,at.W)(a=>this.manuallyTransitionToState(o))):this.manuallyTransitionToState(o)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(me,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,f.n)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return $.w;throw new Error("An order state must be selected")}),function un(r){return(0,pn.N)((n,t)=>{let i,a,o=!1;const m=()=>{i=n.subscribe((0,lt._)(t,void 0,void 0,O=>{a||(a=new B.B,(0,mn.Tg)(r(a)).subscribe((0,lt._)(t,()=>i?m():o=!0))),a&&a.next(O)})),o&&(i.unsubscribe(),i=null,o=!1,m())};m()})}(t=>t.pipe((0,_n.c)(2e3),(0,D.s)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:d.Htj.ORDER_STATE_TRANSITION}},sort:{createdAt:d.xBQ.DESC}}).mapSingle(t=>t.order).pipe((0,R.T)(t=>{const i=t?.history.items.find(o=>"Modifying"===o.data.to);if(i)return i.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,R.T)(({transitionOrderToState:i})=>{switch(i?.__typename){case"Order":return i?.state;case"OrderStateTransitionError":throw this.notificationService.error(i?.transitionError),new Error(i?.transitionError)}}))}static{this.\u0275fac=function(t){return new(t||E)(e.KVO(d.uSP),e.KVO(d.Bg8),e.KVO(d.JEu),e.KVO(d.W40))}}static{this.\u0275prov=e.jDH({token:E,factory:E.\u0275fac,providedIn:"root"})}}var I=s(273),Ae=s(3869),Xe=s(8867),pe=s(5483),Ee=s(163),Le=s(7395),dt=s(8097),Pe=s(8995),st=s(8557),Be=s(8205),Ue=s(3849),T=s(3161),ct=s(4585);function vn(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",9),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.editable=!0)}),e.nrm(1,"clr-icon",10),e.EFF(2),e.nI1(3,"translate"),e.k0s()}2&r&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"common.edit")," "))}function yn(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",11),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.onUpdateClick())}),e.nrm(1,"clr-icon",12),e.EFF(2),e.nI1(3,"translate"),e.k0s()}if(2&r){const t=e.XpG(2);e.Y8G("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.R7$(2),e.SpI(" ",e.bMT(3,2,"common.update")," ")}}function In(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",9),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.onCancelClick())}),e.nrm(1,"clr-icon",13),e.EFF(2),e.nI1(3,"translate"),e.k0s()}2&r&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"common.cancel")," "))}function Tn(r,n){if(1&r&&(e.j41(0,"div",1)(1,"div",2),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"div",3)(5,"div",4),e.nrm(6,"vdr-tabbed-custom-fields",5),e.k0s()(),e.j41(7,"div",6),e.DNE(8,vn,4,3,"button",7)(9,yn,4,4,"button",8)(10,In,4,3,"button",7),e.k0s()()),2&r){const t=e.XpG();e.R7$(2),e.SpI(" ",e.bMT(3,10,"common.custom-fields")," "),e.R7$(3),e.AVh("editable",t.editable),e.R7$(),e.Y8G("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.R7$(2),e.Y8G("ngIf",!t.editable),e.R7$(),e.Y8G("ngIf",t.editable),e.R7$(),e.Y8G("ngIf",t.editable)}}class ue{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e.bkB,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,p.x)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,p.x)("common.keep-editing")},{type:"danger",label:(0,p.x)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}static{this.\u0275fac=function(t){return new(t||ue)(e.rXU(l.ze),e.rXU(d.Bg8))}}static{this.\u0275cmp=e.VBU({type:ue,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,"click","disabled"],["shape","check"],["shape","times"]],template:function(t,i){1&t&&e.DNE(0,Tn,11,12,"div",0),2&t&&e.Y8G("ngIf",i.customFieldsConfig.length)},dependencies:[u.U4n,c.bT,ct.W,_.D9],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0})}}var M=s(808),W=s(1787),Q=s(2981),z=s(6336),Ne=s(7595),mt=s(2124),Y=s(2953);const On=(r,n)=>({total:r,count:n}),Fn=r=>({count:r});function Rn(r,n){1&r&&e.nrm(0,"clr-icon",9)}function Mn(r,n){1&r&&e.nrm(0,"clr-icon",10)}function Sn(r,n){1&r&&e.nrm(0,"clr-icon",11)}function xn(r,n){1&r&&(e.j41(0,"label",12),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.line-fulfillment-all")," "))}function Gn(r,n){if(1&r&&(e.j41(0,"label",12),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r){const t=e.XpG(2);e.R7$(),e.SpI(" ",e.i5U(2,1,"order.line-fulfillment-partial",e.l_i(4,On,t.line.quantity,t.fulfilledCount))," ")}}function kn(r,n){1&r&&(e.j41(0,"label",12),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.line-fulfillment-none")," "))}function Dn(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",15),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG().$implicit;e.Y8G("label",e.bMT(1,2,"order.tracking-code")),e.R7$(2),e.SpI(" ",t.fulfillment.trackingCode," ")}}function $n(r,n){if(1&r&&(e.j41(0,"div",13)(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.nI1(4,"translate"),e.k0s(),e.j41(5,"vdr-labeled-data",15),e.nI1(6,"translate"),e.EFF(7),e.nI1(8,"localeDate"),e.k0s(),e.j41(9,"vdr-labeled-data",15),e.nI1(10,"translate"),e.EFF(11),e.k0s(),e.DNE(12,Dn,3,4,"vdr-labeled-data",16),e.k0s()),2&r){const t=n.$implicit;e.R7$(2),e.E5c(" ",e.bMT(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.i5U(4,10,"order.item-count",e.eq3(20,Fn,t.count)),") "),e.R7$(3),e.Y8G("label",e.bMT(6,13,"common.created-at")),e.R7$(2),e.SpI(" ",e.i5U(8,15,t.fulfillment.createdAt,"medium")," "),e.R7$(2),e.Y8G("label",e.bMT(10,18,"order.fulfillment-method")),e.R7$(2),e.SpI(" ",t.fulfillment.method," "),e.R7$(),e.Y8G("ngIf",t.fulfillment.trackingCode)}}function jn(r,n){if(1&r&&(e.j41(0,"vdr-dropdown",1)(1,"button",2),e.DNE(2,Rn,1,0,"clr-icon",3)(3,Mn,1,0,"clr-icon",4)(4,Sn,1,0,"clr-icon",5),e.k0s(),e.j41(5,"vdr-dropdown-menu",6),e.DNE(6,xn,3,3,"label",7)(7,Gn,3,7,"label",7)(8,kn,3,3,"label",7)(9,$n,13,22,"div",8),e.k0s()()),2&r){const t=e.XpG();e.R7$(2),e.Y8G("ngIf","full"===t.fulfillmentStatus),e.R7$(),e.Y8G("ngIf","partial"===t.fulfillmentStatus),e.R7$(),e.Y8G("ngIf","none"===t.fulfillmentStatus),e.R7$(2),e.Y8G("ngIf","full"===t.fulfillmentStatus),e.R7$(),e.Y8G("ngIf","partial"===t.fulfillmentStatus),e.R7$(),e.Y8G("ngIf","none"===t.fulfillmentStatus),e.R7$(),e.Y8G("ngForOf",t.fulfillments)}}class Z{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.quantity),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){return n.fulfillmentLines?.reduce((t,i)=>t+i.quantity,0)??0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){return n.fulfillmentLines?.map(t=>{const i=this.allOrderFulfillments?.find(o=>o.id===t.fulfillmentId);if(i)return{count:t.quantity,fulfillment:i}}).filter(b.notNullOrUndefined)??[]}static{this.\u0275fac=function(t){return new(t||Z)}}static{this.\u0275cmp=e.VBU({type:Z,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",allOrderFulfillments:"allOrderFulfillments",orderState:"orderState"},features:[e.OA$],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(t,i){1&t&&e.DNE(0,jn,10,7,"vdr-dropdown",0),2&t&&e.Y8G("ngIf",i.fulfilledCount||"PartiallyDelivered"===i.orderState)},dependencies:[u.U4n,u.aZZ,c.Sq,c.bT,W.P,Q.q,z.j,C.B,_.D9,Y.P],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-700)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-700)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-700)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0})}}var pt=s(1239);const En=r=>({count:r});function Pn(r,n){if(1&r&&(e.j41(0,"span",1),e.nI1(1,"translate"),e.nrm(2,"clr-icon",2),e.k0s()),2&r){const t=e.XpG();e.Y8G("title",e.i5U(1,1,"order.refunded-count",e.eq3(4,En,t.getRefundedCount())))}}class w{getRefundedCount(){return(this.payments?.reduce((t,i)=>[...t,...i.refunds],[]).filter(t=>"Failed"!==t.state).reduce((t,i)=>[...t,...i.lines],[])??[]).filter(t=>t.orderLineId===this.line.id).reduce((t,i)=>t+i.quantity,0)}static{this.\u0275fac=function(t){return new(t||w)}}static{this.\u0275cmp=e.VBU({type:w,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(t,i){1&t&&e.DNE(0,Pn,3,6,"span",0),2&t&&e.Y8G("ngIf",i.getRefundedCount())},dependencies:[u.U4n,c.bT,pt.ig,_.D9],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0})}}class V extends d.Y9G{constructor(){super(...arguments),this.orderable=!1}static{this.\u0275fac=(()=>{let n;return function(i){return(n||(n=e.xGo(V)))(i||V)}})()}static{this.\u0275cmp=e.VBU({type:V,selectors:[["vdr-order-total-column"]],exportAs:["row"],features:[e.Vt3],decls:0,vars:0,template:function(t,i){},encapsulation:2})}}var Nn=s(6871),Yn=s(9007),wn=s(563),Vn=s(9323),An=s(1606);const Xn=[[["vdr-bulk-action-menu"]]],Ln=["vdr-bulk-action-menu"],Bn=(r,n,t,i)=>({id:r,itemsPerPage:n,currentPage:t,totalItems:i}),Un=r=>({rowItem:r}),Jn=(r,n)=>({item:r,index:n});function Hn(r,n){if(1&r){const t=e.RV6();e.j41(0,"th",19)(1,"input",20),e.bIt("change",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.onToggleAllClick())}),e.k0s()()}if(2&r){const t=e.XpG();e.R7$(),e.Y8G("checked",null==t.selectionManager?null:t.selectionManager.areAllCurrentItemsSelected())}}function qn(r,n){1&r&&e.nrm(0,"clr-icon",30)}function Wn(r,n){1&r&&e.nrm(0,"clr-icon",31)}function Qn(r,n){1&r&&e.nrm(0,"clr-icon",32)}function zn(r,n){if(1&r&&(e.j41(0,"div",33),e.EFF(1),e.k0s()),2&r){const t=e.XpG().ngIf;e.R7$(),e.JRh(t.sortOrder)}}function Zn(r,n){if(1&r){const t=e.RV6();e.j41(0,"div",24)(1,"button",25),e.bIt("click",function(){const o=e.eBV(t).ngIf;return e.Njj(o.toggleSortOrder())}),e.DNE(2,qn,1,0,"clr-icon",26)(3,Wn,1,0,"clr-icon",27)(4,Qn,1,0,"clr-icon",28),e.k0s(),e.DNE(5,zn,2,1,"div",29),e.k0s()}if(2&r){const t=n.ngIf;e.R7$(),e.AVh("active",t.sortOrder),e.R7$(),e.Y8G("ngIf",!t.sortOrder),e.R7$(),e.Y8G("ngIf","ASC"===t.sortOrder),e.R7$(),e.Y8G("ngIf","DESC"===t.sortOrder),e.R7$(),e.Y8G("ngIf",t.sortOrder)}}function Kn(r,n){if(1&r&&(e.j41(0,"th")(1,"div",21)(2,"vdr-ui-extension-point",22)(3,"span"),e.EFF(4),e.k0s()(),e.DNE(5,Zn,6,6,"div",23),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG();e.AVh("expand",t.expand),e.R7$(),e.Y8G("ngClass",t.align),e.R7$(),e.Y8G("locationId",i.id)("metadata",t.id)("topPx",-6)("leftPx",-24),e.R7$(2),e.JRh(t.heading),e.R7$(),e.Y8G("ngIf",t.sort)}}function er(r,n){1&r&&e.eu8(0)}function tr(r,n){1&r&&e.eu8(0)}function nr(r,n){if(1&r&&e.nrm(0,"vdr-data-table-filters",42),2&r){const t=n.$implicit,i=e.XpG(3);e.Y8G("filterWithValue",t)("filters",i.filters)}}function rr(r,n){if(1&r&&e.nrm(0,"vdr-data-table-filters",43),2&r){const t=e.XpG(3);e.Y8G("filters",t.filters)}}function ir(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",39),e.DNE(2,nr,1,2,"vdr-data-table-filters",40)(3,rr,1,1,"vdr-data-table-filters",41),e.k0s(),e.bVm()),2&r){const t=e.XpG(2);e.R7$(2),e.Y8G("ngForOf",t.filters.activeFilters),e.R7$(),e.Y8G("ngIf",t.filters.length)}}function or(r,n){if(1&r){const t=e.RV6();e.j41(0,"tr")(1,"th",34)(2,"button",35),e.nI1(3,"translate"),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.toggleSearchFilterRow())}),e.nrm(4,"clr-icon",36),e.k0s(),e.j41(5,"div",37),e.DNE(6,er,1,0,"ng-container",38)(7,tr,1,0,"ng-container",38)(8,ir,4,2,"ng-container",9),e.k0s()()()}if(2&r){const t=e.XpG();e.R7$(),e.AVh("active",t.showSearchFilterRow),e.BMQ("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.R7$(),e.AVh("active",t.showSearchFilterRow),e.Y8G("title",e.bMT(3,11,"common.search-and-filter-list")),e.R7$(3),e.AVh("hidden",!t.showSearchFilterRow),e.R7$(),e.Y8G("ngTemplateOutlet",null==t.searchComponent?null:t.searchComponent.template),e.R7$(),e.Y8G("ngTemplateOutlet",t.customSearchTemplate),e.R7$(),e.Y8G("ngIf",t.filters)}}function ar(r,n){if(1&r){const t=e.RV6();e.j41(0,"td",19)(1,"input",46),e.bIt("click",function(o){e.eBV(t);const a=e.XpG().$implicit,m=e.XpG();return e.Njj(m.onRowClick(a,o))}),e.k0s()()}if(2&r){const t=e.XpG(),i=t.$implicit,o=t.index,a=e.XpG();e.AVh("active",a.activeIndex===o),e.R7$(),e.Y8G("checked",null==a.selectionManager?null:a.selectionManager.isSelected(i))}}function lr(r,n){1&r&&e.eu8(0)}function dr(r,n){if(1&r&&(e.qex(0),e.DNE(1,lr,1,0,"ng-container",48),e.bVm()),2&r){const t=n.ngIf,i=e.XpG(2).$implicit;e.R7$(),e.Y8G("ngComponentOutlet",t.config.component)("ngComponentOutletInputs",e.eq3(3,Un,i))("ngComponentOutletInjector",t.injector)}}function sr(r,n){1&r&&e.eu8(0)}function cr(r,n){if(1&r&&e.DNE(0,sr,1,0,"ng-container",49),2&r){const t=e.XpG().$implicit,i=e.XpG(),o=i.$implicit,a=i.index;e.Y8G("ngTemplateOutlet",t.template)("ngTemplateOutletContext",e.l_i(2,Jn,o,a))}}function mr(r,n){if(1&r&&(e.j41(0,"td")(1,"div",21),e.DNE(2,dr,2,5,"ng-container",47)(3,cr,1,5,"ng-template",null,0,e.C5r),e.k0s()()),2&r){const t=n.$implicit,i=e.sdS(4),o=e.XpG().index,a=e.XpG();e.AVh("active",a.activeIndex===o),e.R7$(),e.Y8G("ngClass",t.align),e.R7$(),e.Y8G("ngIf",a.customComponents.get(t.id))("ngIfElse",i)}}function pr(r,n){if(1&r&&(e.j41(0,"tr"),e.DNE(1,ar,2,3,"td",44)(2,mr,5,5,"td",45),e.nrm(3,"td"),e.k0s()),2&r){const t=n.index,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.selectionManager),e.R7$(),e.Y8G("ngForOf",i.visibleSortedColumns),e.R7$(),e.AVh("active",i.activeIndex===t)}}function ur(r,n){if(1&r&&(e.j41(0,"tr")(1,"td"),e.nrm(2,"vdr-empty-placeholder",50),e.nI1(3,"translate"),e.k0s()()),2&r){const t=e.XpG();e.R7$(),e.BMQ("colspan",t.visibleSortedColumns.length+(t.selectionManager?2:1)),e.R7$(),e.Y8G("emptyStateLabel",e.bMT(3,2,"order.order-is-empty"))}}function _r(r,n){if(1&r&&(e.j41(0,"tr",51)(1,"td",52),e.EFF(2),e.k0s(),e.j41(3,"td",53),e.EFF(4),e.k0s(),e.nrm(5,"td",54),e.j41(6,"td",55),e.EFF(7),e.nI1(8,"localeCurrency"),e.j41(9,"div",15),e.nI1(10,"translate"),e.EFF(11),e.nI1(12,"localeCurrency"),e.k0s()(),e.nrm(13,"td"),e.k0s()),2&r){const t=n.$implicit,i=e.XpG();e.R7$(2),e.JRh(t.description),e.R7$(2),e.JRh(t.sku),e.R7$(),e.BMQ("colspan",i.visibleSortedColumns.length-4),e.R7$(2),e.SpI(" ",e.i5U(8,6,t.priceWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(10,9,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(12,11,t.price,i.order.currencyCode)," ")}}function fr(r,n){if(1&r&&(e.j41(0,"vdr-chip"),e.EFF(1),e.k0s()),2&r){const t=n.ngIf;e.R7$(),e.JRh(t)}}function gr(r,n){if(1&r&&(e.j41(0,"tr",57)(1,"td",3)(2,"a",58),e.EFF(3),e.k0s(),e.DNE(4,fr,2,1,"vdr-chip",9),e.k0s(),e.j41(5,"td",3),e.EFF(6),e.nI1(7,"localeCurrency"),e.j41(8,"div",15),e.nI1(9,"translate"),e.EFF(10),e.nI1(11,"localeCurrency"),e.k0s()(),e.nrm(12,"td"),e.k0s()),2&r){const t=e.XpG().$implicit,i=e.XpG();e.R7$(),e.BMQ("colspan",i.visibleSortedColumns.length-1),e.R7$(),e.Y8G("routerLink",i.getPromotionLink(t)),e.R7$(),e.JRh(t.description),e.R7$(),e.Y8G("ngIf",i.getCouponCodeForAdjustment(i.order,t)),e.R7$(2),e.SpI(" ",e.i5U(7,7,t.amountWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(9,10,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(11,12,t.amount,i.order.currencyCode)," ")}}function hr(r,n){if(1&r&&(e.qex(0),e.DNE(1,gr,13,15,"tr",56),e.bVm()),2&r){const t=n.$implicit;e.R7$(),e.Y8G("ngIf","OTHER"!==t.type)}}function br(r,n){if(1&r&&(e.j41(0,"vdr-chip",59),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.SpI(" ",t.shippingMethod.name," ")}}class K extends d.IMU{get allColumns(){return[...this.columns??[],...this.customFieldColumns??[],...this.totalColumns??[]]}get sortedColumns(){const n=this.allColumns,t=this.getDataTableConfig();for(const[i,o]of Object.entries(t[this.id].order)){const a=n.find(O=>O.id===i),m=n.findIndex(O=>O.id===i);-1!==m&&a&&(n.splice(m,1),n.splice(o,0,a))}return n}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const i=t.adjustmentSource.split(":")[1],o=n.promotions.find(a=>a.id===i);if(o)return o.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static{this.\u0275fac=(()=>{let n;return function(i){return(n||(n=e.xGo(K)))(i||K)}})()}static{this.\u0275cmp=e.VBU({type:K,selectors:[["vdr-order-data-table"]],contentQueries:function(t,i,o){if(1&t&&e.wni(o,V,4),2&t){let a;e.mGM(a=e.lsd())&&(i.totalColumns=a)}},inputs:{order:"order"},features:[e.Vt3],ngContentSelectors:Ln,decls:60,vars:70,consts:[["defaultComponent",""],[1,"bulk-actions"],[1,"table-wrapper"],[1,""],[1,"heading-row"],["class","selection-col",4,"ngIf"],[3,"expand",4,"ngFor","ngForOf"],[1,"column-picker"],[3,"reorder","resetColumns","uiLanguage","columns"],[4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"sub-total"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["class","shipping-method-name",4,"ngFor","ngForOf"],[1,"total"],[1,"selection-col"],["type","checkbox","clrCheckbox","",3,"change","checked"],[1,"cell-content",3,"ngClass"],["api","dataTable","display","block",3,"locationId","metadata","topPx","leftPx"],["class","sort-toggle",4,"ngIf"],[1,"sort-toggle"],[3,"click"],["shape","two-way-arrows left",4,"ngIf"],["shape","arrow up",4,"ngIf"],["shape","arrow down",4,"ngIf"],["class","sort-label",4,"ngIf"],["shape","two-way-arrows left"],["shape","arrow up"],["shape","arrow down"],[1,"sort-label"],[1,"filter-row"],[1,"button-ghost","toggle-search-filter-row",3,"click","title"],["shape","search"],[1,"filter-row-wrapper"],[4,"ngTemplateOutlet"],[1,"filters"],["class","mt-1",3,"filterWithValue","filters",4,"ngFor","ngForOf"],["class","mt-1",3,"filters",4,"ngIf"],[1,"mt-1",3,"filterWithValue","filters"],[1,"mt-1",3,"filters"],["class","selection-col",3,"active",4,"ngIf"],[3,"active",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"click","checked"],[4,"ngIf","ngIfElse"],[4,"ngComponentOutlet","ngComponentOutletInputs","ngComponentOutletInjector"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"emptyStateLabel"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle","sku"],[1,"align-middle"],[1,"align-middle","total"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],[3,"routerLink"],[1,"shipping-method-name"]],template:function(t,i){1&t&&(e.NAR(Xn),e.j41(0,"div",1),e.SdG(1),e.k0s(),e.j41(2,"div",2)(3,"table",3)(4,"thead")(5,"tr",4),e.DNE(6,Hn,2,1,"th",5)(7,Kn,6,9,"th",6),e.j41(8,"th")(9,"div",7)(10,"vdr-data-table-colum-picker",8),e.nI1(11,"async"),e.bIt("reorder",function(a){return i.onColumnReorder(a)})("resetColumns",function(){return i.onColumnsReset()}),e.k0s()()()(),e.DNE(12,or,9,13,"tr",9),e.k0s(),e.j41(13,"tbody"),e.DNE(14,pr,4,4,"tr",10),e.nI1(15,"paginate"),e.qex(16),e.DNE(17,ur,4,4,"tr",9),e.bVm(),e.DNE(18,_r,14,14,"tr",11)(19,hr,2,1,"ng-container",12),e.j41(20,"tr",13)(21,"td",3),e.EFF(22),e.nI1(23,"translate"),e.k0s(),e.nrm(24,"td"),e.j41(25,"td",14),e.EFF(26),e.nI1(27,"localeCurrency"),e.j41(28,"div",15),e.nI1(29,"translate"),e.EFF(30),e.nI1(31,"localeCurrency"),e.k0s()(),e.nrm(32,"td"),e.k0s(),e.j41(33,"tr",16)(34,"td",3),e.EFF(35),e.nI1(36,"translate"),e.k0s(),e.j41(37,"td"),e.DNE(38,br,2,1,"vdr-chip",17),e.k0s(),e.j41(39,"td",14),e.EFF(40),e.nI1(41,"localeCurrency"),e.j41(42,"div",15),e.nI1(43,"translate"),e.EFF(44),e.nI1(45,"localeCurrency"),e.k0s()(),e.nrm(46,"td"),e.k0s(),e.j41(47,"tr",18)(48,"td",3),e.EFF(49),e.nI1(50,"translate"),e.k0s(),e.nrm(51,"td"),e.j41(52,"td",14),e.EFF(53),e.nI1(54,"localeCurrency"),e.j41(55,"div",15),e.nI1(56,"translate"),e.EFF(57),e.nI1(58,"localeCurrency"),e.k0s()(),e.nrm(59,"td"),e.k0s()()()()),2&t&&(e.R7$(3),e.AVh("no-select",i.disableSelect),e.R7$(),e.AVh("items-selected",null==i.selectionManager?null:i.selectionManager.selection.length),e.R7$(2),e.Y8G("ngIf",i.selectionManager),e.R7$(),e.Y8G("ngForOf",i.visibleSortedColumns),e.R7$(3),e.Y8G("uiLanguage",e.bMT(11,30,i.uiLanguage$))("columns",i.sortedColumns),e.R7$(2),e.Y8G("ngIf",i.searchComponent||i.customSearchTemplate||(null==i.filters?null:i.filters.length)),e.R7$(2),e.Y8G("ngForOf",e.i5U(15,32,i.items,e.ziG(65,Bn,i.id,i.itemsPerPage,i.currentPage,i.totalItems)))("ngForTrackBy",i.trackByFn),e.R7$(3),e.Y8G("ngIf",!(null!=i.items&&i.items.length)),e.R7$(),e.Y8G("ngForOf",i.order.surcharges),e.R7$(),e.Y8G("ngForOf",i.order.discounts),e.R7$(3),e.JRh(e.bMT(23,35,"order.sub-total")),e.R7$(2),e.BMQ("colspan",i.visibleSortedColumns.length-2),e.R7$(2),e.SpI(" ",e.i5U(27,37,i.order.subTotalWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(29,40,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(31,42,i.order.subTotal,i.order.currencyCode)," "),e.R7$(5),e.JRh(e.bMT(36,45,"order.shipping")),e.R7$(2),e.BMQ("colspan",i.visibleSortedColumns.length-2),e.R7$(),e.Y8G("ngForOf",i.order.shippingLines),e.R7$(2),e.SpI(" ",e.i5U(41,47,i.order.shippingWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(43,50,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(45,52,i.order.shipping,i.order.currencyCode)," "),e.R7$(5),e.JRh(e.bMT(50,55,"order.total")),e.R7$(2),e.BMQ("colspan",i.visibleSortedColumns.length-2),e.R7$(2),e.SpI(" ",e.i5U(54,57,i.order.totalWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(56,60,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(58,62,i.order.total,i.order.currencyCode)," "))},dependencies:[u.U4n,u.Jej,c.YU,c.OI,c.Sq,c.bT,c.T3,M.Wk,k.w,h.V,Nn.O,Yn.b,wn.$,Vn.w,c.Jj,An.kf,_.D9,g.u],styles:["[_nghost-%COMP%]{display:block;max-width:100%;position:relative;margin-bottom:calc(var(--space-unit) * 4);container-type:inline-size}th[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border);color:var(--color-weight-700);font-size:var(--font-size-xs);font-weight:600;text-transform:uppercase;position:relative;white-space:nowrap;background-color:transparent}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 1);color:var(--color-text-100)}tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{text-align:center}@media screen and (min-width: 992px){tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-of-type, tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-of-type{padding-inline-start:var(--surface-margin-left);text-align:start}}th[_ngcontent-%COMP%]:last-of-type, td[_ngcontent-%COMP%]:last-of-type{border-inline-end:1px solid var(--color-table-header-border)}tr[_ngcontent-%COMP%]:first-of-type th[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(0deg,var(--color-table-header-border),transparent) 1}tr[_ngcontent-%COMP%]:last-of-type td[_ngcontent-%COMP%]:last-of-type{border-image:linear-gradient(180deg,var(--color-table-header-border),transparent) 1}tbody[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-row-separator)}tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--color-table-row-hover-bg)}.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 5);background-color:var(--color-surface-bg);z-index:10;display:flex;position:absolute;top:5px;height:40px}@media screen and (min-width: 992px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 8.5)}}@media screen and (min-width: 1280px){.bulk-actions[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 10.5)}}.table-wrapper[_ngcontent-%COMP%]{display:block;overflow-y:hidden;overflow-x:auto;position:relative;width:100%;max-width:var(--surface-width)}table[_ngcontent-%COMP%]{width:100%}table.no-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}.column-picker[_ngcontent-%COMP%]{width:24px}.sort-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;margin-inline-start:calc(var(--space-unit) * .5)}.sort-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border:0;border-radius:var(--border-radius-lg);color:var(--color-weight-500);padding:0 2px;cursor:pointer;background-color:transparent}.sort-toggle[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{color:var(--color-primary-700)}.sort-toggle[_ngcontent-%COMP%] .sort-label[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * .5);font-size:10px;color:var(--color-primary-600);font-weight:400}.toggle-search-filter-row[_ngcontent-%COMP%]{position:absolute;top:-12px;left:4px}@media screen and (min-width: 1280px){.toggle-search-filter-row[_ngcontent-%COMP%]{left:8px}}.toggle-search-filter-row.active[_ngcontent-%COMP%]{background-color:var(--color-primary-700);color:var(--color-primary-100);border-color:var(--color-primary-700)}th.filter-row[_ngcontent-%COMP%]{position:relative;font-size:var(--font-size-base);font-weight:400;background-color:var(--color-weight-100);box-shadow:var(--data-table-filter-box-shadow);border-left-width:0;border-right-width:0;text-align:initial;padding:0}th.filter-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100%}th.filter-row.active[_ngcontent-%COMP%]{border-bottom:1px solid var(--color-table-header-border)}th.filter-row[_ngcontent-%COMP%] .filters[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 1);display:flex;flex-wrap:wrap;gap:calc(var(--space-unit) * .5)}.filter-row-wrapper[_ngcontent-%COMP%]{padding:calc(var(--space-unit) * 4);padding-inline-start:0;max-height:150px;transition:max-height .2s,padding .2s,opacity .2s}.filter-row-wrapper.hidden[_ngcontent-%COMP%]{max-height:0px;padding-top:0;padding-bottom:0;overflow:hidden;opacity:0}.cell-link[_ngcontent-%COMP%]{display:block;width:100%;height:100%}td.active[_ngcontent-%COMP%]{background-color:var(--color-table-row-active-bg)}.cell-content[_ngcontent-%COMP%]{display:flex;align-items:center;line-height:var(--font-size-sm);color:var(--color-weight-700)}.cell-content.left[_ngcontent-%COMP%]{justify-content:flex-start}.cell-content.center[_ngcontent-%COMP%]{justify-content:center}.cell-content.right[_ngcontent-%COMP%]{justify-content:flex-end}.selection-col[_ngcontent-%COMP%]{width:calc(var(--space-unit) * 8)}vdr-empty-placeholder[_ngcontent-%COMP%]{width:100%}.table-footer[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-top:var(--space-unit);margin-inline-start:var(--surface-margin-left);margin-inline-end:var(--space-unit)}.total-items-count[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}@container (max-width: 500px){.total-items-count[_ngcontent-%COMP%]{display:none}}","[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}"],changeDetection:0})}}function Cr(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.id," ")}}function vr(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.createdAt,"short")," ")}}function yr(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.updatedAt,"short")," ")}}function Ir(r,n){if(1&r&&(e.nrm(0,"img",16),e.nI1(1,"assetPreview")),2&r){const t=n.ngIf;e.Y8G("src",e.i5U(1,1,t,"tiny"),e.B4B)}}function Tr(r,n){1&r&&(e.j41(0,"div",17),e.nrm(1,"clr-icon",18),e.k0s())}function Or(r,n){if(1&r&&(e.j41(0,"div",14),e.DNE(1,Ir,2,4,"img",15)(2,Tr,2,0,"ng-template",null,0,e.C5r),e.k0s()),2&r){const t=n.item,i=e.sdS(3);e.R7$(),e.Y8G("ngIf",t.featuredAsset)("ngIfElse",i)}}function Fr(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.name," ")}}function Rr(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.sku," ")}}function Mr(r,n){if(1&r&&(e.j41(0,"div",19),e.EFF(1),e.nI1(2,"localeCurrency"),e.j41(3,"div",20),e.nI1(4,"translate"),e.EFF(5),e.nI1(6,"localeCurrency"),e.k0s()()),2&r){const t=n.item,i=e.XpG();e.R7$(),e.SpI(" ",e.i5U(2,3,t.unitPriceWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(4,6,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(6,8,t.unitPrice,i.order.currencyCode)," ")}}function Sr(r,n){if(1&r&&(e.j41(0,"div",26),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG(2).item;e.Y8G("title",e.bMT(1,2,"order.original-quantity-at-checkout")),e.R7$(2),e.SpI(" ",t.orderPlacedQuantity," ")}}function xr(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",24),e.DNE(2,Sr,3,4,"div",25),e.j41(3,"div"),e.EFF(4),e.k0s()(),e.bVm()),2&r){const t=e.XpG().item;e.R7$(2),e.Y8G("ngIf",t.orderPlacedQuantity&&t.quantity!==t.orderPlacedQuantity),e.R7$(2),e.JRh(t.quantity)}}function Gr(r,n){if(1&r){const t=e.RV6();e.j41(0,"div",24)(1,"input",27,2),e.bIt("blur",function(){e.eBV(t);const o=e.sdS(2),a=e.XpG().item,m=e.XpG();return e.Njj(m.draftInputBlur(a,o.valueAsNumber))}),e.k0s(),e.j41(3,"button",28),e.bIt("click",function(){e.eBV(t);const o=e.XpG().item,a=e.XpG();return e.Njj(a.remove.emit({lineId:o.id}))}),e.nrm(4,"clr-icon",29),e.k0s()()}if(2&r){const t=e.XpG().item;e.R7$(),e.Y8G("value",t.quantity)}}function kr(r,n){if(1&r&&(e.DNE(0,xr,5,2,"ng-container",21)(1,Gr,5,1,"ng-template",null,1,e.C5r),e.nrm(3,"vdr-line-refunds",22)(4,"vdr-line-fulfillment",23)),2&r){const t=n.item,i=e.sdS(2),o=e.XpG();e.Y8G("ngIf",!o.isDraft)("ngIfElse",i),e.R7$(3),e.Y8G("line",t)("payments",o.order.payments),e.R7$(),e.Y8G("line",t)("orderState",o.order.state)("allOrderFulfillments",o.order.fulfillments)}}function Dr(r,n){if(1&r&&e.nrm(0,"vdr-dt2-custom-field-column",30),2&r){const t=n.$implicit;e.Y8G("customField",t)}}function $r(r,n){if(1&r&&(e.j41(0,"div",34)(1,"a",35),e.EFF(2),e.k0s(),e.j41(3,"div",36),e.EFF(4),e.nI1(5,"localeCurrency"),e.j41(6,"div",20),e.nI1(7,"translate"),e.EFF(8),e.nI1(9,"localeCurrency"),e.k0s()()()),2&r){const t=n.$implicit,i=e.XpG(4);e.R7$(),e.Y8G("routerLink",i.getPromotionLink(t)),e.R7$(),e.JRh(t.description),e.R7$(2),e.SpI(" ",e.i5U(5,5,t.amountWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(7,8,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(9,10,t.amount,i.order.currencyCode)," ")}}function jr(r,n){if(1&r&&(e.j41(0,"vdr-dropdown")(1,"div",32),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"vdr-dropdown-menu"),e.DNE(5,$r,10,13,"div",33),e.k0s()()),2&r){const t=e.XpG().ngIf;e.R7$(2),e.SpI(" ",e.bMT(3,2,"order.promotions-applied")," "),e.R7$(3),e.Y8G("ngForOf",t)}}function Er(r,n){if(1&r&&(e.qex(0),e.DNE(1,jr,6,4,"vdr-dropdown",31),e.bVm()),2&r){const t=n.ngIf;e.R7$(),e.Y8G("ngIf",t.length)}}function Pr(r,n){if(1&r&&(e.j41(0,"div",19),e.EFF(1),e.nI1(2,"localeCurrency"),e.j41(3,"div",20),e.nI1(4,"translate"),e.EFF(5),e.nI1(6,"localeCurrency"),e.k0s()(),e.DNE(7,Er,2,1,"ng-container",31)),2&r){const t=n.item,i=e.XpG();e.R7$(),e.SpI(" ",e.i5U(2,4,t.linePriceWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("title",e.bMT(4,7,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(6,9,t.linePrice,i.order.currencyCode)," "),e.R7$(2),e.Y8G("ngIf",i.getLineDiscounts(t))}}class A{constructor(){this.isDraft=!1,this.adjust=new e.bkB,this.remove=new e.bkB,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.mni.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new l.J3({}),i=this.orderLineCustomFields.map(o=>{const a=n.customFields[o.name];return t.addControl(o.name,new l.hs(a)),{config:o,formGroup:t,value:a}}).filter(o=>!!this.orderLineCustomFieldsVisible||null!=o.value);this.customFieldsForLine[n.id]=i}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const i=t.adjustmentSource.split(":")[1],o=n.promotions.find(a=>a.id===i);if(o)return o.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static{this.\u0275fac=function(t){return new(t||A)}}static{this.\u0275cmp=e.VBU({type:A,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields",isDraft:"isDraft"},outputs:{adjust:"adjust",remove:"remove"},decls:29,vars:36,consts:[["imagePlaceholder",""],["draft",""],["qtyInput",""],["id","order-detail-list",3,"items","order"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading"],["id","product-sku",3,"heading","optional"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"customField",4,"ngFor","ngForOf"],["id","total",3,"heading","optional"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"unit-price"],[1,"net-price",3,"title"],[4,"ngIf","ngIfElse"],[3,"line","payments"],[3,"line","orderState","allOrderFulfillments"],[1,"flex"],["class","order-placed-quantity",3,"title",4,"ngIf"],[1,"order-placed-quantity",3,"title"],["type","number","min","0",1,"draft-qty",3,"blur","value"],[1,"icon-button",3,"click"],["shape","trash"],[3,"customField"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"]],template:function(t,i){1&t&&(e.j41(0,"vdr-order-data-table",3)(1,"vdr-dt2-column",4),e.nI1(2,"translate"),e.DNE(3,Cr,1,1,"ng-template"),e.k0s(),e.j41(4,"vdr-dt2-column",5),e.nI1(5,"translate"),e.DNE(6,vr,2,4,"ng-template"),e.k0s(),e.j41(7,"vdr-dt2-column",6),e.nI1(8,"translate"),e.DNE(9,yr,2,4,"ng-template"),e.k0s(),e.j41(10,"vdr-dt2-column",7),e.nI1(11,"translate"),e.DNE(12,Or,4,2,"ng-template"),e.k0s(),e.j41(13,"vdr-dt2-column",8),e.nI1(14,"translate"),e.DNE(15,Fr,1,1,"ng-template"),e.k0s(),e.j41(16,"vdr-dt2-column",9),e.nI1(17,"translate"),e.DNE(18,Rr,1,1,"ng-template"),e.k0s(),e.j41(19,"vdr-dt2-column",10),e.nI1(20,"translate"),e.DNE(21,Mr,7,11,"ng-template"),e.k0s(),e.j41(22,"vdr-dt2-column",11),e.nI1(23,"translate"),e.DNE(24,kr,5,7,"ng-template"),e.k0s(),e.DNE(25,Dr,1,1,"vdr-dt2-custom-field-column",12),e.j41(26,"vdr-order-total-column",13),e.nI1(27,"translate"),e.DNE(28,Pr,8,12,"ng-template"),e.k0s()()),2&t&&(e.Y8G("items",i.order.lines)("order",i.order),e.R7$(),e.Y8G("heading",e.bMT(2,18,"common.id"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(5,20,"common.created-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(8,22,"common.updated-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(11,24,"common.image")),e.R7$(3),e.Y8G("heading",e.bMT(14,26,"order.product-name")),e.R7$(3),e.Y8G("heading",e.bMT(17,28,"order.product-sku"))("optional",!1),e.R7$(3),e.Y8G("heading",e.bMT(20,30,"order.unit-price")),e.R7$(3),e.Y8G("heading",e.bMT(23,32,"order.quantity"))("optional",!1),e.R7$(3),e.Y8G("ngForOf",i.orderLineCustomFields),e.R7$(),e.Y8G("heading",e.bMT(27,34,"order.total"))("optional",!1))},dependencies:[u.U4n,c.Sq,c.bT,M.Wk,h.V,W.P,Q.q,z.j,Ne.Y,mt.T,Z,w,K,V,_.D9,L.H,Y.P,g.u],styles:["[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-inline-start:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}}var Je=s(5529),ut=s(9755);function Nr(r,n){if(1&r&&(e.j41(0,"div",16),e.nrm(1,"vdr-custom-field-control",17),e.k0s()),2&r){const t=n.$implicit,i=e.XpG(3);e.R7$(),e.Y8G("compact",!0)("readonly",!1)("customField",t)("customFieldsFormGroup",i.customFieldsFormGroup)}}function Yr(r,n){if(1&r&&(e.qex(0),e.DNE(1,Nr,2,4,"div",15),e.bVm()),2&r){const t=e.XpG(2);e.R7$(),e.Y8G("ngForOf",t.orderLineCustomFields)}}function wr(r,n){if(1&r){const t=e.RV6();e.j41(0,"div",1)(1,"div",5),e.nrm(2,"img",6),e.nI1(3,"assetPreview"),e.j41(4,"div",7)(5,"div"),e.EFF(6),e.k0s(),e.j41(7,"div",8),e.EFF(8),e.k0s()(),e.j41(9,"div",9)(10,"div",8),e.EFF(11),e.nI1(12,"translate"),e.k0s(),e.j41(13,"div",8),e.EFF(14),e.nI1(15,"translate"),e.k0s()(),e.nrm(16,"div",10),e.j41(17,"div",7)(18,"div"),e.EFF(19),e.nI1(20,"localeCurrency"),e.k0s(),e.j41(21,"div",11),e.nI1(22,"translate"),e.EFF(23),e.nI1(24,"localeCurrency"),e.k0s()(),e.j41(25,"div")(26,"input",12),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.quantity,o)||(a.quantity=o),e.Njj(o)}),e.k0s()(),e.j41(27,"button",13),e.bIt("click",function(){const o=e.eBV(t).ngIf,a=e.XpG();return e.Njj(a.addItemClick(o))}),e.EFF(28),e.nI1(29,"translate"),e.k0s()(),e.DNE(30,Yr,2,1,"ng-container",14),e.k0s()}if(2&r){const t=n.ngIf,i=e.XpG();e.R7$(2),e.Y8G("src",e.i5U(3,15,t.featuredAsset||t.product.featuredAsset,32),e.B4B),e.R7$(4),e.JRh(null==t?null:t.name),e.R7$(2),e.JRh(null==t?null:t.sku),e.R7$(3),e.Lme(" ",e.bMT(12,18,"catalog.stock-on-hand"),": ",t.stockOnHand," "),e.R7$(3),e.Lme(" ",e.bMT(15,20,"catalog.stock-allocated"),": ",t.stockAllocated," "),e.R7$(5),e.JRh(e.i5U(20,22,null==t?null:t.priceWithTax,i.currencyCode)),e.R7$(2),e.Y8G("title",e.bMT(22,25,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(24,27,null==t?null:t.price,i.currencyCode)," "),e.R7$(3),e.Y8G("disabled",!t),e.R50("ngModel",i.quantity),e.R7$(),e.Y8G("disabled",!t),e.R7$(),e.SpI(" ",e.bMT(29,30,"order.add-item-to-order")," "),e.R7$(2),e.Y8G("ngIf",i.orderLineCustomFields.length)}}class _e{constructor(n){this.dataService=n,this.addItem=new e.bkB,this.customFieldsFormGroup=new l.J3({}),this.selectedVariantId$=new B.B,this.quantity=1}ngOnInit(){this.selectedVariant$=this.selectedVariantId$.pipe((0,f.n)(n=>n?this.dataService.product.getProductVariant(n).mapSingle(({productVariant:t})=>t):[void 0]));for(const n of this.orderLineCustomFields)this.customFieldsFormGroup.addControl(n.name,new l.hs(""))}addItemClick(n){n&&(this.addItem.emit({productVariantId:n.id,quantity:this.quantity,customFields:this.orderLineCustomFields.length?this.customFieldsFormGroup.value:void 0}),this.selectedVariantId$.next(void 0),this.customFieldsFormGroup.reset())}static{this.\u0275fac=function(t){return new(t||_e)(e.rXU(d.uSP))}}static{this.\u0275cmp=e.VBU({type:_e,selectors:[["vdr-draft-order-variant-selector"]],inputs:{currencyCode:"currencyCode",orderLineCustomFields:"orderLineCustomFields"},outputs:{addItem:"addItem"},decls:8,vars:6,consts:[[1,"card"],[1,"card-block"],[1,"card-title"],[3,"productSelected"],["class","card-block",4,"ngIf"],[1,"variant-details"],[1,"mr-2",3,"src"],[1,"details"],[1,"small"],[1,"details","ml-4"],[1,"flex-spacer"],[1,"small",3,"title"],["type","number","min","0",3,"ngModelChange","disabled","ngModel"],[1,"btn","btn-small","btn-primary",3,"click","disabled"],[4,"ngIf"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"]],template:function(t,i){1&t&&(e.j41(0,"div",0)(1,"div",1)(2,"h4",2),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.j41(5,"vdr-product-variant-selector",3),e.bIt("productSelected",function(a){return i.selectedVariantId$.next(a.productVariantId)}),e.k0s()(),e.DNE(6,wr,31,32,"div",4),e.nI1(7,"async"),e.k0s()),2&t&&(e.R7$(3),e.JRh(e.bMT(4,2,"order.add-item-to-order")),e.R7$(3),e.Y8G("ngIf",e.bMT(7,4,i.selectedVariant$)))},dependencies:[c.Sq,c.bT,l.me,l.Q0,l.BC,l.VZ,l.vS,Je.C,h.V,ut.h,c.Jj,_.D9,L.H,g.u],styles:[".variant-details[_ngcontent-%COMP%]{display:flex;align-items:center}.variant-details[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img);width:32px;height:32px}.variant-details[_ngcontent-%COMP%] .details[_ngcontent-%COMP%]{font-size:.65rem;line-height:.7rem}.variant-details[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:48px;margin:0 6px}.variant-details[_ngcontent-%COMP%] .small[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}"],changeDetection:0})}}function Vr(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e.nrm(3,"vdr-order-state-label",2),e.k0s()(),e.j41(4,"vdr-ab-right"),e.nrm(5,"vdr-action-bar-items",3),e.j41(6,"button",4),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.completeOrder())}),e.nrm(7,"clr-icon",5),e.EFF(8),e.nI1(9,"translate"),e.k0s(),e.j41(10,"vdr-action-bar-dropdown-menu",6)(11,"button",7),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.deleteOrder())}),e.nrm(12,"clr-icon",8),e.EFF(13),e.nI1(14,"translate"),e.k0s()()()()}if(2&r){const t=n.ngIf;e.R7$(3),e.Y8G("state",t.state),e.R7$(3),e.Y8G("disabled",!t.customer||!t.lines.length||!t.shippingLines.length),e.R7$(2),e.SpI(" ",e.bMT(9,5,"order.complete-draft-order")," "),e.R7$(2),e.Y8G("alwaysShow",!0),e.R7$(3),e.SpI(" ",e.bMT(14,7,"order.delete-draft-order")," ")}}function Ar(r,n){1&r&&e.nrm(0,"clr-icon",24)}function Xr(r,n){1&r&&e.nrm(0,"clr-icon",25)}function Lr(r,n){if(1&r&&e.DNE(0,Ar,1,0,"clr-icon",22)(1,Xr,1,0,"clr-icon",23),2&r){const t=e.XpG().ngIf;e.Y8G("ngIf",!t.customer),e.R7$(),e.Y8G("ngIf",t.customer)}}function Br(r,n){if(1&r&&e.nrm(0,"vdr-customer-label",26),2&r){const t=e.XpG().ngIf;e.Y8G("customer",t.customer)}}function Ur(r,n){1&r&&e.nrm(0,"clr-icon",24)}function Jr(r,n){1&r&&e.nrm(0,"clr-icon",25)}function Hr(r,n){if(1&r&&e.DNE(0,Ur,1,0,"clr-icon",22)(1,Jr,1,0,"clr-icon",23),2&r){const t=e.XpG().ngIf;e.Y8G("ngIf",!t.billingAddress.streetLine1),e.R7$(),e.Y8G("ngIf",t.billingAddress.streetLine1)}}function qr(r,n){if(1&r&&e.nrm(0,"vdr-formatted-address",27),2&r){const t=e.XpG().ngIf;e.Y8G("address",t.billingAddress)}}function Wr(r,n){1&r&&e.nrm(0,"clr-icon",24)}function Qr(r,n){1&r&&e.nrm(0,"clr-icon",25)}function zr(r,n){if(1&r&&e.DNE(0,Wr,1,0,"clr-icon",22)(1,Qr,1,0,"clr-icon",23),2&r){const t=e.XpG().ngIf;e.Y8G("ngIf",!t.shippingAddress.streetLine1||!t.shippingLines.length),e.R7$(),e.Y8G("ngIf",t.shippingAddress.streetLine1&&t.shippingLines.length)}}function Zr(r,n){if(1&r&&e.nrm(0,"vdr-formatted-address",27),2&r){const t=e.XpG().ngIf;e.Y8G("address",t.shippingAddress)}}function Kr(r,n){if(1&r&&(e.j41(0,"div"),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.SpI(" ",t.shippingMethod.name," ")}}function ei(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",12),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.displayCouponCodeInput=!o.displayCouponCodeInput)}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.set-coupon-codes")," "))}function ti(r,n){if(1&r){const t=e.RV6();e.j41(0,"div")(1,"label"),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"vdr-coupon-code-selector",28),e.bIt("addCouponCode",function(o){e.eBV(t);const a=e.XpG(2);return e.Njj(a.applyCouponCode(o))})("removeCouponCode",function(o){e.eBV(t);const a=e.XpG(2);return e.Njj(a.removeCouponCode(o))}),e.k0s()()}if(2&r){const t=e.XpG().ngIf;e.R7$(2),e.JRh(e.bMT(3,2,"order.set-coupon-codes")),e.R7$(2),e.Y8G("couponCodes",t.couponCodes)}}function ni(r,n){if(1&r&&e.nrm(0,"vdr-page-entity-info",29),2&r){const t=n.ngIf;e.Y8G("entity",t)}}function ri(r,n){if(1&r&&(e.j41(0,"tr")(1,"td"),e.EFF(2),e.k0s(),e.j41(3,"td"),e.EFF(4),e.nI1(5,"percent"),e.k0s(),e.j41(6,"td"),e.EFF(7),e.nI1(8,"localeCurrency"),e.k0s(),e.j41(9,"td"),e.EFF(10),e.nI1(11,"localeCurrency"),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG(2).ngIf;e.R7$(2),e.JRh(t.description),e.R7$(2),e.JRh(e.bMT(5,4,t.taxRate/100)),e.R7$(3),e.JRh(e.i5U(8,6,t.taxBase,i.currencyCode)),e.R7$(3),e.JRh(e.i5U(11,9,t.taxTotal,i.currencyCode))}}function ii(r,n){if(1&r&&(e.qex(0),e.j41(1,"table",30)(2,"thead")(3,"tr")(4,"th"),e.EFF(5),e.nI1(6,"translate"),e.k0s(),e.j41(7,"th"),e.EFF(8),e.nI1(9,"translate"),e.k0s(),e.j41(10,"th"),e.EFF(11),e.nI1(12,"translate"),e.k0s(),e.j41(13,"th"),e.EFF(14),e.nI1(15,"translate"),e.k0s()()(),e.j41(16,"tbody"),e.DNE(17,ri,12,12,"tr",15),e.k0s()(),e.bVm()),2&r){const t=e.XpG().ngIf;e.R7$(5),e.JRh(e.bMT(6,5,"common.description")),e.R7$(3),e.JRh(e.bMT(9,7,"order.tax-rate")),e.R7$(3),e.JRh(e.bMT(12,9,"order.tax-base")),e.R7$(3),e.JRh(e.bMT(15,11,"order.tax-total")),e.R7$(3),e.Y8G("ngForOf",t.taxSummary)}}function oi(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",9),e.nI1(3,"translate"),e.DNE(4,Lr,2,2,"ng-template",10)(5,Br,1,1,"vdr-customer-label",11),e.j41(6,"button",12),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.setCustomer())}),e.EFF(7),e.nI1(8,"translate"),e.k0s()(),e.j41(9,"vdr-card",9),e.nI1(10,"translate"),e.DNE(11,Hr,2,2,"ng-template",10)(12,qr,1,1,"vdr-formatted-address",13),e.j41(13,"button",12),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.setBillingAddress())}),e.EFF(14),e.nI1(15,"translate"),e.k0s()(),e.j41(16,"vdr-card",9),e.nI1(17,"translate"),e.DNE(18,zr,2,2,"ng-template",10)(19,Zr,1,1,"vdr-formatted-address",13),e.j41(20,"button",14),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.setShippingAddress())}),e.EFF(21),e.nI1(22,"translate"),e.k0s(),e.DNE(23,Kr,2,1,"div",15),e.j41(24,"button",12),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.setShippingMethod())}),e.EFF(25),e.nI1(26,"translate"),e.k0s()(),e.j41(27,"vdr-card"),e.DNE(28,ei,3,3,"button",16)(29,ti,5,4,"div",0),e.k0s(),e.j41(30,"vdr-card"),e.DNE(31,ni,1,1,"vdr-page-entity-info",17),e.nI1(32,"async"),e.k0s()(),e.j41(33,"vdr-page-block")(34,"vdr-card")(35,"vdr-draft-order-variant-selector",18),e.bIt("addItem",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.addItemToOrder(o))}),e.k0s(),e.j41(36,"vdr-order-table",19),e.bIt("adjust",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.adjustOrderLine(o))})("remove",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.removeOrderLine(o))}),e.k0s()(),e.j41(37,"vdr-card",9),e.nI1(38,"translate"),e.DNE(39,ii,18,13,"ng-container",0),e.k0s(),e.nrm(40,"vdr-custom-detail-component-host",20),e.j41(41,"vdr-order-custom-fields-card",21),e.bIt("updateClick",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.updateCustomFields(o))}),e.k0s()()()}if(2&r){const t=n.ngIf,i=e.XpG();e.R7$(2),e.Y8G("title",e.bMT(3,25,"order.customer")),e.R7$(3),e.Y8G("ngIf",t.customer),e.R7$(2),e.SpI(" ",e.bMT(8,27,"order.set-customer-for-order")," "),e.R7$(2),e.Y8G("title",e.bMT(10,29,"order.billing-address")),e.R7$(3),e.Y8G("ngIf",t.billingAddress),e.R7$(2),e.SpI(" ",e.bMT(15,31,"order.set-billing-address")," "),e.R7$(2),e.Y8G("title",e.bMT(17,33,"order.shipping")),e.R7$(3),e.Y8G("ngIf",t.shippingAddress),e.R7$(2),e.SpI(" ",e.bMT(22,35,"order.set-shipping-address")," "),e.R7$(2),e.Y8G("ngForOf",t.shippingLines),e.R7$(2),e.SpI(" ",e.bMT(26,37,"order.set-shipping-method")," "),e.R7$(3),e.Y8G("ngIf",0===t.couponCodes.length&&!i.displayCouponCodeInput),e.R7$(),e.Y8G("ngIf",t.couponCodes.length||i.displayCouponCodeInput),e.R7$(2),e.Y8G("ngIf",e.bMT(32,39,i.entity$)),e.R7$(4),e.Y8G("orderLineCustomFields",i.orderLineCustomFields)("currencyCode",t.currencyCode),e.R7$(),e.Y8G("order",t)("orderLineCustomFields",i.orderLineCustomFields)("isDraft",!0),e.R7$(),e.Y8G("title",e.bMT(38,41,"order.tax-summary")),e.R7$(2),e.Y8G("ngIf",t.taxSummary.length),e.R7$(),e.Y8G("entity$",i.entity$)("detailForm",i.detailForm),e.R7$(),e.Y8G("customFieldsConfig",i.customFields)("customFieldValues",t.customFields)}}class fe extends d.wi7{constructor(n,t,i,o,a){super(),this.changeDetector=n,this.dataService=t,this.notificationService=i,this.modalService=o,this.orderTransitionService=a,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.J3({}),this.fetchHistory=new B.B,this.displayCouponCodeInput=!1}ngOnInit(){this.init(),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.eligibleShippingMethods$=this.entity$.pipe((0,f.n)(n=>this.dataService.order.getDraftOrderEligibleShippingMethods(n.id).mapSingle(({eligibleShippingMethodsForDraftOrder:t})=>t)))}ngOnDestroy(){this.destroy()}addItemToOrder(n){this.dataService.order.addItemToDraftOrder(this.id,n).subscribe(t=>{"Order"!==t.addItemToDraftOrder.__typename&&this.notificationService.error(t.addItemToDraftOrder.message)})}adjustOrderLine(n){this.dataService.order.adjustDraftOrderLine(this.id,{orderLineId:n.lineId,quantity:n.quantity}).subscribe(t=>{"Order"!==t.adjustDraftOrderLine.__typename&&this.notificationService.error(t.adjustDraftOrderLine.message)})}removeOrderLine(n){this.dataService.order.removeDraftOrderLine(this.id,n.lineId).subscribe(t=>{"Order"!==t.removeDraftOrderLine.__typename&&this.notificationService.error(t.removeDraftOrderLine.message)})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}setCustomer(){this.modalService.fromComponent(H).subscribe(n=>{if(this.hasId(n))this.dataService.order.setCustomerForDraftOrder(this.id,{customerId:n.id}).subscribe();else if(n){const{note:t,...i}=n;this.dataService.order.setCustomerForDraftOrder(this.id,{input:i}).subscribe()}})}setShippingAddress(){this.entity$.pipe((0,D.s)(1),(0,f.n)(n=>this.modalService.fromComponent(J,{locals:{customerId:n.customer?.id,currentAddress:n.shippingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingAddress(this.id,n).subscribe()})}setBillingAddress(){this.entity$.pipe((0,D.s)(1),(0,f.n)(n=>this.modalService.fromComponent(J,{locals:{customerId:n.customer?.id,currentAddress:n.billingAddress??void 0}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderBillingAddress(this.id,n).subscribe()})}applyCouponCode(n){this.dataService.order.applyCouponCodeToDraftOrder(this.id,n).subscribe()}removeCouponCode(n){this.dataService.order.removeCouponCodeFromDraftOrder(this.id,n).subscribe()}setShippingMethod(){(0,Yt.z)(this.entity$,this.eligibleShippingMethods$).pipe((0,D.s)(1),(0,f.n)(([n,t])=>this.modalService.fromComponent(q,{locals:{eligibleShippingMethods:t,currencyCode:n.currencyCode,currentSelectionId:n.shippingLines?.[0]?.shippingMethod.id}}))).subscribe(n=>{n&&this.dataService.order.setDraftOrderShippingMethod(this.id,n).subscribe()})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe()}deleteOrder(){this.dataService.order.deleteDraftOrder(this.id).subscribe(({deleteDraftOrder:n})=>{n.result===d.syg.DELETED?(this.notificationService.success((0,p.x)("common.notify-delete-success"),{entity:"Order"}),this.router.navigate(["/orders"])):n.message&&this.notificationService.error(n.message)})}completeOrder(){this.dataService.order.transitionToState(this.id,"ArrangingPayment").subscribe(({transitionOrderToState:n})=>{"Order"===n?.__typename?this.router.navigate(["/orders",this.id]):"OrderStateTransitionError"===n?.__typename&&this.notificationService.error(n.transitionError)})}hasId(n){return"object"==typeof n&&!!n.id}setFormValues(n){}static{this.\u0275fac=function(t){return new(t||fe)(e.rXU(e.gRc),e.rXU(d.uSP),e.rXU(d.JEu),e.rXU(d.Bg8),e.rXU(E))}}static{this.\u0275cmp=e.VBU({type:fe,selectors:[["vdr-draft-order-detail"]],features:[e.Vt3],decls:5,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"state"],["locationId","draft-order-detail"],[1,"btn","btn-primary",3,"click","disabled"],["shape","check"],["locationId","draft-order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click"],["shape","trash",1,"is-danger"],[3,"title"],["vdrCardControls",""],["class","block mb-2",3,"customer",4,"ngIf"],[1,"button-small",3,"click"],["class","block mb-2",3,"address",4,"ngIf"],[1,"button-small","mr-2",3,"click"],[4,"ngFor","ngForOf"],["class","button-small",3,"click",4,"ngIf"],[3,"entity",4,"ngIf"],[3,"addItem","orderLineCustomFields","currencyCode"],[3,"adjust","remove","order","orderLineCustomFields","isDraft"],["locationId","draft-order-detail",3,"entity$","detailForm"],[3,"updateClick","customFieldsConfig","customFieldValues"],["shape","unknown-status","class","is-warning",4,"ngIf"],["shape","check","class","is-success",4,"ngIf"],["shape","unknown-status",1,"is-warning"],["shape","check",1,"is-success"],[1,"block","mb-2",3,"customer"],[1,"block","mb-2",3,"address"],[3,"addCouponCode","removeCouponCode","couponCodes"],[3,"entity"],[1,"table"]],template:function(t,i){1&t&&(e.j41(0,"vdr-page-block"),e.DNE(1,Vr,15,9,"vdr-action-bar",0),e.nI1(2,"async"),e.k0s(),e.DNE(3,oi,42,43,"vdr-page-detail-layout",0),e.nI1(4,"async")),2&t&&(e.R7$(),e.Y8G("ngIf",e.bMT(2,2,i.entity$)),e.R7$(2),e.Y8G("ngIf",e.bMT(4,4,i.entity$)))},dependencies:[u.U4n,u.aZZ,c.Sq,c.bT,I.nG,I.wL,I.TX,Ae.l,Xe.E,pe.M,Ee.F,se.W,Le.T,dt.L,Pe.e,st.E,Be.c,Ue.e,T.i,T.a,ue,A,_e,U,c.Jj,c.m1,_.D9,g.u],changeDetection:0})}}var ai=s(5652);function li(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.fulfill-order"))}function di(r,n){if(1&r&&(e.nrm(0,"img",17),e.nI1(1,"assetPreview")),2&r){const t=e.XpG().$implicit;e.Y8G("src",e.i5U(1,1,t.featuredAsset,"tiny"),e.B4B)}}function si(r,n){if(1&r){const t=e.RV6();e.j41(0,"input",18),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG().$implicit,m=e.XpG();return e.DH7(m.fulfillmentQuantities[a.id].fulfillCount,o)||(m.fulfillmentQuantities[a.id].fulfillCount=o),e.Njj(o)}),e.k0s()}if(2&r){const t=e.XpG().$implicit,i=e.XpG();e.Y8G("disabled",0===i.getUnfulfilledCount(t)),e.R50("ngModel",i.fulfillmentQuantities[t.id].fulfillCount),e.Y8G("max",i.fulfillmentQuantities[t.id].max)}}function ci(r,n){if(1&r&&(e.j41(0,"tr",9)(1,"td",10),e.DNE(2,di,2,4,"img",11),e.k0s(),e.j41(3,"td",12),e.EFF(4),e.k0s(),e.j41(5,"td",13),e.EFF(6),e.k0s(),e.j41(7,"td",14),e.EFF(8),e.k0s(),e.j41(9,"td",14),e.EFF(10),e.k0s(),e.j41(11,"td",15),e.DNE(12,si,1,3,"input",16),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG();e.AVh("ignore",0===i.getUnfulfilledCount(t)),e.R7$(2),e.Y8G("ngIf",t.featuredAsset),e.R7$(2),e.JRh(t.productVariant.name),e.R7$(2),e.JRh(t.productVariant.sku),e.R7$(2),e.JRh(i.getUnfulfilledCount(t)),e.R7$(2),e.JRh(t.productVariant.stockOnHand),e.R7$(2),e.Y8G("ngIf",i.fulfillmentQuantities[t.id])}}function mi(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",19),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",20),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"common.cancel")),e.R7$(2),e.Y8G("disabled",!t.canSubmit()),e.R7$(),e.SpI(" ",e.bMT(5,5,"order.create-fulfillment")," ")}}class ge{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new l.hs,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,i)=>{const o=this.getFulfillableCount(i,n.trackInventory);return{...t,[i.id]:{fulfillCount:o,max:o}}},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>t.code===this.order.shippingLines[0]?.shippingMethod?.fulfillmentHandlerCode)||n[0],this.fulfillmentHandler=(0,d.N9n)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:i,stockOnHand:o}=n.productVariant,a=i===d.uQg.INHERIT?t:i===d.uQg.TRUE,m=this.getUnfulfilledCount(n);return a?Math.min(m,o):m}getUnfulfilledCount(n){const t=this.order.fulfillments?.filter(i=>"Cancelled"!==i.state).map(i=>i.lines).flat().filter(i=>i.orderLineId===n.id).reduce((i,o)=>i+o.quantity,0)??0;return n.quantity-t}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((o,{fulfillCount:a})=>o+a,0),t=Object.values(this.fulfillmentQuantities).every(({fulfillCount:o,max:a})=>o<=a);return(0,d.yav)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n&&t}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:i}])=>({orderLineId:t,quantity:i}));this.resolveWith({lines:n,handler:(0,d.GfA)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}static{this.\u0275fac=function(t){return new(t||ge)(e.rXU(d.uSP),e.rXU(e.gRc))}}static{this.\u0275cmp=e.VBU({type:ge,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"ngModelChange","disabled","ngModel","max"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,li,2,3,"ng-template",0),e.j41(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e.nrm(6,"th"),e.j41(7,"th"),e.EFF(8),e.nI1(9,"translate"),e.k0s(),e.j41(10,"th"),e.EFF(11),e.nI1(12,"translate"),e.k0s(),e.j41(13,"th"),e.EFF(14),e.nI1(15,"translate"),e.k0s(),e.j41(16,"th"),e.EFF(17),e.nI1(18,"translate"),e.k0s(),e.j41(19,"th"),e.EFF(20),e.nI1(21,"translate"),e.k0s()()(),e.DNE(22,ci,13,8,"tr",4),e.k0s()(),e.j41(23,"div",5),e.nrm(24,"vdr-formatted-address",6),e.j41(25,"h6"),e.EFF(26),e.nI1(27,"translate"),e.k0s(),e.EFF(28),e.j41(29,"strong"),e.EFF(30),e.nI1(31,"localeCurrency"),e.k0s(),e.nrm(32,"vdr-configurable-input",7),e.k0s()(),e.DNE(33,mi,6,7,"ng-template",8)),2&t&&(e.R7$(8),e.JRh(e.bMT(9,14,"order.product-name")),e.R7$(3),e.JRh(e.bMT(12,16,"order.product-sku")),e.R7$(3),e.JRh(e.bMT(15,18,"order.unfulfilled")),e.R7$(3),e.JRh(e.bMT(18,20,"catalog.stock-on-hand")),e.R7$(3),e.JRh(e.bMT(21,22,"order.fulfill")),e.R7$(2),e.Y8G("ngForOf",i.order.lines),e.R7$(2),e.Y8G("address",i.order.shippingAddress),e.R7$(2),e.JRh(e.bMT(27,24,"order.shipping-method")),e.R7$(2),e.SpI(" ",null==i.order.shippingLines[0]||null==i.order.shippingLines[0].shippingMethod?null:i.order.shippingLines[0].shippingMethod.name," "),e.R7$(2),e.JRh(e.i5U(31,26,i.order.shipping,i.order.currencyCode)),e.R7$(2),e.Y8G("operationDefinition",i.fulfillmentHandlerDef)("operation",i.fulfillmentHandler)("formControl",i.fulfillmentHandlerControl)("removable",!1))},dependencies:[c.Sq,c.bT,l.me,l.Q0,l.BC,l.VZ,l.zX,l.vS,l.l_,ai.h,h.V,F.b,y.M,se.W,_.D9,L.H,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}[_nghost-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}[_nghost-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}[_nghost-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}[_nghost-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}[_nghost-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}[_nghost-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}[_nghost-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}[_nghost-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}[_nghost-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}[_nghost-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}[_nghost-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}[_nghost-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-inline-start:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0})}}function pi(r,n){if(1&r&&(e.j41(0,"div",5),e.EFF(1),e.k0s()),2&r){const t=e.XpG().$implicit;e.R7$(),e.JRh(t.quantity)}}function ui(r,n){1&r&&e.nrm(0,"clr-icon",6)}function _i(r,n){if(1&r&&(e.j41(0,"li",2),e.DNE(1,pi,2,1,"div",3)(2,ui,1,0,"clr-icon",4),e.EFF(3),e.k0s()),2&r){const t=n.$implicit;e.Y8G("title",t.name),e.R7$(),e.Y8G("ngIf",null!=t.quantity),e.R7$(),e.Y8G("ngIf",null!=t.quantity),e.R7$(),e.SpI(" ",t.name," ")}}class X{static{this.\u0275fac=function(t){return new(t||X)}}static{this.\u0275cmp=e.VBU({type:X,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],["class","quantity",4,"ngIf"],["shape","times","size","12",4,"ngIf"],[1,"quantity"],["shape","times","size","12"]],template:function(t,i){1&t&&(e.j41(0,"div",0)(1,"ul"),e.DNE(2,_i,4,4,"li",1),e.k0s()()),2&t&&(e.R7$(2),e.Y8G("ngForOf",i.items))},dependencies:[u.U4n,c.Sq,c.bT],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-inline-start:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0})}}function fi(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.tracking-code")),e.R7$(2),e.SpI(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function gi(r,n){if(1&r&&e.nrm(0,"vdr-custom-field-control",5),2&r){const t=e.XpG().$implicit,i=e.XpG();e.Y8G("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",i.customFieldFormGroup)}}function hi(r,n){if(1&r&&(e.qex(0),e.DNE(1,gi,1,4,"vdr-custom-field-control",4),e.bVm()),2&r){const t=n.$implicit,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.customFieldFormGroup.get(t.name))}}class ee{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new l.J3({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){return this.fulfillment?.lines.map(n=>({name:this.order.lines.find(t=>t.id===n.orderLineId)?.productVariant.name??"",quantity:n.quantity}))??[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new l.hs(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,b.isObject)(n)}static{this.\u0275fac=function(t){return new(t||ee)(e.rXU(d.BBL))}}static{this.\u0275cmp=e.VBU({type:ee,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.OA$],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(t,i){1&t&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.nI1(3,"localeDate"),e.k0s(),e.j41(4,"vdr-labeled-data",0),e.nI1(5,"translate"),e.EFF(6),e.k0s(),e.DNE(7,fi,3,4,"vdr-labeled-data",1),e.j41(8,"vdr-labeled-data",0),e.nI1(9,"translate"),e.nrm(10,"vdr-simple-item-list",2),e.k0s(),e.DNE(11,hi,2,1,"ng-container",3)),2&t&&(e.Y8G("label",e.bMT(1,8,"common.created-at")),e.R7$(2),e.SpI(" ",e.i5U(3,10,null==i.fulfillment?null:i.fulfillment.createdAt,"medium"),"\n"),e.R7$(2),e.Y8G("label",e.bMT(5,13,"order.fulfillment-method")),e.R7$(2),e.SpI(" ",null==i.fulfillment?null:i.fulfillment.method,"\n"),e.R7$(),e.Y8G("ngIf",null==i.fulfillment?null:i.fulfillment.trackingCode),e.R7$(),e.Y8G("label",e.bMT(9,15,"order.contents")),e.R7$(2),e.Y8G("items",i.items),e.R7$(),e.Y8G("ngForOf",i.customFieldConfig))},dependencies:[c.Sq,c.bT,Je.C,C.B,X,_.D9,Y.P],changeDetection:0})}}function bi(r,n){1&r&&e.nrm(0,"clr-icon",2)}class he{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}static{this.\u0275fac=function(t){return new(t||he)}}static{this.\u0275cmp=e.VBU({type:he,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,i){1&t&&(e.j41(0,"vdr-chip",0),e.nI1(1,"translate"),e.DNE(2,bi,1,0,"clr-icon",1),e.EFF(3),e.nI1(4,"stateI18nToken"),e.nI1(5,"translate"),e.k0s()),2&t&&(e.Y8G("title",e.bMT(1,4,"order.payment-state"))("colorType",i.chipColorType),e.R7$(2),e.Y8G("ngIf","Delivered"===i.state),e.R7$(),e.SpI(" ",e.bMT(5,8,e.bMT(4,6,i.state)),"\n"))},dependencies:[u.U4n,c.bT,k.w,_.D9,j.p],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0})}}const _t=r=>({state:r});function Ci(r,n){if(1&r&&e.nrm(0,"vdr-fulfillment-detail",8),2&r){const t=e.XpG();e.Y8G("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}function vi(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"button",15),e.bIt("click",function(){const o=e.eBV(t).ngIf,a=e.XpG(2);return e.Njj(a.transitionState.emit(o))}),e.EFF(2),e.nI1(3,"stateI18nToken"),e.nI1(4,"translate"),e.nI1(5,"translate"),e.k0s(),e.bVm()}if(2&r){const t=n.ngIf;e.R7$(2),e.SpI(" ",e.i5U(5,5,"order.set-fulfillment-state",e.eq3(8,_t,e.bMT(4,3,e.bMT(3,1,t))))," ")}}function yi(r,n){if(1&r&&(e.qex(0),e.nrm(1,"clr-icon",18),e.EFF(2),e.nI1(3,"stateI18nToken"),e.nI1(4,"translate"),e.nI1(5,"translate"),e.bVm()),2&r){const t=e.XpG().$implicit;e.R7$(2),e.SpI(" ",e.i5U(5,5,"order.transition-to-state",e.eq3(8,_t,e.bMT(4,3,e.bMT(3,1,t))))," ")}}function Ii(r,n){1&r&&(e.nrm(0,"clr-icon",19),e.EFF(1),e.nI1(2,"translate")),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.cancel-fulfillment")," "))}function Ti(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"button",16),e.bIt("click",function(){const o=e.eBV(t).$implicit,a=e.XpG(2);return e.Njj(a.transitionState.emit(o))}),e.DNE(2,yi,6,10,"ng-container",17)(3,Ii,3,3,"ng-template",null,0,e.C5r),e.k0s(),e.bVm()}if(2&r){const t=n.$implicit,i=e.sdS(4);e.R7$(2),e.Y8G("ngIf","Cancelled"!==t)("ngIfElse",i)}}function Oi(r,n){if(1&r&&(e.j41(0,"div",9),e.DNE(1,vi,6,10,"ng-container",10),e.j41(2,"vdr-dropdown")(3,"button",11),e.nrm(4,"clr-icon",12),e.k0s(),e.j41(5,"vdr-dropdown-menu",13),e.DNE(6,Ti,5,2,"ng-container",14),e.k0s()()()),2&r){const t=e.XpG();e.R7$(),e.Y8G("ngIf",t.nextSuggestedState()),e.R7$(5),e.Y8G("ngForOf",t.nextOtherStates())}}class be{constructor(){this.transitionState=new e.bkB}nextSuggestedState(){if(!this.fulfillment)return;const{nextStates:n}=this.fulfillment,t=i=>n.includes(i)?i:n[0];switch(this.fulfillment?.state){case"Pending":return t("Shipped");case"Shipped":return t("Delivered");default:return n.find(i=>"Cancelled"!==i)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}static{this.\u0275fac=function(t){return new(t||be)}}static{this.\u0275cmp=e.VBU({type:be,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[["cancel",""],[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,i){1&t&&(e.j41(0,"div",1)(1,"div",2)(2,"div"),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.j41(5,"div",3),e.nrm(6,"vdr-fulfillment-state-label",4),e.k0s()(),e.j41(7,"div",5),e.DNE(8,Ci,1,2,"vdr-fulfillment-detail",6),e.k0s(),e.DNE(9,Oi,7,2,"div",7),e.k0s()),2&t&&(e.R7$(3),e.JRh(e.bMT(4,4,"order.fulfillment")),e.R7$(3),e.Y8G("state",null==i.fulfillment?null:i.fulfillment.state),e.R7$(2),e.Y8G("ngIf",!!i.fulfillment),e.R7$(),e.Y8G("ngIf",null==i.fulfillment?null:i.fulfillment.nextStates.length))},dependencies:[u.U4n,c.Sq,c.bT,W.P,Q.q,z.j,pe.M,ee,he,_.D9,j.p],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0})}}function Fi(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.note")),e.R7$(2),e.JRh(t.modification.note)}}function Ri(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.nI1(3,"localeCurrency"),e.k0s()),2&r){let t;const i=n.$implicit,o=e.XpG();e.Y8G("label",e.bMT(1,3,"order.surcharges")),e.R7$(2),e.Lme(" ",null==(t=o.getSurcharge(i.id))?null:t.description," ",e.i5U(3,5,null==(t=o.getSurcharge(i.id))?null:t.priceWithTax,o.order.currencyCode),"")}}function Mi(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.nrm(2,"vdr-simple-item-list",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.added-items")),e.R7$(2),e.Y8G("items",t.getAddedItems())}}function Si(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.nrm(2,"vdr-simple-item-list",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.removed-items")),e.R7$(2),e.Y8G("items",t.getRemovedItems())}}function xi(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.nrm(2,"vdr-simple-item-list",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.modified-items")),e.R7$(2),e.Y8G("items",t.getModifiedItems())}}class Ce{constructor(){this.addedItems=new Map,this.removedItems=new Map,this.modifiedItems=new Set}ngOnChanges(){const{added:n,removed:t,modified:i}=this.getModifiedLines();this.addedItems=n,this.removedItems=t,this.modifiedItems=i}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedItems(){return[...this.modifiedItems].map(n=>({name:n.productVariant.name}))}getModifiedLines(){const n=new Map,t=new Map,i=new Set;for(const o of this.modification.lines||[]){const a=this.order.lines.find(m=>m.id===o.orderLineId);a&&(0===o.quantity?i.add(a):o.quantity<0?t.set(a,-o.quantity):n.set(a,o.quantity))}return{added:n,removed:t,modified:i}}static{this.\u0275fac=function(t){return new(t||Ce)}}static{this.\u0275cmp=e.VBU({type:Ce,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.OA$],decls:8,vars:9,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(t,i){1&t&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s(),e.DNE(3,Fi,3,4,"vdr-labeled-data",1)(4,Ri,4,8,"vdr-labeled-data",2)(5,Mi,3,4,"vdr-labeled-data",1)(6,Si,3,4,"vdr-labeled-data",1)(7,xi,3,4,"vdr-labeled-data",1)),2&t&&(e.Y8G("label",e.bMT(1,7,"common.ID")),e.R7$(2),e.JRh(i.modification.id),e.R7$(),e.Y8G("ngIf",i.modification.note),e.R7$(),e.Y8G("ngForOf",i.modification.surcharges),e.R7$(),e.Y8G("ngIf",i.getAddedItems().length),e.R7$(),e.Y8G("ngIf",i.getRemovedItems().length),e.R7$(),e.Y8G("ngIf",i.getModifiedItems().length))},dependencies:[c.Sq,c.bT,C.B,X,_.D9,g.u],changeDetection:0})}}var Gi=s(2132),ft=s(303),He=s(2612);const qe=72;function ki(r,n){if(1&r&&(e.j41(0,"div",3),e.nrm(1,"div",4)(2,"clr-icon",5),e.j41(3,"div",6),e.EFF(4),e.nI1(5,"stateI18nToken"),e.nI1(6,"translate"),e.k0s()()),2&r){const t=e.XpG();e.R7$(4),e.SpI(" ",e.bMT(6,3,e.bMT(5,1,t.cancelledState))," ")}}class te{constructor(n){this.elementRef=n,this.active$=new He.t(!1),this.activeTarget$=new He.t(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){this.elementRef.nativeElement.getBoundingClientRect();const i=this.elementRef.nativeElement.querySelector(".node")?.getBoundingClientRect().height??0;return{x:10,y:this.index*qe+("bottom"===n?i:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}static{this.\u0275fac=function(t){return new(t||te)(e.rXU(e.aKT))}}static{this.\u0275cmp=e.VBU({type:te,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.OA$],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(t,i){1&t&&(e.j41(0,"div",0),e.nI1(1,"async"),e.j41(2,"div",1),e.nI1(3,"async"),e.EFF(4),e.nI1(5,"stateI18nToken"),e.nI1(6,"translate"),e.k0s(),e.DNE(7,ki,7,5,"div",2),e.k0s()),2&t&&(e.AVh("active",e.bMT(1,7,i.active$)),e.Y8G("ngStyle",i.getStyle()),e.R7$(2),e.AVh("active-target",e.bMT(3,9,i.activeTarget$)),e.R7$(2),e.SpI(" ",e.bMT(6,13,e.bMT(5,11,i.node.name))," "),e.R7$(3),e.Y8G("ngIf",i.isCancellable))},dependencies:[u.U4n,c.bT,c.B3,c.Jj,_.D9,j.p],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-inline-start:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-inline-start:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0})}}class ve{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,de.M)(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"),i=this.to.getPos("down"===n?"top":"bottom"),o=Math.abs(t.x-i.x),a=Math.abs(t.y-i.y),m=Math.sqrt(o**2+a**2);return{"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":m,"width.px":1,..."up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{}}}static{this.\u0275fac=function(t){return new(t||ve)}}static{this.\u0275cmp=e.VBU({type:ve,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(t,i){1&t&&(e.j41(0,"div",0),e.nI1(1,"async"),e.nrm(2,"clr-icon",1),e.k0s()),2&t&&(e.AVh("active",e.bMT(1,5,i.active$)),e.Y8G("ngStyle",i.getStyle()),e.BMQ("data-from",i.from.node.name)("data-to",i.to.node.name))},dependencies:[u.U4n,c.B3,c.Jj],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0})}}function Di(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"vdr-order-process-node",1),e.nI1(2,"async"),e.bIt("mouseenter",function(){const o=e.eBV(t).$implicit,a=e.XpG();return e.Njj(a.onMouseOver(o.name))})("mouseleave",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.onMouseOut())}),e.k0s(),e.bVm()}if(2&r){const t=n.$implicit,i=n.index,o=e.XpG();e.R7$(),e.Y8G("node",t)("index",i)("active",e.bMT(2,3,o.activeState$)===t.name)}}function $i(r,n){if(1&r&&(e.qex(0),e.nrm(1,"vdr-order-process-edge",2),e.bVm()),2&r){const t=n.$implicit;e.R7$(),e.Y8G("from",t.from)("to",t.to)("index",t.index)}}class ye{constructor(n){this.changeDetector=n,this.setActiveState$=new He.t(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*qe}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ve.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(){const n=new Map;for(const t of this.states)n.set(t.name,{name:t.name,to:[]});for(const[t,i]of n.entries()){const o=this.states.find(a=>a.name===t)?.to??[];for(const a of o){const m=n.get(a);m&&i.to.push(m)}}this.nodes=[...n.values()].filter(t=>"Cancelled"!==t.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let i=0;for(const o of n.to){const a=this.getNodeFor(o.name);t&&a&&t!==a&&(this.edges.push({to:a,from:t,index:i}),i++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}static{this.\u0275fac=function(t){return new(t||ye)(e.rXU(e.gRc))}}static{this.\u0275cmp=e.VBU({type:ye,selectors:[["vdr-order-process-graph"]],viewQuery:function(t,i){if(1&t&&e.GBs(te,5),2&t){let o;e.mGM(o=e.lsd())&&(i.nodeComponents=o)}},hostVars:2,hostBindings:function(t,i){2&t&&e.xc7("height",i.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.OA$],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"mouseenter","mouseleave","node","index","active"],[3,"from","to","index"]],template:function(t,i){1&t&&e.DNE(0,Di,3,5,"ng-container",0)(1,$i,2,3,"ng-container",0),2&t&&(e.Y8G("ngForOf",i.nodes),e.R7$(),e.Y8G("ngForOf",i.edges))},dependencies:[c.Sq,te,ve,c.Jj],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0})}}function ji(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.order-state-diagram"))}class Ie{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}static{this.\u0275fac=function(t){return new(t||Ie)(e.rXU(d.BBL))}}static{this.\u0275cmp=e.VBU({type:Ie,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(t,i){1&t&&(e.DNE(0,ji,2,3,"ng-template",0),e.nrm(1,"vdr-order-process-graph",1)),2&t&&(e.R7$(),e.Y8G("states",i.states)("initialState",i.activeState))},dependencies:[y.M,ye,_.D9],changeDetection:0})}}var We=s(1745),Qe=s(5956),Ei=s(779);function Pi(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-select-toggle",6),e.nI1(1,"translate"),e.nI1(2,"translate"),e.mxI("selectedChange",function(o){e.eBV(t);const a=e.XpG().$implicit;return e.DH7(a.selected,o)||(a.selected=o),e.Njj(o)}),e.bIt("selectedChange",function(o){e.eBV(t);const a=e.XpG().$implicit,m=e.XpG();return e.Njj(m.paymentSelected.emit({payment:a,selected:o}))}),e.k0s()}if(2&r){const t=e.XpG().$implicit,i=e.XpG();e.Y8G("title",e.bMT(1,4,"order.refund-this-payment"))("label",e.bMT(2,6,"order.refund-this-payment"))("disabled",1===i.refundablePayments.length),e.R50("selected",t.selected)}}function Ni(r,n){if(1&r&&(e.j41(0,"vdr-card",1),e.nI1(1,"translate"),e.DNE(2,Pi,3,8,"ng-template",2),e.j41(3,"div",3)(4,"vdr-labeled-data",4),e.nI1(5,"translate"),e.EFF(6),e.k0s(),e.j41(7,"vdr-labeled-data",4),e.nI1(8,"translate"),e.EFF(9),e.k0s(),e.j41(10,"vdr-labeled-data",4),e.nI1(11,"translate"),e.EFF(12),e.nI1(13,"localeCurrency"),e.k0s(),e.j41(14,"vdr-labeled-data",4),e.nI1(15,"translate"),e.EFF(16),e.nI1(17,"localeCurrency"),e.k0s()(),e.j41(18,"vdr-form-field",4),e.nI1(19,"translate"),e.nrm(20,"vdr-currency-input",5),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG();e.AVh("selected",t.selected)("unselected",!t.selected),e.Y8G("title",e.bMT(1,17,"order.payment")),e.R7$(4),e.Y8G("label",e.bMT(5,19,"order.payment-method")),e.R7$(2),e.SpI(" ",t.method," "),e.R7$(),e.Y8G("label",e.bMT(8,21,"order.transaction-id")),e.R7$(2),e.SpI(" ",t.transactionId," "),e.R7$(),e.Y8G("label",e.bMT(11,23,"order.payment-amount")),e.R7$(2),e.SpI(" ",e.i5U(13,25,t.amount,i.order.currencyCode)," "),e.R7$(2),e.Y8G("label",e.bMT(15,28,"order.refundable-amount")),e.R7$(2),e.SpI(" ",e.i5U(17,30,t.refundableAmount,i.order.currencyCode)," "),e.R7$(2),e.Y8G("label",e.bMT(19,33,"order.refund-amount")),e.R7$(2),e.Y8G("readonly",!t.selected)("currencyCode",i.order.currencyCode)("formControl",t.amountToRefundControl)}}class ne{constructor(){this.paymentSelected=new e.bkB}static{this.\u0275fac=function(t){return new(t||ne)}}static{this.\u0275cmp=e.VBU({type:ne,selectors:[["vdr-payment-for-refund-selector"]],inputs:{refundablePayments:"refundablePayments",order:"order"},outputs:{paymentSelected:"paymentSelected"},decls:1,vars:1,consts:[[3,"title","selected","unselected",4,"ngFor","ngForOf"],[3,"title"],["vdrCardControls",""],[1,"form-grid"],[3,"label"],[3,"readonly","currencyCode","formControl"],["size","small",3,"selectedChange","title","label","disabled","selected"]],template:function(t,i){1&t&&e.DNE(0,Ni,21,35,"vdr-card",0),2&t&&e.Y8G("ngForOf",i.refundablePayments)},dependencies:[c.Sq,l.BC,l.l_,We.J,N.K,h.V,Ei.E,C.B,T.i,T.a,_.D9,g.u],styles:["[_nghost-%COMP%]{display:block}"]})}}const Yi=r=>({amount:r}),wi=(r,n)=>({min:r,max:n});function Vi(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.refund-and-cancel-order"))}function Ai(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.id," ")}}function Xi(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.createdAt,"short")," ")}}function Li(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.updatedAt,"short")," ")}}function Bi(r,n){if(1&r&&(e.nrm(0,"img",26),e.nI1(1,"assetPreview")),2&r){const t=n.ngIf;e.Y8G("src",e.i5U(1,1,t,"tiny"),e.B4B)}}function Ui(r,n){1&r&&(e.j41(0,"div",27),e.nrm(1,"clr-icon",28),e.k0s())}function Ji(r,n){if(1&r&&(e.j41(0,"div",24),e.DNE(1,Bi,2,4,"img",25)(2,Ui,2,0,"ng-template",null,0,e.C5r),e.k0s()),2&r){const t=n.item,i=e.sdS(3);e.R7$(),e.Y8G("ngIf",t.featuredAsset)("ngIfElse",i)}}function Hi(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.name," ")}}function qi(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.sku," ")}}function Wi(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeCurrency")),2&r){const t=n.item,i=e.XpG();e.SpI(" ",e.i5U(1,1,t.unitPriceWithTax,i.order.currencyCode)," ")}}function Qi(r,n){if(1&r&&(e.j41(0,"div",34),e.EFF(1),e.j41(2,"div",35),e.EFF(3),e.nI1(4,"number"),e.nI1(5,"currency"),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG(3).item,o=e.XpG();e.R7$(),e.SpI(" ",t.description," "),e.R7$(2),e.SpI(" ",e.i5U(5,5,e.i5U(4,2,t.amount/100/i.quantity,"1.0-2"),o.order.currencyCode)," ")}}function zi(r,n){if(1&r&&(e.j41(0,"vdr-dropdown")(1,"div",30)(2,"button",31),e.nrm(3,"clr-icon",32),e.k0s()(),e.j41(4,"vdr-dropdown-menu"),e.DNE(5,Qi,6,8,"div",33),e.k0s()()),2&r){const t=e.XpG().ngIf;e.R7$(5),e.Y8G("ngForOf",t)}}function Zi(r,n){if(1&r&&(e.qex(0),e.DNE(1,zi,6,1,"vdr-dropdown",29),e.bVm()),2&r){const t=n.ngIf;e.R7$(),e.Y8G("ngIf",t.length)}}function Ki(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeCurrency"),e.DNE(2,Zi,2,1,"ng-container",29)),2&r){const t=n.item,i=e.XpG();e.SpI(" ",e.i5U(1,2,t.unitPriceWithTax,i.order.currencyCode)," "),e.R7$(2),e.Y8G("ngIf",t.discounts)}}function eo(r,n){if(1&r&&(e.EFF(0),e.nrm(1,"vdr-line-refunds",36)),2&r){const t=n.item,i=e.XpG();e.SpI(" ",t.quantity," "),e.R7$(),e.Y8G("line",t)("payments",i.order.payments)}}function to(r,n){if(1&r){const t=e.RV6();e.j41(0,"input",38),e.bIt("ngModelChange",function(o){e.eBV(t);const a=e.XpG().item,m=e.XpG();return e.Njj(m.onRefundQuantityChange(a.id,o))}),e.k0s()}if(2&r){const t=e.XpG().item,i=e.XpG();e.Y8G("ngModel",i.lineQuantities[t.id].quantity)("max",t.quantity)}}function no(r,n){if(1&r&&e.DNE(0,to,1,2,"input",37),2&r){const t=n.item,i=e.XpG();e.Y8G("ngIf",i.lineCanBeRefundedOrCancelled(t))}}function ro(r,n){if(1&r){const t=e.RV6();e.j41(0,"input",43),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG().item,m=e.XpG();return e.DH7(m.lineQuantities[a.id].cancel,o)||(m.lineQuantities[a.id].cancel=o),e.Njj(o)}),e.k0s()}if(2&r){const t=e.XpG().item,i=e.XpG();e.Y8G("disabled",0===i.lineQuantities[t.id].quantity),e.R50("ngModel",i.lineQuantities[t.id].cancel)}}function io(r,n){if(1&r&&(e.j41(0,"div",39)(1,"label",40),e.DNE(2,ro,1,2,"input",41),e.j41(3,"span",42),e.EFF(4),e.nI1(5,"translate"),e.k0s()()()),2&r){const t=n.item,i=e.XpG();e.R7$(2),e.Y8G("ngIf",i.lineCanBeRefundedOrCancelled(t)),e.R7$(2),e.JRh(e.bMT(5,2,"order.return-to-stock"))}}function oo(r,n){if(1&r){const t=e.RV6();e.j41(0,"label",44)(1,"input",45),e.bIt("change",function(){const o=e.eBV(t).$implicit,a=e.XpG();return e.Njj(a.toggleShippingRefund(o.id))}),e.k0s(),e.j41(2,"div",42),e.EFF(3),e.nI1(4,"translate"),e.j41(5,"span"),e.EFF(6),e.k0s(),e.j41(7,"span",42),e.EFF(8),e.nI1(9,"localeCurrency"),e.k0s()()()}if(2&r){const t=n.$implicit,i=e.XpG();e.R7$(3),e.SpI(" ",e.bMT(4,3,"order.refund-shipping")," "),e.R7$(3),e.SpI("",t.shippingMethod.name,":"),e.R7$(2),e.SpI("",e.i5U(9,5,t.discountedPriceWithTax,i.order.currencyCode)," ")}}function ao(r,n){if(1&r&&(e.j41(0,"clr-alert",51)(1,"clr-alert-item"),e.EFF(2),e.nI1(3,"currency"),e.nI1(4,"localeCurrency"),e.nI1(5,"translate"),e.k0s()()),2&r){const t=e.XpG(2);e.Y8G("clrAlertType","danger")("clrAlertClosable",!1),e.R7$(2),e.SpI(" ",e.i5U(5,9,"order.refund-total-error",e.l_i(12,wi,e.i5U(3,3,0,t.order.currencyCode),e.i5U(4,6,t.totalRefundableAmount,t.order.currencyCode)))," ")}}function lo(r,n){1&r&&(e.j41(0,"clr-alert",51)(1,"clr-alert-item"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&r&&(e.Y8G("clrAlertType","danger")("clrAlertClosable",!1),e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.refund-total-warning")," "))}function so(r,n){1&r&&(e.j41(0,"clr-alert",51)(1,"clr-alert-item"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&r&&(e.Y8G("clrAlertType","danger")("clrAlertClosable",!1),e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.refund-cancellation-reason-required")," "))}function co(r,n){if(1&r){const t=e.RV6();e.j41(0,"div")(1,"div",46),e.DNE(2,ao,6,15,"clr-alert",47)(3,lo,4,5,"clr-alert",47)(4,so,4,5,"clr-alert",47),e.k0s(),e.j41(5,"div",48)(6,"button",49),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.j41(9,"button",50),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.select())}),e.EFF(10),e.nI1(11,"localeCurrency"),e.nI1(12,"translate"),e.k0s()()()}if(2&r){const t=e.XpG();e.R7$(2),e.Y8G("ngIf",t.refundTotal<0||t.totalRefundableAmount<t.refundTotal),e.R7$(),e.Y8G("ngIf",t.amountToRefundTotal<t.refundTotal||t.refundTotal<t.amountToRefundTotal),e.R7$(),e.Y8G("ngIf",t.amountToRefundTotal&&!t.reason),e.R7$(3),e.JRh(e.bMT(8,6,"common.cancel")),e.R7$(2),e.Y8G("disabled",!t.canSubmit()),e.R7$(),e.SpI(" ",e.i5U(12,11,"order.refund-with-amount",e.eq3(14,Yi,e.i5U(11,8,t.amountToRefundTotal,t.order.currencyCode)))," ")}}class Te{constructor(n){this.i18nService=n,this.lineQuantities={},this.refundablePayments=[],this.refundShippingLineIds=[],this.reasons=(0,d.WEc)().cancellationReasons??[(0,p.x)("order.refund-reason-customer-request"),(0,p.x)("order.refund-reason-not-available")],this.manuallySetRefundTotal=!1,this.refundTotal=0,this.reasons=this.reasons.map(t=>this.i18nService.translate(t))}get totalRefundableAmount(){return(0,b.summate)(this.refundablePayments,"refundableAmount")}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}lineCanBeRefundedOrCancelled(n){return(this.order.payments?.reduce((i,o)=>[...i,...o.refunds],[]).filter(i=>"Failed"!==i.state).reduce((i,o)=>[...i,...o.lines],[]).filter(i=>i.orderLineId===n.id).reduce((i,o)=>i+o.quantity,0)??0)<n.orderPlacedQuantity}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>({...n,[t.id]:{quantity:0,refund:!0,cancel:!1}}),{}),this.refundablePayments=we(this.order.payments)}updateRefundTotal(){if(!this.manuallySetRefundTotal){const i=this.order.lines.reduce((a,m)=>{const Ze=this.lineQuantities[m.id].quantity||0;return a+m.proratedUnitPriceWithTax*Ze},0),o=this.order.shippingLines.reduce((a,m)=>this.refundShippingLineIds.includes(m.id)?a+m.discountedPriceWithTax:a,0);this.refundTotal=i+o}const n=this.refundablePayments.filter(i=>i.selected);let t=0;for(const i of n){const o=Math.min(i.refundableAmount,this.refundTotal-t);i.amountToRefundControl.setValue(o),t+=o}}toggleShippingRefund(n){const t=this.refundShippingLineIds.indexOf(n);-1===t?this.refundShippingLineIds.push(n):this.refundShippingLineIds.splice(t,1),this.updateRefundTotal()}onRefundQuantityChange(n,t){this.manuallySetRefundTotal=!1;const i=this.lineQuantities[n];if(i){const o=i.quantity;0===t?i.cancel=!1:0===o&&t>0&&(i.cancel=!0),i.quantity=t,this.updateRefundTotal()}}onPaymentSelected(n,t){if(t){const i=this.refundTotal-this.refundablePayments.filter(o=>o.id!==n.id).reduce((o,a)=>o+a.amountToRefundControl.value,0);0<i&&n.amountToRefundControl.setValue(Math.min(i,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,i)=>t||0<i.quantity,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,i)=>t||0<i.quantity&&i.cancel,!1)}canSubmit(){return 0<this.refundTotal&&this.amountToRefundTotal===this.refundTotal&&!!this.reason}select(){const n=this.getOrderLineInput(()=>!0),t=this.getOrderLineInput(i=>i.cancel);this.resolveWith({refunds:this.refundablePayments.filter(i=>i.selected&&0<i.amountToRefundControl.value).map(i=>({lines:n,reason:this.reason,paymentId:i.id,amount:i.amountToRefundControl.value,shipping:0,adjustment:0})),cancel:{lines:t,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShippingLineIds.length>0}})}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,i])=>0<i.quantity&&n(i)).map(([t,i])=>({orderLineId:t,quantity:i.quantity}))}static{this.\u0275fac=function(t){return new(t||Te)(e.rXU(d.W40))}}static{this.\u0275cmp=e.VBU({type:Te,selectors:[["vdr-refund-order-dialog"]],decls:50,vars:60,consts:[["imagePlaceholder",""],["vdrDialogTitle",""],[1,"refund-wrapper"],["id","refund-order",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading","hiddenByDefault"],["id","prorated-unit-price",3,"heading"],["id","quantity",3,"heading"],["id","refund-quantity",3,"heading","optional"],["id","cancel",3,"heading","optional"],[1,"refund-details","mt-4"],["class","flex mb-2",4,"ngFor","ngForOf"],[1,"mb-2",3,"label"],["bindLabel","name","autofocus","","bindValue","id",3,"ngModelChange","items","placeholder","addTag","ngModel"],[3,"readOnlyToggleChange","label","readOnlyToggle"],[3,"ngModelChange","readonly","currencyCode","ngModel"],[1,""],[3,"paymentSelected","refundablePayments","order"],["vdrDialogButtons",""],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],[3,"line","payments"],["type","number","min","0",3,"ngModel","max","ngModelChange",4,"ngIf"],["type","number","min","0",3,"ngModelChange","ngModel","max"],[1,"cancel-checkbox-wrapper"],[1,"flex","center"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],[1,"ml-1"],["type","checkbox","clrCheckbox","",3,"ngModelChange","disabled","ngModel"],[1,"flex","mb-2"],["type","checkbox","clrCheckbox","",3,"change"],[1,"errors"],[3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"],[3,"clrAlertType","clrAlertClosable"]],template:function(t,i){1&t&&(e.DNE(0,Vi,2,3,"ng-template",1),e.j41(1,"div",2)(2,"vdr-data-table-2",3)(3,"vdr-dt2-column",4),e.nI1(4,"translate"),e.DNE(5,Ai,1,1,"ng-template"),e.k0s(),e.j41(6,"vdr-dt2-column",5),e.nI1(7,"translate"),e.DNE(8,Xi,2,4,"ng-template"),e.k0s(),e.j41(9,"vdr-dt2-column",6),e.nI1(10,"translate"),e.DNE(11,Li,2,4,"ng-template"),e.k0s(),e.j41(12,"vdr-dt2-column",7),e.nI1(13,"translate"),e.DNE(14,Ji,4,2,"ng-template"),e.k0s(),e.j41(15,"vdr-dt2-column",8),e.nI1(16,"translate"),e.DNE(17,Hi,1,1,"ng-template"),e.k0s(),e.j41(18,"vdr-dt2-column",9),e.nI1(19,"translate"),e.DNE(20,qi,1,1,"ng-template"),e.k0s(),e.j41(21,"vdr-dt2-column",10),e.nI1(22,"translate"),e.DNE(23,Wi,2,4,"ng-template"),e.k0s(),e.j41(24,"vdr-dt2-column",11),e.nI1(25,"translate"),e.DNE(26,Ki,3,5,"ng-template"),e.k0s(),e.j41(27,"vdr-dt2-column",12),e.nI1(28,"translate"),e.DNE(29,eo,2,3,"ng-template"),e.k0s(),e.j41(30,"vdr-dt2-column",13),e.nI1(31,"translate"),e.DNE(32,no,1,1,"ng-template"),e.k0s(),e.j41(33,"vdr-dt2-column",14),e.nI1(34,"translate"),e.DNE(35,io,6,4,"ng-template"),e.k0s()(),e.j41(36,"div",15)(37,"div")(38,"vdr-card"),e.DNE(39,oo,10,8,"label",16),e.j41(40,"vdr-form-field",17),e.nI1(41,"translate"),e.j41(42,"ng-select",18),e.nI1(43,"translate"),e.mxI("ngModelChange",function(a){return e.DH7(i.reason,a)||(i.reason=a),a}),e.k0s()(),e.j41(44,"vdr-form-field",19),e.nI1(45,"translate"),e.bIt("readOnlyToggleChange",function(a){return i.manuallySetRefundTotal=!a}),e.j41(46,"vdr-currency-input",20),e.mxI("ngModelChange",function(a){return e.DH7(i.refundTotal,a)||(i.refundTotal=a),a}),e.bIt("ngModelChange",function(){return i.updateRefundTotal()}),e.k0s()()()(),e.j41(47,"div",21)(48,"vdr-payment-for-refund-selector",22),e.bIt("paymentSelected",function(a){return i.onPaymentSelected(a.payment,a.selected)}),e.k0s()()()(),e.DNE(49,co,13,16,"ng-template",23)),2&t&&(e.R7$(2),e.Y8G("items",i.order.lines),e.R7$(),e.Y8G("heading",e.bMT(4,32,"common.id"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(7,34,"common.created-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(10,36,"common.updated-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(13,38,"common.image")),e.R7$(3),e.Y8G("heading",e.bMT(16,40,"order.product-name"))("optional",!1),e.R7$(3),e.Y8G("heading",e.bMT(19,42,"order.product-sku")),e.R7$(3),e.Y8G("heading",e.bMT(22,44,"order.unit-price"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(25,46,"order.prorated-unit-price")),e.R7$(3),e.Y8G("heading",e.bMT(28,48,"order.quantity")),e.R7$(3),e.Y8G("heading",e.bMT(31,50,"order.refund"))("optional",!1),e.R7$(3),e.Y8G("heading",e.bMT(34,52,"order.return-to-stock"))("optional",!1),e.R7$(6),e.Y8G("ngForOf",i.order.shippingLines),e.R7$(),e.Y8G("label",e.bMT(41,54,"order.refund-cancellation-reason")),e.R7$(2),e.Y8G("items",i.reasons)("placeholder",e.bMT(43,56,"order.refund-cancellation-reason-required"))("addTag",!0),e.R50("ngModel",i.reason),e.R7$(2),e.Y8G("label",e.bMT(45,58,"order.refund-total"))("readOnlyToggle",!0),e.R7$(2),e.Y8G("readonly",!i.manuallySetRefundTotal)("currencyCode",i.order.currencyCode),e.R50("ngModel",i.refundTotal),e.R7$(2),e.Y8G("refundablePayments",i.refundablePayments)("order",i.order))},dependencies:[u.k8k,u.Bw1,u.U4n,u.aZZ,u.Jej,c.Sq,c.bT,l.me,l.Q0,l.Zm,l.BC,l.VZ,l.zX,l.vS,G.vr,We.J,N.K,h.V,F.b,y.M,W.P,Q.q,z.j,Qe.I,Ne.Y,T.i,w,ne,c.QX,c.oe,_.D9,L.H,Y.P,g.u],styles:["[_nghost-%COMP%]{height:100%;display:flex;flex-direction:column;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)} .refund-wrapper .table-wrapper{max-width:initial!important}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding-bottom:var(--space-unit);gap:calc(var(--space-unit) * 2);justify-content:space-between}@media screen and (min-width: 992px){.refund-details[_ngcontent-%COMP%]{flex-direction:row}}.refund-details[_ngcontent-%COMP%] vdr-card.unselected[_ngcontent-%COMP%]{opacity:.8}.refund-details[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{flex:1}.errors[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) 0}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-inline-start:12px}vdr-card.faded[_ngcontent-%COMP%]{opacity:.8}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}}const mo=r=>({method:r});function po(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.settle-refund"))}function uo(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",4),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",5),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.submit())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"common.cancel")),e.R7$(2),e.Y8G("disabled",!t.transactionId),e.R7$(),e.SpI(" ",e.bMT(5,5,"order.settle-refund")," ")}}class Oe{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}static{this.\u0275fac=function(t){return new(t||Oe)}}static{this.\u0275cmp=e.VBU({type:Oe,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModelChange","ngModel"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"]],template:function(t,i){1&t&&(e.DNE(0,po,2,3,"ng-template",0),e.j41(1,"p",1),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"clr-input-container")(5,"label"),e.EFF(6),e.nI1(7,"translate"),e.k0s(),e.j41(8,"input",2),e.mxI("ngModelChange",function(a){return e.DH7(i.transactionId,a)||(i.transactionId=a),a}),e.k0s()(),e.DNE(9,uo,6,7,"ng-template",3)),2&t&&(e.R7$(2),e.SpI(" ",e.i5U(3,3,"order.settle-refund-manual-instructions",e.eq3(8,mo,i.refund.method)),"\n"),e.R7$(4),e.JRh(e.bMT(7,6,"order.transaction-id")),e.R7$(2),e.R50("ngModel",i.transactionId))},dependencies:[u.aZZ,u.icl,u.Xu5,l.me,l.BC,l.vS,h.V,F.b,y.M,_.D9],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0})}}var gt=s(1534);function _o(r,n){1&r&&e.nrm(0,"clr-icon",2)}class Fe{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}static{this.\u0275fac=function(t){return new(t||Fe)}}static{this.\u0275cmp=e.VBU({type:Fe,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,i){1&t&&(e.j41(0,"vdr-chip",0),e.nI1(1,"translate"),e.DNE(2,_o,1,0,"clr-icon",1),e.EFF(3),e.nI1(4,"stateI18nToken"),e.nI1(5,"translate"),e.k0s()),2&t&&(e.Y8G("title",e.bMT(1,4,"order.payment-state"))("colorType",i.chipColorType),e.R7$(2),e.Y8G("ngIf","Settled"===i.state),e.R7$(),e.SpI(" ",e.bMT(5,8,e.bMT(4,6,i.state)),"\n"))},dependencies:[u.U4n,c.bT,k.w,_.D9,j.p],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}}function fo(r,n){1&r&&e.nrm(0,"clr-icon",2)}class Re{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}static{this.\u0275fac=function(t){return new(t||Re)}}static{this.\u0275cmp=e.VBU({type:Re,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(t,i){1&t&&(e.j41(0,"vdr-chip",0),e.nI1(1,"translate"),e.DNE(2,fo,1,0,"clr-icon",1),e.EFF(3),e.nI1(4,"stateI18nToken"),e.nI1(5,"translate"),e.k0s()),2&t&&(e.Y8G("title",e.bMT(1,4,"order.payment-state"))("colorType",i.chipColorType),e.R7$(2),e.Y8G("ngIf","Settled"===i.state),e.R7$(),e.SpI(" ",e.bMT(5,8,e.bMT(4,6,i.state)),"\n"))},dependencies:[u.U4n,c.bT,k.w,_.D9,j.p],styles:["[_nghost-%COMP%]{display:flex;font-size:14px}"],changeDetection:0})}}function go(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.error-message")),e.R7$(2),e.SpI(" ",t.payment.errorMessage,"\n")}}function ho(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.transaction-id")),e.R7$(2),e.SpI(" ",t.payment.transactionId,"\n")}}class re{static{this.\u0275fac=function(t){return new(t||re)}}static{this.\u0275cmp=e.VBU({type:re,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,i){1&t&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s(),e.j41(3,"vdr-labeled-data",0),e.nI1(4,"translate"),e.EFF(5),e.nI1(6,"localeCurrency"),e.k0s(),e.DNE(7,go,3,4,"vdr-labeled-data",1)(8,ho,3,4,"vdr-labeled-data",1),e.j41(9,"vdr-labeled-data",0),e.nI1(10,"translate"),e.nrm(11,"vdr-object-tree",2),e.k0s()),2&t&&(e.Y8G("label",e.bMT(1,8,"order.payment-method")),e.R7$(2),e.SpI(" ",i.payment.method,"\n"),e.R7$(),e.Y8G("label",e.bMT(4,10,"order.amount")),e.R7$(2),e.SpI(" ",e.i5U(6,12,i.payment.amount,i.currencyCode),"\n"),e.R7$(2),e.Y8G("ngIf",i.payment.errorMessage),e.R7$(),e.Y8G("ngIf",i.payment.transactionId),e.R7$(),e.Y8G("label",e.bMT(10,15,"order.payment-metadata")),e.R7$(2),e.Y8G("value",i.payment.metadata))},dependencies:[c.bT,C.B,ce.T,_.D9,g.u],changeDetection:0})}}const bo=r=>({state:r});function Co(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"localeCurrency"),e.bVm()),2&r){const t=e.XpG();e.R7$(),e.JRh(e.i5U(2,1,t.payment.amount,t.currencyCode))}}function vo(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",14),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG().$implicit;e.Y8G("label",e.bMT(1,2,"order.transaction-id")),e.R7$(2),e.SpI(" ",t.transactionId," ")}}function yo(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",14),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG().$implicit;e.Y8G("label",e.bMT(1,2,"order.refund-reason")),e.R7$(2),e.SpI(" ",t.reason," ")}}function Io(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",14),e.nI1(1,"translate"),e.nrm(2,"vdr-object-tree",16),e.k0s()),2&r){const t=e.XpG().$implicit;e.Y8G("label",e.bMT(1,2,"order.refund-metadata")),e.R7$(2),e.Y8G("value",t.metadata)}}function To(r,n){if(1&r){const t=e.RV6();e.j41(0,"div",17)(1,"button",18),e.bIt("click",function(){e.eBV(t);const o=e.XpG().$implicit,a=e.XpG();return e.Njj(a.settleRefund.emit(o))}),e.EFF(2),e.nI1(3,"translate"),e.k0s()()}2&r&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"order.settle-refund")," "))}function Oo(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",10)(2,"div",11),e.nrm(3,"clr-icon",12),e.EFF(4),e.nI1(5,"translate"),e.nrm(6,"div",13)(7,"vdr-refund-state-label",5),e.k0s(),e.j41(8,"div",6)(9,"vdr-labeled-data",14),e.nI1(10,"translate"),e.EFF(11),e.nI1(12,"localeDate"),e.k0s(),e.j41(13,"vdr-labeled-data",14),e.nI1(14,"translate"),e.EFF(15),e.nI1(16,"localeCurrency"),e.k0s(),e.DNE(17,vo,3,4,"vdr-labeled-data",15)(18,yo,3,4,"vdr-labeled-data",15)(19,Io,3,4,"vdr-labeled-data",15),e.k0s(),e.DNE(20,To,4,3,"div",9),e.k0s(),e.bVm()),2&r){const t=n.$implicit,i=e.XpG();e.R7$(4),e.Lme(" ",e.bMT(5,11,"order.refund")," #",t.id," "),e.R7$(3),e.Y8G("state",t.state),e.R7$(2),e.Y8G("label",e.bMT(10,13,"common.created-at")),e.R7$(2),e.SpI(" ",e.i5U(12,15,t.createdAt,"medium")," "),e.R7$(2),e.Y8G("label",e.bMT(14,18,"order.refund-total")),e.R7$(2),e.SpI(" ",e.i5U(16,20,t.total,i.currencyCode)," "),e.R7$(2),e.Y8G("ngIf",t.transactionId),e.R7$(),e.Y8G("ngIf",t.reason),e.R7$(),e.Y8G("ngIf",i.refundHasMetadata(t)),e.R7$(),e.Y8G("ngIf","Pending"===t.state)}}function Fo(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",18),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.settlePayment.emit(o.payment))}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.settle-payment")," "))}function Ro(r,n){if(1&r&&(e.qex(0),e.nrm(1,"clr-icon",25),e.EFF(2),e.nI1(3,"stateI18nToken"),e.nI1(4,"translate"),e.nI1(5,"translate"),e.bVm()),2&r){const t=e.XpG().$implicit;e.R7$(2),e.SpI(" ",e.i5U(5,5,"order.transition-to-state",e.eq3(8,bo,e.bMT(4,3,e.bMT(3,1,t))))," ")}}function Mo(r,n){1&r&&(e.nrm(0,"clr-icon",26),e.EFF(1),e.nI1(2,"translate")),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.cancel-payment")," "))}function So(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"button",23),e.bIt("click",function(){const o=e.eBV(t).$implicit,a=e.XpG(2);return e.Njj(a.transitionPaymentState.emit({payment:a.payment,state:o}))}),e.DNE(2,Ro,6,10,"ng-container",24)(3,Mo,3,3,"ng-template",null,0,e.C5r),e.k0s(),e.bVm()}if(2&r){const t=n.$implicit,i=e.sdS(4);e.R7$(2),e.Y8G("ngIf","Cancelled"!==t)("ngIfElse",i)}}function xo(r,n){if(1&r&&(e.j41(0,"div",17),e.DNE(1,Fo,3,3,"button",19),e.j41(2,"vdr-dropdown")(3,"button",20),e.nrm(4,"clr-icon",21),e.k0s(),e.j41(5,"vdr-dropdown-menu",22),e.DNE(6,So,5,2,"ng-container",8),e.k0s()()()),2&r){const t=e.XpG();e.R7$(),e.Y8G("ngIf",t.payment.nextStates.includes("Settled")),e.R7$(5),e.Y8G("ngForOf",t.nextOtherStates())}}class Me{constructor(){this.settlePayment=new e.bkB,this.transitionPaymentState=new e.bkB,this.settleRefund=new e.bkB}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}static{this.\u0275fac=function(t){return new(t||Me)}}static{this.\u0275cmp=e.VBU({type:Me,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[["cancel",""],[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],[1,"refund-wrapper","card-block"],[1,"card-header","payment-header","refund-header"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",3,"click"],[4,"ngIf","ngIfElse"],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(t,i){1&t&&(e.j41(0,"div",1)(1,"div",2)(2,"div"),e.EFF(3),e.nI1(4,"translate"),e.DNE(5,Co,3,4,"ng-container",3),e.k0s(),e.j41(6,"div",4),e.nrm(7,"vdr-payment-state-label",5),e.k0s()(),e.j41(8,"div",6),e.nrm(9,"vdr-payment-detail",7),e.k0s(),e.DNE(10,Oo,21,23,"ng-container",8)(11,xo,7,2,"div",9),e.k0s()),2&t&&(e.R7$(3),e.SpI(" ",e.bMT(4,7,"order.payment")," "),e.R7$(2),e.Y8G("ngIf",i.payment.amount),e.R7$(2),e.Y8G("state",i.payment.state),e.R7$(2),e.Y8G("payment",i.payment)("currencyCode",i.currencyCode),e.R7$(),e.Y8G("ngForOf",i.payment.refunds),e.R7$(),e.Y8G("ngIf",i.payment.nextStates.length))},dependencies:[u.U4n,c.Sq,c.bT,pt.ig,W.P,Q.q,z.j,pe.M,C.B,ce.T,Fe,Re,re,_.D9,j.p,Y.P,g.u],styles:["[_nghost-%COMP%]{display:block}.payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;line-break:anywhere}.refund-icon[_ngcontent-%COMP%]{margin-inline-end:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}.refund-wrapper[_ngcontent-%COMP%]{font-size:var(--font-size-xs)}"],changeDetection:0})}}var ht=s(2337),Go=s(8387);const ko=["portal"];class Se{constructor(n){this.historyEntryComponentService=n,this.expandClick=new e.bkB}ngOnInit(){const n=this.historyEntryComponentService.getComponent(this.entry.type),t=this.portalRef.createComponent(n);t.instance.entry=this.entry,t.instance.order=this.order,this.instance=t.instance,this.componentRef=t}ngOnDestroy(){this.componentRef?.destroy()}static{this.\u0275fac=function(t){return new(t||Se)(e.rXU(d.HMZ))}}static{this.\u0275cmp=e.VBU({type:Se,selectors:[["vdr-order-history-entry-host"]],viewQuery:function(t,i){if(1&t&&e.GBs(ko,7,e.c1b),2&t){let o;e.mGM(o=e.lsd())&&(i.portalRef=o.first)}},inputs:{entry:"entry",order:"order",expanded:"expanded"},outputs:{expandClick:"expandClick"},exportAs:["historyEntry"],decls:3,vars:6,consts:[["portal",""],[3,"expandClick","displayType","iconShape","createdAt","name","featured","collapsed"]],template:function(t,i){if(1&t){const o=e.RV6();e.j41(0,"vdr-timeline-entry",1),e.bIt("expandClick",function(){return e.eBV(o),e.Njj(i.expandClick.emit())}),e.nrm(1,"div",null,0),e.k0s()}2&t&&e.Y8G("displayType",i.instance.getDisplayType(i.entry))("iconShape",i.instance.getIconShape&&i.instance.getIconShape(i.entry))("createdAt",i.entry.createdAt)("name",i.instance.getName&&i.instance.getName(i.entry))("featured",i.instance.isFeatured(i.entry))("collapsed",!i.expanded&&!i.instance.isFeatured(i.entry))},dependencies:[ht.r],encapsulation:2})}}var bt=s(4612);const Ct=(r,n)=>({from:r,to:n}),vt=(r,n,t)=>({from:r,to:n,id:t}),Do=r=>({count:r}),$o=r=>["/marketing","promotions",r],jo=r=>({newCustomerName:r}),yt=r=>["/customer","customers",r];function Eo(r,n){1&r&&(e.j41(0,"span",15),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.note-only-visible-to-administrators")," "))}function Po(r,n){1&r&&(e.j41(0,"span",16),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.note-visible-to-customer")," "))}function No(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-order-history-entry-host",18),e.bIt("expandClick",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.expanded=!o.expanded)}),e.k0s()}if(2&r){const t=e.XpG().$implicit,i=e.XpG();e.Y8G("order",i.order)("entry",t)("expanded",i.expanded)}}function Yo(r,n){1&r&&(e.j41(0,"div",14),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.history-order-fulfilled")," "))}function wo(r,n){1&r&&(e.j41(0,"div",14),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.history-order-cancelled")," "))}function Vo(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r){const t=e.XpG(3).$implicit;e.SpI(" ",e.i5U(1,1,"order.history-order-transition",e.l_i(4,Ct,t.data.from,t.data.to))," ")}}function Ao(r,n){if(1&r&&(e.qex(0),e.DNE(1,Yo,3,3,"div",23)(2,wo,3,3,"div",23)(3,Vo,2,7,"ng-template",24),e.bVm()),2&r){const t=e.XpG(2).$implicit;e.R7$(),e.Y8G("ngIf","Delivered"===t.data.to),e.R7$(),e.Y8G("ngIf","Cancelled"===t.data.to),e.R7$(),e.Y8G("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function Xo(r,n){1&r&&(e.j41(0,"vdr-chip",30),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"order.modification-settled")))}function Lo(r,n){1&r&&(e.j41(0,"vdr-chip",31),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"order.modification-not-settled")))}function Bo(r,n){if(1&r&&(e.j41(0,"div",26),e.EFF(1),e.nI1(2,"translate"),e.j41(3,"strong"),e.EFF(4),e.nI1(5,"localeCurrency"),e.k0s(),e.DNE(6,Xo,3,3,"vdr-chip",27)(7,Lo,3,3,"vdr-chip",28),e.j41(8,"vdr-history-entry-detail"),e.nrm(9,"vdr-modification-detail",29),e.k0s()()),2&r){const t=n.ngIf,i=e.XpG(4);e.R7$(),e.SpI(" ",e.bMT(2,6,"order.modify-order-price-difference"),": "),e.R7$(3),e.JRh(e.i5U(5,8,t.priceChange,i.order.currencyCode)),e.R7$(2),e.Y8G("ngIf",t.isSettled),e.R7$(),e.Y8G("ngIf",!t.isSettled),e.R7$(2),e.Y8G("order",i.order)("modification",t)}}function Uo(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.DNE(4,Bo,10,11,"div",25),e.bVm()),2&r){const t=e.XpG(2).$implicit,i=e.XpG();e.R7$(2),e.SpI(" ",e.bMT(3,2,"order.history-order-modified")," "),e.R7$(2),e.Y8G("ngIf",i.getModification(t.data.modificationId))}}function Jo(r,n){if(1&r&&(e.j41(0,"vdr-chip",35),e.EFF(1),e.nI1(2,"localeCurrency"),e.k0s()),2&r){const t=n.ngIf,i=e.XpG(5);e.R7$(),e.JRh(e.i5U(2,1,t.amount,i.order.currencyCode))}}function Ho(r,n){if(1&r&&(e.j41(0,"vdr-history-entry-detail"),e.nrm(1,"vdr-payment-detail",36),e.k0s()),2&r){const t=n.ngIf,i=e.XpG(5);e.R7$(),e.Y8G("payment",t)("currencyCode",i.order.currencyCode)}}function qo(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"div",26),e.DNE(5,Jo,3,4,"vdr-chip",33)(6,Ho,2,2,"vdr-history-entry-detail",34),e.k0s(),e.bVm()),2&r){const t=e.XpG(3).$implicit,i=e.XpG();e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.history-payment-settled")," "),e.R7$(3),e.Y8G("ngIf",i.getPayment(t)),e.R7$(),e.Y8G("ngIf",i.getPayment(t))}}function Wo(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r){let t;const i=e.XpG(3).$implicit,o=e.XpG();e.SpI(" ",e.i5U(1,1,"order.history-payment-transition",e.sMw(4,vt,i.data.from,i.data.to,null==(t=o.getPayment(i))?null:t.transactionId))," ")}}function Qo(r,n){if(1&r&&(e.qex(0),e.DNE(1,qo,7,5,"ng-container",32)(2,Wo,2,8,"ng-template",null,1,e.C5r),e.bVm()),2&r){const t=e.sdS(3),i=e.XpG(2).$implicit;e.R7$(),e.Y8G("ngIf","Settled"===i.data.to)("ngIfElse",t)}}function zo(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"div",26)(5,"vdr-chip",37),e.EFF(6),e.nI1(7,"localeCurrency"),e.k0s(),e.j41(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.nI1(10,"translate"),e.EFF(11),e.k0s(),e.j41(12,"vdr-labeled-data",38),e.nI1(13,"translate"),e.nrm(14,"vdr-simple-item-list",39),e.k0s()()(),e.bVm()),2&r){const t=n.ngIf,i=e.XpG(4).$implicit,o=e.XpG();e.R7$(2),e.Lme("",e.bMT(3,7,"order.refund")," #",t.id,""),e.R7$(4),e.JRh(e.i5U(7,9,t.total,o.order.currencyCode)),e.R7$(3),e.Y8G("label",e.bMT(10,12,"order.cancellation-reason")),e.R7$(2),e.SpI(" ",i.data.reason," "),e.R7$(),e.Y8G("label",e.bMT(13,14,"order.contents")),e.R7$(2),e.Y8G("items",o.getCancelledItems(t.lines))}}function Zo(r,n){if(1&r&&(e.qex(0),e.DNE(1,zo,15,16,"ng-container",34),e.bVm()),2&r){const t=e.XpG(3).$implicit,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.getRefund(t))}}function Ko(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r){const t=e.XpG(3).$implicit;e.SpI(" ",e.i5U(1,1,"order.history-refund-transition",e.sMw(4,vt,t.data.from,t.data.to,t.data.refundId))," ")}}function ea(r,n){if(1&r&&(e.qex(0),e.DNE(1,Zo,2,1,"ng-container",32)(2,Ko,2,8,"ng-template",null,2,e.C5r),e.bVm()),2&r){const t=e.sdS(3),i=e.XpG(2).$implicit;e.R7$(),e.Y8G("ngIf","Settled"===i.data.to)("ngIfElse",t)}}function ta(r,n){if(1&r&&(e.j41(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",38),e.nI1(2,"translate"),e.EFF(3),e.k0s(),e.j41(4,"vdr-labeled-data",38),e.nI1(5,"translate"),e.nrm(6,"vdr-simple-item-list",39),e.k0s(),e.j41(7,"vdr-labeled-data",38),e.nI1(8,"translate"),e.EFF(9),e.k0s()()),2&r){const t=n.ngIf,i=e.XpG(3).$implicit;e.R7$(),e.Y8G("label",e.bMT(2,6,"order.cancellation-reason")),e.R7$(2),e.SpI(" ",i.data.reason," "),e.R7$(),e.Y8G("label",e.bMT(5,8,"order.contents")),e.R7$(2),e.Y8G("items",t),e.R7$(),e.Y8G("label",e.bMT(8,10,"order.shipping-cancelled")),e.R7$(2),e.SpI(" ",i.data.shippingCancelled," ")}}function na(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.DNE(3,ta,10,12,"vdr-history-entry-detail",34),e.bVm()),2&r){const t=e.XpG(2).$implicit,i=e.XpG();e.R7$(),e.SpI(" ",e.i5U(2,2,"order.history-items-cancelled",e.eq3(5,Do,i.getCancelledQuantity(t)))," "),e.R7$(2),e.Y8G("ngIf",i.getCancelledItems(t.data.lines))}}function ra(r,n){if(1&r&&(e.j41(0,"vdr-history-entry-detail"),e.nrm(1,"vdr-fulfillment-detail",40),e.k0s()),2&r){const t=n.ngIf,i=e.XpG(4);e.R7$(),e.Y8G("fulfillmentId",t.id)("order",i.order)}}function ia(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.DNE(3,ra,2,2,"vdr-history-entry-detail",34),e.bVm()),2&r){const t=e.XpG(2).$implicit,i=e.XpG();e.R7$(),e.SpI(" ",e.bMT(2,2,"order.history-fulfillment-created")," "),e.R7$(2),e.Y8G("ngIf",i.getFulfillment(t))}}function oa(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.EFF(4),e.nI1(5,"translate"),e.bVm()),2&r){let t;const i=e.XpG(3).$implicit,o=e.XpG();e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.history-fulfillment-delivered")," "),e.R7$(2),e.Lme(" ",e.bMT(5,5,"order.tracking-code"),": ",null==(t=o.getFulfillment(i))?null:t.trackingCode," ")}}function aa(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.EFF(4),e.nI1(5,"translate"),e.bVm()),2&r){let t;const i=e.XpG(3).$implicit,o=e.XpG();e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.history-fulfillment-shipped")," "),e.R7$(2),e.Lme(" ",e.bMT(5,5,"order.tracking-code"),": ",null==(t=o.getFulfillment(i))?null:t.trackingCode," ")}}function la(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.bVm()),2&r){const t=e.XpG(3).$implicit;e.R7$(),e.SpI(" ",e.i5U(2,1,"order.history-fulfillment-transition",e.l_i(4,Ct,t.data.from,t.data.to))," ")}}function da(r,n){if(1&r&&(e.j41(0,"vdr-history-entry-detail"),e.nrm(1,"vdr-fulfillment-detail",40),e.k0s()),2&r){const t=n.ngIf,i=e.XpG(4);e.R7$(),e.Y8G("fulfillmentId",t.id)("order",i.order)}}function sa(r,n){if(1&r&&(e.qex(0),e.DNE(1,oa,6,7,"ng-container",34)(2,aa,6,7,"ng-container",34)(3,la,3,7,"ng-container",34)(4,da,2,2,"vdr-history-entry-detail",34),e.bVm()),2&r){const t=e.XpG(2).$implicit,i=e.XpG();e.R7$(),e.Y8G("ngIf","Delivered"===t.data.to),e.R7$(),e.Y8G("ngIf","Shipped"===t.data.to),e.R7$(),e.Y8G("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.R7$(),e.Y8G("ngIf",i.getFulfillment(t))}}function ca(r,n){1&r&&(e.j41(0,"span",53),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"common.public")))}function ma(r,n){1&r&&(e.j41(0,"span",54),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"common.private")))}function pa(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"div",41)(2,"div",42),e.DNE(3,ca,3,3,"span",43)(4,ma,3,3,"span",44),e.EFF(5),e.k0s(),e.nrm(6,"div",45),e.j41(7,"vdr-dropdown")(8,"button",46),e.nrm(9,"clr-icon",47),e.k0s(),e.j41(10,"vdr-dropdown-menu",48)(11,"button",49),e.nI1(12,"hasPermission"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2).$implicit,a=e.XpG();return e.Njj(a.updateNote.emit(o))}),e.nrm(13,"clr-icon",50),e.EFF(14),e.nI1(15,"translate"),e.k0s(),e.nrm(16,"div",51),e.j41(17,"button",49),e.nI1(18,"hasPermission"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2).$implicit,a=e.XpG();return e.Njj(a.deleteNote.emit(o))}),e.nrm(19,"clr-icon",52),e.EFF(20),e.nI1(21,"translate"),e.k0s()()()(),e.bVm()}if(2&r){const t=e.XpG(2).$implicit;e.R7$(3),e.Y8G("ngIf",t.isPublic),e.R7$(),e.Y8G("ngIf",!t.isPublic),e.R7$(),e.SpI(" ",t.data.note," "),e.R7$(6),e.Y8G("disabled",!e.bMT(12,7,"UpdateOrder")),e.R7$(3),e.SpI(" ",e.bMT(15,9,"common.edit")," "),e.R7$(3),e.Y8G("disabled",!e.bMT(18,11,"UpdateOrder")),e.R7$(3),e.SpI(" ",e.bMT(21,13,"common.delete")," ")}}function ua(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.j41(3,"vdr-chip")(4,"a",55),e.EFF(5),e.k0s()(),e.bVm()),2&r){const t=e.XpG(2).$implicit;e.R7$(),e.SpI(" ",e.bMT(2,3,"order.history-coupon-code-applied"),": "),e.R7$(3),e.Y8G("routerLink",e.eq3(5,$o,t.data.promotionId)),e.R7$(),e.JRh(t.data.couponCode)}}function _a(r,n){if(1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.j41(3,"vdr-chip")(4,"span",56),e.EFF(5),e.k0s()(),e.bVm()),2&r){const t=e.XpG(2).$implicit;e.R7$(),e.SpI(" ",e.bMT(2,2,"order.history-coupon-code-removed"),": "),e.R7$(4),e.JRh(t.data.couponCode)}}function fa(r,n){if(1&r&&(e.j41(0,"a",58),e.nrm(1,"clr-icon",59),e.j41(2,"span"),e.EFF(3),e.k0s(),e.nrm(4,"clr-icon",60),e.k0s()),2&r){const t=e.XpG(3).$implicit;e.Y8G("routerLink",e.eq3(2,yt,t.data.previousCustomerId)),e.R7$(3),e.JRh(t.data.previousCustomerName)}}function ga(r,n){if(1&r&&(e.j41(0,"a",58),e.nrm(1,"clr-icon",59),e.j41(2,"span"),e.EFF(3),e.k0s(),e.nrm(4,"clr-icon",60),e.k0s()),2&r){const t=e.XpG(3).$implicit;e.Y8G("routerLink",e.eq3(2,yt,t.data.newCustomerId)),e.R7$(3),e.JRh(t.data.newCustomerName)}}function ha(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.j41(4,"div",41)(5,"div",42),e.EFF(6),e.k0s(),e.nrm(7,"div",45),e.j41(8,"vdr-history-entry-detail")(9,"vdr-labeled-data",38),e.nI1(10,"translate"),e.DNE(11,fa,5,4,"a",57),e.k0s(),e.j41(12,"vdr-labeled-data",38),e.nI1(13,"translate"),e.DNE(14,ga,5,4,"a",57),e.k0s()()(),e.bVm()),2&r){const t=e.XpG(2).$implicit;e.R7$(2),e.SpI(" ",e.i5U(3,6,"order.history-customer-updated",e.eq3(13,jo,t.data.newCustomerName))," "),e.R7$(4),e.SpI(" ",t.data.note," "),e.R7$(3),e.Y8G("label",e.bMT(10,9,"order.previous-customer")),e.R7$(2),e.Y8G("ngIf",t.data.previousCustomerId),e.R7$(),e.Y8G("label",e.bMT(13,11,"order.new-customer")),e.R7$(2),e.Y8G("ngIf",t.data.newCustomerId)}}function ba(r,n){if(1&r&&(e.j41(0,"vdr-history-entry-detail"),e.nrm(1,"vdr-object-tree",61),e.k0s()),2&r){const t=e.XpG(3).$implicit;e.R7$(),e.Y8G("value",t.data)}}function Ca(r,n){if(1&r&&(e.qex(0),e.j41(1,"div",14),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.DNE(4,ba,2,1,"vdr-history-entry-detail",34),e.bVm()),2&r){const t=e.XpG(2).$implicit;e.R7$(2),e.SpI(" ",e.bMT(3,2,t.type)," "),e.R7$(2),e.Y8G("ngIf",t.data)}}function va(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-timeline-entry",19),e.bIt("expandClick",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.expanded=!o.expanded)}),e.qex(1,20),e.DNE(2,Ao,4,3,"ng-container",21)(3,Uo,5,4,"ng-container",21)(4,Qo,4,2,"ng-container",21)(5,ea,4,2,"ng-container",21)(6,na,4,7,"ng-container",21)(7,ia,4,4,"ng-container",21)(8,sa,5,4,"ng-container",21)(9,pa,22,15,"ng-container",21)(10,ua,6,7,"ng-container",21)(11,_a,6,4,"ng-container",21)(12,ha,15,15,"ng-container",21)(13,Ca,5,4,"ng-container",22),e.bVm(),e.k0s()}if(2&r){const t=e.XpG().$implicit,i=e.XpG();e.Y8G("displayType",i.getDisplayType(t))("iconShape",i.getTimelineIcon(t))("createdAt",t.createdAt)("name",i.getName(t))("featured",i.isFeatured(t))("collapsed",!i.expanded&&!i.isFeatured(t)),e.R7$(),e.Y8G("ngSwitch",t.type),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_STATE_TRANSITION),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_MODIFIED),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_PAYMENT_TRANSITION),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_REFUND_TRANSITION),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_CANCELLATION),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_FULFILLMENT),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_FULFILLMENT_TRANSITION),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_NOTE),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_COUPON_APPLIED),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_COUPON_REMOVED),e.R7$(),e.Y8G("ngSwitchCase",i.type.ORDER_CUSTOMER_UPDATED)}}function ya(r,n){if(1&r&&(e.qex(0),e.DNE(1,No,1,3,"vdr-order-history-entry-host",17)(2,va,14,18,"ng-template",null,0,e.C5r),e.bVm()),2&r){const t=n.$implicit,i=e.sdS(3),o=e.XpG();e.R7$(),e.Y8G("ngIf",o.hasCustomComponent(t.type))("ngIfElse",i)}}class xe{constructor(n){this.historyEntryComponentService=n,this.addNote=new e.bkB,this.updateNote=new e.bkB,this.deleteNote=new e.bkB,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=d.Htj}hasCustomComponent(n){return!!this.historyEntryComponentService.getComponent(n)}getDisplayType(n){if(n.type===d.Htj.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===d.Htj.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type!==d.Htj.ORDER_PAYMENT_TRANSITION||"Declined"!==n.data.to&&"Cancelled"!==n.data.to?n.type===d.Htj.ORDER_CANCELLATION||n.type===d.Htj.ORDER_REFUND_TRANSITION?"warning":"default":"error"}getTimelineIcon(n){if(n.type===d.Htj.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===d.Htj.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to||n.type===d.Htj.ORDER_REFUND_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===d.Htj.ORDER_NOTE?"note":n.type===d.Htj.ORDER_MODIFIED?"pencil":n.type===d.Htj.ORDER_CUSTOMER_UPDATED?"switch":n.type!==d.Htj.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case d.Htj.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case d.Htj.ORDER_REFUND_TRANSITION:return"Settled"===n.data.to;case d.Htj.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case d.Htj.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case d.Htj.ORDER_NOTE:case d.Htj.ORDER_MODIFIED:case d.Htj.ORDER_CUSTOMER_UPDATED:return!0;default:return!1}}getFulfillment(n){if((n.type===d.Htj.ORDER_FULFILLMENT||n.type===d.Htj.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===d.Htj.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getRefund(n){if(n.type===d.Htj.ORDER_REFUND_TRANSITION&&this.order.payments)return this.order.payments.reduce((i,o)=>i.concat(o.refunds),[]).find(i=>i.id===n.data.refundId)}getCancelledQuantity(n){return n.data.lines.reduce((t,i)=>t+i.quantity,0)}getCancelledItems(n){const t=new Map;for(const i of this.order.lines){const o=n.find(a=>a.orderLineId===i.id);if(o){t.get(i.productVariant.name);t.set(i.productVariant.name,o.quantity)}}return Array.from(t.entries()).map(([i,o])=>({name:i,quantity:o}))}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 i=this.order.customer;if(i)return`${i.firstName} ${i.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}static{this.\u0275fac=function(t){return new(t||xe)(e.rXU(d.HMZ))}}static{this.\u0275cmp=e.VBU({type:xe,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:20,vars:22,consts:[["defaultComponents",""],["regularPaymentTransition",""],["regularRefundTransition",""],[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured","isFirst"],[1,"note-entry"],["name","note",1,"note",3,"ngModelChange","ngModel"],[1,"btn","btn-secondary",3,"click","disabled"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModelChange","ngModel"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"order","entry","expanded","expandClick",4,"ngIf","ngIfElse"],[3,"expandClick","order","entry","expanded"],[3,"expandClick","displayType","iconShape","createdAt","name","featured","collapsed"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["class","title",4,"ngIf"],[3,"ngIf"],["class","flex items-center",4,"ngIf"],[1,"flex","items-center"],["colorType","success","class","mx-1",4,"ngIf"],["colorType","error","class","mx-1",4,"ngIf"],[3,"order","modification"],["colorType","success",1,"mx-1"],["colorType","error",1,"mx-1"],[4,"ngIf","ngIfElse"],["class","mr-1",4,"ngIf"],[4,"ngIf"],[1,"mr-1"],[3,"payment","currencyCode"],["colorType","warning",1,"mr-1"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"button-small","ml-1"],["shape","ellipsis-vertical","size","12"],["vdrPosition","bottom-right"],["vdrDropdownItem","",3,"click","disabled"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"],["class","button-ghost",3,"routerLink",4,"ngIf"],[1,"button-ghost",3,"routerLink"],["shape","user",1,"is-solid"],["shape","arrow right"],[3,"value"]],template:function(t,i){1&t&&(e.j41(0,"div",3)(1,"vdr-timeline-entry",4)(2,"div",5)(3,"textarea",6),e.mxI("ngModelChange",function(a){return e.DH7(i.note,a)||(i.note=a),a}),e.k0s(),e.j41(4,"button",7),e.bIt("click",function(){return i.addNoteToOrder()}),e.EFF(5),e.nI1(6,"translate"),e.k0s()(),e.j41(7,"div",8)(8,"clr-checkbox-wrapper")(9,"input",9),e.mxI("ngModelChange",function(a){return e.DH7(i.noteIsPrivate,a)||(i.noteIsPrivate=a),a}),e.k0s(),e.j41(10,"label"),e.EFF(11),e.nI1(12,"translate"),e.k0s()(),e.DNE(13,Eo,3,3,"span",10)(14,Po,3,3,"span",11),e.k0s()(),e.DNE(15,ya,4,2,"ng-container",12),e.j41(16,"vdr-timeline-entry",13)(17,"div",14),e.EFF(18),e.nI1(19,"translate"),e.k0s()()()),2&t&&(e.AVh("expanded",i.expanded),e.R7$(),e.Y8G("featured",!0)("isFirst",!0),e.R7$(2),e.R50("ngModel",i.note),e.R7$(),e.Y8G("disabled",!i.note),e.R7$(),e.SpI(" ",e.bMT(6,16,"common.add-note")," "),e.R7$(4),e.R50("ngModel",i.noteIsPrivate),e.R7$(2),e.JRh(e.bMT(12,18,"order.note-is-private")),e.R7$(2),e.Y8G("ngIf",i.noteIsPrivate),e.R7$(),e.Y8G("ngIf",!i.noteIsPrivate),e.R7$(),e.Y8G("ngForOf",i.history),e.R7$(),e.Y8G("isLast",!0)("createdAt",i.order.createdAt)("featured",!0),e.R7$(2),e.SpI(" ",e.bMT(19,20,"order.history-order-created")," "))},dependencies:[u.U4n,u.aZZ,u.Jej,u.eAx,c.Sq,c.bT,c.ux,c.e1,c.fG,l.me,l.Zm,l.BC,l.vS,M.Wk,k.w,h.V,W.P,Q.q,z.j,pe.M,C.B,ce.T,ht.r,Go.f,ee,re,X,Ce,Se,_.D9,bt.E,g.u],styles:["[_nghost-%COMP%]{display:block}.entry-list[_ngcontent-%COMP%]{margin-inline-start:calc(var(--space-unit) * 2)}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-700)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-inline-end:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap;max-width:580px}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-700)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-700)}"],changeDetection:0})}}var Ia=s(7605);const It=P.J1`
|
|
28
|
+
query GetSellerOrders($orderId: ID!) {
|
|
29
|
+
order(id: $orderId) {
|
|
30
|
+
id
|
|
31
|
+
sellerOrders {
|
|
32
|
+
id
|
|
33
|
+
code
|
|
34
|
+
state
|
|
35
|
+
orderPlacedAt
|
|
36
|
+
currencyCode
|
|
37
|
+
totalWithTax
|
|
38
|
+
channels {
|
|
39
|
+
id
|
|
40
|
+
code
|
|
41
|
+
seller {
|
|
42
|
+
id
|
|
43
|
+
name
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`,Ta=r=>["seller-orders",r];function Oa(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",5),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=n.ngIf;e.Y8G("label",e.bMT(1,2,"common.seller")),e.R7$(2),e.SpI(" ",t.name," ")}}function Fa(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",5),e.nI1(1,"translate"),e.EFF(2),e.nI1(3,"localeCurrency"),e.k0s()),2&r){const t=e.XpG().$implicit;e.Y8G("label",e.bMT(1,2,"order.total")),e.R7$(2),e.SpI(" ",e.i5U(3,4,t.totalWithTax,t.currencyCode)," ")}}function Ra(r,n){if(1&r&&(e.j41(0,"div")(1,"a",3),e.EFF(2),e.nrm(3,"clr-icon",4),e.k0s(),e.j41(4,"vdr-labeled-data",5),e.nI1(5,"translate"),e.nrm(6,"vdr-order-state-label",6),e.k0s(),e.DNE(7,Oa,3,4,"vdr-labeled-data",7)(8,Fa,4,7,"vdr-labeled-data",7),e.k0s()),2&r){const t=n.$implicit,i=e.XpG();e.R7$(),e.Y8G("routerLink",e.eq3(8,Ta,t.id)),e.R7$(),e.SpI("",t.code," "),e.R7$(2),e.Y8G("label",e.bMT(5,6,"order.state")),e.R7$(2),e.Y8G("state",t.state),e.R7$(),e.Y8G("ngIf",i.getSeller(t)),e.R7$(),e.Y8G("ngIf",i.getSeller(t))}}class Ge{constructor(n,t,i){this.router=n,this.dataService=t,this.channelService=i}ngOnInit(){this.sellerOrders$=this.dataService.query(It,{orderId:this.orderId}).mapSingle(({order:n})=>n?.sellerOrders??[])}getSeller(n){return n.channels.find(i=>i.code!==Ia.ky)?.seller}navigateToSellerOrder(n){this.router.navigate(["/orders",n.id])}static{this.\u0275fac=function(t){return new(t||Ge)(e.rXU(M.Ix),e.rXU(d.uSP),e.rXU(d.lhn))}}static{this.\u0275cmp=e.VBU({type:Ge,selectors:[["vdr-seller-orders-card"]],inputs:{orderId:"orderId"},decls:5,vars:6,consts:[[3,"title"],[1,"form-grid"],[4,"ngFor","ngForOf"],[1,"button-ghost","mb-1",3,"routerLink"],["shape","arrow right"],[3,"label"],[3,"state"],[3,"label",4,"ngIf"]],template:function(t,i){1&t&&(e.j41(0,"vdr-card",0),e.nI1(1,"translate"),e.j41(2,"div",1),e.DNE(3,Ra,9,10,"div",2),e.nI1(4,"async"),e.k0s()()),2&t&&(e.Y8G("title",e.bMT(1,2,"order.seller-orders")),e.R7$(3),e.Y8G("ngForOf",e.bMT(4,4,i.sellerOrders$)))},dependencies:[u.U4n,c.Sq,c.bT,M.Wk,Ee.F,C.B,T.i,c.Jj,_.D9,g.u],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}const Ma=r=>({state:r}),Sa=()=>["UpdateOrder","ReadCustomer"];function xa(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",10),e.bIt("click",function(){e.eBV(t);const o=e.XpG().ngIf,a=e.XpG();return e.Njj(a.addManualPayment(o))}),e.EFF(1),e.nI1(2,"translate"),e.nI1(3,"localeCurrency"),e.k0s()}if(2&r){const t=e.XpG().ngIf,i=e.XpG();e.R7$(),e.Lme(" ",e.bMT(2,2,"order.add-payment-to-order")," (",e.i5U(3,4,i.outstandingPaymentAmount(t),t.currencyCode),") ")}}function Ga(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",10),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.transitionToState("ArrangingAdditionalPayment"))}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.arrange-additional-payment")," "))}function ka(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",11),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.fulfillOrder())}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}if(2&r){const t=e.XpG().ngIf,i=e.XpG();e.Y8G("disabled",!i.canAddFulfillment(t)),e.R7$(),e.SpI(" ",e.bMT(2,2,"order.fulfill-order")," ")}}function Da(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"button",8),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.transitionToModifying())}),e.nrm(2,"clr-icon",12),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.nrm(5,"div",7),e.bVm()}2&r&&(e.R7$(3),e.SpI(" ",e.bMT(4,1,"order.modify-order")," "))}function $a(r,n){1&r&&(e.qex(0),e.EFF(1),e.nI1(2,"translate"),e.bVm()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.refund-and-cancel-order")," "))}function ja(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.SpI(" ",e.bMT(1,1,"order.cancel-order")," ")}function Ea(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",8),e.bIt("click",function(){e.eBV(t);const o=e.XpG().ngIf,a=e.XpG();return e.Njj(a.cancelOrRefund(o))}),e.nrm(1,"clr-icon",13),e.DNE(2,$a,3,3,"ng-container",14)(3,ja,2,3,"ng-template",null,0,e.C5r),e.k0s()}if(2&r){const t=e.sdS(4),i=e.XpG().ngIf,o=e.XpG();e.R7$(2),e.Y8G("ngIf",o.orderHasSettledPayments(i))("ngIfElse",t)}}function Pa(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",8),e.bIt("click",function(){const o=e.eBV(t).$implicit,a=e.XpG(3);return e.Njj(a.transitionToState(o))}),e.nrm(1,"clr-icon",16),e.EFF(2),e.nI1(3,"stateI18nToken"),e.nI1(4,"translate"),e.nI1(5,"translate"),e.k0s()}if(2&r){const t=n.$implicit;e.R7$(2),e.SpI(" ",e.i5U(5,5,"order.transition-to-state",e.eq3(8,Ma,e.bMT(4,3,e.bMT(3,1,t))))," ")}}function Na(r,n){if(1&r&&(e.qex(0),e.nrm(1,"div",7),e.DNE(2,Pa,6,10,"button",15),e.nI1(3,"async"),e.bVm()),2&r){const t=e.XpG(2);e.R7$(2),e.Y8G("ngForOf",e.bMT(3,1,t.nextStates$))}}function Ya(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-action-bar"),e.nrm(1,"vdr-ab-left"),e.j41(2,"vdr-ab-right"),e.nrm(3,"vdr-action-bar-items",2),e.DNE(4,xa,4,7,"button",3)(5,Ga,3,3,"button",3)(6,ka,3,4,"button",4),e.j41(7,"vdr-action-bar-dropdown-menu",5),e.DNE(8,Da,6,3,"ng-container",1)(9,Ea,5,2,"button",6)(10,Na,4,3,"ng-container",1),e.nI1(11,"async"),e.nrm(12,"div",7),e.j41(13,"button",8),e.bIt("click",function(){const o=e.eBV(t).ngIf,a=e.XpG();return e.Njj(a.manuallyTransitionToState(o))}),e.nrm(14,"clr-icon",9),e.EFF(15),e.nI1(16,"translate"),e.k0s()()()()}if(2&r){let t;const i=n.ngIf,o=e.XpG();e.R7$(4),e.Y8G("ngIf","Aggregate"!==i.type&&("ArrangingPayment"===i.state||"ArrangingAdditionalPayment"===i.state)&&(o.hasUnsettledModifications(i)||0<o.outstandingPaymentAmount(i))),e.R7$(),e.Y8G("ngIf","Aggregate"!==i.type&&!1===i.active&&"ArrangingAdditionalPayment"!==i.state&&"ArrangingPayment"!==i.state&&0<o.outstandingPaymentAmount(i)),e.R7$(),e.Y8G("ngIf","Aggregate"!==i.type),e.R7$(),e.Y8G("alwaysShow",!0),e.R7$(),e.Y8G("ngIf","Aggregate"!==i.type&&i.nextStates.includes("Modifying")),e.R7$(),e.Y8G("ngIf","Aggregate"!==i.type&&i.nextStates.includes("Cancelled")),e.R7$(),e.Y8G("ngIf",null==(t=e.bMT(11,8,o.nextStates$))?null:t.length),e.R7$(5),e.SpI(" ",e.bMT(16,10,"order.manually-transition-to-state")," ")}}function wa(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",33),e.nI1(1,"translate"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.openStateDiagram())}),e.nrm(2,"clr-icon",34),e.k0s()}2&r&&e.Y8G("title",e.bMT(1,1,"order.order-state-diagram"))}function Va(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",33),e.nI1(1,"translate"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(3);return e.Njj(o.setOrderCustomer())}),e.nrm(2,"clr-icon",36),e.k0s()}2&r&&e.Y8G("title",e.bMT(1,1,"order.assign-order-to-another-customer"))}function Aa(r,n){1&r&&e.DNE(0,Va,3,3,"button",35),2&r&&e.Y8G("vdrIfPermissions",e.lJ4(1,Sa))}function Xa(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",37),e.nI1(1,"translate"),e.nrm(2,"vdr-formatted-address",38),e.k0s()),2&r){const t=e.XpG().ngIf;e.Y8G("label",e.bMT(1,2,"order.shipping-address")),e.R7$(2),e.Y8G("address",t.shippingAddress)}}function La(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",39),e.nI1(1,"translate"),e.nrm(2,"vdr-formatted-address",38),e.k0s()),2&r){const t=e.XpG().ngIf;e.Y8G("label",e.bMT(1,2,"order.billing-address")),e.R7$(2),e.Y8G("address",t.billingAddress)}}function Ba(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-order-payment-card",41),e.bIt("settlePayment",function(o){e.eBV(t);const a=e.XpG(3);return e.Njj(a.settlePayment(o))})("transitionPaymentState",function(o){e.eBV(t);const a=e.XpG(3);return e.Njj(a.transitionPaymentState(o))})("settleRefund",function(o){e.eBV(t);const a=e.XpG(3);return e.Njj(a.settleRefund(o))}),e.k0s()}if(2&r){const t=n.$implicit,i=e.XpG(2).ngIf;e.Y8G("currencyCode",i.currencyCode)("payment",t)}}function Ua(r,n){if(1&r&&(e.j41(0,"vdr-card",17),e.nI1(1,"translate"),e.DNE(2,Ba,1,2,"vdr-order-payment-card",40),e.k0s()),2&r){const t=e.XpG().ngIf;e.Y8G("title",e.bMT(1,2,"order.payments")),e.R7$(2),e.Y8G("ngForOf",t.payments)}}function Ja(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-fulfillment-card",43),e.bIt("transitionState",function(o){const a=e.eBV(t).$implicit,m=e.XpG(3);return e.Njj(m.transitionFulfillment(a.id,o))}),e.k0s()}if(2&r){const t=n.$implicit,i=e.XpG(2).ngIf;e.Y8G("fulfillment",t)("order",i)}}function Ha(r,n){if(1&r&&(e.j41(0,"vdr-card"),e.DNE(1,Ja,1,2,"vdr-fulfillment-card",42),e.k0s()),2&r){const t=e.XpG().ngIf;e.R7$(),e.Y8G("ngForOf",t.fulfillments)}}function qa(r,n){if(1&r&&e.nrm(0,"vdr-page-entity-info",44),2&r){const t=n.ngIf;e.Y8G("entity",t)}}function Wa(r,n){if(1&r&&e.nrm(0,"vdr-seller-orders-card",45),2&r){const t=e.XpG().ngIf;e.Y8G("orderId",t.id)}}function Qa(r,n){if(1&r&&(e.j41(0,"tr")(1,"td"),e.EFF(2),e.k0s(),e.j41(3,"td"),e.EFF(4),e.nI1(5,"percent"),e.k0s(),e.j41(6,"td"),e.EFF(7),e.nI1(8,"localeCurrency"),e.k0s(),e.j41(9,"td"),e.EFF(10),e.nI1(11,"localeCurrency"),e.k0s()()),2&r){const t=n.$implicit,i=e.XpG().ngIf;e.R7$(2),e.JRh(t.description),e.R7$(2),e.JRh(e.i5U(5,4,t.taxRate/100,"0.0-2")),e.R7$(3),e.JRh(e.i5U(8,7,t.taxBase,i.currencyCode)),e.R7$(3),e.JRh(e.i5U(11,10,t.taxTotal,i.currencyCode))}}function za(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-card",17),e.nI1(1,"translate"),e.nrm(2,"vdr-tabbed-custom-fields",46),e.nI1(3,"hasPermission"),e.j41(4,"button",47),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.updateCustomFields())}),e.EFF(5),e.nI1(6,"translate"),e.k0s()()}if(2&r){let t;const i=e.XpG(2);e.Y8G("title",e.bMT(1,6,"common.custom-fields")),e.R7$(2),e.Y8G("customFields",i.customFields)("customFieldsFormGroup",i.detailForm.get("customFields"))("readonly",!e.bMT(3,8,"UpdateOrder")),e.R7$(2),e.Y8G("disabled",(null==(t=i.detailForm.get("customFields"))?null:t.pristine)||(null==(t=i.detailForm.get("customFields"))?null:t.invalid)),e.R7$(),e.SpI(" ",e.bMT(6,10,"common.update")," ")}}function Za(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",17),e.nI1(3,"translate"),e.DNE(4,wa,3,3,"ng-template",18),e.nrm(5,"vdr-order-state-label",19),e.k0s(),e.j41(6,"vdr-card",17),e.nI1(7,"translate"),e.DNE(8,Aa,1,2,"ng-template",18),e.nrm(9,"vdr-customer-label",20),e.DNE(10,Xa,3,4,"vdr-labeled-data",21)(11,La,3,4,"vdr-labeled-data",22),e.k0s(),e.DNE(12,Ua,3,4,"vdr-card",23)(13,Ha,2,1,"vdr-card",1),e.j41(14,"vdr-card"),e.DNE(15,qa,1,1,"vdr-page-entity-info",24),e.nI1(16,"async"),e.k0s()(),e.j41(17,"vdr-page-block"),e.DNE(18,Wa,1,1,"vdr-seller-orders-card",25),e.j41(19,"vdr-card",26),e.nrm(20,"vdr-order-table",27),e.k0s(),e.j41(21,"vdr-card",28),e.nI1(22,"translate"),e.j41(23,"table",29)(24,"thead")(25,"tr")(26,"th"),e.EFF(27),e.nI1(28,"translate"),e.k0s(),e.j41(29,"th"),e.EFF(30),e.nI1(31,"translate"),e.k0s(),e.j41(32,"th"),e.EFF(33),e.nI1(34,"translate"),e.k0s(),e.j41(35,"th"),e.EFF(36),e.nI1(37,"translate"),e.k0s()()(),e.j41(38,"tbody"),e.DNE(39,Qa,12,13,"tr",30),e.k0s()()(),e.DNE(40,za,7,12,"vdr-card",23),e.nrm(41,"vdr-custom-detail-component-host",31),e.j41(42,"vdr-card",17),e.nI1(43,"translate"),e.j41(44,"vdr-order-history",32),e.nI1(45,"async"),e.bIt("addNote",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.addNote(o))})("updateNote",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.updateNote(o))})("deleteNote",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.deleteNote(o))}),e.k0s()()()()}if(2&r){const t=n.ngIf,i=e.XpG();e.R7$(2),e.Y8G("title",e.bMT(3,26,"order.state")),e.R7$(3),e.Y8G("state",t.state),e.R7$(),e.Y8G("title",e.bMT(7,28,"order.customer")),e.R7$(3),e.Y8G("customer",t.customer),e.R7$(),e.Y8G("ngIf",i.getOrderAddressLines(t.shippingAddress).length),e.R7$(),e.Y8G("ngIf",i.getOrderAddressLines(t.billingAddress).length),e.R7$(),e.Y8G("ngIf",null==t.payments?null:t.payments.length),e.R7$(),e.Y8G("ngIf",null==t.fulfillments?null:t.fulfillments.length),e.R7$(2),e.Y8G("ngIf",e.bMT(16,30,i.entity$)),e.R7$(3),e.Y8G("ngIf",t.sellerOrders.length),e.R7$(),e.Y8G("paddingX",!1),e.R7$(),e.Y8G("order",t)("orderLineCustomFields",i.orderLineCustomFields),e.R7$(),e.Y8G("title",e.bMT(22,32,"order.tax-summary"))("paddingX",!1),e.R7$(6),e.JRh(e.bMT(28,34,"common.description")),e.R7$(3),e.JRh(e.bMT(31,36,"order.tax-rate")),e.R7$(3),e.JRh(e.bMT(34,38,"order.tax-base")),e.R7$(3),e.JRh(e.bMT(37,40,"order.tax-total")),e.R7$(3),e.Y8G("ngForOf",t.taxSummary),e.R7$(),e.Y8G("ngIf",i.customFields.length),e.R7$(),e.Y8G("entity$",i.entity$)("detailForm",i.detailForm),e.R7$(),e.Y8G("title",e.bMT(43,42,"order.order-history")),e.R7$(2),e.Y8G("order",t)("history",e.bMT(45,44,i.history$))}}const Ka=P.J1`
|
|
50
|
+
query OrderDetailQuery($id: ID!) {
|
|
51
|
+
order(id: $id) {
|
|
52
|
+
...OrderDetail
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
${d.kQx}
|
|
56
|
+
`,el=P.J1`
|
|
57
|
+
mutation SetOrderCustomer($input: SetOrderCustomerInput!) {
|
|
58
|
+
setOrderCustomer(input: $input) {
|
|
59
|
+
id
|
|
60
|
+
customer {
|
|
61
|
+
id
|
|
62
|
+
firstName
|
|
63
|
+
lastName
|
|
64
|
+
emailAddress
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`;class ke extends d.wi7{constructor(n,t,i,o,a,m){super(),this.changeDetector=n,this.dataService=t,this.notificationService=i,this.modalService=o,this.orderTransitionService=a,this.formBuilder=m,this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.detailForm=new l.gE({customFields:this.formBuilder.group((0,d.HCD)(this.customFields))}),this.fetchHistory=new B.B,this.defaultStates=["AddingItems","ArrangingPayment","PaymentAuthorized","PaymentSettled","PartiallyShipped","Shipped","PartiallyDelivered","Delivered","Cancelled","Modifying","ArrangingAdditionalPayment"]}ngOnInit(){this.init(),this.entity$.pipe((0,D.s)(1)).subscribe(n=>{"Modifying"===n.state&&this.router.navigate(["./","modify"],{relativeTo:this.route})}),this.history$=this.fetchHistory.pipe((0,nt.Z)(null),(0,f.n)(()=>this.dataService.order.getOrderHistory(this.id,{sort:{createdAt:d.xBQ.DESC}}).mapStream(n=>n.order?.history.items))),this.nextStates$=this.entity$.pipe((0,R.T)(n=>this.defaultStates.includes(n.state)?n.nextStates.filter(i=>!this.defaultStates.includes(i)):n.nextStates))}ngOnDestroy(){this.destroy()}openStateDiagram(){this.entity$.pipe((0,D.s)(1),(0,f.n)(n=>this.modalService.fromComponent(Ie,{closable:!0,locals:{activeState:n.state}}))).subscribe()}setOrderCustomer(){this.modalService.fromComponent(H,{locals:{canCreateNew:!1,includeNoteInput:!0,title:(0,p.x)("order.assign-order-to-another-customer")}}).pipe((0,f.n)(n=>function t(i){return"object"==typeof i&&!!i.id}(n)?this.dataService.mutate(d.GO4,{input:{customerId:n.id,orderId:this.id,note:n.note}}):$.w),(0,f.n)(n=>this.refetchOrder(n))).subscribe(n=>{n&&this.notificationService.success((0,p.x)("order.set-customer-success"))})}transitionToState(n){this.dataService.order.transitionToState(this.id,n).subscribe(({transitionOrderToState:t})=>{switch(t?.__typename){case"Order":this.notificationService.success((0,p.x)("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,p.x)("order.manually-transition-to-state-message"),retry:0}).subscribe()}transitionToModifying(){this.dataService.order.transitionToState(this.id,"Modifying").subscribe(({transitionOrderToState:n})=>{switch(n?.__typename){case"Order":this.router.navigate(["./modify"],{relativeTo:this.route});break;case"OrderStateTransitionError":this.notificationService.error(n.transitionError)}})}updateCustomFields(){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:this.detailForm.value.customFields}).subscribe(()=>{this.notificationService.success((0,p.x)("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,p.x)("order.settle-payment-success")):this.notificationService.error((0,p.x)("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:i})=>{switch(i.__typename){case"Payment":this.notificationService.success((0,p.x)("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(i.transitionError);break;case"CancelPaymentError":this.notificationService.error(i.paymentErrorMessage)}}):this.dataService.order.transitionPaymentToState(n.id,t).subscribe(({transitionPaymentToState:i})=>{switch(i.__typename){case"Payment":this.notificationService.success((0,p.x)("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(i.message)}})}canAddFulfillment(n){const t=(n.fulfillments??[]).filter(o=>"Cancelled"!==o.state).reduce((o,a)=>[...o,...a.lines],[]);let i=!0;for(const o of n.lines)t.filter(m=>m.orderLineId===o.id).reduce((m,O)=>m+O.quantity,0)<o.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,b.summate)(n.modifications.filter(t=>!t.isSettled),"priceChange")}outstandingPaymentAmount(n){const t=o=>"Cancelled"!==o.state&&"Declined"!==o.state&&"Error"!==o.state;let i=0;for(const o of n.payments?.filter(t)??[]){const a=o.refunds.filter(O=>"Failed"!==O.state)??[],m=(0,b.summate)(a,"total");i+=o.amount-m}return n.totalWithTax-i}addManualPayment(n){const t=n.state;this.modalService.fromComponent(ae,{closable:!0,locals:{outstandingAmount:this.outstandingPaymentAmount(n),currencyCode:n.currencyCode}}).pipe((0,f.n)(i=>i?this.dataService.order.addManualPaymentToOrder({orderId:this.id,transactionId:i.transactionId,method:i.method,metadata:i.metadata||{}}):$.w),(0,f.n)(({addManualPaymentToOrder:i})=>{switch(i.__typename){case"Order":return this.notificationService.success((0,p.x)("order.add-payment-to-order-success")),"ArrangingAdditionalPayment"===t?this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates):(0,v.of)("PaymentSettled");case"ManualPaymentStateError":return this.notificationService.error(i.message),$.w;default:return $.w}})).subscribe(i=>{i&&this.refetchOrder({result:i})})}fulfillOrder(){this.entity$.pipe((0,D.s)(1),(0,f.n)(n=>this.modalService.fromComponent(ge,{size:"xl",locals:{order:n}})),(0,f.n)(n=>n?this.dataService.order.createFulfillment(n):(0,v.of)(void 0)),(0,f.n)(n=>this.refetchOrder(n).pipe((0,ft.u)(n)))).subscribe(n=>{if(n){const{addFulfillmentToOrder:t}=n;switch(t.__typename){case"Fulfillment":this.notificationService.success((0,p.x)("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,b.assertNever)(t)}}})}transitionFulfillment(n,t){this.dataService.order.transitionFulfillmentToState(n,t).pipe((0,f.n)(i=>this.refetchOrder(i))).subscribe(()=>{this.notificationService.success((0,p.x)("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(Oe,{size:"md",locals:{refund:n}}).pipe((0,f.n)(t=>t?this.dataService.order.settleRefund({transactionId:t,id:n.id},this.id):(0,v.of)(void 0))).subscribe(t=>{t&&this.notificationService.success((0,p.x)("order.settle-refund-success"))})}addNote(n){const{note:t,isPublic:i}=n;this.dataService.order.addNoteToOrder({id:this.id,note:t,isPublic:i}).pipe((0,f.n)(o=>this.refetchOrder(o))).subscribe(o=>{this.notificationService.success((0,p.x)("common.notify-create-success"),{entity:"Note"})})}updateNote(n){this.modalService.fromComponent(d.MR8,{closable:!0,locals:{displayPrivacyControls:!0,note:n.data.note,noteIsPrivate:!n.isPublic}}).pipe((0,f.n)(t=>t?this.dataService.order.updateOrderNote({noteId:n.id,isPublic:!t.isPrivate,note:t.note}):$.w)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,p.x)("common.notify-update-success"),{entity:"Note"})})}deleteNote(n){return this.modalService.dialog({title:(0,p.x)("common.confirm-delete-note"),body:n.data.note,buttons:[{type:"secondary",label:(0,p.x)("common.cancel")},{type:"danger",label:(0,p.x)("common.delete"),returnValue:!0}]}).pipe((0,f.n)(t=>t?this.dataService.order.deleteOrderNote(n.id):$.w)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,p.x)("common.notify-delete-success"),{entity:"Note"})})}orderHasSettledPayments(n){return!!n.payments?.find(t=>"Settled"===t.state)}cancelOrder(n){this.modalService.fromComponent(le,{size:"xl",locals:{order:n}}).pipe((0,f.n)(t=>t?this.dataService.order.cancelOrder(t):(0,v.of)(void 0)),(0,f.n)(t=>this.refetchOrder(t))).subscribe(t=>{t&&this.notificationService.success((0,p.x)("order.cancelled-order-success"))})}refundOrder(n){this.modalService.fromComponent(Te,{size:"xl",locals:{order:n}}).pipe((0,f.n)(t=>t?t.cancel.lines?.length?this.dataService.order.cancelOrder(t.cancel).pipe((0,R.T)(i=>{const o=i.cancelOrder;switch(o.__typename){case"Order":return this.refetchOrder(o).subscribe(),this.notificationService.success((0,p.x)("order.cancelled-order-items-success"),{count:(0,b.summate)(t.cancel.lines,"quantity")}),t;case"CancelActiveOrderError":case"QuantityTooGreatError":case"MultipleOrderError":case"OrderStateTransitionError":case"EmptyOrderLineSelectionError":return void this.notificationService.error(o.message)}})):[t]:(0,v.of)(void 0)),(0,f.n)(t=>t?t.refunds.length?(0,Gi.p)(t.refunds.map(i=>this.dataService.order.refundOrder(i).pipe((0,R.T)(o=>o.refundOrder)))):[void 0]:(0,v.of)(void 0))).subscribe(t=>{for(const i of t??[])if(i)switch(i.__typename){case"Refund":"Failed"===i.state?this.notificationService.error((0,p.x)("order.refund-order-failed")):this.notificationService.success((0,p.x)("order.refund-order-success"));break;case"AlreadyRefundedError":case"NothingToRefundError":case"PaymentOrderMismatchError":case"RefundOrderStateError":case"RefundStateTransitionError":this.notificationService.error(i.message)}this.refetchOrder(t?.[0]).subscribe()})}refetchOrder(n){return this.fetchHistory.next(),n?this.dataService.order.getOrder(this.id).single$:(0,v.of)(void 0)}setFormValues(n){this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customFields"]),n)}static{this.\u0275fac=function(t){return new(t||ke)(e.rXU(e.gRc),e.rXU(d.uSP),e.rXU(d.JEu),e.rXU(d.Bg8),e.rXU(E),e.rXU(l.ok))}}static{this.\u0275cmp=e.VBU({type:ke,selectors:[["vdr-order-detail"]],features:[e.Vt3],decls:5,vars:6,consts:[["cancelOnly",""],[4,"ngIf"],["locationId","order-detail"],["class","button primary mr-1",3,"click",4,"ngIf"],["class","button primary mr-1",3,"disabled","click",4,"ngIf"],["locationId","order-detail",3,"alwaysShow"],["type","button","vdrDropdownItem","",3,"click",4,"ngIf"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",3,"click"],["shape","step-forward-2",1,"is-warning"],[1,"button","primary","mr-1",3,"click"],[1,"button","primary","mr-1",3,"click","disabled"],["shape","pencil"],["shape","error-standard",1,"is-error"],[4,"ngIf","ngIfElse"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["shape","step-forward-2"],[3,"title"],["vdrCardControls",""],[3,"state"],[3,"customer"],["class","mt-2",3,"label",4,"ngIf"],[3,"label",4,"ngIf"],[3,"title",4,"ngIf"],[3,"entity",4,"ngIf"],["class","mb-2",3,"orderId",4,"ngIf"],[3,"paddingX"],[3,"order","orderLineCustomFields"],[3,"title","paddingX"],[1,"table"],[4,"ngFor","ngForOf"],["locationId","order-detail",3,"entity$","detailForm"],[3,"addNote","updateNote","deleteNote","order","history"],[1,"button-small",3,"click","title"],["shape","list"],["class","button-small",3,"title","click",4,"vdrIfPermissions"],["shape","switch"],[1,"mt-2",3,"label"],[1,"mt-1",3,"address"],[3,"label"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund",4,"ngFor","ngForOf"],[3,"settlePayment","transitionPaymentState","settleRefund","currencyCode","payment"],[3,"fulfillment","order","transitionState",4,"ngFor","ngForOf"],[3,"transitionState","fulfillment","order"],[3,"entity"],[1,"mb-2",3,"orderId"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly"],[1,"button","primary",2,"margin-top","1rem",3,"click","disabled"]],template:function(t,i){1&t&&(e.j41(0,"vdr-page-block"),e.DNE(1,Ya,17,12,"vdr-action-bar",1),e.nI1(2,"async"),e.k0s(),e.DNE(3,Za,46,46,"vdr-page-detail-layout",1),e.nI1(4,"async")),2&t&&(e.R7$(),e.Y8G("ngIf",e.bMT(2,2,i.entity$)),e.R7$(2),e.Y8G("ngIf",e.bMT(4,4,i.entity$)))},dependencies:[u.U4n,c.Sq,c.bT,I.nG,I.wL,I.TX,Ae.l,Xe.E,pe.M,Ee.F,se.W,C.B,gt.p,Le.T,ct.W,dt.L,Pe.e,st.E,Be.c,Ue.e,T.i,T.a,Me,xe,be,A,Ge,c.Jj,c.m1,_.D9,bt.E,j.p,g.u],styles:[".shipping-address[_ngcontent-%COMP%]{list-style-type:none;line-height:1.3em}.order-cards[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{margin-top:6px;color:var(--color-text-200)}vdr-order-payment-card[_ngcontent-%COMP%] + vdr-order-payment-card[_ngcontent-%COMP%]{margin-top:calc(var(--space-unit) * 2)}"],changeDetection:0})}}var tl=s(5517),Tt=s(4361),nl=s(8422);const ze=r=>({count:r});function rl(r,n){if(1&r&&(e.j41(0,"div",4),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.SpI(" ",t," ")}}function il(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.DNE(2,rl,2,1,"div",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.i5U(1,2,"order.modification-adjusting-lines",e.eq3(5,ze,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))),e.R7$(2),e.Y8G("ngForOf",t.adjustedLines)}}function ol(r,n){if(1&r&&(e.j41(0,"div"),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.Lme(" ",t.productVariant.name," x ",t.quantity," ")}}function al(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.DNE(2,ol,2,2,"div",5),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.i5U(1,2,"order.modification-adding-items",e.eq3(5,ze,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))),e.R7$(2),e.Y8G("ngForOf",t.addedLines)}}function ll(r,n){if(1&r&&(e.j41(0,"div",4),e.EFF(1),e.nI1(2,"localeCurrency"),e.k0s()),2&r){const t=n.$implicit,i=e.XpG(2);e.R7$(),e.Lme(" ",t.description,": ",e.i5U(2,2,t.price,i.orderSnapshot.currencyCode)," ")}}function dl(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.DNE(2,ll,3,5,"div",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.i5U(1,2,"order.modification-adding-surcharges",e.eq3(5,ze,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))),e.R7$(2),e.Y8G("ngForOf",t.modifyOrderInput.surcharges)}}function sl(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=n.ngIf;e.Y8G("label",e.bMT(1,2,"order.modification-updating-shipping-address")),e.R7$(2),e.SpI(" ",t,"\n")}}function cl(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=n.ngIf;e.Y8G("label",e.bMT(1,2,"order.modification-updating-billing-address")),e.R7$(2),e.SpI(" ",t,"\n")}}function ml(r,n){if(1&r&&(e.j41(0,"div",4),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.JRh(t)}}function pl(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.DNE(2,ml,2,1,"div",3),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.set-coupon-codes")),e.R7$(2),e.Y8G("ngForOf",t.couponCodeChanges)}}function ul(r,n){if(1&r&&(e.j41(0,"div",4),e.EFF(1),e.k0s()),2&r){const t=n.$implicit;e.R7$(),e.JRh(t)}}function _l(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",2),e.nI1(1,"translate"),e.DNE(2,ul,2,1,"div",3),e.k0s()),2&r){const t=e.XpG().ngIf;e.Y8G("label",e.bMT(1,2,"order.shipping-method")),e.R7$(2),e.Y8G("ngForOf",t)}}function fl(r,n){if(1&r&&(e.qex(0),e.DNE(1,_l,3,4,"vdr-labeled-data",0),e.bVm()),2&r){const t=n.ngIf;e.R7$(),e.Y8G("ngIf",t.length)}}class ie{get adjustedLines(){return(this.modifyOrderInput.adjustOrderLines||[]).map(n=>{const t=this.orderSnapshot.lines.find(i=>i.id===n.orderLineId);if(t){const i=n.quantity-t.quantity;return i?`${0===i?"":i>0?"+":"-"}${Math.abs(i)} ${t.productVariant.name}`:t.productVariant.name}}).filter(b.notNullOrUndefined)}getModifiedFields(n){return n.dirty?Object.entries(n.controls).map(([t,i])=>{if(i.dirty)return t}).filter(b.notNullOrUndefined).join(", "):""}getUpdatedShippingMethodLines(){return Object.entries(this.updatedShippingMethods||{}).map(([n,t])=>{const i=this.orderSnapshot.shippingLines.find(m=>m.id===n);if(!i)return;return`${i.shippingMethod.name||i.shippingMethod.code} -> ${t.name||t.code}`}).filter(b.notNullOrUndefined)}get couponCodeChanges(){const n=this.orderSnapshot.couponCodes||[],t=this.couponCodesControl.value||[];return[...t.filter(a=>!n.includes(a)).map(a=>`+ ${a}`),...n.filter(a=>!t.includes(a)).map(a=>`- ${a}`)]}static{this.\u0275fac=function(t){return new(t||ie)}}static{this.\u0275cmp=e.VBU({type:ie,selectors:[["vdr-order-modification-summary"]],inputs:{orderSnapshot:"orderSnapshot",modifyOrderInput:"modifyOrderInput",addedLines:"addedLines",shippingAddressForm:"shippingAddressForm",billingAddressForm:"billingAddressForm",updatedShippingMethods:"updatedShippingMethods",couponCodesControl:"couponCodesControl"},decls:7,vars:7,consts:[[3,"label",4,"ngIf"],[4,"ngIf"],[3,"label"],["class","mb-1",4,"ngFor","ngForOf"],[1,"mb-1"],[4,"ngFor","ngForOf"]],template:function(t,i){1&t&&e.DNE(0,il,3,7,"vdr-labeled-data",0)(1,al,3,7,"vdr-labeled-data",0)(2,dl,3,7,"vdr-labeled-data",0)(3,sl,3,4,"vdr-labeled-data",0)(4,cl,3,4,"vdr-labeled-data",0)(5,pl,3,4,"vdr-labeled-data",0)(6,fl,2,1,"ng-container",1),2&t&&(e.Y8G("ngIf",null==i.modifyOrderInput.adjustOrderLines?null:i.modifyOrderInput.adjustOrderLines.length),e.R7$(),e.Y8G("ngIf",null==i.modifyOrderInput.addItems?null:i.modifyOrderInput.addItems.length),e.R7$(),e.Y8G("ngIf",null==i.modifyOrderInput.surcharges?null:i.modifyOrderInput.surcharges.length),e.R7$(),e.Y8G("ngIf",i.getModifiedFields(i.shippingAddressForm)),e.R7$(),e.Y8G("ngIf",i.getModifiedFields(i.billingAddressForm)),e.R7$(),e.Y8G("ngIf",i.couponCodeChanges.length),e.R7$(),e.Y8G("ngIf",i.getUpdatedShippingMethodLines()))},dependencies:[c.Sq,c.bT,C.B,_.D9,g.u],changeDetection:0})}}function gl(r,n){1&r&&(e.EFF(0),e.nI1(1,"translate")),2&r&&e.JRh(e.bMT(1,1,"order.confirm-modifications"))}function hl(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-payment-for-refund-selector",10),e.bIt("paymentSelected",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.onPaymentSelected(o.payment,o.selected))}),e.k0s()}if(2&r){const t=e.XpG();e.Y8G("refundablePayments",t.refundablePayments)("order",t.order)}}function bl(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-form-field",7),e.nI1(1,"translate"),e.j41(2,"textarea",11),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.refundNote,o)||(a.refundNote=o),e.Njj(o)}),e.k0s()()}if(2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.refund-cancellation-reason")),e.R7$(2),e.R50("ngModel",t.refundNote)}}function Cl(r,n){1&r&&(e.j41(0,"clr-alert",18)(1,"clr-alert-item"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&r&&(e.Y8G("clrAlertType","danger")("clrAlertClosable",!1),e.R7$(2),e.SpI(" ",e.bMT(3,3,"order.refund-total-warning")," "))}function vl(r,n){if(1&r){const t=e.RV6();e.j41(0,"div")(1,"div",12),e.DNE(2,Cl,4,5,"clr-alert",13),e.k0s(),e.j41(3,"div",14)(4,"clr-alert",15)(5,"clr-alert-item"),e.EFF(6),e.nI1(7,"translate"),e.nI1(8,"localeCurrency"),e.k0s()(),e.j41(9,"button",16),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.cancel())}),e.EFF(10),e.nI1(11,"translate"),e.k0s(),e.j41(12,"button",17),e.bIt("click",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.submit())}),e.EFF(13),e.nI1(14,"translate"),e.k0s()()()}if(2&r){const t=e.XpG();e.R7$(2),e.Y8G("ngIf",t.priceDifference<0&&!t.refundsCoverDifference()),e.R7$(2),e.Y8G("clrAlertType","primary")("clrAlertClosable",!1),e.R7$(2),e.E5c(" ",e.bMT(7,9,"order.modify-order-price-difference")," ",0<t.priceDifference?"+":"","",e.i5U(8,11,t.priceDifference,t.order.currencyCode)," "),e.R7$(4),e.SpI(" ",e.bMT(11,14,"common.cancel")," "),e.R7$(2),e.Y8G("disabled",t.priceDifference<0&&!t.refundsCoverDifference()),e.R7$(),e.SpI(" ",e.bMT(14,16,"common.confirm")," ")}}var S,r;(r=S||(S={}))[r.Refund=0]="Refund",r[r.Payment=1]="Payment",r[r.PriceUnchanged=2]="PriceUnchanged",r[r.Cancel=3]="Cancel";class De{get priceDifference(){return this.order.totalWithTax-this.orderSnapshot.totalWithTax}get amountToRefundTotal(){return this.refundablePayments.reduce((n,t)=>n+t.amountToRefundControl.value,0)}ngOnInit(){this.refundNote=this.modifyOrderInput.note||"",this.refundablePayments=we(this.order.payments||[]),this.refundablePayments.forEach(n=>{n.amountToRefundControl.addValidators(l.k0.max(-1*this.priceDifference))}),this.priceDifference<0&&this.refundablePayments.length&&this.onPaymentSelected(this.refundablePayments[0],!0)}onPaymentSelected(n,t){if(t){const i=-1*this.priceDifference-this.refundablePayments.filter(o=>o.id!==n.id).reduce((o,a)=>o+a.amountToRefundControl.value,0);0<i&&n.amountToRefundControl.setValue(Math.min(i,n.refundableAmount))}else n.amountToRefundControl.setValue(0)}refundsCoverDifference(){return-1*this.priceDifference===this.amountToRefundTotal}cancel(){this.resolveWith({result:S.Cancel})}submit(){0<this.priceDifference?this.resolveWith({result:S.Payment}):this.priceDifference<0?this.resolveWith({result:S.Refund,refunds:this.refundablePayments.filter(n=>n.selected&&0<n.amountToRefundControl.value).map(n=>({reason:this.refundNote||this.modifyOrderInput.note,paymentId:n.id,amount:n.amountToRefundControl.value}))}):this.resolveWith({result:S.PriceUnchanged})}static{this.\u0275fac=function(t){return new(t||De)}}static{this.\u0275cmp=e.VBU({type:De,selectors:[["vdr-order-edits-preview-dialog"]],decls:14,vars:18,consts:[["vdrDialogTitle",""],[1,"order-edits-preview-table",3,"order","orderLineCustomFields"],[1,"payments-wrapper","mb-2"],[1,"flex-spacer"],["class","",3,"refundablePayments","order","paymentSelected",4,"ngIf"],[3,"title"],[3,"orderSnapshot","modifyOrderInput","addedLines","shippingAddressForm","billingAddressForm","couponCodesControl","updatedShippingMethods"],[3,"label"],[3,"label",4,"ngIf"],["vdrDialogButtons",""],[1,"",3,"paymentSelected","refundablePayments","order"],["name","refundNote","required","",3,"ngModelChange","ngModel"],[1,"errors"],["class","mb-1",3,"clrAlertType","clrAlertClosable",4,"ngIf"],[1,"modal-buttons"],[1,"",3,"clrAlertType","clrAlertClosable"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"click","disabled"],[1,"mb-1",3,"clrAlertType","clrAlertClosable"]],template:function(t,i){1&t&&(e.DNE(0,gl,2,3,"ng-template",0),e.nrm(1,"vdr-order-table",1),e.j41(2,"div",2)(3,"div",3),e.DNE(4,hl,1,2,"vdr-payment-for-refund-selector",4),e.k0s(),e.j41(5,"div",3)(6,"vdr-card",5),e.nI1(7,"translate"),e.nrm(8,"vdr-order-modification-summary",6),e.j41(9,"vdr-labeled-data",7),e.nI1(10,"translate"),e.EFF(11),e.k0s(),e.DNE(12,bl,3,4,"vdr-form-field",8),e.k0s()()(),e.DNE(13,vl,15,18,"ng-template",9)),2&t&&(e.R7$(),e.Y8G("order",i.order)("orderLineCustomFields",i.orderLineCustomFields),e.R7$(3),e.Y8G("ngIf",i.priceDifference<0),e.R7$(2),e.Y8G("title",e.bMT(7,14,"order.modify-order")),e.R7$(2),e.Y8G("orderSnapshot",i.orderSnapshot)("modifyOrderInput",i.modifyOrderInput)("addedLines",i.addedLines)("shippingAddressForm",i.shippingAddressForm)("billingAddressForm",i.billingAddressForm)("couponCodesControl",i.couponCodesControl)("updatedShippingMethods",i.updatedShippingMethods),e.R7$(),e.Y8G("label",e.bMT(10,16,"order.note")),e.R7$(2),e.SpI(" ",i.modifyOrderInput.note||"-"," "),e.R7$(),e.Y8G("ngIf",i.priceDifference<0))},dependencies:[u.k8k,u.Bw1,c.bT,l.me,l.BC,l.YS,l.vS,N.K,h.V,F.b,y.M,C.B,T.i,A,ne,ie,_.D9,g.u],styles:[".order-edits-preview-table .table-wrapper{max-width:initial!important}.payments-wrapper[_ngcontent-%COMP%]{display:flex;gap:calc(var(--space-unit) * 2)}.modal-buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.6rem;gap:var(--clr-modal-footer-gap, .6rem)}"],changeDetection:0})}}var yl=s(3159),Il=s(2319);const Tl=r=>({rate:r});function Ol(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-action-bar")(1,"vdr-ab-left"),e.nrm(2,"div",2),e.k0s(),e.j41(3,"vdr-ab-right")(4,"button",3),e.bIt("click",function(){const o=e.eBV(t).ngIf,a=e.XpG();return e.Njj(a.transitionToPriorState(o))}),e.EFF(5),e.nI1(6,"translate"),e.k0s()()()}2&r&&(e.R7$(5),e.SpI(" ",e.bMT(6,1,"order.cancel-modification")," "))}function Fl(r,n){1&r&&(e.j41(0,"div",52),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"order.no-modifications-made")," "))}function Rl(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",53),e.nI1(1,"translate"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.editingShippingAddress=!o.editingShippingAddress)}),e.nrm(2,"clr-icon",54),e.k0s()}2&r&&e.Y8G("title",e.bMT(1,1,"order.edit-shipping-address"))}function Ml(r,n){if(1&r&&e.nrm(0,"vdr-formatted-address",55),2&r){const t=e.XpG(2);e.Y8G("address",t.shippingAddressForm.value)}}function Sl(r,n){if(1&r&&(e.nrm(0,"vdr-address-form",56),e.nI1(1,"async")),2&r){const t=e.XpG(2);e.Y8G("formGroup",t.shippingAddressForm)("availableCountries",e.bMT(1,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function xl(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",53),e.nI1(1,"translate"),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.editingBillingAddress=!o.editingBillingAddress)}),e.nrm(2,"clr-icon",54),e.k0s()}2&r&&e.Y8G("title",e.bMT(1,1,"order.edit-billing-address"))}function Gl(r,n){if(1&r&&e.nrm(0,"vdr-formatted-address",55),2&r){const t=e.XpG(2);e.Y8G("address",t.billingAddressForm.value)}}function kl(r,n){if(1&r&&(e.nrm(0,"vdr-address-form",56),e.nI1(1,"async")),2&r){const t=e.XpG(2);e.Y8G("formGroup",t.billingAddressForm)("availableCountries",e.bMT(1,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function Dl(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.id," ")}}function $l(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.createdAt,"short")," ")}}function jl(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.updatedAt,"short")," ")}}function El(r,n){if(1&r&&(e.nrm(0,"img",59),e.nI1(1,"assetPreview")),2&r){const t=n.ngIf;e.Y8G("src",e.i5U(1,1,t,"tiny"),e.B4B)}}function Pl(r,n){1&r&&(e.j41(0,"div",60),e.nrm(1,"clr-icon",61),e.k0s())}function Nl(r,n){if(1&r&&(e.j41(0,"div",57),e.DNE(1,El,2,4,"img",58)(2,Pl,2,0,"ng-template",null,0,e.C5r),e.k0s()),2&r){const t=n.item,i=e.sdS(3);e.R7$(),e.Y8G("ngIf",t.featuredAsset)("ngIfElse",i)}}function Yl(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.name," ")}}function wl(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.productVariant.sku," ")}}function Vl(r,n){if(1&r&&(e.j41(0,"div",62)(1,"div"),e.EFF(2),e.nI1(3,"localeCurrency"),e.k0s(),e.j41(4,"div",63),e.nI1(5,"translate"),e.EFF(6),e.nI1(7,"localeCurrency"),e.k0s()()),2&r){const t=n.item,i=e.XpG().ngIf;e.R7$(2),e.JRh(e.i5U(3,3,t.unitPriceWithTax,i.currencyCode)),e.R7$(2),e.Y8G("title",e.bMT(5,6,"order.net-price")),e.R7$(2),e.SpI(" ",e.i5U(7,8,t.unitPrice,i.currencyCode)," ")}}function Al(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",68),e.bIt("click",function(){e.eBV(t);const o=e.XpG().item,a=e.XpG(2);return e.Njj(a.removeAddedItem(o.id))}),e.nrm(1,"clr-icon",69),e.k0s()}}function Xl(r,n){if(1&r){const t=e.RV6();e.j41(0,"input",64),e.bIt("input",function(o){const a=e.eBV(t).item,m=e.XpG(2);return e.Njj(m.updateLineQuantity(a,o.target.value))}),e.k0s(),e.DNE(1,Al,2,0,"button",65),e.nrm(2,"vdr-line-refunds",66)(3,"vdr-line-fulfillment",67)}if(2&r){const t=n.item,i=e.XpG().ngIf,o=e.XpG();e.Y8G("value",o.getInitialLineQuantity(t.id)),e.R7$(),e.Y8G("ngIf",o.isAddedLine(t)),e.R7$(),e.Y8G("line",t)("payments",i.payments),e.R7$(),e.Y8G("line",t)("allOrderFulfillments",i.fulfillments)("orderState",i.state)}}function Ll(r,n){if(1&r&&e.nrm(0,"vdr-custom-field-control",71),2&r){const t=n.index,i=e.XpG().$implicit,o=e.XpG(2);e.Y8G("compact",!0)("entityName","OrderLine")("customField",i)("customFieldsFormGroup",o.orderLineCustomFieldsFormArray.at(t))}}function Bl(r,n){if(1&r&&(e.j41(0,"vdr-dt2-column",70),e.nI1(1,"async"),e.nI1(2,"customFieldLabel"),e.DNE(3,Ll,1,4,"ng-template"),e.k0s()),2&r){const t=n.$implicit,i=e.XpG(2);e.Y8G("id",t.name)("heading",e.i5U(2,5,t,e.bMT(1,3,i.uiLanguage$)))("hiddenByDefault",!0)}}function Ul(r,n){if(1&r&&(e.nrm(0,"img",75),e.nI1(1,"assetPreview")),2&r){const t=n.ngIf;e.Y8G("src",e.i5U(1,1,t,"tiny"),e.B4B)}}function Jl(r,n){if(1&r&&(e.j41(0,"div",72),e.DNE(1,Ul,2,4,"img",73),e.j41(2,"div")(3,"strong",74),e.EFF(4),e.k0s(),e.j41(5,"small"),e.EFF(6),e.k0s(),e.j41(7,"div"),e.EFF(8),e.nI1(9,"localeCurrency"),e.k0s()()()),2&r){const t=e.XpG().ngIf,i=e.XpG();e.R7$(),e.Y8G("ngIf",i.addItemSelectedVariant.productAsset),e.R7$(3),e.JRh(i.addItemSelectedVariant.productVariantName),e.R7$(2),e.JRh(i.addItemSelectedVariant.sku),e.R7$(2),e.SpI(" ",e.i5U(9,4,i.getSelectedItemPrice(i.addItemSelectedVariant),t.currencyCode)," ")}}function Hl(r,n){if(1&r&&(e.qex(0),e.nrm(1,"vdr-custom-field-control",77),e.bVm()),2&r){const t=n.$implicit,i=e.XpG(3);e.R7$(),e.Y8G("readonly",!i.addItemSelectedVariant)("customField",t)("customFieldsFormGroup",i.addItemCustomFieldsForm)("compact",!0)}}function ql(r,n){if(1&r&&(e.j41(0,"div",37),e.DNE(1,Hl,2,4,"ng-container",76),e.k0s()),2&r){const t=e.XpG(2);e.R7$(),e.Y8G("ngForOf",t.orderLineCustomFields)}}function Wl(r,n){if(1&r){const t=e.RV6();e.j41(0,"button",78),e.bIt("click",function(){e.eBV(t);const o=e.XpG(2);return e.Njj(o.addItemToOrder(o.addItemSelectedVariant))}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}if(2&r){const t=e.XpG(2);e.Y8G("disabled",!t.addItemSelectedVariant||t.addItemCustomFieldsForm.invalid),e.R7$(),e.SpI(" ",e.bMT(2,2,"order.add-item-to-order")," ")}}function Ql(r,n){if(1&r){const t=e.RV6();e.qex(0),e.j41(1,"div"),e.EFF(2),e.k0s(),e.j41(3,"div",79),e.EFF(4),e.nI1(5,"localeCurrency"),e.k0s(),e.j41(6,"button",68),e.bIt("click",function(){e.eBV(t);const o=e.XpG().$implicit,a=e.XpG(2);return e.Njj(a.setShippingMethod(o.id))}),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.bVm()}if(2&r){const t=n.ngIf,i=e.XpG(2).ngIf;e.R7$(2),e.SpI("",t.name,":"),e.R7$(2),e.SpI(" ",e.i5U(5,3,t.price,i.currencyCode)," "),e.R7$(3),e.SpI(" ",e.bMT(8,6,"order.set-shipping-method")," ")}}function zl(r,n){if(1&r&&(e.j41(0,"div",10),e.DNE(1,Ql,9,8,"ng-container",1),e.k0s()),2&r){const t=n.$implicit,i=e.XpG(2);e.R7$(),e.Y8G("ngIf",i.getShippingLineDetails(t))}}function Zl(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-page-detail-layout")(1,"vdr-page-detail-sidebar")(2,"vdr-card",4),e.nI1(3,"translate"),e.nrm(4,"vdr-order-modification-summary",5),e.DNE(5,Fl,3,3,"div",6),e.j41(6,"div",7)(7,"vdr-form-field",8),e.nI1(8,"translate"),e.j41(9,"textarea",9),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.note,o)||(a.note=o),e.Njj(o)}),e.k0s()(),e.j41(10,"label",10)(11,"input",11),e.mxI("ngModelChange",function(o){e.eBV(t);const a=e.XpG();return e.DH7(a.recalculateShipping,o)||(a.recalculateShipping=o),e.Njj(o)}),e.k0s(),e.j41(12,"div",12),e.EFF(13),e.nI1(14,"translate"),e.k0s()(),e.j41(15,"button",13),e.bIt("click",function(){const o=e.eBV(t).ngIf,a=e.XpG();return e.Njj(a.previewAndModify(o))}),e.EFF(16),e.nI1(17,"translate"),e.k0s()()(),e.j41(18,"vdr-card",4),e.nI1(19,"translate"),e.nrm(20,"vdr-coupon-code-selector",14),e.k0s(),e.j41(21,"vdr-card",4),e.nI1(22,"translate"),e.DNE(23,Rl,3,3,"ng-template",15)(24,Ml,1,1,"vdr-formatted-address",16)(25,Sl,2,5,"vdr-address-form",17),e.k0s(),e.j41(26,"vdr-card",4),e.nI1(27,"translate"),e.DNE(28,xl,3,3,"ng-template",15)(29,Gl,1,1,"vdr-formatted-address",16)(30,kl,2,5,"vdr-address-form",17),e.k0s()(),e.j41(31,"vdr-page-block")(32,"vdr-card",18)(33,"vdr-data-table-2",19)(34,"vdr-dt2-column",20),e.nI1(35,"translate"),e.DNE(36,Dl,1,1,"ng-template"),e.k0s(),e.j41(37,"vdr-dt2-column",21),e.nI1(38,"translate"),e.DNE(39,$l,2,4,"ng-template"),e.k0s(),e.j41(40,"vdr-dt2-column",22),e.nI1(41,"translate"),e.DNE(42,jl,2,4,"ng-template"),e.k0s(),e.j41(43,"vdr-dt2-column",23),e.nI1(44,"translate"),e.DNE(45,Nl,4,2,"ng-template"),e.k0s(),e.j41(46,"vdr-dt2-column",24),e.nI1(47,"translate"),e.DNE(48,Yl,1,1,"ng-template"),e.k0s(),e.j41(49,"vdr-dt2-column",25),e.nI1(50,"translate"),e.DNE(51,wl,1,1,"ng-template"),e.k0s(),e.j41(52,"vdr-dt2-column",26),e.nI1(53,"translate"),e.DNE(54,Vl,8,11,"ng-template"),e.k0s(),e.j41(55,"vdr-dt2-column",27),e.nI1(56,"translate"),e.DNE(57,Xl,4,7,"ng-template"),e.k0s(),e.DNE(58,Bl,4,8,"vdr-dt2-column",28),e.k0s()(),e.j41(59,"vdr-card",4),e.nI1(60,"translate"),e.j41(61,"vdr-product-variant-selector",29),e.bIt("productSelected",function(o){e.eBV(t);const a=e.XpG();return e.Njj(a.addItemSelectedVariant=o)}),e.k0s(),e.j41(62,"div",30)(63,"div"),e.DNE(64,Jl,10,7,"div",31)(65,ql,2,1,"div",32),e.k0s(),e.nrm(66,"div",33),e.j41(67,"div"),e.DNE(68,Wl,3,4,"button",34),e.k0s()()(),e.j41(69,"vdr-card",4),e.nI1(70,"translate"),e.DNE(71,zl,2,1,"div",35),e.k0s(),e.j41(72,"vdr-card",4),e.nI1(73,"translate"),e.j41(74,"form",36),e.bIt("submit",function(){e.eBV(t);const o=e.XpG();return e.Njj(o.addSurcharge(o.surchargeForm.value))}),e.j41(75,"div",37)(76,"vdr-form-field",38),e.nI1(77,"translate"),e.nrm(78,"input",39),e.k0s(),e.j41(79,"vdr-form-field",40),e.nI1(80,"translate"),e.nrm(81,"input",41),e.k0s(),e.j41(82,"vdr-form-field",42),e.nI1(83,"translate"),e.nrm(84,"vdr-currency-input",43),e.k0s(),e.j41(85,"vdr-form-field",44),e.nI1(86,"translate"),e.nrm(87,"input",45),e.k0s(),e.j41(88,"vdr-form-field",46),e.nI1(89,"translate"),e.j41(90,"vdr-affixed-input",47),e.nrm(91,"input",48),e.k0s()(),e.j41(92,"vdr-form-field",49),e.nI1(93,"translate"),e.nrm(94,"input",50),e.k0s()(),e.j41(95,"button",51),e.EFF(96),e.nI1(97,"translate"),e.k0s()()()()()}if(2&r){let t,i;const o=n.ngIf,a=e.XpG();e.R7$(2),e.Y8G("title",e.bMT(3,58,"order.modification-summary")),e.R7$(2),e.Y8G("orderSnapshot",a.orderSnapshot)("modifyOrderInput",a.modifyOrderInput)("addedLines",a.addedLines)("shippingAddressForm",a.shippingAddressForm)("billingAddressForm",a.billingAddressForm)("couponCodesControl",a.couponCodesControl)("updatedShippingMethods",a.updatedShippingMethods),e.R7$(),e.Y8G("ngIf",!a.hasModifications()),e.R7$(2),e.Y8G("label",e.bMT(8,60,"order.note")),e.R7$(2),e.R50("ngModel",a.note),e.Y8G("disabled",!a.hasModifications()),e.R7$(2),e.R50("ngModel",a.recalculateShipping),e.Y8G("disabled",!a.hasModifications()),e.R7$(2),e.JRh(e.bMT(14,62,"order.modification-recalculate-shipping")),e.R7$(2),e.Y8G("disabled",!a.hasModifications()),e.R7$(),e.SpI(" ",e.bMT(17,64,"order.preview-changes")," "),e.R7$(2),e.Y8G("title",e.bMT(19,66,"order.set-coupon-codes")),e.R7$(2),e.Y8G("control",a.couponCodesControl),e.R7$(),e.Y8G("title",e.bMT(22,68,"order.shipping-address")),e.R7$(3),e.Y8G("ngIf",!a.editingShippingAddress),e.R7$(),e.Y8G("ngIf",a.editingShippingAddress),e.R7$(),e.Y8G("title",e.bMT(27,70,"order.billing-address")),e.R7$(3),e.Y8G("ngIf",!a.editingBillingAddress),e.R7$(),e.Y8G("ngIf",a.editingBillingAddress),e.R7$(2),e.Y8G("paddingX",!1),e.R7$(),e.Y8G("items",o.lines.concat(a.addedLines)),e.R7$(),e.Y8G("heading",e.bMT(35,72,"common.id"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(38,74,"common.created-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(41,76,"common.updated-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(44,78,"common.image")),e.R7$(3),e.Y8G("heading",e.bMT(47,80,"order.product-name"))("optional",!1),e.R7$(3),e.Y8G("heading",e.bMT(50,82,"order.product-sku")),e.R7$(3),e.Y8G("heading",e.bMT(53,84,"order.unit-price")),e.R7$(3),e.Y8G("heading",e.bMT(56,86,"order.quantity"))("optional",!1),e.R7$(3),e.Y8G("ngForOf",a.orderLineCustomFields),e.R7$(),e.Y8G("title",e.bMT(60,88,"order.add-item-to-order")),e.R7$(5),e.Y8G("ngIf",a.addItemSelectedVariant),e.R7$(),e.Y8G("ngIf",a.addItemSelectedVariant),e.R7$(3),e.Y8G("ngIf",a.addItemSelectedVariant),e.R7$(),e.Y8G("title",e.bMT(70,90,"order.shipping")),e.R7$(2),e.Y8G("ngForOf",o.shippingLines),e.R7$(),e.Y8G("title",e.bMT(73,92,"order.add-surcharge")),e.R7$(2),e.Y8G("formGroup",a.surchargeForm),e.R7$(2),e.Y8G("label",e.bMT(77,94,"common.description")),e.R7$(3),e.Y8G("label",e.bMT(80,96,"order.product-sku")),e.R7$(3),e.Y8G("label",e.bMT(83,98,"common.price")),e.R7$(2),e.Y8G("currencyCode",o.currencyCode),e.R7$(),e.Y8G("label",e.i5U(86,100,"catalog.price-includes-tax-at",e.eq3(109,Tl,null!==(t=null==(t=a.surchargeForm.get("taxRate"))?null:t.value)&&void 0!==t?t:0))),e.R7$(3),e.Y8G("label",e.bMT(89,103,"order.tax-rate")),e.R7$(4),e.Y8G("label",e.bMT(93,105,"order.tax-description")),e.R7$(3),e.Y8G("disabled",a.surchargeForm.invalid||a.surchargeForm.pristine||0===(null==(i=a.surchargeForm.get("price"))?null:i.value)||!(null!=(i=a.surchargeForm.get("description"))&&i.value)),e.R7$(),e.SpI(" ",e.bMT(97,107,"order.add-surcharge")," ")}}class $e extends d.wi7{constructor(n,t,i,o,a){super(),this.dataService=n,this.notificationService=t,this.modalService=i,this.orderTransitionService=o,this.changeDetectorRef=a,this.detailForm=new l.J3({}),this.couponCodesControl=new l.MJ([]),this.modifyOrderInput={dryRun:!0,orderId:"",addItems:[],adjustOrderLines:[],surcharges:[],note:"",refunds:[],updateShippingAddress:{},updateBillingAddress:{}},this.surchargeForm=new l.gE({description:new l.MJ("",l.k0.minLength(1)),sku:new l.MJ(""),price:new l.MJ(0),priceIncludesTax:new l.MJ(!0),taxRate:new l.MJ(0),taxDescription:new l.MJ("")}),this.shippingAddressForm=new l.gE({fullName:new l.MJ(""),company:new l.MJ(""),streetLine1:new l.MJ(""),streetLine2:new l.MJ(""),city:new l.MJ(""),province:new l.MJ(""),postalCode:new l.MJ(""),countryCode:new l.MJ(""),phoneNumber:new l.MJ("")}),this.billingAddressForm=new l.gE({fullName:new l.MJ(""),company:new l.MJ(""),streetLine1:new l.MJ(""),streetLine2:new l.MJ(""),city:new l.MJ(""),province:new l.MJ(""),postalCode:new l.MJ(""),countryCode:new l.MJ(""),phoneNumber:new l.MJ("")}),this.note="",this.recalculateShipping=!0,this.editingShippingAddress=!1,this.editingBillingAddress=!1,this.updatedShippingMethods={},this.addedVariants=new Map}ngOnInit(){this.init(),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.modifyOrderInput.orderId=this.route.snapshot.paramMap.get("id"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.entity$.pipe((0,D.s)(1)).subscribe(n=>{this.orderSnapshot=this.createOrderSnapshot(n),n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm.reset();for(const[t,i]of Object.entries(this.shippingAddressForm.controls))i.setValue(n.shippingAddress?.[t]);this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress);for(const[t,i]of Object.entries(this.billingAddressForm.controls))i.setValue(n.billingAddress?.[t]);this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress),this.orderLineCustomFieldsFormArray=new l.Bm([]);for(const t of n.lines){const i=new l.J3({});for(const{name:o}of this.orderLineCustomFields)i.addControl(o,new l.hs(t.customFields[o]));i.valueChanges.pipe((0,Tt.Q)(this.destroy$)).subscribe(o=>{let a=this.modifyOrderInput.adjustOrderLines.find(m=>m.orderLineId===t.id);a||(a={orderLineId:t.id,quantity:t.quantity},this.modifyOrderInput.adjustOrderLines.push(a)),this.orderLineCustomFields.length&&(a.customFields=o)}),this.orderLineCustomFieldsFormArray.push(i)}}),this.addItemCustomFieldsFormArray=new l.Bm([]),this.addItemCustomFieldsForm=new l.J3({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new l.hs);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,nl.t)(1)),this.dataService.order.getOrderHistory(this.id,{take:1,sort:{createdAt:d.xBQ.DESC},filter:{type:{eq:d.Htj.ORDER_STATE_TRANSITION}}}).single$.subscribe(({order:n})=>{this.previousState=n?.history.items[0].data.from}),this.uiLanguage$=this.dataService.client.uiState().stream$.pipe((0,R.T)(({uiState:n})=>n.language))}ngOnDestroy(){this.destroy()}get addedLines(){const n=t=>"SinglePrice"===t.__typename?t.value:0;return(this.modifyOrderInput.addItems||[]).map(t=>{const i=this.addedVariants.get(t.productVariantId);if(i)return{id:this.getIdForAddedItem(t),featuredAsset:i.productAsset,productVariant:{id:i.productVariantId,name:i.productVariantName,sku:i.sku},unitPrice:n(i.price),unitPriceWithTax:n(i.priceWithTax),quantity:t.quantity}}).filter(b.notNullOrUndefined)}getIdForAddedItem(n){return`added-${n.productVariantId}-${JSON.stringify(n.customFields||{})}`}transitionToPriorState(n){this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates).subscribe(t=>{this.router.navigate([".."],{relativeTo:this.route})})}hasModifications(){const{addItems:n,adjustOrderLines:t,surcharges:i}=this.modifyOrderInput;return!!n?.length||!!i?.length||!!t?.length||this.shippingAddressForm.dirty&&this.shippingAddressForm.valid||this.billingAddressForm.dirty&&this.billingAddressForm.valid||this.couponCodesControl.dirty||Object.entries(this.updatedShippingMethods).length>0}isLineModified(n){return!!this.modifyOrderInput.adjustOrderLines?.find(t=>t.orderLineId===n.id&&t.quantity!==n.quantity)}getInitialLineQuantity(n){const t=this.modifyOrderInput.adjustOrderLines?.find(a=>a.orderLineId===n);if(t)return t.quantity;const i=this.modifyOrderInput.addItems?.find(a=>this.getIdForAddedItem(a)===n);if(i)return i.quantity??1;const o=this.orderSnapshot.lines.find(a=>a.id===n);return o?o.quantity:1}updateLineQuantity(n,t){const{adjustOrderLines:i}=this.modifyOrderInput;if(this.isAddedLine(n)){const o=this.modifyOrderInput.addItems?.find(a=>a.productVariantId===n.productVariant.id);o&&(o.quantity=+t)}else{let o=i?.find(a=>a.orderLineId===n.id);o&&+t===n.quantity&&i?.splice(i?.indexOf(o),1),o||(o={orderLineId:n.id,quantity:+t},i?.push(o)),o.quantity=+t}}isAddedLine(n){return n.id.startsWith("added-")}updateAddedItemQuantity(n,t){const i=this.modifyOrderInput.addItems?.find(o=>o.productVariantId===n.productVariant.id);i&&(i.quantity=+t)}trackByProductVariantId(n,t){return t.productVariant.id}getSelectedItemPrice(n){return"SinglePrice"===n?.priceWithTax.__typename?n.priceWithTax.value:0}addItemToOrder(n){if(!n)return;const t=this.orderLineCustomFields.length?this.addItemCustomFieldsForm.value:void 0;let i=this.modifyOrderInput.addItems?.find(o=>this.isMatchingAddItemRow(o,n,t));if(i?i.quantity++:(i={productVariantId:n.productVariantId,quantity:1},t&&(i.customFields=t),this.modifyOrderInput.addItems?.push(i)),t){const o=new l.J3({});for(const[a,m]of Object.entries(t))o.addControl(a,new l.hs(m));this.addItemCustomFieldsFormArray.push(o),o.valueChanges.pipe((0,Tt.Q)(this.destroy$)).subscribe(a=>{i&&(i.customFields=a)})}this.addItemCustomFieldsForm.reset({}),this.addItemSelectedVariant=void 0,this.addedVariants.set(n.productVariantId,n)}getShippingLineDetails(n){const t=this.updatedShippingMethods[n.id];return t?{name:t.name||t.code,price:t.priceWithTax}:{name:n.shippingMethod.name||n.shippingMethod.code,price:n.discountedPriceWithTax}}setShippingMethod(n){const t=this.updatedShippingMethods[n]??this.entity?.shippingLines.find(i=>i.id===n)?.shippingMethod;t&&this.dataService.order.getDraftOrderEligibleShippingMethods(this.id).mapSingle(({eligibleShippingMethodsForDraftOrder:i})=>i).pipe((0,f.n)(i=>this.modalService.fromComponent(q,{locals:{eligibleShippingMethods:i,currencyCode:this.entity?.currencyCode,currentSelectionId:t.id}}).pipe((0,R.T)(o=>{if(o)return i.find(a=>a.id===o)})))).subscribe(i=>{i&&(this.updatedShippingMethods[n]=i,this.changeDetectorRef.markForCheck())})}isMatchingAddItemRow(n,t,i){return n.productVariantId===t.productVariantId&&JSON.stringify(n.customFields)===JSON.stringify(i)}removeAddedItem(n){this.modifyOrderInput.addItems=this.modifyOrderInput.addItems?.filter(t=>this.getIdForAddedItem(t)!==n)}getSurchargePrices(n){const t=n.priceIncludesTax?n.price:Math.round(n.price*((100+(n.taxRate||0))/100));return{price:n.priceIncludesTax?Math.round(n.price/((100+(n.taxRate||0))/100)):n.price,priceWithTax:t}}addSurcharge(n){this.modifyOrderInput.surcharges?.push(n),this.surchargeForm.reset({price:0,priceIncludesTax:!0,taxRate:0})}removeSurcharge(n){this.modifyOrderInput.surcharges?.splice(n,1)}previewAndModify(n){const i={...{...this.modifyOrderInput,adjustOrderLines:this.modifyOrderInput.adjustOrderLines.map(o=>(0,d.xo)((0,tl.q)(o),this.orderLineCustomFields))},...this.billingAddressForm.dirty?{updateBillingAddress:this.billingAddressForm.value}:{},...this.shippingAddressForm.dirty?{updateShippingAddress:this.shippingAddressForm.value}:{},dryRun:!0,couponCodes:this.couponCodesControl.dirty?this.couponCodesControl.value:void 0,note:this.note??"",options:{recalculateShipping:this.recalculateShipping}};Object.entries(this.updatedShippingMethods).length&&(i.shippingMethodIds=n.shippingLines.map(o=>this.updatedShippingMethods[o.id]?this.updatedShippingMethods[o.id].id:o.shippingMethod.id)),this.dataService.order.modifyOrder(i).pipe((0,f.n)(({modifyOrder:o})=>{switch(o.__typename){case"Order":return this.modalService.fromComponent(De,{size:"xl",closable:!1,locals:{order:o,orderSnapshot:this.orderSnapshot,orderLineCustomFields:this.orderLineCustomFields,modifyOrderInput:i,addedLines:this.addedLines,shippingAddressForm:this.shippingAddressForm,billingAddressForm:this.billingAddressForm,couponCodesControl:this.couponCodesControl,updatedShippingMethods:this.updatedShippingMethods}});case"InsufficientStockError":case"NegativeQuantityError":case"NoChangesSpecifiedError":case"OrderLimitError":case"OrderModificationStateError":case"PaymentMethodMissingError":case"RefundPaymentIdMissingError":case"CouponCodeLimitError":case"CouponCodeExpiredError":case"IneligibleShippingMethodError":case"CouponCodeInvalidError":return this.notificationService.error(o.message),(0,v.of)(!1);case null:case void 0:return(0,v.of)(!1);default:(0,b.assertNever)(o)}}),(0,f.n)(o=>{if(!o||o.result===S.Cancel)return this.dataService.order.getOrder(this.id).mapSingle(()=>!1);{const a={...i,dryRun:!1};return o.result===S.Refund&&(a.refunds=o.refunds),this.dataService.order.modifyOrder(a).pipe((0,f.n)(({modifyOrder:m})=>{if("Order"===m.__typename){const Ze=0<m.totalWithTax-this.orderSnapshot.totalWithTax?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,Ze).pipe((0,ft.u)(!0))}return this.notificationService.error(m.message),$.w}))}})).subscribe(o=>{o&&this.router.navigate(["../"],{relativeTo:this.route})})}addAddressCustomFieldsFormGroup(n,t){if(t&&this.addressCustomFields.length){const i=new l.J3({});for(const o of this.addressCustomFields){const a=o.name,m=t.customFields?.[a];i.addControl(a,new l.hs(m))}n.addControl("customFields",i)}}createOrderSnapshot(n){return{totalWithTax:n.totalWithTax,currencyCode:n.currencyCode,couponCodes:n.couponCodes,lines:[...n.lines].map(t=>({...t})),shippingLines:[...n.shippingLines].map(t=>({...t}))}}setFormValues(n,t){}static{this.\u0275fac=function(t){return new(t||$e)(e.rXU(d.uSP),e.rXU(d.JEu),e.rXU(d.Bg8),e.rXU(E),e.rXU(e.gRc))}}static{this.\u0275cmp=e.VBU({type:$e,selectors:[["vdr-order-editor"]],features:[e.Vt3],decls:4,vars:4,consts:[["imagePlaceholder",""],[4,"ngIf"],[1,"flex","clr-align-items-center"],[1,"btn","btn-secondary",3,"click"],[3,"title"],[3,"orderSnapshot","modifyOrderInput","addedLines","shippingAddressForm","billingAddressForm","couponCodesControl","updatedShippingMethods"],["class","no-modifications",4,"ngIf"],[1,"summary-controls"],[3,"label"],["name","note","required","",3,"ngModelChange","ngModel","disabled"],[1,"flex","items-center"],["type","checkbox",3,"ngModelChange","ngModel","disabled"],[1,"ml-1"],[1,"btn","btn-primary","mt-2",3,"click","disabled"],[3,"control"],["vdrCardControls",""],[3,"address",4,"ngIf"],[3,"formGroup","availableCountries","customFields",4,"ngIf"],[3,"paddingX"],["id","modify-order",1,"order-table",3,"items"],["id","id",3,"heading","hiddenByDefault"],["id","created-at",3,"heading","hiddenByDefault"],["id","updated-at",3,"heading","hiddenByDefault"],["id","image",3,"heading"],["id","product-name",3,"heading","optional"],["id","product-sku",3,"heading"],["id","unit-price",3,"heading"],["id","quantity",3,"heading","optional"],[3,"id","heading","hiddenByDefault",4,"ngFor","ngForOf"],[1,"mb-4",3,"productSelected"],[1,"flex"],["class","flex mb-4",4,"ngIf"],["class","form-grid",4,"ngIf"],[1,"flex-spacer"],["class","btn btn-secondary",3,"disabled","click",4,"ngIf"],["class","flex items-center",4,"ngFor","ngForOf"],[3,"submit","formGroup"],[1,"form-grid"],["for","description",3,"label"],["id","description","type","text","formControlName","description"],["for","sku",3,"label"],["id","sku","type","text","formControlName","sku"],["for","price",3,"label"],["id","price","formControlName","price",3,"currencyCode"],["for","priceIncludesTax",3,"label"],["id","priceIncludesTax","type","checkbox","clrCheckbox","","formControlName","priceIncludesTax"],["for","taxRate",3,"label"],["suffix","%"],["id","taxRate","type","number","min","0","max","100","formControlName","taxRate"],["for","taxDescription",3,"label"],["id","taxDescription","type","text","formControlName","taxDescription"],[1,"btn","btn-secondary","mt-2",3,"disabled"],[1,"no-modifications"],[1,"button-small",3,"click","title"],["shape","edit"],[3,"address"],[3,"formGroup","availableCountries","customFields"],[1,"image-placeholder"],[3,"src",4,"ngIf","ngIfElse"],[3,"src"],[1,"placeholder"],["shape","image","size","48"],[1,"text-center"],[1,"net-price",3,"title"],["type","number","min","0",1,"draft-qty","mr-1",3,"input","value"],["class","button-small",3,"click",4,"ngIf"],[3,"line","payments"],[3,"line","allOrderFulfillments","orderState"],[1,"button-small",3,"click"],["shape","trash"],[3,"id","heading","hiddenByDefault"],[3,"compact","entityName","customField","customFieldsFormGroup"],[1,"flex","mb-4"],["class","mr-4 add-item-thumb",3,"src",4,"ngIf"],[1,"mr-4"],[1,"mr-4","add-item-thumb",3,"src"],[4,"ngFor","ngForOf"],["entityName","OrderLine",3,"readonly","customField","customFieldsFormGroup","compact"],[1,"btn","btn-secondary",3,"click","disabled"],[1,"mx-1"]],template:function(t,i){1&t&&(e.j41(0,"vdr-page-block"),e.DNE(1,Ol,7,3,"vdr-action-bar",1),e.nI1(2,"async"),e.k0s(),e.DNE(3,Zl,98,111,"vdr-page-detail-layout",1)),2&t&&(e.R7$(),e.Y8G("ngIf",e.bMT(2,2,i.entity$)),e.R7$(2),e.Y8G("ngIf",i.entity))},dependencies:[u.U4n,u.aZZ,u.Jej,c.Sq,c.bT,l.qT,l.me,l.Q0,l.Zm,l.BC,l.cb,l.YS,l.VZ,l.zX,l.vS,l.j4,l.JD,I.nG,I.wL,I.TX,yl.R,We.J,Je.C,N.K,h.V,se.W,ut.h,rt.O,Qe.I,Ne.Y,Pe.e,Be.c,Ue.e,T.i,T.a,Z,w,U,ie,c.Jj,_.D9,Il._,L.H,Y.P,g.u],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:var(--border-radius-img)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-inline-end:18px}.order-table[_ngcontent-%COMP%] .draft-qty[_ngcontent-%COMP%]{max-width:48px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300);line-height:14px}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}.order-table[_ngcontent-%COMP%] .shipping-method-name[_ngcontent-%COMP%]{font-size:var(--font-size-xs);margin-inline-end:2px}.order-table[_ngcontent-%COMP%] .order-placed-quantity[_ngcontent-%COMP%]{text-decoration:line-through;color:var(--color-text-300);margin-inline-end:2px}.order-table[_ngcontent-%COMP%] tr.modified[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{text-align:start}.add-item-thumb[_ngcontent-%COMP%]{max-width:50px}.no-modifications[_ngcontent-%COMP%]{color:var(--color-grey-400)}.summary-controls[_ngcontent-%COMP%]{border-top:1px solid var(--color-weight-200);margin-top:calc(var(--space-unit) * 2);padding-top:calc(var(--space-unit) * 1)}"],changeDetection:0})}}var Kl=s(4195),ed=s(6637),td=s(1955);const nd=()=>["CreateOrder"],rd=()=>["./draft/create"],id=r=>["./draft",r],od=r=>["./",r];function ad(r,n){1&r&&(e.j41(0,"a",17),e.nrm(1,"clr-icon",18),e.EFF(2),e.nI1(3,"translate"),e.k0s()),2&r&&(e.Y8G("routerLink",e.lJ4(4,rd)),e.R7$(2),e.SpI(" ",e.bMT(3,2,"catalog.create-draft-order")," "))}function ld(r,n){1&r&&(e.qex(0),e.DNE(1,ad,4,5,"a",16),e.bVm()),2&r&&(e.R7$(),e.Y8G("vdrIfPermissions",e.lJ4(1,nd)))}function dd(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item;e.SpI(" ",t.id," ")}}function sd(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.createdAt,"short")," ")}}function cd(r,n){if(1&r&&(e.j41(0,"a",19)(1,"span"),e.EFF(2),e.k0s(),e.nrm(3,"clr-icon",20),e.k0s()),2&r){const t=n.item;e.Y8G("routerLink","Draft"===t.state?e.eq3(2,id,t.id):e.eq3(4,od,t.id)),e.R7$(2),e.JRh(t.code)}}function md(r,n){if(1&r){const t=e.RV6();e.j41(0,"vdr-customer-label",21),e.bIt("click",function(o){return e.eBV(t),e.Njj(o.stopPropagation())}),e.k0s()}if(2&r){const t=n.item;e.Y8G("customer",t.customer)}}function pd(r,n){1&r&&(e.j41(0,"vdr-chip"),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"order.order-type-regular")))}function ud(r,n){1&r&&(e.j41(0,"vdr-chip"),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"order.order-type-aggregate")))}function _d(r,n){1&r&&(e.j41(0,"vdr-chip"),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&r&&(e.R7$(),e.JRh(e.bMT(2,1,"order.order-type-seller")))}function fd(r,n){if(1&r&&e.DNE(0,pd,3,3,"vdr-chip",1)(1,ud,3,3,"vdr-chip",1)(2,_d,3,3,"vdr-chip",1),2&r){const t=n.item,i=e.XpG();e.Y8G("ngIf",t.type===i.OrderType.Regular),e.R7$(),e.Y8G("ngIf",t.type===i.OrderType.Aggregate),e.R7$(),e.Y8G("ngIf",t.type===i.OrderType.Seller)}}function gd(r,n){if(1&r&&e.nrm(0,"vdr-order-state-label",22),2&r){const t=n.item;e.Y8G("state",t.state)}}function hd(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeCurrency")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.totalWithTax,t.currencyCode)," ")}}function bd(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"timeAgo")),2&r){const t=n.item;e.SpI(" ",e.bMT(1,1,t.updatedAt)," ")}}function Cd(r,n){if(1&r&&(e.EFF(0),e.nI1(1,"localeDate")),2&r){const t=n.item;e.SpI(" ",e.i5U(1,1,t.orderPlacedAt,"short")," ")}}function vd(r,n){if(1&r&&e.EFF(0),2&r){const t=n.item,i=e.XpG();e.SpI(" ",i.getShippingNames(t)," ")}}function yd(r,n){if(1&r&&e.nrm(0,"vdr-dt2-custom-field-column",23),2&r){const t=n.$implicit,i=e.XpG();e.Y8G("customField",t)("sorts",i.sorts)}}class je extends d.B8I{constructor(n,t){super(),this.serverConfigService=n,this.channelService=t,this.orderStates=this.serverConfigService.getOrderProcessStates().map(i=>i.name),this.OrderType=d.ZNd,this.customFields=this.getCustomFieldConfig("Order"),this.filters=this.createFilterCollection().addIdFilter().addDateFilters().addFilter({name:"active",type:{kind:"boolean"},label:(0,p.x)("order.filter-is-active"),filterField:"active"}).addFilter({name:"totalWithTax",type:{kind:"number",inputType:"currency",currencyCode:"USD"},label:(0,p.x)("order.total"),filterField:"totalWithTax"}).addFilter({name:"state",type:{kind:"select",options:this.orderStates.map(i=>({value:i,label:(0,d.oS5)(i)}))},label:(0,p.x)("order.state"),filterField:"state"}).addFilter({name:"type",type:{kind:"select",options:[{value:d.ZNd.Regular,label:(0,p.x)("order.order-type-regular")},{value:d.ZNd.Aggregate,label:(0,p.x)("order.order-type-aggregate")},{value:d.ZNd.Seller,label:(0,p.x)("order.order-type-seller")}]},label:(0,p.x)("order.order-type"),filterField:"type"}).addFilter({name:"orderPlacedAt",type:{kind:"dateRange"},label:(0,p.x)("order.placed-at"),filterField:"orderPlacedAt"}).addFilter({name:"customerLastName",type:{kind:"text"},label:(0,p.x)("customer.last-name"),filterField:"customerLastName"}).addFilter({name:"transactionId",type:{kind:"text"},label:(0,p.x)("order.transaction-id"),filterField:"transactionId"}).addCustomFieldFilters(this.customFields).connectToRoute(this.route),this.sorts=this.createSortCollection().defaultSort("updatedAt","DESC").addSort({name:"id"}).addSort({name:"createdAt"}).addSort({name:"updatedAt"}).addSort({name:"orderPlacedAt"}).addSort({name:"customerLastName"}).addSort({name:"state"}).addSort({name:"totalWithTax"}).addCustomFieldSorts(this.customFields).connectToRoute(this.route),this.canCreateDraftOrder=!1,this.activeChannelIsDefaultChannel=!1,super.configure({document:d.GQq,getItems:i=>i.orders,setVariables:(i,o)=>this.createQueryOptions(i,o,this.searchTermControl.value),refreshListOnChanges:[this.filters.valueChanges,this.sorts.valueChanges]}),this.canCreateDraftOrder=!!this.serverConfigService.getOrderProcessStates().find(i=>"Created"===i.name)?.to.includes("Draft")}ngOnInit(){super.ngOnInit();const n=this.channelService.defaultChannelIsActive$.pipe((0,de.M)(t=>this.activeChannelIsDefaultChannel=t));super.refreshListOnChanges(this.filters.valueChanges,this.sorts.valueChanges,n)}createQueryOptions(n,t,i){let o=this.filters.createFilterInput();return this.activeChannelIsDefaultChannel&&(o={...o??{}}),i&&(o={code:{contains:i},customerLastName:{contains:i},transactionId:{contains:i}}),{options:{skip:n,take:t,filter:{...o??{}},filterOperator:i?d.umn.OR:d.umn.AND,sort:this.sorts.createSortInput()}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}static{this.\u0275fac=function(t){return new(t||je)(e.rXU(d.BBL),e.rXU(d.lhn))}}static{this.\u0275cmp=e.VBU({type:je,selectors:[["vdr-order-list"]],features:[e.Vt3],decls:45,vars:60,consts:[["locationId","order-list"],[4,"ngIf"],["id","order-list",1,"mt-2",3,"pageChange","itemsPerPageChange","items","itemsPerPage","totalItems","currentPage","filters"],["locationId","order-list",3,"hostComponent","selectionManager"],[3,"searchTermControl","searchTermPlaceholder"],["id","id",3,"heading","hiddenByDefault","sort"],["id","created-at",3,"heading","hiddenByDefault"],["id","code",3,"heading","optional"],["id","customer",3,"heading","sort"],["id","order-type",3,"heading","hiddenByDefault"],["id","state",3,"heading","sort"],["id","total",3,"heading","sort"],["id","updated-at",3,"heading"],["id","placed-at",3,"heading","sort"],["id","shipping",3,"heading"],[3,"customField","sorts",4,"ngFor","ngForOf"],["class","btn",3,"routerLink",4,"vdrIfPermissions"],[1,"btn",3,"routerLink"],["shape","plus"],[1,"button-ghost",3,"routerLink"],["shape","arrow right"],[3,"click","customer"],[3,"state"],[3,"customField","sorts"]],template:function(t,i){1&t&&(e.j41(0,"vdr-page-block")(1,"vdr-action-bar")(2,"vdr-ab-right"),e.nrm(3,"vdr-action-bar-items",0),e.DNE(4,ld,2,2,"ng-container",1),e.nrm(5,"vdr-action-bar-dropdown-menu",0),e.k0s()()(),e.j41(6,"vdr-data-table-2",2),e.nI1(7,"async"),e.nI1(8,"async"),e.nI1(9,"async"),e.nI1(10,"async"),e.bIt("pageChange",function(a){return i.setPageNumber(a)})("itemsPerPageChange",function(a){return i.setItemsPerPage(a)}),e.nrm(11,"vdr-bulk-action-menu",3)(12,"vdr-dt2-search",4),e.nI1(13,"translate"),e.j41(14,"vdr-dt2-column",5),e.nI1(15,"translate"),e.DNE(16,dd,1,1,"ng-template"),e.k0s(),e.j41(17,"vdr-dt2-column",6),e.nI1(18,"translate"),e.DNE(19,sd,2,4,"ng-template"),e.k0s(),e.j41(20,"vdr-dt2-column",7),e.nI1(21,"translate"),e.DNE(22,cd,4,6,"ng-template"),e.k0s(),e.j41(23,"vdr-dt2-column",8),e.nI1(24,"translate"),e.DNE(25,md,1,1,"ng-template"),e.k0s(),e.j41(26,"vdr-dt2-column",9),e.nI1(27,"translate"),e.DNE(28,fd,3,3,"ng-template"),e.k0s(),e.j41(29,"vdr-dt2-column",10),e.nI1(30,"translate"),e.DNE(31,gd,1,1,"ng-template"),e.k0s(),e.j41(32,"vdr-dt2-column",11),e.nI1(33,"translate"),e.DNE(34,hd,2,4,"ng-template"),e.k0s(),e.j41(35,"vdr-dt2-column",12),e.nI1(36,"translate"),e.DNE(37,bd,2,3,"ng-template"),e.k0s(),e.j41(38,"vdr-dt2-column",13),e.nI1(39,"translate"),e.DNE(40,Cd,2,4,"ng-template"),e.k0s(),e.j41(41,"vdr-dt2-column",14),e.nI1(42,"translate"),e.DNE(43,vd,1,1,"ng-template"),e.k0s(),e.DNE(44,yd,1,2,"vdr-dt2-custom-field-column",15),e.k0s()),2&t&&(e.R7$(4),e.Y8G("ngIf",i.canCreateDraftOrder),e.R7$(2),e.Y8G("items",e.bMT(7,30,i.items$))("itemsPerPage",e.bMT(8,32,i.itemsPerPage$))("totalItems",e.bMT(9,34,i.totalItems$))("currentPage",e.bMT(10,36,i.currentPage$))("filters",i.filters),e.R7$(5),e.Y8G("hostComponent",i)("selectionManager",i.selectionManager),e.R7$(),e.Y8G("searchTermControl",i.searchTermControl)("searchTermPlaceholder",e.bMT(13,38,"order.search-by-order-filters")),e.R7$(2),e.Y8G("heading",e.bMT(15,40,"common.id"))("hiddenByDefault",!0)("sort",i.sorts.get("id")),e.R7$(3),e.Y8G("heading",e.bMT(18,42,"common.created-at"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(21,44,"common.code"))("optional",!1),e.R7$(3),e.Y8G("heading",e.bMT(24,46,"order.customer"))("sort",i.sorts.get("customerLastName")),e.R7$(3),e.Y8G("heading",e.bMT(27,48,"order.order-type"))("hiddenByDefault",!0),e.R7$(3),e.Y8G("heading",e.bMT(30,50,"order.state"))("sort",i.sorts.get("state")),e.R7$(3),e.Y8G("heading",e.bMT(33,52,"order.total"))("sort",i.sorts.get("totalWithTax")),e.R7$(3),e.Y8G("heading",e.bMT(36,54,"common.updated-at")),e.R7$(3),e.Y8G("heading",e.bMT(39,56,"order.placed-at"))("sort",i.sorts.get("orderPlacedAt")),e.R7$(3),e.Y8G("heading",e.bMT(42,58,"order.shipping")),e.R7$(3),e.Y8G("ngForOf",i.customFields))},dependencies:[u.U4n,c.Sq,c.bT,M.Wk,I.nG,I.TX,Ae.l,k.w,Xe.E,Ee.F,gt.p,Le.T,Kl.T,Qe.I,Ne.Y,ed.E,mt.T,Pe.e,c.Jj,_.D9,td.n,Y.P,g.u],styles:[".search-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:baseline;width:100%;max-width:100vw;margin-bottom:6px}.filter-presets[_ngcontent-%COMP%]{max-width:90vw;overflow-x:auto}.search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}.custom-filters[_ngcontent-%COMP%]{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded[_ngcontent-%COMP%]{max-height:initial}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%}ng-select[_ngcontent-%COMP%]{flex:1;min-width:200px;height:36px}ng-select[_ngcontent-%COMP%] .ng-select-container{height:36px}"],changeDetection:0})}}function Id(r,n){if(1&r&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.k0s()),2&r){const t=e.XpG();e.Y8G("label",e.bMT(1,2,"order.transaction-id")),e.R7$(2),e.SpI(" ",t.refund.transactionId,"\n")}}class Ye{static{this.\u0275fac=function(t){return new(t||Ye)}}static{this.\u0275cmp=e.VBU({type:Ye,selectors:[["vdr-refund-detail"]],inputs:{refund:"refund",currencyCode:"currencyCode"},decls:8,vars:12,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(t,i){1&t&&(e.j41(0,"vdr-labeled-data",0),e.nI1(1,"translate"),e.EFF(2),e.nI1(3,"localeCurrency"),e.k0s(),e.DNE(4,Id,3,4,"vdr-labeled-data",1),e.j41(5,"vdr-labeled-data",0),e.nI1(6,"translate"),e.nrm(7,"vdr-object-tree",2),e.k0s()),2&t&&(e.Y8G("label",e.bMT(1,5,"order.amount")),e.R7$(2),e.SpI(" ",e.i5U(3,7,i.refund.total,i.currencyCode),"\n"),e.R7$(2),e.Y8G("ngIf",i.refund.transactionId),e.R7$(),e.Y8G("label",e.bMT(6,10,"order.payment-metadata")),e.R7$(2),e.Y8G("value",i.refund.metadata))},dependencies:[c.bT,C.B,ce.T,_.D9,g.u],changeDetection:0})}}const Td=P.J1`
|
|
69
|
+
query GetCustomerAddresses($customerId: ID!) {
|
|
70
|
+
customer(id: $customerId) {
|
|
71
|
+
id
|
|
72
|
+
addresses {
|
|
73
|
+
...Address
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
${d.QZS}
|
|
78
|
+
`,Ot=P.J1`
|
|
79
|
+
query GetOrderState($id: ID!) {
|
|
80
|
+
order(id: $id) {
|
|
81
|
+
id
|
|
82
|
+
state
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;class x{constructor(n,t){this.dataService=n,this.router=t}canActivate(n,t){const i=t.url.includes("orders/draft"),o=t.url.includes("/modify"),a=n.paramMap.get("id");return i?"create"!==a||this.dataService.order.createDraftOrder().pipe((0,R.T)(({createDraftOrder:m})=>this.router.parseUrl(`/orders/draft/${m.id}`))):this.dataService.query(Ot,{id:a}).single$.pipe((0,R.T)(({order:m})=>!("Modifying"===m?.state&&!o)||this.router.parseUrl(`/orders/${a}/modify`)))}static{this.\u0275fac=function(t){return new(t||x)(e.KVO(d.uSP),e.KVO(M.Ix))}}static{this.\u0275prov=e.jDH({token:x,factory:x.\u0275fac,providedIn:"root"})}}const Ft=r=>[{path:"",component:d.H1b,pathMatch:"full",data:{locationId:"order-list",breadcrumb:(0,p.x)("breadcrumb.orders")},children:r.getPageTabRoutes("order-list")},{path:"draft/:id",component:d.H1b,canActivate:[x],data:{locationId:"draft-order-detail",breadcrumb:{label:(0,p.x)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("draft-order-detail")},{path:":id",component:d.H1b,canActivate:[x],data:{locationId:"order-detail",breadcrumb:{label:(0,p.x)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":aggregateOrderId/seller-orders/:id",component:d.H1b,canActivate:[x],data:{locationId:"order-detail",breadcrumb:{label:(0,p.x)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("order-detail")},{path:":id/modify",component:d.H1b,canActivate:[x],data:{locationId:"modify-order",breadcrumb:{label:(0,p.x)("breadcrumb.orders"),link:["../"]}},children:r.getPageTabRoutes("modify-order")}];class oe{static{this.hasRegisteredTabsAndBulkActions=!1}constructor(n){oe.hasRegisteredTabsAndBulkActions||(n.registerPageTab({priority:0,location:"order-list",tab:(0,p.x)("order.orders"),route:"",component:je}),n.registerPageTab({priority:0,location:"order-detail",tab:(0,p.x)("order.order"),route:"",component:(0,d.HL6)({component:ke,query:d.dRq,entityKey:"order",getBreadcrumbs:t=>t?.type===d.ZNd.Seller&&t?.aggregateOrder?[{label:`${t?.aggregateOrder?.code}`,link:["/orders/",t?.aggregateOrder?.id]},{label:(0,p.x)("breadcrumb.seller-orders"),link:["/orders/",t?.aggregateOrder?.id]},{label:`${t?.code}`,link:[t?.id]}]:[{label:`${t?.code}`,link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"draft-order-detail",tab:(0,p.x)("order.order"),route:"",component:(0,d.HL6)({component:fe,query:d.dRq,entityKey:"order",getBreadcrumbs:t=>[{label:(0,p.x)("order.draft-order"),link:[t?.id]}]})}),n.registerPageTab({priority:0,location:"modify-order",tab:(0,p.x)("order.order"),route:"",component:(0,d.HL6)({component:$e,query:d.dRq,entityKey:"order",getBreadcrumbs:t=>[{label:t?.code||"order",link:["/orders/",t?.id]},{label:(0,p.x)("breadcrumb.modifying-order"),link:[t?.id]}]})}),oe.hasRegisteredTabsAndBulkActions=!0)}static{this.\u0275fac=function(t){return new(t||oe)(e.KVO(d.bPm))}}static{this.\u0275mod=e.$C({type:oe})}static{this.\u0275inj=e.G2t({providers:[{provide:M.bw,useFactory:n=>Ft(n),multi:!0,deps:[d.bPm]}],imports:[d.GgS,M.iI.forChild([])]})}}}}]);
|
|
86
|
+
//# sourceMappingURL=53.7f3fee856943b03f.js.map
|