feat: add order management page
This commit is contained in:
1 parent
060dc39fdd
commit
beb8317fad
2 files changed
+105
-1
No files matched your search
@@ -4,6 +4,7 @@ import Dashboard from './pages/Dashboard';
|
||||
import Login from './pages/Login';
|
||||
import Users from './pages/Users';
|
||||
import Products from './pages/Products';
|
||||
import Orders from './pages/Orders';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
@@ -14,7 +15,7 @@ function App() {
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="users" element={<Users />} />
|
||||
<Route path="products" element={<Products />} />
|
||||
<Route path="orders" element={<div className="p-4">مدیریت سفارشات</div>} />
|
||||
<Route path="orders" element={<Orders />} />
|
||||
<Route path="coupons" element={<div className="p-4">کدهای تخفیف</div>} />
|
||||
<Route path="settings" element={<div className="p-4">تنظیمات سیستم</div>} />
|
||||
</Route>
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import { ShoppingCart, Eye, Truck, Check, X, Search, Filter } from 'lucide-react';
|
||||
|
||||
const orders = [
|
||||
{ id: 'ORD-10045', customer: 'علی رضایی', amount: '۴,۵۰۰,۰۰۰ تومان', date: '۱۴۰۲/۰۸/۱۵', status: 'pending', items: 3 },
|
||||
{ id: 'ORD-10044', customer: 'کلینیک دامپزشکی مهر', amount: '۱۲,۸۰۰,۰۰۰ تومان', date: '۱۴۰۲/۰۸/۱۴', status: 'shipped', items: 12 },
|
||||
{ id: 'ORD-10043', customer: 'سارا احمدی', amount: '۸۵۰,۰۰۰ تومان', date: '۱۴۰۲/۰۸/۱۲', status: 'delivered', items: 1 },
|
||||
{ id: 'ORD-10042', customer: 'محمد کریمی', amount: '۳,۲۰۰,۰۰۰ تومان', date: '۱۴۰۲/۰۸/۱۱', status: 'cancelled', items: 2 },
|
||||
];
|
||||
|
||||
const statusStyles: Record<string, { label: string, color: string }> = {
|
||||
pending: { label: 'در حال بررسی', color: 'bg-orange-100 text-orange-700' },
|
||||
shipped: { label: 'ارسال شده', color: 'bg-blue-100 text-blue-700' },
|
||||
delivered: { label: 'تحویل داده شده', color: 'bg-green-100 text-green-700' },
|
||||
cancelled: { label: 'لغو شده', color: 'bg-red-100 text-red-700' },
|
||||
};
|
||||
|
||||
export default function Orders() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
||||
<div>
|
||||
<h2 className="text-2xl font-black text-gray-900 flex items-center gap-2">
|
||||
<ShoppingCart className="w-6 h-6 text-purple-600" />
|
||||
مدیریت سفارشات
|
||||
</h2>
|
||||
<p className="text-gray-500 font-medium mt-1">مشاهده فاکتورها، تغییر وضعیت و درج کد رهگیری پستی</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<button className="bg-white border border-gray-200 text-gray-700 px-4 py-2 rounded-xl flex items-center gap-2 font-bold hover:bg-gray-50 transition-all">
|
||||
<Filter className="w-4 h-4" />
|
||||
فیلتر
|
||||
</button>
|
||||
<div className="relative">
|
||||
<Search className="w-5 h-5 text-gray-400 absolute right-3 top-1/2 -translate-y-1/2" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="جستجوی شماره سفارش..."
|
||||
className="pl-4 pr-10 py-2 border border-gray-200 rounded-xl outline-none focus:ring-2 focus:ring-purple-500 w-full sm:w-64 font-medium"
|
||||
dir="rtl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-right font-vazir">
|
||||
<thead className="bg-gray-50 text-gray-500 text-sm border-b border-gray-200">
|
||||
<tr>
|
||||
<th className="py-4 px-6 font-bold">شماره سفارش</th>
|
||||
<th className="py-4 px-6 font-bold">مشتری</th>
|
||||
<th className="py-4 px-6 font-bold">مبلغ کل</th>
|
||||
<th className="py-4 px-6 font-bold">تاریخ ثبت</th>
|
||||
<th className="py-4 px-6 font-bold">آیتمها</th>
|
||||
<th className="py-4 px-6 font-bold">وضعیت</th>
|
||||
<th className="py-4 px-6 font-bold text-center">عملیات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-100">
|
||||
{orders.map((order) => (
|
||||
<tr key={order.id} className="hover:bg-gray-50/50 transition-colors">
|
||||
<td className="py-4 px-6 font-bold text-purple-600" dir="ltr">{order.id}</td>
|
||||
<td className="py-4 px-6 font-bold text-gray-900">{order.customer}</td>
|
||||
<td className="py-4 px-6 font-bold text-gray-900">{order.amount}</td>
|
||||
<td className="py-4 px-6 text-gray-500 text-sm font-medium">{order.date}</td>
|
||||
<td className="py-4 px-6 text-gray-500 font-bold">{order.items} عدد</td>
|
||||
<td className="py-4 px-6">
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-bold ${statusStyles[order.status].color}`}>
|
||||
{statusStyles[order.status].label}
|
||||
</span>
|
||||
</td>
|
||||
<td className="py-4 px-6">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<button className="text-gray-600 hover:bg-gray-100 p-2 rounded-lg transition-colors" title="مشاهده فاکتور">
|
||||
<Eye className="w-4 h-4" />
|
||||
</button>
|
||||
{order.status === 'pending' && (
|
||||
<>
|
||||
<button className="text-blue-600 hover:bg-blue-50 p-2 rounded-lg transition-colors" title="ثبت به عنوان ارسال شده">
|
||||
<Truck className="w-4 h-4" />
|
||||
</button>
|
||||
<button className="text-red-600 hover:bg-red-50 p-2 rounded-lg transition-colors" title="لغو سفارش">
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{order.status === 'shipped' && (
|
||||
<button className="text-green-600 hover:bg-green-50 p-2 rounded-lg transition-colors" title="ثبت به عنوان تحویل داده شده">
|
||||
<Check className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user