import{d as Z,r as n,b8 as q,a as $,qJ as w,j as t,B as J,I as S,qM as j,uZ as h,eK as K,R as U,T as Y,U as C,u_ as p,$ as G,u$ as H}from"./index-c3f592b2.js";import{M as Q}from"./MasterPageTitle-eaa6f939.js";import{A as W}from"./add.stage-a2c1fc58.js";import{C as X}from"./index-14d7673e.js";import{T}from"./Tooltip-0fd4d2f4.js";import{Z as v}from"./Zoom-209264bc.js";import{P as L}from"./Select-9d10c4ab.js";import{T as tt}from"./TextField-7d0d5009.js";import{I as et}from"./InputAdornment-fd596377.js";import"./index.esm-1314deac.js";import"./index.esm-70dd1c06.js";import"./yup-abb4a026.js";import"./Divider-057a9865.js";import"./dividerClasses-03c42ea7.js";import"./FilterFilled-90800ccd.js";import"./AntdIcon-b07622f5.js";import"./objectSpread2-890c3efa.js";import"./index-78da10f4.js";import"./GenericThumbnailView-9f1d2f81.js";import"./createClass-c7973e27.js";import"./popper-f3391c26.js";import"./Grow-f61cc5ca.js";import"./ScrollableList-ecbfc0f3.js";import"./FormInput-adbf55b1.js";import"./FormControlLabel-3f9f7a84.js";import"./Checkbox-38171bff.js";import"./SwitchBase-38103115.js";import"./componentStyles-b8fcedb5.js";import"./TableRow-974e102e.js";import"./TextArea-674a9ec6.js";import"./DialogContent-b7fc1c43.js";import"./DialogTitle-5d3e2030.js";import"./DialogContentText-c3e782dc.js";import"./DialogActions-6e00f4f1.js";import"./LoadingButton-69b28388.js";import"./LastPage-4fb40c42.js";import"./KeyboardArrowRight-ee7691b4.js";import"./TableContainer-a7e6bb64.js";import"./TableHead-98885dba.js";import"./TablePagination-fd957a04.js";import"./KeyboardArrowRight-8b3fa289.js";import"./LastPage-a52503ff.js";import"./Toolbar-ac8f3726.js";import"./MenuItem-e7a45c4b.js";import"./listItemTextClasses-3ff99335.js";import"./listItemIconClasses-b60c7a41.js";import"./isMuiElement-43203123.js";const Ht=()=>{const a=Z(),[M,u]=n.useState(""),i=q(),[x,f]=n.useState(null),y=!!x,[l,z]=n.useState(null),{stages:{stagesList:m,pageParams:r,loading:I,stagesCount:P,model:b},system:{userAccessList:s}}=$(e=>w(e)),_=[{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)=>{z(o),f(e.currentTarget)},c=()=>{f(null)},D=e=>{a(H({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(J,{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(K,{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(U,{style:{cursor:"pointer",color:"#fc6f03",fontSize:16}})})}),t.jsx(L,{id:l?String(l):void 0,open:y,anchorEl:x,onClose:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:t.jsxs("div",{style:{padding:"15px"},children:[t.jsx(Y,{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(W,{modal:b,closeModal:N}),t.jsx(Q,{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:M,size:"small",InputProps:{startAdornment:t.jsx(et,{position:"start",children:t.jsx(G,{size:16})})},variant:"outlined",placeholder:"Search",onChange:R}),children:t.jsx(X,{count:P,columns:_,rows:O,loading:I,page:r.page,pageSize:r.page_size,handleChangePage:E,handleChangeRowsPerPage:A,showPagination:!0})})]})};export{Ht as default};
