PageSourceSearch

https://bizvanguard.ai/assets/OvertimeCalculator-CTTzcBd6.js

js bizvanguard.ai collected 2026-10-05 13:47:16 UTC 15,334 bytes, 1 lines download raw bytes

1import{r as b,j as e}from"./vendor-react-zwv87yMD.js";import"./vendor-charts-CtrTLS4K.js";import"./vendor-i18n-BdYkS11p.js";import"./vendor-ui-CfDMlrKu.js";import"./vendor-pdf-DQuePnfN.js";import"./vendor-state-ByI9XJey.js";import"./vendor-editor-C_dhmuey.js";const T=80;function B(o,l,c){const i=Math.max(0,l-12),x=l-i,y=Math.min(8,o),g=Math.min(4,Math.max(0,o-8)),m=Math.max(0,o-12),p=Math.min(8,o),N=Math.max(0,o-8),u=x*y,f=x*g+i*p,h=x*m+i*N,k=Math.min(T,u),H=Math.max(0,u-T),M=f+H,$=h;return{wage:k*c+M*c*1.5+$*c*2,reg:k,ot15:M,ot2:$}}function P(o,l,c){if(o<=0||l<=0||c<=0)return null;let i=0,x=24;for(let f=0;f<100;f++){const h=(i+x)/2,{wage:k}=B(h,l,c);if(k<o?i=h:x=h,Math.abs(x-i)<1e-4)break}const y=(i+x)/2,{reg:g,ot15:m,ot2:p}=B(y,l,c),N=g+m+p,u=g*c+m*c*1.5+p*c*2;return{hoursPerDay:Math.round(y*100)/100,regularHours:Math.round(g*100)/100,otHours15x:Math.round(m*100)/100,otHours2x:Math.round(p*100)/100,totalHours:Math.round(N*100)/100,calculatedWage:Math.round(u*100)/100}}function E(o){return o>10?60:o>5?30:0}function D(o){const l=Math.floor(o/60),c=Math.round(o%60),i=l>=12?"PM":"AM";return`${l>12?l-12:l===0?12:l}:${c.toString().padStart(2,"0")} ${i}`}function F(o){const l=Math.floor(o/60),c=Math.round(o%60);return`${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`}function W(o){const[l,c]=o.split(":").map(Number);return l*60+(c||0)}function U(o){const l={};let c=0;for(let i=1;i<o;i++){const x=(Math.random()*20-10)/60;l[i]=x,c+=x}return l[o]=-c,l}function X(o,l,c,i){const x=o.hoursPerDay,y=[];let g=0;for(let m=1;m<=l;m++){const p=m>12,N=m<=7?1:2,u=x+(i[m]||0);let f,h;const k=p?Math.max(0,u-8):Math.max(0,u-12);if(p)f=0,h=Math.min(8,u);else{const C=Math.min(8,u);h=Math.min(4,Math.max(0,u-8)),g+C>T?(f=Math.max(0,T-g),h+=C-f):f=C}g+=f;const H=E(u),M=480,$=u*60,S=M+$+H;y.push({day:m,week:N,isSeventhDay:p,clockIn:D(M),clockOut:D(Math.round(S)),breakMinutes:H,workHours:Math.round(u*100)/100,regHours:Math.round(f*100)/100,ot15Hours:Math.round(h*100)/100,ot2Hours:Math.round(k*100)/100})}return y}const _=[{id:1,name:"Dong, Junsu",totalWage:"2677.5",daysWorked:"12",hourlyRate:"19"},{id:2,name:"Du",totalWage:"3122.5",daysWorked:"12",hourlyRate:"22"},{id:3,name:"Ren",totalWage:"3360",daysWorked:"12",hourlyRate:"22"},{id:4,name:"Wang",totalWage:"2857.5",daysWorked:"12",hourlyRate:"21"}];function Y(){const[o,l]=b.useState(_),[c,i]=b.useState({}),[x,y]=b.useState(new Set),[g,m]=b.useState("12:00"),[p,N]=b.useState("08:45"),[u,f]=b.useState(0),h=(s,r,d)=>{l(n=>n.map(w=>w.id===s?{...w,[r]:d}:w))},k=()=>{const s={};for(const r of o)s[r.id]=P(parseFloat(r.totalWage)||0,parseFloat(r.daysWorked)||0,parseFloat(r.hourlyRate)||0);i(s),f(r=>r+1)},H=()=>{const s=Math.max(...o.map(r=>r.id))+1;l(r=>[...r,{id:s,name:`Employee ${s}`,totalWage:"",daysWorked:"",hourlyRate:""}])},M=s=>{o.length<=1||l(r=>r.filter(d=>d.id!==s))},$=s=>{y(r=>{const d=new Set(r);return d.has(s)?d.delete(s):d.add(s),d})},S=p?W(p):525,C=g?W(g):720,R="w-full px-2 py-1.5 border border-gray-300 rounded text-sm text-right focus:outline-none focus:ring-1 focus:ring-blue-400 bg-green-50",v="text-sm text-right font-mono tabular-nums";return e.jsx("div",{className:"min-h-screen bg-gray-50 p-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"CA Overtime Calculator"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Test tool — Bi-weekly pay period, California daily overtime rules. Assumes equal hours per day."}),e.jsxs("div",{className:"mt-3 p-3 bg-blue-50 border border-blue-200 rounded text-xs text-blue-800 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"CA Daily OT Rules (bi-weekly):"}),e.jsx("p",{children:"- Daily: first 8 hrs = 1x, hours 8-12 = 1.5x, hours 12+ = 2x"}),e.jsx("p",{children:"- 7th consecutive day (13+ days worked): first 8 hrs = 1.5x, 8+ hrs = 2x"}),e.jsx("p",{children:"- Max 80 regular hours per bi-weekly pay period (2 x 40 hrs/week)"}),e.jsx("p",{children:"- Excess regular hours above 80 are paid at 1.5x"})]})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 w-40",children:"Default Start Time:"}),e.jsx("input",{type:"time",value:p,onChange:s=>N(s.target.value),className:"w-28 px-2 py-1.5 border border-gray-300 rounded text-sm text-center focus:outline-none focus:ring-1 focus:ring-blue-400"}),e.jsx("span",{className:"text-xs text-gray-400",children:"randomized +/-5 min per day"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 w-40",children:"Default Break Start:"}),e.jsx("input",{type:"time",value:g,onChange:s=>m(s.target.value),className:"w-28 px-2 py-1.5 border border-gray-300 rounded text-sm text-center focus:outline-none focus:ring-1 focus:ring-blue-400"}),e.jsx("span",{className:"text-xs text-gray-400",children:"randomized +/-10 min; duration per CA rules (>5hrs = 30min, >10hrs = 60min)"})]})]}),e.jsx("div",{className:"bg-white rounded-lg shadow overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-100 border-b",children:[e.jsx("th",{className:"px-3 py-2 text-left text-xs font-semibold text-gray-600 w-44",children:"Name"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-36",children:"Total Wage Amou
1nt"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-36",children:"Number of Days Worked"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"Hourly Rate"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"Hrs/Day"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"Regular Hours"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"1.5X Pay Hours"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"2X Pay Hours"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-28",children:"Total Hours"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-semibold text-gray-600 w-32",children:"Calculated Wage"}),e.jsx("th",{className:"px-3 py-2 w-10"})]})}),e.jsx("tbody",{children:o.map(s=>{const r=c[s.id]??null,d=r?Math.abs(r.calculatedWage-(parseFloat(s.totalWage)||0)):0,n=x.has(s.id),w=parseFloat(s.daysWorked)||0;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center gap-1",children:[r&&e.jsx("button",{onClick:()=>$(s.id),className:"text-gray-400 hover:text-gray-700 text-xs w-4 flex-shrink-0",title:n?"Collapse":"Expand time entries",children:n?"▼":"▶"}),e.jsx("input",{type:"text",value:s.name,onChange:t=>h(s.id,"name",t.target.value),className:"w-full px-2 py-1.5 border border-gray-300 rounded text-sm focus:outline-none focus:ring-1 focus:ring-blue-400"})]})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("input",{type:"text",value:s.totalWage,onChange:t=>h(s.id,"totalWage",t.target.value),placeholder:"0.00",className:R})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("input",{type:"text",value:s.daysWorked,onChange:t=>h(s.id,"daysWorked",t.target.value),placeholder:"0",className:R})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("input",{type:"text",value:s.hourlyRate,onChange:t=>h(s.id,"hourlyRate",t.target.value),placeholder:"0.00",className:R})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`${v} text-gray-500`,children:r?r.hoursPerDay:"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:v,children:r?r.regularHours.toFixed(2):"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`${v} ${r&&r.otHours15x>0?"text-orange-600 font-semibold":""}`,children:r?r.otHours15x.toFixed(2):"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`${v} ${r&&r.otHours2x>0?"text-red-600 font-semibold":""}`,children:r?r.otHours2x.toFixed(2):"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`${v} font-semibold`,children:r?r.totalHours.toFixed(2):"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("span",{className:`${v} ${d>.01?"text-red-600":"text-green-600"}`,title:d>.01?`Diff: $${d.toFixed(2)}`:"Matches",children:r?`$${r.calculatedWage.toFixed(2)}`:"-"})}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("button",{onClick:()=>M(s.id),className:"text-gray-400 hover:text-red-500 text-sm",title:"Remove row",children:"x"})})]},s.id),n&&r&&e.jsx("tr",{children:e.jsx("td",{colSpan:11,className:"p-0 bg-slate-50 border-b",children:e.jsx(q,{result:r,daysWorked:w,defaultStartMin:S,defaultBreakStartMin:C,hourlyRate:parseFloat(s.hourlyRate)||0},u)})},`${s.id}-detail`)]})})})]})}),e.jsxs("div",{className:"mt-4 flex gap-3",children:[e.jsx("button",{onClick:k,className:"px-6 py-2 text-sm font-semibold bg-blue-600 text-white rounded hover:bg-blue-700",children:"Calculate"}),e.jsx("button",{onClick:H,className:"px-4 py-2 text-sm border border-gray-300 rounded hover:bg-gray-100",children:"+ Add Employee"})]}),e.jsxs("div",{className:"mt-6 p-3 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-800",children:[e.jsx("p",{className:"font-semibold",children:"Assumptions:"}),e.jsx("p",{children:"- Equal hours worked each day (total hours / days worked)"}),e.jsx("p",{children:"- Bi-weekly pay period: max 80 regular hours, excess at 1.5x"}),e.jsx("p",{children:"- 2x overtime only when daily hours exceed 12, or on 7th day when hours exceed 8"}),e.jsx("p",{children:"- 7th day rule applies when days worked exceed 12 (13 days = 1 seventh day, 14 = 2)"}),e.jsx("p",{children:"- Clock in starts at 8:00 AM for all days"}),e.jsx("p",{children:'- "Calculated Wage" verifies: (Reg hrs x rate) + (1.5x hrs x rate x 1.5) + (2x hrs x rate x 2)'})]})]})})}function q({result:o,daysWorked:l,defaultStartMin:c,defaultBreakStartMin:i,hourlyRate:x}){const y=Math.round(l),[g]=b.useState(()=>U(y)),[m]=b.useState(()=>{const t={};for(let a=1;a<=y;a++)t[a]=Math.round(Math.random()*10-5);return t}),[p]=b.useState(()=>{const t={};for(let a=1;a<=y;a++)t[a]=Math.round(Math.random()*20-10);return t}),[N]=b.useState(()=>{const t={};for(let a=1;a<=y;a++)t[a]=Math.round(Math.random()*10);return t}),u=X(o,l,null,g),[f,h]=b.useState(()=>{const t={};for(const a of u)t[a.day]=c+(m[a.day]||0);return t}),[k,H]=b.useState(()=>{const t={};for(const a of u)t[a.day]=i+(p[a.day]||0);return t}),[M,$]=b.useState(()=>{const t={};for(const a of u){const j=i+(p[a.day]||0),O=E(a.workHours);t[a.day]=j+O+(N[a.day]||0)}return t}),S=u.map(t=>{const a=f[t.day]??c,j=k[t.day]??i,O=M[t.day]??j+E(t.workHours)+(N[t.day]||0),A=Math.max(0,O-j),I=a+t.workHours*60+A;return{...t,clockInMin:a,brkStartMin:j,brkEndMin:O,breakMinutes:A,clockIn:D(a),clockOut:D(Math.round(I))}}),C=(t,a)=>{h(j=>({...j,[t]:W(a)}))},R=(t,a)=>{H(j=>({...j,[t]:W(a)}))},v=(t,a)=>{$(j=>({...j,[t]:W(a)}))},s=S.reduce((t,a)=>({workHours:t.workHours+a.workHours,regHours:t.regHours+a.regHours,ot15Hours:t.ot15Hours+a.ot15Hours,ot2Hours:t.ot2Hours+a.ot2Hours,breakMinutes:t.breakMinutes+a.breakMinutes}),{workHours:0,regHours:0,ot15Hours:0,ot2Hours:0,breakMinutes:0}),r=s.regHours*x+s.ot15Hours*x*1.5+s.ot2Hours*x*2,d="px-3 py-1.5 text-xs font-semibold text-gray-600",n="px-3 py-1.5 text-xs font-mono tabular-nums",w="px-1 py-0.5 border border-gray-300 rounded text-xs text-center focus:outline-none focus:ring-1 focus:ring-blue-400 bg-green-50";return e.jsx("div",{className:"px-8 py-3",children:e.jsxs("table",{className:"w-full border-collapse border border-gray-200 rounded",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-200",children:[e.jsx("th",{className:`${d} text-left w-16`,children:"Day"}),e.jsx("th",{className:`${d} text-center w-12`,children:"Wk"}),e.jsx("th",{className:`${d} text-center w-28`,children:"Clock In"}),e.jsx("th",{className:`${d} text-center w-24`,children:"Clock Out"}),e.jsx("th",{className:`${d} text-center w-28`,children:"Break Start"}),e.jsx("th",{className:`${d} text-center w-28`,children:"Break End"}),e.jsx("th",{className:`${d} text-center w-16`,children:"Break"}),e.jsx("th",{className:`${d} text-right w-20`,children:"Work Hrs"}),e.jsx("th",{className:`${d} text-right w-20`,children:"Regular"}),e.jsx("th",{className:`${d} text-right w-20`,children:"1.5x"}),e.jsx("th",{className:`${d} text-right w-20`,children:"2x"})]})}),e.jsxs("tbody",{children:[S.map(t=>e.jsxs("tr",{className:`border-t border-gray-200 ${t.isSeventhDay?"bg-amber-50":"bg-white"}`,children:[e.jsxs("td",{className:`${n} text-left`,children:["Day ",t.day,t.isSeventhDay&&e.jsx("span",{className:"ml-1 text-[10px] font-semibold text-amber-600 bg-amber-100 px-1 rounded",children:"7th"})]}),e.jsx("td",{className:`${n} text-center text-gray-400`,children:t.week}),e.jsx("td",{className:`${n} text-center`,children:e.jsx("input",{type:"time",value:F(t.clockInMin),onChange:a=>C(t.day,a.target.value),className:`${w} w-24`})}),e.jsx("td",{className:`${n} text-center`,children:t.clockOut}),e.jsx("td",{className:`${n} text-center`,children:e.jsx("input",{type:"time",value:F(t.brkStartMin),onChange:a=>R(t.day,a.target.value),className:`${w} w-24`})}),e.jsx("td",{className:`${n} text-center`,children:e.jsx("input",{type:"time",value:F(t.brkEndMin),onChange:a=>v(t.day,a.target.value),className:`${w} w-24`})}),e.jsxs("td",{className:`${n} text-center text-gray-500`,children:[t.breakMinutes," min"]}),e.jsx("td",{className:`${n} text-right`,children:t.workHours.toFixed(2)}),e.jsx("td",{className:`${n} text-right`,children:t.regHours>0?t.regHours.toFixed(2):"-"}),e.jsx("td",{className:`${n} text-right ${t.ot15Hours>0?"text-orange-600 font-semibold":""}`,children:t.ot15Hours>0?t.ot15Hours.toFixed(2):"-"}),e.jsx("td",{className:`${n} text-right ${t.ot2Hours>0?"text-red-600 font-semibold":""}`,children:t.ot2Hours>0?t.ot2Hours.toFixed(2):"-"})]},t.day)),e.jsxs("tr",{className:"border-t-2 border-gray-400 bg-gray-100 font-semibold",children:[e.jsx("td",{className:`${n} text-left`,children:"Total"}),e.jsx("td",{className:n}),e.jsx("td",{className:n}),e.jsx("td",{className:n}),e.jsx("td",{className:n}),e.jsx("td",{className:n}),e.jsx("td",{className:`${n} text-center text-gray-500`,children:Math.floor(s.breakMinutes/60)>0?`${Math.floor(s.breakMinutes/60)}h ${s.breakMinutes%60}m`:`${s.breakMinutes} min`}),e.jsx("td",{className:`${n} text-right`,children:s.workHours.toFixed(2)}),e.jsx("td",{className:`${n} text-right`,children:s.regHours.toFixed(2)}),e.jsx("td",{className:`${n} text-right text-orange-600`,children:s.ot15Hours.toFixed(2)}),e.jsx("td",{className:`${n} text-right text-red-600`,children:s.ot2Hours.toFixed(2)})]}),e.jsxs("tr",{className:"bg-gray-100",children:[e.jsx("td",{colSpan:7,className:`${n} text-right font-semibold`,children:"Calculated Wage:"}),e.jsxs("td",{colSpan:4,className:`${n} text-left font-semibold text-green-700 pl-4`,children:["$",r.toFixed(2)]})]})]})]})})}export{Y as default};

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.