diff --git a/src/views/AdminEvents.tsx b/src/views/AdminEvents.tsx index 2bc4aba..081d5a0 100644 --- a/src/views/AdminEvents.tsx +++ b/src/views/AdminEvents.tsx @@ -2,15 +2,28 @@ import * as React from 'react'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; +import { Edit3, Eye, Trash2 } from 'lucide-react'; import { Link, useNavigate } from '@/lib/router'; import type { EventListItemSchema } from '@/lib/types'; import { api } from '@/lib/api'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from '@/components/ui/alert-dialog'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { ScrollArea } from '@/components/ui/scroll-area'; +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import ProgressiveImage from '@/components/ProgressiveImage'; import { useToast } from '@/hooks/use-toast'; import { formatJalali, formatToman, getEventCardImageUrl, resolveErrorMessage, toPersianDigits } from '@/lib/utils'; @@ -101,6 +114,70 @@ const AdminEventsPage: React.FC = () => { } }, [eventsQuery.data, filters.sort]); + const renderEventActions = (event: EventListItemSchema) => ( +
+ + + + + جزئیات + + + + + + ویرایش + + + + + + + + + حذف + + + + حذف رویداد + + آیا از حذف رویداد «{event.title}» مطمئن هستید؟ این عملیات رویداد را از لیست‌های عادی حذف می‌کند. + + + + انصراف + deleteMutation.mutate(event.id)} + > + حذف + + + + +
+ ); + return (
@@ -219,7 +296,7 @@ const AdminEventsPage: React.FC = () => { تاریخ شروع ثبت‌نام‌ها قیمت (تومان) - عملیات + @@ -244,20 +321,8 @@ const AdminEventsPage: React.FC = () => { {formatJalali(event.start_time)} {toPersianDigits(event.registration_count)} {formatToman(event.price)} - - - - + + {renderEventActions(event)} ))} @@ -278,16 +343,8 @@ const AdminEventsPage: React.FC = () => {
ثبت‌نام‌ها: {toPersianDigits(event.registration_count)}
قیمت: {formatToman(event.price)}
-
- - - +
+ {renderEventActions(event)}
))}