PageSourceSearch

https://sendunlimitedemail.com/sue/mod-D3Z1Aeec.js

js sendunlimitedemail.com collected 2026-10-05 06:25:12 UTC 5,402 bytes, 1 lines download raw bytes

1import{m as w,r,e as x,t as d,j as e}from"./edge-BOITG1XR.js";function C(){const{fmt:a}=w(),[o,g]=r.useState([]),[n,u]=r.useState(null),[y,h]=r.useState(!0),[c,j]=r.useState("all"),[l,i]=r.useState([]);r.useEffect(()=>{m()},[c]);const m=async()=>{try{h(!0);const t=c!=="all"?`?status=${c}`:"",[s,p]=await Promise.all([x.get(`/admin/commissions${t}`),x.get("/admin/commissions/stats")]);g(s.data?.data||s.data),u(p.data)}catch{d.error("Failed to fetch commissions")}finally{h(!1)}},f=async t=>{try{await x.put(`/admin/commissions/${t}/paid`),d.success("Commission marked as paid"),m()}catch(s){d.error(s.response?.data?.message||"Failed to update commission")}},N=async()=>{if(l.length===0){d.error("Select commissions to mark as paid");return}try{await x.post("/admin/commissions/bulk-paid",{commission_ids:l}),d.success(`${l.length} commissions marked as paid`),i([]),m()}catch(t){d.error(t.response?.data?.message||"Error processing bulk payment")}},b=t=>{i(s=>s.includes(t)?s.filter(p=>p!==t):[...s,t])},v=t=>{switch(t){case"paid":return"bg-green-100 text-green-800";
1case"pending":return"bg-yellow-100 text-yellow-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Commission Management"}),l.length>0&&e.jsxs("button",{onClick:N,className:"bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700",children:["Mark ",l.length," as Paid"]})]}),n&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"Total Commissions"}),e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:a(n.total_commissions)})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"Total Payouts"}),e.jsx("div",{className:"text-2xl font-bold text-green-600",children:a(n.total_payouts)})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"Pending Payouts"}),e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:a(n.pending_payouts)})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-4",children:[e.jsx("div",{className:"text-sm text-gray-500",children:"Pending Count"}),e.jsx("div",{className:"text-2xl font-bold text-gray-900",children:n.pending_count||0})]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","paid","cancelled"].map(t=>e.jsx("button",{onClick:()=>j(t),className:`px-4 py-2 rounded-lg text-sm font-medium capitalize ${c===t?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:t},t))}),e.jsx("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:e.jsx("input",{type:"checkbox",onChange:t=>{t.target.checked?i(o.filter(s=>s.status==="pending").map(s=>s.id)):i([])}})}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Seller"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Order"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Amount"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Commission"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Payout"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:y?e.jsx("tr",{children:e.jsx("td",{colSpan:"8",className:"text-center py-8",children:"Loading..."})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"8",className:"text-center py-8 text-gray-500",children:"No commissions found"})}):o.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-3",children:t.status==="pending"&&e.jsx("input",{type:"checkbox",checked:l.includes(t.id),onChange:()=>b(t.id)})}),e.jsx("td",{className:"px-4 py-3 font-medium",children:t.seller?.store_name||"N/A"}),e.jsxs("td",{className:"px-4 py-3 text-sm text-gray-500",children:["#",t.order_id]}),e.jsx("td",{className:"px-4 py-3",children:a(t.order_amount)}),e.jsxs("td",{className:"px-4 py-3 text-red-600",children:["-",a(t.commission_amount)," (",t.commission_rate,"%)"]}),e.jsx("td",{className:"px-4 py-3 text-green-600 font-medium",children:a(t.seller_payout)}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${v(t.status)}`,children:t.status})}),e.jsx("td",{className:"px-4 py-3",children:t.status==="pending"&&e.jsx("button",{onClick:()=>f(t.id),className:"text-sm text-green-600 hover:text-green-800",children:"Mark Paid"})})]},t.id))})]})})]})}export{C 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.