102 lines
4.5 KiB
JavaScript
102 lines
4.5 KiB
JavaScript
import { jsxs, 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 } from "./card-B-gBwpxd.js";
|
|
import { S as Separator } from "./separator-CSqU-rrB.js";
|
|
import { T as Table, a as TableBody, b as TableRow, c as TableCell } from "./table-BMWNGY4o.js";
|
|
import { u as useAuth } from "./use-auth-8FvJer_G.js";
|
|
import { D as DashboardLayout } from "./layout-Cf9mPjOS.js";
|
|
import { useReactTable, getFilteredRowModel, getSortedRowModel, getCoreRowModel, flexRender } from "@tanstack/react-table";
|
|
import * as React from "react";
|
|
import AdminTableColumn from "./admin-table-columns-BlYmUBJQ.js";
|
|
import EnrollmentModal from "./enrollment-modal-CClOiviE.js";
|
|
import InstructorTableColumn from "./instructor-table-columns-BB7drc5l.js";
|
|
import "./use-lang-44ndmTOc.js";
|
|
import "@inertiajs/react";
|
|
import "./debounce-ZFxqVthq.js";
|
|
import "./route-DlE7FdTW.js";
|
|
import "./utils-DLCPGU0v.js";
|
|
import "clsx";
|
|
import "tailwind-merge";
|
|
import "lucide-react";
|
|
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 "@radix-ui/react-separator";
|
|
import "./sidebar-C1tqSfnl.js";
|
|
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";
|
|
import "./badge-J-zeQvMg.js";
|
|
import "./combobox-BpeE9nB5.js";
|
|
import "cmdk";
|
|
import "./input-error-D1JIzedA.js";
|
|
import "./loading-button-CCIxhJrY.js";
|
|
import "./label-0rIIfpX0.js";
|
|
import "@radix-ui/react-label";
|
|
import "./radio-group-Wf8uu9ZY.js";
|
|
import "@radix-ui/react-radio-group";
|
|
const Courses = (props) => {
|
|
const { isAdmin } = useAuth();
|
|
const [sorting, setSorting] = React.useState([]);
|
|
const { translate, enrollments } = props;
|
|
const { button, dashboard } = translate;
|
|
const table = useReactTable({
|
|
data: enrollments.data,
|
|
columns: isAdmin ? AdminTableColumn("course", translate, "enrollments.destroy") : InstructorTableColumn("course", translate),
|
|
onSortingChange: setSorting,
|
|
getCoreRowModel: getCoreRowModel(),
|
|
getSortedRowModel: getSortedRowModel(),
|
|
getFilteredRowModel: getFilteredRowModel(),
|
|
state: { sorting }
|
|
});
|
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
/* @__PURE__ */ jsx(EnrollmentModal, { type: "course", title: "Add New Course Enrollment", handler: /* @__PURE__ */ jsx(Button, { children: button.add_new_enrollment }) }),
|
|
/* @__PURE__ */ jsx(Separator, { className: "my-6" }),
|
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
/* @__PURE__ */ jsx(
|
|
TableFilter,
|
|
{
|
|
data: enrollments,
|
|
title: dashboard.course_list,
|
|
globalSearch: true,
|
|
tablePageSizes: [10, 15, 20, 25],
|
|
routeName: "course-enrollments.index"
|
|
}
|
|
),
|
|
/* @__PURE__ */ jsxs(Table, { className: "border-border border-y", children: [
|
|
/* @__PURE__ */ jsx(TableHeader, { table }),
|
|
/* @__PURE__ */ jsx(TableBody, { children: enrollments.data && enrollments.data.length > 0 ? 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, { className: "h-24 text-center", children: dashboard.no_results }) }) })
|
|
] }),
|
|
/* @__PURE__ */ jsx(TableFooter, { className: "p-5 sm:p-7", routeName: "course-enrollments.index", paginationInfo: enrollments })
|
|
] })
|
|
] });
|
|
};
|
|
Courses.layout = (page) => /* @__PURE__ */ jsx(DashboardLayout, { children: page });
|
|
export {
|
|
Courses as default
|
|
};
|