79 lines
3.6 KiB
JavaScript
79 lines
3.6 KiB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
|
|
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 { T as Table, a as TableBody, b as TableRow, c as TableCell } from "./table-BMWNGY4o.js";
|
|
import { usePage } from "@inertiajs/react";
|
|
import { useReactTable, getFilteredRowModel, getSortedRowModel, getCoreRowModel, flexRender } from "@tanstack/react-table";
|
|
import { Plus } from "lucide-react";
|
|
import * as React from "react";
|
|
import AssignmentTableColumn from "./assignment-table-column-BiDQOR4t.js";
|
|
import AssignmentForm from "./assignment-form-Bs7_RhfV.js";
|
|
import "@radix-ui/react-slot";
|
|
import "class-variance-authority";
|
|
import "./utils-DLCPGU0v.js";
|
|
import "clsx";
|
|
import "tailwind-merge";
|
|
import "./badge-J-zeQvMg.js";
|
|
import "./dropdown-menu-msun3TP8.js";
|
|
import "@radix-ui/react-dropdown-menu";
|
|
import "date-fns";
|
|
import "./datetime-picker-BRbsgYE_.js";
|
|
import "react-day-picker";
|
|
import "./popover-Cv6Hz_y0.js";
|
|
import "@radix-ui/react-popover";
|
|
import "./select-BYx0MCUK.js";
|
|
import "@radix-ui/react-select";
|
|
import "./use-lang-44ndmTOc.js";
|
|
import "./input-error-D1JIzedA.js";
|
|
import "./loading-button-CCIxhJrY.js";
|
|
import "./checkbox--3Zj5G-w.js";
|
|
import "@radix-ui/react-checkbox";
|
|
import "./dialog-DGP_3dPQ.js";
|
|
import "@radix-ui/react-dialog";
|
|
import "./input-BsvJqbcd.js";
|
|
import "./label-0rIIfpX0.js";
|
|
import "@radix-ui/react-label";
|
|
import "./scroll-area-CDdrLubh.js";
|
|
import "@radix-ui/react-scroll-area";
|
|
import "./inertia-BtwbgBI3.js";
|
|
import "richtor";
|
|
/* empty css */
|
|
const Assignment = () => {
|
|
var _a;
|
|
const { props } = usePage();
|
|
const { course, translate, tab } = props;
|
|
const [sorting, setSorting] = React.useState([]);
|
|
const table = useReactTable({
|
|
data: course.assignments,
|
|
columns: AssignmentTableColumn(tab, translate, course.enrollments_count || 0),
|
|
onSortingChange: setSorting,
|
|
getCoreRowModel: getCoreRowModel(),
|
|
getSortedRowModel: getSortedRowModel(),
|
|
getFilteredRowModel: getFilteredRowModel(),
|
|
state: { sorting }
|
|
});
|
|
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: /* @__PURE__ */ jsxs(Card, { className: "space-y-6 overflow-hidden p-4 sm:p-6", children: [
|
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
/* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: "Assignments" }),
|
|
/* @__PURE__ */ jsx(
|
|
AssignmentForm,
|
|
{
|
|
title: "Add Assignment",
|
|
handler: /* @__PURE__ */ jsxs(Button, { className: "flex items-center gap-2", children: [
|
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
/* @__PURE__ */ jsx("span", { children: "Add Assignment" })
|
|
] })
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs(Table, { className: "border-border min-w-3xl 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, { className: "h-24 text-center", children: translate.frontend.no_results }) }) })
|
|
] }) })
|
|
] }) });
|
|
};
|
|
export {
|
|
Assignment as default
|
|
};
|