import{r,j as t,a as w,f as v}from"./app-BZJf8lgN.js";import{L as b}from"./layout-DZ5xjWdd.js";import{D as E,C as a}from"./column.esm-BrHEUUD7.js";import{I as g}from"./inputtext.esm-B1lZn37a.js";import{T as N}from"./toast.esm-CYGIlaDH.js";import"./hooks.esm-UVLztt_0.js";import"./CSSTransition-DBuKQJwM.js";import"./button.esm-D_cwsnQR.js";import"./index.esm-mvXJc0W-.js";import"./dropdown.esm-HqLoOpxI.js";import"./overlayservice.esm-B-BnP5c1.js";import"./index.esm-hRnQzR_k.js";import"./csstransition.esm-BNRxTMOa.js";import"./index.esm-CygY3Qsw.js";import"./index.esm-Ckth6fI3.js";import"./index.esm-B5zYYMSp.js";const q=({metadatos:i,auth:s})=>{const d=r.useRef(null),[l,u]=r.useState(i),[y,n]=r.useState({});r.useEffect(()=>{u(i)},[i]);const x=e=>{[...l];let{newData:o,index:T}=e;v.put(route("metadatos.update",o.id),o,{onSuccess:()=>{d.current.show({severity:"success",summary:"Éxito",detail:"Metadato actualizado correctamente.",life:3e3})},onError:c=>{let p="No se pudo actualizar el metadato.";c&&typeof c=="object"&&(p=Object.values(c).join(" ")),d.current.show({severity:"error",summary:"Error de Actualización",detail:p,life:5e3})},onFinish:()=>{n({})}})},m=e=>t.jsx(g,{type:"text",value:e.value||"",onChange:o=>e.editorCallback(o.target.value),className:"w-full p-inputtext-sm"}),f=e=>e.seccion,j=e=>e.keywords,h=e=>e.descripcion;return t.jsxs(b,{auth:s,user:s==null?void 0:s.user,children:[" ",t.jsx(w,{title:"Gestión de Metadatos"}),t.jsx(N,{ref:d}),t.jsx("div",{className:"grid",children:t.jsx("div",{className:"col-12",children:t.jsxs("div",{className:"card",children:[t.jsx("h5",{className:"card-header",children:"Listado de Metadatos"}),t.jsx("div",{className:"p-4",children:t.jsxs(E,{value:l,editMode:"row",dataKey:"id",editingRows:y,onRowEditChange:e=>n(e.data),onRowEditComplete:x,emptyMessage:"No se encontraron metadatos.",responsiveLayout:"scroll",children:[t.jsx(a,{field:"seccion",header:"Sección",body:f,style:{width:"20%"},sortable:!0}),t.jsx(a,{field:"keywords",header:"Keywords",body:j,editor:e=>m(e),style:{width:"35%"},sortable:!0}),t.jsx(a,{field:"descripcion",header:"Descripción",body:h,editor:e=>m(e),style:{width:"35%"},sortable:!0}),t.jsx(a,{rowEditor:!0,headerStyle:{width:"10%",minWidth:"8rem"},bodyStyle:{textAlign:"center"},header:"Editar"})]})})]})})})]})};export{q as default};
//# sourceMappingURL=MetaDatos-BDRecb3d.js.map
