import { jsx as e, jsxs as c } from "react/jsx-runtime";
import { useTranslation as i } from "react-i18next";
import { u as d } from "./useUserAccessRequests-BMfMQ9H6.js";
import { A as o } from "./AccessRequestStatusBadge-CjkJPKuE.js";
import { Clock as m, CheckCircle as p, XCircle as u, Key as h, Loader2 as x, Inbox as y } from "lucide-react";
import { P as N, K as b } from "./index-CeEMms9z.js";
function A() {
  const { t } = i("admin"), { requests: a, loading: r } = d(), l = [
    {
      label: t("accessRequests.stats.pending"),
      value: a.filter((s) => s.status === "Pending").length,
      icon: /* @__PURE__ */ e(m, { className: "w-5 h-5" }),
      accent: 2
    },
    {
      label: t("accessRequests.stats.approved"),
      value: a.filter((s) => s.status === "Approved").length,
      icon: /* @__PURE__ */ e(p, { className: "w-5 h-5" }),
      accent: 5
    },
    {
      label: t("accessRequests.stats.denied"),
      value: a.filter((s) => s.status === "Denied").length,
      icon: /* @__PURE__ */ e(u, { className: "w-5 h-5" }),
      accent: 1
    }
  ], n = () => r ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ e(x, { className: "w-8 h-8 animate-spin text-[var(--color-accent-500)]" }) }) : a.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
    /* @__PURE__ */ e(y, { 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__ */ c("table", { className: "w-full text-sm", children: [
    /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("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: a.map((s) => /* @__PURE__ */ c("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(o, { 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__ */ c(
    N,
    {
      title: t("accessRequests.myRequests"),
      subtitle: t("accessRequests.myRequestsDescription"),
      icon: /* @__PURE__ */ e(h, { className: "w-6 h-6" }),
      children: [
        /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-4", children: l.map((s) => /* @__PURE__ */ e(
          b,
          {
            title: s.label,
            value: s.value,
            icon: s.icon,
            accent: s.accent
          },
          s.label
        )) }),
        /* @__PURE__ */ e("div", { className: "bg-[var(--bg-secondary)] rounded-[var(--radius-card)] border border-[var(--border-color)]", children: n() })
      ]
    }
  );
}
export {
  A as default
};
//# sourceMappingURL=MyAccessRequestsPage-BDaYzcRO.js.map
