import{b as x,a as h,b0 as b,j as t,e9 as f,ea as g}from"./index-60a3c753.js";import{o as j}from"./yup-92678dde.js";import{T as A}from"./TextArea-b2d5bcf9.js";import{C as I}from"./Modal-72d4e806.js";import{u as S}from"./index.esm-c494934a.js";import{c as v,b as T}from"./index.esm-62d6b2f7.js";const P=({isOpen:n,hide:o})=>{const s=x(),{selectedData:e,pageParams:r,loading:i}=h(a=>b(a)),d=v().shape({name:T().trim().required("Please enter your name").min(1,"Name cannot be just spaces")}),{control:c,handleSubmit:p,reset:l}=S({resolver:j(d),values:{name:e.name}}),u=a=>{const m={name:a.name};e.id?s(g({id:e.id,data:m,params:r,hide:o})):s(f({data:m,params:r,hide:o})),l()};return t.jsx(t.Fragment,{children:t.jsx(I,{isOpen:n,title:(e==null?void 0:e.id)==null?"Add Item":"Edit Item",onClose:()=>{o()},onOK:p(u,a=>{console.log("errors",a)}),okText:"Save",closeText:"",loading:i,showFooter:!0,children:t.jsx("form",{style:{width:"100%"},children:t.jsx(A,{control:c,label:"",name:"name",maxRows:0,placeholder:"Enter item description here...",containerSx:{display:"grid",gap:1}})})})})};export{P as A};
