import{r,a as W,c as q,j as e,v as A,I as U,i as I}from"./index-7c7a558c.js";import{B as D}from"./Breadcrumb-f4cb0f42.js";import{g as L}from"./fastWithdrawApi-a6a9d56d.js";const P=()=>{var m,j,u,i,N,g,b,y,f,h,v,S;const[n,F]=r.useState(25),_=25,o=10,{isLoading:a,data:t,refetch:p,isFetching:E,isError:R,error:x}=W("getAdminCompletedFastWithdrawals",()=>L({count:n})),d=q();r.useEffect(()=>{const s=localStorage.getItem("token"),c=localStorage.getItem("user");s&&c||d("/login")},[d]),r.useEffect(()=>{p()},[n,p]);let l=null;return a&&(l=e.jsx("tr",{className:"section-bg border-b dark:text-white",children:e.jsx("td",{colSpan:o,className:"text-center text-white",children:e.jsx("div",{className:"text-center flex justify-center items-center my-6",children:e.jsx(I,{color:"white",size:"lg",variant:"dots"})})})})),!a&&R&&(l=e.jsx("tr",{className:"section-bg border-b dark:text-white",children:e.jsx("td",{colSpan:o,className:"text-center text-white py-6",children:`${x==null?void 0:x.error}`})})),!a&&((j=(m=t==null?void 0:t.data)==null?void 0:m.data)==null?void 0:j.withdraws.length)===0&&(l=e.jsx("tr",{className:"section-bg border-b dark:text-white",children:e.jsx("td",{colSpan:o,className:"text-center text-white py-6",children:"No Withdrawal Found!"})})),!a&&((i=(u=t==null?void 0:t.data)==null?void 0:u.data)==null?void 0:i.withdraws.length)>0&&(l=(g=(N=t==null?void 0:t.data)==null?void 0:N.data)==null?void 0:g.withdraws.map((s,c)=>{var k,C;return e.jsxs("tr",{className:"section-bg border-b dark:text-white",children:[e.jsx("td",{"data-label":"Serial",className:"px-6 py-4",children:c+1}),e.jsx("td",{"data-label":"Method",className:"px-6 py-4",children:s==null?void 0:s.payment_method}),e.jsx("td",{"data-label":"Amount",className:"px-6 py-4",children:s==null?void 0:s.amount}),e.jsxs("td",{"data-label":"User",className:"px-6 py-4",children:[e.jsxs("p",{children:["Name: ",(k=s==null?void 0:s.user)==null?void 0:k.name]}),e.jsx("br",{}),e.jsxs("p",{children:["ID: ",(C=s==null?void 0:s.user)==null?void 0:C.referral_code]})]}),e.jsx("td",{"data-label":"Note",className:"px-6 py-4",children:s==null?void 0:s.note}),e.jsx("td",{"data-label":"Request user note",className:"px-6 py-4",children:s==null?void 0:s.request_user_note}),e.jsx("td",{"data-label":"User Id",className:"px-6 py-4",children:s==null?void 0:s.user_id}),e.jsx("td",{"data-label":"Date",className:"px-6 py-4",children:A(s==null?void 0:s.created_at)}),e.jsx("td",{"data-label":"Status",className:"px-6 py-4",children:(s==null?void 0:s.status)==1?e.jsx("span",{className:"bg-yellow-400 text-white p-2 rounded",children:"Requested"}):(s==null?void 0:s.status)==3?e.jsx("span",{className:"bg-red text-white p-2 rounded",children:"Cancelled"}):(s==null?void 0:s.status)==4?e.jsx("span",{className:"bg-[green] text-white p-2 rounded",children:"Completed"}):(s==null?void 0:s.status)==2?e.jsx("span",{className:"bg-orange-600 text-white p-2 rounded",children:"Rejected"}):e.jsx("span",{className:"bg-blue-500 text-white p-2 rounded",children:"Pending"})})]},c)})),e.jsxs(e.Fragment,{children:[e.jsx(D,{title:"Withdrawal Completed"}),e.jsx("div",{className:"container mx-auto my-5 p-5",children:e.jsxs("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg section-bg p-2",children:[e.jsx(U,{dataLength:(y=(b=t==null?void 0:t.data)==null?void 0:b.data)!=null&&y.withdraws.length?(h=(f=t==null?void 0:t.data)==null?void 0:f.data)==null?void 0:h.withdraws.length:0,next:()=>{F(s=>s+_)},hasMore:((S=(v=t==null?void 0:t.data)==null?void 0:v.data)==null?void 0:S.withdraws.length)==n,children:e.jsxs("table",{className:"w-full text-sm text-left text-gray-500 dark:text-gray-400",children:[e.jsx("thead",{className:"text-xs text-gray-700 uppercase bg-white text-black",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"p-6",children:"Serial"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Method"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Amount"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"User"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Note"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Request user note"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"User Id"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Status"})]})}),e.jsx("tbody",{children:l})]})}),E&&e.jsx("div",{className:"text-center flex justify-center items-center my-6",children:e.jsx(I,{color:"white",size:"lg",variant:"dots"})})]})})]})};export{P as default};
