import{d as Q,r as l,b6 as W,a as Y,pe as q,b as H,j as t,B as J,ew as K,tk as L,tl as f,Q as U,T as X,R as j,tm as n,pg as Z,tn as w,lb as ee,_ as te,to as ae}from"./index-e6164346.js";import{T as re}from"./index-8e856c3a.js";import{M as se}from"./MasterPageTitle-fcafb323.js";import{A as ie}from"./add.bidnature-feb6e979.js";import{c as oe,b as ne,u as le}from"./index.esm-0a041314.js";import{o as pe}from"./yup-5fd5d57b.js";import{P as ce}from"./Select-9c2d8cd2.js";import{T as de}from"./TextField-db9cff08.js";import{I as me}from"./InputAdornment-59975edf.js";import"./TableRow-bf4e60a0.js";import"./useMediaQuery-43140cef.js";import"./TableContainer-7ecd96ea.js";import"./TableHead-0c525f54.js";import"./Grow-306e2fd0.js";import"./TablePagination-b02830fa.js";import"./KeyboardArrowRight-73af71dd.js";import"./LastPage-b9dcf78c.js";import"./Toolbar-82d22fac.js";import"./MenuItem-8dd174fb.js";import"./dividerClasses-932c3e8b.js";import"./listItemTextClasses-6b253cb4.js";import"./listItemIconClasses-a58b491d.js";import"./index.esm-42924bf1.js";import"./Divider-6099014b.js";import"./FilterFilled-c0851aaa.js";import"./AntdIcon-4f5aa87b.js";import"./objectSpread2-7d7378cc.js";import"./index-ce90e1a7.js";import"./GenericThumbnailView-80c6fd98.js";import"./createClass-ad55a3ca.js";import"./popper-f3391c26.js";import"./ScrollableList-5a17e8f4.js";import"./CircularProgress-7d99d864.js";import"./FormInput-859198ec.js";import"./FormControlLabel-ee192a98.js";import"./Checkbox-70f568c2.js";import"./SwitchBase-e1f0b96b.js";import"./componentStyles-00385170.js";import"./TextArea-f5c200de.js";import"./Dialog-2e8a8e2e.js";import"./DialogTitle-8757f50f.js";import"./DialogContent-f10d6731.js";import"./DialogContentText-027be15d.js";import"./DialogActions-31bec80e.js";import"./index-e5978b8b.js";import"./isMuiElement-5779af4f.js";const nt=()=>{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{nt as default};
