حساب فعال
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)}
+
+
+ ))}
+
+
+
+ );
+}
+
+
+function TicketSummaryCard({ value, label, color }: { value: string; label: string; color: string }) {
+ return (
+
+ );
+}
+function FilterButton({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {
+ return ;
+}
+
+
+function Pager({ page, totalPages, onPrev, onNext }: { page: number; totalPages: number; onPrev: () => void; onNext: () => void }) {
+ return صفحه {page.toLocaleString('fa-IR')} از {totalPages.toLocaleString('fa-IR')}
;
+}
+
+function LoadingCard({ text }: { text: string }) {
+ return {text}
;
+}
+
+function ErrorCard({ text }: { text: string }) {
+ return {text}
;
+}
+
+function EmptyCard({ title, description }: { title: string; description: string }) {
+ return ;
+}
+
+function StatusBadge({ status }: { status: TicketStatus }) {
+ return {statusLabels[status]};
+}
+
+
+function PriorityBadge({ priority }: { priority: TicketPriority }) {
+ return {priorityLabels[priority]};
+}
+
+
+function formatDateTime(value?: string | null) {
+ if (!value) return "ثبت نشده";
+ return new Intl.DateTimeFormat("fa-IR", { dateStyle: "medium", timeStyle: "short" }).format(new Date(value));
+}
+
+
+export default function TicketsTab(props: {
+
+ tickets: any[]; // به جای any میتوانید TicketListItem قرار دهید
+ loading: boolean;
+ error: string;
+ counts: any; // TicketCounts
+ selectedTicketId: string;
+ selectedTicket: any | null; // TicketDetail
+ detailLoading: boolean;
+ reply: string;
+ replyLoading: boolean;
+ statusFilter: "" | string; // TicketStatus
+ onSelectTicket: (id: string) => void;
+ onStatusFilterChange: (status: "" | string) => void;
+ onReplyChange: (value: string) => void;
+ onReplySubmit: () => void;
+ onCloseTicket: () => void;
+ onOpenCreateTicket: () => void;
+ page: number;
+ totalPages: number;
+ onPrevPage: () => void;
+ onNextPage: () => void;
+}) {
+ return (
+
+
+
تیکتهای پشتیبانی
+
+
+
+
+
+
+
+
+
+
+
+
+ props.onStatusFilterChange("")}>همه تیکتها
+ props.onStatusFilterChange("waiting_for_admin")}>در انتظار پشتیبانی
+ props.onStatusFilterChange("waiting_for_user")}>در انتظار شما
+ props.onStatusFilterChange("closed")}>بسته شده
+
+
+
+
+
+ {props.loading ?
: props.error ?
: props.tickets.length === 0 ?
: (
+ <>
+ {props.tickets.map((ticket) => (
+
+ ))}
+
+ >
+ )}
+
+
+ {props.detailLoading ? : !props.selectedTicket ? : (
+
+ )}
+
+
+
+ );
+}
diff --git a/components/dashboard/wallet.tsx b/components/dashboard/wallet.tsx
new file mode 100644
index 0000000..63e68a3
--- /dev/null
+++ b/components/dashboard/wallet.tsx
@@ -0,0 +1,16 @@
+const WalletTab = ({ balance }:any) => {
+ return (
+
+
+ موجودی فعلی حساب شما:
+
+
+
+ {balance}
+ تومان
+
+
+ );
+};
+
+export default WalletTab;