refactor: remove 'No' column from various finance and HR tables to streamline data presentation
This commit is contained in:
parent
d82b7f13f2
commit
6e165d95c4
@ -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) && (
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
@ -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>,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user