merge: integrate develop fixes (Dashboard null-safety, Tasks Tehran datetime, and sorting) into main
Deploy Canina / deploy (push) Successful in 2m47s
Deploy Canina / deploy (push) Successful in 2m47s
This commit is contained in:
commit
b3d4e08914
2 files changed
+22
-5
No files matched your search
@@ -117,10 +117,10 @@ export default function Dashboard() {
|
|||||||
const COLORS = ['#8b5cf6', '#3b82f6', '#10b981'];
|
const COLORS = ['#8b5cf6', '#3b82f6', '#10b981'];
|
||||||
|
|
||||||
const stats = [
|
const stats = [
|
||||||
{ title: 'درآمد کل', value: `${data.revenue.toLocaleString()} تومان`, icon: DollarSign, color: 'text-green-600', bg: 'bg-green-100', link: '/reports' },
|
{ title: 'درآمد کل', value: `${(data?.revenue || 0).toLocaleString()} تومان`, icon: DollarSign, color: 'text-green-600', bg: 'bg-green-100', link: '/reports' },
|
||||||
{ title: 'سفارشات جدید', value: data.newOrders.toString(), icon: ShoppingCart, color: 'text-blue-600', bg: 'bg-blue-100', link: '/orders' },
|
{ title: 'سفارشات جدید', value: (data?.newOrders || 0).toString(), icon: ShoppingCart, color: 'text-blue-600', bg: 'bg-blue-100', link: '/orders' },
|
||||||
{ title: 'کاربران فعال', value: data.users.toString(), icon: Users, color: 'text-purple-600', bg: 'bg-purple-100', link: '/users' },
|
{ title: 'کاربران فعال', value: (data?.users || 0).toString(), icon: Users, color: 'text-purple-600', bg: 'bg-purple-100', link: '/users' },
|
||||||
{ title: 'بازدید امروز', value: data.todayVisits.toString(), icon: Activity, color: 'text-orange-600', bg: 'bg-orange-100', link: '/reports' },
|
{ title: 'بازدید امروز', value: (data?.todayVisits || 0).toString(), icon: Activity, color: 'text-orange-600', bg: 'bg-orange-100', link: '/reports' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ export default function TasksManagementPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const filteredTasks = tasks.filter((t) => {
|
const sortedTasks = [...tasks].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
||||||
|
const filteredTasks = sortedTasks.filter((t) => {
|
||||||
const matchesSearch =
|
const matchesSearch =
|
||||||
!searchTerm ||
|
!searchTerm ||
|
||||||
t.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
t.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
@@ -310,6 +311,12 @@ export default function TasksManagementPage() {
|
|||||||
<thead className="bg-gray-50/75 border-b border-gray-100 text-gray-500 font-black">
|
<thead className="bg-gray-50/75 border-b border-gray-100 text-gray-500 font-black">
|
||||||
<tr>
|
<tr>
|
||||||
<th className="py-3 px-4">کد تسک</th>
|
<th className="py-3 px-4">کد تسک</th>
|
||||||
|
<th className="py-3 px-4 cursor-pointer select-none hover:text-purple-700" onClick={() => setSortOrder(prev => prev === 'desc' ? 'asc' : 'desc')}>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<span>تاریخ و ساعت (تهران)</span>
|
||||||
|
<span className="text-[10px] text-purple-600">({sortOrder === 'desc' ? '▼ جدیدترین' : '▲ قدیمیترین'})</span>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
<th className="py-3 px-4">عنوان و شرح وظیفه</th>
|
<th className="py-3 px-4">عنوان و شرح وظیفه</th>
|
||||||
<th className="py-3 px-4">دپارتمان</th>
|
<th className="py-3 px-4">دپارتمان</th>
|
||||||
<th className="py-3 px-4">اولویت</th>
|
<th className="py-3 px-4">اولویت</th>
|
||||||
@@ -326,6 +333,16 @@ export default function TasksManagementPage() {
|
|||||||
{task.code}
|
{task.code}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td className="py-3.5 px-4 whitespace-nowrap text-xs text-gray-600 font-medium" dir="ltr">
|
||||||
|
{task.createdAt ? new Intl.DateTimeFormat('fa-IR', {
|
||||||
|
timeZone: 'Asia/Tehran',
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
}).format(new Date(task.createdAt)) : '-'}
|
||||||
|
</td>
|
||||||
<td className="py-3.5 px-4">
|
<td className="py-3.5 px-4">
|
||||||
<div className="font-black text-gray-900 text-xs mb-0.5">{task.title}</div>
|
<div className="font-black text-gray-900 text-xs mb-0.5">{task.title}</div>
|
||||||
{task.description && (
|
{task.description && (
|
||||||
|
|||||||
Reference in new issue
Block a user