import{d as Q,r as l,b6 as W,a as Y,pc as q,b as H,j as t,B as J,fr as K,ti as L,tj as f,Q as U,T as X,R as j,tk as n,pe as Z,tl as w,l9 as ee,_ as te,tm as ae}from"./index-e972fa8e.js";import{T as re}from"./index-0e298e38.js";import{M as se}from"./MasterPageTitle-fc1ef7a8.js";import{A as ie}from"./add.bidnature-c6efab0b.js";import{c as oe,b as ne,u as le}from"./index.esm-b3c20f6d.js";import{o as pe}from"./yup-b3178c01.js";import{P as ce}from"./Select-a2938be0.js";import{T as de}from"./TextField-77f9d647.js";import{I as me}from"./InputAdornment-acd34c72.js";import"./TableRow-c60adf0a.js";import"./useMediaQuery-f8b4772b.js";import"./TableContainer-ad9de4b5.js";import"./TableHead-11d85aea.js";import"./Grow-0b3a9797.js";import"./TablePagination-63dde5fc.js";import"./KeyboardArrowRight-4b11e6b9.js";import"./LastPage-69d51b6f.js";import"./Toolbar-fca75f8a.js";import"./MenuItem-fab52ff5.js";import"./dividerClasses-b771f620.js";import"./listItemTextClasses-f7cdafa8.js";import"./listItemIconClasses-bcb38dc7.js";import"./index.esm-44b3cc2a.js";import"./Divider-1d368ab1.js";import"./FilterFilled-61dd8e74.js";import"./AntdIcon-c86cb7c3.js";import"./objectSpread2-5ffd54f7.js";import"./index-44db81fe.js";import"./GenericThumbnailView-38007944.js";import"./createClass-8ffbea6f.js";import"./popper-f3391c26.js";import"./ScrollableList-4768c2b7.js";import"./CircularProgress-58819244.js";import"./FormInput-dbaa88c2.js";import"./FormControlLabel-77a47114.js";import"./Checkbox-05d562e2.js";import"./SwitchBase-a3d90b7d.js";import"./componentStyles-7142291f.js";import"./TextArea-6c7f39e1.js";import"./DialogContent-51a7b314.js";import"./DialogTitle-6bcbc606.js";import"./DialogContentText-1562904b.js";import"./DialogActions-122de1b4.js";import"./index-e5978b8b.js";import"./isMuiElement-fab695f8.js";const ot=()=>{const a=Q(),[S,u]=l.useState(!1);l.useState("");const o=W(),[h,g]=l.useState(null),b=!!h,[p,y]=l.useState(null),{bidnature:{bidnatureList:v,pageParams:r,loading:C,bidnatureCount:B,searchValue:ue,masterValue:M,masterEditId:z},system:{userAccessList:i}}=Y(e=>({bidnature:q(e),system:H(e)})),I=[{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}}),k=(e,s)=>{y(s),g(e.currentTarget)},c=()=>{g(null)},E=e=>{a(ae({id:e,clearDataFn:()=>{},navigate:s=>{},pageParams:r})),a(n({...r,search:"",page:1,page_size:10})),c()},D=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:G=>k(G,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:()=>E(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)}),F=({search:e})=>{a(n({...r,search:e||"",page:1,page_size:10}))},V=(e,s)=>{a(n({...r,search:"",page:s+1}))},A=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)},$=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:_(F),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:$})})}),t.jsx(re,{count:B,columns:I,rows:D,loading:C,page:r.page,pageSize:r.page_size,handleChangePage:V,handleChangeRowsPerPage:A})]}),t.jsx(ie,{modal:S,closeModal:R,mastersName:"BidNature",edit_Id:z,mastersValue:M})]})};export{ot as default};
