import{b as j,a as y,g,fm as v,r as S,j as e,I as A,ef as D,J as c,fn as F,fo as p,fp as C}from"./index-d2b25495.js";import{c as w,b as B}from"./index.esm-3043d6d4.js";import{o as N}from"./yup-267e586f.js";import{u as E}from"./index.esm-ce3c2c20.js";import"./componentStyles-0e851d91.js";import{F as P}from"./FormInput-d202e905.js";/* empty css                   */import"./ScrollableList-fc1de312.js";import{D as $,a as k}from"./DialogContent-cded694d.js";import{D as q}from"./DialogTitle-a145b392.js";import{D as L}from"./DialogContentText-43575e44.js";import{D as T}from"./DialogActions-7c802cc8.js";const M=({modal:n,closeModal:t,mastersName:U,edit_Id:r,mastersValue:z})=>{const s=j(),{bidnature:{selectedData:a,pageParams:l},system:{userAccessList:J}}=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}=E({resolver:N(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:l,clearDataFn:()=>{},navigate:f=>{}};s(F(m)),t(),s(p({})),i()}else{const m={obj:{id:r,name:o.name},pageParams:l,clearDataFn:()=>{},navigate:f=>{}};s(C(m)),s(p({})),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(q,{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(A,{onClick:t,children:e.jsx(D,{color:"white"})})]}),e.jsx(k,{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(T,{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{M as A};
