import{d as H,r as l,b4 as J,a as K,oB as L,b as Q,j as t,B as W,f5 as Y,sH as q,sI as f,Q as U,T as X,R as j,sJ as n,oD as Z,sK as w,kx as ee,_ as te,sL as ae}from"./index-858224db.js";import{T as re}from"./index-e980fe31.js";import{M as se}from"./MasterPageTitle-cb9528e3.js";import{A as ie}from"./add.bidnature-36fb2c69.js";import{c as oe,b as ne,u as le}from"./index.esm-241dec99.js";import{o as pe}from"./yup-9213c3af.js";import{P as ce}from"./Select-8b602eed.js";import{T as de}from"./TextField-bbb2480f.js";import{I as me}from"./InputAdornment-583927e5.js";import"./TableRow-ef998644.js";import"./useMediaQuery-f2f5fd7b.js";import"./TableContainer-0664e137.js";import"./TableHead-cf76ecee.js";import"./Grow-b7b43b3f.js";import"./TablePagination-4cf72ac4.js";import"./KeyboardArrowRight-b25c72ab.js";import"./LastPage-c7260b25.js";import"./Toolbar-9be5abc1.js";import"./MenuItem-bf5218a0.js";import"./dividerClasses-3bf2d765.js";import"./listItemTextClasses-ac0d77df.js";import"./listItemIconClasses-5ed9cb9d.js";import"./index.esm-20949d74.js";import"./Divider-262150be.js";import"./FilterFilled-4ddeca5a.js";import"./AntdIcon-8f3bee6f.js";import"./objectSpread2-cfd43bb2.js";import"./index-9223140c.js";import"./GenericThumbnailView-2d7b7363.js";import"./createClass-042c577b.js";import"./popper-f3391c26.js";import"./ScrollableList-bf78e54b.js";import"./CircularProgress-5bd54bd6.js";import"./FormInput-8eacbbd9.js";import"./FormControlLabel-c742681c.js";import"./Checkbox-57cdf644.js";import"./SwitchBase-959e94f2.js";import"./componentStyles-107bd37e.js";import"./TextArea-78cda1eb.js";import"./DialogContent-e06a39bc.js";import"./DialogTitle-6e616d34.js";import"./DialogContentText-a2775ca2.js";import"./DialogActions-825c19e9.js";import"./index-e5978b8b.js";import"./isMuiElement-ec705bc2.js";const ot=()=>{const a=H(),[S,u]=l.useState(!1);l.useState("");const o=J(),[h,g]=l.useState(null),b=!!h,[p,y]=l.useState(null),{bidnature:{bidnatureList:v,pageParams:r,loading:B,bidnatureCount:C,searchValue:ue,masterValue:I,masterEditId:M},system:{userAccessList:i}}=K(e=>({bidnature:L(e),system:Q(e)})),z=[{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)},D=e=>{a(ae({id:e,clearDataFn:()=>{},navigate:s=>{},pageParams:r})),a(n({...r,search:"",page:1,page_size:10})),c()},E=v.map((e,s)=>{const d=(r.page-1)*r.page_size+(s+1),m=t.jsxs(W,{justifyContent:"start",alignItems:"center",sx:{display:"flex",gap:2},children:[(i==null?void 0:i.indexOf("Masters.change_sourceportal"))!==-1&&t.jsx(Y,{style:{cursor:"pointer",color:"#fc6f03"},onClick:()=>{a(q({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:()=>D(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:C,columns:z,rows:E,loading:B,page:r.page,pageSize:r.page_size,handleChangePage:V,handleChangeRowsPerPage:A})]}),t.jsx(ie,{modal:S,closeModal:R,mastersName:"BidNature",edit_Id:M,mastersValue:I})]})};export{ot as default};
