1import{g as ks,N as Ss,j as e,_ as vs}from"./index-CkAxGocv.js";import{u as Cs,r as i}from"./i18n-vendor-Co-krN6G.js";import{A as Rs}from"./ActiveFiltersBar-Cb8-5HAC.js";import{g as Ds,l as Ts,a as Ae}from"./employeeData-C8aL7inU.js";import{u as Is,g as Ee}from"./employeePhotos-Bk2b9ZIj.js";import{f as $t}from"./employees-CZ6YCCge.js";import{f as Pt,c as Ms,d as $s}from"./reports-i9ywm6qt.js";import{f as Ze}from"./idRecords-BTEnaOsB.js";import{e as de}from"./htmlEscape-BnJmeRse.js";import{r as Ps,i as At,w as Et,f as Ot,a as Lt,b as As,c as Bt,d as Es}from"./progressReportPlatformSelection-CXVhMbe1.js";import{c as zt,f as Ut}from"./platforms-CuFZQmDd.js";import{r as Os,g as Ls,l as Bs}from"./companyLetterhead-6tPXceCz.js";import{g as zs,b as Us,r as Ws,p as Oe,n as Le,u as _s,o as Fs}from"./progressReportRules-DZUG49io.js";import{r as Be,f as qs,d as Wt}from"./dailyReportTargets-B08I7wGx.js";import{c as Hs}from"./dutyTime-CLWnIwLd.js";import{n as Vs}from"./search-BjfNVckD.js";import{r as Ys}from"./appNavigationGuard-DFhsd4TY.js";import{e as Js,u as Ks}from"./react-vendor-D5E1hOjb.js";import{S as Gs}from"./store-D8PGBbir.js";import{P as Xs}from"./plus-kWcs1cQG.js";import{M as Qs}from"./map-pin-Bu5btHpr.js";import{U as _t}from"./users-Ca2mGkUt.js";import{P as Ft}from"./printer-CRDmGlRA.js";import{D as et}from"./download-Cj8OUOB8.js";import{E as Zs}from"./eye-CwXOHK5S.js";import{X as qt}from"./x-vmD7m2IU.js";import{C as ea}from"./check-Dmd9WXya.js";import{C as ta}from"./chevron-up-C_ovFRxy.js";import{C as sa}from"./chevron-down-dM4Lsy2M.js";import{C as aa}from"./chevron-left-CMJUBmiW.js";import{C as ra}from"./chevron-right-B7wd-Mqk.js";import{A as la}from"./arrow-up-down-CkLpXE6A.js";import{A as oa,a as na}from"./arrow-up-rtfahGq6.js";import"./supabase-vendor-Co_IX6oM.js";import"./permissionGuard-BRj1WUDY.js";import"./fileUploadPolicy-Dsb_MFV2.js";import"./browserCache-CpZow4D-.js";import"./createLucideIcon-BPd9wT8k.js";const ia="sharedIds:checked",Yt=(u,b)=>u&&b?`${ia}:${u}:${b}`:"",da=(u,b)=>{const x=Yt(u,b);if(!x||typeof window>"u")return new Set;try{const w=window.localStorage.getItem(x);if(!w)return new Set;const C=JSON.parse(w);return Array.isArray(C)?new Set(C.filter(J=>typeof J=="string")):new Set}catch{return new Set}},ca=(u,b,x)=>{const w=Yt(u,b);if(!(!w||typeof window>"u"))try{window.localStorage.setItem(w,JSON.stringify(Array.from(x)))}catch{}},ma=8e3,Ht=["January","February","March","April","May","June","July","August","September","October","November","December"],fa=async u=>Promise.race([u,new Promise((b,x)=>{window.setTimeout(()=>x(new Error("Database request timed out.")),ma)})]),ge=Hs,ua=u=>u.toLowerCase().startsWith("ar")?"ar-SA-u-ca-gregory-nu-latn":"en-GB",xa=(u,b)=>{const[x,w,C]=u.split("-").map(Number);return!x||!w||!C?u:new Date(x,w-1,C).toLocaleDateString(ua(b),{day:"2-digit",month:"short",year:"numeric"})},pa=(u,b)=>`${u}-${String(b+1).padStart(2,"0")}`,tt=(u,b)=>{const x=String(b+1).padStart(2,"0"),w=new Date(u,b+1,0).getDate();return{startDate:`${u}-${x}-01`,endDate:`${u}-${x}-${String(w).padStart(2,"0")}`}},ha=u=>u.replace(/[\\/?*:[\]]/g," ").replace(/\s+/g," ").trim().slice(0,31)||"Platform",ba=(u,b)=>{const x=ha(u);let w=x,C=2;for(;b.has(w.toLowerCase());){const J=` (${C})`;w=`${x.slice(0,31-J.length)}${J}`,C+=1}return b.add(w.toLowerCase()),w},ya={selfie:!1,iqama:!1,license:!1,passport:!1,medicalInfo:!1,driverCard:!1,ajeerContract:!1},ga=(u,b,x)=>({id:u,idNumber:"",nickName:b,arabicName:"",fullName:b,phoneNo:"",phoneNo2:"",email:"",designation:x,occupationVisa:"",branch:"",status:"Exited",vehicleNumber:"-",iqamaNumber:"",iqamaExpiry:"",dateOfBirth:"",passportNo:"",passportExpiry:"",nationality:"",entryDate:"",sponsor:"",accomodation:"",agreement:"Not Complete",commitment:"Not Complete",transferCount:"",healthInsuranceName:"",healthInsuranceExpiry:"",bankAccounts:[],documents:{...ya}}),ze=Vs,Vt=u=>{const b=u.filter(x=>x.fromRiderName.trim()&&Fs(x)).map(x=>`${x.fromRiderName} ${x.orderCount}`).join(", ");return b?`[${b}]`:""};function rr(){var Tt,It,Mt;const u=Js(),{t:b,i18n:x}=Cs(),w=Ks(),C=(w==null?void 0:w.searchTerm)??"",J=w==null?void 0:w.setSearchTerm,[Ne]=i.useState(()=>new Date),ce=x.language,Ue=ce.toLowerCase().startsWith("ar"),we=Ue?"rtl":"ltr",a=i.useCallback(t=>b(`terms.${t}`,t),[b]),st=i.useRef(null),at=i.useRef(null),Q=((Tt=ks())==null?void 0:Tt.companyId)??"",rt=Ss(Ue?"ar":"en"),O=i.useCallback(t=>Ds(t,ce),[ce]),We=t=>xa(t,ce),[B,Jt]=i.useState(Ne.getMonth()),[M,Kt]=i.useState(Ne.getFullYear()),[F,Gt]=i.useState(Ts),[lt,ot]=i.useState([]),[q,nt]=i.useState([]),[$,it]=i.useState(!1),[_e,dt]=i.useState(null),je=i.useRef(null),[te,ct]=i.useState(!1),[Xt,mt]=i.useState(!1),[ke,ft]=i.useState(!1),[Qt,me]=i.useState(null),[Fe,qe]=i.useState(!1),[Zt,T]=i.useState(""),[fe,ut]=i.useState([]),[ue,He]=i.useState([]),[y,xt]=i.useState("all"),[se,es]=i.useState("all"),[Se,pt]=i.useState(!1),[ve,ae]=i.useState(null),[re,ts]=i.useState(null),[Ve,ht]=i.useState("desc"),[ss,bt]=i.useState(()=>new Set),[as,Ce]=i.useState(!1),[Re,yt]=i.useState(()=>new Set),[De,rs]=i.useState(()=>Be().orderCount),[Te,ls]=i.useState(()=>Be().dutyTime),[Ie,os]=i.useState(()=>
1Be().declinedOrders),Me=Is(F),gt=i.useMemo(()=>fe.filter(t=>!t.isArchived),[fe]),$e=i.useCallback(t=>{xt(l=>{const r=l==="all"?"":l,h=Ps(Q),m=At(r,t)?r:At(h,t)?h:"";return Et(Q,m),m||"all"})},[Q]),ns=t=>{xt(t),Et(Q,t==="all"?"":t)},is=()=>{const t=at.current;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus()}},ds=()=>{const t=st.current;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus()}},cs=i.useMemo(()=>zs(Ne,M),[M,Ne]),le=i.useMemo(()=>pa(M,B),[B,M]),oe=`${a(Ht[B])} ${M}`;i.useEffect(()=>{let t=!0;return(async()=>{try{const r=await fa($t());if(!t)return;Gt(r)}catch(r){console.warn("Failed to load Supabase employees for monthly report:",r)}})(),()=>{t=!1}},[]),i.useEffect(()=>{const t=()=>{const l=Be();rs(l.orderCount),ls(l.dutyTime),os(l.declinedOrders)};return qs().then(t),window.addEventListener(Wt,t),()=>{window.removeEventListener(Wt,t)}},[]),i.useEffect(()=>{yt(da(Q,le))},[Q,le]);const ms=t=>{yt(l=>{const r=new Set(l);return r.has(t)?r.delete(t):r.add(t),ca(Q,le,r),r})},ne=i.useMemo(()=>lt.filter(t=>y==="all"?t.isAllPlatforms:!t.isAllPlatforms&&t.platformId===y),[y,lt]),fs=$?ne.length>0:q.some(t=>y==="all"||t.platformId===y),Nt=i.useMemo(()=>{const t=new Set;return F.forEach(l=>{const r=String(l.branch??"").trim();r&&t.add(r)}),Array.from(t).sort((l,r)=>l.localeCompare(r))},[F]),Ye=i.useCallback(t=>se==="all"||String(t.branch??"").trim()===se,[se]),Je=i.useMemo(()=>{const t=$?ne:q.filter(l=>y==="all"||l.platformId===y);return Us(F,t).map(({employee:l,riderId:r,riderName:h,designation:m})=>l??ga(r,h,m)).filter(Ye).sort((l,r)=>l.fullName.localeCompare(r.fullName))},[F,$,y,q,Ye,ne]);i.useEffect(()=>{let t=!0;return(async()=>{ct(!0),mt(!1),T(""),ae(null),me(null),dt(null),je.current=null,Ce(!1),bt(new Set);try{const{startDate:r,endDate:h}=tt(M,B),m=Ut(!0);let k=[],g=[],o=[],n=!1;try{g=await Ms(r),n=!0}catch(R){console.warn("Monthly summary RPC unavailable; using paginated report fallback:",R),[k,o]=await Promise.all([Pt(r,h),Ze()])}const s=await m;if(!t)return;ot(g),nt(k),it(n),ut(s),$e(s),He(o)}catch(r){console.error("Failed to load monthly reports:",r),t&&(ot([]),nt([]),it(!1),He([]),mt(!0),T(a("Monthly report data could not be loaded.")))}finally{t&&ct(!1)}})(),()=>{t=!1}},[le,B,M,$e,a]),i.useEffect(()=>{let t=!0;const l=async()=>{try{const r=await Ut(!0);if(!t)return;ut(r),$e(r)}catch(r){console.warn("Failed to refresh monthly report platforms:",r)}};return window.addEventListener(zt,l),()=>{t=!1,window.removeEventListener(zt,l)}},[$e]);const H=i.useMemo(()=>{const t=new Map(ne.map(n=>[n.riderId,n])),l=Je.map(n=>{const s=$?t.get(n.id):void 0,R=q.filter(N=>N.riderId===n.id&&(y==="all"||N.platformId===y)).sort((N,S)=>N.date.localeCompare(S.date)),I=s?s.orderTotal:R.reduce((N,S)=>N+S.orderCount,0),z=s?s.dutyMinutesTotal:R.reduce((N,S)=>N+S.dutyMinutes,0),G=s?s.reportDays:new Set(R.map(N=>N.date)).size,he=s?s.searchText:R.flatMap(N=>[N.riderName,N.designation,N.platformName,N.platformIdNumber,N.date,...N.transferSources.flatMap(S=>[S.platformName,S.platformIdNumber])]).join(" ");return{serial:0,rider:n,records:R,orderTotal:I,reportDays:G,totalDutyMinutes:z,averageDutyTime:G?ge((s==null?void 0:s.averageDutyMinutes)??z/G):"-",searchText:he,rank:0}}),r=[...l].sort((n,s)=>s.orderTotal-n.orderTotal),h=new Map;r.forEach((n,s)=>{h.set(n.rider.id,s+1)});const m=n=>re==="totalOrder"?n.orderTotal:re==="reportDays"?n.reportDays:n.reportDays?n.totalDutyMinutes/n.reportDays:-1,k=re?[...l].sort((n,s)=>{const R=Ve==="desc"?-1:1,I=m(n),z=m(s);return I!==z?(I-z)*R:O(n.rider).localeCompare(O(s.rider))}):l,g=ze(C);return(g?k.filter(n=>[n.rider.id,n.rider.idNumber,n.rider.nickName,n.rider.fullName,n.rider.arabicName,n.rider.iqamaNumber,n.rider.designation,n.rider.status,n.searchText].some(s=>ze(s).includes(g))):k).map((n,s)=>({...n,serial:s+1,rank:h.get(n.rider.id)??s+1}))},[O,$,y,q,Je,C,ne,re,Ve]),wt=i.useCallback(async()=>{if(!$)return q;if(je.current)return je.current;const{startDate:t,endDate:l}=tt(M,B),r=await Pt(t,l);return je.current=r,dt(r),r},[$,q,B,M]),jt=i.useMemo(()=>$?_e??[]:q,[$,_e,q]),K=i.useMemo(()=>{const t=new Map(F.map(o=>[o.id,o])),l=(o,n)=>{const s=t.get(o);return s?O(s):n},r=new Map(F.filter(o=>o.databaseId).map(o=>[o.id,o.databaseId])),h=new Map(ue.filter(o=>o.employeeId&&o.platformId&&o.databaseId).map(o=>[`${o.employeeId}|${o.platformId}`,{idRecordId:o.databaseId,idNumber:o.idNumber}])),m=(o,n)=>{const s=r.get(o);return!s||!n?null:h.get(`${s}|${n}`)??null},k=Ws(jt.filter(o=>y==="all"||o.platformId===y),{resolveOwnIdRecord:m}).map(o=>({...o,ownerName:l(o.ownerId??0,o.ownerName),workers:o.workers.map(n=>({...n,riderName:l(n.riderId,n.riderName)}))}
1)),g=ze(C);return g?k.filter(o=>[o.idNumber,o.platformName,o.ownerName,...o.workers.map(n=>n.riderName)].some(n=>ze(n).includes(g))):k},[jt,O,F,ue,y,C]),us=i.useMemo(()=>{const t=K.filter(r=>!Re.has(r.idRecordId)),l=K.filter(r=>Re.has(r.idRecordId));return[...t,...l]},[Re,K]),xs=K.reduce((t,l)=>t+l.orderTotal,0),ps=((It=ne[0])==null?void 0:It.sharedIdCount)??0,Pe=$&&_e===null?ps:K.length,kt=async()=>{if(!ke){ft(!0),T("");try{const[,t]=await Promise.all([wt(),ue.length>0?Promise.resolve(ue):Ze()]);ue.length===0&&He(t),Ce(!0)}catch(t){console.error("Failed to load shared ID detail:",t),T(a("Monthly report data could not be loaded."))}finally{ft(!1)}}},St=(t,l,r="sm")=>{const h=t?F.find(g=>g.id===t):void 0,m=h?Ee(h,Me):"",k=r==="xs"?"h-5 w-5 text-[7px] border":"h-6 w-6 text-[8px] border-2";return m?e.jsx("img",{src:m,alt:l,loading:"lazy",decoding:"async",className:`${k} shrink-0 rounded-full border-emerald-300 object-cover shadow-sm`}):e.jsx("span",{"aria-hidden":"true",className:`${k} flex shrink-0 items-center justify-center rounded-full border-emerald-300 bg-emerald-50 font-black text-emerald-700 shadow-sm dark:bg-emerald-950/45 dark:text-emerald-200`,children:h?Ae(h,x.language):""})},hs=t=>{bt(l=>{const r=new Set(l);return r.has(t)?r.delete(t):r.add(t),r})};i.useEffect(()=>{if(ve===null||!$){me(null),qe(!1);return}let t=!0;return(async()=>{me(null),qe(!0);try{const{startDate:r,endDate:h}=tt(M,B),m=await $s({startDate:r,endDate:h,riderId:ve,platformId:y==="all"?"":y});t&&me(m)}catch(r){console.error("Failed to load monthly rider detail:",r),t&&(me([]),T(a("Monthly report data could not be loaded.")))}finally{t&&qe(!1)}})(),()=>{t=!1}},[ve,$,y,B,M,a]);const xe=H.find(t=>t.rider.id===ve)??null,P=xe?{...xe,records:$?Qt??[]:xe.records}:null,pe=xe?H.findIndex(t=>t.rider.id===xe.rider.id):-1,Ke=pe>0?H[pe-1].rider.id:null,Ge=pe>=0&&pe<H.length-1?H[pe+1].rider.id:null,vt=P?Ee(P.rider,Me):"",Xe=t=>{if(re!==t){ts(t),ht("desc");return}ht(l=>l==="desc"?"asc":"desc")},Qe=({column:t})=>re!==t?e.jsx(la,{size:14}):Ve==="desc"?e.jsx(oa,{size:14}):e.jsx(na,{size:14}),Ct=async()=>{if(!(Se||te)){pt(!0),T("");try{const[t,l,r,h]=await Promise.all([wt(),vs(()=>import("./xlsx-B2eTCt_Q.js"),[]),Ze(),$t()]),m=t.filter(j=>y==="all"||j.platformId===y),k=m.filter(j=>!j.platformId||j.mappingStatus!=="resolved");if(k.length>0){T(`${k.length} ${a("legacy report rows need platform reconciliation before download.")}`);return}if(m.length===0){T(a("No platform report data found for this month."));return}const g=new Map(h.map(j=>[j.id,j])),o=new Map(fe.map(j=>[j.id,j])),n=new Map;m.forEach(j=>{const A=j.platformId;n.set(A,[...n.get(A)??[],j])});const s=l.utils.book_new(),R=new Set,I=new Date(M,B+1,0).getDate(),z=Array.from({length:I},(j,A)=>String(A+1));if(n.forEach((j,A)=>{var ye,Y;if(j.length===0)return;const ie=((ye=o.get(A))==null?void 0:ye.name)||((Y=j[0])==null?void 0:Y.platformName)||a("Platform"),V=_s({records:j,platformId:A,daysInMonth:I,employees:h,managedIds:r}).filter(f=>{const D=g.get(f.riderId);return D?Ye(D):se==="all"}).sort((f,D)=>{var _,c;const L=((_=g.get(f.riderId))==null?void 0:_.fullName)??f.riderName,W=((c=g.get(D.riderId))==null?void 0:c.fullName)??D.riderName;return L.localeCompare(W)||f.idNumber.localeCompare(D.idNumber,void 0,{numeric:!0})});if(V.length===0)return;const X=[[a("SL"),a("Rider Name"),a("Iqama Number"),a("ID Number"),...z,a("Total Orders")],...V.map((f,D)=>{const L=g.get(f.riderId);return[D+1,L?O(L):f.riderName,(L==null?void 0:L.iqamaNumber)??"",f.idNumber,...f.dailyOrders.map(W=>W>0?W:""),f.dailyOrders.reduce((W,_)=>W+_,0)]})],Z=l.utils.aoa_to_sheet(X),ee=4+I;V.forEach((f,D)=>{const L=D+2,W=l.utils.encode_cell({r:D+1,c:ee}),_=l.utils.encode_cell({r:D+1,c:4}),c=l.utils.encode_cell({r:D+1,c:ee-1});Z[W]={t:"n",v:f.dailyOrders.reduce((d,p)=>d+p,0),f:`SUM(${_}:${c})`}});const be=Math.min(60,Math.max(30,...X.slice(1).map(f=>String(f[1]??"").length+2)));Z["!cols"]=[{wch:7},{wch:be},{wch:18},{wch:18},...Array.from({length:I},()=>({wch:5})),{wch:15}],Z["!autofilter"]={ref:`A1:${l.utils.encode_col(ee)}${X.length}`},l.utils.book_append_sheet(s,Z,ba(ie,R))}),s.SheetNames.length===0){T(a("No platform report data found for this month."));return}const G=s;G.Workbook={...G.Workbook??{},CalcPr:{fullCalcOnLoad:"1",forceFullCalc:"1"}};const he=l.write(s,{bookType:"xlsx",type:"array"}),N=URL.createObjectURL(new Blob([he],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),S=document.createElement("a");S.href=N,S.download=`monthly-platform-report-${le}.xlsx`,S.click(),window.setTimeout(()=>URL.revokeObjectURL(N),0),T(a("Monthly platform workbook downloaded."))}catch(t){console.error("Monthly platform workbook download failed:",t),T(a("Monthly platform workbook could not be created."))}finally{pt(!1)}}},Rt=()=>{const t=window.open("","_blank","width=1100,height=780");if(!t){T(a("Popup was blocked. Please allow popups for printing."));return}const l=H.map(r=>` 2 <tr> 3 <td>${r.serial}</td> 4 <td>${de(O(r.rider))}</td> 5 <td>${r.orderTotal}</td> 6 <td>${de(r.averageDutyTime)}</td> 7 <td>${r.reportDays}</td> 8 <td>${r.rank}</td> 9 </tr>`).join("");t.document.write(` 10 <!doctype html> 11 <html lang="${ce}" dir="${we}"> 12 <head> 13 <title>${de(a("Monthly Report"))} ${de(oe)}</title> 14 <style> 15 body { margin: 0; background: #f8fafc; color: #0f172a; font-family: Arial, sans-serif; } 16 .sheet { width: 980px; margin: 24px auto; padding: 32px; background: #fff; } 17 h1 { margin: 0; text-align: center; font-size: 24px; font-weight: 800; } 18 h2 { margin: 8px 0 24px; text-align: center; font-size: 17px; font-weight: 700; } 19 table { width: 100%; border-collapse: collapse; font-size: 14px; } 20 th, td { border: 1px solid #cbd5e1; padding: 9px 10px; text-align: center; vertical-align: middle; font-weight: 700; } 21 th { background: #ecfdf5; color: #065f46; font-weight: 800; } 22 th:nth-child(2), td:nth-child(2) { text-align: start; font-weight: 800; } 23 @media print { body { background: #fff; } .sheet { width: auto; margin: 0; padding: 20px; } } 24 </style> 25 </head> 26 <body> 27 <div class="sheet"> 28 ${Os(Ls(Ue?"ar":"en"),Bs("monthlyReport"),a)} 29 <h2>${de(a("Monthly Report"))} - ${de(oe)}</h2> 30 <table> 31 <thead> 32 <tr> 33 <th>${a("Serial")}</th> 34 <th>${a("Rider Name")}</th> 35 <th>${a("Total Order")}</th> 36 <th>${a("Average Duty Time")}</th> 37 <th>${a("Report Days")}</th> 38 <th>${a("Rank")}</th> 39 </tr> 40 </thead> 41 <tbody>${l}</tbody> 42 </table> 43 </div> 44 <script> 45 window.onload = function () { 46 window.focus(); 47 window.print(); 48 }; 49 <\/script> 50 </body> 51 </html>`),t.document.close()},bs=async t=>{const g=200+Math.max(t.records.length,1)*42+86,o=[110,68,84,84,274],n=document.createElement("canvas");n.width=620*2,n.height=g*2;const s=n.getContext("2d");if(!s){T(a("Screenshot failed on this browser."));return}const R=we==="rtl",I=R?"right":"left",z=(c,d,p=12)=>R?c+d-p:c+p,G=Ee(t.rider,Me),he=c=>new Promise(d=>{if(!c){d(null);return}const p=new Image;p.crossOrigin="anonymous",p.onload=()=>d(p),p.onerror=()=>d(null),p.src=c}),N=(c,d,p,v,E)=>{s.beginPath(),s.moveTo(c+E,d),s.lineTo(c+p-E,d),s.quadraticCurveTo(c+p,d,c+p,d+E),s.lineTo(c+p,d+v-E),s.quadraticCurveTo(c+p,d+v,c+p-E,d+v),s.lineTo(c+E,d+v),s.quadraticCurveTo(c,d+v,c,d+v-E),s.lineTo(c,d+E),s.quadraticCurveTo(c,d,c+E,d),s.closePath()},S=(c,d)=>{const p=String(c||"-");if(s.measureText(p).width<=d)return p;let v=p;for(;v.length>1&&s.measureText(`${v}...`).width>d;)v=v.slice(0,-1);return`${v}...`},j=await he(G);s.scale(2,2),s.direction=we,s.fillStyle="#ffffff",s.fillRect(0,0,620,g);const A=24,ie=22,V=72,X=84;s.save(),N(A,ie,V,X,12),s.fillStyle="#ecfdf5",s.fill(),s.clip(),j&&s.drawImage(j,A,ie,V,X),s.restore(
51),s.strokeStyle="#10b981",s.lineWidth=2,N(A,ie,V,X,12),s.stroke(),s.lineWidth=1,j||(s.fillStyle="#065f46",s.font="900 16px Arial",s.textAlign="center",s.textBaseline="middle",s.fillText(Ae(t.rider,x.language),A+V/2,ie+X/2)),s.textBaseline="alphabetic",s.textAlign=I;const Z=A+V+16,ee=R?596:Z,be=620-Z-24;s.fillStyle="#059669",s.font="900 12px Arial",s.fillText(S(rt,be),ee,38),s.fillStyle="#0f172a",s.font="900 20px Arial",s.fillText(S(O(t.rider),be),ee,64),s.fillStyle="#475569",s.font="800 14px Arial",s.fillText(S(`${a("Iqama")}: ${t.rider.iqamaNumber||"-"} | ${oe}`,be),ee,88);const ye=[a("Date"),a("Orders"),a("Declined Orders"),a("Duty Time"),a("Remarks")],Y=ye.length-1;let f=0;s.textBaseline="middle",ye.forEach((c,d)=>{if(s.fillStyle="#ecfdf5",s.fillRect(f,112,o[d],44),s.strokeStyle="#cbd5e1",s.strokeRect(f,112,o[d],44),s.fillStyle="#065f46",s.font="900 14px Arial",d===2||d===3){const p=c.split(/\s+/).filter(Boolean),v=p.slice(0,1).join(" ")||c,E=p.slice(1).join(" ")||c;s.textAlign="center",s.fillText(v,f+o[d]/2,130),s.fillText(E,f+o[d]/2,148)}else s.textAlign=d===Y?I:"center",s.fillText(c,d===Y?z(f,o[d]):f+o[d]/2,134);f+=o[d]}),t.records.forEach((c,d)=>{const p=156+d*42,v=Vt(c.transferSources),E=v||c.issue?[v,c.issue].filter(
51Boolean).join(" "):"-",ys=De!==""&&c.orderCount<Oe(De),gs=Ie!==""&&c.declinedOrders>Oe(Ie),Ns=c.dutyTime!==""&&Te!==""&&Le(c.dutyTime)<Le(Te),ws=[We(c.date),String(c.orderCount),String(c.declinedOrders),c.dutyTime||"-",E];f=0,ws.forEach((js,U)=>{s.fillStyle="#ffffff",s.fillRect(f,p,o[U],42),s.strokeStyle="#cbd5e1",s.strokeRect(f,p,o[U],42),s.fillStyle=U===1&&ys||U===2&&gs||U===3&&Ns?"#dc2626":"#0f172a",s.font="800 14px Arial",s.textAlign=U===Y?I:"center",s.fillText(S(js,o[U]-20),U===Y?z(f,o[U]):f+o[U]/2,p+42/2),f+=o[U]})});const D=t.records.reduce((c,d)=>c+d.declinedOrders,0),L=156+Math.max(t.records.length,1)*42,W=[`${a("Total Days")}: ${t.reportDays}`,String(t.orderTotal),String(D),ge(t.totalDutyMinutes),"-"];f=0,W.forEach((c,d)=>{s.fillStyle="#f8fafc",s.fillRect(f,L,o[d],44),s.strokeStyle="#cbd5e1",s.strokeRect(f,L,o[d],44),s.fillStyle="#0f172a",s.font="900 14px Arial",s.textAlign=d===Y?I:"center",s.fillText(S(c,o[d]-20),d===Y?z(f,o[d]):f+o[d]/2,L+22),f+=o[d]});const _=document.createElement("a");_.download=`monthly-rider-history-${le}-${t.rider.id}.png`,_.href=n.toDataURL("image/png"),_.click(),T(a("Screenshot downloaded."))},Dt=y==="all"?"#94A3B8":((Mt=fe.find(t=>t.id===y))==null?void 0:Mt.color)??"#94A3B8";return e.jsxs("section",{className:"ars-page p-3 sm:p-4 md:p-5",children:[e.jsxs("div",{className:"ars-page-control-bar mb-4 flex flex-wrap items-center justify-between gap-2 rounded-xl border border-slate-200 p-2 shadow-sm dark:border-slate-700 sm:p-3",children:[e.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 sm:w-auto",children:[e.jsx("select",{ref:st,value:B,onChange:t=>Jt(Number(t.target.value)),"aria-label":a("Month"),className:"ars-period-control h-10 w-auto min-w-[6.5rem] flex-none whitespace-nowrap rounded-lg border px-3 text-sm font-black outline-none",children:Ht.map((t,l)=>e.jsx("option",{value:l,children:a(t)},t))}),e.jsx("select",{value:M,onChange:t=>Kt(Number(t.target.value)),"aria-label":a("Year"),className:"ars-period-control h-10 w-auto min-w-[5rem] flex-none whitespace-nowrap rounded-lg border px-3 text-sm font-black outline-none",children:cs.map(t=>e.jsx("option",{value:t,children:t},t))}),e.jsxs("span",{className:`${Ot} ms-auto sm:ms-0`,children:[e.jsx(Gs,{size:18,className:Lt,style:{color:Dt},"aria-hidden":"true"}),e.jsx("span",{className:As,style:{backgroundColor:Dt},"aria-hidden":"true"}),e.jsxs("select",{ref:at,value:y,onChange:t=>ns(t.target.value),"aria-label":a("Platform"),className:Bt,children:[e.jsx("option",{value:"all",children:a("All Platforms")}),gt.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]}),!te&>.length===0&&e.jsxs("button",{type:"button",onClick:()=>{Ys()&&u("/id-manager?addPlatform=1")},className:"inline-flex h-10 items-center justify-center gap-1.5 rounded-lg border border-dashed border-emerald-300 bg-emerald-50 px-3 text-xs font-black text-emerald-700 dark:border-emerald-700 dark:bg-emerald-950/35 dark:text-emerald-200",children:[e.jsx(Xs,{size:14})," ",a("Add Platform")]}),Nt.length>0&&e.jsxs("span",{className:Ot,children:[e.jsx(Qs,{size:18,className:`${Lt} ${Es(se!=="all")}`,"aria-hidden":"true"}),e.jsxs("select",{value:se,onChange:t=>es(t.target.value),"aria-label":a("Branch"),className:Bt,children:[e.jsx("option",{value:"all",children:a("All Branches")}),Nt.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]}),e.jsxs("div",{className:"ms-auto hidden flex-none flex-wrap items-center justify-end gap-2 sm:flex",children:[e.jsxs("button",{type:"button",onClick:()=>void kt(),disabled:ke,className:"ars-glass-button inline-flex h-10 w-fit items-center justify-center gap-1.5 rounded-lg px-2.5 py-2 text-xs font-black disabled:cursor-not-allowed disabled:opacity-60 sm:gap-2 sm:px-4 sm:text-sm",children:[e.jsx(_t,{size:17}),a(ke?"Loading...":"Shared IDs"),Pe>0&&e.jsx("span",{className:"rounded-full bg-emerald-100 px-1.5 text-[11px] font-black text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-200",children:Pe})]}),e.jsxs("button",{type:"button",onClick:Rt,className:"ars-glass-button inline-flex h-10 w-fit min-w-[5.25rem] items-center justify-center gap-1.5 rounded-lg px-2.5 py-2 text-xs font-black sm:gap-2 sm:px-4 sm:text-sm",children:[e.jsx(Ft,{size:17}),a("Print")]}),e.jsxs("button",{type:"button",onClick:()=>void Ct(),disabled:te||Se,className:"ars-glass-button inline-flex h-10 w-fit min-w-[6.5rem] items-center justify-center gap-1.5 rounded-lg px-2.5 py-2 text-xs font-black disabled:cursor-not-allowed disabled:opacity-60 sm:gap-2 sm:px-4 sm:text-sm",children:[e.jsx(et,{size:17}),a(Se?"Preparing...":"Download")]})]})]}),e.jsxs("div",{className:"ars-mobile-fab-group sm:hidden",children:[e.jsx("button",{type:"button",onClick:()=>void Ct(),disabled:te||Se,className:"ars-glass-button inline-flex h-11 w-11 items-center justify-center rounded-xl shadow-lg disabled:opacity-60","aria-label":a("Download"),title:a("Download"),children:e.jsx(et,{size:19})}),e.jsx("button",{type:"button",onClick:Rt,className:"ars-glass-button inline-flex h-11 w-11 items-center justify-center rounded-xl shadow-lg","aria-label":a("Print"),title:a("Print"),children:e.jsx(Ft,{size:19})}),e.jsxs("button",{type:"button",onClick:()=>void kt(),disabled:ke,className:"ars-primary-button relative inline-flex h-11 w-11 items-center justify-center rounded-xl shadow-lg disabled:opacity-60","aria-label":a("Shared IDs"),title:a("Shared IDs"),children:[e.jsx(_t,{size:19}),Pe>0&&e.jsx("span",{className:"absolute -end-1 -top-1 min-w-5 rounded-full bg-emerald-100 px-1 text-[10px] font-black text-emerald-700",children:Pe})]})]}),e.jsx(Rs,{className:"mb-3",visibleCount:H.length,totalCount:Je.length,hasSearch:!!C.trim(),filters:[],onClearAll:()=>J==null?void 0:J(""),showingLabel:a("Showing"),clearAllLabel:a("Clear all"),removeLabel:a("Remove filter"),ariaLabel:a("Active filters")}),e.jsx("div",{className:"ars-table-shell w-full overflow-hidden",children:e.jsxs("table",{className:"w-full table-fixed border-collapse text-xs sm:text-sm",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-[7%]"}),e.jsx("col",{className:"w-[30%]"}),e.jsx("col",{className:"w-[11%]"}),e.jsx("col",{className:"w-[14%]"}),e.jsx("col",{className:"w-[13%]"}),e.jsx("col",{className:"w-[10%]"}),e.jsx("col",{className:"w-[6%]"})]}),e.jsx("thead",{className:"ars-table-head text-start text-xs font-black uppercase tracking-normal text-slate-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:a("SL")}),e.jsx("th",{className:"px-1.5 py-2 sm:px-2",children:a("Rider Name")}
51),e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:e.jsxs("button",{type:"button",onClick:()=>Xe("totalOrder"),className:"inline-flex items-center justify-center gap-1 font-black text-slate-500 hover:text-emerald-700",children:[a("Total Order"),e.jsx(Qe,{column:"totalOrder"})]})}),e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:e.jsxs("button",{type:"button",onClick:()=>Xe("averageDuty"),className:"inline-flex items-center justify-center gap-1 font-black text-slate-500 hover:text-emerald-700",children:[a("Avg Duty Time"),e.jsx(Qe,{column:"averageDuty"})]})}),e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:e.jsxs("button",{type:"button",onClick:()=>Xe("reportDays"),className:"inline-flex items-center justify-center gap-1 font-black text-slate-500 hover:text-emerald-700",children:[a("Report Days"),e.jsx(Qe,{column:"reportDays"})]})}),e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:a("Rank")}),e.jsx("th",{className:"px-1.5 py-2 text-center sm:px-2",children:a("View")})]})}),e.jsxs("tbody",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:[H.map(t=>{const l=Ee(t.rider,Me),r=O(t.rider);return e.jsxs("tr",{className:"bg-white/60 dark:bg-slate-950/40",children:[e.jsx("td",{className:"px-1.5 py-2 text-center font-black text-slate-500 sm:px-2",children:t.serial}),e.jsx("td",{className:"px-1.5 py-2 sm:px-2",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l?e.jsx("img",{src:l,alt:r,className:"h-9 w-9 shrink-0 rounded-full border-2 border-emerald-300 object-cover shadow-sm"}):e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border-2 border-emerald-300 bg-emerald-50 text-[10px] font-black text-emerald-700 shadow-sm dark:bg-emerald-950/45 dark:text-emerald-200",children:Ae(t.rider,x.language)}),e.jsx("p",{className:"min-w-0 truncate text-sm font-black text-slate-900 dark:text-slate-100",children:r})]})}),e.jsx("td",{className:"px-1.5 py-2 text-center text-sm font-black text-emerald-700 sm:px-2",children:t.orderTotal}),e.jsx("td",{className:"px-1.5 py-2 text-center font-black text-slate-700 dark:text-slate-200 sm:px-2",children:t.averageDutyTime}),e.jsx("td",{className:"px-1.5 py-2 text-center font-black text-slate-700 dark:text-slate-200 sm:px-2",children:t.reportDays}),e.jsx("td",{className:"px-1.5 py-2 text-center font-black text-slate-700 dark:text-slate-200 sm:px-2",children:t.rank}),e.jsx("td",{className:"px-1.5 py-2 text-center sm:px-2",children:e.jsx("button",{type:"button",onClick:()=>ae(t.rider.id),className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg","aria-label":`${a("View")} ${O(t.rider)}`,children:e.jsx(Zs,{size:17})})})]},t.rider.id)}),H.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-4 py-10 text-center",children:!te&&!Xt&&!fs?e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center gap-3",children:[e.jsx("p",{className:"text-sm font-black text-slate-700 dark:text-slate-200",children:a("No rider reports found for this month.")}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[e.jsx("button",{type:"button",onClick:ds,className:"ars-primary-button inline-flex h-9 items-center justify-center rounded-lg px-3 text-xs font-black",children:a("Change Month")}),y!=="all"&&e.jsx("button",{type:"button",onClick:is,className:"ars-glass-button inline-flex h-9 items-center justify-center rounded-lg px-3 text-xs font-black",children:a("Change Platform")}),e.jsx("button",{type:"button",onClick:()=>u(y==="all"?"/id-manager":`/id-manager?platformId=${encodeURIComponent(y)}`),className:"ars-glass-button inline-flex h-9 items-center justify-center rounded-lg px-3 text-xs font-black",children:a("Check ID Manager")})]})]}):e.jsx("span",{className:"font-bold text-slate-400",children:C.trim()?a("No monthly report rows match your search."):a("No rider reports found for this month.")})})})]})]})}),e.jsx("div",{className:"mt-4 min-h-5",children:e.jsx("p",{className:"min-h-5 text-sm font-bold text-slate-500",children:te?a("Lo
51ading..."):Zt})}),as&&e.jsx("div",{className:"fixed inset-0 z-[300] bg-slate-950/45",onClick:()=>Ce(!1),children:e.jsxs("aside",{className:"absolute bottom-0 top-0 flex w-full max-w-[62rem] flex-col border-slate-200 bg-white shadow-2xl ltr:right-0 ltr:border-l rtl:left-0 rtl:border-r dark:border-slate-700 dark:bg-slate-900",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-slate-200 p-4 dark:border-slate-700",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"truncate text-lg font-black text-slate-900 dark:text-slate-100",children:a("Shared IDs")}),e.jsxs("p",{className:"mt-0.5 truncate text-xs font-bold text-slate-500",children:[a("IDs worked by another rider")," · ",oe]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[K.length>0&&e.jsxs("p",{className:"text-xs font-bold text-slate-500",children:[K.length," ",a("IDs")," · ",xs," ",a("Orders")]}),e.jsx("button",{type:"button",onClick:()=>Ce(!1),className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg","aria-label":a("Close"),children:e.jsx(qt,{size:17})})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:K.length===0?e.jsx("p",{className:"px-4 py-10 text-center font-bold text-slate-400",children:C.trim()?a("No monthly report rows match your search."):a("No shared IDs found for this month.")}):e.jsx("div",{className:"gap-3 [column-fill:balance] columns-1 md:columns-2 xl:columns-3",children:us.map(t=>{var h;const l=((h=fe.find(m=>m.id===t.platformId))==null?void 0:h.color)??"#94A3B8",r=Re.has(t.idRecordId);return e.jsxs("div",{className:`ars-table-shell mb-3 inline-block w-full break-inside-avoid overflow-hidden p-3 align-top transition-opacity ${r?"opacity-60":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"h-4 w-1.5 shrink-0 rounded-full",style:{backgroundColor:l},"aria-hidden":"true"}),e.jsx("p",{className:"min-w-0 truncate text-sm font-black text-slate-900 dark:text-slate-100",children:t.idNumber||a("Not found")}),e.jsx("span",{className:"shrink-0 truncate text-xs font-bold text-slate-500",children:t.platformName})]}),e.jsxs("div",{className:"mt-1.5 flex min-w-0 items-center gap-1.5",children:[St(t.ownerId,t.ownerName,"xs"),e.jsxs("span",{title:t.ownerName,className:"min-w-0 truncate text-xs font-bold text-slate-500",children:[a("Owner"),": ",t.ownerName||"-"]})]})]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>ms(t.idRecordId),"aria-pressed":r,"aria-label":a(r?"Mark as not reviewed":"Mark as reviewed"),title:a(r?"Mark as not reviewed":"Mark as reviewed"),className:`flex h-6 w-6 items-center justify-center rounded-full border transition ${r?"border-emerald-500 bg-emerald-500 text-white":"border-slate-300 bg-white hover:border-emerald-400 dark:border-slate-600 dark:bg-slate-900"}`,children:e.jsx(ea,{size:14,className:r?"opacity-100":"opacity-0"})}),e.jsx("p",{className:"text-sm font-black text-emerald-700",children:t.orderTotal})]})]}),e.jsx("div",{className:"mt-2 divide-y divide-slate-100 dark:divide-slate-800",children:t.workers.map(m=>{const k=`${t.idRecordId}:${m.riderId}`,g=ss.has(k);return e.jsxs("div",{className:g?"-mx-2 rounded-xl bg-emerald-50/80 px-2 ring-1 ring-emerald-200 !border-t-0 dark:bg-emerald-950/30 dark:ring-emerald-900/60":"",children:[e.jsxs("button",{type:"button",onClick:()=>hs(k),"aria-expanded":g,className:"flex w-full items-center gap-2 py-2 text-start",children:[g?e.jsx(ta,{size:15,className:"shrink-0 text-slate-400"}):e.jsx(sa,{size:15,className:"shrink-0 text-slate-400"}),St(m.riderId,m.riderName),e.jsx("span",{title:m.riderName,className:"min-w-0 flex-1 truncate text-sm font-black text-slate-800 dark:text-slate-100",children:m.riderName}),e.jsxs("span",{className:"shrink-0 text-xs font-bold text-slate-500",children:[m.dayCount," ",m.dayCount===1?a("Day"):a("Days")]}),e.jsx("span",{className:"w-10 shrink-0 text-end text-sm font-black text-emerald-700",children:m.orderTotal})]}),g&&e.jsxs("table",{className:"mb-2 w-full table-fixed border-collapse text-xs",children:[e.jsx("thead",{className:"text-start font-black uppercase tracking-normal text-slate-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"w-[46%] px-2 py-1 text-start",children:a("Date")}),e.jsx("th",{className:"w-[27%] px-2 py-1 text-center",children:a("Orders")}),e.jsx("th",{className:"w-[27%] px-2 py-1 text-center",children:a("Duty Time")})]})}),e.jsx("tbody",{children:m.days.map(o=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-2 py-1 text-start font-bold text-slate-600 dar
51k:text-slate-300",children:We(o.date)}),e.jsx("td",{className:"px-2 py-1 text-center font-black text-emerald-700",children:o.orderCount}),e.jsx("td",{className:"px-2 py-1 text-center font-bold text-slate-600 dark:text-slate-300",children:o.dutyMinutes?ge(o.dutyMinutes):"-"})]},o.date))}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"border-t border-slate-100 font-black text-slate-700 dark:border-slate-800 dark:text-slate-200",children:[e.jsx("td",{className:"px-2 py-1 text-start",children:a("Total")}),e.jsx("td",{className:"px-2 py-1 text-center text-emerald-700",children:m.orderTotal}),e.jsx("td",{className:"px-2 py-1 text-center",children:ge(m.dutyMinutes)})]})})]})]},k)})})]},t.idRecordId)})})})]})}),P&&e.jsx("div",{className:"fixed inset-0 z-[300] bg-slate-950/45",onClick:()=>ae(null),children:e.jsxs("aside",{className:"absolute bottom-0 top-0 flex w-full max-w-[40rem] flex-col border-slate-200 bg-white shadow-2xl ltr:right-0 ltr:border-l rtl:left-0 rtl:border-r dark:border-slate-700 dark:bg-slate-900",onClick:t=>t.stopPropagation(),children:[e.jsx("div",{className:"border-b border-slate-200 p-4 dark:border-slate-700",children:e.jsxs("div",{dir:"ltr",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[vt?e.jsx("img",{src:vt,alt:O(P.rider),className:"h-20 w-[4.25rem] shrink-0 rounded-xl border-2 border-emerald-300 object-cover shadow-sm"}):e.jsx("span",{className:"flex h-20 w-[4.25rem] shrink-0 items-center justify-center rounded-xl border-2 border-emerald-300 bg-emerald-50 text-sm font-black text-emerald-700 shadow-sm dark:bg-emerald-950/45 dark:text-emerald-200",children:Ae(P.rider,x.language)}),e.jsxs("div",{dir:we,className:"min-w-0 text-start",children:[e.jsx("p",{className:"text-xs font-black uppercase tracking-normal text-emerald-700",children:rt}),e.jsx("h2",{className:"mt-1 truncate text-lg font-black text-slate-900 dark:text-slate-100",children:O(P.rider)}),e.jsxs("p",{className:"mt-1 text-sm font-bold text-slate-500",children:[a("Iqama"),": ",P.rider.iqamaNumber||"-"," | ",oe]})]})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{Ke!==null&&ae(Ke)},disabled:Ke===null,className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg disabled:cursor-not-allowed disabled:opacity-40","aria-label":a("Previous rider report"),title:a("Previous rider report"),children:e.jsx(aa,{size:18})}),e.jsx("button",{type:"button",onClick:()=>{Ge!==null&&ae(Ge)},disabled:Ge===null,className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg disabled:cursor-not-allowed disabled:opacity-40","aria-label":a("Next rider report"),title:a("Next rider report"),children:e.jsx(ra,{size:18})}),e.jsx("button",{type:"button",onClick:()=>bs(P),disabled:Fe,className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg disabled:cursor-not-allowed disabled:opacity-40","aria-label":a("Screenshot"),title:a("Screenshot"),children:e.jsx(et,{size:17})}),e.jsx("button",{type:"button",onClick:()=>ae(null),className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg","aria-label":a("Close"),children:e.jsx(qt,{size:17})})]})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-4",children:e.jsx("div",{className:"ars-table-shell w-full overflow-hidden",children:e.jsxs("table",{className:"w-full table-fixed border-collapse text-sm",children:[e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-[18%]"}),e.jsx("col",{className:"w-[13%]"}),e.jsx("col",{className:"w-[15%]"}),e.jsx("col",{className:"w-[15%]"}),e.jsx("col",{className:"w-[39%]"})]}),e.jsx("thead",{className:"ars-table-head text-start text-xs font-black uppercase tracking-normal text-slate-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-2 py-2",children:a("Date")}),e.jsx("th",{className:"px-2 py-2 text-center",children:a("Orders")}),e.jsx("th",{className:"px-2 py-2 text-center",children:a("Declined Orders")}),e.jsx("th",{className:"px-2 py-2 text-center",children:a("Duty Time")}),e.jsx("th",{className:"px-2 py-2",children:a("Remarks")})]})}
51),e.jsxs("tbody",{className:"divide-y divide-slate-100 dark:divide-slate-800",children:[Fe&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-10 text-center font-bold text-slate-400",children:a("Loading...")})}),P.records.map(t=>{const l=Vt(t.transferSources),r=De!==""&&t.orderCount<Oe(De),h=Ie!==""&&t.declinedOrders>Oe(Ie),m=t.dutyTime!==""&&Te!==""&&Le(t.dutyTime)<Le(Te);return e.jsxs("tr",{className:"bg-white/60 dark:bg-slate-950/40",children:[e.jsx("td",{className:"px-2 py-2 text-start font-black text-slate-700 dark:text-slate-200",children:We(t.date)}),e.jsx("td",{className:`px-2 py-2 text-center font-black ${r?"text-red-600":"text-emerald-700"}`,children:t.orderCount}),e.jsx("td",{className:`px-2 py-2 text-center font-black ${h?"text-red-600":"text-slate-700 dark:text-slate-200"}`,children:t.declinedOrders}),e.jsx("td",{className:`px-2 py-2 text-center font-black ${m?"text-red-600":"text-slate-700 dark:text-slate-200"}`,children:t.dutyTime||"-"}),e.jsx("td",{className:"px-2 py-2 text-start font-bold text-slate-600 dark:text-slate-300",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[l&&e.jsx("span",{title:l,className:"max-w-[48%] shrink-0 truncate rounded-md bg-emerald-50 px-1.5 py-1 text-[11px] font-black text-emerald-700 dark:bg-emerald-950/35 dark:text-emerald-200",children:l}),e.jsx("span",{className:"min-w-0 truncate",children:t.issue||(l?"":"-")})]})})]},`${t.date}_${t.riderId}`)}),!Fe&&P.records.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"px-4 py-10 text-center font-bold text-slate-400",children:[a("No report found for this rider in")," ",oe,"."]})})]}),e.jsx("tfoot",{children:e.jsxs("tr",{className:"bg-slate-50 text-sm font-black text-slate-900 dark:bg-slate-950 dark:text-slate-100",children:[e.jsxs("td",{className:"px-2 py-3 text-start",children:[a("Total Days"),": ",P.reportDays]}),e.jsx("td",{className:"px-2 py-3 text-center",children:P.orderTotal}),e.jsx("td",{className:"px-2 py-3 text-center",children:ge(P.totalDutyMinutes)}),e.jsx("td",{className:"px-2 py-3 text-start text-xs text-slate-500",children:"-"})]})})]})})})]})})]})}export{rr 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.