PageSourceSearch

https://luxuryridesdenver.base44.app/assets/DriverEarnings-Dg4eEOGp.js

js luxuryridesdenver.base44.app collected 2026-10-03 03:16:21 UTC 10,094 bytes, 1 lines download raw bytes

1import{x as p,u as w,j as e,f as S,T as B,i as R,C as d,b as l,z as g,D as h,aB as C,m as F,k as L,g as U,n as i}from"./index-Bk9vt8H7.js";import{C as D}from"./circle-check-big-BTnJVbQB.js";import{C as q}from"./credit-card-D77iQtOm.js";function Q(){var v,y,_;const[M,$]=p.useState(null),[t,E]=p.useState(null);p.useEffect(()=>{(async()=>{const r=await i.auth.me();$(r);const u=(await i.entities.Driver.list()).find(P=>P.email===r.email);E(u)})()},[]);const{data:k}=w({queryKey:["driver-bookings-earnings",t==null?void 0:t.id],queryFn:()=>i.entities.Booking.filter({driver_id:t.id},"-completed_at"),initialData:[],enabled:!!t}),{data:c}=w({queryKey:["driver-payouts",t==null?void 0:t.id],queryFn:()=>i.entities.Payout.filter({driver_id:t.id},"-created_date"),initialData:[],enabled:!!t});if(!t)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("div",{className:"text-foreground",children:"Loading..."})});const a=k.filter(s=>s.status==="completed"),o=a.reduce((s,r)=>s+r.total_amount,0),j=a.reduce((s,r)=>s+(r.tip_amount||0),0),n=t.commission_rate||20,b=o*n/100,N=o-b,x=N+j,f=c.filter(s=>s.status==="paid").reduce((s,r)=>s+r.total_payout,0),T=[{title:"Pending Earnings",value:`$${(x-f).toFixed(2)}`,icon:S,color:"text-yellow-500",bgColor:"bg-yellow-500/20"},{title:"Total Paid",value:`$${f.toFixed(2)}`,icon:D,color:"text-green-500",bgColor:"bg-green-500/20"},{title:"Lifetime Earnings",value:`$${x.toFixed(2)}`,icon:B,color:"text-blue-500",bgColor:"bg-blue-500/20"},{title:"Completed Trips",value:a.length,icon:R,color:"text-purple-500",bgColor:"bg-purple-500/20"}],A={pending:"bg-yellow-500/20 text-yellow-500",processing:"bg-blue-500/20 text-blue-500",paid:"bg-green-500/20 text-green-500",failed:"bg-red-500/20 text-red-500"};return e.jsx("div",{className:"min-h-screen bg-background p-4 md:p-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-2",children:"My Earnings"}),e.jsx("p",{className:"text-muted-foreground",children:"Track your income and payout history"})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:T.map((s,r)=>e.jsx(d,{className:"bg-card border-border",children:e.jsxs(l,{className:"p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsx("div",{className:`p-3 rounded-lg ${s.bgColor}`,children:e.jsx(s.icon,{className:`w-6 h-6 ${s.color}`})})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:s.title}),e.jsx("p",{className:"text-3xl font-bold text-foreground",children:s.value})]})},r))}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[e.jsxs(d,{className:"bg-card border-border",children:[e.jsx(g,{className:"border-b border-border",children:e.jsxs(h,{className:"text-foreground flex items-center gap-2",children:[e.jsx(C,{className:"w-5 h-5 text-[#D4AF37]"}),"Earnings Breakdown"]})}),e.jsxs(l,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[e.jsx("span",{className:"text-muted-foreground",children:"Gross Trip Revenue"}),e.jsxs("span",{className:"text-foreground font-semibold",children:["$",o.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Platform Commission (",n,"%)"]}),e.jsxs("span",{className:"text-red-400",children:["-$",b.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[e.jsx("span",{className:"text-muted-foreground",children:"Net Earnings"}),e.jsxs("span",{className:"text-foreground font-semibold",children:["$",N.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[e.jsx("span",{className:"text-muted-foreground",children:"Tips Received"}),e.jsxs("span",{className:"text-green-400",children:["+$",j.toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between items-center py-4 bg-muted rounded-lg px-4",children:[e.jsx("span",{className:"text-foreground font-semibold text-lg",children:"Total Earnings"}),e.jsxs("span",{className:"text-[#D4AF37] font-bold text-2xl",children:["$",x.toFixed(2)]})]}),e.jsx("div",{className:"mt-4 p-4 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:e.jsxs("p",{className:"text-sm text-blue-400",children:["💡 Your commission rate is ",n,"%. For every $100 earned, you keep $",(100-n).toFixed(0)," plus all tips."]})})]})]}),e.jsxs(d,{className:"bg-card border-border",children:[e.jsx(g,{className:"border-b border-border",children:e.jsx(h,{className:"text-foreground",children:"Payout History"})}),e.jsx(l,{className:"p-6",children:c.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(C,{className:"w-12 h-12 text-[#D4AF37] mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No payouts yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Complete trips to start earning!"})]}):e.jsx("div",{className:"space-y-4",children:c.map(s=>e.jsxs("div",{className:"bg-muted rounded-lg p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-foreground font-medium",children:["$",s.total_payout.toFixed(2)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[new Date(s.period_start).toLocaleDateString()," - ",new Date(s.period_end).toLocaleDateString()]})]}),e.jsx(F,{className:A[s.status],children:s.status})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs mt-3 pt-3 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Trips"}),e.jsx("p",{className:"text-foreground",children:s.total_trips})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Method"}),e.jsx("p",{className:"text-foreground",children:s.payment_method})]})]}),s.paid_at&&e.jsxs("p",{className:"text-xs text-green-400 mt-2",children:["Paid on ",new Date(s.paid_at).toLocaleDateString()]})]},s.id))})})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-foreground mb-3 flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5 text-[#D4AF37]"}),"Payment Method"]}),e.jsx(d,{className:"bg-muted border-border",children:e.jsx(l,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Method:"}),e.jsx(F,{className:"bg-[#D4AF37]/20 text-[#D4AF37]",children:(v=t.payment_method)==null?void 0:v.replace(/_/g," ").toUpperCase()})]}),t.payment_method==="bank_transfer"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(L,{className:"w-4 h-4 text-green-400"}),e.jsx("span",{className:"text-green-400",children:"Bank details encrypted"})]}),e.jsxs("div",{className:"bg-card rounded p-3 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Account Holder:"}),e.jsx("span",{className:"text-foreground",children:t.bank_account_name})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Account Type:"}),e.jsx("span",{className:"text-foreground capitalize",children:t.bank_account_type})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Routing:"}),e.jsxs("span",{className:"text-foreground font-mono",children:["••••••",((y=t.bank_routing_number)==null?void 0:y.slice(-4))||"••••"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Account:"}),e.jsxs("span",{className:"text-foreground font-mono",children:["••••••••",((_=t.bank_account_number)==null?void 0:_.slice(-4))||"••••"]})]}),t.bank_verified?e.jsxs("div",{className:"flex items-center gap-2 text-green-400 pt-2",children:[e.jsx(D,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Verified"})]}):e.jsxs("div",{className:"flex items-center gap-2 text-yellow-400 pt-2",children:[e.jsx(U,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Pending verification"})]})]})]}),t.payment_method==="paypal"&&e.jsx("div",{className:"bg-card rounded p-3",children:e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"PayPal Email:"}),e.jsx("span",{className:"text-foreground",children:t.paypal_email})]})})]})})})]}),e.jsxs(d,{className:"bg-card border-border mt-6",children:[e.jsx(g,{className:"border-b border-border",children:e.jsx(h,{className:"text-foreground",children:"Recent 
1Completed Trips"})}),e.jsx(l,{className:"p-6",children:a.length===0?e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-muted-foreground",children:"No completed trips yet"})}):e.jsx("div",{className:"space-y-3",children:a.slice(0,10).map(s=>{const r=s.total_amount*(1-n/100),m=s.tip_amount||0,u=r+m;return e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border last:border-0",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-foreground font-medium",children:["#",s.booking_number]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.customer_name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(s.completed_at).toLocaleDateString()})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-[#D4AF37] font-semibold",children:["$",u.toFixed(2)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["$",r.toFixed(2)," + $",m.toFixed(2)," tip"]})]})]},s.id)})})})]})]})})}export{Q 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.