PageSourceSearch

https://ripplemind.com/_next/static/chunks/pages/salary-management…/[companyId]/attendance-783d2ad826a28c79.js

js ripplemind.com collected 2026-10-06 13:16:40 UTC 15,431 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7042],{90470:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(91373);let l=(0,n.Z)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},31012:function(e,t,a){"use strict";a.d(t,{Z:function(){return l}});var n=a(91373);let l=(0,n.Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},74973:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/salary-management/company/[companyId]/attendance",function(){return a(77218)}])},42689:function(e,t,a){"use strict";a.r(t);var n=a(85893),l=a(67294),s=a(41664),o=a.n(s),r=a(11163),i=a(88446),c=a(86501);t.default=e=>{let{children:t}=e,a=(0,r.useRouter)(),{companyId:s}=a.query,[d,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(!0),p=[{name:"Employees",path:"/salary-management/company/".concat(s,"/employees")},{name:"Departments",path:"/salary-management/company/".concat(s,"/department")},{name:"Attendance",path:"/salary-management/company/".concat(s,"/attendance")},{name:"Designations",path:"/salary-management/company/".concat(s,"/designation")},{name:"Salary List",path:"/salary-management/company/".concat(s,"/salary-list")},{name:"Holidays",path:"/salary-management/company/".concat(s,"/holidays")},{name:"Religion",path:"/salary-management/company/".concat(s,"/religion")}].sort((e,t)=>e.name.localeCompare(t.name));return(0,l.useEffect)(()=>{if(!s)return;let e=async()=>{var e,t,a;try{let t=await i.Z.post("/payroll/company/company-by-id",{company_id:s});u(null===(e=t.data)||void 0===e?void 0:e.data)}catch(e){c.ZP.error((null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.message)||"Error fetching company"),console.error("❌ Error fetching company:",e)}finally{h(!1)}};e()},[s]),(0,n.jsxs)("div",{className:"flex min-h-screen",children:[(0,n.jsxs)("aside",{className:"w-64 flex-shrink-0 bg-gray-900 text-white p-4",children:[m?(0,n.jsx)("h2",{className:"text-lg font-bold mb-6",children:"Loading..."}):(0,n.jsxs)("div",{className:"flex items-center gap-3 my-3",children:[(null==d?void 0:d.logo_url)&&(0,n.jsx)("img",{src:d.logo_url,alt:d.company_name,className:"w-12 h-12 rounded-full object-cover border border-gray-700"}),(0,n.jsx)("h2",{className:"text-lg font-bold truncate",children:(null==d?void 0:d.company_name)||"Company"})]}),(0,n.jsx)("ul",{className:"space-y-2 mb-6",children:p.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(o(),{href:e.path,children:(0,n.jsx)("span",{className:"block px-3 py-2 rounded-md cursor-pointer transition-colors ".concat(a.asPath.startsWith(e.path)?"bg-gray-700 font-semibold":"hover:bg-gray-800"),children:e.name})})},e.path))}),(0,n.jsx)(o(),{href:"/salary-management/company",children:(0,n.jsx)("span",{className:"block mt-6 text-sm text-gray-300 hover:text-white",children:"← Back to Companies"})})]}),(0,n.jsx)("main",{className:"flex-1 p-3 bg-gray-100 overflow-x-auto",children:(0,n.jsx)("div",{className:"min-w-[1200px]",children:t})})]})}},77218:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return _}});var n=a(85893),l=a(67294),s=a(90044),o=a(88446),r=a(87083),i=a(41664),c=a.n(i),d=a(90470),u=a(31012),m=a(17866),h=a(74295),p=a.n(h),y=a(86501),x=e=>{let{companyId:t}=e,[a,s]=(0,l.useState)(""),r=async()=>{let e=new(p()).Workbook,t=e.addWorksheet("Template");t.addRow(["Employee ID","Employee Name","Date","Check-in Time","Check-out Time","Holiday","OT"]);let a=[{id:"EMP001",name:"Employee One",date:"2025-07-01",checkIn:new Date(new Date(2e3,0,1,9,32).valueOf()+198e5),checkOut:new Date(new Date(2e3,0,1,18,32).valueOf()+198e5),holiday:"No",ot:"No"},{id:"EMP001",name:"Employee One",date:"2025-07-02",checkIn:new Date(new Date(2e3,0,1,9,52).valueOf()+198e5),checkOut:new Date(new Date(2e3,0,1,18,22).valueOf()+198e5),holiday:"No",ot:"No"},{id:"EMP001",name:"Employee One",date:"2025-07-03",checkIn:new Date(new Date(2e3,0,1,9,10).valueOf()+198e5),checkOut:new Date(new Date(2e3,0,1,18,0).valueOf()+198e5),holiday:"No",ot:"No"}];a.forEach((e,a)=>{let n=t.addRow([e.id,e.name,new Date(e.date),e.checkIn,e.checkOut,e.holiday,e.ot]),l=n.number,s=t.getCell("C".concat(l));s.value=new Date(e.date),s.numFmt="m/d/yyyy",t.getCell("D".concat(l)).numFmt="hh:mm:ss",t.getCell("E".concat(l)).numFmt="hh:mm:ss"}
1),t.columns.forEach(e=>e.width=15);let n=await e.xlsx.writeBuffer(),l=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),s=URL.createObjectURL(l),o=document.createElement("a");o.href=s,o.setAttribute("download","Attendance_Template.xlsx"),document.body.appendChild(o),o.click(),document.body.removeChild(o)},i=async e=>{var a,n;s("");let l=null===(a=e.target.files)||void 0===a?void 0:a[0];if(!l)return;let r=null===(n=l.name.split(".").pop())||void 0===n?void 0:n.toLowerCase();if("xlsx"!==r){s("Please upload a valid Excel file (.xlsx)."),e.target.value="";return}try{let a=await l.arrayBuffer(),n=new(p()).Workbook;await n.xlsx.load(a);let s=n.worksheets[0],r=[],i=0;s.eachRow(()=>{i++});for(let e=2;e<=i;e++){let t={employee_id:"",date:"",check_in:"",check_out:"",total_hours:0,total_worked_minutes:0,is_ot:!1,is_present:!1,excelError:""},a=s.getCell("A".concat(e));"string"==typeof a.value&&(t.employee_id=a.value);let n=s.getCell("C".concat(e)).value;if(n instanceof Date){let e=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");t.date="".concat(e,"-").concat(a,"-").concat(l)}else t.date=String(null!=n?n:"");let l=s.getCell("D".concat(e));if(l.value instanceof Date){let e=l.value.getUTCHours().toString().padStart(2,"0"),a=l.value.getUTCMinutes().toString().padStart(2,"0");t.check_in="".concat(e,":").concat(a)}let o=s.getCell("E".concat(e));if(o.value instanceof Date){let e=o.value.getUTCHours().toString().padStart(2,"0"),a=o.value.getUTCMinutes().toString().padStart(2,"0");t.check_out="".concat(e,":").concat(a)}let i=new Date().toISOString().split("T")[0],c="".concat(i,"T").concat(t.check_in,":00"),d="".concat(i,"T").concat(t.check_out,":00"),u=new Date(c),m=new Date(d);if(isNaN(u.getTime())||isNaN(m.getTime()))console.error("Invalid date input");else{let e=m.getTime()-u.getTime(),a=Math.floor(e/1e3/60),n=Math.round(a/60*100)/100;t.total_hours=n,t.total_worked_minutes=a}t.total_hours>0&&(t.is_present=!0),r.push(t)}await o.Z.post("/payroll/attendance/bulk-create",{attendances:r,company_id:t}),y.ZP.success("Attendance uploaded successfully!"),e.target.value=""}catch(e){console.error(e),s("Failed to upload attendance. Please try again.")}};return(0,n.jsxs)("div",{className:"flex flex-col gap-y-4 p-4 bg-gray-50 rounded-md shadow-sm max-w-md mb-3",children:[(0,n.jsx)("label",{className:"text-gray-700 text-base font-bold",children:"Upload Excel"}),(0,n.jsx)("input",{type:"file",accept:".xlsx",onChange:i,className:"block text-sm text-gray-600    file:mr-4 file:py-1 file:px-3   file:rounded file:border-0   file:text-sm file:font-medium   file:bg-gray-200 file:text-gray-800   hover:file:bg-gray-300"}),(0,n.jsxs)("p",{className:"text-sm text-gray-600",children:["Need a template?"," ",(0,n.jsx)("button",{onClick:r,className:"text-blue-600 underline hover:text-blue-800",children:"Download the format"})]}),a&&(0,n.jsx)("div",{className:"text-red-600 text-sm",children:a})]})},g=a(26533),f=a(8823),v=e=>{let{companyId:t}=e,[a,i]=(0,l.useState)(0),[h,p]=(0,l.useState)([]),[y,v]=(0,l.useState)(1),[b,j]=(0,l.useState)(20),[w,_]=(0,l.useState)(""),[N,k]=(0,l.useState)(""),[S,D]=(0,l.useState)([]),[C,Z]=(0,l.useState)(""),[E,T]=(0,l.useState)({sortKey:"employee-id",sortType:-1}),[P,O]=(0,l.useState)(!1),R={display:"flex",justifyContent:"center",width:"100%"},I=[{name:(0,n.jsx)("div",{style:R,children:"Action"}),width:"160px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,n.jsx)(r.ZP,{content:(0,n.jsx)("span",{children:"Edit"}),placement:"bottom",children:(0,n.jsx)(c(),{href:"/salary-management/company/".concat(t,"/attendance/").concat(e.id,"/edit"),children:(0,n.jsx)("button",{className:"m-1 inline p-5 bg-gray-300 hover:bg-gray-400 text-black py-2 px-4 rounded",children:(0,n.jsx)(d.Z,{className:"w-5 h-5"})})})})})},{name:(0,n.jsx)("div",{style:R,children:"ID"}),id:"id",minWidth:"60px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.id)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Employee ID"}),id:"employee_id",minWidth:"120px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.employee_id)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Name"}),id:"name",minWidth:"120px",cell:e=>{var t;return(0,n.jsx)("div",{style:R,children:(0,m.Z)(null===(t=e.employeeDetails[0])||void 0===t?void 0:t.name)})},sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Date"}),id:"date",minWidth:"130px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(new Date(e.date).toLocaleDateString())}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Present"}),id:"is_present",minWidth:"130px",cell:e=>(0,n.jsx)("div",{style:{...R,fontSize:"20px"},children:(0,m.Z)(!0===e.is_present?"✓":"✗")}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Check In"}),id:"check_in",minWidth:"100px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.check_in)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Check Out"}),id:"check_out",minWidth:"100px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.check_out)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Total Hours"}),id:"total_hours",width:"120px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.total_hours)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Worked Minutes"}),id:"total_worked_minutes",width:"150px",cell:e=>(0,n.jsx)("div",{style:R,children:(0,m.Z)(e.total_worked_minutes)}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Holiday"}),id:"is_holiday",width:"100px",cell:e=>(0,n.jsx)("div",{style:R,children:e.is_holiday?"Yes":"No"}),sortable:!0},{name:(0,n.jsx)("div",{style:R,children:"Overtime"}),id:"is_ot",width:"100px",cell:e=>(0,n.jsx)("div",{style:R,children:e.is_ot?"Yes":"No"}),sortable:!0}],A=async()=>{O(!0);try{var e,a;let n=await o.Z.post("/payroll/attendance/list",{page_enabled:"y",page:y,limit:b,sortDetails:E,searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:"",date:w,monthYear:N,employee_id:C,company_id:t}),l=(null===(e=n.data)||void 0===e?void 0:e.data)||[];p(l),i((null===(a=n.data)||void 0===a?void 0:a.count)||0)}catch(e){console.error("Failed to fetch attendance list:",e)}finally{O(!1)}},M=async()=>{O(!0);try{var e;let a=await o.Z.post("/payroll/employee/active-list",{page_enabled:"n",page:-1,limit:-1,sortDetails:{sort
1Key:"name",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:"",company_id:t}),n=(null===(e=a.data)||void 0===e?void 0:e.data)||[];D(n)}catch(e){console.error("Failed to fetch employee list:",e)}finally{O(!1)}};return(0,l.useEffect)(()=>{S.length<=0&&M(),A()},[y,b,E,w,N,C]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"px-4 pt-4",children:[(0,n.jsx)("h1",{className:"text-2xl  mb-3",children:"Attendance Details (".concat(a,")")}),(0,n.jsx)("div",{className:"mb-4",children:(0,n.jsx)(x,{companyId:t})}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsx)(r.ZP,{content:(0,n.jsx)("span",{className:"text-xs",children:"Add New"}),placement:"bottom",children:(0,n.jsx)(c(),{href:"/salary-management/company/".concat(t,"/attendance/add"),children:(0,n.jsx)("button",{className:"bg-gray-300 hover:bg-gray-400 px-4 py-2 rounded text-sm h-10",children:(0,n.jsx)(u.Z,{className:"w-5 h-5"})})})}),(0,n.jsx)(e=>{let{value:t,onChange:a}=e;return(0,n.jsx)("input",{type:"date",value:t,onChange:e=>a(e.target.value),max:new Date().toISOString().split("T")[0],className:"border-2 border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-400"})},{value:w,onChange:e=>{_(e),k("")}}),(0,n.jsx)(c(),{href:"/salary-management/company/".concat(t,"/attendance/add-team"),className:"bg-gray-300 hover:bg-gray-400 px-4 py-2 rounded text-sm h-10 inline-flex items-center justify-center",children:"Mark Team Attendance"}),(0,n.jsx)(g.Z,{value:N,onChange:e=>{k(e),_("")},className:"rounded",inputClassName:"focus:outline-none focus:ring focus:border-blue-500"}),(0,n.jsxs)("select",{value:C,onChange:e=>Z(e.target.value),className:"border rounded px-5 py-2 text-sm",children:[(0,n.jsx)("option",{value:"",children:"Select Employee"}),Array.isArray(S)&&S.map(e=>(0,n.jsx)("option",{value:e.employee_id,children:e.name},e.employee_id))]})]})]}),(0,n.jsx)("div",{className:"pt-2 p-4",children:(0,n.jsx)(s.ZP,{columns:I,data:h,progressPending:P,pagination:!0,paginationServer:!0,paginationPerPage:b,paginationRowsPerPageOptions:[5,10,20,30,50,100],paginationTotalRows:a,onChangeRowsPerPage:e=>{v(1),j(e)},onChangePage:e=>{v(e)},sortServer:!0,defaultSortFieldId:"col_".concat(E.sortKey),defaultSortAsc:1===E.sortType,onSort:(e,t)=>{let a={sortKey:"string"==typeof(null==e?void 0:e.id)?e.id.replace("col_",""):"id",sortType:"desc"===t?-1:1};T(a)},fixedHeader:!0,fixedHeaderScrollHeight:"64vh",customStyles:f.Z,highlightOnHover:!0})})]})},b=a(42689),j=a(64270),w=a(11846),_=()=>{let e=(0,j.P)("companyId");return!e||e<1?null:(0,n.jsx)(w.Z,{children:(0,n.jsx)(b.default,{children:(0,n.jsx)(v,{companyId:e})})})}},28646:function(e,t,a){"use strict";var n=a(85893),l=a(41664),s=a.n(l),o=a(11163);a(67294),t.Z=()=>{let e=(0,o.useRouter)(),t=e.asPath;return(0,n.jsxs)("div",{className:"md:mx-28 text-center text-red-500 p-10 bg-gray-100 text-xl",children:["Your are not Logged in to use this functionality .......! ",(0,n.jsx)("br",{}),(0,n.jsx)(s(),{className:"text-blue-500",href:"/login?re_url=".concat(t),children:"Click here to Login"})]})}},8823:function(e,t){"use strict";t.Z={headCells:{style:{border:"1px solid #f1f1f1",fontSize:"14px",backgroundColor:"#e1e1e1"}},cells:{style:{border:"1px solid #f1f1f1",paddingLeft:"7px",paddingRight:"7px"}}}},26533:function(e,t,a){"use strict";var n=a(85893);a(67294),t.Z=e=>{let{value:t,onChange:a,className:l="",inputClassName:s=""}=e;return(0,n.jsx)("div",{className:l,children:(0,n.jsx)("input",{type:"month",value:t,onChange:e=>a(e.target.value),className:"border px-3 py-2 rounded w-full text-sm ".concat(s)})})}},11846:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var n=a(85893),l=a(48583),s=a(94543),o=a(28646);function r(e){let{children:t}=e,a=(0,l.Dv)(s.ZP);return a.isLoggedIn?t:(0,n.jsx)(o.Z,{})}},17866:function(e,t){"use strict";t.Z=e=>{try{if("string"==typeof e||"number"==typeof e)return"".concat(e);return"-"}catch(e){return console.error(e),"-----"}}},64270:function(e,t,a){"use strict";a.d(t,{N:function(){return o},P:function(){return s}});var n=a(11163),l=a(67294);function s(e){let t=(0,n.useRouter)(),[a,s]=(0,l.useState)(null);return(0,l.useEffect)(()=>
1{if(t.isReady){let a=t.query[e];if("string"==typeof a){let e=Number(a);e>=1&&s(e)}}},[t.isReady,t.query,e]),a}function o(e){let t=(0,n.useRouter)(),[a,s]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(t.isReady){let a=t.query[e];"string"==typeof a&&""!==a.trim()&&s(a)}},[t.isReady,t.query,e]),a}}},function(e){e.O(0,[8869,44,5655,9774,2888,179],function(){return e(e.s=74973)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.