import{u as x,r as g,j as e,T as i,B as n}from"./render-D1ZqzUbP.js";import{g as j}from"./utils-VIUIl18e.js";import{W as f}from"./Base-Qt2-pbvB.js";import{D as u,a as E}from"./DialogTitle-J__fqFcw.js";import{A as a}from"./Alert-M7jUzTjE.js";import{D}from"./DialogContentText-BSyscD7T.js";import{D as _}from"./DialogActions-JiHQNj-t.js";import{B as l}from"./Button-DJ_uYab0.js";import"./formControlState-C1XOL3mQ.js";import"./Select-Ht3nAO4Q.js";import"./Link-4dUp4u44.js";import"./Grid-BihMtcd8.js";import"./isMuiElement-BcEQvMml.js";import"./Dialog-aanaDG86.js";const L=({user:t,handleClose:c,handleSuccess:d})=>{const{localeMessages:o,apiBaseUrl:m}=x(),[s,p]=g.useState(""),h=()=>{fetch(`${m}/organizations/${t.organization_id}/users/${t.id}/`,{method:"DELETE",headers:{"Content-Type":"application/json","X-CSRFToken":j("csrftoken")}}).then(r=>{if(r.status!=200)throw new Error("Unhandled network Error! user is not deleted");return r.json()}).then(r=>{if(r.error)throw new Error(r.error);console.log("User deleted successfully:",r),d()}).catch(r=>{p(r.message)})};return e.jsxs(e.Fragment,{children:[e.jsxs(u,{id:"alert-dialog-title",children:[s&&e.jsx(a,{severity:"error",children:s}),e.jsxs(i,{variant:"h6",component:"span",children:[e.jsx(n,{sx:{display:"inline-block",alignItems:"center",mr:1,mt:1,pt:1},children:e.jsx(f,{color:"warning"})}),e.jsx(n,{sx:{display:"inline-block"},children:o.delete_user_with_email.replace("USER_EMAIL",t.email)})]})]}),e.jsxs(E,{children:[e.jsx(D,{id:"alert-dialog-description",children:o.user_delete_confirmation.replace("USER_EMAIL",t.email)}),e.jsx(a,{severity:"info",sx:{mt:2},children:o.delete_note})]}),e.jsxs(_,{children:[e.jsx(l,{onClick:c,children:o.cancel}),e.jsx(l,{onClick:h,autoFocus:!0,variant:"contained",children:e.jsx(i,{children:o.delete})})]})]})};export{L as default};
//# sourceMappingURL=DeleteUserDialog-DIJDLuCk.js.map
