diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 514c0e7..f1a2296 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -433,7 +433,7 @@ export default function DashboardPage() {
{userInfo.fullName}
-
{userInfo.phone}
+
{userInfo.phone}
حساب فعال diff --git a/components/dashboard/address.tsx b/components/dashboard/address.tsx new file mode 100644 index 0000000..a04e79f --- /dev/null +++ b/components/dashboard/address.tsx @@ -0,0 +1,33 @@ +import { User , Headphones } from "lucide-react"; + +const AddressTab = ({ addresses }:any) => { + return ( +
+ {addresses.map((address:any) => ( +
+
+ {address.text} +
+ +
+
+ + گیرنده: {address.receiver} +
+
+ + تماس: {address.phone} +
+
+
+ ))} +
+ ); +}; + +export default AddressTab; diff --git a/components/dashboard/dash.tsx b/components/dashboard/dash.tsx new file mode 100644 index 0000000..dc71418 --- /dev/null +++ b/components/dashboard/dash.tsx @@ -0,0 +1,40 @@ +import DashboardStat from "./dashboardstat"; +import { Wallet, ShoppingBag, Headphones, TrendingUp } from "lucide-react"; + + +const DashboardHomeTab = ({ ticketStatValue }: any) => { + return ( +
+

خوش آمدید

+ +
+ } + color="bg-blue-50 text-blue-600" + label="موجودی کیف پول" + value="1,500,000 تومان" + /> + } + color="bg-green-50 text-green-600" + label="سفارشات جاری" + value="2 مورد" + /> + } + color="bg-orange-50 text-orange-600" + label="تیکت‌ها" + value={ticketStatValue} + /> + } + color="bg-purple-50 text-purple-600" + label="امتیاز وفاداری" + value="2,340 امتیاز" + /> +
+
+ ); +}; + +export default DashboardHomeTab; diff --git a/components/dashboard/dashboardstat.tsx b/components/dashboard/dashboardstat.tsx new file mode 100644 index 0000000..c7a0434 --- /dev/null +++ b/components/dashboard/dashboardstat.tsx @@ -0,0 +1,11 @@ +export default function DashboardStat({ icon, color, label, value }: { icon: React.ReactNode; color: string; label: string; value: string }) { + return ( +
+
{icon}
+
+

{label}

+ {value} +
+
+ ); +} diff --git a/components/dashboard/overview.tsx b/components/dashboard/overview.tsx new file mode 100644 index 0000000..751c18a --- /dev/null +++ b/components/dashboard/overview.tsx @@ -0,0 +1,28 @@ +const OrdersTab = ({ orders }:any) => { + return ( +
+ {orders.map((order:any) => ( +
+
+
+

{order.id}

+

+ ثبت سفارش: {order.regDate} +

+
+ + + {order.status} + +
+
+ ))} +
+ ); +}; + +export default OrdersTab; diff --git a/components/dashboard/profilefield.tsx b/components/dashboard/profilefield.tsx new file mode 100644 index 0000000..f060b47 --- /dev/null +++ b/components/dashboard/profilefield.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +interface ProfileFieldProps { + label: string; + value: string | undefined; +} + +export default function ProfileField({ label, value }: ProfileFieldProps) { + return ( +
+ {label} + {value || '-'} +
+ ); +} diff --git a/components/dashboard/profileview.tsx b/components/dashboard/profileview.tsx new file mode 100644 index 0000000..3a8ca30 --- /dev/null +++ b/components/dashboard/profileview.tsx @@ -0,0 +1,20 @@ +import ProfileField from "./profilefield"; + +const ProfileTab = ({ userInfo }:any) => { + return ( +
+

+ اطلاعات شخصی +

+ +
+ + + + +
+
+ ); +}; + +export default ProfileTab; diff --git a/components/dashboard/tickets.tsx b/components/dashboard/tickets.tsx new file mode 100644 index 0000000..935c459 --- /dev/null +++ b/components/dashboard/tickets.tsx @@ -0,0 +1,229 @@ +import React from 'react'; +import { Plus } from 'lucide-react'; // فرض بر این است که از lucide-react استفاده می‌کنید + +// TODO: کامپوننت‌های کمکی و تایپ‌های زیر باید از فایل‌های مربوطه‌شان ایمپورت شوند +// import TicketSummaryCard from './TicketSummaryCard'; +// import FilterButton from './FilterButton'; +// import LoadingCard from './LoadingCard'; +// import ErrorCard from './ErrorCard'; +// import EmptyCard from './EmptyCard'; +// import StatusBadge from './StatusBadge'; +// import PriorityBadge from './PriorityBadge'; +// import Pager from './Pager'; +// import TicketConversationCard from './TicketConversationCard'; +// import { formatDateTime } from '../utils/dateHelpers'; + +import { + closeUserTicket, + createUserTicket, + getAdminTicketById, + getAdminTickets, + getUserTicketById, + getUserTickets, + sendAdminTicketMessage, + sendUserTicketMessage, + TicketDetail, + TicketListItem, + TicketPriority, + TicketStatus, + updateAdminTicket, +} from "@/public/src/services/tickets/api"; + +import { LoaderCircle,Send , Headphones } from 'lucide-react'; + +const statusLabels: Record = { + waiting_for_admin: "در انتظار پاسخ پشتیبانی", + waiting_for_user: "در انتظار پاسخ کاربر", + closed: "بسته شده", +}; + + +const priorityLabels: Record = { + low: "کم", + normal: "عادی", + high: "زیاد", + urgent: "فوری", +}; + + +function TicketConversationCard({ ticket, reply, onReplyChange, onReplySubmit, replyLoading, onCloseTicket, adminMode = false }: { + ticket: TicketDetail; + reply: string; + onReplyChange: (value: string) => void; + onReplySubmit: () => void; + replyLoading: boolean; + onCloseTicket?: () => void; + adminMode?: boolean; +}) { + const closed = ticket.status === "closed"; + + return ( +
+
+
+
{ticket.ticketNumber}
+

{ticket.subject}

+
+
+ + +
+
+ {!adminMode && onCloseTicket && ( +
+ +
+ )} +
+ {ticket.messages.map((message) => ( +
+
+
{message.sender.fullName} • {message.senderType === 'user' ? 'کاربر' : 'پشتیبانی'}
+
{message.message}
+
{formatDateTime(message.createdAt)}
+
+
+ ))} +
+
+