1import{f as m}from"./requestDisplay-DR9biDUM.js";const f=[{key:"all",label:"All"},{key:"pending",label:"Pending",dot:"bg-amber-500"},{key:"approved",label:"Approved",dot:"bg-emerald-500"},{key:"rejected",label:"Rejected",dot:"bg-rose-500"},{key:"cancelled",label:"Cancelled",dot:"bg-slate-400"}],d=e=>String(e).padStart(2,"0"),k=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`;function y(e=new Date){return{from:k(new Date(e.getFullYear(),e.getMonth(),1)),to:k(new Date(e.getFullYear(),e.getMonth()+1,0))}}function $(e){return e.replace(" & "," / ")}function p(e){return e?e.start&&e.end?`${e.name} (${m(e.start)} To ${m(e.end)})`:e.name:"No shift assigned"}function I(e){return e.status==="pending"?e.unassigned?"No approver â an HR admin must decide":e.currentApproverName?`Waiting on ${e.currentApproverName}${e.currentStepLabel?` (${e.currentStepLabel})`:""}`:e.currentStepLabel?`Waiting on ${e.currentStepLabel}`:"Pending":e.lastActionByName?`By ${e.lastActionByName}`:"-"}function O(e){const n=e.filter(o=>o.canDecide).map(o=>o.id);return{ids:n,skipped:e.length-n.length}}function v(e,n,o=0){const t=n.filter(a=>a.ok).length,c=n.filter(a=>!a.ok),r=e==="approve"?"Approved":"Rejected",l=a=>`${a} request${a===1?"":"s"}`,s=c.length+o;if(!t){const a=c[0]?.message??(o?"They are not waiting on you.":"Nothing was decided.");return{tone:"error",message:`No requests were ${r.toLowerCase()}. ${a}`}}if(!s)return{tone:"success",message:`${r} ${l(t)}.`};const i=c[0]?.message??"Some are not waiting on you.";return{tone:"warning",message:`${r} ${l(t)}. ${l(s)} could not be: ${i}`}}function g(e){const n=/^(\d{2})\/(\d{2})\/(\d{4})$/.exec(e.trim());if(!n)return null;const[,o,t,c]=n,r=new Date(Date.UTC(Number(c),Number(t)-1,Number(o)));return r.getUTCDate()===Number(o)&&r.getUTCMonth()===Number(t)-1?`${c}-${t}-${o}`:null}function h(e){const n=/^(\d{2})\/(\d{2})\/(\d{2,4})\s+(\d{1,2}):(\d{2})\s*(AM|PM)$/i.exec(e.trim());if(!n)return null;const[,o,t,c,r,l,s]=n,i=c.length===2?`20${c}`:c;let a=Number(r);if(a<1||a>12||Number(l)>59)return null;s.toUpperCase()==="AM"?a=a===12?0:a:a=a===12?12:a+12;const u=g(`${o}/${t}/${i}`);return u?{date:u,time:`${d(a)}:${l}`}:null}function N(e,n){const[o,t,c]=e.split("-"),[r,l]=n.split(":").map(Number);return`${c}/${t}/${o.slice(2)} ${d(r%12===0?12:r%12)}:${d(l)} ${r<12?"AM":"PM"}`}function D(e,n,o={clockIn:null,clockOut:null}){const t={},c=g(e.date),r=e.clockIn.trim()?h(e.clockIn):null,l=e.clockOut.trim()?h(e.clockOut):null;e.employeeId||(t.employeeId="Choose the employee."),c?c>n&&(t.date="Attendance cannot be added for a future date."):t.date="Choose the date to correct.",e.clockIn.trim()&&!r&&(t.clockIn="Enter a date and time, such as 15/07/26 09:00 AM."),e.clockOut.trim()&&!l&&(t.clockOut="Enter a date and time, such as 15/07/26 06:00 PM."),!e.clockIn.trim()&&!e.clockOut.trim()&&(t.clockIn="Give a clock-in time, a clock-out time, or both."),c&&r&&r.date!==c&&(t.clockIn="The clock-in must be on the date being corrected."),c&&l&&l.date!==c&&(t.clockOut="The clock-out must be on the date being corrected."),r&&l&&!t.clockIn&&!t.clockOut&&l.time<=r.time&&(t.clockOut="The clock-out must be later than the clock-in.");const s=e.reason.trim();s?s.length>500&&(t.reason="Use 500 characters or fewer."):t.reason="Give the reason for this correction.";const i=r&&r.time!==o.clockIn?r.time:void 0,a=l&&l.time!==o.clockOut?l.time:void 0;return!Object.keys(t).length&&!i&&!a&&(t.clockIn="Both times are as recorded. Change the clock-in or clock-out first."),Object.keys(t).length||!c?{errors:t,body:null}:{errors:t,body:{type:"attendance_correction",employeeId:e.employeeId,approveNow:e.approveNow,workDate:c,clockIn:i,clockOut:a,reason:s}}}function A(e){const n={};if(!e.isSelf&&!e.isAdmin)return n.form="Only an HR admin can regularize another employee's attendance.",{errors:n,body:null};const o=e.clockIn.trim(),t=e.clockOut.trim();!o&&!t&&(n.clockIn="Give a clock-in time, a clock-out time, or both."),o&&t&&t<=o&&(n.clockOut="The clock-out time must be later than the clock-in time."),e.reason.trim()||(n.reason="Choose a reason for the correction."),e.reason==="Other"&&!e.remarks.trim()&&(n.remarks="Say what the reason is.");const c=o&&o!==e.recordedClockIn?o:void 0,r=t&&t!==e.recordedClockOut?t:void 0;if(!Object.keys(n).length&&!c&&!r&&(n.clockIn="Both times are as re
1corded. Change the clock-in or clock-out first."),Object.keys(n).length)return{errors:n,body:null};const l=e.reason==="Other"?e.remarks.trim():e.reason.trim();return{errors:n,body:{type:"attendance_correction",employeeId:e.employeeId,...e.isSelf?{}:{approveNow:e.isAdmin&&e.approveNow},workDate:e.workDate,clockIn:c,clockOut:r,reason:l,remarks:e.reason==="Other"?void 0:e.remarks.trim()||void 0}}}export{f as S,D as a,A as b,$ as c,O as d,v as e,g as i,y as m,p as s,N as t,I as w};
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.