Add full FOCO investor management system with CRUD, investments, and transactions

This commit is contained in:
sazzadulalambd
2026-04-22 01:02:45 +06:00
parent 5338038ea2
commit dab0c11b15
32 changed files with 7673 additions and 89 deletions

View File

@@ -0,0 +1,104 @@
import { Package, Truck, MapPin, Clock, Check, Play, Phone } from 'lucide-react';
import { deliveries } from '@/data/mockData';
const statusColors: Record<string, string> = {
pending: 'bg-amber-100 text-amber-700',
in_progress: 'bg-blue-100 text-blue-700',
completed: 'bg-green-100 text-green-700',
};
export default function ShopDeliveriesPage() {
const pending = deliveries.filter(d => d.status === 'pending').length;
const inProgress = deliveries.filter(d => d.status === 'in_progress').length;
const completed = deliveries.filter(d => d.status === 'completed').length;
return (
<div className="p-4 lg:p-6">
<div className="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-6">
<div>
<h1 className="text-2xl lg:text-3xl font-extrabold text-slate-800">Deliveries</h1>
<p className="text-sm text-slate-500 mt-1">Track and manage deliveries</p>
</div>
</div>
<div className="grid grid-cols-3 gap-4 mb-6">
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<div className="flex items-center gap-3">
<div className="w-12 h-12 rounded-xl bg-amber-50 flex items-center justify-center">
<Clock className="w-6 h-6 text-amber-600" />
</div>
<div>
<p className="text-2xl font-extrabold text-slate-800">{pending}</p>
<p className="text-sm text-slate-500">Pending</p>
</div>
</div>
</div>
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<div className="flex items-center gap-3">
<div className="w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center">
<Play className="w-6 h-6 text-blue-600" />
</div>
<div>
<p className="text-2xl font-extrabold text-slate-800">{inProgress}</p>
<p className="text-sm text-slate-500">In Progress</p>
</div>
</div>
</div>
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<div className="flex items-center gap-3">
<div className="w-12 h-12 rounded-xl bg-green-50 flex items-center justify-center">
<Check className="w-6 h-6 text-green-600" />
</div>
<div>
<p className="text-2xl font-extrabold text-slate-800">{completed}</p>
<p className="text-sm text-slate-500">Completed</p>
</div>
</div>
</div>
</div>
<div className="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
<div className="px-5 py-4 border-b border-slate-100">
<h2 className="font-bold text-slate-800">All Deliveries</h2>
</div>
<div className="divide-y divide-slate-50">
{deliveries.map(delivery => (
<div key={delivery.id} className="p-5 hover:bg-slate-50 transition-colors">
<div className="flex flex-col lg:flex-row lg:items-center gap-4">
<div className="flex items-center gap-4 lg:w-48">
<div className="w-10 h-10 rounded-full bg-slate-100 flex items-center justify-center">
<Truck className="w-5 h-5 text-slate-600" />
</div>
<div>
<p className="font-semibold text-slate-800">{delivery.id}</p>
<p className="text-xs text-slate-400">{delivery.createdAt}</p>
</div>
</div>
<div className="flex-1">
<div className="flex items-center gap-2 text-sm text-slate-600">
<MapPin className="w-4 h-4 text-green-500" />
<span>{delivery.pickupLocation}</span>
</div>
<div className="flex items-center gap-2 text-sm text-slate-400 mt-1">
<span></span>
<span>{delivery.dropoffLocation}</span>
</div>
</div>
<div className="flex items-center gap-3">
<span className={`inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1 rounded-full ${statusColors[delivery.status]}`}>
{delivery.status.replace('_', ' ')}
</span>
{delivery.status !== 'completed' && (
<button className="p-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
<Phone className="w-4 h-4" />
</button>
)}
</div>
</div>
</div>
))}
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,93 @@
import { Bike, MapPin, Battery, User, MoreVertical } from 'lucide-react';
import { bikes } from '@/data/mockData';
const rentedBikes = bikes.filter(b => b.status === 'rented');
export default function ShopFleetPage() {
return (
<div className="p-4 lg:p-6">
<div className="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4 mb-6">
<div>
<h1 className="text-2xl lg:text-3xl font-extrabold text-slate-800">Fleet Status</h1>
<p className="text-sm text-slate-500 mt-1">View assigned bikes and their status</p>
</div>
</div>
<div className="grid grid-cols-3 gap-4 mb-6">
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<p className="text-2xl font-extrabold text-slate-800">{rentedBikes.length}</p>
<p className="text-sm text-slate-500">Rented Out</p>
</div>
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<p className="text-2xl font-extrabold text-slate-800">
{rentedBikes.filter(b => b.batteryLevel > 50).length}
</p>
<p className="text-sm text-slate-500">Good Battery</p>
</div>
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<p className="text-2xl font-extrabold text-slate-800">
{rentedBikes.filter(b => b.batteryLevel <= 50).length}
</p>
<p className="text-sm text-slate-500">Low Battery</p>
</div>
</div>
<div className="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
<div className="px-5 py-4 border-b border-slate-100">
<h2 className="font-bold text-slate-800">Assigned Bikes</h2>
</div>
<div className="overflow-x-auto">
<table className="w-full">
<thead className="bg-slate-50">
<tr>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Bike</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Plate</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Rider</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Location</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Battery</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Actions</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-50">
{rentedBikes.map(bike => (
<tr key={bike.id} className="hover:bg-slate-50">
<td className="px-4 py-3">
<div className="flex items-center gap-3">
<Bike className="w-5 h-5 text-slate-400" />
<span className="text-sm font-medium text-slate-700">{bike.model}</span>
</div>
</td>
<td className="px-4 py-3 text-sm text-slate-600">{bike.plateNumber}</td>
<td className="px-4 py-3">
<div className="flex items-center gap-2">
<User className="w-4 h-4 text-slate-400" />
<span className="text-sm text-slate-600">{bike.assignedTo}</span>
</div>
</td>
<td className="px-4 py-3">
<div className="flex items-center gap-1 text-sm text-slate-600">
<MapPin className="w-3 h-3" /> {bike.location}
</div>
</td>
<td className="px-4 py-3">
<div className="flex items-center gap-2">
<Battery className={`w-4 h-4 ${bike.batteryLevel > 50 ? 'text-green-600' : 'text-amber-600'}`} />
<span className={`text-sm font-medium ${bike.batteryLevel > 50 ? 'text-green-600' : 'text-amber-600'}`}>
{bike.batteryLevel}%
</span>
</div>
</td>
<td className="px-4 py-3">
<button className="p-2 hover:bg-slate-100 rounded-lg">
<MoreVertical className="w-4 h-4 text-slate-400" />
</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
);
}

110
src/app/shop/page.tsx Normal file
View File

@@ -0,0 +1,110 @@
import StatCard from '@/components/StatCard';
import { stats, deliveries, bikes } from '@/data/mockData';
import { Package, Bike, Play, CheckCircle, MapPin, Battery, Phone, Settings } from 'lucide-react';
export default function ShopPage() {
const activeBikes = bikes.filter(b => b.status === 'rented');
const pendingDeliveries = deliveries.filter(d => d.status === 'pending');
const inProgressDeliveries = deliveries.filter(d => d.status === 'in_progress');
const completedDeliveries = deliveries.filter(d => d.status === 'completed');
return (
<div className="p-4 lg:p-6">
<div className="mb-6">
<h1 className="text-xl lg:text-2xl font-extrabold text-slate-800">Shop Dashboard</h1>
<p className="text-sm text-slate-500">Manage deliveries and fleet</p>
</div>
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<StatCard label="Today's Deliveries" value={stats.shop.todayDeliveries} icon={Package} color="text-shop" />
<StatCard label="Active Riders" value={stats.shop.activeRiders} icon={Bike} color="text-green-600" />
<StatCard label="In Progress" value={inProgressDeliveries.length} icon={Play} color="text-amber-600" />
<StatCard label="Completed Today" value={completedDeliveries.length} icon={CheckCircle} color="text-purple-600" />
</div>
<div className="grid lg:grid-cols-2 gap-6 mb-6">
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<div className="flex items-center justify-between mb-4">
<h2 className="font-bold text-slate-800">Active Deliveries</h2>
<span className="text-xs font-semibold px-2 py-1 bg-amber-100 text-amber-700 rounded-full">
{inProgressDeliveries.length + pendingDeliveries.length} active
</span>
</div>
<div className="space-y-3">
{deliveries.filter(d => d.status !== 'completed').map(delivery => (
<div key={delivery.id} className="p-3 bg-slate-50 rounded-lg">
<div className="flex items-center justify-between mb-2">
<span className="text-xs font-semibold text-slate-500">{delivery.id}</span>
<span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
delivery.status === 'in_progress' ? 'bg-blue-100 text-blue-700' :
'bg-amber-100 text-amber-700'
}`}>
{delivery.status.replace('_', ' ')}
</span>
</div>
<p className="text-sm text-slate-700 flex items-center gap-1"><MapPin className="w-3 h-3" /> {delivery.pickupLocation}</p>
<p className="text-xs text-slate-400 flex items-center gap-1 ml-4"> {delivery.dropoffLocation}</p>
</div>
))}
</div>
</div>
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100">
<h2 className="font-bold text-slate-800 mb-4">Fleet Status</h2>
<div className="space-y-3">
{activeBikes.map(bike => (
<div key={bike.id} className="flex items-center justify-between p-3 bg-slate-50 rounded-lg">
<div>
<p className="font-medium text-slate-700">{bike.model}</p>
<p className="text-xs text-slate-400">{bike.plateNumber}</p>
</div>
<div className="text-right">
<p className="text-xs font-medium text-green-600 flex items-center gap-1"><Battery className="w-3 h-3" /> {bike.batteryLevel}%</p>
<p className="text-xs text-slate-400 flex items-center gap-1"><MapPin className="w-3 h-3" /> {bike.location}</p>
</div>
</div>
))}
</div>
</div>
</div>
<div className="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
<div className="px-5 py-3 border-b border-slate-100">
<h2 className="font-bold text-slate-800">Delivery History</h2>
</div>
<div className="overflow-x-auto">
<table className="w-full">
<thead className="bg-slate-50">
<tr>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Delivery ID</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Rider</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Pickup</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Dropoff</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase">Status</th>
</tr>
</thead>
<tbody className="divide-y divide-slate-50">
{deliveries.map(delivery => (
<tr key={delivery.id} className="hover:bg-slate-50">
<td className="px-4 py-3 text-sm font-medium text-slate-700">{delivery.id}</td>
<td className="px-4 py-3 text-sm text-slate-600">{delivery.riderId}</td>
<td className="px-4 py-3 text-sm text-slate-600">{delivery.pickupLocation}</td>
<td className="px-4 py-3 text-sm text-slate-600">{delivery.dropoffLocation}</td>
<td className="px-4 py-3">
<span className={`text-xs font-medium px-2 py-1 rounded-full ${
delivery.status === 'completed' ? 'bg-green-100 text-green-700' :
delivery.status === 'in_progress' ? 'bg-blue-100 text-blue-700' :
'bg-amber-100 text-amber-700'
}`}>
{delivery.status.replace('_', ' ')}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
);
}