Skip to content
العربية
Invoices and support

TicketView

A support ticket: the conversation with internal notes and attachments, the reply form, and the ticket details beside it on wide screens.

import { TicketView } from "@percentsa/ui";

Examples

TCK-1024

Cannot download last month's invoice

Open
Sara Alqahtani
The download button shows an error for the January invoice.

Attachments

Omar Alharbi
Internal note
The PDF job failed on the 31st. Running it again now.
Code
export function TicketViewExample() {
  const t = useT();
  const omar = { name: t("Omar Alharbi", "عمر الحربي") };
  return (
    <TicketView
      className="w-full max-w-5xl"
      subject={t("Cannot download last month's invoice", "لا أستطيع تنزيل فاتورة الشهر الماضي")}
      id="TCK-1024"
      status={<Badge variant="outline">{t("Open", "مفتوحة")}</Badge>}
      meta={[
        { term: t("Customer", "العميل"), details: t("Najd Trading Co.", "شركة نجد التجارية") },
        { term: t("Priority", "الأولوية"), details: t("High", "عالية") },
        { term: t("Assignee", "المسؤول"), details: omar.name },
        { term: t("Opened", "تاريخ الفتح"), details: t("18 February 2026", "18 فبراير 2026") },
      ]}
      messages={[
        {
          id: "1",
          author: { name: t("Sara Alqahtani", "سارة القحطاني") },
          time: <time dateTime="2026-02-18T09:30">09:30</time>,
          body: t("The download button shows an error for the January invoice.", "يظهر خطأ عند الضغط على زر التنزيل لفاتورة يناير."),
          attachments: [{ name: "error.png", href: "#error.png", size: 245_000 }],
        },
        {
          id: "2",
          author: omar,
          time: <time dateTime="2026-02-18T09:42">09:42</time>,
          body: t("The PDF job failed on the 31st. Running it again now.", "فشلت مهمة إنشاء ملف PDF يوم 31. أعيد تشغيلها الآن."),
          internal: true,
        },
        {
          id: "3",
          author: omar,
          time: <time dateTime="2026-02-18T09:55">09:55</time>,
          body: t("Thanks, Sara. The invoice is ready to download again.", "شكرًا يا سارة. الفاتورة جاهزة للتنزيل مرة أخرى."),
          attachments: [{ name: "INV-2026-0031.pdf", href: "#INV-2026-0031.pdf", size: 1_250_000 }],
        },
      ]}
      composer={
        <form onSubmit={(e) => e.preventDefault()} className="grid gap-3">
          <Field label={t("Reply", "الرد")}>
            <Textarea placeholder={t("Write a reply", "اكتب ردًا")} />
          </Field>
          <Inline justify="end">
            <Button type="submit">{t("Send", "إرسال")}</Button>
          </Inline>
        </form>
      }
    />
  );
}