import{d as Z,r as n,b7 as q,a as w,p_ as Q,j as t,B as Y,I as S,q1 as j,u7 as h,eI as G,Q as H,T as J,R as C,u8 as p,_ as K,u9 as U}from"./index-952e178b.js";import{M as W}from"./MasterPageTitle-7665a485.js";import{A as X}from"./add.stage-1681e51a.js";import{C as $}from"./index-8c2f17c1.js";import{T}from"./Tooltip-2222bd7e.js";import{Z as v}from"./Zoom-79996292.js";import{P as L}from"./Select-41d78585.js";import{T as tt}from"./TextField-d1a887ff.js";import{I as et}from"./InputAdornment-020147de.js";import"./index.esm-70af4911.js";import"./index.esm-6feddb16.js";import"./yup-d92565dd.js";import"./Divider-342f1cfc.js";import"./dividerClasses-8e897c94.js";import"./FilterFilled-1ab4da14.js";import"./AntdIcon-54006664.js";import"./objectSpread2-a71852a2.js";import"./index-22eb3e7f.js";import"./GenericThumbnailView-4e535459.js";import"./createClass-5a32667f.js";import"./popper-f3391c26.js";import"./ScrollableList-cd5816a8.js";import"./CircularProgress-3b605689.js";import"./FormInput-8320115a.js";import"./FormControlLabel-973be654.js";import"./Checkbox-6c7c4dc0.js";import"./SwitchBase-bd5cc4c6.js";import"./componentStyles-00160cc0.js";import"./TableRow-6a27d7f4.js";import"./TextArea-ce7716c9.js";import"./DialogContent-4facb916.js";import"./DialogTitle-3aa960f8.js";import"./DialogContentText-54d95680.js";import"./DialogActions-bd200b72.js";import"./LoadingButton-404f8a68.js";import"./composeClasses-b42b2e69.js";import"./LastPage-9979d461.js";import"./KeyboardArrowRight-91d2ccce.js";import"./TableContainer-e3ecf13b.js";import"./TableHead-e31d41f4.js";import"./TablePagination-b93979a3.js";import"./KeyboardArrowRight-c3d685e2.js";import"./LastPage-54692111.js";import"./Toolbar-201b514b.js";import"./MenuItem-f41722f4.js";import"./listItemTextClasses-ca40551b.js";import"./listItemIconClasses-3e4286ad.js";import"./index-e5978b8b.js";import"./isMuiElement-f03a71e4.js";const Xt=()=>{const a=Z(),[y,u]=n.useState(""),i=q(),[x,f]=n.useState(null),z=!!x,[l,M]=n.useState(null),{stages:{stagesList:m,pageParams:r,loading:I,stagesCount:P,model:_},system:{userAccessList:s}}=w(e=>Q(e)),b=[{title:"S.No",width:100},{title:"Name",width:100},{title:"Remarks",width:100},{title:"Actions",width:100}];function k(e,o,d,g){return{index:e,name:o,remarks:d,actions:g}}const B=(e,o)=>{M(o),f(e.currentTarget)},c=()=>{f(null)},D=e=>{a(U({id:e,clearDataFn:()=>{c()},pageParams:r}))},O=m==null?void 0:m.map((e,o)=>{const d=(r.page-1)*r.page_size+(o+1),g=t.jsxs(Y,{sx:{display:"flex",gap:2,justifyContent:"start"},children:[(s==null?void 0:s.indexOf("Masters.change_stage"))!==-1&&t.jsx(T,{TransitionComponent:v,title:"Edit Stage",children:t.jsx(S,{onClick:()=>{a(j(e)),a(h(!0))},children:t.jsx(G,{style:{cursor:"pointer",color:"#fc6f03",fontSize:16}})})}),(s==null?void 0:s.indexOf("Masters.delete_stage"))!==-1&&t.jsxs(t.Fragment,{children:[t.jsx(T,{TransitionComponent:v,title:"Delete Stage",children:t.jsx(S,{onClick:V=>B(V,e==null?void 0:e.id),children:t.jsx(H,{style:{cursor:"pointer",color:"#fc6f03",fontSize:16}})})}),t.jsx(L,{id:l?String(l):void 0,open:z,anchorEl:x,onClose:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:t.jsxs("div",{style:{padding:"15px"},children:[t.jsx(J,{variant:"subtitle1",gutterBottom:!0,children:"Are you sure to delete this Record?"}),t.jsx(C,{variant:"contained",type:"submit",color:"primary",onClick:()=>{D(l)},autoFocus:!0,children:"Yes"}),t.jsx(C,{variant:"outlined",size:"small",onClick:c,style:{marginLeft:"20px"},children:"No"})]})})]})]});return k(d,e.name,e.remarks,g)}),E=(e,o)=>{a(p({...r,search:"",page:o+1}))},A=e=>{a(p({...r,search:"",page:1,page_size:parseInt(e.target.value)}))};n.useEffect(()=>{a(p({...r,search:"",page:1,page_size:10})),i==null||i.setTitle("Stages"),i==null||i.setSubtitle("Masters"),u("")},[]);const F=e=>{a(j({})),a(h(e))},R=e=>{const o=e.target.value;u(o),a(p({...r,search:o||"",page:1,page_size:10}))},N=()=>{a(h(!1))};return t.jsxs(t.Fragment,{children:[t.jsx(X,{modal:_,closeModal:N}),t.jsx(W,{prefix:"Masters",postfix:"stage",pageTitle:"Stages",goBack:!0,addModelTile:(s==null?void 0:s.indexOf("Masters.add_stage"))!==-1?"Add Stages":void 0,modalVisible:!0,setIsModalVisible:F,pageText:"",searchComponent:t.jsx(tt,{type:"text",sx:{width:"300px"},value:y,size:"small",InputProps:{startAdornment:t.jsx(et,{position:"start",children:t.jsx(K,{size:16})})},variant:"outlined",placeholder:"Search",onChange:R}),children:t.jsx($,{count:P,columns:b,rows:O,loading:I,page:r.page,pageSize:r.page_size,handleChangePage:E,handleChangeRowsPerPage:A,showPagination:!0})})]})};export{Xt as default};
