130 lines
7.1 KiB
PHP
130 lines
7.1 KiB
PHP
<?php
|
|
$pageTitle = 'داشبورد و وضعیت عملکرد مزرعه';
|
|
require __DIR__ . '/layout_header.php';
|
|
?>
|
|
|
|
<!-- Stats Grid -->
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
|
<div class="bg-white p-6 rounded-2xl border border-stone-200 shadow-sm flex items-center justify-between">
|
|
<div>
|
|
<span class="text-xs text-stone-500 font-bold block mb-1">کل سفارشها</span>
|
|
<span class="text-2xl font-black text-stone-900"><?= \Bildirchin\Helpers::toPersianDigits($stats['total_orders']) ?></span>
|
|
</div>
|
|
<div class="w-12 h-12 rounded-2xl bg-amber-50 text-amber-600 flex items-center justify-center text-xl">
|
|
<i class="fas fa-shopping-bag"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white p-6 rounded-2xl border border-stone-200 shadow-sm flex items-center justify-between">
|
|
<div>
|
|
<span class="text-xs text-stone-500 font-bold block mb-1">سفارشهای در انتظار تایید</span>
|
|
<span class="text-2xl font-black text-amber-600"><?= \Bildirchin\Helpers::toPersianDigits($stats['pending_orders']) ?></span>
|
|
</div>
|
|
<div class="w-12 h-12 rounded-2xl bg-amber-50 text-amber-600 flex items-center justify-center text-xl">
|
|
<i class="fas fa-clock"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white p-6 rounded-2xl border border-stone-200 shadow-sm flex items-center justify-between">
|
|
<div>
|
|
<span class="text-xs text-stone-500 font-bold block mb-1">استعلامهای عمده جدید</span>
|
|
<span class="text-2xl font-black text-sky-600"><?= \Bildirchin\Helpers::toPersianDigits($stats['new_wholesale']) ?></span>
|
|
</div>
|
|
<div class="w-12 h-12 rounded-2xl bg-sky-50 text-sky-600 flex items-center justify-center text-xl">
|
|
<i class="fas fa-handshake"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white p-6 rounded-2xl border border-stone-200 shadow-sm flex items-center justify-between">
|
|
<div>
|
|
<span class="text-xs text-stone-500 font-bold block mb-1">مجموع فروش ثبتشده</span>
|
|
<span class="text-xl font-black text-emerald-700"><?= \Bildirchin\Helpers::formatPrice($stats['total_revenue']) ?></span>
|
|
</div>
|
|
<div class="w-12 h-12 rounded-2xl bg-emerald-50 text-emerald-600 flex items-center justify-center text-xl">
|
|
<i class="fas fa-coins"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
|
<!-- Recent Orders -->
|
|
<div class="lg:col-span-8 bg-white rounded-2xl border border-stone-200 shadow-sm overflow-hidden">
|
|
<div class="p-5 border-b border-stone-100 flex items-center justify-between">
|
|
<h3 class="font-bold text-stone-900 text-sm">سفارشهای اخیر مشتریان</h3>
|
|
<a href="/admin/orders" class="text-xs text-amber-600 font-bold hover:underline">مشاهده همه</a>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-right text-xs">
|
|
<thead class="bg-stone-50 text-stone-500 border-b">
|
|
<tr>
|
|
<th class="p-3.5">کد سفارش</th>
|
|
<th class="p-3.5">مشتری</th>
|
|
<th class="p-3.5">مبلغ کل</th>
|
|
<th class="p-3.5">وضعیت</th>
|
|
<th class="p-3.5">عملیات</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-stone-100">
|
|
<?php if (empty($recentOrders)): ?>
|
|
<tr><td colspan="5" class="p-6 text-center text-stone-400">هنوز سفارشی ثبت نشده است.</td></tr>
|
|
<?php else: ?>
|
|
<?php foreach ($recentOrders as $ord): ?>
|
|
<tr class="hover:bg-stone-50">
|
|
<td class="p-3.5 font-bold font-mono"><?= htmlspecialchars($ord['order_code']) ?></td>
|
|
<td class="p-3.5">
|
|
<span class="font-bold text-stone-900 block"><?= htmlspecialchars($ord['customer_name']) ?></span>
|
|
<span class="text-stone-400 text-[11px]"><?= htmlspecialchars($ord['customer_phone']) ?></span>
|
|
</td>
|
|
<td class="p-3.5 font-black text-stone-900"><?= \Bildirchin\Helpers::formatPrice($ord['final_amount']) ?></td>
|
|
<td class="p-3.5">
|
|
<span class="px-2.5 py-1 rounded-full text-[10px] font-bold bg-amber-100 text-amber-800">
|
|
<?= htmlspecialchars($ord['status']) ?>
|
|
</span>
|
|
</td>
|
|
<td class="p-3.5">
|
|
<a href="/admin/order/<?= $ord['id'] ?>" class="text-amber-600 hover:text-amber-800 font-bold">
|
|
جزییات و فاکتور
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recent Wholesale Inquiries -->
|
|
<div class="lg:col-span-4 bg-white rounded-2xl border border-stone-200 shadow-sm overflow-hidden">
|
|
<div class="p-5 border-b border-stone-100 flex items-center justify-between">
|
|
<h3 class="font-bold text-stone-900 text-sm">استعلامهای اخیر عمده</h3>
|
|
<a href="/admin/wholesale-inquiries" class="text-xs text-amber-600 font-bold hover:underline">همه</a>
|
|
</div>
|
|
|
|
<div class="p-4 space-y-3">
|
|
<?php if (empty($recentInquiries)): ?>
|
|
<p class="text-xs text-stone-400 text-center py-6">استعلام جدیدی ثبت نشده است.</p>
|
|
<?php else: ?>
|
|
<?php foreach ($recentInquiries as $inq): ?>
|
|
<div class="bg-stone-50 p-3.5 rounded-xl border border-stone-100 text-xs space-y-1">
|
|
<div class="flex justify-between items-center">
|
|
<span class="font-bold text-stone-900"><?= htmlspecialchars($inq['customer_name']) ?></span>
|
|
<span class="text-[10px] text-stone-400"><?= \Bildirchin\Helpers::getJalaliDate($inq['created_at']) ?></span>
|
|
</div>
|
|
<p class="text-amber-800 font-medium"><?= htmlspecialchars($inq['product_requested']) ?></p>
|
|
<div class="flex justify-between text-[11px] text-stone-500 pt-1">
|
|
<span>تماس: <?= htmlspecialchars($inq['phone']) ?></span>
|
|
<span><?= htmlspecialchars($inq['city']) ?></span>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
require __DIR__ . '/layout_footer.php';
|
|
?>
|