import{r as f,S as g,j as e,a as b,f as m}from"./app-BZJf8lgN.js";import{L as I}from"./layout-DZ5xjWdd.js";import{F as n}from"./fileupload.esm-CWt4e-Qk.js";import{I as S}from"./inputtext.esm-B1lZn37a.js";import{T as v}from"./toast.esm-CYGIlaDH.js";import{I as r}from"./InputLabel-Dd3VnoK3.js";import{B as N}from"./button.esm-D_cwsnQR.js";import{I as d}from"./image.esm-DhzuK4QZ.js";import"./hooks.esm-UVLztt_0.js";import"./CSSTransition-DBuKQJwM.js";import"./index.esm-Ckth6fI3.js";import"./index.esm-hRnQzR_k.js";import"./csstransition.esm-BNRxTMOa.js";import"./index.esm-CygY3Qsw.js";import"./index.esm-B5zYYMSp.js";const M=({contenido:c,iconoSup:t,iconoInf:i})=>{const o=f.useRef(null),{data:l,setData:p,post:u}=g({...c,_method:"PUT"}),x=s=>{s.preventDefault(),u(route("contactos.update",c.id),{onSuccess:()=>{o.current.show({severity:"success",summary:"Exito",detail:"Contenido Actualizado",life:3e3})}})},h=s=>{m.post(route("iconoSup.update",t.id),{iconosup:s.files[0],_method:"PUT"},{onSuccess:()=>{o.current.show({severity:"success",summary:"Exito",detail:"Icono Superior Actualizado",life:3e3})}})},j=s=>{m.post(route("iconoInf.update",i.id),{iconoinf:s.files[0],_method:"PUT"},{onSuccess:()=>{o.current.show({severity:"success",summary:"Exito",detail:"Icono Inferior Actualizado",life:3e3})}})};return e.jsxs(I,{children:[e.jsx(v,{ref:o}),e.jsx(b,{title:"Editar Contacto"}),e.jsxs("div",{className:"grid",children:[e.jsx("div",{className:"col-12",children:e.jsx("div",{className:"card",children:e.jsxs("section",{className:"max-w-xl",children:[e.jsx("header",{children:e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Editar Contacto"})}),e.jsxs("form",{onSubmit:x,children:[Object.keys(l).filter(s=>s!=="id"&&s!=="_method").map(s=>e.jsxs("div",{children:[e.jsx(r,{children:s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}),e.jsx(S,{value:l[s]||"",onChange:a=>p(s,a.target.value),type:s==="correo"?"email":"text",className:"w-full mb-4",placeholder:s.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())})]},s)),e.jsx(N,{type:"submit",label:"Modificar",style:{display:"block",margin:"auto"}})]})]})})}),e.jsx("div",{className:"col-6",children:e.jsxs("div",{className:"card ",children:[e.jsx(r,{children:"Icono Superior"}),t.icono&&e.jsx(d,{src:t.icono,className:"w-2rem ",height:"100px",width:"200px"}),e.jsx(n,{mode:"basic",name:"img",className:"mt-3",accept:"image/*",maxFileSize:1e6,chooseLabel:"Subir Imagen",onSelect:h})]})}),e.jsx("div",{className:"col-6",children:e.jsxs("div",{className:"card ",children:[e.jsx(r,{children:"Icono Inferior"}),i.icono&&e.jsx(d,{src:i.icono,className:"w-1rem ",height:"100px",width:"200px"}),e.jsx(n,{mode:"basic",name:"img",className:"mt-3",accept:"image/*",maxFileSize:1e6,chooseLabel:"Subir Imagen",onSelect:j})]})})]})]})};export{M as default};
//# sourceMappingURL=Contacto-j8wwnPUK.js.map
