1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7990],{91373:function(e,t,a){a.d(t,{Z:function(){return m}});var l=a(67294);/** 2 * @license lucide-react v0.540.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase()),r=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},c=(...e)=>e.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim(),o=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};/** 7 * @license lucide-react v0.540.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** 12 * @license lucide-react v0.540.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */let d=(0,l.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:n,className:s="",children:r,iconNode:d,...m},u)=>(0,l.createElement)("svg",{ref:u,...i,width:t,height:t,stroke:e,strokeWidth:n?24*Number(a)/Number(t):a,className:c("lucide",s),...!r&&!o(m)&&{"aria-hidden":"true"},...m},[...d.map(([e,t])=>(0,l.createElement)(e,t)),...Array.isArray(r)?r:[r]])),m=(e,t)=>{let a=(0,l.forwardRef)(({className:a,...s},o)=>(0,l.createElement)(d,{ref:o,iconNode:t,className:c(`lucide-${n(r(e))}`,`lucide-${e}`,a),...s}));return a.displayName=r(e),a}},64998:function(e,t,a){a.d(t,{Z:function(){return n}});var l=a(91373);let n=(0,l.Z)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},42689:function(e,t,a){a.r(t);var l=a(85893),n=a(67294),s=a(41664),r=a.n(s),c=a(11163),o=a(88446),i=a(86501);t.default=e=>{let{children:t}=e,a=(0,c.useRouter)(),{companyId:s}
16=a.query,[d,m]=(0,n.useState)(null),[u,h]=(0,n.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,n.useEffect)(()=>{if(!s)return;let e=async()=>{var e,t,a;try{let t=await o.Z.post("/payroll/company/company-by-id",{company_id:s});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{h(!1)}};e()},[s]),(0,l.jsxs)("div",{className:"flex min-h-screen",children:[(0,l.jsxs)("aside",{className:"w-64 flex-shrink-0 bg-gray-900 text-white p-4",children:[u?(0,l.jsx)("h2",{className:"text-lg font-bold mb-6",children:"Loading..."}):(0,l.jsxs)("div",{className:"flex items-center gap-3 my-3",children:[(null==d?void 0:d.logo_url)&&(0,l.jsx)("img",{src:d.logo_url,alt:d.company_name,className:"w-12 h-12 rounded-full object-cover border border-gray-700"}),(0,l.jsx)("h2",{className:"text-lg font-bold truncate",children:(null==d?void 0:d.company_name)||"Company"})]}),(0,l.jsx)("ul",{className:"space-y-2 mb-6",children:p.map(e=>(0,l.jsx)("li",{children:(0,l.jsx)(r(),{href:e.path,children:(0,l.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,l.jsx)(r(),{href:"/salary-management/company",children:(0,l.jsx)("span",{className:"block mt-6 text-sm text-gray-300 hover:text-white",children:"â Back to Companies"})})]}),(0,l.jsx)("main",{className:"flex-1 p-3 bg-gray-100 overflow-x-auto",children:(0,l.jsx)("div",{className:"min-w-[1200px]",children:t})})]})}},28646:function(e,t,a){var l=a(85893),n=a(41664),s=a.n(n),r=a(11163);a(67294),t.Z=()=>{let e=(0,r.useRouter)(),t=e.asPath;return(0,l.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,l.jsx)("br",{}),(0,l.jsx)(s(),{className:"text-blue-500",href:"/login?re_url=".concat(t),children:"Click here to Login"})]})}},28368:function(e,t,a){var l=a(85893),n=a(67294),s=a(88446),r=a(86501),c=a(41664),o=a.n(c),i=a(64998),d=a(11163);t.Z=e=>{let{companyId:t,id:a}=e,c=(0,d.useRouter)(),[m,u]=(0,n.useState)([]),[h,p]=(0,n.useState)(!1),[y,x]=(0,n.useState)({employee_id:"",date:new Date().toISOString().split("T")[0],check_in:"",check_out:"",total_hours:0,total_worked_minutes:0,is_ot:!1,is_holiday:!1,is_present:!0}),[g,b]=(0,n.useState)({employee_id:"",date:"",check_in:"",check_out:"",total_hours:"",total_worked_minutes:"",is_ot:"",is_holiday:""}),[f,_]=(0,n.useState)({loading:!1,success:"",error:""}),k=()=>{let e={};return y.employee_id||(e.employee_id="Please select an employee"),y.date||(e.date="Date is required"),!1===y.is_present||(y.check_in||(e.check_in="Check-in time is required"),y.check_out||(e.check_out="Check-out time is required")),(g.check_in||g.check_out)&&(e.check_in=g.check_in,e.check_out=g.check_out),b(e),0===Object.keys(e).length},w=(e,t)=>{if(!e||!t)return;let[a,l]=e.split(":").map(Number),[n,s]=t.split(":").map(Number),r=new Date;
16r.setHours(a,l,0,0);let c=new Date;c.setHours(n,s,0,0);let o=c.getTime()-r.getTime();if(o<0){b(e=>({...e,check_in:"",check_out:"Check-out time must be after check-in time"})),x(e=>({...e,total_hours:"",total_worked_minutes:""}));return}b(e=>({...e,check_in:"",check_out:""}));let i=Math.floor(o/6e4),d=+(i/60).toFixed(2);x(e=>({...e,total_hours:d,total_worked_minutes:i}))};(0,n.useEffect)(()=>{y.check_in&&y.check_out&&w(y.check_in,y.check_out)},[y.check_in,y.check_out]);let v=async()=>{p(!0);try{var e;let a=await s.Z.post("/payroll/employee/active-list",{page_enabled:"n",page:1,limit:1e3,sortDetails:{sortKey:"name",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:"",company_id:t}),l=(null===(e=a.data)||void 0===e?void 0:e.data)||[];u(l)}catch(e){console.error("Failed to fetch employee list:",e)}finally{p(!1)}};(0,n.useEffect)(()=>{v()},[]),(0,n.useEffect)(()=>{let e=async()=>{if(a){_({loading:!0,success:"",error:""});try{var e;let t=await s.Z.get("/payroll/attendance/attendance-by-id/".concat(a));if(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.data){let e=t.data.data,a={...e,date:e.date?new Date(e.date).toISOString().split("T")[0]:""};x(a),_({loading:!1,success:"",error:""})}else _({loading:!1,success:"",error:"No data found"})}catch(e){_({loading:!1,success:"",error:e.message||"Something went wrong"})}}};e()},[a]);let j=(e,t)=>{let{name:a,value:l,checked:n}=e.target,s="number"===t?parseFloat(l)||0:"checkbox"===t?n:l;x(e=>({...e,[a]:s})),b(e=>({...e,[a]:""}))},N=async()=>{if(!k()){r.ZP.error("Please update all required fields.");return}_({loading:!0,success:"",error:""});let e={employee_id:y.employee_id,date:y.date,check_in:y.check_in,check_out:y.check_out,total_hours:y.total_hours,total_worked_minutes:y.total_worked_minutes,is_ot:y.is_ot,is_holiday:y.is_holiday,is_present:y.is_present,company_id:t};try{a?(await s.Z.put("/payroll/attendance/update",{attendance_id:a,...e}),r.ZP.success("Attendance updated successfully!")):(await s.Z.post("/payroll/attendance/create",e),r.ZP.success("Attendance added successfully!")),c.push("/salary-management/company/".concat(t,"/attendance")),_({loading:!1,success:"",error:""})}catch(e){console.error("Error submitting attendance:",e),_({loading:!1,success:"",error:a?"Failed to update attendance!":"Failed to add attendance!"}),r.ZP.error(a?"Failed to update attendance!":"Failed to add attendance!")}};return(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"container mx-auto",children:(0,l.jsxs)("div",{className:"py-5 px-2 lg:px-8",children:[(0,l.jsx)("h2",{className:"font-bold mb-2",children:a?"Attendance Edit":"Attendance Add"}),(0,l.jsx)("div",{className:"container mx-auto py-1",children:(0,l.jsxs)("ul",{className:"flex flex-wrap items-center",children:[(0,l.jsxs)("li",{className:"inline-flex items-center",children:[(0,l.jsx)(o(),{href:"/salary-management/company/".concat(t,"/attendance"),children:(0,l.jsx)("span",{className:"text-gray-600 hover:text-blue-500",children:"Attendance List"})}),(0,l.jsx)(i.Z,{className:"w-4 h-4 mx-3 text-gray-400"})]}),(0,l.jsx)("li",{className:"inline-flex items-center",children:(0,l.jsx)("span",{className:"text-blue-500",children:a?"Edit":"Add"})})]})}),(0,l.jsx)("div",{className:"py-3",children:(0,l.jsx)(o(),{href:"/salary-management/company/".concat(t,"/attendance"),children:(0,l.jsx)("button",{className:"shadow bg-slate-300 hover:bg-slate-400 text-black py-2 px-4 rounded",type:"button",children:"Back"})})}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col md:flex-row lg:flex-row items-center pb-3",children:[(0,l.jsx)("div",{className:"w-full md:w-[40%] lg:w-1/5",children:(0,l.jsx)("label",{className:"block text-black font-semibold text-sm mb-1",children:"Select Employee"})}),(0,l.jsxs)("div",{className:"w-full lg:w-[40%]",children:[(0,l.jsx)("div",{className:"md:ml-[-21%] md:w-[68%] lg:w-[119%] lg:ml-[-1%]",children:(0,l.jsxs)("select",{name:"employee_id",value:y.employee_id,onChange:e=>{let{value:t}=e.target;x(e=>({...e,employee_id:t})),b(e=>({...e,employee_id:""}))},disabled:h,className:"border-2 border-gray-200 rounded w-full md:ml-[26%] lg:ml-[0%] lg:w-3/4 py-2 px-4 text-gray-700 text-sm bg-slate-200",children:[(0,l.jsx)("option",{value:"",children:h?"Loading...":"Select Employee"}),Array.isArray(m)&&m.map(e=>(0,l.jsx)("option",{value:e.employee_id,children:e.name},e.employee_id))]})}),g.employee_id&&(0,l.jsx)("div",{className:"text-red-300 text-sm mt-1",children:g.employee_id})]})]}),[{label:"Employee ID*",name:"employee_id",type:"text",disabled:!0},{label:"Date*",name:"date",type:"date"},{label:"Check In*",name:"check_in",type:"time"},{label:"Check Out*",name:"check_out",type:"time"},{label:"Total Hours*",name:"total_hours",type:"number",disabled:!0},{label:"Total Worked Minutes*",name:"total_worked_minutes",type:"number",disabled:!0}
16,{label:"Overtime (OT)",name:"is_ot",type:"checkbox"},{label:"Holiday",name:"is_holiday",type:"checkbox"},{label:"Present",name:"is_present",type:"checkbox"}].map(e=>{let{label:t,name:a,type:n,disabled:s=!1}=e;return(0,l.jsxs)("div",{className:"flex flex-col md:flex-row lg:flex-row items-center pb-3",children:[(0,l.jsx)("div",{className:"w-full md:w-[40%] lg:w-1/5",children:(0,l.jsx)("label",{className:"block text-black font-semibold text-sm mb-1",children:t})}),(0,l.jsxs)("div",{className:"w-full lg:w-[40%]",children:[(0,l.jsx)("div",{className:"md:ml-[-21%] md:w-[68%] lg:w-[119%] lg:ml-[-1%]",children:"checkbox"===n?(0,l.jsx)("input",{name:a,type:"checkbox",disabled:s,checked:y[a],className:"border-2 border-gray-200 rounded text-gray-700 text-sm",onChange:e=>j(e,n)}):(0,l.jsx)("input",{name:a,type:n,disabled:s,value:y[a],max:"date"===n?new Date().toISOString().split("T")[0]:void 0,className:"border-2 border-gray-200 rounded w-full md:ml-[26%] lg:ml-[0%] lg:w-3/4 py-2 px-4 text-gray-700 text-sm bg-slate-200",placeholder:t,onChange:e=>j(e,n),onKeyDown:e=>{(38===e.keyCode||40===e.keyCode)&&e.preventDefault()}})}),g[a]&&(0,l.jsx)("div",{className:"text-red-300 text-sm mt-1",children:g[a]})]})]},a)})]}),(0,l.jsx)("div",{className:"pt-4",children:f.loading?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"pb-3",children:(0,l.jsx)("p",{className:"text-blue-400 text-sm bg-blue-100 p-2 rounded",children:"Loading..."})}),(0,l.jsx)("button",{className:"shadow bg-yellow-400 hover:bg-yellow-500 text-white py-2 px-4 rounded",type:"button",children:"Loading..."})]}):(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{children:[(0,l.jsx)("button",{className:"shadow bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded",type:"button",onClick:N,children:a?"Update":"Add"}),(0,l.jsx)(o(),{href:"/salary-management/company/".concat(t,"/attendance"),children:(0,l.jsx)("button",{className:"shadow bg-slate-300 hover:bg-slate-400 text-black py-2 px-4 rounded ml-3",type:"button",children:"Back"})})]})})})]})})})}},11846:function(e,t,a){a.d(t,{Z:function(){return c}});var l=a(85893),n=a(48583),s=a(94543),r=a(28646);function c(e){let{children:t}=e,a=(0,n.Dv)(s.ZP);return a.isLoggedIn?t:(0,l.jsx)(r.Z,{})}},64270:function(e,t,a){a.d(t,{N:function(){return r},P:function(){return s}});var l=a(11163),n=a(67294);function s(e){let t=(0,l.useRouter)(),[a,s]=(0,n.useState)(null);return(0,n.useEffect)(()=>{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 r(e){let t=(0,l.useRouter)(),[a,s]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(t.isReady){let a=t.query[e];"string"==typeof a&&""!==a.trim()&&s(a)}},[t.isReady,t.query,e]),a}}}]);
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.