import{d as L,r as l,b6 as Q,a as W,pg as Y,b as q,j as t,B as H,eL as J,ti as K,tj as f,Q as U,T as X,R as j,tk as n,pi as Z,tl as w,ld as ee,_ as te,tm as ae}from"./index-5ae5cc5e.js";import{T as re}from"./index-7d0c783f.js";import{M as se}from"./MasterPageTitle-426707bb.js";import{A as ie}from"./add.bidnature-a589f813.js";import{c as oe,b as ne,u as le}from"./index.esm-bd37e938.js";import{o as pe}from"./yup-86a48159.js";import{P as de}from"./Select-6f375e89.js";import{T as ce}from"./TextField-013fef4f.js";import{I as me}from"./InputAdornment-c8af61f0.js";import"./TableRow-fbdd6d52.js";import"./useMediaQuery-8780c1c1.js";import"./TableContainer-ed67fdcd.js";import"./TableHead-15aac70d.js";import"./Grow-d70e9b6d.js";import"./TablePagination-63129eb6.js";import"./KeyboardArrowRight-8e772e39.js";import"./LastPage-aa82a010.js";import"./Toolbar-0ec32807.js";import"./MenuItem-dc2bf765.js";import"./dividerClasses-ea2ed133.js";import"./listItemTextClasses-2547faff.js";import"./listItemIconClasses-20c36342.js";import"./index.esm-91b69e04.js";import"./Divider-e1d32c28.js";import"./FilterFilled-40058e95.js";import"./AntdIcon-b932f733.js";import"./objectSpread2-13a56fdb.js";import"./index-125b1c7e.js";import"./GenericThumbnailView-fac7773c.js";import"./createClass-227e27b6.js";import"./popper-f3391c26.js";import"./ScrollableList-2ee889f8.js";import"./CircularProgress-672898c5.js";import"./FormInput-77541d96.js";import"./FormControlLabel-b2fabe81.js";import"./Checkbox-84b6779a.js";import"./SwitchBase-4fa73d90.js";import"./componentStyles-7d84c389.js";import"./TextArea-20f097f8.js";import"./DialogContent-e2578cbd.js";import"./DialogTitle-4a5aec12.js";import"./DialogContentText-bc10bf8d.js";import"./DialogActions-ad26e3d6.js";import"./index-e5978b8b.js";import"./isMuiElement-c29cfc23.js";const ot=()=>{const a=L(),[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:B,searchValue:ue,masterValue:M,masterEditId:z},system:{userAccessList:i}}=W(e=>({bidnature:Y(e),system:q(e)})),I=[{title:"S.No",width:100},{title:"Code",width:100},{title:"Name",width:100},{title:"Actions",width:100}];function T(e,s,c,m){return{index:e,code:s,name:c,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)},d=()=>{g(null)},E=e=>{a(ae({id:e,clearDataFn:()=>{},navigate:s=>{},pageParams:r})),a(n({...r,search:"",page:1,page_size:10})),d()},D=v.map((e,s)=>{const c=(r.page-1)*r.page_size+(s+1),m=t.jsxs(H,{justifyContent:"start",alignItems:"center",sx:{display:"flex",gap:2},children:[(i==null?void 0:i.indexOf("Masters.change_sourceportal"))!==-1&&t.jsx(J,{style:{cursor:"pointer",color:"#fc6f03"},onClick:()=>{a(K({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(de,{id:p?String(p):void 0,open:b,anchorEl:h,onClose:d,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:d,style:{marginLeft:"20px"},children:"No"})]})})]})]});return T(c,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(ce,{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};
