1import{r as n,j as e,a as p}from"./app-CaP8YSl_.js";import{A as u,a as g,b as j,C as f,c as y,d as N,e as b,f as v,g as A,h as M,i as z}from"./alert-dialog-DotSsbtF.js";import{h as i}from"./moment-BLMuvzoS.js";import{c as C,B as r}from"./createLucideIcon-CkwwBq-Z.js";import{D as T,a as E,b as L,c as P,d as R,e as U}from"./dialog-BlTxoymy.js";import{D as O}from"./data-table-Zayh06Va.js";import{A as V,a as $}from"./app-layout-DHXgqVrB.js";/* empty css */import"./index-DoBsurrP.js";import"./sheet-ByV5uDpT.js";import"./index-Dd79_kh5.js";import"./folder-x-BDQnLYG9.js";import"./index-CGKk7do1.js";import"./index-DNQFP-Mx.js";import"./app-logo-icon-DjgN192f.js";import"./users-BvDzJe9j.js";import"./chevron-right-Dmtt37_k.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const F=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}
6]],H=C("ExternalLink",F);/** 7 * @license lucide-react v0.475.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const I=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],K=C("Eye",I),D=(s,a)=>{switch(s.toUpperCase()){case"USDT TRC 20":return`https://tronscan.org/#/transaction/${a}`;case"BITCOIN":return`https://www.blockchain.com/btc/tx/${a}`;case"ETHEREUM":return`https://etherscan.io/tx/${a}`;default:return null}};function B({deposit:s}){const[a,c]=n.useState(!1),[_,o]=n.useState(!1),[X,G]=n.useState(!1),[w,d]=n.useState(!1),[t,l]=n.useState(!1);function m(x){switch(x){case"24 hours":return 1;case"48 hours":return 2;case"72 hours":return 3;case"5 Days":return 5;case"10 Days":return 10;default:return 10}}const k=()=>{p.patch(route("deposit.approve",s.id),{},{onStart:()=>l(!0),onSuccess:()=>{o(!1)},onFinish:()=>l(!1)})},S=()=>{p.patch(route("deposit.credit",s.id),{},{onStart:()=>l(!0),onSuccess:()=>{c(!1),d(!1)},onFinish:()=>l(!1)})};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(T,{open:a,onOpenChange:c,children:[e.jsx(E,{asChild:!0,children:e.jsxs(r,{variant:"ghost",size:"icon",className:"rounded-full border border-gray-400",children:[e.jsx(K,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"View"})]})}),e.jsxs(L,{className:"max-h-[90dvh] overflow-auto",children:[e.jsxs(P,{children:[e.jsx(R,{children:"Deposit Details"}),e.jsx(U,{children:"Full information about the selected deposit."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 border p-4 text-sm",children:[e.jsx("p",{className:"text-gray-500",children:"Profit:"}),e.jsxs("p",{className:"font-medium",children:[s.investment_plan.percentage,"% after ",s.investment_plan.maturity]}),e.jsx("p",{className:"text-gray-500",children:"Net Profit:"}),e.jsx("p",{className:"font-medium",children:Number(s.amount)*(s.investment_plan.percentage/100)})," ",e.jsx("p",{className:"text-gray-500",children:"Maturity Date:"}),e.jsx("p",{className:"font-medium",children:i(s.created_at).add(m(s.investment_plan.maturity),"days").format("MMMM Do, YYYY, h:mm A")}),e.jsx("p",{className:"text-gray-500",children:"Days Remaining:"}),e.jsx("p",{className:"font-medium",children:(()=>{const h=i(s.created_at).add(m(s.investment_plan.maturity),"days").diff(i(),"days");return h>0?`${h} days`:"Matured"})()}),e.jsx("div",{children:s.status==="active"&&e.jsxs(u,{open:w,onOpenChange:d,children:[e.jsx(g,{asChild:!0,children:e.jsx(r,{size:"sm",className:"bg-green-500 text-xs hover:bg-green-500",disabled:t,children:"Credit Profit"})}),e.jsxs(j,{children:[e.jsxs("div",{className:"flex flex-col gap-2 max-sm:items-center sm:flex-row sm:gap-4",children:[e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full border","aria-hidden":"true",children:e.jsx(f,{className:"opacity-80",size:16})}),e.jsxs(y,{children:[e.jsx(N,{children:"Are you sure?"}),e.jsx(b,{children:"Are you sure you want to credit the profit of the investment? After crediting the profit this action can't be reversed."})]})]}),e.jsxs(v,{children:[e.jsx(A,{disabled:t,children:"Cancel"}),e.jsx(r,{size:"sm",className:"bg-green-500 text-xs hover:bg-green-500",onClick:S,disabled:t,children:t?"Crediting...":"Credit Profits"})]})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 border p-4 text-sm",children:[e.jsx("p",{className:"text-gray-500",children:"User Name:"}),e.jsx("p",{className:"font-medium",children:s.user.name}),e.jsx("p",{className:"text-gray-500",children:"User Email:"}),e.jsx("p",{className:"font-medium",children:s.user.email}),e.jsx("p",{className:"text-gray-500",children:"Investment Plan:"}),e.jsx("p",{className:"font-medium",children:s.investment_plan.name}),e.jsx("p",{className:"text-gray-500",children:"Amount:"}),e.jsxs("p",{className:"font-medium",children:["$",Number.parseFloat(s.amount).toLocaleStr
11ing()]}),e.jsx("p",{className:"text-gray-500",children:"Payment Method:"}),e.jsx("p",{className:"font-medium",children:s.payment_method.name}),e.jsx("p",{className:"text-gray-500",children:"Payer Account:"}),e.jsx("p",{className:"font-medium",children:s.payer_account}),e.jsx("p",{className:"text-gray-500",children:"Transaction Hash:"}),e.jsxs("p",{className:"flex cursor-pointer items-center gap-1 font-medium break-all text-green-600 underline",children:[s.tranx_hash,D(s.payment_method.name,s.tranx_hash)&&e.jsx("a",{href:D(s.payment_method.name,s.tranx_hash)||"#",target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:underline","aria-label":"Verify transaction on blockchain explorer",children:e.jsx(H,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-gray-500",children:"Status:"}),e.jsx("p",{className:"font-medium",children:e.jsx("span",{className:`rounded-full px-2 py-1 text-xs font-medium ${s.status==="completed"?"bg-green-100 text-green-800":s.status==="pending"?"bg-yellow-100 text-yellow-800":"bg-red-100 text-red-800"}`,children:s.status.charAt(0).toUpperCase()+s.status.slice(1)})}),e.jsx("p",{className:"text-gray-500",children:"Created At:"}),e.jsx("p",{className:"font-medium",children:new Date(s.created_at).toLocaleString()})]})]})]})]}),s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(u,{open:_,onOpenChange:o,children:[e.jsx(g,{asChild:!0,children:e.jsxs(r,{variant:"outline",size:"sm",className:"border-green-200 bg-transparent text-xs text-green-600 hover:bg-green-50",children:[e.jsx(M,{className:"size-3"}),"Approve"]})}),e.jsxs(j,{children:[e.jsxs("div",{className:"flex flex-col gap-2 max-sm:items-center sm:flex-row sm:gap-4",children:[e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full border","aria-hidden":"true",children:e.jsx(f,{className:"opacity-80",size:16})}),e.jsxs(y,{children:[e.jsx(N,{children:"Are you sure?"}),e.jsx(b,{children:"Are you sure you want to approve this deposit investment? After approval this action can't be reversed."})]})]}),e.jsxs(v,{children:[e.jsx(A,{disabled:t,children:"Cancel"}),e.jsx(r,{disabled:t,onClick:k,children:"Confirm"})]})]})]}),e.jsxs(r,{disabled:t,variant:"outline",size:"sm",className:"border-red-200 bg-transparent text-red-600 hover:bg-red-50",children:[e.jsx(z,{className:"mr-2 h-4 w-4"}),"Reject"]})]})]})}const Y=[{accessorKey:"user.name",header:"User Name"},{accessorKey:"investment_plan.name",header:"Investment Plan"},{accessorKey:"amount",header:"Amount (USDT)"},{accessorKey:"payment_method.name",header:"Payment Method"},{accessorKey:"status",header:"Status",cell:({row:s})=>e.jsx("span",{className:`rounded-full px-2 py-1 text-xs font-medium capitalize ${s.getValue("status")==="completed"?"bg-green-100 text-green-800":s.getValue("status")==="pending"?"bg-yellow-100 text-yellow-800":"bg-red-100 text-red-800"}`,children:s.getValue("status")})},{id:"created_at",header:"Created At",cell:({row:s})=>{const a=s.original.created_at;return console.log(a),e.jsx("span",{children:new Date(a).toLocaleDateString()})}},{id:"actions",enableHiding:!1,header:"Actions",cell:({row:s})=>e.jsx(B,{deposit:s.original})}],q=[{title:"Dashboard",href:"/dashboard"},{title:"Deposits",href:"/deposits"}];function he({deposits:s}){return e.jsx(V,{breadcrumbs:q,children:e.jsxs("div",{className:"flex-1 px-4 py-8 md:px-6 lg:py-8",children:[e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx($,{className:"h-6 w-6 text-gray-600"}),e.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:"Manage Deposits"})]}),e.jsx("p",{className:"mt-2 text-gray-600",children:"Review and manage all user deposits."})]}),e.jsx(O,{data:s.data,columns:Y})]})})}export{he 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.