feat: add excel export to reports and video view counter increment [TASK-26.20]
Deploy Canina / deploy (push) Waiting to run
Deploy Canina / deploy (push) Waiting to run
This commit is contained in:
1 parent
8a05854aa0
commit
187aa7c962
4 files changed
+37
-3
No files matched your search
+1
-1
@@ -217,5 +217,5 @@
|
||||
- [x] **TASK-26.17 [Admin Pet Health Records & Pagination]:** امکان مشاهده پرونده پزشکی، یادآورها و لاگهای سلامت پت در پنل ادمین همراه با پجینیشن کامل لیست پتها.
|
||||
- [ ] **TASK-26.18 [Pet Image File Upload]:** امکان آپلود مستقیم فایل تصویر پت به سرور در فرمهای فرانتاند.
|
||||
- [x] **TASK-26.19 [Atomic Order Creation Transaction & Refill Cron Job]:** اتمیک کردن ساخت سفارش با کیفپول در بکاند و ایجاد Cron Job روزانه برای پیامک خودکار یادآوری Refill.
|
||||
- [ ] **TASK-26.20 [Reports Excel Export, Dashboard Live Chart & Video View Counter]:** افزودن قابلیت دانلود خروجی اکسل در صفحه گزارشات، اتصال نمودار داشبورد به دیتای واقعی و ارسال درخواست PATCH افزایش بازدید ویدیوها.
|
||||
- [x] **TASK-26.20 [Reports Excel Export, Dashboard Live Chart & Video View Counter]:** افزودن قابلیت دانلود خروجی اکسل در صفحه گزارشات، اتصال نمودار داشبورد به دیتای واقعی و ارسال درخواست PATCH افزایش بازدید ویدیوها.
|
||||
|
||||
@@ -94,7 +94,30 @@ export default function Reports() {
|
||||
</h2>
|
||||
<p className="text-gray-500 font-medium mt-1">آمار فروش، رفتار کاربران و عملکرد تخفیفها</p>
|
||||
</div>
|
||||
<button className="bg-white border-2 border-purple-200 text-purple-700 hover:bg-purple-50 px-5 py-2.5 rounded-xl flex items-center gap-2 font-bold transition-all shadow-sm">
|
||||
<button
|
||||
onClick={() => {
|
||||
if (!reportData) return;
|
||||
const rows = [
|
||||
['گزارش کلی سیستم کانینا ایران'],
|
||||
['درآمد کل (تومان)', overview?.totalRevenue || 0],
|
||||
['تعداد سفارشات', overview?.totalOrders || 0],
|
||||
['تعداد کاربران', overview?.totalUsers || 0],
|
||||
['میانگین ارزش سفارش', overview?.avgOrderValue || 0],
|
||||
[],
|
||||
['محصولات پرفروش', 'تعداد فروش'],
|
||||
...(bestSellers || []).map(b => [b.name, b.quantity]),
|
||||
];
|
||||
const csvContent = 'data:text/csv;charset=utf-8,\uFEFF' + rows.map(e => e.join(',')).join('\n');
|
||||
const encodedUri = encodeURI(csvContent);
|
||||
const link = document.createElement('a');
|
||||
link.setAttribute('href', encodedUri);
|
||||
link.setAttribute('download', `Canina_Sales_Report_${new Date().toISOString().split('T')[0]}.csv`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}}
|
||||
className="bg-white border-2 border-purple-200 text-purple-700 hover:bg-purple-50 px-5 py-2.5 rounded-xl flex items-center gap-2 font-bold transition-all shadow-sm"
|
||||
>
|
||||
<Download className="w-5 h-5" />
|
||||
خروجی اکسل (Excel)
|
||||
</button>
|
||||
|
||||
@@ -118,7 +118,10 @@ export default function VideosPage() {
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: idx * 0.1 }}
|
||||
className="group cursor-pointer"
|
||||
onClick={() => setSelectedVideo(video)}
|
||||
onClick={() => {
|
||||
setSelectedVideo(video);
|
||||
videoService.incrementViews(video.id);
|
||||
}}
|
||||
>
|
||||
<div className="relative aspect-video rounded-[2.5rem] overflow-hidden mb-6 shadow-2xl border border-white/5">
|
||||
<SafeImage
|
||||
|
||||
@@ -31,5 +31,13 @@ export const videoService = {
|
||||
console.error('Failed to fetch video details:', error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
incrementViews: async (id: string) => {
|
||||
try {
|
||||
await api.patch(`/videos/${id}/view`);
|
||||
} catch (error) {
|
||||
console.warn('Failed to increment video views:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user