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,
|
300,
|
||||||
);
|
);
|
||||||
|
|
||||||
const visibleColumns = isSortable
|
const totalPages = pagination?.last_page ?? 1;
|
||||||
? [
|
const currentPage = pagination?.current_page ?? 1;
|
||||||
{
|
|
||||||
id: 'drag',
|
const visibleColumns = [
|
||||||
header: '',
|
{
|
||||||
cell: () => <DragHandleTrigger />,
|
id: 'no',
|
||||||
meta: {
|
header: () => <span className="block text-center">No</span>,
|
||||||
className: 'w-[40px]',
|
cell: ({ row }) => (
|
||||||
headerClassName: 'w-[40px]',
|
<span className="block text-center">
|
||||||
},
|
{isServerMode
|
||||||
} as ColumnDef<TData, TValue>,
|
? (currentPage - 1) * (pagination?.per_page ?? 25) +
|
||||||
...columns,
|
row.index +
|
||||||
]
|
1
|
||||||
: columns;
|
: 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(
|
const sensors = useSensors(
|
||||||
useSensor(PointerSensor, {
|
useSensor(PointerSensor, {
|
||||||
@ -256,9 +278,6 @@ export function DataTable<TData, TValue>({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalPages = pagination?.last_page ?? 1;
|
|
||||||
const currentPage = pagination?.current_page ?? 1;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(searchKey || toolbar || isServerMode) && (
|
{(searchKey || toolbar || isServerMode) && (
|
||||||
|
|||||||
@ -26,17 +26,6 @@ export function createCashAccountColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama</span>,
|
header: () => <span>Nama</span>,
|
||||||
|
|||||||
@ -105,17 +105,6 @@ export function createTransactionColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'created_at',
|
||||||
header: () => <span>Tanggal</span>,
|
header: () => <span>Tanggal</span>,
|
||||||
|
|||||||
@ -100,17 +100,6 @@ export function createEmployeeAdvanceColumns(
|
|||||||
const { handleEdit, handleDeleteClick, handleApprove, handlePay } = params;
|
const { handleEdit, handleDeleteClick, handleApprove, handlePay } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'created_at',
|
||||||
header: () => <span>Tanggal</span>,
|
header: () => <span>Tanggal</span>,
|
||||||
|
|||||||
@ -78,17 +78,6 @@ export function createExpenseColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'created_at',
|
||||||
header: () => <span>Tanggal</span>,
|
header: () => <span>Tanggal</span>,
|
||||||
|
|||||||
@ -79,17 +79,6 @@ export function createPayrollPeriodColumns(
|
|||||||
const { showUrl, handleClose, handleReopen } = params;
|
const { showUrl, handleClose, handleReopen } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'year',
|
||||||
header: () => <span>Periode</span>,
|
header: () => <span>Periode</span>,
|
||||||
|
|||||||
@ -82,17 +82,6 @@ export function createPayrollColumns(
|
|||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
return [
|
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',
|
id: 'employee_name',
|
||||||
header: () => <span>Nama Karyawan</span>,
|
header: () => <span>Nama Karyawan</span>,
|
||||||
|
|||||||
@ -64,17 +64,6 @@ export function createEmployeeColumns(
|
|||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'user_profile.full_name',
|
||||||
id: 'full_name',
|
id: 'full_name',
|
||||||
|
|||||||
@ -78,17 +78,6 @@ export function createLeaveRequestColumns(
|
|||||||
params;
|
params;
|
||||||
|
|
||||||
return [
|
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',
|
id: 'employee_name',
|
||||||
header: () => <span>Oleh</span>,
|
header: () => <span>Oleh</span>,
|
||||||
|
|||||||
@ -24,17 +24,6 @@ export function createCategoryColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama</span>,
|
header: () => <span>Nama</span>,
|
||||||
|
|||||||
@ -26,17 +26,6 @@ export function createCustomerColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama</span>,
|
header: () => <span>Nama</span>,
|
||||||
|
|||||||
@ -143,17 +143,6 @@ export function createProductColumns(
|
|||||||
headerClassName: 'hidden',
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama Produk</span>,
|
header: () => <span>Nama Produk</span>,
|
||||||
|
|||||||
@ -26,17 +26,6 @@ export function createSupplierColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama</span>,
|
header: () => <span>Nama</span>,
|
||||||
|
|||||||
@ -25,17 +25,6 @@ export function createRoleColumns(
|
|||||||
const { handleEdit, handleDeleteClick } = params;
|
const { handleEdit, handleDeleteClick } = params;
|
||||||
|
|
||||||
return [
|
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',
|
accessorKey: 'name',
|
||||||
header: () => <span>Nama Role</span>,
|
header: () => <span>Nama Role</span>,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user