1import{r as T,j as e,Y as xe,bw as ke,a$ as Ne,aC as ye,U as oe,ah as X,L as ve,dz as Se,K as A,br as De,dq as Pe,dA as he,ai as Re,aM as Te,ae as Ie,a9 as _e,ay as Fe,aD as be,a5 as we,af as Ee,X as ze,b8 as Oe,ar as Le,dB as Me,b0 as Be,d1 as Ke,$ as Ve}from"./ui-vendor-Bizn46in.js";import{a as Ce,d as qe}from"./react-vendor-DDIKA4Ll.js";import{T as Ze,a as B}from"./tabs-CxHk9qBY.js";import{u as re}from"./useQuery-CEoYTnDP.js";import{B as H,c as q,C as d,b as m,d as k,e as S,s as W,k as Ue,I as He,l as Ae,m as We,n as $e}from"./index-D0WoK5a4.js";import{f as ie,C as ue,d as Je,s as Qe}from"./calendar-eoCemyKa.js";import{P as pe,a as je,b as ge}from"./popover-BzL_L4Jm.js";import{T as Y,a as G,b as F,c as i,d as ee,e as n,f as Xe}from"./table-I9W_YaWZ.js";import{S as O}from"./skeleton-BsOMqmRk.js";import{s as Ye}from"./subWeeks-CuICWeoB.js";import{h as ce,f as K,c as Z}from"./cs-BdlVyxlC.js";import{p as Q}from"./parseISO-BDAex6Nh.js";import{S as te,a as ae,b as le,c as ne,d as M}from"./select-CV3xkpur.js";import{B as V}from"./badge-BYQrBvXB.js";import{e as Ge}from"./endOfMonth-YheYFKNI.js";import{f as U}from"./dateUtils-OCEmstg1.js";import{i as fe}from"./isPast-mMes0UST.js";import{d as es}from"./differenceInDays-CtKxBSkL.js";import{D as ss,C as ts,F as as}from"./FuelReceiptsQueue-DpdfQEAG.js";import{R as ls}from"./RegisterFineDialog-D2b6Ht_3.js";import{H as ns}from"./HourlyPayroll-BgzsX4B1.js";import{u as rs,S as is}from"./useTabOrder-C0TBcDIL.js";import"./charts-vendor-e9E4_Tty.js";import"./addDays-mj2hKU6o.js";import"./index-BdQq_4o_.js";import"./index-C3nvyk2t.js";import"./useMutation-B0jr85Zr.js";import"./dialog-BZFVwrdQ.js";import"./useTableSort-gq1qRuIf.js";import"./useTableFilters-CNPUUxIb.js";import"./checkbox-MoNFL6Jq.js";import"./scroll-area-C0Z2CGYx.js";import"./RecurringDeductionsPanel-DAzhGCiv.js";import"./progress-DwMA0ydB.js";import"./VehicleAssignmentSelect-CfAL7nj-.js";import"./command-DAKObUfW.js";import"./date-input-BSdW6LLU.js";import"./parse-D8WPNpdy.js";import"./imageUtils-0FKDsP2U.js";import"./image-fullscreen-dialog-D24CPi90.js";import"./pdf-viewer-BrbHLM6n.js";import"./pdf-vendor-Cx33I5o-.js";import"./invokeAuthedFunction-B1sBoD-b.js";import"./useAresLookup-8GF-X7_g.js";import"./jmhzCountries-BOm1chtJ.js";import"./alert-DRfsolDv.js";import"./GenerateDebtAcknowledgmentDialog-BLR5Yghw.js";import"./purify.es-A66Cw1IH.js";import"./separator-MSxvMlAX.js";import"./switch-D6jNQObn.js";import"./xlsx-vendor-B7wZZvT5.js";import"./subMonths-CAPqwBRY.js";import"./PlatformBadges-C0Z7DD6C.js";import"./VehicleReturnDialog-qcg7Xoqe.js";import"./radio-group-CWZjOlZq.js";import"./DriveDayBadge--SkMxg35.js";import"./fuelReceipts-Dk0uYVyW.js";import"./collapsible-BsIiCyR2.js";import"./index-NThfaOnT.js";import"./clipboard-YC955cWu.js";import"./sortable.esm-CMhifxem.js";const p=j=>new Intl.NumberFormat("cs-CZ",{style:"currency",currency:"CZK",minimumFractionDigits:0}).format(j);function cs(){const j=new Date,[y,D]=T.useState(Ye(ce(j,{weekStartsOn:1}),4)),[u,z]=T.useState(ie(j,{weekStartsOn:1})),[P,l]=T.useState(!1),[g,I]=T.useState(!1),b=K(y,"yyyy-MM-dd"),E=K(u,"yyyy-MM-dd"),{data:R,isLoading:C}=re({queryKey:["payroll-overview-report",b,E],queryFn:async()=>{const{data:a,error:o}=await W.from("payroll_periods").select("id, platform, period_start, period_end, payment_date, status, total_commission, total_net_payout, total_deductions").in("platform",["taxi_combined","uber","bolt","liftago"]).in("status",["paid","closed"]).gte("period_start",b).lte("period_end",E).order("period_start",{ascending:!0});if(o)throw o;if(!a||a.length===0)return[];const x=a.map(c=>c.id),{data:v,error:_}=await W.from("payroll_items").select(` 2 payroll_period_id, 3 gross_payout, 4 commission_amount, 5 rent_deduction, 6 deposit_deduction, 7 debt_repayment, 8 net_payout, 9 shortfall, 10 deposit_received, 11 income_bonus, 12 sim_deduction, 13 penalty, 14 service_deduction, 15 discount, 16 employee_id 17 `).in("payroll_period_id",x);if(_)throw _;const h={};for(const c of v||[]){const N=c.payroll_period_id;h[N]||(h[N]=[]),h[N].push(c)}return a.map(c=>{const N=h[c.id]||[],L=new Set(N.map(f=>
17f.employee_id).filter(Boolean)),t={weekLabel:`${K(Q(c.period_start),"d.M.",{locale:Z})} â ${K(Q(c.period_end),"d.M.yyyy",{locale:Z})}`,periodStart:c.period_start,periodEnd:c.period_end,platform:c.platform,periodId:c.id,grossEarnings:0,commissionIncome:0,rentIncome:0,depositDeductions:0,debtRepayments:0,totalCompanyIncome:0,totalPayouts:0,totalShortfalls:0,driverCount:L.size,depositsReceived:0,incomeBonuses:0,simDeductions:0,penalties:0,serviceDeductions:0,discounts:0};for(const f of N)t.grossEarnings+=f.gross_payout||0,t.commissionIncome+=f.commission_amount||0,t.rentIncome+=f.rent_deduction||0,t.depositDeductions+=f.deposit_deduction||0,t.debtRepayments+=f.debt_repayment||0,t.totalPayouts+=f.net_payout||0,t.totalShortfalls+=f.shortfall||0,t.depositsReceived+=f.deposit_received||0,t.incomeBonuses+=f.income_bonus||0,t.simDeductions+=f.sim_deduction||0,t.penalties+=f.penalty||0,t.serviceDeductions+=f.service_deduction||0,t.discounts+=f.discount||0;return t.totalCompanyIncome=t.commissionIncome+t.rentIncome+t.debtRepayments+t.depositDeductions,t})}}),w=R||[],s=T.useMemo(()=>w.reduce((a,o)=>({grossEarnings:a.grossEarnings+o.grossEarnings,commissionIncome:a.commissionIncome+o.commissionIncome,rentIncome:a.rentIncome+o.rentIncome,depositDeductions:a.depositDeductions+o.depositDeductions,debtRepayments:a.debtRepayments+o.debtRepayments,totalCompanyIncome:a.totalCompanyIncome+o.totalCompanyIncome,totalPayouts:a.totalPayouts+o.totalPayouts,totalShortfalls:a.totalShortfalls+o.totalShortfalls,driverCount:a.driverCount,depositsReceived:a.depositsReceived+o.depositsReceived,incomeBonuses:a.incomeBonuses+o.incomeBonuses,simDeductions:a.simDeductions+o.simDeductions,penalties:a.penalties+o.penalties,serviceDeductions:a.serviceDeductions+o.serviceDeductions,discounts:a.discounts+o.discounts}),{grossEarnings:0,commissionIncome:0,rentIncome:0,depositDeductions:0,debtRepayments:0,totalCompanyIncome:0,totalPayouts:0,totalShortfalls:0,driverCount:0,depositsReceived:0,incomeBonuses:0,simDeductions:0,penalties:0,serviceDeductions:0,discounts:0}),[w]),r=()=>{if(w.length===0)return;const a=["ObdobÃ","Hrubé pÅÃjmy","Provize","Nájem","Spl. kauce","Spl. dluhu","PÅÃjmy firmy","Výplaty","Nedoplatky","Vklady","ÅidiÄů"],o=w.map(c=>[c.weekLabel,c.grossEarnings,c.commissionIncome,c.rentIncome,c.depositDeductions,c.debtRepayments,c.totalCompanyIncome,c.totalPayouts,c.totalShortfalls,c.depositsReceived,c.driverCount]);o.push(["CELKEM",s.grossEarnings,s.commissionIncome,s.rentIncome,s.depositDeductions,s.debtRepayments,s.totalCompanyIncome,s.totalPayouts,s.totalShortfalls,s.depositsReceived,""]);const x=[a.join(";"),...o.map(c=>c.join(";"))].join(` 18`),v=new Blob(["\uFEFF"+x],{type:"text/csv;charset=utf-8;"}),_=URL.createObjectURL(v),h=document.createElement("a");h.href=_,h.download=`report-${b}-${E}.csv`,h.click(),URL.revokeObjectURL(_)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Od"}),e.jsxs(pe,{open:P,onOpenChange:l,children:[e.jsx(je,{asChild:!0,children:e.jsxs(H,{variant:"outline",className:q("w-[180px] justify-start text-left font-normal",!y&&"text-muted-foreground"),children:[e.jsx(xe,{className:"mr-2 h-4 w-4"}),K(y,"d. MMMM yyyy",{locale:Z})]})}),e.jsx(ge,{className:"w-auto p-0",align:"start",children:e.jsx(ue,{mode:"single",selected:y,onSelect:a=>{a&&(D(ce(a,{weekStartsOn:1})),l(!1))},initialFocus:!0,className:q("p-3 pointer-events-auto")})})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Do"}),e.jsxs(pe,{open:g,onOpenChange:I,children:[e.jsx(je,{asChild:!0,children:e.jsxs(H,{variant:"outline",className:q("w-[180px] justify-start text-left font-normal",!u&&"text-muted-foreground"),children:[e.jsx(xe,{className:"mr-2 h-4 w-4"}),K(u,"d. MMMM yyyy",{locale:Z})]})}),e.jsx(ge,{className:"w-auto p-0",align:"start",children:e.jsx(ue,{mode:"single",selected:u,onSelect:a=>{a&&(z(ie(a,{weekStartsOn:1}
18)),I(!1))},initialFocus:!0,className:q("p-3 pointer-events-auto")})})]})]}),e.jsxs(H,{variant:"outline",size:"sm",onClick:r,disabled:w.length===0,children:[e.jsx(ke,{className:"h-4 w-4 mr-1"}),"Export CSV"]})]}),!C&&w.length>0&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(d,{children:e.jsxs(m,{className:"pt-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(Ne,{className:"h-4 w-4"}),"Hrubé pÅÃjmy"]}),e.jsx("p",{className:"text-xl font-bold",children:p(s.grossEarnings)})]})}),e.jsx(d,{children:e.jsxs(m,{className:"pt-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(ye,{className:"h-4 w-4"}),"PÅÃjmy firmy"]}),e.jsx("p",{className:"text-xl font-bold text-green-600",children:p(s.totalCompanyIncome)})]})}),e.jsx(d,{children:e.jsxs(m,{className:"pt-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(oe,{className:"h-4 w-4"}),"Výplaty ÅidiÄům"]}),e.jsx("p",{className:"text-xl font-bold",children:p(s.totalPayouts)})]})}),e.jsx(d,{children:e.jsxs(m,{className:"pt-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(X,{className:"h-4 w-4"}),"Nedoplatky"]}),e.jsx("p",{className:q("text-xl font-bold",s.totalShortfalls>0&&"text-destructive"),children:p(s.totalShortfalls)})]})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-3",children:e.jsx(S,{className:"text-base",children:"Týdennà pÅehled uzavÅených vyúÄtovánÃ"})}),e.jsx(m,{className:"p-0",children:C?e.jsx("div",{className:"p-6 space-y-3",children:[1,2,3].map(a=>e.jsx(O,{className:"h-10 w-full"},a))}):w.length===0?e.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Žádná uzavÅená vyúÄtovánà v zvoleném obdobÃ."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(F,{children:[e.jsx(i,{className:"sticky left-0 bg-background z-10 min-w-[160px]",children:"ObdobÃ"}),e.jsx(i,{className:"text-right min-w-[110px]",children:"Hrubé pÅÃjmy"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Provize"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Nájem"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Spl. kauce"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Spl. dluhu"}),e.jsx(i,{className:"text-right min-w-[120px] font-semibold",children:"PÅÃjmy firmy"}),e.jsx(i,{className:"text-right min-w-[110px]",children:"Výplaty"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Vklady"}),e.jsx(i,{className:"text-right min-w-[100px]",children:"Nedoplatky"}),e.jsx(i,{className:"text-right min-w-[60px]",children:"ÅidiÄů"})]})}),e.jsx(ee,{children:w.map(a=>e.jsxs(F,{children:[e.jsx(n,{className:"sticky left-0 bg-background z-10 font-medium",children:a.weekLabel}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.grossEarnings)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.commissionIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.rentIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.depositDeductions)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.debtRepayments)}),e.jsx(n,{className:"text-right tabular-nums font-semibold text-green-600",children:p(a.totalCompanyIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.totalPayouts)}),e.jsx(n,{className:"text-right tabular-nums",children:p(a.depositsReceived)}),e.jsx(n,{className:q("text-right tabular-nums",a.totalShortfalls>0&&"text-destructive font-medium"),children:a.totalShortfalls>0?p(a.totalShortfalls):"â"}),e.jsx(n,{className:"text-right tabular-nums",children:a.driverCount})]},a.periodId))}),e.jsx(Xe,{children:e.jsxs(F,{className:"font-bold",children:[e.jsx(n,{className:"sticky left-0 bg-muted z-10",children:"CELKEM"}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.grossEarnings)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.commissionIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.rentIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.depositDeductions)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.debtRepayments)}),e.jsx(n,{className:"text-right tabular-nums text-green-600",children:p(s.totalCompanyIncome)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.totalPayouts)}),e.jsx(n,{className:"text-right tabular-nums",children:p(s.depositsReceived)}),e.jsx(n,{className:q("text-right tabular-nums",s.totalShortfalls>0&&"text-destructive"),children:s.totalShortfalls>0?p(s.totalShortfalls):"â"}),e.jsx(n,{className:"text-right",children:"â"})]})})]})})})]})]})}const os=[{value:"week",label:"Tento týden"},{value:"month",label:"Tento mÄsÃc"},{value:"quarter",label:"Poslednà 3 mÄsÃce"},{value:"all",label:"Celkem"}],ds=[{value:"all",label:"VÅ¡echny platformy"},{value:"uber",label:"Uber"},{value:"bolt",label:"Bolt"},{value:"liftago",label:"Liftago"}];function ms(){const j=Ce(),[y,D]=T.useState("month"),[u,z]=T.useState("all"),P=()=>{const s=new Date;switch(y){case"week":return{start:ce(s,{locale:Z}),end:ie(s,{locale:Z})};case"month":return{start:Qe(s),end:Ge(s)};case"quarter":return{start:Je(s,90),end:s};default:return{start:null,end:null}}},{data:l,isLoading:g}=re({queryKey:["fleet-performance",y,u],queryFn:async()=>{const{start:s,end:r}=P();let a=W.from("employee_performance_stats").select(` 19 employee_id, 20 platform, 21 trips_count, 22 kilometers, 23 online_hours, 24 cash_collected, 25 gross_earnings, 26 rating, 27 acceptance_rate, 28 cancellation_rate, 29 period_start, 30 period_end 31 `);
31s&&r&&(a=a.gte("period_start",K(s,"yyyy-MM-dd")).lte("period_end",K(r,"yyyy-MM-dd"))),u!=="all"&&(a=a.eq("platform",u));const{data:o,error:x}=await a;if(x)throw x;const{data:v,error:_}=await W.from("employees").select("id, fleet_id, full_name, employee_type, platforms").eq("is_archived",!1).in("employee_type",["driver","courier"]);if(_)throw _;const h={};v==null||v.forEach(t=>{h[t.id]={employee_id:t.id,fleet_id:t.fleet_id,full_name:t.full_name,employee_type:t.employee_type,platforms:t.platforms||[],total_trips:0,total_km:0,total_hours:0,total_cash:0,total_earnings:0,avg_rating:null,avg_acceptance:null,avg_cancellation:null,periods_count:0}});const c={},N={},L={};return o==null||o.forEach(t=>{h[t.employee_id]&&(h[t.employee_id].total_trips+=t.trips_count||0,h[t.employee_id].total_km+=Number(t.kilometers)||0,h[t.employee_id].total_hours+=Number(t.online_hours)||0,h[t.employee_id].total_cash+=Number(t.cash_collected)||0,h[t.employee_id].total_earnings+=Number(t.gross_earnings)||0,h[t.employee_id].periods_count+=1,t.rating&&(c[t.employee_id]||(c[t.employee_id]=[]),c[t.employee_id].push(Number(t.rating))),t.acceptance_rate&&(N[t.employee_id]||(N[t.employee_id]=[]),N[t.employee_id].push(Number(t.acceptance_rate))),t.cancellation_rate&&(L[t.employee_id]||(L[t.employee_id]=[]),L[t.employee_id].push(Number(t.cancellation_rate))))}),Object.keys(h).forEach(t=>{var f,de,me;(f=c[t])!=null&&f.length&&(h[t].avg_rating=c[t].reduce(($,J)=>$+J,0)/c[t].length),(de=N[t])!=null&&de.length&&(h[t].avg_acceptance=N[t].reduce(($,J)=>$+J,0)/N[t].length),(me=L[t])!=null&&me.length&&(h[t].avg_cancellation=L[t].reduce(($,J)=>$+J,0)/L[t].length)}),Object.values(h).sort((t,f)=>t.full_name.localeCompare(f.full_name))}}),I=(l==null?void 0:l.reduce((s,r)=>({trips:s.trips+r.total_trips,km:s.km+r.total_km,hours:s.hours+r.total_hours,cash:s.cash+r.total_cash,earnings:s.earnings+r.total_earnings,driversWithData:s.driversWithData+(r.periods_count>0?1:0)}),{trips:0,km:0,hours:0,cash:0,earnings:0,driversWithData:0}))||{trips:0,km:0,hours:0,cash:0,earnings:0,driversWithData:0},b=l==null?void 0:l.filter(s=>s.total_trips>0).sort((s,r)=>r.total_trips-s.total_trips)[0],E=l==null?void 0:l.filter(s=>s.avg_rating).sort((s,r)=>(r.avg_rating||0)-(s.avg_rating||0))[0],R=l==null?void 0:l.filter(s=>s.avg_cancellation).sort((s,r)=>(r.avg_cancellation||0)-(s.avg_cancellation||0))[0],C=(s,r=0)=>new Intl.NumberFormat("cs-CZ",{maximumFractionDigits:r}).format(s),w=s=>new Intl.NumberFormat("cs-CZ",{style:"currency",currency:"CZK",maximumFractionDigits:0}).format(s);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Výkon flotily"}),e.jsx("p",{className:"text-muted-foreground",children:"PÅehled výkonu vÅ¡ech ÅidiÄů a kurýrů"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(te,{value:y,onValueChange:s=>D(s),children:[e.jsx(ae,{className:"w-[180px]",children:e.jsx(le,{})}),e.jsx(ne,{children:os.map(s=>e.jsx(M,{value:s.value,children:s.label},s.value))})]}),e.jsxs(te,{value:u,onValueChange:s=>
31z(s),children:[e.jsx(ae,{className:"w-[180px]",children:e.jsx(le,{})}),e.jsx(ne,{children:ds.map(s=>e.jsx(M,{value:s.value,children:s.label},s.value))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),"Aktivnà ÅidiÄi"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:I.driversWithData})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4"}),"Celkem jÃzd"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-20"}):e.jsx("div",{className:"text-2xl font-bold",children:C(I.trips)})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Se,{className:"h-4 w-4"}),"Celkem km"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-24"}):e.jsx("div",{className:"text-2xl font-bold",children:C(I.km)})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4"}),"Online hodiny"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-20"}):e.jsx("div",{className:"text-2xl font-bold",children:C(I.hours,1)})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(De,{className:"h-4 w-4"}),"Vybraná hotovost"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-28"}):e.jsx("div",{className:"text-2xl font-bold",children:w(I.cash)})})]}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"}),"Hrubé výdÄlky"]})}),e.jsx(m,{children:g?e.jsx(O,{className:"h-8 w-28"}):e.jsx("div",{className:"text-2xl font-bold",children:w(I.earnings)})})]})]}),!g&&(b||E||R)&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[b&&e.jsxs(d,{className:"border-green-500/20 bg-green-500/5",children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-green-500"}),"NejvÃce jÃzd"]})}),e.jsxs(m,{children:[e.jsx("div",{className:"font-semibold",children:b.full_name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[C(b.total_trips)," jÃzd"]})]})]}),E&&E.avg_rating&&e.jsxs(d,{className:"border-yellow-500/20 bg-yellow-500/5",children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-yellow-500"}),"Nejlepšà hodnocenÃ"]})}),e.jsxs(m,{children:[e.jsx("div",{className:"font-semibold",children:E.full_name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[E.avg_rating.toFixed(2)," â"]})]})]}),R&&R.avg_cancellation&&R.avg_cancellation>5&&e.jsxs(d,{className:"border-red-500/20 bg-red-500/5",children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-red-500"}),"Nejvyššà storno"]})}),e.jsxs(m,{children:[e.jsx("div",{className:"font-semibold",children:R.full_name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[R.avg_cancellation.toFixed(1),"% stornováno"]})]})]})]}),e.jsxs(d,{children:[e.jsx(k,{children:e.jsx(S,{children:"PÅehled podle ÅidiÄů"})}),e.jsx(m,{children:g?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((s,r)=>e.jsx(O,{className:"h-12 w-full"},r))}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(F,{children:[e.jsx(i,{children:"Jméno"}),e.jsx(i,{children:"Typ"}),e.jsx(i,{children:"Platformy"}),e.jsx(i,{className:"text-right",children:"JÃzdy"}),e.jsx(i,{className:"text-right",children:"Km"}),e.jsx(i,{className:"text-right",children:"Hodiny"}),e.jsx(i,{className:"text-right",children:"Hotovost"}),e.jsx(i,{className:"text-right",children:"VýdÄlky"}),e.jsx(i,{className:"text-right",children:"Rating"}),e.jsx(i,{className:"text-right",children:"Accept."}),e.jsx(i,{className:"text-right",children:"Storno"}),e.jsx(i,{})]})}),e.jsxs(ee,{children:[l==null?void 0:l.map(s=>{var r;return e.jsxs(F,{className:"hover:bg-muted/50",children:[e.jsx(n,{className:"font-medium",children:s.full_name}),e.jsx(n,{children:e.jsx(V,{variant:"outline",children:s.employee_type==="driver"?"ÅidiÄ":"Kurýr"})}),e.jsx(n,{children:e.jsx("div",{className:"flex gap-1 flex-wrap",children:(r=s.platforms)==null?void 0:r.map(a=>e.jsx(V,{variant:"secondary",className:"text-xs",children:a},a))})}),e.jsx(n,{className:"text-right",children:s.total_trips>0?C(s.total_trips):"-"}),e.jsx(n,{className:"text-right",children:s.total_km>0?C(s.total_km):"-"}),e.jsx(n,{className:"text-right",children:s.total_hours>0?C(s.total_hours,1):"-"}),e.jsx(n,{className:"text-right",children:s.total_cash>0?w(s.total_cash):"-"}),e.jsx(n,{className:"text-right",children:s.total_earnings>0?w(s.total_earnings):"-"}),e.jsx(n,{className:"text-right",children:s.avg_rating?e.jsxs("span",{className:"flex items-center justify-end gap-1",children:[s.avg_rating.toFixed(2),e.jsx(he,{className:"h-3 w-3 text-yellow-500 fill-yellow-500"})]}):"-"}),e.jsx(n,{className:"text-right",children:s.avg_acceptance?e.jsxs("span",{className:s.avg_acceptance>=85?"text-green-600":s.avg_acceptance>=70?"text-yellow-600":"text-red-600",children:[s.avg_acceptance.toFixed(0),"%"]}):"-"}),e.jsx(n,{className:"text-right",children:s.avg_cancellation?e.jsxs("span",{className:s.avg_cancellation<=5?"text-green-600":s.avg_cancellation<=10?"text-yellow-600":"text-red-600",children:[s.avg_cancellation.toFixed(1),"%"]}):"-"}),e.jsx(n,{children:e.jsx(H,{variant:"ghost",size:"icon",onClick:()=>j(`/admin/employees/${s.fleet_id}`),children:e.jsx(Te,{className:"h-4 w-4"})})})]},s.employee_id)}),(l==null?void 0:l.length)===0&&e.jsx(F,{children:e.jsx(n,{colSpan:12,className:"text-center text-muted-foreground py-8",children:"Žádnà ÅidiÄi nebo kurýÅi nebyli nalezeni"})})]})]})})})]})]})}const xs=()=>{const{data:j,isLoading:y}=re({queryKey:["retentions-overview"],queryFn:async()=>{const{data:l,error:g}=await W.from("employees").select("id, full_name, fleet_id, termination_date, retention_amount, retention_release_date, retention_released").eq("employee_type","driver").or("is_archived.eq.true,status.eq.terminated").not("retention_release_date","is",null).order("retention_release_date",{ascending:!0});if(g)throw g;return l}});if(y)return e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(Ie,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const D=(j==null?void 0:j.filter(l=>!l.retention_released&&l.retention_release_date&&!fe(Q(l.retention_release_date))))||[],u=(j==null?void 0:j.filter(l=>!l.retention_released&&l.retention_release_date&&fe(Q(l.retention_release_date))))||[],z=(j==null?void 0:j.filter(l=>l.retention_released))||[],P=[...D,...u].reduce((l,g)=>l+(g.retention_amount||2e3),0);return e.jsxs("div",{className:"space-y-4 lg:space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-display tracking-wide",children:"Zádržné â pÅehled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Evidence zádržného ukonÄených ÅidiÄů (1 rok retence)"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(_e,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[new Intl.NumberFormat("cs-CZ").format(P)," KÄ"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Celkem zadrženo"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-muted flex items-center justify-center",children:e.jsx(A,{className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:D.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktivnà retence"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-destructive/10 flex items-center justify-center",children:e.jsx(X,{className:"h-6 w-6 text-destructive"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:u.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"K uvolnÄnÃ"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-green-500/10 flex items-center justify-center",children:e.jsx(Fe,{className:"h-6 w-6 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:z.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Vyplaceno"})]})]})})})]}),u.length>0&&e.jsxs(d,{className:"border-destructive/50",children:[e.jsx(k,{children:e.jsxs(S,{className:"flex items-center gap-2 text-destructive",children:[e.jsx(X,{className:"h-5 w-5"}),"K uvolnÄnà â termÃn uplynul"]})}),e.jsx(m,{children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(F,{children:[e.jsx(i,{children:"ÅidiÄ"}),e.jsx(i,{children:"UkonÄenÃ"}),e.jsx(i,{children:"UvolnÄnÃ"}),e.jsx(i,{children:"Äástka"})]})}),e.jsx(ee,{children:u.map(l=>e.jsxs(F,{children:[e.jsx(n,{className:"font-medium",children:l.full_name}),e.jsx(n,{children:l.termination_date?U(l.termination_date):"-"}),e.jsx(n,{children:e.jsx(V,{variant:"destructive",children:U(l.retention_release_date)})}),e.jsxs(n,{className:"font-medium",children:[l.retention_amount||2e3," KÄ"]})]},l.id))})]})})]}),D.length>0&&e.jsxs(d,{children:[e.jsx(k,{children:e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5"}),"Aktivnà retence"]})}),e.jsx(m,{children:e.jsxs(Y,{children:[e.jsx(G,{children:e.jsxs(F,{children:[e.jsx(i,{children:"ÅidiÄ"}),e.jsx(i,{children:"UkonÄenÃ"}),e.jsx(i,{children:"UvolnÄnÃ"}),e.jsx(i,{children:"Zbývá"}),e.jsx(i,{children:"Äástka"})]})}
31),e.jsx(ee,{children:D.map(l=>{const g=es(Q(l.retention_release_date),new Date);return e.jsxs(F,{children:[e.jsx(n,{className:"font-medium",children:l.full_name}),e.jsx(n,{children:l.termination_date?U(l.termination_date):"-"}),e.jsx(n,{children:U(l.retention_release_date)}),e.jsx(n,{children:e.jsxs(V,{variant:g<=30?"secondary":"outline",children:[g," dnÃ"]})}),e.jsxs(n,{className:"font-medium",children:[l.retention_amount||2e3," KÄ"]})]},l.id)})})]})})]})]})},se={new:{label:"Nová",variant:"destructive",icon:X},assigned:{label:"PÅiÅazena",variant:"secondary",icon:A},deducted:{label:"Stržena",variant:"outline",icon:ye},paid_to_authority:{label:"Uhrazena",variant:"default",icon:we}};function hs(){const j=Ce(),[y,D]=T.useState(""),[u,z]=T.useState("all"),[P,l]=T.useState("all"),[g,I]=T.useState(!1),{data:b=[],isLoading:E}=re({queryKey:["all-fines"],queryFn:async()=>{const{data:s,error:r}=await W.from("employee_fines").select(` 32 id, fine_date, amount, description, license_plate, reference_number, 33 received_date, due_date, status, deducted_at, deducted_from, 34 paid_to_authority_at, notes, created_at, employee_id, 35 bank_account, variable_symbol, constant_symbol, specific_symbol, 36 document_path, document_name, 37 employees (full_name, fleet_id, employee_type, status) 38 `).order("fine_date",{ascending:!1});if(r)throw r;return s||[]}}),R=T.useMemo(()=>b.filter(s=>{var r,a,o,x,v,_,h,c;if(y){const N=y.toLowerCase();if(!(((a=(r=s.employees)==null?void 0:r.full_name)==null?void 0:a.toLowerCase().includes(N))||((x=(o=s.employees)==null?void 0:o.fleet_id)==null?void 0:x.toLowerCase().includes(N))||((v=s.license_plate)==null?void 0:v.toLowerCase().includes(N))||((_=s.description)==null?void 0:_.toLowerCase().includes(N))||((h=s.reference_number)==null?void 0:h.toLowerCase().includes(N))))return!1}return!(u!=="all"&&s.status!==u||P!=="all"&&((c=s.employees)==null?void 0:c.employee_type)!==P)}),[b,y,u,P]),C=T.useMemo(()=>{const s=b.length,r=b.filter(x=>x.status==="assigned"||x.status==="new").length,a=b.filter(x=>x.status==="deducted").length,o=b.filter(x=>x.status==="assigned"||x.status==="new").reduce((x,v)=>x+v.amount,0);return{total:s,pending:r,deducted:a,totalAmount:o}},[b]),w=y||u!=="all"||P!=="all";return E?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[1,2,3,4].map(s=>e.jsx(O,{className:"h-24"},s))}),e.jsx(O,{className:"h-96"})]}):e.jsx(Ue,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(d,{children:e.jsx(m,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(be,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:C.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Celkem pokut"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-amber-500/10 flex items-center justify-center",children:e.jsx(A,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:C.pending}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"NevyÅÃzených"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-green-500/10 flex items-center justify-center",children:e.jsx(we,{className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:C.deducted}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Stržených"})]})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-destructive/10 flex items-center justify-center",children:e.jsx(X,{className:"h-5 w-5 text-destructive"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:C.totalAmount.toLocaleStr
38ing("cs-CZ")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"KÄ k ÅeÅ¡enÃ"})]})]})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Ee,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(He,{placeholder:"Hledat ÅidiÄe, SPZ, popis, Ä. jednacÃ...",value:y,onChange:s=>D(s.target.value),className:"pl-9"})]}),e.jsxs(te,{value:u,onValueChange:z,children:[e.jsx(ae,{className:"w-[150px]",children:e.jsx(le,{placeholder:"Stav"})}),e.jsxs(ne,{children:[e.jsx(M,{value:"all",children:"VÅ¡echny stavy"}),e.jsx(M,{value:"assigned",children:"PÅiÅazené"}),e.jsx(M,{value:"deducted",children:"Stržené"}),e.jsx(M,{value:"paid_to_authority",children:"Uhrazené"})]})]}),e.jsxs(te,{value:P,onValueChange:l,children:[e.jsx(ae,{className:"w-[140px]",children:e.jsx(le,{placeholder:"Typ"})}),e.jsxs(ne,{children:[e.jsx(M,{value:"all",children:"VÅ¡echny typy"}),e.jsx(M,{value:"driver",children:"ÅidiÄi"}),e.jsx(M,{value:"courier",children:"KurýÅi"})]})]}),w&&e.jsxs(H,{variant:"ghost",size:"sm",onClick:()=>{D(""),z("all"),l("all")},className:"gap-1",children:[e.jsx(ze,{className:"h-4 w-4"}),"Vymazat"]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(H,{onClick:()=>I(!0),className:"gap-2",children:[e.jsx(Oe,{className:"h-4 w-4"}),"Nová pokuta"]})})]})})}),e.jsxs(d,{children:[e.jsx(k,{className:"pb-2",children:e.jsxs(S,{className:"text-base",children:["Pokuty (",R.length,")"]})}),e.jsx(m,{className:"p-0",children:R.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:w?"Žádné pokuty odpovÃdajÃcà filtrům":"Žádné pokuty v systému"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"md:hidden divide-y",children:R.map(s=>{var o,x,v;const r=se[s.status]||se.assigned,a=r.icon;return e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("button",{className:"font-medium text-sm hover:underline text-left truncate block",onClick:()=>{var _;(_=s.employees)!=null&&_.fleet_id&&j(`/admin/employees/${s.employees.fleet_id}`)},children:((o=s.employees)==null?void 0:o.full_name)||"Neznámý"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(x=s.employees)==null?void 0:x.fleet_id,((v=s.employees)==null?void 0:v.status)==="terminated"&&e.jsx(V,{variant:"outline",className:"ml-1 text-[10px] px-1 py-0",children:"ukonÄen"})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsxs("div",{className:"font-semibold text-destructive whitespace-nowrap",children:[s.amount.toLocaleString("cs-CZ")," KÄ"]}),e.jsxs(V,{variant:r.variant,className:"gap-1 text-[10px] mt-1",children:[e.jsx(a,{className:"h-3 w-3"}),r.label]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Datum: "}),U(s.fine_date)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"SPZ: "}),e.jsx("span",{className:"font-mono",children:s.license_plate||"â"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Popis: "}),s.description]}),s.reference_number&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Ä. jednacÃ: "}),s.reference_number]}),s.deducted_from&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Strženo z: "}),s.deducted_from==="payroll"&&"Výplata",s.deducted_from==="deposit"&&"Kauce",s.deducted_from==="retention"&&"Zádržné"]})]})]},s.id)})}),e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs(Y,{minWidth:1100,children:[e.jsx(G,{children:e.jsxs(F,{children:[e.jsx(i,{children:"ÅidiÄ / Kurýr"}),e.jsx(i,{children:"Datum"}),e.jsx(i,{children:"SPZ"}),e.jsx(i,{children:"Popis"}),e.jsx(i,{children:"Ä. jednacÃ"}),e.jsx(i,{className:"text-right",children:"Äástka"}),e.jsx(i,{children:"Stav"}),e.jsx(i,{children:"Strženo z"})]})}),e.jsx(ee,{children:R.map(s=>{var o,x,v;const r=se[s.status]||se.assigned,a=r.icon;return e.jsxs(F,{className:"group",children:[e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-7 w-7 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Le,{className:"h-3.5 w-3.5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("button",{className:"font-medium text-sm hover:underline text-left truncate block",onClick:()=>{var _;(_=s.employees)!=null&&_.fleet_id&&j(`/admin/employees/${s.employees.fleet_id}`)},children:((o=s.employees)==null?void 0:o.full_name)||"Neznámý"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(x=s.employees)==null?void 0:x.fleet_id,((v=s.employees)==null?void 0:v.status)==="terminated"&&e.jsx(V,{variant:"outline",className:"ml-1 text-[10px] px-1 py-0",children:"ukonÄen"})]})]})]})}),e.jsx(n,{className:"text-sm whitespace-nowrap",children:U(s.fine_date)}),e.jsx(n,{children:s.license_plate?e.jsx("span",{className:"font-mono text-sm",children:s.license_plate}):e.jsx("span",{className:"text-muted-foreground",children:"â"})}),e.jsx(n,{className:"max-w-[200px]",children:e.jsxs(Ae,{children:[e.jsx(We,{asChild:!0,children:e.jsx("span",{className:"text-sm truncate block",children:s.description})}),e.jsxs($e,{side:"top",className:"max-w-xs",children:[e.jsx("p",{children:s.description}),s.notes&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s.notes})]})]})}),e.jsx(n,{className:"text-sm text-muted-foreground",children:s.reference_number||"â"}),e.jsxs(n,{className:"text-right font-medium text-destructive whitespace-nowrap",children:[s.amount.toLocaleStr
38ing("cs-CZ")," KÄ"]}),e.jsx(n,{children:e.jsxs(V,{variant:r.variant,className:"gap-1 text-xs",children:[e.jsx(a,{className:"h-3 w-3"}),r.label]})}),e.jsxs(n,{className:"text-xs text-muted-foreground",children:[s.deducted_from==="payroll"&&"Výplata",s.deducted_from==="deposit"&&"Kauce",s.deducted_from==="retention"&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_e,{className:"h-3 w-3"}),"Zádržné"]}),!s.deducted_from&&"â"]})]},s.id)})})]})})]})})]}),e.jsx(ls,{open:g,onOpenChange:I})]})})}const us=[{id:"report",label:"Report",icon:Me},{id:"drivers",label:"ÅidiÄi",icon:oe},{id:"couriers",label:"KurýÅi",icon:Be},{id:"hourly",label:"Hodinovka",icon:A},{id:"performance",label:"Výkon",icon:Ke},{id:"retention",label:"Zádržné",icon:ve},{id:"fines",label:"Pokuty",icon:be},{id:"fuel-receipts",label:"ÃÄtenky",icon:Ve}];function _t(){const[j,y]=qe(),D=j.get("tab")||"report",{orderedTabs:u,reorder:z}=rs("payroll-page",us),P=l=>{y({tab:l})};return e.jsx("div",{className:"flex flex-col min-h-0 flex-1",children:e.jsxs(Ze,{value:D,onValueChange:P,className:"flex flex-col min-h-0 flex-1",children:[e.jsx(is,{tabs:u,onReorder:z}),e.jsx(B,{value:"report",className:"flex-1 min-h-0 mt-4",children:e.jsx(cs,{})}),e.jsx(B,{value:"drivers",className:"flex-1 min-h-0 mt-4",children:e.jsx(ss,{})}),e.jsx(B,{value:"couriers",className:"flex-1 min-h-0 mt-4",children:e.jsx(ts,{})}),e.jsx(B,{value:"hourly",className:"flex-1 min-h-0 mt-4",children:e.jsx(ns,{})}),e.jsx(B,{value:"performance",className:"flex-1 min-h-0 mt-4",children:e.jsx(ms,{})}),e.jsx(B,{value:"retention",className:"flex-1 min-h-0 mt-4",children:e.jsx(xs,{})}),e.jsx(B,{value:"fines",className:"flex-1 min-h-0 mt-4",children:e.jsx(hs,{})}),e.jsx(B,{value:"fuel-receipts",className:"flex-1 min-h-0 mt-4",children:e.jsx(as,{})})]})})}export{_t 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.