import React, { useState, useEffect } from 'react'; // Header and SubHeader are now part of the global Layout import { Wallet, TrendingUp, ArrowUpRight, ArrowDownRight, DollarSign, Activity, ShoppingCart, Package, AlertTriangle, Plus, History } from 'lucide-react'; export default function ReceptionistDashboard() { const [stats, setStats] = useState({ total_income: 0, total_expenses: 0, net_profit: 0, low_stock_count: 0 }); const [transactions, setTransactions] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const fetchDashboardData = async () => { try { const response = await fetch('/api/reports/profit'); const data = await response.json(); setStats({ total_income: data.total_income || 0, total_expenses: data.total_expense || 0, net_profit: data.net_profit || 0, low_stock_count: data.low_stock_count || 0 }); setTransactions(data.transactions || []); } catch (error) { console.error('Error fetching dashboard data:', error); } finally { setLoading(false); } }; fetchDashboardData(); }, []); const StatCard = ({ title, amount, icon: Icon, color, trend, iconColor, bgColor, textColor, label }) => (
{trend && (
{trend >= 0 ? : ''} {trend}%
)} {label && (
{label}
)}

{(amount || 0).toLocaleString('en-AE', { minimumFractionDigits: 0 })} {title === 'Low Stock Items' ? '' : 'AED'}

{title}

); const QuickAction = ({ icon: Icon, label, color, sublabel, path }) => ( ); if (loading) { return (
); } return (
{/* Welcome Section */}

Receptionist Dashboard

{/* Stats Grid */}
{/* Quick Actions */}

Quick Actions

{/* Recent Transactions Table */}

Recent Transactions

{transactions.length > 0 ? ( transactions.map((tx, idx) => ( )) ) : ( )}
Date & Time Description Type Amount
{tx.date} {tx.time}

{tx.description}

0 ? 'bg-red-50 text-red-600' : 'bg-emerald-50 text-emerald-600' }`}> {tx.debit > 0 ? 'DEBITED' : 'RECEIVED'} 0 ? 'text-red-500' : 'text-emerald-500'}`}> {tx.debit > 0 ? '-' : '+'} {(tx.debit || tx.credit || 0).toLocaleString('en-AE', { minimumFractionDigits: 2 })} AED

No transactions found

); }