import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,t as n}from"./jsx-runtime-BWRPWl8p.js";import{Aa as r,Ai as i,Da as a,Dr as o,Ei as s,Li as c,Na as l,Qn as u,Qt as d,W as f,da as p,ki as m,zi as h}from"./index-DccLTdzK.js";import{t as g}from"./Alta-B8ZhDz-G.js";var _=e(t(),1),v=n();function y(){let[e,t]=(0,_.useState)(``),[n,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(``),[w,T]=(0,_.useState)(!1),E=async()=>{if(n)try{let{_id:e,nombre:r,tipo:i}=(await l(n)).data;t(e),x(r),C(i)}catch(e){console.error(e)}};return(0,_.useEffect)(()=>{E()},[n]),(0,v.jsxs)(v.Fragment,{children:[w&&(0,v.jsx)(f,{}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(i,{className:`justify-content-center`,style:{backgroundColor:`#0c1b30`,position:`fixed`,top:0,width:`100%`,zIndex:1e3},children:(0,v.jsx)(i.Brand,{children:(0,v.jsx)(h,{alt:``,src:g,width:`100%`,height:`100%`})})}),(0,v.jsx)(`div`,{style:{marginTop:`80px`,marginBottom:`80px`},children:(0,v.jsxs)(c,{onSubmit:async t=>{if(t.preventDefault(),e)try{T(!0);let t=await r(e);d(`Se ha eliminado el usuario `+e),a.success(t.data.mensaje),y(``),x(``),C(``)}catch(e){e.message===`Network Error`?a.error(`Conexión al servidor no disponible`):e.response&&e.response.status===401?a.error(e.response.data.mensaje):a.error(`Error inesperado`)}finally{T(!1)}},style:{padding:`2%`},children:[(0,v.jsx)(`div`,{className:`d-flex`,style:{justifyContent:`space-between`},children:(0,v.jsx)(`div`,{children:(0,v.jsx)(`h4`,{children:`Eliminación de usuario:`})})}),(0,v.jsx)(`hr`,{}),(0,v.jsx)(m,{className:`mb-2`,children:(0,v.jsxs)(p,{children:[(0,v.jsxs)(c.Label,{children:[`Email: `,(0,v.jsx)(`code`,{children:`*`})]}),(0,v.jsx)(c.Control,{type:`email`,placeholder:`Ingresa email`,value:n,onChange:e=>y(e.target.value)})]})}),(0,v.jsxs)(m,{className:`mb-2`,children:[(0,v.jsx)(p,{sm:12,md:4,lg:6,children:(0,v.jsx)(c.Control,{type:`text`,placeholder:`Nombre del usuario`,value:b,disabled:!0})}),(0,v.jsx)(p,{sm:12,md:4,lg:6,children:(0,v.jsx)(c.Control,{type:`text`,value:S,placeholder:`Tipo de usuario`,disabled:!0})})]}),(0,v.jsx)(`br`,{}),(0,v.jsx)(`div`,{className:`divSubmit`,children:(0,v.jsx)(`input`,{disabled:!e,className:`submit`,value:`Enviar`,type:`submit`})})]})}),(0,v.jsxs)(`div`,{style:{position:`fixed`,left:0,bottom:0,width:`100%`,backgroundColor:`#0c1b30`,color:`white`,textAlign:`center`,padding:`10px 0`},children:[(0,v.jsxs)(`p`,{style:{marginBottom:0},children:[(0,v.jsx)(s,{icon:o}),` EL ROBLE #38, COLONIA SANTA CRUZ NIETO, CP 76804, SAN JUAN DEL RÍO, QRO.`]}),(0,v.jsx)(`a`,{href:`mailto:mesadecontrol@grupodentalherfran.com`,style:{color:`#fff`},children:(0,v.jsx)(s,{icon:u})})]})]})]})}export{y as default};