import{an as d,ap as f,k as x,aH as p,x as i,av as j,w as F,a7 as b,a2 as y,j as e,M as U,Q as D,T as t,R as v,am as B,a3 as E,B as c,ao as T}from"./main-TIUJvpaR.js";import{F as w}from"./date-picker-ChxLcE9J.js";import{F as C}from"./switch-Bj7wwiPq.js";import{D as P}from"./dialog-footer-yCpPZGPO.js";function Q(n,s){return d({mutationFn:a=>x.post(`users/ban/${s.join(",")}`,a).then(r=>r.data),onSuccess:async()=>{p(i("[one User|other :count Users] suspended",{values:{count:s.length}})),await j.invalidateQueries({queryKey:["users"]})},onError:a=>f(a,n)})}function N({userIds:n,description:s,onSuccess:a}){const{trans:r}=F(),{close:m,formId:u}=b(),o=y({defaultValues:{permanent:!0}}),h=o.watch("permanent"),l=Q(o,n);return e.jsxs(U,{children:[e.jsx(D,{children:e.jsx(t,{message:"Suspend users"})}),e.jsxs(v,{children:[e.jsxs(B,{id:u,form:o,onSubmit:g=>l.mutate(g,{onSuccess:()=>{m(!0),a==null||a()}}),children:[e.jsx(w,{name:"ban_until",label:e.jsx(t,{message:"Suspend until"}),disabled:h}),e.jsx(C,{name:"permanent",className:"mt-12",children:e.jsx(t,{message:"Permanent"})}),e.jsx(E,{className:"mt-24",name:"comment",inputElementType:"textarea",maxLength:250,label:e.jsx(t,{message:"Reason"}),placeholder:r(i("Optional"))})]}),s&&e.jsx("div",{className:"mt-16",children:s})]}),e.jsxs(P,{children:[e.jsx(c,{onClick:()=>m(),children:e.jsx(t,{message:"Cancel"})}),e.jsx(c,{form:u,variant:"flat",color:"primary",type:"submit",disabled:l.isPending,children:e.jsx(t,{message:"Suspend"})})]})]})}function R(n){return d({mutationFn:()=>x.delete(`users/unban/${n.join(",")}`).then(s=>s.data),onSuccess:()=>{p(i("[one User|other :count Users] unsuspended",{values:{count:n.length}})),j.invalidateQueries({queryKey:["users"]})},onError:s=>T(s)})}export{N as B,R as u};
