import{d as Q,r as l,b6 as W,a as Y,pf as q,b as H,j as t,B as J,ew as K,tl as L,tm as f,Q as U,T as X,R as j,tn as n,ph as Z,to as w,lc as ee,_ as te,tp as ae}from"./index-aa25c5ff.js";import{T as re}from"./index-1b842ccf.js";import{M as se}from"./MasterPageTitle-4b4774f8.js";import{A as ie}from"./add.bidnature-b1b7af6d.js";import{c as oe,b as ne,u as le}from"./index.esm-a7f661dc.js";import{o as pe}from"./yup-72cc4918.js";import{P as ce}from"./Select-b8388c2f.js";import{T as de}from"./TextField-55b66d20.js";import{I as me}from"./InputAdornment-1e7eea92.js";import"./TableRow-ee82d902.js";import"./useMediaQuery-5832b4d6.js";import"./TableContainer-150455ba.js";import"./TableHead-7918647e.js";import"./Grow-53c7e965.js";import"./TablePagination-7f533723.js";import"./KeyboardArrowRight-207c2b3b.js";import"./LastPage-cc741249.js";import"./Toolbar-aae1a453.js";import"./MenuItem-6f39aa2e.js";import"./dividerClasses-ce522944.js";import"./listItemTextClasses-88140258.js";import"./listItemIconClasses-31a870c1.js";import"./index.esm-def27a11.js";import"./Divider-52e89c7e.js";import"./FilterFilled-8e291e82.js";import"./AntdIcon-b92b7162.js";import"./objectSpread2-f5b2f6aa.js";import"./index-d4b36417.js";import"./GenericThumbnailView-e0343bac.js";import"./createClass-d1bae5ec.js";import"./popper-f3391c26.js";import"./ScrollableList-9498bc37.js";import"./CircularProgress-d6cfca6d.js";import"./FormInput-dc74a5d8.js";import"./FormControlLabel-56777c7d.js";import"./Checkbox-d917a1e2.js";import"./SwitchBase-f1314509.js";import"./componentStyles-e32842f3.js";import"./TextArea-d1a16eb1.js";import"./Dialog-049271f6.js";import"./DialogTitle-7a3842b8.js";import"./DialogContent-f207f33c.js";import"./DialogContentText-70face94.js";import"./DialogActions-2338d733.js";import"./index-e5978b8b.js";import"./isMuiElement-1b254892.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}}),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()},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=>E(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:()=>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)}),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};
