import{b as n,c as D,a as u}from"./vendor-redux-a1f00e6b.js";import{c as f,d as T,e as y,f as A,g as v}from"./TimeLogService-cd7b2f61.js";import{F as C}from"./index-c62ac197.js";const l="TimeLogData",d=n(`${l}/getTimeLogsData`,async e=>{var i,r;const a={fromDate:new Date((i=e==null?void 0:e.filterData)==null?void 0:i.fromDate),toDate:new Date((r=e==null?void 0:e.filterData)==null?void 0:r.toDate)};console.log("payload",a);const t=await f(a);return console.log("response",t),t.data.$values.map(o=>({...o,fullName:`${o.firstName} ${o.lastName}`,approvedStatus:o.isApproved?"Yes":"No",duration:I(o.startTime,o.endTime)}))}),I=(e,a)=>{if(e&&a){const t=new Date(e),i=new Date(a).getTime()-t.getTime();if(i>0){const r=Math.floor(i/1e3/60),o=Math.floor(r/60),L=r%60;return`${o}h ${L}m`}else return""}},g=n(`${l}/getTimeLogApprovalListData`,async e=>(await T(e.userId)).data),$=n(l+"/getTimeLogDetails",async e=>(await y(e.id)).data),p=n(`${l}/getTimeLogDataByBatchId`,async e=>(await A(e.id)).data.$values.map(s=>({...s,fullName:`${s.firstName} ${s.lastName}`,approvedStatus:s.isApproved?"Yes":"No"}))),c=n(`${l}/getAllTimeLogApprovalList`,async e=>(await v(e.id)).data.$values),h={total:0,pageIndex:1,pageSize:10,query:"",sort:{order:"",key:""}},w={loading:!1,deleteConfirmation:!1,selectedRowData:"",tableData:h,filterData:{},TimeLogtDataList:[],TimeLogList:[],TimeLogApprovalList:[],TimeLogListByBatchId:[],UserSignatureList:[],signatureImageUrl:"",AllTimeLogApprovalList:[]},m=D({name:`${l}`,initialState:w,reducers:{setTableData:(e,a)=>{e.tableData=a.payload},setFilterData:(e,a)=>{e.filterData=a.payload},toggleDeleteConfirmation:(e,a)=>{e.deleteConfirmation=a.payload},setSelectedRowData:(e,a)=>{e.selectedRowData=a.payload},setSignatureImageURL:(e,a)=>{e.signatureImageUrl=a.payload}},extraReducers:e=>{e.addCase(d.fulfilled,(a,t)=>{a.TimeLogtDataList=t.payload,a.tableData.total=t.payload.length,a.loading=!1}).addCase(d.pending,a=>{a.loading=!0}).addCase($.fulfilled,(a,t)=>{a.TimeLogData=t.payload,a.loading=!1}).addCase(g.fulfilled,(a,t)=>{a.TimeLogApprovalList=t.payload,a.tableData.total=t.payload.length,a.loading=!1}).addCase(g.pending,a=>{a.loading=!0}).addCase(p.fulfilled,(a,t)=>{a.TimeLogListByBatchId=t.payload,a.tableData.total=t.payload.length,a.loading=!1}).addCase(p.pending,a=>{a.loading=!0}).addCase(c.fulfilled,(a,t)=>{a.AllTimeLogApprovalList=t.payload,a.loading=!1}).addCase(c.pending,a=>{a.loading=!0})}}),{setTableData:R,setFilterData:U,toggleDeleteConfirmation:G,setSelectedRowData:M,setSignatureImageURL:x}=m.actions,S=m.reducer,F=u({data:S}),k=C;export{U as a,M as b,c,p as d,d as g,F as r,x as s,G as t,k as u};
