refactor: remove 'No' column from various finance and HR tables to streamline data presentation

This commit is contained in:
Yoga Pangestu 2026-08-02 01:50:43 +07:00
parent d82b7f13f2
commit 6e165d95c4
14 changed files with 36 additions and 160 deletions

View File

@ -189,20 +189,42 @@ export function DataTable<TData, TValue>({
300,
);
const visibleColumns = isSortable
? [
{
id: 'drag',
header: '',
cell: () => <DragHandleTrigger />,
meta: {
className: 'w-[40px]',
headerClassName: 'w-[40px]',
},
} as ColumnDef<TData, TValue>,
...columns,
]
: columns;
const totalPages = pagination?.last_page ?? 1;
const currentPage = pagination?.current_page ?? 1;
const visibleColumns = [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">
{isServerMode
? (currentPage - 1) * (pagination?.per_page ?? 25) +
row.index +
1
: row.index + 1}
</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
} as ColumnDef<TData, TValue>,
...(isSortable
? [
{
id: 'drag',
header: '',
cell: () => <DragHandleTrigger />,
meta: {
className: 'w-[40px]',
headerClassName: 'w-[40px]',
},
} as ColumnDef<TData, TValue>,
]
: []),
...columns,
];
const sensors = useSensors(
useSensor(PointerSensor, {
@ -256,9 +278,6 @@ export function DataTable<TData, TValue>({
}
}
const totalPages = pagination?.last_page ?? 1;
const currentPage = pagination?.current_page ?? 1;
return (
<>
{(searchKey || toolbar || isServerMode) && (

View File

@ -26,17 +26,6 @@ export function createCashAccountColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama</span>,

View File

@ -105,17 +105,6 @@ export function createTransactionColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'created_at',
header: () => <span>Tanggal</span>,

View File

@ -100,17 +100,6 @@ export function createEmployeeAdvanceColumns(
const { handleEdit, handleDeleteClick, handleApprove, handlePay } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'created_at',
header: () => <span>Tanggal</span>,

View File

@ -78,17 +78,6 @@ export function createExpenseColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'created_at',
header: () => <span>Tanggal</span>,

View File

@ -79,17 +79,6 @@ export function createPayrollPeriodColumns(
const { showUrl, handleClose, handleReopen } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'year',
header: () => <span>Periode</span>,

View File

@ -82,17 +82,6 @@ export function createPayrollColumns(
} = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
id: 'employee_name',
header: () => <span>Nama Karyawan</span>,

View File

@ -64,17 +64,6 @@ export function createEmployeeColumns(
} = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'user_profile.full_name',
id: 'full_name',

View File

@ -78,17 +78,6 @@ export function createLeaveRequestColumns(
params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
id: 'employee_name',
header: () => <span>Oleh</span>,

View File

@ -24,17 +24,6 @@ export function createCategoryColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama</span>,

View File

@ -26,17 +26,6 @@ export function createCustomerColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama</span>,

View File

@ -143,17 +143,6 @@ export function createProductColumns(
headerClassName: 'hidden',
},
},
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama Produk</span>,

View File

@ -26,17 +26,6 @@ export function createSupplierColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama</span>,

View File

@ -25,17 +25,6 @@ export function createRoleColumns(
const { handleEdit, handleDeleteClick } = params;
return [
{
id: 'no',
header: () => <span className="block text-center">No</span>,
cell: ({ row }) => (
<span className="block text-center">{row.index + 1}</span>
),
meta: {
className: 'w-[50px] text-center',
headerClassName: 'w-[50px] text-center',
},
},
{
accessorKey: 'name',
header: () => <span>Nama Role</span>,