1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[844,9310],{14871:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[org]/manager/transactions",function(){return r(18396)}])},18396:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>z});var o=r(78488),a=r(45738),l=r(48339),n=r(14400),i=r(99745),s=r.n(i),d=r(88),c=r(17563),m=r(81204),u=r(72788),h=r(58723),f=r(10427),x=r(15831),p=r(16462),y=r(26158),_=r(76639),j=r(35737),v=r(98737),g=r.n(v),S=r(49191),w=r(12036),C=r(73593),A=r(48113),b=r(46498),D=r(78085);let N=[u.DDj.CustomerName,u.DDj.Origin,u.DDj.ItemsCount,u.DDj.TotalAmountCents,u.DDj.PaymentMethodType,u.DDj.Status,u.DDj.CreatedAt],I=e=>{var t;let{transactions:r,isLoading:a,pagination:n,totalRows:i,onRowClick:s,onSortStateChange:c,initialSortState:m}=e,u=null!=(t=(0,S.Z5)().defaultIanaTimezone)?t:"UTC",h=(0,w.sN)(null!=r?r:[]);return(0,o.jsx)(b.Ay,{serverSideSorting:!0,loading:a,rows:h,totalRows:i,pagination:n,onRowClick:e=>s(e.transaction),onSortStateChange:e=>{(e=>{let{activeColumnIndex:t,direction:r}=e;c({sort_by:N[t],sort_direction:r})})({comparator:()=>0,activeColumnIndex:e.activeColumnIndex,direction:e.direction})},initialSortState:{comparator:()=>0,activeColumnIndex:m.activeColumnIndex,direction:m.direction},columns:[{title:"Customer",cellContent:e=>{var t;let{row:r}=e;return(0,o.jsx)(l.EY.BodySmallSemiBold,{children:null!=(t=r.transaction.customer_name)?t:"Guest"})},comparator:()=>0,width:"grow"},{title:"Origin",cellContent:e=>{let{row:t}=e;return(0,o.jsx)(l.EY.BodySmallSemiBold,{children:(0,w.zq)(t.transaction.origin)})},comparator:()=>0,width:"grow"},{title:"Quantity",cellContent:e=>{let{row:t}=e;return(0,o.jsx)(l.EY.BodySmallSemiBold,{children:g()("item",t.transaction.line_items.length,!0)})},comparator:()=>0,width:"grow"},{title:"Amount",cellContent:e=>{let{row:t}=e,r=t.payment?t.payment.amount_cents:t.transaction.total_cents,a=t.payment?(0,w.dL)(t.payment):(0,w.JU)(t.transaction);return(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsx)(l.EY.BodySmallSemiBold,{children:(0,C.$5)(r)}),a>0&&(0,o.jsxs)(l.EY.BodySmall,{color:"secondary",children:[(0,C.$5)(a)," refunded"]})]})},comparator:()=>0,width:"grow"},{title:"Payment method",cellContent:e=>{var t,r;let{row:a}=e;return(0,o.jsx)(l.EY.BodySmallSemiBold,{children:null!=(r=null==(t=a.payment)?void 0:t.formatted_payment_method_type)?r:"None"})},comparator:()=>0,width:"grow"},{title:"Payment status",cellContent:e=>{let{row:t}=e;return(0,o.jsx)(D.A,{order:t.transaction})},comparator:()=>0,width:"grow"},{title:"Submitted on",cellContent:e=>{var t,r;let{row:a}=e;return(0,o.jsx)(l.EY.BodySmallSemiBold,{children:(0,A.r6)(d.c9.fromISO(null!=(r=null==(t=a.payment)?void 0:t.created_at)?r:a.transaction.created_at).setZone(u),d.c9.DATETIME_SHORT)})},width:"grow",comparator:()=>0}]})};var P=r(95863),B=r(63378),E=r(84975),k=r(25216),O=r(24846);let T={filters:P.VK,search:null,sort_by:u.DDj.CreatedAt,sort_direction:"desc",store_id:null},R={filters:P.p8,search:null,sort_by:null,sort_direction:null,store_id:null};function Y(){var e,t;let r=(0,S.Z5)(),i=(0,B.qN)(),{createOrgRoute:h}=(0,E.x)(),{query:v,replace:g}=(0,c.useRouter)(),w=v.orderId,[C,A]=(0,m.useState)(w),[b,D]=(0,m.useState)(Object.assign({},T,w?{filters:{...P.VK,search:[w]}}:{})),Y=(0,k.A)({rowsPerPageOptions:[25,100]}),{loading:z,data:V,error:F,refetch:q}=(0,u.BF3)({variables:{organization_id:r.organizationID,limit:Y.rowsPerPage,offset:Y.offset,sort_by:b.sort_by,sort_direction:b.sort_direction,search:b.search||void 0,statuses:b.filters.statuses||void 0,payment_methods:b.filters.payment_methods||void 0,date_from:b.filters.date_from?d.c9.fromJSDate(b.filters.date_from).startOf("day").toISO():void 0,date_to:b.filters.date_to?d.c9.fromJSDate(b.filters.date_to).endOf("day").toISO():void 0,store_id:b.store_id||void 0,origins:b.filters.origins||void 0,price_modifier_ids:b.filters.price_modifier_ids||void 0},fetchPolicy:"network-only"});F&&(O.A.error(F),i("Could not load transactions."));let L=(null==V?void 0:V.getTransactions.transactions)||[],$=(null==V?void 0:V.getTransactions.total_count)||0,J=(0,m.useCallback)(e=>{D(t=>({...t,...e,filters:{...t.filters,...e.filters}})),Y.setPage(0)},[Y]),M=()=>{J(R)},[U,W]=(0,m.useState)(!1),Z=!s()(b,R),K=!s()(b.filters,P.p8);return(0,o.jsxs)("div",{className:"mx-6 my-8 flex flex-1 flex-col gap-y-6",children:[(0,o.jsx)(x.A,{routes:[{label:"Transactions",href:h(a.qD.transactionsRoot)}],loading:z}),(0,o.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,o.jsx)("div",{className:"scrollbar-hide flex flex-row justify-between overflow-x-auto",children:(0,o.jsxs)("div",{className:"flex flex-row items-center gap-2",children:[(0,o.jsx)(_.A,{placeholder:"Search by name, email, phone, or order ID",fieldProps:{autoComplete:"off",variant:"outlined"},onSearch:e=>
1{J({search:null!=e?e:null})}}),(0,o.jsx)("div",{className:"min-w-[280px]",children:(0,o.jsx)(y.A,{organizationId:r.organizationID,name:"store_id",defaultValue:null!=(e=b.store_id)?e:"",value:null!=(t=b.store_id)?t:"",onChange:e=>{J({store_id:null!=e?e:null})}})}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsxs)(l.$n.Secondary,{onClick:()=>W(!0),children:[(0,o.jsxs)("div",{className:"mr-2",children:[(0,o.jsx)(n.A,{fontSize:"small"}),K&&(0,o.jsx)("span",{className:"relative left-[-3px] top-[-9px] inline-block h-[5px] w-[5px] rounded-full bg-brand-primary"})]}),"Filters"]}),Z&&(0,o.jsx)(p.A,{additionalActions:()=>{M()}})]})]})}),z?(0,o.jsx)(f.A,{}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(I,{transactions:L,isLoading:z,pagination:Y,totalRows:$,onRowClick:e=>{g({query:{...v,orderId:e.id}},void 0,{shallow:!0}),A(e.id)},initialSortState:{comparator:()=>0,activeColumnIndex:N.indexOf(b.sort_by||u.DDj.CreatedAt)||0,direction:"asc"===b.sort_direction?u.V47.Asc:u.V47.Desc},onSortStateChange:e=>{J({sort_by:e.sort_by,sort_direction:e.sort_direction})}}),L.length<1&&(0,o.jsxs)("div",{className:"mt-10 text-center",children:[(0,o.jsx)(l.EY.BodyLargeSemiBold,{children:"No results found"}),(0,o.jsx)(l.EY.BodySmall,{className:"mt-1 text-secondary",children:"Try refining your search or filters."}),(0,o.jsx)("div",{className:"mt-4",children:(0,o.jsx)(l.$n.Secondary,{className:"h-[auto] w-[120px] py-[10.5px]",onClick:M,children:"Reset"})})]})]})]}),(0,o.jsx)(j.A,{transactionId:C,onClose:()=>{A(void 0);let e={...v};delete e.orderId,g({query:e},void 0,{shallow:!0}),b.search===v.orderId&&J({search:null})},onOrderUpdate:async()=>{await q()}}),(0,o.jsx)(P.ry,{appliedFilters:b.filters,open:U,onClose:()=>W(!1),onApply:async e=>{J({filters:{...b.filters,...e}}),W(!1)}})]})}Y.PageLayout=h.T;let z=Y},76639:(e,t,r)=>{"use strict";r.d(t,{A:()=>y,W:()=>x});var o=r(78488),a=r(39310),l=r(15950),n=r(44857),i=r(91558),s=r(42155),d=r.n(s),c=r(81204),m=r(33237),u=r(60766),h=r(23268),f=r(5324);let x=()=>{let e=(0,u.wA)();return{searchFilter:(0,u.d4)(f.iP),SearchInput:e=>(0,o.jsx)(p,{...e}),resetSearch:()=>{e((0,f.Pk)())}}},p=e=>{var t;let{disabled:r,onSearch:s,placeholder:x,fieldProps:p,formClassName:y}=e,_=(0,u.wA)(),j=(0,u.d4)(f.iP),v=(0,h.o)(),{InputProps:g,...S}=p||{};function w(e){let t=e.search.trim();_((0,f.LF)(t)),b("search",t),s&&s(t)}let{register:C,handleSubmit:A,setValue:b}=(0,m.mN)({mode:"onChange",reValidateMode:"onChange"});(0,c.useEffect)(()=>{b("search",null!=j?j:"",{shouldValidate:!0})},[j,b]);let{ref:D,...N}=C("search");return(0,o.jsx)("form",{className:"flex md:flex-row md:justify-between md:space-x-2 mmd:flex-col mmd:justify-center ".concat(y),onSubmit:A(w),children:(0,o.jsx)(n.A,{disabled:r,...N,inputProps:{"aria-label":"Search"},placeholder:x||(v?"Search by keyword":"Search by ID, name, email, phone number, or address"),fullWidth:!0,inputRef:D,InputProps:{classes:{input:"py-2 mmd:px-4 h-8 placeholder:text-[#757575] placeholder:opacity-100"},style:{minWidth:v?void 0:415},startAdornment:(0,o.jsx)(i.A,{position:"start",children:(0,o.jsx)(l.A,{className:d()({"mb-4":!["outlined","standard"].includes(null!=(t=null==p?void 0:p.variant)?t:"")})})}),endAdornment:j&&j.length>0?(0,o.jsx)(i.A,{position:"end",className:"cursor-pointer",onClick:()=>{w({search:""})},children:(0,o.jsx)(a.A,{})}):void 0,...g},variant:"filled",...S})})},y=p}},e=>{e.O(0,[7643,5214,9869,3661,5799,2599,4105,320,3630,2463,4098,6055,6482,6943,9436,789,8668,7763,4543,1724,4488,2224,8385,3862,2242,3804,3310,8723,636,6593,8792],()=>e(e.s=14871)),_N_E=e.O()}]);
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.