1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1098],{90470:function(e,a,t){"use strict";t.d(a,{Z:function(){return l}});var n=t(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,a,t){"use strict";t.d(a,{Z:function(){return l}});var n=t(91373);let l=(0,n.Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},13671:function(e,a,t){"use strict";t.d(a,{Z:function(){return l}});var n=t(91373);let l=(0,n.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"}]])},37937:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/salary-management/company/[companyId]/holidays",function(){return t(18470)}])},42689:function(e,a,t){"use strict";t.r(a);var n=t(85893),l=t(67294),r=t(41664),i=t.n(r),s=t(11163),o=t(88446),c=t(86501);a.default=e=>{let{children:a}=e,t=(0,s.useRouter)(),{companyId:r}=t.query,[d,y]=(0,l.useState)(null),[h,u]=(0,l.useState)(!0),m=[{name:"Employees",path:"/salary-management/company/".concat(r,"/employees")},{name:"Departments",path:"/salary-management/company/".concat(r,"/department")},{name:"Attendance",path:"/salary-management/company/".concat(r,"/attendance")},{name:"Designations",path:"/salary-management/company/".concat(r,"/designation")},{name:"Salary List",path:"/salary-management/company/".concat(r,"/salary-list")},{name:"Holidays",path:"/salary-management/company/".concat(r,"/holidays")},{name:"Religion",path:"/salary-management/company/".concat(r,"/religion")}].sort((e,a)=>e.name.localeCompare(a.name));return(0,l.useEffect)(()=>{if(!r)return;let e=async()=>{var e,a,t;try{let a=await o.Z.post("/payroll/company/company-by-id",{company_id:r});y(null===(e=a.data)||void 0===e?void 0:e.data)}catch(e){c.ZP.error((null==e?void 0:null===(a=e.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.message)||"Error fetching company"),console.error("â Error fetching company:",e)}finally{u(!1)}};e()},[r]),(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:[h?(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:m.map(e=>(0,n.jsx)("li",{children:(0,n.jsx)(i(),{href:e.path,children:(0,n.jsx)("span",{className:"block px-3 py-2 rounded-md cursor-pointer transition-colors ".concat(t.asPath.startsWith(e.path)?"bg-gray-700 font-semibold":"hover:bg-gray-800"),children:e.name})})},e.path))}),(0,n.jsx)(i(),{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:a})})]})}},18470:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return v}});var n=t(85893),l=t(42689),r=t(67294),i=t(88446),s=t(90044),o=t(87083),c=t(41664),d=t.n(c),y=t(90470),h=t(13671),u=t(31012),m=t(17866),p=t(8823),x=e=>{let{companyId:a}=e,[t,l]=(0,r.useState)(0),[c,x]=(0,r.useState)([]),[g,f]=(0,r.useState)(1),[v,j]=(0,r.useState)(20),[b,_]=(0,r.useState)({sortKey:"holiday_id",sortType:-1}),[N,w]=(0,r.useState)(!1),Z={display:"flex",justifyContent:"center",width:"100%"},S=async(e,t)=>{let n=window.confirm("Are you sure you want to delete this holiday?");if(n)try{let n=await i.Z.patch("/payroll/holiday/delete",{holidayId:e,company_id:a});200===n.status?(alert("Holiday deleted successfully!"),t()):alert("Failed to delete holiday.")}catch(e){console.error("Error deleting holiday:",e),alert("An error occurred while deleting the holiday.")}},k=async()=>{w(!0);try{var e,t;let n=await i.Z.post("/payroll/holiday/list",{page_enabled:"y",page:g,limit:v,sortDetails:b,searchDetails:[],searchDetailsAnd:[{basicSearchKey:"",basicSearchValue:"",basicSearchType:""}],searchQuery:"",company_id:a}),r=(null===(e=n.data)||void 0===e?void 0:e.data)||[];x(r),l((null===(t=n.data)||void 0===t?void 0:t.count)||0)}catch(e){console.error("Failed to fetch employee list:",e)}finally{w(!1)}};return(0,r.useEffect)(()=>{k()},[g,v,b]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"px-4 pt-4",children:[(0,n.jsx)("h1",{className:"text-2xl mb-1",children:"Holidays Details (".concat(t,")")}),(0,n.jsx)(o.ZP,{content:(0,n.jsx)("span",{className:"text-xs",children:"Add New"}),placement:"bottom",children:(0,n.jsx)(d(),{href:"/salary-management/company/".concat(a,"/holidays/add"),children:(0,n.jsx)("button",{className:"p-2 bg-gray-300 hover:bg-gray-400 py-2 px-3 rounded ml-1",children:(0,n.jsx)(u.Z,{className:"w-4 h-4 text-gray-700"})})})})]}),(0,n.jsx)("div",{className:"pt-2 p-4",children:(0,n.jsx)(s.ZP,{columns:[{name:(0,n.jsx)("div",{style:Z,children:"Action"}),width:"160px",cell:e=>(0,n.jsxs)("div",{style:Z,children:[(0,n.jsx)(o.ZP,{content:(0,n.jsx)("span",{children:"Edit"}),placement:"bottom",children:(0,n.jsx)(d(),{href:"/salary-management/company/".concat(a,"/holidays/").concat(e.holiday_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 roun
1ded",children:(0,n.jsx)(y.Z,{className:"w-4 h-4 text-gray-700"})})})}),(0,n.jsx)(o.ZP,{content:(0,n.jsx)("span",{children:"Delete"}),placement:"bottom",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",onClick:()=>S(e.holiday_id,k),children:(0,n.jsx)(h.Z,{className:"w-4 h-4 text-gray-700"})})})]})},{name:(0,n.jsx)("div",{style:Z,children:"ID"}),id:"holiday_id",minWidth:"90px",cell:e=>(0,n.jsx)("div",{style:Z,children:(0,m.Z)(e.holiday_id)}),sortable:!0},{name:(0,n.jsx)("div",{style:Z,children:"Holiday Name"}),id:"Holiday_name",minWidth:"150px",cell:e=>(0,n.jsx)("div",{children:(0,m.Z)(e.Holiday_name)}),sortable:!0},{name:(0,n.jsx)("div",{style:Z,children:"Religion"}),id:"religion",minWidth:"150px",cell:e=>{var a;return(0,n.jsx)("div",{children:(0,m.Z)(null===(a=e.religionDetails[0])||void 0===a?void 0:a.name)})},sortable:!0},{name:(0,n.jsx)("div",{style:Z,children:"Holiday Date"}),id:"Holiday_date",minWidth:"200px",cell:e=>(0,n.jsx)("div",{style:Z,children:(0,m.Z)(e.Holiday_date)}),sortable:!0},{name:(0,n.jsx)("div",{style:Z,children:"Paid"}),id:"is_paid",width:"120px",cell:e=>(0,n.jsx)("div",{style:Z,children:e.is_paid?"Yes":"No"}),sortable:!0},{name:(0,n.jsx)("div",{style:Z,children:"Operator Id"}),id:"operator_id",width:"120px",cell:e=>(0,n.jsx)("div",{style:Z,children:(0,m.Z)(e.operator_id)}),sortable:!0}],data:c,progressPending:N,pagination:!0,paginationServer:!0,paginationPerPage:v,paginationRowsPerPageOptions:[5,10,20,30,50,100],paginationTotalRows:t,onChangeRowsPerPage:e=>{f(1),j(e)},onChangePage:e=>{f(e)},sortServer:!0,defaultSortFieldId:"col_".concat(b.sortKey),defaultSortAsc:1===b.sortType,onSort:(e,a)=>{let t={sortKey:"string"==typeof(null==e?void 0:e.id)?e.id.replace("col_",""):"id",sortType:"desc"===a?-1:1};_(t)},fixedHeader:!0,fixedHeaderScrollHeight:"64vh",customStyles:p.Z,highlightOnHover:!0})})]})},g=t(11846),f=t(64270),v=()=>{let e=(0,f.P)("companyId");return!e||e<1?null:(0,n.jsx)(g.Z,{children:(0,n.jsx)(l.default,{children:(0,n.jsx)(x,{companyId:e})})})}},28646:function(e,a,t){"use strict";var n=t(85893),l=t(41664),r=t.n(l),i=t(11163);t(67294),a.Z=()=>{let e=(0,i.useRouter)(),a=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)(r(),{className:"text-blue-500",href:"/login?re_url=".concat(a),children:"Click here to Login"})]})}},8823:function(e,a){"use strict";a.Z={headCells:{style:{border:"1px solid #f1f1f1",fontSize:"14px",backgroundColor:"#e1e1e1"}},cells:{style:{border:"1px solid #f1f1f1",paddingLeft:"7px",paddingRight:"7px"}}}},11846:function(e,a,t){"use strict";t.d(a,{Z:function(){return s}});var n=t(85893),l=t(48583),r=t(94543),i=t(28646);function s(e){let{children:a}=e,t=(0,l.Dv)(r.ZP);return t.isLoggedIn?a:(0,n.jsx)(i.Z,{})}},17866:function(e,a){"use strict";a.Z=e=>{try{if("string"==typeof e||"number"==typeof e)return"".concat(e);return"-"}catch(e){return console.error(e),"-----"}}},64270:function(e,a,t){"use strict";t.d(a,{N:function(){return i},P:function(){return r}});var n=t(11163),l=t(67294);function r(e){let a=(0,n.useRouter)(),[t,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(a.isReady){let t=a.query[e];if("string"==typeof t){let e=Number(t);e>=1&&r(e)}}},[a.isReady,a.query,e]),t}function i(e){let a=(0,n.useRouter)(),[t,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(a.isReady){let t=a.query[e];"string"==typeof t&&""!==t.trim()&&r(t)}},[a.isReady,a.query,e]),t}}},function(e){e.O(0,[44,5655,9774,2888,179],function(){return e(e.s=37937)}),_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.