PageSourceSearch

https://app.cartsumo.com/assets/ArchivedOrders-CZvMtLmC.js

js cartsumo.com collected 2026-10-05 02:34:39 UTC 8,933 bytes, 1 lines download raw bytes

1import{d as Ie,r as l,A as Re,e as _e,f as w,C as A,j as e,K as D,R as Pe,F as b,S as te,L as Ne,a as Fe}from"./index-BRUYgDZ0.js";import{L as we,l as Ee}from"./index-BmDI_7Yf.js";import{E as Le}from"./Export-JcEb-ahR.js";import{E as ze}from"./ExportModal-C_aPYods.js";import{D as Be}from"./DateFilters2-j3PEfkXd.js";import{C as Ue}from"./Helpers-UFukXBWy.js";import{S as se}from"./Sytles-BlaSVXwF.js";import{S as E}from"./skeleton-DJoRCqp2.js";import{M as Ke,a as $e,b as He,c as Ve}from"./modal-B3S87F5J.js";import{M as re}from"./modal-button-Dxw9to4n.js";import{T as qe,a as ae}from"./tab-CJ-BAGb2.js";import{C as Ye}from"./card-D1zlbeBo.js";import{S as oe}from"./value-CzMcFCoR.js";import{T as Ze,V as Ge}from"./tag-BCwcHbno.js";import{D as Je,A as Qe}from"./drawer-BFrpz1zo.js";import{F as k}from"./form-control-BlzcEpd7.js";import{I as We}from"./input-kmkdOBgI.js";import{S as L}from"./select-DAFEPYlm.js";import{S as Xe}from"./stateful-popover-CW_vBJ0J.js";import{P as et}from"./popover-De8jBRfr.js";import{C as tt}from"./chevron-down-B4RCkKsV.js";import{S as st}from"./stateful-menu-DSzfNe12.js";import{S as le}from"./checkbox-DGWfnH7G.js";import{P as rt}from"./pagination-D9hwhtQ4.js";import"./arrow-up-Bs0FLNg2.js";import"./datepicker-DJSvh_7Y.js";import"./chevron-right-DnD3Puxz.js";import"./chevron-left-BVLSnvJV.js";import"./Combination-Cvfc6Fwa.js";import"./base-input-DmRVwGit.js";import"./constants-fIewqu6O.js";import"./currency-symbol-map-C0_j1N4a.js";import"./layer-B9TM2HP5.js";import"./styled-components-5E6YxkEc.js";import"./stateful-container-uwkqfq84.js";import"./hooks-BM4mCzXA.js";const Bt=()=>{document.title="Orders - CartSumo";let z=Ie();const j=l.useContext(Re),[m,u]=l.useState([]),[x,B]=l.useState({}),[c,U]=l.useState([]),[h,K]=l.useState([]),[O,$]=l.useState([]),[ie,ne]=l.useState("1"),[de,ce]=l.useState(1),[M,he]=l.useState(1),[f,pe]=l.useState([!1]),[p,T]=l.useState([]),[me,g]=l.useState(!1),[n,I]=l.useState([]),[d,R]=l.useState([]),[ue,_]=l.useState(!1),[xe,P]=l.useState(!1),[H,V]=l.useState(!1),[y,fe]=l.useState(!1),[q,v]=l.useState(!1),[je,Y]=l.useState(!0),[Z,G]=l.useState(""),[J,Q]=l.useState(0),W=f.every(Boolean),ge=f.some(Boolean)&&!W,ye=f.includes(!0);function ve(){const[t,s]=Fe();return e.jsx("div",{className:t({display:"flex",alignItems:"center",paddingLeft:s.sizing.scale500}),children:e.jsx(oe,{size:"18px"})})}const N={Popover:{props:{overrides:{Body:{style:{zIndex:11}}}}}},S=_e();let r=new we(Ee);r.setLanguage(localStorage.getItem("lang")?localStorage.getItem("lang"):"en");const X=j.st?j.st:"";l.useEffect(()=>{w.post(A.CARTSUMO.APIURL+"orders/archive",x,{headers:{Authorization:`Bearer ${S}`}}).then(t=>{u(t.data.orders),he(t.data.totalPages);const s=[],a=t.data.orders.length;for(let o=0;o<a;o++)s.push(!1);pe(s),fe(!0)}).catch(t=>{})},[S,x]);const Se=()=>{_(!1)},ee=()=>{P(!1)},Ce=()=>{let t="",s="";Array.isArray(n)&&n.length&&Array.isArray(d)&&d.length&&(t=C(n),s=C(d));const a={search:Z,order_status:c[0]?c[0].id:"",payment_status:h[0]?h[0].id:"",delivery_method:O[0]?O[0].id:"",date_range:p[0]?p[0].id:"",start_date:t,end_date:s};B(a);let o=0;Object.keys(a).forEach(function(F){a[F]&&F!=="start_date"&&F!=="end_date"&&(o=o+1)}),Q(o),Y(!1),v(!1)},Ae=()=>{Q(0),B({}),Y(!0),v(!1),U([]),K([]),$([]),g(!1),T([]),I([]),R([]),G("")},De=()=>{if(_(!1),X){let s="&search="+(x.search?x.search:"");if(Array.isArray(c)&&c[0]&&(s+="&order_status="+c[0].id),Array.isArray(h)&&h[0]&&(s+="&payment_status="+h[0].id),Array.isArray(p)&&p[0]&&(s+="&date_range="+p[0].id),Array.isArray(n)&&n.length&&Array.isArray(d)&&d.length){const o=C(n),i=C(d);o&&i&&(s+="&start_date="+o+"&end_date="+i)}const a=A.CARTSUMO.APPURL+"export_excel/"+X+"?action=archived_orders_report";window.open(a+s)}},be=t=>{t==="delete"&&P(!0)},ke=()=>{V(!0);const t=[];m.map(s=>(s.selected===!0&&(t.push(s.orderNum),u(a=>a.filter(o=>!o.selected))),s)),V(!1),P(!1),w.post(A.CARTSUMO.APIURL+"orders/delete",{orders:t},{headers:{Authorization:`Bearer ${S}`}}).then(s=>{}).catch(s=>{})},C=t=>{var s=new Date(t),a=""+(s.getMonth()+1),o=""+s.getDate(),i=s.getFullYear();return a.length<2&&(a="0"+a),o.length<2&&(o="0"+o),i&&a&&o?[i,a,o].join("-"):""},Oe=t=>{T(t.value),t.value[0]?t.value[0].id!==6?(g(!1),I([]),R([])):g(!0):(g(!1),T([]))},Me=t=>{I(t)},Te=t=>{R(t)};return e.jsxs("div",{children:[e.jsx("h2",{children:r.orders}),e.jsx("div",{className:"cs-my-5",children:y?e.jsx(Le,{clicked:()=>_(!0)}):e.jsx(E,{width:"110px",height:"45px"})}),e.jsx(ze,{modalclose:Se,modalOpen:ue,exportCsv:()=>De()}),e.jsxs(Ke,{onClose:ee,isOpen:xe,overrides:se.ModalOverrides,children:[e.jsx($e,{children:r.orderDeleteConfirm}),e.jsx(He,{children:r.deleteOrderConfirm}),e.jsxs(Ve,{children:[e.jsx(re,{kind:D.secondary,onClick:ee,children:r.cancel}),e.jsx(re,{disabled:H,isLoading:H,onClick:()=>{ke()},children:r.delete})]})]}),e.jsxs(qe,{activeKey:ie,onChange:({activeKey:t})=>{ne(t)},children:[e.jsx(ae,{title:r.orders,onClick:()=>z("/orders")}),e.jsxs(ae,{title:r.archivedOrders,onClick:()=>z("/orders/archive"),children:[e.jsxs(Ye,{overrides:se.CardOverrides,style:{marginTop:"8px"},children:[y?e.jsxs(Pe.Fragment,{children:[e.jsxs("div",{className:"cs-flex",children:[e.jsx(b,{kind:D.secondary,size:te.compact,onClick:()=>v(!q),children:e.jsx(oe,{size:30,title:r.filters})}),J?e.jsx("div",{className:"fl-to-ct",children:e.jsx(Ze,{closeable:!1,variant:Ge.solid,children:J})}):null]}),e.jsx(Je,{isOpen:q,autoFocus:!0,onClose:()=>v(!1),anchor:Qe.right,size:"360px",overrides:{Root:{style:()=>({zIndex:10})}},children:e.jsxs("div",{style:{marginTop:"32px"},children:[e.jsx("div",{children:e.jsx(k,{children:e.jsx(We,{overrides:{Before:ve},autoComplete:"off",name:"search",value:Z,onChange:t=>G(t.target.value),placeholder:r.searchOrders,clearable:!0})})}),e.jsx("div",{children:e.jsx(k,{children:e.jsx(L,{name:"order_status",clearable:!0,options:[{label:r.cancelled,id:"cancelled"},{label:r.completed,id:"completed"}],value:c,searchable:!1,placeholder:r.orderStatus,onChange:t=>U(t.value),overrides:N})})}),e.jsx("div",{children:e.jsx(k,{children:e.jsx(L,{name:"payment_status",clearable:!0,options:[{label:r.pending,id:1},{label:r.paid,id:2},{label:r.partiallyRefunded,id:3},{label:r.refunded,id:4}],value:h,searchable:!1,placeholder:r.paymentStatus,onChange:t=>K(t.value),overrides:N})})}),e.jsx("div",{children:e.jsx(k,{children:e.jsx(L,{name:"delivery_method",clearable:!0,options:[{label:r.localPickup,id:"local_pickup"},{label:r.shipToCustomer,id:"ship_to_customer"}],value:O,searchable:!1,placeholder:r.deliveryMethod,onChange:t=>$(t.value),overrides:N})})}),e.jsx("div",{children:e.jsx(Be,{range:p,dateClear:!0,upDtRng:t=>Oe(t),showDp:me,uptStDt:({date:t})=>Me(Array.isArray(t)?t:[t]),uptEnDt:({date:t})=>Te(Array.isArray(t)?t:[t]),startDate:n,endDate:d})}),e.jsxs("div",{style:{marginTop:"24px"},children:[e.jsx(b,{onClick:()=>Ae(),kind:D.secondary,disabled:je,children:r.clearAllFilters}),e.jsx(b,{style:{float:"right",marginRight:"16px"},onClick:()=>Ce(),children:r.apply})]})]})}),e.jsx("div",{style:{marginTop:"20px"},children:ye?e.jsx(Xe,{placement:et.bottomLeft,content:({close:t})=>e.jsx(st,{items:[{label:r.delete,id:"delete"}],onItemSelect:({item:s})=>{t(),be(s.id)},overrides:{List:{style:{height:"auto",width:"138px"}}}}),children:e.jsx(b,{kind:D.secondary,size:te.compact,endEnhancer:()=>e.jsx(tt,{size:20}),children:r.actions})}):null})]}):e.jsx(E,{width:"200px",height:"50px"}),e.jsx("div",{className:"cs-table",style:{marginTop:"20px"},children:y?e.jsxs("table",{className:"tb-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:e.jsx(le,{isIndeterminate:ge,checked:W,onChange:t=>{let s=t.target.checked;m&&u(m.map((a,o)=>(a.selected=s,f[o]=s,a)))}})}),e.jsxs("th",{children:[r.order," #"]}),e.jsx("th",{children:r.date}),e.jsx("th",{children:r.customer}),e.jsx("th",{children:r.orderStatus}),e.jsx("th",{children:r.paymentStatus}),e.jsx("th",{children:r.total})]})}),e.jsx("tbody",{children:m.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(le,{checked:t.selected,onChange:s=>{let a=s.target.checked;u(m.map((o,i)=>(t.orderNum===o.orderNum&&(o.selected=a,f[i]=a),o)))}})}),e.jsx("td",{children:e.jsx(Ne,{className:"cs-nav-link",to:`/order/${t.orderNum}`,children:t.orderRefNum})}),e.jsx("td",{children:t.createdAt}),e.jsx("td",{children:t.customerName}),e.jsx("td",{children:t.orderStatus}),e.jsx("td",{children:t.paymentStatus}),e.jsx("td",{children:Ue(t.orderTotal,j.currency,j.priceDecimals)})]},t.orderNum))})]}):e.jsx(E,{animation:!0,rows:3,width:"100%",overrides:{Row:{style:{height:"20px",marginBottom:"15px"}}}})})]}),M>1&&y?e.jsx("div",{style:{marginTop:"20px"},children:e.jsx(rt,{numPages:M,currentPage:de,onPageChange:({nextPage:t})=>{const s={...x,page:t};w.post(A.CARTSUMO.APIURL+"orders/archive",s,{headers:{Authorization:`Bearer ${S}`}}).then(a=>{u(a.data.orders)}).catch(a=>{}),ce(Math.min(Math.max(t,1),M))}})}):null]})]})]})};export{Bt as default};

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.