1import{g as gs,N as ws,j as e,_ as Ns}from"./index-CWfHYO5E.js";import{u as js,r as i}from"./i18n-vendor-Co-krN6G.js";import{A as ks}from"./ActiveFiltersBar-BLfIExsM.js";import{g as Ss,l as vs,a as Ae}from"./employeeData-C8aL7inU.js";import{u as Rs,g as Ee}from"./employeePhotos-D9Y3giLT.js";import{f as Mt}from"./employees-BRHETJwx.js";import{g as Ds,b as Cs,f as $t,y as Ts,p as Oe,t as Le,z as Is,A as Ms,B as $s,v as Ps}from"./progressReportRules-e7v744vG.js";import{f as Ze}from"./idRecords-DEMAw_-Y.js";import{e as ie}from"./htmlEscape-BnJmeRse.js";import{c as Pt,f as At}from"./platforms-Cj_JU4Vs.js";import{r as As,g as Es,l as Os}from"./companyLetterhead-Bkb_Onva.js";import{r as Be,a as Ls,i as Et,w as Ot,f as Bs,d as Lt}from"./progressReportPlatformSelection-7DFLDyhL.js";import{a as zs}from"./dutyTime-C9tub0z8.js";import{n as Us}from"./search-BjfNVckD.js";import{r as Ws}from"./appNavigationGuard-DFhsd4TY.js";import{e as _s,u as Fs}from"./react-vendor-D5E1hOjb.js";import{P as qs}from"./plus-kWcs1cQG.js";import{U as Bt}from"./users-Ca2mGkUt.js";import{P as zt}from"./printer-CRDmGlRA.js";import{D as et}from"./download-Cj8OUOB8.js";import{E as Hs}from"./eye-CwXOHK5S.js";import{X as Ut}from"./x-vmD7m2IU.js";import{C as Vs}from"./check-Dmd9WXya.js";import{C as Ys}from"./chevron-up-C_ovFRxy.js";import{C as Js}from"./chevron-down-dM4Lsy2M.js";import{C as Ks}from"./chevron-left-CMJUBmiW.js";import{C as Gs}from"./chevron-right-B7wd-Mqk.js";import{A as Xs}from"./arrow-up-down-CkLpXE6A.js";import{A as Qs,a as Zs}from"./arrow-up-rtfahGq6.js";import"./supabase-vendor-Co_IX6oM.js";import"./permissionGuard-CncTqt-b.js";import"./fileUploadPolicy-Dsb_MFV2.js";import"./browserCache-CpZow4D-.js";import"./createLucideIcon-BPd9wT8k.js";const ea="sharedIds:checked",Ft=(u,b)=>u&&b?`${ea}:${u}:${b}`:"",ta=(u,b)=>{const f=Ft(u,b);if(!f||typeof window>"u")return new Set;try{const N=window.localStorage.getItem(f);if(!N)return new Set;const R=JSON.parse(N);return Array.isArray(R)?new Set(R.filter(J=>typeof J=="string")):new Set}catch{return new Set}},sa=(u,b,f)=>{const N=Ft(u,b);if(!(!N||typeof window>"u"))try{window.localStorage.setItem(N,JSON.stringify(Array.from(f)))}catch{}},aa=8e3,Wt=["January","February","March","April","May","June","July","August","September","October","November","December"],ra=async u=>Promise.race([u,new Promise((b,f)=>{window.setTimeout(()=>f(new Error("Database request timed out.")),aa)})]),ge=zs,la=u=>u.toLowerCase().startsWith("ar")?"ar-SA-u-ca-gregory":"en-GB",na=(u,b)=>{const[f,N,R]=u.split("-").map(Number);
1return!f||!N||!R?u:new Date(f,N-1,R).toLocaleDateString(la(b),{day:"2-digit",month:"short",year:"numeric"})},oa=(u,b)=>`${u}-${String(b+1).padStart(2,"0")}`,tt=(u,b)=>{const f=String(b+1).padStart(2,"0"),N=new Date(u,b+1,0).getDate();return{startDate:`${u}-${f}-01`,endDate:`${u}-${f}-${String(N).padStart(2,"0")}`}},ia=u=>u.replace(/[\\/?*:[\]]/g," ").replace(/\s+/g," ").trim().slice(0,31)||"Platform",da=(u,b)=>{const f=ia(u);let N=f,R=2;for(;b.has(N.toLowerCase());){const J=` (${R})`;N=`${f.slice(0,31-J.length)}${J}`,R+=1}return b.add(N.toLowerCase()),N},ca={selfie:!1,iqama:!1,license:!1,passport:!1,medicalInfo:!1,driverCard:!1,ajeerContract:!1},ma=(u,b,f)=>({id:u,idNumber:"",nickName:b,arabicName:"",fullName:b,phoneNo:"",phoneNo2:"",email:"",designation:f,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:{...ca}}),ze=Us,_t=u=>{const b=u.filter(f=>f.fromRiderName.trim()&&Ps(f)).map(f=>`${f.fromRiderName} ${f.orderCount}`).join(", ");return b?`[${b}]`:""};function Va(){var Ct,Tt,It;const u=_s(),{t:b,i18n:f}=js(),N=Fs(),R=(N==null?void 0:N.searchTerm)??"",J=N==null?void 0:N.setSearchTerm,[we]=i.useState(()=>new Date),de=f.language,Ue=de.toLowerCase().startsWith("ar"),Ne=Ue?"rtl":"ltr",a=i.useCallback(t=>b(`terms.${t}`,t),[b]),st=i.useRef(null),at=i.useRef(null),Q=((Ct=gs())==null?void 0:Ct.companyId)??"",rt=ws(Ue?"ar":"en"),O=i.useCallback(t=>Ss(t,de),[de]),We=t=>na(t,de),[B,qt]=i.useState(we.getMonth()),[M,Ht]=i.useState(we.getFullYear()),[F,Vt]=i.useState(vs),[lt,nt]=i.useState([]),[q,ot]=i.useState([]),[$,it]=i.useState(!1),[_e,dt]=i.useState(null),je=i.useRef(null),[te,ct]=i.useState(!1),[Yt,mt]=i.useState(!1),[ke,xt]=i.useState(!1),[Jt,ce]=i.useState(null),[Fe,qe]=i.useState(!1),[Kt,T]=i.useState(""),[me,ut]=i.useState([]),[xe,He]=i.useState([]),[y,ft]=i.useState("all"),[ue,Gt]=i.useState("all"),[Se,pt]=i.useState(!1),[ve,se]=i.useState(null),[ae,Xt]=i.useState(null),[Ve,ht]=i.useState("desc"),[Qt,bt]=i.useState(()=>new Set),[Zt,Re]=i.useState(!1),[De,yt]=i.useState(()=>new Set),[Ce,es]=i.useState(()=>Be().orderCount),[Te,ts]=i.useState(()=>Be().dutyTime),[Ie,ss]=i.useState(()=>Be().declinedOrders),Me=Rs(F),gt=i.useMemo(()=>me.filter(t=>!t.isArchived),[me]),$e=i.useCallback(t=>{ft(l=>{const r=l==="all"?"":l,h=Ls(Q),m=Et(r,t)?r:Et(h,t)?h:"";return Ot(Q,m),m||"all"})},[Q]),as=t=>{ft(t),Ot(Q,t==="all"?"":t)},rs=()=>{const t=at.current;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus()}},ls=()=>{const t=st.current;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus()}},ns=i.useMemo(()=>Ds(we,M),[M,we]),re=i.useMemo(()=>oa(M,B),[B,M]),le=`${a(Wt[B])} ${M}`;i.useEffect(()=>{let t=!0;return(async()=>{try{const r=await ra(Mt());if(!t)return;Vt(r)}catch(r){console.warn("Failed to load Supabase employees for monthly report:",r)}})(),()=>{t=!1}},[]),i.useEffect(()=>{const t=()=>{const l=Be();es(l.orderCount),ts(l.dutyTime),ss(l.declinedOrders)};return Bs().then(t),window.addEventListener(Lt,t),()=>{window.removeEventListener(Lt,t)}},[]),i.useEffect(()=>{yt(ta(Q,re))},[Q,re]);const os=t=>{yt(l=>{const r=new Set(l);return r.has(t)?r.delete(t):r.add(t),sa(Q,re,r),r})},ne=i.useMemo(()=>lt.filter(t=>y==="all"?t.isAllPlatforms:!t.isAllPlatforms&&t.platformId===y),[y,lt]),is=$?ne.length>0:q.some(t=>y==="all"||t.platformId===y),wt=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=>ue==="all"||String(t.branch??"").trim()===ue,[ue]),Je=i.useMemo(()=>{const t=$?ne:q.filter(l=>y==="all"||l.platformId===y);return Cs(F,t).map(({employee:l,riderId:r,riderName:h,designation:m})=>l??ma(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(""),se(null),ce(null),dt(null),je.current=null,Re(!1),bt(new Set);try{const{startDate:r,endDate:h}=tt(M,B),m=At(!0);let k=[],g=[],n=[],o=!1;try{g=await Is(r),o=!0}catch(D){console.warn("Monthly summary RPC unavailable; using paginated report fallback:",D),[k,n]=await Promise.all([$t(r,h),Ze()])}const s=await m;if(!t)return;nt(g),ot(k),it(o),ut(s),$e(s),He(n)}catch(r){console.error("Failed to load monthly reports:",r),t&&(nt([]),ot([]),it(!1),He([]),mt(!0),T(a("Monthly report data could not be loaded.")))}finally{t&&ct(!1)}})(),()=>{t=!1}},[re,B,M,$e,a]),i.useEffect(()=>{let t=!0;const l=async()=>{try{const r=await At(!0);if(!t)return;ut(r),$e(r)}catch(r){console.warn("Failed to refresh monthly report platforms:",r)}};return window.addEventListener(Pt,l),()=>{t=!1,window.removeEventListener(Pt,l)}
1},[$e]);const H=i.useMemo(()=>{const t=new Map(ne.map(o=>[o.riderId,o])),l=Je.map(o=>{const s=$?t.get(o.id):void 0,D=q.filter(w=>w.riderId===o.id&&(y==="all"||w.platformId===y)).sort((w,S)=>w.date.localeCompare(S.date)),I=s?s.orderTotal:D.reduce((w,S)=>w+S.orderCount,0),z=s?s.dutyMinutesTotal:D.reduce((w,S)=>w+S.dutyMinutes,0),G=s?s.reportDays:new Set(D.map(w=>w.date)).size,he=s?s.searchText:D.flatMap(w=>[w.riderName,w.designation,w.platformName,w.platformIdNumber,w.date,...w.transferSources.flatMap(S=>[S.platformName,S.platformIdNumber])]).join(" ");return{serial:0,rider:o,records:D,orderTotal:I,reportDays:G,totalDutyMinutes:z,averageDutyTime:G?ge((s==null?void 0:s.averageDutyMinutes)??z/G):"-",searchText:he,rank:0}}),r=[...l].sort((o,s)=>s.orderTotal-o.orderTotal),h=new Map;r.forEach((o,s)=>{h.set(o.rider.id,s+1)});const m=o=>ae==="totalOrder"?o.orderTotal:ae==="reportDays"?o.reportDays:o.reportDays?o.totalDutyMinutes/o.reportDays:-1,k=ae?[...l].sort((o,s)=>{const D=Ve==="desc"?-1:1,I=m(o),z=m(s);return I!==z?(I-z)*D:O(o.rider).localeCompare(O(s.rider))}):l,g=ze(R);return(g?k.filter(o=>[o.rider.id,o.rider.idNumber,o.rider.nickName,o.rider.fullName,o.rider.arabicName,o.rider.iqamaNumber,o.rider.designation,o.rider.status,o.searchText].some(s=>ze(s).includes(g))):k).map((o,s)=>({...o,serial:s+1,rank:h.get(o.rider.id)??s+1}))},[O,$,y,q,Je,R,ne,ae,Ve]),Nt=i.useCallback(async()=>{if(!$)return q;if(je.current)return je.current;const{startDate:t,endDate:l}=tt(M,B),r=await $t(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(n=>[n.id,n])),l=(n,o)=>{const s=t.get(n);return s?O(s):o},r=new Map(F.filter(n=>n.databaseId).map(n=>[n.id,n.databaseId])),h=new Map(xe.filter(n=>n.employeeId&&n.platformId&&n.databaseId).map(n=>[`${n.employeeId}|${n.platformId}`,{idRecordId:n.databaseId,idNumber:n.idNumber}])),m=(n,o)=>{const s=r.get(n);return!s||!o?null:h.get(`${s}|${o}`)??null},k=Ts(jt.filter(n=>y==="all"||n.platformId===y),{resolveOwnIdRecord:m}).map(n=>({...n,ownerName:l(n.ownerId??0,n.ownerName),workers:n.workers.map(o=>({...o,riderName:l(o.riderId,o.riderName)}))})),g=ze(R);return g?k.filter(n=>[n.idNumber,n.platformName,n.ownerName,...n.workers.map(o=>o.riderName)].some(o=>ze(o).includes(g))):k},[jt,O,F,xe,y,R]),ds=i.useMemo(()=>{const t=K.filter(r=>!De.has(r.idRecordId)),l=K.filter(r=>De.has(r.idRecordId));return[...t,...l]},[De,K]),cs=K.reduce((t,l)=>t+l.orderTotal,0),ms=((Tt=ne[0])==null?void 0:Tt.sharedIdCount)??0,Pe=$&&_e===null?ms:K.length,kt=async()=>{if(!ke){xt(!0),T("");try{const[,t]=await Promise.all([Nt(),xe.length>0?Promise.resolve(xe):Ze()]);xe.length===0&&He(t),Re(!0)}catch(t){console.error("Failed to load shared ID detail:",t),T(a("Monthly report data could not be loaded."))}finally{xt(!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,f.language):""})},xs=t=>{bt(l=>{const r=new Set(l);return r.has(t)?r.delete(t):r.add(t),r})};i.useEffect(()=>{if(ve===null||!$){ce(null),qe(!1);return}let t=!0;return(async()=>{ce(null),qe(!0);try{const{startDate:r,endDate:h}=tt(M,B),m=await Ms({startDate:r,endDate:h,riderId:ve,platformId:y==="all"?"":y});t&&ce(m)}catch(r){console.error("Failed to load monthly rider detail:",r),t&&(ce([]),T(a("Monthly report data could not be loaded.")))}finally{t&&qe(!1)}})(),()=>{t=!1}},[ve,$,y,B,M,a]);const fe=H.find(t=>t.rider.id===ve)??null,P=fe?{...fe,records:$?Jt??[]:fe.records}:null,pe=fe?H.findIndex(t=>t.rider.id===fe.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(ae!==t){Xt(t),ht("desc");return}ht(l=>l==="desc"?"asc":"desc")},Qe=({column:t})=>ae!==t?e.jsx(Xs,{size:14}):Ve==="desc"?e.jsx(Qs,{size:14}):e.jsx(Zs,{size:14}),Rt=async()=>
1{if(!(Se||te)){pt(!0),T("");try{const[t,l,r,h]=await Promise.all([Nt(),Ns(()=>import("./xlsx-B2eTCt_Q.js"),[]),Ze(),Mt()]),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])),n=new Map(me.map(j=>[j.id,j])),o=new Map;m.forEach(j=>{const A=j.platformId;o.set(A,[...o.get(A)??[],j])});const s=l.utils.book_new(),D=new Set,I=new Date(M,B+1,0).getDate(),z=Array.from({length:I},(j,A)=>String(A+1));if(o.forEach((j,A)=>{var ye,Y;if(j.length===0)return;const oe=((ye=n.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(x=>{const C=g.get(x.riderId);return C?Ye(C):ue==="all"}).sort((x,C)=>{var _,c;const L=((_=g.get(x.riderId))==null?void 0:_.fullName)??x.riderName,W=((c=g.get(C.riderId))==null?void 0:c.fullName)??C.riderName;return L.localeCompare(W)||x.idNumber.localeCompare(C.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((x,C)=>{const L=g.get(x.riderId);return[C+1,L?O(L):x.riderName,(L==null?void 0:L.iqamaNumber)??"",x.idNumber,...x.dailyOrders.map(W=>W>0?W:""),x.dailyOrders.reduce((W,_)=>W+_,0)]})],Z=l.utils.aoa_to_sheet(X),ee=4+I;V.forEach((x,C)=>{const L=C+2,W=l.utils.encode_cell({r:C+1,c:ee}),_=l.utils.encode_cell({r:C+1,c:4}),c=l.utils.encode_cell({r:C+1,c:ee-1});Z[W]={t:"n",v:x.dailyOrders.reduce((d,p)=>d+p,0),f:`SUM(${_}:${c})`}});const be=Math.min(60,Math.max(30,...X.slice(1).map(x=>String(x[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,da(oe,D))}),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"}),w=URL.createObjectURL(new Blob([he],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),S=document.createElement("a");S.href=w,S.download=`monthly-platform-report-${re}.xlsx`,S.click(),window.setTimeout(()=>URL.revokeObjectURL(w),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)}}},Dt=()=>{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>${ie(O(r.rider))}</td> 5 <td>${r.orderTotal}</td> 6 <td>${ie(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="${de}" dir="${Ne}"> 12 <head> 13 <title>${ie(a("Monthly Report"))} ${ie(le)}</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 ${As(Es(Ue?"ar":"en"),Os("monthlyReport"),a)} 29 <h2>${ie(a("Monthly Report"))} - ${ie(le)}</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()},us=async t=>{const g=200+Math.max(t.records.length,1)*42+86,n=[110,68,84,84,274],o=document.createElement("canvas");o.width=620*2,o.height=g*2;const s=o.getContext("2d");if(!s){T(a("Screenshot failed on this browser."));return}const D=Ne==="rtl",I=D?"right":"left",z=(c,d,p=12)=>D?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}),w=(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=Ne,s.fillStyle="#ffffff",s.fillRect(0,0,620,g);const A=24,oe=22,V=72,X=84;s.save(),w(A,oe,V,X,12),s.fillStyle="#ecfdf5",s.fill(),s.clip(),j&&s.drawImage(j,A,oe,V,X),s.restore(
51),s.strokeStyle="#10b981",s.lineWidth=2,w(A,oe,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,f.language),A+V/2,oe+X/2)),s.textBaseline="alphabetic",s.textAlign=I;const Z=A+V+16,ee=D?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||"-"} | ${le}`,be),ee,88);const ye=[a("Date"),a("Orders"),a("Declined Orders"),a("Duty Time"),a("Remarks")],Y=ye.length-1;let x=0;s.textBaseline="middle",ye.forEach((c,d)=>{if(s.fillStyle="#ecfdf5",s.fillRect(x,112,n[d],44),s.strokeStyle="#cbd5e1",s.strokeRect(x,112,n[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,x+n[d]/2,130),s.fillText(E,x+n[d]/2,148)}else s.textAlign=d===Y?I:"center",s.fillText(c,d===Y?z(x,n[d]):x+n[d]/2,134);x+=n[d]}),t.records.forEach((c,d)=>{const p=156+d*42,v=_t(c.transferSources),E=v||c.issue?[v,c.issue].filter(
51Boolean).join(" "):"-",fs=Ce!==""&&c.orderCount<Oe(Ce),ps=Ie!==""&&c.declinedOrders>Oe(Ie),hs=c.dutyTime!==""&&Te!==""&&Le(c.dutyTime)<Le(Te),bs=[We(c.date),String(c.orderCount),String(c.declinedOrders),c.dutyTime||"-",E];x=0,bs.forEach((ys,U)=>{s.fillStyle="#ffffff",s.fillRect(x,p,n[U],42),s.strokeStyle="#cbd5e1",s.strokeRect(x,p,n[U],42),s.fillStyle=U===1&&fs||U===2&&ps||U===3&&hs?"#dc2626":"#0f172a",s.font="800 14px Arial",s.textAlign=U===Y?I:"center",s.fillText(S(ys,n[U]-20),U===Y?z(x,n[U]):x+n[U]/2,p+42/2),x+=n[U]})});const C=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(C),ge(t.totalDutyMinutes),"-"];x=0,W.forEach((c,d)=>{s.fillStyle="#f8fafc",s.fillRect(x,L,n[d],44),s.strokeStyle="#cbd5e1",s.strokeRect(x,L,n[d],44),s.fillStyle="#0f172a",s.font="900 14px Arial",s.textAlign=d===Y?I:"center",s.fillText(S(c,n[d]-20),d===Y?z(x,n[d]):x+n[d]/2,L+22),x+=n[d]});const _=document.createElement("a");_.download=`monthly-rider-history-${re}-${t.rider.id}.png`,_.href=o.toDataURL("image/png"),_.click(),T(a("Screenshot downloaded."))};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 flex-wrap items-center gap-2",children:[e.jsx("select",{ref:st,value:B,onChange:t=>qt(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:Wt.map((t,l)=>e.jsx("option",{value:l,children:a(t)},t))}),e.jsx("select",{value:M,onChange:t=>Ht(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:ns.map(t=>e.jsx("option",{value:t,children:t},t))}),e.jsxs("span",{className:"flex h-10 w-auto min-w-[8.5rem] max-w-[12rem] flex-none items-center gap-2 rounded-lg border border-slate-200 bg-white px-2 dark:border-slate-700 dark:bg-slate-950",children:[e.jsx("span",{className:"h-4 w-1.5 rounded-full",style:{backgroundColor:y==="all"?"#94A3B8":((It=me.find(t=>t.id===y))==null?void 0:It.color)??"#94A3B8"},"aria-hidden":"true"}),e.jsxs("select",{ref:at,value:y,onChange:t=>as(t.target.value),"aria-label":a("Platform"),className:"w-auto min-w-0 max-w-[10rem] flex-1 whitespace-nowrap bg-transparent text-sm font-black text-slate-800 outline-none dark:text-slate-100",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:()=>{Ws()&&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(qs,{size:14})," ",a("Add Platform")]}),wt.length>0&&e.jsx("span",{className:"flex h-10 w-auto min-w-[8.5rem] max-w-[12rem] flex-none items-center gap-2 rounded-lg border border-slate-200 bg-white px-2 dark:border-slate-700 dark:bg-slate-950",children:e.jsxs("select",{value:ue,onChange:t=>Gt(t.target.value),"aria-label":a("Branch"),className:"w-auto min-w-0 max-w-[10rem] flex-1 whitespace-nowrap bg-transparent text-sm font-black text-slate-800 outline-none dark:text-slate-100",children:[e.jsx("option",{value:"all",children:a("All Branches")}),wt.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(Bt,{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:Dt,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(zt,{size:17}),a("Print")]}),e.jsxs("button",{type:"button",onClick:()=>
51void Rt(),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 Rt(),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:Dt,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(zt,{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(Bt,{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(ks,{className:"mb-3",visibleCount:H.length,totalCount:Je.length,hasSearch:!!R.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")}),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,f.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:()=>se(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(Hs,{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&&!Yt&&!is?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:ls,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:rs,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:()=>
51u(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:R.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("Loading..."):Kt})}),Zt&&e.jsx("div",{className:"fixed inset-0 z-[300] bg-slate-950/45",onClick:()=>Re(!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")," · ",le]})]}),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")," · ",cs," ",a("Orders")]}),e.jsx("button",{type:"button",onClick:()=>Re(!1),className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg","aria-label":a("Close"),children:e.jsx(Ut,{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:R.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:ds.map(t=>{var h;const l=((h=me.find(m=>m.id===t.platformId))==null?void 0:h.color)??"#94A3B8",r=De.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:()=>os(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(Vs,{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=Qt.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:()=>xs(k),"aria-expanded":g,className:"flex w-full items-center gap-2 py-2 text-start",children:[g?e.jsx(Ys,{size:15,className:"shrink-0 text-slate-400"}):e.jsx(Js,{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(n=>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(n.date)}),e.jsx("td",{className:"px-2 py-1 text-center font-black text-emerald-700",children:n.orderCount}),e.jsx("td",{className:"px-2 py-1 text-center font-bold text-slate-600 dark:text-slate-300",children:n.dutyMinutes?ge(n.dutyMinutes):"-"})]},n.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:()=>se(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,f.language)}),e.jsxs("div",{dir:Ne,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||"-"," | ",le]})]})]}),e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{Ke!==null&&se(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(Ks,{size:18})}),e.jsx("button",{type:"button",onClick:()=>{Ge!==null&&se(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(Gs,{size:18})}),e.jsx("button",{type:"button",onClick:()=>us(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:()=>se(null),className:"ars-glass-button inline-flex h-9 w-9 items-center justify-center rounded-lg","aria-label":a("Close"),children:e.jsx(Ut,{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=_t(t.transferSources),r=Ce!==""&&t.orderCount<Oe(Ce),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")," ",le,"."]})})]}),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{Va 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.