import{r as d,a as W,c as _,j as e,v as F,I as L,i as I}from"./index-7c7a558c.js";import{B as M}from"./Breadcrumb-21e99ae5.js";import{b as z}from"./withdrawApi-ab06adf3.js";const T=()=>{var p,i,j,N,u,b,g,h,y,f,v,S;const[n,k]=d.useState(25),A=25,o=10,{isLoading:c,data:t,refetch:r,isFetching:E,isError:R,error:x}=W("getAdminRejectedWithdrawals",()=>z({count:n})),m=_();d.useEffect(()=>{const s=localStorage.getItem("token"),l=localStorage.getItem("user");s&&l||m("/login")},[m]),d.useEffect(()=>{r()},[n,r]);let a=null;return c&&(a=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"})})})})),!c&&R&&(a=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}`})})),!c&&((i=(p=t==null?void 0:t.data)==null?void 0:p.data)==null?void 0:i.withdraws.length)===0&&(a=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!"})})),!c&&((N=(j=t==null?void 0:t.data)==null?void 0:j.data)==null?void 0:N.withdraws.length)>0&&(a=(b=(u=t==null?void 0:t.data)==null?void 0:u.data)==null?void 0:b.withdraws.map((s,l)=>e.jsxs("tr",{className:"section-bg border-b dark:text-white",children:[e.jsx("td",{"data-label":"Serial",className:"px-6 py-4",children:l+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.jsx("td",{"data-label":"TNX Id",className:"px-6 py-4",children:s==null?void 0:s.transection_id}),e.jsx("td",{"data-label":"Note",className:"px-6 py-4",children:s==null?void 0:s.note}),e.jsx("td",{"data-label":"Admin Note",className:"px-6 py-4",children:s==null?void 0:s.admin_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:F(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:"Approved"}):(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"})})]},l))),e.jsxs(e.Fragment,{children:[e.jsx(M,{title:"Withdrawal Rejected"}),e.jsx("div",{className:"container mx-auto my-5 p-5",children:e.jsxs("div",{className:"relative overflow-x-auto p-2 bg-gradient-to-r from-main to-second shadow-md border-dashed border rounded-tr-xl rounded-bl-xl",children:[e.jsx(L,{dataLength:(h=(g=t==null?void 0:t.data)==null?void 0:g.data)!=null&&h.withdraws.length?(f=(y=t==null?void 0:t.data)==null?void 0:y.data)==null?void 0:f.withdraws.length:0,next:()=>{k(s=>s+A)},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:"TNX Id"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Note"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Admin 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:a})]})}),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{T as default};
