1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[75],{90470:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var l=a(91373);let n=(0,l.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 n}});var l=a(91373);let n=(0,l.Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},87764:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var l=a(91373);let n=(0,l.Z)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},13671:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var l=a(91373);let n=(0,l.Z)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},76426:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/salary-management/company/[companyId]/employees",function(){return a(69219)}])},42689:function(e,t,a){"use strict";a.r(t);var l=a(85893),n=a(67294),i=a(41664),s=a.n(i),r=a(11163),o=a(88446),d=a(86501);t.default=e=>{let{children:t}=e,a=(0,r.useRouter)(),{companyId:i}
1=a.query,[c,m]=(0,n.useState)(null),[p,y]=(0,n.useState)(!0),h=[{name:"Employees",path:"/salary-management/company/".concat(i,"/employees")},{name:"Departments",path:"/salary-management/company/".concat(i,"/department")},{name:"Attendance",path:"/salary-management/company/".concat(i,"/attendance")},{name:"Designations",path:"/salary-management/company/".concat(i,"/designation")},{name:"Salary List",path:"/salary-management/company/".concat(i,"/salary-list")},{name:"Holidays",path:"/salary-management/company/".concat(i,"/holidays")},{name:"Religion",path:"/salary-management/company/".concat(i,"/religion")}].sort((e,t)=>e.name.localeCompare(t.name));return(0,n.useEffect)(()=>{if(!i)return;let e=async()=>{var e,t,a;try{let t=await o.Z.post("/payroll/company/company-by-id",{company_id:i});m(null===(e=t.data)||void 0===e?void 0:e.data)}catch(e){d.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{y(!1)}};e()},[i]),(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:[p?(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==c?void 0:c.logo_url)&&(0,l.jsx)("img",{src:c.logo_url,alt:c.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==c?void 0:c.company_name)||"Company"})]}),(0,l.jsx)("ul",{className:"space-y-2 mb-6",children:h.map(e=>(0,l.jsx)("li",{children:(0,l.jsx)(s(),{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)(s(),{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})})]})}},69219:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return k}});var l=a(85893),n=a(42689),i=a(67294),s=a(90044),r=a(88446),o=a(87083),d=a(8823),c=a(86501),m=a(41664),p=a.n(m),y=a(90470),h=a(13671),u=a(31012),x=a(87764),v=a(91373);let g=(0,v.Z)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);var f=a(6605);let j={employee_id:"Employee ID",name:"Employee Name",email:"Email",mobile:"Mobile",department:"Department",designation:"Designation",join_date:"Joining Date",salary_per_month:"Monthly Salary",religion:"Religion",start_time:"Start Time",end_time:"End Time",total_work_minutes_per_day:"Total Work Minutes/Day",is_active:"Is Active",include_saturday:"Include Saturday",include_sunday:"Include Sunday",operator_id:"Operator ID"},b=e=>e.map(e=>{var t,a,l,n,i,s;return{employee_id:e.employee_id,name:e.name,email:e.email,mobile:e.mobile,department:(null===(t=e.departmentDetails)||void 0===t?void 0:null===(a=t[0])||void 0===a?void 0:a.name)||"",designation:(null===(l=e.designationDetails)||void 0===l?void 0:null===(n=l[0])||void 0===n?void 0:n.name)||"",join_date:(null===(i=e.join_date)||void 0===i?void 0:i.split("T")[0])||"",salary_per_month:e.salary_per_month,religion:(null===(s=e.religionDetails[0])||void 0===s?void 0:s.name)||"",start_time:e.start_time,end_time:e.end_time,total_work_minutes_per_day:e.total_work_minutes_per_day,is_active:e.is_active?"Yes":"No",include_saturday:e.include_saturday?"Yes":"No",include_sunday:e.include_sunday?"Yes":"No",operator_id:e.operator_id}});var _=e=>{let{companyId:t}=e,[a,n]=(0,i.useState)(0),[m,v]=(0,i.useState)([]),[_,w]=(0,i.useState)(1),[N,k]=(0,i.useState)(20),[S,E]=(0,i.useState)({sortKey:"employee-id",sortType:-1}),[D,Z]=(0,i.useState)(!1),[C,P]=(0,i.useState)(!1),[T,R]=(0,i.useState)(""),[F,M]=(0,i.useState)(!1),I=async()=>{Z(!0);try{var e,a;let l=await r.Z.post("/payroll/employee/list",{page_enabled:"y",page:_,limit:N,sortDetails:S,searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:T,company_id:Number(t)}),i=(null===(e=l.data)||void 0===e?void 0:e.data)||[];v(i),n((null===(a=l.data)||void 0===a?void 0:a.count)||0)}catch(e){console.error("Failed to fetch employee list:",e)}finally{Z(!1)}},W=e=>{try{if("string"==typeof e||"number"==typeof e)return"".concat(e);return"-"}catch(e){return console.error(e),"-----"}},A=async()=>{Z(!0);try{var e,t;let a=await r.Z.post("/payroll/employee/list",{page_enabled:"y",page:_,limit:N,sortDetails:S,searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:T}),l=(null===(e=a.data)||void 0===e?void 0:e.data)||[];return v(l),n((null===(t=a.data)||void 0===t?void 0:t.count)||0),l}catch(e){return console.error("Failed to fetch employee list:",e),[]}finally{Z(!1)}};(0,i.useEffect)(()=>{I()},[_,N,S,T]);let O={display:"flex",justifyContent:"center",width:"100%"},H=async e=>{let a=window.confirm("Are you sure you want to delete this employee?");if(a)try{let a=await r.Z.patch("/payroll/employee/delete/".concat(e),{employeeId:e,company_id:Number(t)});if(200===a.status)c.ZP.success("Employee deactivated successfully.");else throw Error("Unexpected response status")}catch(e){console.error("Error deleting employee:",e),c.ZP.error("An error occurred while deactivating the employee.")}},V=[{name:(0,l.jsx)("div",{style:O,children:"Action"}),width:"160px",cell:e=>(0,l.jsxs)("div",{style:O,children:[(0,l.jsx)(o.ZP,{content:(0,l.jsx)("span",{children:"Edit"}),placement:"bottom",children:(0,l.jsx)(p(),{href:"/salary-management/company/".concat(t,"/employees/").concat(e.employee_id,"/edit"),children:(0,l.jsx)("button",{className:"m-1 inline p-5 bg-gray-300 hover:bg-gray-400 text-black py-2 px-4 roun
1ded",children:(0,l.jsx)(y.Z,{className:"mx-3 text-black w-4 h-4"})})})}),(0,l.jsx)(o.ZP,{content:(0,l.jsx)("span",{children:"Delete"}),placement:"bottom",children:(0,l.jsx)("button",{className:"m-1 inline p-5 bg-gray-300 hover:bg-gray-400 text-black py-2 px-4 rounded",onClick:()=>H(e.employee_id),children:(0,l.jsx)(h.Z,{className:"mx-3 text-black w-4 h-4"})})})]})},{name:(0,l.jsx)("div",{style:O,children:"ID"}),id:"id",minWidth:"80px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.id)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Employee ID"}),id:"employee_id",minWidth:"120px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.employee_id)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Name"}),id:"name",minWidth:"120px",cell:e=>(0,l.jsx)("div",{children:W(e.name)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Gender"}),id:"gender",minWidth:"120px",cell:e=>(0,l.jsx)("div",{children:W(e.gender)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Status"}),id:"is_active",minWidth:"120px",sortable:!0,cell:e=>(0,l.jsx)("div",{children:!0===e.is_active?"Active":"Deactive"})},{name:(0,l.jsx)("div",{style:O,children:"Employee Type"}),id:"work_type",minWidth:"120px",sortable:!0,cell:e=>(0,l.jsx)("div",{style:O,children:W(e.work_type)})},{name:(0,l.jsx)("div",{style:O,children:"Email"}),id:"email",minWidth:"150px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.email)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Mobile"}),id:"mobile",width:"120px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.mobile)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Religion"}),id:"religion",width:"120px",cell:e=>{var t;return(0,l.jsx)("div",{style:O,children:W(null===(t=e.religionDetails[0])||void 0===t?void 0:t.name)})},sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Comp Off"}),id:"comp_off",minWidth:"80px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.comp_off)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Base Salary"}),id:"base_salary",width:"120px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.base_salary)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Salary Per Day"}),id:"salary_per_day",width:"120px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.salary_per_day)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Salary/Month"}),id:"salary_per_month",width:"120px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.salary_per_month)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Department"}),id:"department",width:"120px",cell:e=>{var t;return(0,l.jsx)("div",{style:O,children:W(null===(t=e.departmentDetails[0])||void 0===t?void 0:t.name)})},sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Designation"}),id:"designation",minWidth:"150px",cell:e=>{var t;return(0,l.jsx)("div",{style:O,children:W(null===(t=e.designationDetails[0])||void 0===t?void 0:t.name)})},sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Join Date"}),id:"join_date",width:"130px",cell:e=>(0,l.jsx)("div",{style:O,children:W(new Date(e.join_date).toLocaleDateString())}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Check In"}),id:"start_time",width:"80px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.start_time)}),sortable:!0},{name:(0,l.jsx)("div",{style:O,children:"Check Out"}),id:"end_time",width:"80px",cell:e=>(0,l.jsx)("div",{style:O,children:W(e.end_time)}),sortable:!0}];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"px-4 pt-4",children:[(0,l.jsx)("h1",{className:"text-2xl mb-1",children:"Employee Details (".concat(a,")")}),(0,l.jsxs)("div",{className:"space-x-2",children:[(0,l.jsx)(o.ZP,{content:(0,l.jsx)("span",{className:"text-xs",children:"Add New"}),placement:"bottom",children:(0,l.jsx)(p(),{href:"/salary-management/company/".concat(t,"/employees/add"),children:(0,l.jsx)("button",{className:"p-2 bg-gray-300 hover:bg-gray-400 py-2 px-3 rounded ml-1",children:(0,l.jsx)(u.Z,{className:"w-5 h-5 text-gray-700"})})})}),(0,l.jsx)(o.ZP,{content:(0,l.jsx)("span",{className:"text-xs",children:"Search"}),placement:"bottom",children:(0,l.jsx)("button",{className:"p-2 bg-gray-300 hover:bg-gray-400 py-2 px-3 rounded ml-1",onClick:()=>P(e=>!e),children:(0,l.jsx)(x.Z,{className:"w-5 h-5 text-gray-700"})})}),(0,l.jsx)("button",{className:"p-2 bg-gray-300 hover:bg-gray-400 py-2 px-3 rounded ml-4",onClick:()=>{M(!0)},children:(0,l.jsx)(g,{className:"w-5 h-5 text-gray-700"})})]})]}),C&&(0,l.jsx)("div",{className:"flex items-center gap-2 p-4",children:(0,l.jsx)("input",{type:"text",placeholder:"Search by name",className:"border-2 border-gray-300 rounded px-4 py-2 w-full max-w-xs text-sm focus:outline-none focus:ring-2 focus:ring-blue-400",onChange:e=>R(e.target.value)})}),(0,l.jsxs)("div",{className:"pt-2 p-4",children:[(0,l.jsx)(s.ZP,{columns:V,data:m,progressPending:D,pagination:!0,paginationServer:!0,paginationPerPage:N,paginationRowsPerPageOptions:[5,10,20,30,50,100],paginationTotalRows:a,onChangeRowsPerPage:e=>{w(1),k(e)},onChangePage:e=>{w(e)},sortServer:!0,defaultSortFieldId:"col_".concat(S.sortKey),defaultSortAsc:1===S.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};E(a)},fixedHeader:!0,fixedHeaderScrollHeight:"64vh",customStyles:d.Z,highlightOnHover:!0}),(0,l.jsx)(f.Z,{onClose:()=>M(!1),isOpen:F,title:"Employee Details Data",fieldToHeaderMap:j,fetchData:A,processData:b})]})]})},w=a(11846),N=a(64270),k=()=>{let e=(0,N.P)("companyId");return!e||e<1?null:(0,l.jsx)(w.Z,{children:(0,l.jsx)(n.default,{children:(0,l.jsx)(_,{companyId:e})})})}},28646:function(e,t,a){"use strict";var l=a(85893),n=a(41664),i=a.n(n),s=a(11163);a(67294),t.Z=()=>{let e=(0,s.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)(i(),{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"}}}},6605:function(e,t,a){"use strict";a.d(t,{Z:function(){return x}});var l=a(85893),n=a(67294),i=a(44080),s=a(91479);let r=e=>Object.values(e),o=(e,t)=>e.map(e=>Object.keys(t).reduce((a,l)=>(a[t[l]]=e[l],a),{}));var d=a(74295),c=a.n(d),m=a(93162);let p=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"export";try{let l=new(c()).Workbook,n=l.addWorksheet("Exported Data");n.addRow(e),t.forEach(t=>{let a=e.map(e=>t[e]||"");n.addRow(a)});let i=n.getRow(1);i.eachCell(e=>{e.font={bold:!0},e.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFFFE599"}}}
1),n.columns.forEach(e=>{if(e&&e.eachCell){let t=10;e.eachCell({includeEmpty:!0},e=>{if(e.value){let a=e.value.toString().length;t=Math.max(t,a)}}),e.width=t+2}else e.width=12});let s=await l.xlsx.writeBuffer(),r=new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});(0,m.saveAs)(r,"".concat(a,".xlsx"))}catch(e){console.error("Error exporting to Excel:",e)}};var y=a(57460),h=a.n(y);let u=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"export",l=t.map(t=>e.reduce((e,a)=>(e[a]=t[a]||"",e),{})),n=h().unparse({fields:e,data:l}),i=new Blob([n],{type:"text/csv;charset=utf-8;"});(0,m.saveAs)(i,"".concat(a||"export",".csv"))};var x=e=>{let{onClose:t,isOpen:a,title:d,fieldToHeaderMap:c,fetchData:m,processData:y}=e,[h,x]=(0,n.useState)("excel"),[v,g]=(0,n.useState)(!1),f=async()=>{g(!0);try{let e=await m(),t=await y(e),a=r(c),l=o(t,c);"excel"===h?p(a,l,d):u(a,l,d)}catch(e){console.error("Error exporting data:",e)}finally{g(!1)}};return(0,l.jsx)(i.u,{appear:!0,show:a,as:n.Fragment,children:(0,l.jsxs)(s.V,{as:"div",className:"relative z-10",onClose:t,children:[(0,l.jsx)(i.u.Child,{as:n.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-25"})}),(0,l.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,l.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,l.jsx)(i.u.Child,{as:n.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,l.jsxs)(s.V.Panel,{className:"w-full max-w-md p-6 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-2xl",children:[(0,l.jsx)(s.V.Title,{as:"h3",className:"text-lg font-medium leading-6 text-gray-900",children:(0,l.jsxs)("div",{children:[d,(0,l.jsx)("button",{className:"shadow bg-slate-400 hover:bg-slate-500 text-white text-sm py-1 px-2 rounded ml-2",onClick:t,children:"Close"})]})}),(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)("div",{className:"py-3",children:(0,l.jsxs)("div",{className:"flex flex-row text-center rounded bg-gray-200",children:[(0,l.jsx)("div",{className:"px-2 py-1 flex-grow ".concat("excel"===h?"bg-blue-500 text-white":""),onClick:()=>x("excel"),children:"Excel"}),(0,l.jsx)("div",{className:"px-2 py-1 flex-grow ".concat("csv"===h?"bg-blue-500 text-white":""),onClick:()=>x("csv"),children:"CSV"})]})}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)("button",{className:"shadow bg-green-500 hover:bg-green-600 text-white text-sm py-2 px-4 rounded",onClick:f,disabled:v,children:v?"Exporting...":"Export ".concat(h.toUpperCase())})})]})]})})})})]})})}},11846:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var l=a(85893),n=a(48583),i=a(94543),s=a(28646);function r(e){let{children:t}=e,a=(0,n.Dv)(i.ZP);return a.isLoggedIn?t:(0,l.jsx)(s.Z,{})}},64270:function(e,t,a){"use strict";a.d(t,{N:function(){return s},P:function(){return i}});var l=a(11163),n=a(67294);function i(e){let t=(0,l.useRouter)(),[a,i]=(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&&i(e)}}},[t.isReady,t.query,e]),a}function s(e){let t=(0,l.useRouter)(),[a,i]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(t.isReady){let a=t.query[e];"string"==typeof a&&""!==a.trim()&&i(a)}},[t.isReady,t.query,e]),a}}},function(e){e.O(0,[8869,1303,44,5655,7419,9774,2888,179],function(){return e(e.s=76426)}),_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.