import{n as x,r as g,j as e,T as i,B as n}from"./render-BEL5IN7j.js";import{g as j}from"./utils-MPtJ5ynp.js";import{W as f}from"./Base-B0IvxOwn.js";import{D as u,a as E,b as D}from"./DialogTitle-D3yk6KnK.js";import{A as a}from"./Alert-DGyy5JNc.js";import{D as _}from"./DialogActions-CUWg4ydV.js";import{B as l}from"./Button-CGPZXh3G.js";import"./formControlState-YO0xWqIm.js";import"./Select-DyY0x5OK.js";import"./SwitchBase-DFAnYP3H.js";import"./Link-u7JOT8iP.js";import"./Grid-CY2FZLhF.js";import"./isMuiElement-e1vpiHuY.js";import"./Dialog-CGu6k_Gi.js";const F=({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{F as default};
//# sourceMappingURL=DeleteUserDialog-46tpMdeO.js.map
