1import{j as e}from"./app-xtnexrKX.js";import{V as r,r as t,R as a,U as s,M as l,h as i}from"./vendor-jfmykXpB.js";import{A as o}from"./AdminLayoutNew-C0AoHtGQ.js";import{D as n}from"./DataTableServerSide--4v_MT4L.js";import"./utils-Cp3twET-.js";import"./ApplicationLogo-DxAzR1IV.js";import"./transition-BDGULseq.js";import"./DarkLightModeSwitcher-Cf-XG8h9.js";import"./DataContext-D360ttN-.js";import"./debounce-DUp1Mma4.js";import"./TablePagination-D0KpC2Ah.js";import"./LoadingSpinner-DHt7BdQ_.js";function d({auth:d,segments:c=[]}){const{filters:m}=r().props,[u,g]=t.useState("all"),[x,h]=t.useState(0),f=a.useMemo(()=>[{header:"First Name",accessorKey:"first_name"},{header:"Last Name",accessorKey:"last_name"},{header:"Email",accessorKey:"email"},{header:"Profit",accessorKey:"formatted_profit",cell:({row:r})=>{const t=parseFloat(r.original.profit||0);return e.jsx("span",{className:""+(t>0?"text-green-600 dark:text-green-400":""),children:r.original.formatted_profit})}},{header:"Registered",accessorKey:"created_at",cell:({getValue:e})=>{const r=new Date(e());return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).format(r)}},{header:"",id:"Profile",cell:({row:r})=>e.jsxs(e.Fragment,{children:[e.jsx(s,{href:route("admin.user.view",r.original.id),className:"text-blue-600 dark:text-blue-400 hover:underline",children:"View"})," ","|"," ",e.jsx(s,{href:route("admin.edit",["user",r.original.id]),className:"text-blue-600 dark:text-blue-400 hover:underline",children:"Edit"})," ","|"," ",e.jsx(s,{onClick:e=>((e,r)=>{e.preventDefault(),window.confirm(`Are you sure you want to delete user ${r.first_name} ${r.last_name}?`)&&i.delete(route("admin.user.delete",r.id),{preserveScroll:!0})})(e,r.original),className:"text-red-600 dark:text-red-400 hover:underline cursor-pointer",children:"Delete"})]}),size:100}],[]);return e.jsxs(o,{user:!(!d||!d.user)&&d.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight",children:"Users"}),children:[e.jsx(l,{title:"Users"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg shadow",children:[e.jsx("div",{className:"flex flex-col lg:flex-row",children:e.jsxs("div",{className:"px-4 flex items-center gap-2",children:[e.jsx("label",{htmlFor:"segment-select",className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Segment:"}),e.jsxs("select",{id:"segment-select",className:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",value:u,onChange:e=>{const r=e.target.value;console.log("Segment changed to:",r),g(r),h(e=>e+1)},children:[e.jsx("option",{value:"all",children:"All Users"}),c.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]})}),e.jsx("div",{className:"flex flex-col lg:flex-row",children:e.jsx("div",{className:"w-full",children:e.jsx(n,{columns:f,routeName:"admin.users.list",filters:{...m,segment:u}},x)})})]})]})}export{d 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.