import { jsxs as a, jsx as e } from "react/jsx-runtime";
import { useTranslation as o } from "react-i18next";
import { u as i } from "./useUserAccessRequests-BB6FHW14.js";
import { A as m } from "./AccessRequestStatusBadge-CjkJPKuE.js";
import { Loader2 as p, Inbox as x } from "lucide-react";
function N() {
  const { t } = o("admin"), { requests: r, loading: c } = i(), l = [
    {
      label: t("accessRequests.stats.pending"),
      value: r.filter((s) => s.status === "Pending").length,
      color: "yellow"
    },
    {
      label: t("accessRequests.stats.approved"),
      value: r.filter((s) => s.status === "Approved").length,
      color: "green"
    },
    {
      label: t("accessRequests.stats.denied"),
      value: r.filter((s) => s.status === "Denied").length,
      color: "red"
    }
  ], n = {
    green: "bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",
    yellow: "bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",
    red: "bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]"
  }, d = () => c ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ e(p, { className: "w-8 h-8 animate-spin text-[var(--color-accent-500)]" }) }) : r.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
    /* @__PURE__ */ e(x, { className: "w-12 h-12 text-[var(--text-secondary)] mb-4" }),
    /* @__PURE__ */ e("p", { className: "text-[var(--text-secondary)]", children: t("accessRequests.noRequests") })
  ] }) : /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ a("table", { className: "w-full text-sm", children: [
    /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "border-b border-[var(--border-color)] text-left text-[var(--text-secondary)]", children: [
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.application") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.tenant") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.reason") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.requestedAt") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.status") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.processedAt") }),
      /* @__PURE__ */ e("th", { className: "px-4 py-3 font-medium", children: t("accessRequests.table.notes") })
    ] }) }),
    /* @__PURE__ */ e("tbody", { className: "divide-y divide-[var(--border-color)]", children: r.map((s) => /* @__PURE__ */ a("tr", { className: "hover:bg-[var(--bg-tertiary)] transition-colors", children: [
      /* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium", children: s.applicationLabel }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3", children: s.tenantName || "—" }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3 text-[var(--text-secondary)] max-w-[200px] truncate", children: s.reason || "—" }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3 text-[var(--text-secondary)] whitespace-nowrap", children: new Date(s.requestedAt).toLocaleDateString() }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ e(m, { status: s.status }) }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3 text-[var(--text-secondary)] whitespace-nowrap", children: s.processedAt ? new Date(s.processedAt).toLocaleDateString() : "—" }),
      /* @__PURE__ */ e("td", { className: "px-4 py-3 text-[var(--text-secondary)] max-w-[200px] truncate", children: s.processingNotes || "—" })
    ] }, s.id)) })
  ] }) });
  return /* @__PURE__ */ a("div", { className: "space-y-6", children: [
    /* @__PURE__ */ a("div", { children: [
      /* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: t("accessRequests.myRequests") }),
      /* @__PURE__ */ e("p", { className: "text-[var(--text-secondary)]", children: t("accessRequests.myRequestsDescription") })
    ] }),
    /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-4", children: l.map((s) => /* @__PURE__ */ a("div", { className: `card p-4 text-center border ${n[s.color]}`, children: [
      /* @__PURE__ */ e("div", { className: "text-2xl font-bold", children: s.value }),
      /* @__PURE__ */ e("div", { className: "text-sm opacity-80", children: s.label })
    ] }, s.label)) }),
    /* @__PURE__ */ e("div", { className: "bg-[var(--bg-secondary)] rounded-[var(--radius-card)] border border-[var(--border-color)]", children: d() })
  ] });
}
export {
  N as default
};
//# sourceMappingURL=MyAccessRequestsPage-D6pVULNM.js.map
