import{d as y,a as f,b as g,qF as v,r as S,j as e,I as F,aM as A,U as m,qG as D,qH as p,qI as C}from"./index-c3f592b2.js";import{c as q,b as w,u as B}from"./index.esm-70dd1c06.js";import{o as N}from"./yup-abb4a026.js";import"./GenericThumbnailView-9f1d2f81.js";import{F as E}from"./FormInput-adbf55b1.js";import"./componentStyles-b8fcedb5.js";import"./ScrollableList-ecbfc0f3.js";import"./TextArea-674a9ec6.js";import{D as P,a as U}from"./DialogContent-b7fc1c43.js";import{D as $}from"./DialogTitle-5d3e2030.js";import{D as k}from"./DialogContentText-c3e782dc.js";import{D as L}from"./DialogActions-6e00f4f1.js";const M=({modal:n,closeModal:t,mastersName:T,edit_Id:r,mastersValue:z})=>{const s=y(),{bidnature:{selectedData:a,pageParams:l},system:{userAccessList:G}}=f(o=>({system:g(o),bidnature:v(o)}));S.useEffect(()=>{n?i({name:(a==null?void 0:a.name)||""}):i()},[n,a]);const u=q().shape({name:w().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}=B({resolver:N(u),values:{name:a!=null&&a.name?a==null?void 0:a.name:""}}),x=o=>{if(r==null||r==""){const c={obj:{name:o.name},pageParams:l,clearDataFn:()=>{},navigate:j=>{}};s(D(c)),t(),s(p({})),i()}else{const c={obj:{id:r,name:o.name},pageParams:l,clearDataFn:()=>{},navigate:j=>{}};s(C(c)),s(p({})),t(),i()}};return e.jsx(e.Fragment,{children:e.jsxs(P,{open:n,onClose:t,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[e.jsxs($,{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(F,{onClick:t,children:e.jsx(A,{color:"white"})})]}),e.jsx(U,{sx:{px:"24px",pt:"12px !important",pb:0},children:e.jsx(k,{id:"alert-dialog-description",sx:{width:500},children:e.jsxs("form",{style:{width:"100%"},onSubmit:h(x),children:[e.jsx(E,{name:"name",label:"Name",required:!0,type:"text",placeholder:"Enter Source Portal here...",control:d}),e.jsxs(L,{sx:{p:2},children:[e.jsx(m,{onClick:t,variant:"outlined",color:"secondary",children:"Cancel"}),r==null||r==""?e.jsx(m,{variant:"contained",type:"submit",color:"primary",autoFocus:!0,children:"Submit"}):e.jsx(m,{variant:"contained",type:"submit",color:"primary",autoFocus:!0,children:"Update"})]})]})})})]})})};export{M as A};
