- Added a new column to display open semesters in the academic terms table with badges. - Removed course registration related pages and components including index, create, and show. - Updated course registration types to reflect changes in the data structure. - Refactored admin routes for course registrations to streamline submission handling.
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import type { ColumnDef } from '@tanstack/react-table';
|
|
import { Eye } from 'lucide-react';
|
|
import { RowActions } from '@/components/row-actions';
|
|
import { show } from '@/routes/admin/manage/course-registrations';
|
|
import type { CourseRegistrationRow } from '@/types/course-registration';
|
|
|
|
export type { CourseRegistrationRow } from '@/types/course-registration';
|
|
|
|
export function createCourseRegistrationColumns(): ColumnDef<CourseRegistrationRow>[] {
|
|
return [
|
|
{
|
|
id: 'student',
|
|
header: () => <span>Mahasiswa</span>,
|
|
cell: ({ row }) => {
|
|
const student = row.original.student;
|
|
|
|
return (
|
|
<div>
|
|
<p className="font-medium">
|
|
{student?.user?.profile?.full_name ?? 'N/A'}
|
|
</p>
|
|
<p className="text-xs text-muted-foreground">
|
|
{student?.student_number}
|
|
</p>
|
|
</div>
|
|
);
|
|
},
|
|
},
|
|
{
|
|
id: 'department',
|
|
header: () => <span>Jurusan</span>,
|
|
cell: ({ row }) => row.original.student?.department?.name ?? '-',
|
|
},
|
|
{
|
|
id: 'actions',
|
|
header: () => <span className="block text-center">Aksi</span>,
|
|
meta: {
|
|
className: 'w-[80px] text-center',
|
|
headerClassName: 'w-[80px] text-center',
|
|
},
|
|
cell: ({ row }) => (
|
|
<RowActions
|
|
actions={[
|
|
{
|
|
label: 'Lihat Detail',
|
|
icon: <Eye className="h-4 w-4" />,
|
|
href: show.url(row.original.student_id),
|
|
},
|
|
]}
|
|
/>
|
|
),
|
|
},
|
|
];
|
|
}
|