unzip frontend
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect } from "react"
|
||||
|
||||
// Mock data types
|
||||
interface KPIs {
|
||||
totalRevenue: number
|
||||
revenueGrowth: number
|
||||
activeProducts: number
|
||||
lowStockItems: number
|
||||
activeClients: number
|
||||
newClientsThisMonth: number
|
||||
profitMargin: number
|
||||
marginImprovement: number
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
id: string
|
||||
client: string
|
||||
product: string
|
||||
amount: number
|
||||
status: "paid" | "pending" | "overdue"
|
||||
date: string
|
||||
}
|
||||
|
||||
interface Product {
|
||||
id: string
|
||||
name: string
|
||||
category: string
|
||||
unitsSold: number
|
||||
revenue: number
|
||||
}
|
||||
|
||||
interface ClientCredit {
|
||||
id: string
|
||||
name: string
|
||||
outstandingAmount: number
|
||||
daysOverdue: number
|
||||
lastPayment: string
|
||||
}
|
||||
|
||||
interface SupplierCredit {
|
||||
id: string
|
||||
name: string
|
||||
amountOwed: number
|
||||
status: "current" | "overdue"
|
||||
nextPayment: string
|
||||
}
|
||||
|
||||
// Mock data - in a real app, this would come from your database
|
||||
const mockKPIs: KPIs = {
|
||||
totalRevenue: 125000,
|
||||
revenueGrowth: 12.5,
|
||||
activeProducts: 156,
|
||||
lowStockItems: 8,
|
||||
activeClients: 42,
|
||||
newClientsThisMonth: 6,
|
||||
profitMargin: 28.5,
|
||||
marginImprovement: 3.2,
|
||||
}
|
||||
|
||||
const mockTransactions: Transaction[] = [
|
||||
{
|
||||
id: "1",
|
||||
client: "ABC Electronics",
|
||||
product: "Wireless Headphones",
|
||||
amount: 2500,
|
||||
status: "paid",
|
||||
date: "2024-01-15",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
client: "Tech Solutions Inc",
|
||||
product: "Laptop Chargers",
|
||||
amount: 1800,
|
||||
status: "pending",
|
||||
date: "2024-01-14",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
client: "Mobile World",
|
||||
product: "Phone Cases",
|
||||
amount: 950,
|
||||
status: "paid",
|
||||
date: "2024-01-13",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
client: "Digital Store",
|
||||
product: "USB Cables",
|
||||
amount: 650,
|
||||
status: "overdue",
|
||||
date: "2024-01-12",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
client: "Gadget Hub",
|
||||
product: "Power Banks",
|
||||
amount: 3200,
|
||||
status: "paid",
|
||||
date: "2024-01-11",
|
||||
},
|
||||
]
|
||||
|
||||
const mockTopProducts: Product[] = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Wireless Headphones",
|
||||
category: "Audio",
|
||||
unitsSold: 145,
|
||||
revenue: 14500,
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Phone Cases",
|
||||
category: "Accessories",
|
||||
unitsSold: 230,
|
||||
revenue: 11500,
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Power Banks",
|
||||
category: "Electronics",
|
||||
unitsSold: 89,
|
||||
revenue: 8900,
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
name: "USB Cables",
|
||||
category: "Accessories",
|
||||
unitsSold: 156,
|
||||
revenue: 7800,
|
||||
},
|
||||
]
|
||||
|
||||
const mockClientsWithCredit: ClientCredit[] = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Tech Solutions Inc",
|
||||
outstandingAmount: 4500,
|
||||
daysOverdue: 15,
|
||||
lastPayment: "2023-12-20",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Digital Store",
|
||||
outstandingAmount: 2800,
|
||||
daysOverdue: 45,
|
||||
lastPayment: "2023-11-30",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Mobile Mart",
|
||||
outstandingAmount: 1200,
|
||||
daysOverdue: 8,
|
||||
lastPayment: "2024-01-05",
|
||||
},
|
||||
]
|
||||
|
||||
const mockSuppliersWithCredit: SupplierCredit[] = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Electronics Wholesale Co",
|
||||
amountOwed: 8500,
|
||||
status: "current",
|
||||
nextPayment: "2024-01-25",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "Global Tech Supplies",
|
||||
amountOwed: 3200,
|
||||
status: "overdue",
|
||||
nextPayment: "2024-01-10",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
name: "Premium Components Ltd",
|
||||
amountOwed: 5600,
|
||||
status: "current",
|
||||
nextPayment: "2024-01-30",
|
||||
},
|
||||
]
|
||||
|
||||
export function useBusinessData() {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [kpis, setKpis] = useState<KPIs>(mockKPIs)
|
||||
const [recentTransactions, setRecentTransactions] = useState<Transaction[]>(mockTransactions)
|
||||
const [topProducts, setTopProducts] = useState<Product[]>(mockTopProducts)
|
||||
const [clientsWithCredit, setClientsWithCredit] = useState<ClientCredit[]>(mockClientsWithCredit)
|
||||
const [suppliersWithCredit, setSuppliersWithCredit] = useState<SupplierCredit[]>(mockSuppliersWithCredit)
|
||||
|
||||
useEffect(() => {
|
||||
// Simulate loading data
|
||||
const timer = setTimeout(() => {
|
||||
setLoading(false)
|
||||
}, 1000)
|
||||
|
||||
return () => clearTimeout(timer)
|
||||
}, [])
|
||||
|
||||
return {
|
||||
kpis,
|
||||
recentTransactions,
|
||||
topProducts,
|
||||
clientsWithCredit,
|
||||
suppliersWithCredit,
|
||||
loading,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user