= {
+ active: 'Aktif',
+ on_leave: 'Cuti',
+ graduated: 'Lulus',
+ dropped_out: 'Drop Out',
+};
+
+const StudentStatusVariants: Record<
+ string,
+ 'default' | 'secondary' | 'destructive' | 'outline'
+> = {
+ active: 'default',
+ on_leave: 'secondary',
+ graduated: 'outline',
+ dropped_out: 'destructive',
+};
+
+export function StudentStatusBadge({ status }: StudentStatusBadgeProps) {
+ if (!status) {
+ return -;
+ }
+
+ return (
+
+ {StudentStatusLabels[status] ?? status}
+
+ );
+}
diff --git a/resources/js/pages/admin/users/administrators/columns.tsx b/resources/js/pages/admin/users/administrators/columns.tsx
index 6c95a87..0ea11b2 100644
--- a/resources/js/pages/admin/users/administrators/columns.tsx
+++ b/resources/js/pages/admin/users/administrators/columns.tsx
@@ -1,6 +1,7 @@
-import { RowActions } from '@/components/row-actions';
import type { ColumnDef } from '@tanstack/react-table';
import { Key, Pencil, Trash2 } from 'lucide-react';
+import { GenderBadge } from '@/components/gender-badge';
+import { RowActions } from '@/components/row-actions';
export type Administrator = {
id: number;
@@ -33,7 +34,9 @@ export function createAdministratorColumns(
cell: ({ row }) => (
{row.original.username}
- {row.original.email}
+
+ {row.original.email}
+
),
},
@@ -50,10 +53,9 @@ export function createAdministratorColumns(
{
accessorKey: 'profile.gender',
header: () => Jenis Kelamin,
- cell: ({ row }) => {
- const gender = row.original.profile?.gender;
- return gender === 'male' ? 'Laki-laki' : gender === 'female' ? 'Perempuan' : '-';
- },
+ cell: ({ row }) => (
+
+ ),
},
{
id: 'actions',
@@ -80,7 +82,9 @@ export function createAdministratorColumns(
},
{
label: 'Hapus',
- icon: ,
+ icon: (
+
+ ),
onClick: () => handleDeleteClick(admin),
},
]}
diff --git a/resources/js/pages/admin/users/lecturers/columns.tsx b/resources/js/pages/admin/users/lecturers/columns.tsx
index e13a311..74a090c 100644
--- a/resources/js/pages/admin/users/lecturers/columns.tsx
+++ b/resources/js/pages/admin/users/lecturers/columns.tsx
@@ -1,13 +1,17 @@
-import { RowActions } from '@/components/row-actions';
import type { ColumnDef } from '@tanstack/react-table';
import { Key, Pencil, Trash2 } from 'lucide-react';
+import { GenderBadge } from '@/components/gender-badge';
+import { RowActions } from '@/components/row-actions';
export type Lecturer = {
id: number;
username: string;
email: string;
- profile: { full_name: string } | null;
- lecturer: { lecturer_number: string; department: { name: string } | null } | null;
+ profile: { full_name: string; phone_number: string; gender: string } | null;
+ lecturer: {
+ lecturer_number: string;
+ department: { name: string } | null;
+ } | null;
};
type CreateColumnsParams = {
@@ -23,14 +27,16 @@ export function createLecturerColumns(
return [
{
- accessorKey: 'lecturer.lecturer_number',
+ id: 'identity',
header: () => NIDN,
- cell: ({ row }) => row.original.lecturer?.lecturer_number ?? '-',
- },
- {
- accessorKey: 'profile.full_name',
- header: () => Nama Lengkap,
- cell: ({ row }) => row.original.profile?.full_name ?? '-',
+ cell: ({ row }) => (
+
+ {row.original.lecturer?.lecturer_number ?? '-'}
+
+ {row.original.profile?.full_name ?? '-'}
+
+
+ ),
},
{
id: 'account',
@@ -38,7 +44,9 @@ export function createLecturerColumns(
cell: ({ row }) => (
{row.original.username}
- {row.original.email}
+
+ {row.original.email}
+
),
},
@@ -47,6 +55,18 @@ export function createLecturerColumns(
header: () => Jurusan,
cell: ({ row }) => row.original.lecturer?.department?.name ?? '-',
},
+ {
+ accessorKey: 'profile.phone_number',
+ header: () => Nomor Telepon,
+ cell: ({ row }) => row.original.profile?.phone_number ?? '-',
+ },
+ {
+ accessorKey: 'profile.gender',
+ header: () => Jenis Kelamin,
+ cell: ({ row }) => (
+
+ ),
+ },
{
id: 'actions',
header: () => Aksi,
@@ -72,7 +92,9 @@ export function createLecturerColumns(
},
{
label: 'Hapus',
- icon: ,
+ icon: (
+
+ ),
onClick: () => handleDeleteClick(lecturer),
},
]}
diff --git a/resources/js/pages/admin/users/students/columns.tsx b/resources/js/pages/admin/users/students/columns.tsx
index 981d8a0..75c36cb 100644
--- a/resources/js/pages/admin/users/students/columns.tsx
+++ b/resources/js/pages/admin/users/students/columns.tsx
@@ -1,13 +1,20 @@
-import { RowActions } from '@/components/row-actions';
import type { ColumnDef } from '@tanstack/react-table';
import { Key, Pencil, Trash2 } from 'lucide-react';
+import { GenderBadge } from '@/components/gender-badge';
+import { RowActions } from '@/components/row-actions';
+import { StudentStatusBadge } from '@/components/student-status-badge';
export type Student = {
id: number;
username: string;
email: string;
- profile: { full_name: string } | null;
- student: { student_number: string; department: { name: string } | null; enrollment_year: number; status: string | null } | null;
+ profile: { full_name: string; phone_number: string; gender: string } | null;
+ student: {
+ student_number: string;
+ department: { name: string } | null;
+ enrollment_year: number;
+ status: string | null;
+ } | null;
};
type CreateColumnsParams = {
@@ -23,14 +30,16 @@ export function createStudentColumns(
return [
{
- accessorKey: 'student.student_number',
+ id: 'identity',
header: () => NIM,
- cell: ({ row }) => row.original.student?.student_number ?? '-',
- },
- {
- accessorKey: 'profile.full_name',
- header: () => Nama Lengkap,
- cell: ({ row }) => row.original.profile?.full_name ?? '-',
+ cell: ({ row }) => (
+
+ {row.original.student?.student_number ?? '-'}
+
+ {row.original.profile?.full_name ?? '-'}
+
+
+ ),
},
{
id: 'account',
@@ -38,7 +47,9 @@ export function createStudentColumns(
cell: ({ row }) => (
{row.original.username}
- {row.original.email}
+
+ {row.original.email}
+
),
},
@@ -55,7 +66,21 @@ export function createStudentColumns(
{
accessorKey: 'student.status',
header: () => Status,
- cell: ({ row }) => row.original.student?.status ?? '-',
+ cell: ({ row }) => (
+
+ ),
+ },
+ {
+ accessorKey: 'profile.phone_number',
+ header: () => Nomor Telepon,
+ cell: ({ row }) => row.original.profile?.phone_number ?? '-',
+ },
+ {
+ accessorKey: 'profile.gender',
+ header: () => Jenis Kelamin,
+ cell: ({ row }) => (
+
+ ),
},
{
id: 'actions',
@@ -82,7 +107,9 @@ export function createStudentColumns(
},
{
label: 'Hapus',
- icon: ,
+ icon: (
+
+ ),
onClick: () => handleDeleteClick(student),
},
]}