import{r as x,S as f,j as t}from"./app-BZJf8lgN.js";import{C as h}from"./CustomCKEditor-BpmNiC9B.js";import{F as b}from"./fileupload.esm-CWt4e-Qk.js";import{I as s}from"./inputtext.esm-B1lZn37a.js";import{D as j}from"./dropdown.esm-HqLoOpxI.js";import{B as v}from"./button.esm-D_cwsnQR.js";import{I as N}from"./image.esm-DhzuK4QZ.js";import{I as w}from"./InputLabel-Dd3VnoK3.js";import"./hooks.esm-UVLztt_0.js";import"./index.esm-Ckth6fI3.js";import"./index.esm-hRnQzR_k.js";import"./csstransition.esm-BNRxTMOa.js";import"./CSSTransition-DBuKQJwM.js";import"./index.esm-CygY3Qsw.js";import"./index.esm-B5zYYMSp.js";import"./overlayservice.esm-B-BnP5c1.js";const z=({novedad:o,categorias:l,toast:m,setVisibleEditNews:p})=>{const[r,u]=x.useState(o.imagen),{data:i,setData:a,post:c,reset:n}=f({titulo:o.titulo,pie:o.pie,texto:o.texto,imagenFile:null,category_id:o.category_id,_method:"PUT"}),d=e=>{e.preventDefault(),c(route("novedades.update",o.id),{onSuccess:()=>{m.current.show({severity:"success",summary:"Exito",detail:"Novedad Actualizada",life:3e3}),n(),p(!1)}})},g=e=>{u(e.files[0].objectURL),a("imagenFile",e.files[0])};return t.jsxs("form",{onSubmit:d,children:[t.jsx(s,{className:"w-full mb-2",value:i.titulo,placeholder:"Titulo",name:"titulo",onChange:e=>a("titulo",e.target.value)}),t.jsx(s,{className:"w-full mb-2",value:i.pie,placeholder:"Pie de foto",name:"pie",onChange:e=>a("pie",e.target.value)}),t.jsx(h,{data:i.texto,onChange:e=>a("texto",e)}),r&&t.jsx(N,{src:r,className:"w-6rem shadow-2 border-round",height:"200px"}),t.jsx(b,{mode:"basic",name:"img",className:"mt-3",accept:"image/*",chooseLabel:"Subir Imagen",required:!0,onSelect:g}),t.jsx(w,{children:"Resolucion Recomendada 808px * 457px"}),t.jsx(j,{value:i.category_id,onChange:e=>a("category_id",e.value),options:l,optionValue:"id",optionLabel:"titulo",placeholder:"Seleccionar categoria",className:"w-full mt-3"}),t.jsx(v,{type:"submit",className:"mt-5",style:{display:"block",margin:"auto"},children:"Editar Novedad"})]})};export{z as default};
//# sourceMappingURL=EditFormNovedad-Bz9TaIIn.js.map
