import{d as G,r as l,b7 as Q,a as W,qu as Y,b as H,j as t,B as J,eI as K,uw as L,ux as f,Q as U,T as X,R as j,uy as n,qw as Z,uz as w,mn as ee,_ as te,uA as ae}from"./index-e79f7aad.js";import{T as re}from"./index-a65810f4.js";import{M as se}from"./MasterPageTitle-a4f02d02.js";import{A as ie}from"./add.bidnature-4f31989e.js";import{c as oe,b as ne,u as le}from"./index.esm-1ca67d65.js";import{o as pe}from"./yup-96f14780.js";import{P as ce}from"./Select-8a61e5a6.js";import{T as de}from"./TextField-21e22d39.js";import{I as me}from"./InputAdornment-d42c17cd.js";import"./TableRow-0ea91e40.js";import"./useMediaQuery-9155ba05.js";import"./TableContainer-00013c19.js";import"./TableHead-1f8b658d.js";import"./TablePagination-6f9f31d4.js";import"./KeyboardArrowRight-4ee9435c.js";import"./LastPage-1ca2417e.js";import"./Toolbar-d2cd5725.js";import"./MenuItem-c14df0e9.js";import"./dividerClasses-691b251c.js";import"./listItemTextClasses-d3a968ad.js";import"./listItemIconClasses-03011ebf.js";import"./index.esm-05058101.js";import"./Divider-d5c2dff6.js";import"./FilterFilled-8d538f67.js";import"./AntdIcon-1cfbd840.js";import"./objectSpread2-d56e1476.js";import"./index-310d07a1.js";import"./GenericThumbnailView-8a83a30c.js";import"./createClass-b86a4c8d.js";import"./popper-f3391c26.js";import"./ScrollableList-5929779e.js";import"./CircularProgress-8c35778c.js";import"./FormInput-07daa19d.js";import"./FormControlLabel-bfeefc5c.js";import"./Checkbox-b895334d.js";import"./SwitchBase-e7cea42d.js";import"./componentStyles-7718fc5e.js";import"./TextArea-ec29d1d5.js";import"./DialogContent-6a297cef.js";import"./DialogTitle-62595023.js";import"./DialogContentText-0c5306f9.js";import"./DialogActions-edd1d02f.js";import"./index-e5978b8b.js";import"./isMuiElement-db2b7d4c.js";const it=()=>{const a=G(),[S,u]=l.useState(!1);l.useState("");const o=Q(),[h,g]=l.useState(null),b=!!h,[p,y]=l.useState(null),{bidnature:{bidnatureList:v,pageParams:r,loading:C,bidnatureCount:z,searchValue:ue,masterValue:B,masterEditId:I},system:{userAccessList:i}}=W(e=>({bidnature:Y(e),system:H(e)})),M=[{title:"S.No",width:100},{title:"Code",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function T(e,s,d,m){return{index:e,code:s,name:d,actions:m}}let P=oe({search:ne()});const{control:he,handleSubmit:_,register:N,reset:O}=le({resolver:pe(P),values:{search:r.search}}),E=(e,s)=>{y(s),g(e.currentTarget)},c=()=>{g(null)},k=e=>{a(ae({id:e,clearDataFn:()=>{},navigate:s=>{},pageParams:r})),a(n({...r,search:"",page:1,page_size:10})),c()},A=v.map((e,s)=>{const d=(r.page-1)*r.page_size+(s+1),m=t.jsxs(J,{justifyContent:"start",alignItems:"center",sx:{display:"flex",gap:2},children:[(i==null?void 0:i.indexOf("Masters.change_sourceportal"))!==-1&&t.jsx(K,{style:{cursor:"pointer",color:"#fc6f03"},onClick:()=>{a(L({id:e==null?void 0:e.id})),x(!0),a(f(e==null?void 0:e.id))}}),(i==null?void 0:i.indexOf("Masters.delete_sourceportal"))!==-1&&t.jsxs(t.Fragment,{children:[t.jsx(U,{style:{cursor:"pointer",color:"#fc6f03"},onClick:$=>E($,e==null?void 0:e.id)}),t.jsx(ce,{id:p?String(p):void 0,open:b,anchorEl:h,onClose:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:t.jsxs("div",{style:{padding:"15px"},children:[t.jsx(X,{variant:"subtitle1",gutterBottom:!0,children:"Are you sure to delete this Record?"}),t.jsx(j,{variant:"contained",type:"submit",color:"primary",onClick:()=>k(p),autoFocus:!0,children:"Yes"}),t.jsx(j,{variant:"outlined",size:"small",onClick:c,style:{marginLeft:"20px"},children:"No"})]})})]})]});return T(d,e.code,e.name,m)}),D=({search:e})=>{a(n({...r,search:e||"",page:1,page_size:10}))},F=(e,s)=>{a(n({...r,search:"",page:s+1}))},V=e=>{a(n({...r,search:"",page:1,page_size:parseInt(e.target.value)}))};l.useEffect(()=>{a(n({...r,search:"",page:1,page_size:10})),o==null||o.setTitle("BidNature"),o==null||o.setSubtitle("Masters"),O({search:""})},[]);const x=e=>{a(f(0)),a(Z({})),u(e),a(w(e))},R=()=>{u(!1)},q=e=>{const s=e.target.value;a(n({...r,search:s||"",page:1,page_size:10}))};return t.jsxs(t.Fragment,{children:[t.jsxs(se,{prefix:"Masters",postfix:"SourcePortal",pageTitle:"SourcePortal",goBack:!0,addModelTile:(i==null?void 0:i.indexOf("Masters.add_sourceportal"))!==-1?"Add Source Portal":void 0,modalVisible:!0,setIsModalVisible:x,pageText:"",children:[t.jsx("form",{action:"",onSubmit:_(D),children:t.jsx(ee,{container:!0,my:2,children:t.jsx(de,{type:"text",sx:{width:"500px"},...N("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:t.jsx(me,{position:"start",children:t.jsx(te,{size:20})})},fullWidth:!0,variant:"outlined",placeholder:"Search",onChange:q})})}),t.jsx(re,{count:z,columns:M,rows:A,loading:C,page:r.page,pageSize:r.page_size,handleChangePage:F,handleChangeRowsPerPage:V})]}),t.jsx(ie,{modal:S,closeModal:R,mastersName:"BidNature",edit_Id:I,mastersValue:B})]})};export{it as default};
