1import{a as ce}from"./chunk-EJLHYM6Z.js";import{a as se}from"./chunk-I2BF4VFZ.js";import{a as ae,f as re}from"./chunk-B3QJM2RM.js";import"./chunk-M6OZBIKI.js";import"./chunk-XQLXGKEK.js";import"./chunk-IXD6ECVB.js";import"./chunk-RRCBQ55K.js";import"./chunk-DQRROS2B.js";import"./chunk-EONF3GVN.js";import"./chunk-5LMG4TVJ.js";import"./chunk-Z2TVBXTG.js";import"./chunk-WRHHAZEI.js";import{a as pe}from"./chunk-QIOURN4K.js";import{a as ee,b as te}from"./chunk-KYVCMV2E.js";import"./chunk-HWZZ5RQT.js";import"./chunk-ZNR7QNVV.js";import"./chunk-WGAXTYG2.js";import"./chunk-U3Z5BGA7.js";import{a as oe,b as le}from"./chunk-M6YDMVQ7.js";import{a as de}from"./chunk-OTMVSU27.js";import{a as j}from"./chunk-EB6TJ75L.js";import"./chunk-QI7CEGT6.js";import"./chunk-6ND7557V.js";import{D as Y,g as H,l as $}from"./chunk-FOJCKIWO.js";import{a as K}from"./chunk-NBMUSEX4.js";import{a as Q,b as J}from"./chunk-3AIY57KH.js";import"./chunk-AB6CKZTE.js";import{b as ie,c as ne}from"./chunk-H66TAOKK.js";import"./chunk-Z64D265S.js";import"./chunk-K5O3OQFW.js";import"./chunk-2DRXLVRR.js";import{d as X,e as Z}from"./chunk-RQJZECR4.js";import"./chunk-G3G5OK6Q.js";import"./chunk-AERMLNF3.js";import"./chunk-QHMYZ6SM.js";import"./chunk-PJPLTBJX.js";import"./chunk-DLIVM562.js";import"./chunk-CV2ZWZQE.js";import"./chunk-H4HD3LNW.js";import{ja as q}from"./chunk-AQEWHUN5.js";import{c as U,d as z,e as W}from"./chunk-YQZAETCE.js";import{o as B,x as G}from"./chunk-EO42E46J.js";import"./chunk-3QVSKJ3X.js";import{D as V,I as F,p as N}from"./chunk-ERUCNOOT.js";import{$b as y,Cc as L,Dc as w,Ec as M,Gc as D,Jb as v,Mb as h,Qb as _,Qc as d,Rc as s,Sc as A,V as I,Vb as a,Wb as n,Xb as g,da as S,db as i,f as b,fc as E,gc as p,la as C,ma as f,sa as P,sb as k,tc as o,uc as l,vc as R,wc as O,yb as u}from"./chunk-DBE7WQEG.js";import{g as T}from"./chunk-W7GRJBO5.js";var _e=()=>({width:"600px"}),ue=()=>({minWidth:"200px"});function xe(t,r){t&1&&g(0,"app-widget-loading")}function ve(t,r){if(t&1){let e=y();a(0,"app-widget-api-error",4),E("retry",function(){C(e);let m=p();return f(m.loadData())}),n()}}function Ce(t,r){if(t&1&&(a(0,"div",5)(1,"div",11)(2,"div",12)(3,"div",13)(4,"div",14),o(5),d(6,"translate"),n(),a(7,"div",15),o(8),n()()()(),a(9,"div",11)(10,"div",12)(11,"div",13)(12,"div",14),o(13),d(14,"translate"),n(),a(15,"div",15),o(16),n()()()(),a(17,"div",11)(18,"div",12)(19,"div",13)(20,"div",14),o(21),d(22,"translate"),n(),a(23,"div",16),o(24),n()()()(),a(25,"div",11)(26,"div",12)(27,"div",13)(28,"div",14),o(29),d(30,"translate"),n(),a(31,"div",17),o(32),n()()()()()),t&2){let e=p(2);i(5),l(s(6,8,"MANAGER.ORDERS.STAT_REVENUE")),i(3),l(e.formatPrice(e.stats.totalRevenue,"EUR")),i(5),l(s(14,10,"MANAGER.ORDERS.STAT_ORDERS")),i(3),l(e.stats.totalOrders),i(5),l(s(22,12,"MANAGER.ORDERS.STAT_REFUNDED")),i(3),l(e.formatPrice(e.stats.totalRefunded,"EUR")),i(5),l(s(30,14,"MANAGER.ORDERS.STAT_THIS_MONTH")),i(3),l(e.formatPrice(e.stats.thisMonth,"EUR"))}}function fe(t,r){if(t&1){let e=y();a(0,"button",18),E("click",function(){C(e);let m=p(2);return f(m.onResetFilters())}),g(1,"i",19),o(2),d(3,"translate"),n()}t&2&&(i(2),R(" ",s(3,1,"COMMON.RESET_FILTERS")," "))}function Ee(t,r){t&1&&(a(0,"div",9),g(1,"i",20),a(2,"p",21),o(3),d(4,"translate"),n()()),t&2&&(i(3),l(s(4,1,"MANAGER.ORDERS.EMPTY")))}function ge(t,r){t&1&&(a(0,"tr")(1,"th"),o(2),d(3,"translate"),n(),a(4,"th"),o(5),d(6,"translate"),n(),a(7,"th"),o(8),d(9,"translate"),n(),a(10,"th"),o(11),d(12,"translate"),n(),a(13,"th"),o(14),d(15,"translate"),n(),g(16,"th",25),n()),t&2&&(i(2),l(s(3,5,"MANAGER.ORDERS.COL_ORDER")),i(3),l(s(6,7,"MANAGER.ORDERS.COL_BUYER")),i(3),l(s(9,9,"MANAGER.ORDERS.COL_AMOUNT")),i(3),l(s(12,11,"MANAGER.ORDERS.COL_STATUS")),i(3),l(s(15,13,"MANAGER.ORDERS.COL_DATE")))}function ye(t,r){if(t&1&&(a(0,"div",27),o(1),n()),t&2){let e=p().$implicit;i(),O("",e.buyerFirstName," ",e.buyerLastName,"")}}function Se(t,r){if(t&1){let e=y();a(0,"p-button",33),d(1,"translate"),E("onClick",function(){C(e);let m=p().$implicit,x=p(3);return f(x.refundOrder(m))}),n()}t&2&&v("text",!0)("pTooltip",s(1,2,"MANAGER.ORDERS.BTN_REFUND"))}function Oe(t,r){if(t&1){let e=y();a(0,"tr")(1,"td")(2,"a",26),E("click",function(){let m=C(e).$implicit,x=p(3);return f(x.openDetail(m))}),o(3),n()(),a(4,"td")(5,"div"),o(6),n(),u(7,ye,2,2,"div",27),n(),a(8,"td",28),o(9),n(),a(10,"td"),g(11,"p-tag",29),n(),a(12,"td",27),o(13),d(14,"date"),n(),a(15,"td")(16,"div",30)(17,"p-button",31),d(18,"translate"),E("onClick",function(){let m=C(e).$implicit,x=p(3);return f(x.openDetail(m))}),n(),u(19,Se,2,4,"p-button",32),n()()()}if(t&2){let e=r.$implicit,c=p(3);i(3),R(" ",e.orderNumber," "),i(3),l(e.buyerEmail),i(),_(e.buyerFirstName||e.buyerLastName?7:-1),i(2),l(c.formatPrice(e.totalCents,e.currency)),i(2),v("value",c.getStatusLabel(e.status))("severity",c.getStatusSeverity(e.status))("rounded",!0),i(2),l(A(14,11,e.createdAt,"short")),i(4),v("text",!0)("pTooltip",s(18,14,"COMMON.VIEW")),i(2),_(c.canRefund(e)?19:-1)}}function Re(t,r){if(t&1){let e=y();a(0,"p-table",22),E("onLazyLoad",function(m){C(e);let x=p(2);return f(x.onPageChange(m))}),u(1,ge,17,15,"ng-template",23)(2,Oe,20,16,"ng-template",24),n()}if(t&2){let e=p(2);v("value",e.orders)("lazy",!0)("paginator",!0)("rows",e.limit)("totalRecords",e.totalOrders)("loading",e.loading)("rowHover",!0)}}function Ae(t,r){if(t&1){let e=y();
1u(0,Ce,33,16,"div",5),a(1,"div",6)(2,"p-select",7),M("ngModelChange",function(m){C(e);let x=p();return w(x.filterStatus,m)||(x.filterStatus=m),f(m)}),E("onChange",function(){C(e);let m=p();return f(m.onFilterChange())}),n(),u(3,fe,4,3,"button",8),n(),u(4,Ee,5,3,"div",9)(5,Re,3,7,"p-table",10)}if(t&2){let e=p();_(e.stats?0:-1),i(2),h(D(7,ue)),v("options",e.statusOptions),L("ngModel",e.filterStatus),i(),_(e.filters&&e.filters.activeCount()>0?3:-1),i(),_(e.orders.length===0?4:5)}}function Te(t,r){if(t&1&&(a(0,"div"),o(1),n()),t&2){let e=p(2);i(),O("",e.selectedOrder.buyerFirstName," ",e.selectedOrder.buyerLastName,"")}}function he(t,r){if(t&1&&(a(0,"div"),o(1),n()),t&2){let e=p(2);i(),l(e.selectedOrder.buyerPhone)}}function Le(t,r){if(t&1&&(a(0,"div"),o(1),n()),t&2){let e=p(3);i(),l(e.selectedOrder.shippingAddressLine2)}}function we(t,r){if(t&1&&(a(0,"div"),o(1),n()),t&2){let e=p(3);i(),l(e.selectedOrder.shippingState)}}function Me(t,r){if(t&1&&(a(0,"div",45),g(1,"span",46),o(2),n()),t&2){let e=p(3);i(),v("ngClass","fp-"+e.selectedOrder.shippingCountry.toLowerCase()),i(),R(" ",e.selectedOrder.shippingCountry," ")}}function De(t,r){if(t&1&&(a(0,"div",35)(1,"h6",37),o(2),d(3,"translate"),n(),a(4,"div"),o(5),n(),u(6,Le,2,1,"div"),a(7,"div"),o(8),n(),u(9,we,2,1,"div")(10,Me,3,2,"div",45),n()),t&2){let e=p(2);i(2),l(s(3,7,"MANAGER.ORDERS.DETAIL_SHIPPING")),i(3),l(e.selectedOrder.shippingAddressLine1),i(),_(e.selectedOrder.shippingAddressLine2?6:-1),i(2),O("",e.selectedOrder.shippingPostalCode," ",e.selectedOrder.shippingCity,""),i(),_(e.selectedOrder.shippingState?9:-1),i(),_(e.selectedOrder.shippingCountry?10:-1)}}function be(t,r){if(t&1&&(a(0,"tr")(1,"td",39),o(2),d(3,"translate"),n(),a(4,"td",40),o(5),n()()),t&2){let e=p(2);i(2),l(s(3,2,"MANAGER.ORDERS.DETAIL_SHIPPING_COST")),i(3),l(e.formatPrice(e.selectedOrder.shippingCents,e.selectedOrder.currency))}}function Ie(t,r){if(t&1&&(a(0,"tr",43)(1,"td"),o(2),d(3,"translate"),n(),a(4,"td",40),o(5),n()()),t&2){let e=p(2);i(2),l(s(3,2,"MANAGER.ORDERS.DETAIL_REFUNDED")),i(3),R("-",e.formatPrice(e.selectedOrder.refundAmountCents,e.selectedOrder.currency),"")}}function Pe(t,r){if(t&1&&(a(0,"div",27),o(1),d(2,"translate"),d(3,"date"),n()),t&2){let e=p(2);i(),O(" ",s(2,2,"MANAGER.ORDERS.DETAIL_PAID_AT"),": ",A(3,4,e.selectedOrder.paidAt,"medium")," ")}}function ke(t,r){if(t&1&&(a(0,"div",27),o(1),d(2,"translate"),d(3,"date"),n()),t&2){let e=p(2);i(),O(" ",s(2,2,"MANAGER.ORDERS.DETAIL_FULFILLED_AT"),": ",A(3,4,e.selectedOrder.fulfilledAt,"medium")," ")}}function Ne(t,r){if(t&1&&(a(0,"div",27),o(1),d(2,"translate"),d(3,"date"),n()),t&2){let e=p(2);i(),O(" ",s(2,2,"MANAGER.ORDERS.DETAIL_REFUNDED_AT"),": ",A(3,4,e.selectedOrder.refundedAt,"medium")," ")}}function Ve(t,r){if(t&1){let e=y();a(0,"p-button",50),d(1,"translate"),E("onClick",function(){C(e);let m=p(3);return f(m.refundOrder(m.selectedOrder))}),n()}t&2&&v("label",s(1,2,"MANAGER.ORDERS.BTN_REFUND"))("outlined",!0)}function Fe(t,r){if(t&1){let e=y();a(0,"div",47),u(1,Ve,2,4,"p-button",48),a(2,"p-button",49),d(3,"translate"),E("onClick",function(){C(e);let m=p(2);return f(m.showDetailDialog=!1)}),n()()}if(t&2){let e=p(2);i(),_(e.canRefund(e.selectedOrder)?1:-1),i(),v("label",s(3,2,"COMMON.CLOSE"))}}function Be(t,r){if(t&1&&(a(0,"div",34)(1,"div",35)(2,"div",36)(3,"span",15),o(4),n(),g(5,"p-tag",29),n()(),a(6,"div",35)(7,"h6",37),o(8),d(9,"translate"),n(),a(10,"div"),o(11),n(),u(12,Te,2,2,"div")(13,he,2,1,"div"),n(),u(14,De,11,9,"div",35),a(15,"div",35)(16,"h6",37),o(17),d(18,"translate"),n(),a(19,"table",38)(20,"tr")(21,"td",39),o(22),d(23,"translate"),n(),a(24,"td",40),o(25),n()(),u(26,be,6,4,"tr"),a(27,"tr")(28,"td",39),o(29),d(30,"translate"),n(),a(31,"td",41),o(32),n()(),a(33,"tr",42)(34,"td"),o(35),d(36,"translate"),n(),a(37,"td",40),o(38),n()(),u(39,Ie,6,4,"tr",43),n()(),a(40,"div",35)(41,"h6",37),o(42),d(43,"translate"),n(),a(44,"div",27),o(45),d(46,"translate"),d(47,"date"),n(),u(48,Pe,4,7,"div",27)(49,ke,4,7,"div",27)(50,Ne,4,7,"div",27),n()(),u(51,Fe,4,4,"ng-template",44)),t&2){let e=p();i(4),l(e.selectedOrder.orderNumber),i(),v("value",e.getStatusLabel(e.selectedOrder.status))("severity",e.getStatusSeverity(e.selectedOrder.status))("rounded",!0),i(3),l(s(9,24,"MANAGER.ORDERS.DETAIL_BUYER")),i(3),l(e.selectedOrder.buyerEmail),i(),_(e.selectedOrder.buyerFirstName||e.selectedOrder.buyerLastName?12:-1),i(),_(e.selectedOrder.buyerPhone?13:-1),i(),_(e.selectedOrder.shippingAddressLine1?14:-1),i(3),l(s(18,26,"MANAGER.ORDERS.DETAIL_AMOUNTS")),i(5),l(s(23,28,"MANAGER.ORDERS.DETAIL_SUBTOTAL")),i(3),l(e.formatPrice(e.selectedOrder.subtotalCents,e.selectedOrder.currency)),i(),_(e.selectedOrder.shippingCents>0?26:-1),i(3),l(s(30,30,"MANAGER.ORDERS.DETAIL_PLATFORM_FEE")),i(3),R("-",e.formatPrice(e.selectedOrder.platformFeeCents,e.selectedOrder.currency),""),i(3),l(s(36,32,"MANAGER.ORDERS.DETAIL_TOTAL")),i(3),l(e.formatPrice(e.selectedOrder.totalCents,e.selectedOrder.currency)),i(),_(e.selectedOrder.refundAmountCents?39:-1),i(3),l(s(43,34,"MANAGER.ORDERS.DETAIL_DATES")),i(3),O(" ",s(46,36,"MANAGER.ORDERS.DETAIL_CREATED_AT"),": ",A(47,38,e.selectedOrder.createdAt,"medium")," "),i(3),_(e.selectedOrder.paidAt?48:-1),i(),_(e.selectedOrder.fulfilledAt?49:-1),i(),_(e.selectedOrder.refundedAt?50:-1)}}var me=class t{payLinkService=S(ce);toastService=S(j);confirmService=S(pe);translateService=S(U);route=S(B);qf=S(se);destroyRef=S(P);destroy$=new b;filters;loading=!0;error="";orders=[];totalOrders=0;stats=null;page=1;limit=20;sort="createdAt";order="DESC";filterStatus="";filterPayLinkId="";showDetailDialog=!1;selectedOrder=null;statusOptions=[{label:"MANAGER.ORDERS.FILTER_ALL",value:""},{label:"MANAGER.ORDERS.STATUS_PENDING",value:"pending"},{label:"MANAGER.ORDERS.STATUS_PAID",value:"paid"},{label:"MANAGER.ORDERS.STATUS_PROCESSING",value:"processing"},{label:"MANAGER.ORDERS.STATUS_FULFILLED",value:"fulfilled"},{label:"MANAGER.ORDERS.STATUS_REFUNDED",value:"refunded"},{label:"MANAGER.ORDERS.STATUS_FAILED",value:"failed"}];ngOnInit(){this.filters=this.qf.init(this.route,[{key:"status",default:""},{key:"page",default:1,type:"number"},{key:"limit",default:20,type:"number"}],()=>this.onFiltersChanged(),this.destroyRef),this.syncFromFilters(),this.loadData(),this.payLinkService.refresh$.pipe(I(this.destroy$)).subscribe(()=>this.loadData())}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}loadData(){return T(this,null,function*(){this.loading=!0,this.error="";try{let[r,e]=yield Promise.all([this.payLinkService.getOrders({page:this.page,limit:this.limit,sort:this.sort,order:this.order,status:this.filterStatus||void 0,payLinkId:this.filterPayLinkId||void 0}),this.payLinkService.getOrderStats()]);this.orders=r.data,this.totalOrders=r.total,this.stats=e}catch(r){this.error=r?.error?.message||r?.message||"Error"}finally{this.loading=!1}})}onPageChange(r){let e=Math.floor(r.first/r.rows)+1;this.filters.set({page:e,limit:r.rows}),this.syncFromFilters(),this.loadData()}onFilterChange(){this.filters.set({status:this.filterStatus,page:1}),this.syncFromFilters(),this.loadData()}syncFromFilters(){let r=this.filters.values();this.filterStatus=r.status,this.page=r.page,this.limit=r.limit}onFiltersChanged(){this.syncFromFilters(),this.loadData()}onResetFilters(){this.filters.reset()}openDetail(r){this.selectedOrder=r,this.showDetailDialog=!0}refundOrder(r){return T(this,null,function*(){if(yield this.confirmService.confirm({message:this.translateService.instant("MANAGER.ORDERS.CONFIRM_REFUND_MSG",{orderNumber:r.orderNumber}),header:this.translateService.instant("MANAGER.ORDERS.CONFIRM_REFUND_TITLE"),severity:"danger",acceptLabel:this.translateService.instant("MANAGER.ORDERS.BTN_REFUND"),rejectLabel:this.translateService.instant("COMMON.CANCEL")}))try{yield this.payLinkService.refundOrder(r.id),this.toastService.success(this.translateService.instant("MANAGER.ORDERS.TOAST_REFUNDED")),this.payLinkService.refresh()}catch(c){this.toastService.error(c?.error?.message||c?.message||"Error")}})}formatPrice(r,e){return(r/100).toFixed(2)+" "+e}getStatusSeverity(r){switch(r){case"paid":return"success";case"fulfilled":return"success";
1case"pending":return"warn";case"processing":return"info";case"failed":return"danger";case"refunded":return"danger";case"partially_refunded":return"warn";case"ecommerce_sync_failed":return"danger";default:return"info"}}getStatusLabel(r){return this.translateService.instant("MANAGER.ORDERS.STATUS_"+r.toUpperCase())}canRefund(r){return r.status==="paid"||r.status==="fulfilled"}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=k({type:t,selectors:[["app-view-manager-pay-link-orders"]],decls:11,vars:14,consts:[[1,"d-flex","justify-content-between","align-items-center","mb-2"],[1,"text-light","fs-6"],[1,"pi","pi-receipt","me-2"],[3,"visibleChange","header","visible","modal","closable"],[3,"retry"],[1,"row","g-3","mb-4"],[1,"d-flex","gap-3","mb-3","align-items-center"],["optionLabel","label","optionValue","value",3,"ngModelChange","onChange","options","ngModel"],[1,"btn","btn-sm","btn-outline-secondary","d-flex","align-items-center","gap-1"],[1,"text-center","text-muted","py-5"],["styleClass","p-datatable-sm",3,"value","lazy","paginator","rows","totalRecords","loading","rowHover"],[1,"col-6","col-md-3"],[1,"card","h-100"],[1,"card-body","text-center"],[1,"text-muted","small","mb-1"],[1,"fw-bold","fs-5"],[1,"fw-bold","fs-5","text-danger"],[1,"fw-bold","fs-5","text-success"],[1,"btn","btn-sm","btn-outline-secondary","d-flex","align-items-center","gap-1",3,"click"],[1,"pi","pi-filter-slash"],[1,"pi","pi-inbox",2,"font-size","3rem","opacity","0.3"],[1,"mt-3"],["styleClass","p-datatable-sm",3,"onLazyLoad","value","lazy","paginator","rows","totalRecords","loading","rowHover"],["pTemplate","header"],["pTemplate","body"],[2,"width","100px"],[1,"text-primary","cursor-pointer",3,"click"],[1,"text-muted","small"],[1,"fw-semibold"],[3,"value","severity","rounded"],[1,"d-flex","gap-1","justify-content-end"],["icon","pi pi-eye","severity","secondary","size","small",3,"onClick","text","pTooltip"],["icon","pi pi-replay","severity","danger","size","small",3,"text","pTooltip"],["icon","pi pi-replay","severity","danger","size","small",3,"onClick","text","pTooltip"],[1,"row","g-3"],[1,"col-12"],[1,"d-flex","justify-content-between","align-items-center"],[1,"mb-2"],[1,"table","table-sm","mb-0"],[1,"text-muted"],[1,"text-end"],[1,"text-end","text-danger"],[1,"fw-bold"],[1,"text-danger"],["pTemplate","footer"],[1,"d-flex","align-items-center","gap-2"],[1,"fp","fp-rounded",3,"ngClass"],[1,"d-flex","justify-content-end","gap-2"],["icon","pi pi-replay","severity","danger",3,"label","outlined"],["severity","secondary",3,"onClick","label"],["icon","pi pi-replay","severity","danger",3,"onClick","label","outlined"]],template:function(e,c){e&1&&(a(0,"div",0)(1,"span",1),g(2,"i",2),o(3),d(4,"translate"),n()(),u(5,xe,1,0,"app-widget-loading")(6,ve,1,0,"app-widget-api-error")(7,Ae,6,8),a(8,"p-dialog",3),d(9,"translate"),M("visibleChange",function(x){return w(c.showDetailDialog,x)||(c.showDetailDialog=x),x}),u(10,Be,52,41),n()),e&2&&(i(3),R("",s(4,9,"MANAGER.ORDERS.TITLE")," "),i(2),_(c.loading&&!c.orders.length?5:c.error?6:7),i(3),h(D(13,_e)),v("header",s(9,11,"MANAGER.ORDERS.DETAIL_TITLE")),L("visible",c.showDetailDialog),v("modal",!0)("closable",!0),i(2),_(c.selectedOrder?10:-1))},dependencies:[F,N,V,G,Y,H,$,W,z,Z,X,q,le,oe,J,Q,re,ae,te,ee,ne,ie,K,de],styles:[".card[_ngcontent-%COMP%]{border:1px solid var(--surface-border);background:var(--surface-card)}[_nghost-%COMP%] .p-datatable .p-datatable-tbody>tr{cursor:pointer}"]})};export{me as ViewManagerPayLinkOrdersComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.