1import{c as d,as as w,at as C,au as L,an as R,r as x,d as k,j as e,X as E,B as F,t}from"./index-DSXTHp_n.js";import{u}from"./useMutation-DCnUjsax.js";import{I as q}from"./input-CVVKrf1r.js";import{B as _}from"./badge-WDZ8vjSY.js";import{S as B,a as O,b as Q,c as I,d as K}from"./select-mZ6Ie5tF.js";import{S as P}from"./shield-check-Dfn0WxTN.js";import"./index-P72ZlWpd.js";import"./index-BAU_c2OA.js";import"./chevron-down-Bte0CX8p.js";import"./check-B_ORuh6A.js";const U=["admin","manager","customer"],h={admin:"à¦
à§à¦¯à¦¾à¦¡à¦®à¦¿à¦¨",manager:"মà§à¦¯à¦¾à¦¨à§à¦à¦¾à¦°",customer:"à¦à¦¾à¦¸à§à¦à¦®à¦¾à¦°"},V={admin:"bg-red-100 text-red-700 border-red-200",manager:"bg-blue-100 text-blue-700 border-blue-200",customer:"bg-muted text-muted-foreground"};function W(){const p=d(w),j=d(C),g=d(L),l=R(),[o,b]=x.useState(""),[f,N]=x.useState({}),{data:v=[],isLoading:c}=k({queryKey:["admin-users"],queryFn:()=>p()}),i=u({mutationFn:s=>j({data:s}),onSuccess:()=>{t.success("রà§à¦² দà§à¦à¦¯à¦¼à¦¾ হয়à§à¦à§"),l.invalidateQueries({queryKey:["admin-users"]})},onError:s=>t.error(s.message??"বà§à¦¯à¦°à§à¦¥")}),y=u({mutationFn:s=>g({data:s}),onSuccess:()=>{t.success("রà§à¦² সরানৠহয়à§à¦à§"),l.invalidateQueries({queryKey:["admin-users"]})},onError:s=>t.error(s.message??"বà§à¦¯à¦°à§à¦¥")}),m=v.filter(s=>{const r=o.trim().toLowerCase();return r?(s.full_name??"").toLowerCase().includes(r)||(s.email??"").toLowerCase().includes(r)||(s.phone??"").toLowerCase().includes(r):!0});return e.jsxs("div",{className:"p-4 md:p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-primary/10 text-primary",children:e.jsx(P,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl md:text-2xl font-extrabold",children:"à¦à¦à¦à¦¾à¦° রà§à¦² মà§à¦¯à¦¾à¦¨à§à¦à¦®à§à¦¨à§à¦"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"à¦à¦à¦à¦¾à¦°à¦¦à§à¦° à¦
à§à¦¯à¦¾à¦¡à¦®à¦¿à¦¨ / মà§à¦¯à¦¾à¦¨à§à¦à¦¾à¦° / à¦à¦¾à¦¸à§à¦à¦®à¦¾à¦° রà§à¦² দিন বা সরান"})]})]}),e.jsx("div",{className:"rounded-2xl border border-border bg-card p-4 shadow-sm",children:e.jsx(q,{placeholder:"নাম, à¦à¦®à§à¦à¦² বা ফà§à¦¨ দিয়ৠসারà§à¦ à¦à¦°à§à¦¨â¦",value:o,onChange:s=>b(s.target.value),className:"max-w-md"})}),e.jsx("div",{className:"rounded-2xl border border-border bg-card shadow-sm overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/50 text-left",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 font-semibold",children:"à¦à¦à¦à¦¾à¦°"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"à¦à¦¨à§à¦à¦¾à¦à§à¦"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"বরà§à¦¤à¦®à¦¾à¦¨ রà§à¦²"}),e.jsx("th",{className:"px-4 py-3 font-semibold",children:"নতà§à¦¨ রà§à¦² দিন"})]})}),e.jsxs("tbody",{children:[c&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-muted-foreground",children:"লà§à¦¡ হà¦à§à¦à§â¦"})}),!c&&m.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-muted-foreground",children:"à¦à§à¦¨à§ à¦à¦à¦à¦¾à¦° পাà¦à¦¯à¦¼à¦¾ যায়নি"})}),m.map(s=>{const r=f[s.id]??"manager",n=a=>s.roles.includes(a);return e.jsxs("tr",{className:"border-t border-border align-top",children:[e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"font-semibold",children:s.full_name??"â"}),e.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[s.id.slice(0,8),"â¦"]})]}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{children:s.email||"â"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.phone||""})]}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.roles.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"à¦à§à¦¨à§ রà§à¦² নà§à¦"}),s.roles.map(a=>e.jsxs(_,{variant:"outline",className:`gap-1 ${V[a]}`,children:[h[a]??a,e.jsx("button",{onClick:()=>y.mutate({user_id:s.id,role:a}),className:"ml-1 hover:opacity-70","aria-label":"remove",children:e.jsx(E,{className:"h-3 w-3"})})]},a))]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(B,{value:r,onValueChange:a=>N(S=>({...S,[s.id]:a})),children:[e.jsx(O,{className:"w-36",children:e.jsx(Q,{})}),e.jsx(I,{children:U.map(a=>e.jsxs(K,{value:a,disabled:n(a),children:[h[a],n(a)?" â":""]},a))})]}),e.jsx(F,{size:"sm",disabled:n(r)||i.isPending,onClick:()=>i.mutate({user_id:s.id,role:r}),children:"যà§à¦ à¦à¦°à§à¦¨"})]})})]},s.id)})]})]})})})]})}export{W as component};
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.