From 9254a8b4874ee3992768aba1ecde1bf2e256bb89 Mon Sep 17 00:00:00 2001 From: alisaza Date: Fri, 11 Sep 2026 21:31:16 +0330 Subject: [PATCH] feat(support-tickets): add close action and turn-based reply guidance Let admins close tickets with confirmation and surface closedBy so consumer reopen rules stay clear. --- app/(dashboard)/support-tickets/[id]/page.tsx | 36 +++++++++++++- openapi.json | 48 +++++++++++++++++++ services/supportTickets.ts | 1 + 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/app/(dashboard)/support-tickets/[id]/page.tsx b/app/(dashboard)/support-tickets/[id]/page.tsx index f42fa89..7c646ad 100644 --- a/app/(dashboard)/support-tickets/[id]/page.tsx +++ b/app/(dashboard)/support-tickets/[id]/page.tsx @@ -7,6 +7,7 @@ import PageNavbar from '@/components/layouts/PageNavbar' import Button from '@/components/formElements/Button' import Input from '@/components/formElements/Input' import { APP_ROUTES } from '@/constants/routes' +import useAlertModal from '@/hooks/useAlertModal' import { addToast } from '@/lib/toast' import { formatIranianMobile, formatPersianDate } from '@/lib/formatters' import { @@ -21,6 +22,7 @@ import { const AdminSupportTicketDetail = () => { const { id } = useParams<{ id: string }>() + const { showAlert } = useAlertModal() const [ticket, setTicket] = useState(null) const [reply, setReply] = useState('') const [pending, setPending] = useState(false) @@ -56,6 +58,17 @@ const AdminSupportTicketDetail = () => { } } + const confirmClose = () => { + showAlert( + 'این تیکت بسته شود؟ کاربر دیگر نمی‌تواند پیام بفرستد و در صورت بستن توسط ادمین، خودش نمی‌تواند دوباره باز کند.', + () => { + void changeStatus('closed') + }, + undefined, + { dangerAccept: true } + ) + } + return (
@@ -104,6 +117,24 @@ const AdminSupportTicketDetail = () => { + {ticket.status !== 'closed' ? ( +
+ +
+ ) : ( +

+ {ticket.closedBy === 'user' + ? 'این تیکت توسط کاربر بسته شده است.' + : 'این تیکت توسط پشتیبانی بسته شده است؛ کاربر نمی‌تواند دوباره باز کند.'} +

+ )}
{ticket.messages.map((message) => ( @@ -129,7 +160,10 @@ const AdminSupportTicketDetail = () => { setReply(String(value)) }} /> -

پس از ثبت پاسخ، برای کاربر پیامک اطلاع‌رسانی ارسال می‌شود.

+

+ می‌توانید چند پیام پشت‌سرهم بفرستید. کاربر فقط بعد از پاسخ شما یک پیام می‌تواند بفرستد. پس از ثبت پاسخ، برای کاربر پیامک + اطلاع‌رسانی ارسال می‌شود. +