import{j as i}from"./vendor-mui-69397583.js";import{A as f}from"./AdaptableCard-df7695d6.js";import{r as t,f as V}from"./vendor-react-ece1c85f.js";import{u as l,c as z,r as O,b as y,t as H}from"./index-f1576468.js";import{Y as W,ab as q,l as P,f as Y,B as _}from"./index-c62ac197.js";import{A as $,T as c}from"./actioncell-17e12e21.js";import{D as J}from"./tableV2-4d1c9fd2.js";import"./vendor-redux-a1f00e6b.js";import"./TimeLogService-cd7b2f61.js";import"./vendor-pdf-b2a5d8b1.js";import"./vendor-devex-33a39e11.js";import"./vendor-i18n-2fcb1983.js";import"./vendor-msal-9caa1ed1.js";import"./vendor-charts-eccea5d1.js";import"./FileSaver.min-20f3f13a.js";import"./DensitySelector-a2c1c68f.js";import"./NoData-8c485a3a.js";const K=[{key:"auto",name:"Immediately"},{key:"onClick",name:"On Button Click"}],Q=[{key:"dragAndDrop",name:"Drag and drop"},{key:"select",name:"Select"}],X=["nextColumn","widget"],Z={delete:!0,view:!0};W("TimeLogData",O);const be=()=>{const[x,S]=t.useState([]),[w,G]=t.useState(!1);t.useState(!1),t.useState(!1);const[ee,A]=t.useState(!1),[te,L]=t.useState(),[ae,b]=t.useState(),[ie,C]=t.useState(!0),[se,D]=t.useState(!0),[oe,F]=t.useState(K[0].key),d=t.useRef(null);t.useState(X[0]),t.useState(Q[1].key),t.useState(!0),t.useState(!0),t.useState(!0),t.useState(!0);const p=V();t.useState("");const{auth:n}=q.getState(),o=P(),u=l(e=>{var a,s;return(s=(a=e==null?void 0:e.TimeLogData)==null?void 0:a.data)==null?void 0:s.filterData}),{loading:T}=l(e=>e.TimeLogData.data),j=l(e=>e.TimeLogData.data.AllTimeLogApprovalList);Y();const{pageIndex:m,pageSize:g,sort:v,query:R,total:re}=l(e=>e.TimeLogData.data.tableData);t.useEffect(()=>{k()},[m,g,v,w,u]);const k=()=>{var s,h;const e=((h=(s=n==null?void 0:n.session)==null?void 0:s.userId)==null?void 0:h.toString())??"",a=z({pageIndex:m,pageSize:g,sort:v,query:R,filterData:u,userId:e});o(a)},r=t.useCallback(()=>{var e;(e=d==null?void 0:d.current)==null||e.instance().clearFilter()},[]);t.useCallback(e=>{C(e.value),r()},[r]),t.useCallback(e=>{D(e.value),r()},[r]),t.useCallback(e=>{F(e.value)},[]);const I=e=>{p("/app/pages/TimeLogApproval/view/"+e.timeLogApprovalBatchId)},[U,M]=t.useState({pageSize:"",pageIndex:""}),N=(e,a)=>{a===c.view&&I(e),a===c.edit&&(L(e.id),b(e),o(y(e)),A(!0)),a===c.delete&&(o(H(!0)),o(y(e)))},E=[{dataField:"Action",caption:"Action",width:"75",cellRender:e=>i.jsx("div",{id:"mAction","data-cname":"Action",children:i.jsx($,{row:e==null?void 0:e.data,actions:Z,buttonClick:N})})},{dataField:"startDate",caption:"Start Date",width:"150",dataType:"datetime",format:"MM/dd/yyyy"},{dataField:"endDate",caption:"End Date",width:"150",dataType:"datetime",format:"MM/dd/yyyy"},{dataField:"approveStatus",caption:"Approved",width:"150"},{dataField:"approvedUsers",caption:"Approved Users",width:"300",cellRender:e=>{var a;return i.jsx("div",{id:"div-approvedUsers","data-cname":"Approved Users",style:{width:"100%",textWrap:"initial"},children:(a=e==null?void 0:e.data)==null?void 0:a.approvedUsers})}},{dataField:"nextApproveUsers",caption:"Next Approve Users",width:"300",cellRender:e=>{var a;return i.jsx("div",{id:"div-nextApproveUsers","data-cname":"Next Approve Users",style:{width:"100%",textWrap:"initial"},children:(a=e==null?void 0:e.data)==null?void 0:a.nextApproveUsers})}},{dataField:"approvalUsers",caption:"Approval Users",width:"300",cellRender:e=>{var a;return i.jsx("div",{id:"div-approvalUsers","data-cname":"Approval Users",style:{width:"100%",textWrap:"initial"},children:(a=e==null?void 0:e.data)==null?void 0:a.approvalUsers})}},{dataField:"approvalCreatedBy",caption:"Created By",width:"250"},{dataField:"createdDate",caption:"Created On",width:"150",dataType:"date",format:"MM/dd/yyyy"}],B=()=>{p("/app/pages/TimeLog")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"topbar py-4 px-6 border-gray-200 border-b",children:i.jsxs("div",{className:"lg:flex items-center justify-between",children:[i.jsx("h3",{className:"mb-4 lg:mb-0",children:"Time Log Approvals"}),i.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center",children:i.jsx(_,{style:{marginRight:"0.5rem"},onClick:()=>B(),block:!0,variant:"solid",size:"sm",children:"View TimeLog List"})})]})}),i.jsx(f,{className:"m-6 h-full py-4 px-6 bg-transparent",bodyClass:"h-full",children:i.jsx(f,{className:"borderless",children:i.jsx(J,{columns:E,tableName:"time-log-approval",data:j||[],height:"calc(100vh - 320px)",defaultHiddenColumn:[],fetchData:()=>{},id_label:"$id",selectedRowId:x,setSelectedRowId:S,setFilterValues:()=>{},filterValues:[],identity:"Lead-Listing",setInLineFilters:()=>{},inLineFilter:[],inLineFilterMobileView:[],setInLineFiltersMobileView:()=>{},setColSorting:()=>{},ImpColumnName:"DocumentId",idName:"app-key-Listing-table",handleSearch:()=>{},isColumnResizing:!0,pager:U,setPager:M,isPaginationReq:!0,isLoading:T})})})]})};export{be as default};
