PageSourceSearch

https://ripplemind.com/_next/static/chunks/pages/salary-management…/attendance/add-team-01854de428258d82.js

js ripplemind.com collected 2026-10-06 13:16:42 UTC 9,646 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3553],{83508:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/salary-management/company/[companyId]/attendance/add-team",function(){return a(97321)}])},42689:function(e,t,a){"use strict";a.r(t);var n=a(85893),s=a(67294),l=a(41664),r=a.n(l),o=a(11163),c=a(88446),i=a(86501);t.default=e=>{let{children:t}=e,a=(0,o.useRouter)(),{companyId:l}=a.query,[d,m]=(0,s.useState)(null),[u,p]=(0,s.useState)(!0),y=[{name:"Employees",path:"/salary-management/company/".concat(l,"/employees")},{name:"Departments",path:"/salary-management/company/".concat(l,"/department")},{name:"Attendance",path:"/salary-management/company/".concat(l,"/attendance")},{name:"Designations",path:"/salary-management/company/".concat(l,"/designation")},{name:"Salary List",path:"/salary-management/company/".concat(l,"/salary-list")},{name:"Holidays",path:"/salary-management/company/".concat(l,"/holidays")},{name:"Religion",path:"/salary-management/company/".concat(l,"/religion")}].sort((e,t)=>e.name.localeCompare(t.name));return(0,s.useEffect)(()=>{if(!l)return;let e=async()=>{var e,t,a;try{let t=await c.Z.post("/payroll/company/company-by-id",{company_id:l});m(null===(e=t.data)||void 0===e?void 0:e.data)}catch(e){i.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{p(!1)}};e()},[l]),(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:[u?(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:y.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(r(),{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)(r(),{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})})]})}},97321:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return x}});var n=a(85893),s=a(64270),l=a(67294),r=a(88446),o=a(86501),c=a(41664),i=a.n(c),d=a(90044),m=a(8823),u=a(11163),p=e=>{let{companyId:t}=e,a=(0,u.useRouter)(),[s,c]=(0,l.useState)([]),[p,y]=(0,l.useState)({}),[h,x]=(0,l.useState)(new Date().toISOString().split("T")[0]),[g,f]=(0,l.useState)(!1),[b,v]=(0,l.useState)("");(0,l.useEffect)(()=>{_()},[]);let _=async()=>{f(!0);try{var e;let a=await r.Z.post("/payroll/employee/list",{page_enabled:"n",page:1,limit:1e3,sortDetails:{sortKey:"employee-id",sortType:-1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:"",company_id:t}),n=((null===(e=a.data)||void 0===e?void 0:e.data)||[]).sort((e,t)=>e.name.localeCompare(t.name));c(n)}catch(e){console.error("Error fetching employees:",e)}finally{f(!1)}},N=(e,t,a)=>{let n="checkbox"===e.target.type?e.target.checked:e.target.value;y(e=>({...e,[t]:{...e[t],[a]:n}}))},j=(e,t)=>{let[a,n]=e.split(":").map(Number),[s,l]=t.split(":").map(Number),r=60*s+l-(60*a+n);return{hours:r>0?Math.floor(r/60):0,totalMins:r>0?r:0}},k=async()=>{if(!h){alert("Please select a date");return}let e={date:h,attendances:s.map(e=>{let a=p[e.employee_id]||{},n=a.check_in||"00:00",s=a.check_out||"00:00",l=!!a.is_present,r=!!a.is_ot,{hours:o,totalMins:c}=j(n,s);return{employee_id:e.employee_id,check_in:n,check_out:s,total_hours:l?o:0,total_worked_minutes:l?c:0,is_ot:r,is_present:l,company_id:t}})};try{await r.Z.post("/payroll/attendance/day-attendance",e),a.push("/salary-management/company/".concat(t,"/attendance-list")),o.ZP.success("Attendance submitted successfully.")}catch(e){console.error("Submission error:",e),o.ZP.error("Failed to submit attendance.")}},w=s.filter(e=>e.name.toLowerCase().includes(b.toLowerCase())),S=[{name:"Name",selector:e=>e.name,sortable:!0,wrap:!0},{name:"ID",selector:e=>e.employee_id,sortable:!0,maxWidth:"120px"},{name:"Check In",cell:e=>{var t;return(0,n.jsx)("input",{type:"time",className:"border rounded px-2 py-1 text-sm bg-white",value:(null===(t=p[e.employee_id])||void 0===t?void 0:t.check_in)||"",onChange:t=>N(t,e.employee_id,"check_in")})}},{name:"Check Out",cell:e=>{var t;return(0,n.jsx)("input",{type:"time",className:"border rounded px-2 py-1 text-sm bg-white",value:(null===(t=p[e.employee_id])||void 0===t?void 0:t.check_out)||"",onChange:t=>N(t,e.employee_id,"check_out")})}},{name:"Hours Spent",cell:e=>{var t,a;let n=null===(t=p[e.employee_id])||void 0===t?void 0:t.check_in,s=null===(a=p[e.employee_id])||void 0===a?void 0:a.check_out;if(!n||!s)return"-";let[l,r]=n.split(":").map(Number),[o,c]=s.split(":").map(Number),i=60*l+r,d=60*o+c,m=d>=i?d-i:1440-i+d;return"".concat(Math.floor(m/60),"h ").concat(m%60,"m")}},{name:"Minutes",cell:e=>{var t,a;let n=null===(t=p[e.employee_id])||void 0===t?void 0:t.check_in,s=null===(a=p[e.employee_id])||void 0===a?void 0:a.check_out;if(!n||!s)return"-";let[l,r]=n.split(":").map(Number),[o,c]=s.split(":").map(Number),i=60*l+r,d=60*o+c;return"".concat(d>=i?d-i:1440-i+d)}},{name:"Present",cell:e=>{var t;return(0,n.jsx)("input",{type:"checkbox",className:"w-4 h-4",checked:(null===(t=p[e.employee_id])||void 0===t?void 0:t.is_present)||!1,onChange:t=>N(t,e.employee_id,"is_present")})}},{name:"OT",cell:e=>{var t;return(0,n.jsx)("input",{type:"checkbox",className:"w-4 h-4",checked:(null===(t=p[e.employee_id])||void 0===t?void 0:t.is_ot)||!1,onChange:t=>N(t,e.employee_id,"is_ot")})}}];return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Mark Team Attendance"}),(0,n.jsxs)("div",{className:"text-sm text-gray-600 mb-2",children:[(0,n.jsx)(i(),{href:"/salary-management/company/".concat(t,"/attendance"),className:"text-gray-500",children:"Attendance List"})," ","/ ",(0,n.jsx)("span",{className:"text-gray-700",children:"Team Add"})]}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4 mb-4",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium",children:"Date:"}),(0,n.jsx)("input",{type:"date",className:"border px-3 py-2 rounded text-sm bg-white",value:h,onChange:e=>x(e.target.value),max:new Date().toISOString().split("T")[0]})]}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,n.jsx)("input",{type:"text",placeholder:"Search by name",className:"border px-3 py-2 rounded text-sm bg-white",value:b,onChange:e=>v(e.target.value)}),(0,n.jsx)("button",{className:"bg-red-100 text-red-600 hover:bg-red-200 px-4 py-2 rounded text-sm",onClick:()=>{y({})},children:"Reset All"})]})]}),(0,n.jsx)(d.ZP,{columns:S,data:w,progressPending:g,pagination:!0,fixedHeader:!0,fixedHeaderScrollHeight:"500px",highlightOnHover:!0,persistTableHead:!0,noHeader:!0,customStyles:m.Z}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4",children:[(0,n.jsx)("button",{type:"button",onClick:k,className:"bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded text-sm",disabled:g,children:"Submit Attendance"}),(0,n.jsx)(i(),{href:"/salary-management/company/".concat(t,"/attendance"),children:(0,n.jsx)("button",{type:"button",className:"bg-gray-300 hover:bg-gray-400 text-black px-6 py-2 rounded text-sm",children:"Back"})})]})]})},y=a(42689),h=a(11846),x=()=>{let e=(0,s.P)("companyId");return((0,s.P)("id"),!e||e<1)?null:(0,n.jsx)(h.Z,{children:(0,n.jsx)(y.default,{children:(0,n.jsx)(p,{companyId:e})})})}},28646:function(e,t,a){"use strict";var n=a(85893),s=a(41664),l=a.n(s),r=a(11163);a(67294),t.Z=()=>{let e=(0,r.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)(l(),{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"}}}},11846:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(85893),s=a(48583),l=a(94543),r=a(28646);function o(e){let{children:t}=e,a=(0,s.Dv)(l.ZP);return a.isLoggedIn?t:(0,n.jsx)(r.Z,{})}},64270:function(e,t,a){"use strict";a.d(t,{N:function(){return r},P:function(){return l}});var n=a(11163),s=a(67294);
1function l(e){let t=(0,n.useRouter)(),[a,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(t.isReady){let a=t.query[e];if("string"==typeof a){let e=Number(a);e>=1&&l(e)}}},[t.isReady,t.query,e]),a}function r(e){let t=(0,n.useRouter)(),[a,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(t.isReady){let a=t.query[e];"string"==typeof a&&""!==a.trim()&&l(a)}},[t.isReady,t.query,e]),a}}},function(e){e.O(0,[44,9774,2888,179],function(){return e(e.s=83508)}),_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.