import{a as e}from"./chunk-BNv3lrIs.js";import{n as t,t as n}from"./jsx-runtime-pmtNMKr4.js";import{a as r,n as i}from"./usuarios-uLfQbCp9.js";import{n as a}from"./toast-hrvP3G3Q.js";import{t as o}from"./Col-Cmv4fRfN.js";import{t as s}from"./load-HIf6x4Qy.js";import{Fn as c,Lt as l,Si as u,bi as d,fi as f,li as p,pi as m,ur as h}from"./index-CBXvBSuP.js";import{t as g}from"./Alta-CDxtbO1v.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:i,tipo:a}=(await r(n)).data;t(e),x(i),C(a)}catch(e){console.error(e)}};return(0,_.useEffect)(()=>{E()},[n]),(0,v.jsxs)(v.Fragment,{children:[w&&(0,v.jsx)(s,{}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(m,{className:`justify-content-center`,style:{backgroundColor:`#0c1b30`,position:`fixed`,top:0,width:`100%`,zIndex:1e3},children:(0,v.jsx)(m.Brand,{children:(0,v.jsx)(u,{alt:``,src:g,width:`100%`,height:`100%`})})}),(0,v.jsx)(`div`,{style:{marginTop:`80px`,marginBottom:`80px`},children:(0,v.jsxs)(d,{onSubmit:async t=>{if(t.preventDefault(),e)try{T(!0);let t=await i(e);l(`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)(f,{className:`mb-2`,children:(0,v.jsxs)(o,{children:[(0,v.jsxs)(d.Label,{children:[`Email: `,(0,v.jsx)(`code`,{children:`*`})]}),(0,v.jsx)(d.Control,{type:`email`,placeholder:`Ingresa email`,value:n,onChange:e=>y(e.target.value)})]})}),(0,v.jsxs)(f,{className:`mb-2`,children:[(0,v.jsx)(o,{sm:12,md:4,lg:6,children:(0,v.jsx)(d.Control,{type:`text`,placeholder:`Nombre del usuario`,value:b,disabled:!0})}),(0,v.jsx)(o,{sm:12,md:4,lg:6,children:(0,v.jsx)(d.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)(p,{icon:h}),` 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)(p,{icon:c})})]})]})]})}export{y as default};