import { jsxs, Fragment, jsx } from "react/jsx-runtime"; import { T as TableFilter } from "./table-filter-aC0v-3Es.js"; import { T as TableFooter } from "./table-footer-BvAwBYor.js"; import { T as TableHeader } from "./table-header-CdEXSV6s.js"; import { B as Button } from "./button-CdJZJLGw.js"; import { C as Card, a as CardHeader, c as CardTitle, b as CardContent } from "./card-B-gBwpxd.js"; import { T as Table, a as TableBody, b as TableRow, c as TableCell } from "./table-BMWNGY4o.js"; import { D as DashboardLayout } from "./layout-Cf9mPjOS.js"; import { usePage, Head, Link } from "@inertiajs/react"; import { useReactTable, getFilteredRowModel, getSortedRowModel, getCoreRowModel, flexRender } from "@tanstack/react-table"; import { Plus, BookOpen, Eye, Edit, Archive } from "lucide-react"; import * as React from "react"; import TableColumn from "./table-columns-CB7G3Jb4.js"; import "./use-lang-44ndmTOc.js"; import "./debounce-ZFxqVthq.js"; import "./route-DlE7FdTW.js"; import "./utils-DLCPGU0v.js"; import "clsx"; import "tailwind-merge"; import "./dropdown-menu-msun3TP8.js"; import "@radix-ui/react-dropdown-menu"; import "./scroll-area-CDdrLubh.js"; import "@radix-ui/react-scroll-area"; import "./table-page-size-CF314lUl.js"; import "@radix-ui/react-slot"; import "class-variance-authority"; import "./sidebar-C1tqSfnl.js"; import "./separator-CSqU-rrB.js"; import "@radix-ui/react-separator"; import "./sheet-BOQ-e9_C.js"; import "@radix-ui/react-dialog"; import "./tooltip-BYKuzaoQ.js"; import "@radix-ui/react-tooltip"; import "./main-BKBelQb-.js"; import "next-themes"; import "sonner"; import "./appearance-BJIqrZL5.js"; import "./language-mewnB-2r.js"; import "./notification-Bg6IzWOo.js"; import "./popover-Cv6Hz_y0.js"; import "@radix-ui/react-popover"; import "date-fns"; import "./app-logo-DWyi5bLn.js"; import "./accordion-cIAfVfPq.js"; import "@radix-ui/react-accordion"; import "./avatar-C8iCpF5R.js"; import "@radix-ui/react-avatar"; import "./delete-modal-BrX_mlY2.js"; import "./dialog-DGP_3dPQ.js"; const BlogsIndex = () => { var _a; const { props } = usePage(); const { blogs, statistics, translate } = props; const { dashboard, frontend } = translate; const [sorting, setSorting] = React.useState([]); const table = useReactTable({ data: blogs.data, columns: TableColumn(props.translate), onSortingChange: setSorting, getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(), getFilteredRowModel: getFilteredRowModel(), state: { sorting } }); return /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsx(Head, { title: dashboard.blog }), /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [ /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold", children: dashboard.blog }), /* @__PURE__ */ jsx(Button, { asChild: true, children: /* @__PURE__ */ jsxs(Link, { href: route("blogs.create"), children: [ /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }), dashboard.add_new_blog ] }) }) ] }), /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-4", children: [ /* @__PURE__ */ jsxs(Card, { children: [ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [ /* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: dashboard.total_blogs }), /* @__PURE__ */ jsx(BookOpen, { className: "text-muted-foreground h-4 w-4" }) ] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "text-2xl font-bold", children: statistics.total }) }) ] }), /* @__PURE__ */ jsxs(Card, { children: [ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [ /* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: dashboard.published }), /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4 text-green-600" }) ] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-green-600", children: statistics.published }) }) ] }), /* @__PURE__ */ jsxs(Card, { children: [ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [ /* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: dashboard.draft }), /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 text-yellow-600" }) ] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-yellow-600", children: statistics.draft }) }) ] }), /* @__PURE__ */ jsxs(Card, { children: [ /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [ /* @__PURE__ */ jsx(CardTitle, { className: "text-sm font-medium", children: dashboard.archived }), /* @__PURE__ */ jsx(Archive, { className: "h-4 w-4 text-gray-600" }) ] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-gray-600", children: statistics.archived }) }) ] }) ] }), /* @__PURE__ */ jsxs(Card, { children: [ /* @__PURE__ */ jsx(TableFilter, { data: blogs, title: dashboard.blog, globalSearch: true, tablePageSizes: [10, 15, 20, 25], routeName: "blogs.index" }), /* @__PURE__ */ jsxs(Table, { className: "border-border border-y", children: [ /* @__PURE__ */ jsx(TableHeader, { table }), /* @__PURE__ */ jsx(TableBody, { children: ((_a = table.getRowModel().rows) == null ? void 0 : _a.length) ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow, { "data-state": row.getIsSelected() && "selected", children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: frontend.no_results }) }) }) ] }), /* @__PURE__ */ jsx(TableFooter, { className: "p-5 sm:p-7", routeName: "blogs.index", paginationInfo: blogs }) ] }) ] }) ] }); }; BlogsIndex.layout = (page) => /* @__PURE__ */ jsx(DashboardLayout, { children: page }); export { BlogsIndex as default };