PageSourceSearch

https://alwscms-8f210.web.app/static/js/5743.671ff070.chunk.js

js alwscms-8f210.web.app collected 2026-10-03 13:20:12 UTC 15,492 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdatta_able_free_react_admin_template=self.webpackChunkdatta_able_free_react_admin_template||[]).push([[5743],{32465:(e,t,s)=>{s.d(t,{A:()=>o});var a=s(89379),n=(s(9950),s(28429)),l=s(81543),d=s(80499),r=s(44414);const o=e=>t=>{const s=(0,l.As)(),o=s.currentUser;return s.loading?(0,r.jsx)(d.A,{}):o?(0,r.jsx)(e,(0,a.A)({},t)):(0,r.jsx)(n.C5,{to:"/auth/signin-1",replace:!0})}},55743:(e,t,s)=>{s.r(t),s.d(t,{default:()=>p});var a=s(89379),n=s(5544),l=s(81543),d=s(9950),r=s(95252),o=s(19360),c=s(4342),i=s(5216),x=s(62578),m=s(43203),u=s(59051),h=s.n(u),y=s(32465),b=s(44414);const p=(0,y.A)((()=>{const e=(0,l.As)().userId,t=(0,d.useState)(null),s=(0,n.A)(t,2),u=s[0],y=s[1],p=(0,d.useState)(null),f=(0,n.A)(p,2),g=f[0],j=f[1],N=(0,d.useState)(!0),v=(0,n.A)(N,2),D=v[0],w=v[1],A=(0,d.useState)(null),F=(0,n.A)(A,2),S=F[0],L=F[1],k=(0,d.useState)(h()().format("YYYY-MM")),H=(0,n.A)(k,2),M=H[0],Y=H[1],W=(0,d.useState)(null),_=(0,n.A)(W,2),B=_[0],E=_[1],C=(0,d.useState)([]),I=(0,n.A)(C,2),O=I[0],P=I[1];(0,d.useEffect)((()=>{(async()=>{try{w(!0),L(null);const t=M.split("-"),s=(0,n.A)(t,2),l=s[0],d=s[1],r=e.replace(/[.#$[\]/]/g,"_"),o=(0,x.KR)(m.db,"users/".concat(r)),c=await(0,x.Jt)(o);if(!c.exists())throw new Error("User not found in database.");const i=c.val(),u=(0,x.KR)(m.db,"attendanceSettings/monthly/".concat(l,"/").concat(d)),b=await(0,x.Jt)(u);let p=null;b.exists()&&(p=b.val(),E(p));const f=(0,x.KR)(m.db,"salaryAdjustments/".concat(l,"/").concat(d,"/").concat(i.employeeId)),g=await(0,x.Jt)(f);let N=[];if(g.exists()){const e=g.val();N=Object.entries(e).map((e=>{let t=(0,n.A)(e,2),s=t[0],l=t[1];return(0,a.A)({id:s},l)}))}P(N);const v=h()(M,"YYYY-MM").daysInMonth(),D=[];for(let e=1;e<=v;e++){const t=String(e).padStart(2,"0"),s=(0,x.KR)(m.db,"attendance/".concat(l,"/").concat(d,"/").concat(t,"/").concat(i.employeeId));D.push((0,x.Jt)(s).then((e=>e.exists()?(0,a.A)({date:h()("".concat(l,"-").concat(d,"-").concat(t)).format("YYYY-MM-DD")},e.val()):null)))}const A=(await Promise.all(D)).filter(Boolean);A.sort(((e,t)=>h()(t.date).diff(h()(e.date))));const F=J(A,i,p,N);y(i),j(F),w(!1)}catch(S){console.error("Error fetching user data:",S),L(S.message||"An unexpected error occurred"),w(!1)}})()}),[e,M]);const J=function(e,t,s){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!t)return null;const n=h()(M).daysInMonth(),l=parseFloat(t.currentSalary||0),d=l/30,r=null!==s&&void 0!==s&&s.noOfAllowedWFH?parseInt(s.noOfAllowedWFH):2,o=null!==s&&void 0!==s&&s.bonusAmount?parseFloat(s.bonusAmount):0,c={present:0,fullDay:0,halfDay:0,workFromHome:0,workFromHomeApproved:0,halfDayWfh:0,leave:0,absent:0,holiday:0,lateLogins:0,totalWorkDays:n};e.forEach((e=>{var t,s;const a=null===(t=e.status)||void 0===t?void 0:t.toLowerCase(),n=null===(s=e.attendanceType)||void 0===s?void 0:s.toLowerCase();switch(a){case"present":switch(c.present++,n){case"full_day":c.fullDay++;break;case"half_day":c.halfDay++;break;case"work_from_home":c.workFromHome++,!0===e.wfhFullPay&&c.workFromHomeApproved++;break;case"half_day_wfh":c.halfDayWfh++}!0===e.isLateLogin&&c.lateLogins++;break;case"leave":c.leave++;break;case"absent":c.absent++;break;case"holiday":c.holiday++}}));const i={halfDayDeduction:0,halfDayWfhDeduction:0,workFromHomeDeduction:0,leaveDeduction:0,absentDeduction:0,lateLoginDeduction:0,extraLateLoginDeduction:0,totalDeductions:0};i.halfDayDeduction=c.halfDay*(d/2),i.leaveDeduction=c.leave*d;const x=c.workFromHome,m=c.workFromHomeApproved,u=Math.max(0,x-m),y=Math.max(0,u-r);if(i.workFromHomeDeduction=y*(d/2),i.halfDayWfhDeduction=c.halfDayWfh*(d/2),i.absentDeduction=c.absent*(2*d),c.lateLogins>0){const e=Math.floor(c.lateLogins/3),t=c.lateLogins%3;i.lateLoginDeduction=e*(.5*d),i.extraLateLoginDeduction=t*(.15*d)}i.totalDeductions=i.halfDayDeduction+i.halfDayWfhDeduction+i.workFromHomeDeduction+i.leaveDeduction+i.absentDeduction+i.lateLoginDeduction+i.extraLateLoginDeduction;let b=0,p=0;a.forEach((e=>{const t=parseFloat(e.amount||0);"addition"===e.type?b+=t:"deduction"===e.type&&(p+=t)}));let f=!1,g=0;0===c.absent&&0===c.leave&&0===c.workFromHome&&0===c.halfDayWfh&&0===c.halfDay&&0===c.lateLogins&&o>0&&(g=o,f=!0);let j=l-i.totalDeductions+g+b-p;return j=Math.max(j,0),{baseSalary:l,bonusAmount:o,attendanceStats:c,deductions:i,manualAdditions:b,manualDeductions:p,netSalary:j,eligibleForBonus:f,dailySalary:d}};return D?(0,b.jsx)("div",{className:"flex justify-center items-center min-h-screen",children:(0,b.jsx)(r.A,{animation:"border",variant:"success"})}):S?(0,b.jsx)("div",{className:"p-4",children:(0,b.jsx)(o.A,{variant:"danger",children:S})}):(0,b.jsxs)("div",{className:"min-h-screen bg-gray-50 pb-6",children:[(0,b.jsxs)("div",{className:"bg-gradient-to-r from-green-600 to-green-500 text-white p-6 rounded-2xl shadow-lg",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h4",{className:"text-xl text-white font-bold mb-1",children:"Salary Overview"}),(0,b.jsx)("p",{className:"text-green-100 text-sm",children:null===u||void 0===u?void 0:u.name})]}),(0,b.jsx)("input",{type:"month",value:M,onChange:e=>Y(e.target.value),className:"px-3 py-2 rounded-lg bg-white text-gray-800 text-sm font-medium shadow focus:outline-none"})]}),g&&(0,b.jsx)("div",{className:"bg-white/10 backdrop-blur-sm rounded-2xl p-4 mt-4",children:(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsx)("p",{className:"text-green-100 text-white text-sm mb-1",children:"Net Salary"}),(0,b.jsxs)("h2",{className:"text-3xl text-white font-bold",children:["\u20b9",g.netSalary.toFixed(2)]}),g.eligibleForBonus&&(0,b.jsx)(c.A,{bg:"warning",className:"mt-2",children:"\ud83c\udf89 Bonus Earned!"})]})})]}),g&&(0,b.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,b.jsx)(i.A,{className:"border-0 shadow-sm rounded-xl",children:(0,b.jsxs)(i.A.Body,{className:"p-4",children:[(0,b.jsxs)("h6",{className:"font-bold text-gray-800 mb
1-3 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-green-600",children:"\ud83d\udcb0"})," Earnings Breakdown"]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsx)("span",{className:"text-sm text-gray-600",children:"Monthly Salary"}),(0,b.jsxs)("span",{className:"font-semibold text-gray-800",children:["\u20b9",g.baseSalary.toFixed(2)]})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsx)("span",{className:"text-sm text-gray-600",children:"Per Day Salary"}),(0,b.jsxs)("span",{className:"font-semibold text-gray-800",children:["\u20b9",g.dailySalary.toFixed(2)]})]}),g.bonusAmount>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 rounded-lg px-3 ".concat(g.eligibleForBonus?"bg-green-50":"bg-yellow-50"),children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:g.eligibleForBonus?"\u2713 Perfect Attendance Bonus":"Bonus (Not Eligible)"}),(0,b.jsx)("span",{className:"font-bold ".concat(g.eligibleForBonus?"text-green-600":"text-gray-400"),children:g.eligibleForBonus?"+ \u20b9".concat(g.bonusAmount.toFixed(2)):"\u20b90.00"})]}),O.filter((e=>"addition"===e.type)).map((e=>(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 bg-blue-50 rounded-lg px-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("p",{className:"text-sm font-medium text-blue-700",children:["+ ",e.reason]}),(0,b.jsxs)("p",{className:"text-xs text-blue-500",children:["Added on ",h()(e.createdAt).format("DD MMM YYYY")]})]}),(0,b.jsxs)("span",{className:"font-bold text-blue-700",children:["+ \u20b9",parseFloat(e.amount).toFixed(2)]})]},e.id)))]})]})}),(g.deductions.totalDeductions>0||g.manualDeductions>0)&&(0,b.jsx)(i.A,{className:"border-0 shadow-sm rounded-xl",children:(0,b.jsxs)(i.A.Body,{className:"p-4",children:[(0,b.jsxs)("h6",{className:"font-bold text-gray-800 mb-3 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-red-600",children:"\ud83d\udcc9"})," Deductions"]}),(0,b.jsxs)("div",{className:"space-y-2",children:[g.deductions.halfDayDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Half Day"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[g.attendanceStats.halfDay," days"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.halfDayDeduction.toFixed(2)]})]}),g.attendanceStats.workFromHomeApproved>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 bg-blue-50 rounded-lg px-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-medium text-blue-700",children:"\u2713 WFH Approved"}),(0,b.jsxs)("p",{className:"text-xs text-blue-600",children:[g.attendanceStats.workFromHomeApproved," days full pay"]})]}),(0,b.jsx)("span",{className:"text-blue-700 font-semibold",children:"\u20b90.00"})]}),g.deductions.workFromHomeDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"WFH Deduction"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[Math.max(0,g.attendanceStats.workFromHome-g.attendanceStats.workFromHomeApproved-((null===B||void 0===B?void 0:B.noOfAllowedWFH)||2))," days at half pay"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.workFromHomeDeduction.toFixed(2)]})]}),g.deductions.halfDayWfhDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Half Day WFH"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[g.attendanceStats.halfDayWfh," days"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.halfDayWfhDeduction.toFixed(2)]})]}),g.deductions.leaveDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Leave"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[g.attendanceStats.leave," days \xd7 1 day salary"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.leaveDeduction.toFixed(2)]})]}),g.deductions.absentDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Absent Penalty"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[g.attendanceStats.absent," days \xd7 2"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.absentDeduction.toFixed(2)]})]}),g.deductions.lateLoginDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Late Login Deduction"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[Math.floor(g.attendanceStats.lateLogins/3)," \xd7 3 late logins = ",.5*Math.floor(g.attendanceStats.lateLogins/3)," days"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.lateLoginDeduction.toFixed(2)]})]}),g.deductions.extraLateLoginDeduction>0&&(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:"Extra Late Login Deduction"}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:[g.attendanceStats.lateLogins%3," extra late login(s) \xd7 0.15 day"]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",g.deductions.extraLateLoginDeduction.toFixed(2)]})]}),O.filter((e=>"deduction"===e.type)).map((e=>(0,b.jsxs)("div",{className:"flex justify-between items-center py-2 border-b border-gray-100",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm text-gray-600",children:e.reason}),(0,b.jsxs)("p",{className:"text-xs text-gray-400",children:["Added on ",h()(e.createdAt).format("DD MMM YYYY")]})]}),(0,b.jsxs)("span",{className:"text-red-600 font-semibold",children:["-\u20b9",parseFloat(e.amount).toFixed(2)]})]},e.id))),(0,b.jsxs)("div",{className:"flex justify-between items-center py-3 bg-red-50 rounded-lg px-3 mt-2",children:[(0,b.jsx)("span",{className:"font-bold text-red-700",children:"Total Deductions"}),(0,b.jsxs)("span",{className:"font-bold text-red-700",children:["\u20b9",(g.deductions.totalDeductions+g.manualDeductions).toFixed(2)]})]})]})]})}),(0,b.jsx)(i.A,{className:"border-0 shadow-sm rounded-xl",children:(0,b.jsxs)(i.A.Body,{className:"p-4",children:[(0,b.jsxs)("h6",{className:"font-bold text-gray-800 mb
1-3 flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-blue-600",children:"\ud83d\udcca"})," Attendance Summary"]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"bg-green-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-green-600",children:g.attendanceStats.fullDay}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Full Days"})]}),(0,b.jsxs)("div",{className:"bg-yellow-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-yellow-600",children:g.attendanceStats.halfDay}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Half Days"})]}),(0,b.jsxs)("div",{className:"bg-blue-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-blue-600",children:g.attendanceStats.workFromHome}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"WFH Days"})]}),(0,b.jsxs)("div",{className:"bg-purple-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-purple-600",children:g.attendanceStats.holiday}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Holidays"})]}),(0,b.jsxs)("div",{className:"bg-orange-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-orange-600",children:g.attendanceStats.leave}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Leaves"})]}),(0,b.jsxs)("div",{className:"bg-red-50 rounded-lg p-3 text-center",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-red-600",children:g.attendanceStats.absent}),(0,b.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Absents"})]})]}),g.attendanceStats.lateLogins>0&&(0,b.jsxs)("div",{className:"bg-gray-50 rounded-lg p-3 text-center mt-3",children:[(0,b.jsx)("p",{className:"text-2xl font-bold text-gray-600",children:g.attendanceStats.lateLogins}),(0,b.jsxs)("p",{className:"text-xs text-gray-600 mt-1",children:["Late Logins",g.attendanceStats.lateLogins>0&&(0,b.jsxs)("span",{className:"block text-gray-400 text-xs mt-0.5",children:["(",Math.floor(g.attendanceStats.lateLogins/3)," \xd7 3",g.attendanceStats.lateLogins%3>0&&" + ".concat(g.attendanceStats.lateLogins%3," extra"),")"]})]})]})]})})]})]})}))}}]);

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.