import{d as f,a as y,b as g,pe as v,r as S,j as e,I as D,aK as A,R as c,pf as F,pg as l,ph as C}from"./index-e6164346.js";import{c as w,b as B,u as N}from"./index.esm-0a041314.js";import{o as E}from"./yup-5fd5d57b.js";import"./GenericThumbnailView-80c6fd98.js";import{F as P}from"./FormInput-859198ec.js";import"./componentStyles-00385170.js";import"./ScrollableList-5a17e8f4.js";import"./TextArea-f5c200de.js";import{D as $}from"./Dialog-2e8a8e2e.js";import{D as k}from"./DialogTitle-8757f50f.js";import{D as q}from"./DialogContent-f10d6731.js";import{D as L}from"./DialogContentText-027be15d.js";import{D as R}from"./DialogActions-31bec80e.js";const _=({modal:n,closeModal:t,mastersName:T,edit_Id:r,mastersValue:U})=>{const s=f(),{bidnature:{selectedData:a,pageParams:p},system:{userAccessList:z}}=y(o=>({system:g(o),bidnature:v(o)}));S.useEffect(()=>{n?i({name:(a==null?void 0:a.name)||""}):i()},[n,a]);const u=w().shape({name:B().required("Please enter source portal name").trim().matches(/^[a-zA-Z0-9 ]*$/,"source portal name should not contain special characters")}),{control:d,handleSubmit:h,reset:i}=N({resolver:E(u),values:{name:a!=null&&a.name?a==null?void 0:a.name:""}}),x=o=>{if(r==null||r==""){const m={obj:{name:o.name},pageParams:p,clearDataFn:()=>{},navigate:j=>{}};s(F(m)),t(),s(l({})),i()}else{const m={obj:{id:r,name:o.name},pageParams:p,clearDataFn:()=>{},navigate:j=>{}};s(C(m)),s(l({})),t(),i()}};return e.jsx(e.Fragment,{children:e.jsxs($,{open:n,onClose:t,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[e.jsxs(k,{sx:{bgcolor:"primary.main",color:"white",p:1,px:2,display:"flex",alignItems:"center",justifyContent:"space-between"},variant:"h4",id:"alert-dialog-title",children:[r==null||r==0?"Add ":"Update ","Source Portal",e.jsx(D,{onClick:t,children:e.jsx(A,{color:"white"})})]}),e.jsx(q,{sx:{px:"24px",pt:"12px !important",pb:0},children:e.jsx(L,{id:"alert-dialog-description",sx:{width:500},children:e.jsxs("form",{style:{width:"100%"},onSubmit:h(x),children:[e.jsx(P,{name:"name",label:"Name",required:!0,type:"text",placeholder:"Enter Source Portal here...",control:d}),e.jsxs(R,{sx:{p:2},children:[e.jsx(c,{onClick:t,variant:"outlined",color:"secondary",children:"Cancel"}),r==null||r==""?e.jsx(c,{variant:"contained",type:"submit",color:"primary",autoFocus:!0,children:"Submit"}):e.jsx(c,{variant:"contained",type:"submit",color:"primary",autoFocus:!0,children:"Update"})]})]})})})]})})};export{_ as A};
