import { getCurrentUser } from "@/lib/auth" import { getJobsByPlumberId, getPlumberEarnings } from "@/lib/plumber-jobs" import StatsCard from "@/components/dashboard/stats-card" import JobCard from "@/components/plumber/job-card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Briefcase, DollarSign, Star, Clock, TrendingUp, Calendar, CheckCircle } from "lucide-react" import Link from "next/link" export default async function PlumberDashboard() { const user = await getCurrentUser() const jobs = user ? getJobsByPlumberId(user.id) : [] const earnings = user ? getPlumberEarnings(user.id) : null const pendingJobs = jobs.filter((job) => job.status === "pending") const todayJobs = jobs.filter((job) => { const today = new Date().toISOString().split("T")[0] return job.scheduledDate === today }) const upcomingJobs = jobs.filter((job) => { const today = new Date().toISOString().split("T")[0] return job.scheduledDate > today && job.status === "accepted" }) return (
{/* Welcome Section */}

مرحباً، {user?.name}

إليك نظرة عامة على مهامك وأرباحك

{/* Stats Cards */}
{/* Earnings Overview */} {earnings && (

الأرباح الإجمالية

{earnings.totalEarnings} جنيه

أرباح هذا الشهر

{earnings.monthlyEarnings} جنيه

أرباح هذا الأسبوع

{earnings.weeklyEarnings} جنيه

)}
{/* Pending Jobs */} المهام المعلقة ({pendingJobs.length}) {pendingJobs.length > 0 ? (
{pendingJobs.slice(0, 3).map((job) => ( ))}
) : (

لا توجد مهام معلقة

)}
{/* Today's Jobs */} مهام اليوم ({todayJobs.length}) {todayJobs.length > 0 ? (
{todayJobs.map((job) => ( ))}
) : (

لا توجد مهام مجدولة اليوم

)}
{/* Quick Actions */} إجراءات سريعة
) }