PageSourceSearch

https://app.snapto.ai/assets/CatalogOrder-K3uQQfcl.js

js snapto.ai collected 2026-10-05 15:07:56 UTC 5,049 bytes, 1 lines download raw bytes

1import{r as l,D as z,C as R,p as e,T as d,v as k,w as A,B as S,be as q,bf as L,y as _,L as b,a1 as u,a0 as B}from"./index-C9IH3k-2.js";import{S as E}from"./MainApp-BoiAvjMg.js";import{g as W,I as G,aa as $}from"./TemplateUtil-D1DzmWLm.js";import{g as w,a as K}from"./AuditConstant-C6syQHOu.js";import{u as M,B as Q}from"./HelperMethods-C-ewwU_x.js";import{P as H}from"./PageDescription-BrOUsEZE.js";import{W as P}from"./WalletPointsFilter-D06q_Gh8.js";import{F as J}from"./Table-isZ0WXp4.js";import"./Wrapper-ChjuDa3w.js";import"./index-CmSVNJzc.js";import"./index-Bv3SRNsl.js";import"./CalendarOutlined-DyzsKNdO.js";import"./ClockCircleOutlined-Cym7vptW.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";const ue=()=>{const[C,I]=l.useState([]),[N,g]=l.useState(!1),[n,x]=l.useState({current:1,pageSize:10,total:0}),y=z(),j=R(),f=l.useRef(null),v=M(),m=async(r,t,a)=>{t()},O=l.useMemo(()=>[{title:"ID",dataIndex:"id",key:"id"},{title:"Phone number",dataIndex:"receiverNumber",key:"receiverNumber",...w("receiverNumber","receiverNumber",f,m)},{title:"Name",dataIndex:"customerName",key:"customerName",...w("customerName","Customer Name",f,m)},{title:"Total Count",dataIndex:"totalProduct",key:"totalProduct",sorter:!0,filterDropdown:r=>e.jsx(P,{...r}),render:(r,t)=>{const a=t.productItems.reduce((i,s)=>i+parseFloat(s.quantity),0);return e.jsx(e.Fragment,{children:a})}},{title:"Total Amount",dataIndex:"totalPrice",key:"totalPrice",sorter:!0,filterDropdown:r=>e.jsx(P,{...r}),render:(r,t)=>{const a=t.productItems.reduce((i,s)=>i+parseFloat(s.itemPrice*s.quantity),0);return e.jsx(e.Fragment,{children:a})}},{title:"Creation Time",dataIndex:"creationTime",key:"creationTime",sorter:!0,defaultSortOrder:"descend",...K("creationTime","Creation Time",()=>{},()=>{},m),render:(r,t)=>e.jsx(d.Text,{children:W(t.creationTime)})},{title:"Action",key:"action",render:(r,t)=>e.jsx(k,{children:e.jsx(A,{title:"Review and send a payment message manually.",children:e.jsx(S,{variant:"filled",shape:"round",onClick:()=>{y(q("Payment")),y(L([])),j("/SendMessages",{state:{catalogOrder:{...t,to:t.receiverNumber,orderItems:t.productItems.map(a=>({retailer_id:a.productRetailerId||"",name:a.productName||a.currency,amount:{value:parseFloat(a.itemPrice*a.quantity)||0},quantity:parseInt(a.quantity)||1})),customBody:`Hello ${t.customerName||"Customer"}, you have placed an order with us. Please review your order details below and continue with the payment to complete your purchase.`}}})},children:"Review & Send Payment Message"})})})}],[]);l.useEffect(()=>{T(n.current,n.pageSize)},[n.current,n.pageSize]);const T=async(r,t,a=[],i=[])=>{g(!0);try{const c=await _("/api/v1/catalog/orders",{pagination:{current:r,pageSize:t},search:a,order:i});c&&(I(c.data.results),x(p=>({...p,total:c.data?.total||0})))}catch(s){console.error("Error fetching catalog orders:",s)}finally{g(!1)}},F=async({pagination:r,search:t=[],order:a=[]})=>{await T(r.current,r.pageSize,t,a)},D=(r,t,a)=>{const i={current:r?.current??1,pageSize:r?.pageSize??10};x({...i,total:n.total});const s=a.order?[{fieldName:a.columnKey||a.field,dir:a.order==="descend"?"desc":"asc"}]:[],c=["totalProduct","totalPrice"],p=Object.entries(t??{}).filter(([o])=>!c.includes(o)).map(([o,h])=>({fieldName:o,value:h!==null?o!=="creationTime"&&o!=="lastUpdateTime"?h:h.map($):null})).filter(({value:o})=>o&&(Array.isArray(o)?o.length>0:!0));p.push(...Q(t,c)),F({pagination:i,search:p,order:s})};return e.jsxs(b,{vertical:!0,gap:"large",children:[e.jsxs(b,{justify:"space-between",children:[e.jsx(d.Title,{level:4,style:{margin:0},children:"Catalog Order"}),e.jsx(S,{icon:e.jsx(E,{}),onClick:()=>j("/GoogleSheets?type=CATALOG"),disabled:!v("manage_integrations"),children:"View Google Sheets"})]}),e.jsx(H,{children:"This page displays a list of orders received through your WhatsApp catalog. When customers browse your catalog and place orders, they appear here with details about the customer, products ordered, quantities, and total amounts. You can review orders and send payment messages to customers to complete their transactions."}),e.jsx(J,{columns:O,dataSource:C,pagination:{current:n.current,pageSize:n.pageSize,total:n.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:(r,t)=>`${t[0]}-${t[1]} of ${r} items`},loading:N,onChange:D,expandable:{expandedRowRender:r=>e.jsx(G,{variant:"borderless",style:{padding:"16px"},styles:{body:{padding:0}},children:r.productItems.map((t,a)=>e.jsx(u,{span:24,children:e.jsxs(B,{gutter:[16,8],children:[e.jsxs(u,{span:6,children:[e.jsx(d.Text,{strong:!0,children:"Product ID:"})," ",t.productRetailerId]}),e.jsxs(u,{span:6,children:[e.jsx(d.Text,{strong:!0,children:"Product Name:"})," ",t.productName]}),e.jsxs(u,{span:6,children:[e.jsx(d.Text,{strong:!0,children:"Quantity:"})," ",t.quantity]}),e.jsxs(u,{span:6,children:[e.jsx(d.Text,{strong:!0,children:"Price:"})," ₹",t.itemPrice]})]})},a))}),rowExpandable:r=>r.productItems.length>0},rowKey:r=>r.id,scroll:{x:"max-content"}})]})};export{ue 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.