From 9a1422ef28952070fdb54c76c881e1097cb837bd Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Wed, 22 Jul 2026 13:42:28 +0700 Subject: [PATCH] feat: add fields translations to common.json and enhance EnterpriseDataTable with status column and StatusBadge component --- .../core-i18n/src/languages/en/common.json | 35 +++++++++++++++++++ .../core-i18n/src/languages/id/common.json | 35 +++++++++++++++++++ .../components/data-table/index.tsx | 18 ++++++++-- 3 files changed, 85 insertions(+), 3 deletions(-) diff --git a/packages/core-i18n/src/languages/en/common.json b/packages/core-i18n/src/languages/en/common.json index 9172a9c..98e6a83 100644 --- a/packages/core-i18n/src/languages/en/common.json +++ b/packages/core-i18n/src/languages/en/common.json @@ -113,6 +113,41 @@ "system_menu": { "history": "History", "bookmark": "Bookmark" + }, + "fields": { + "id": "ID", + "code": "Code", + "name": "Name", + "description": "Description", + "number": "Number", + "status": "Status", + "type": "Type", + "category": "Category", + "action": "Action", + "createdAt": "Created At", + "updatedAt": "Updated At", + "createdBy": "Created By", + "updatedBy": "Updated By", + "deletedAt": "Deleted At", + "date": "Date", + "amount": "Amount", + "price": "Price", + "quantity": "Quantity", + "total": "Total", + "balance": "Balance", + "address": "Address", + "phone": "Phone Number", + "email": "Email", + "user": "User", + "role": "Role", + "notes": "Notes", + "isActive": "Active", + "isDefault": "Default", + "isRequired": "Required", + "startDate": "Start Date", + "endDate": "End Date", + "attachment": "Attachment", + "reference": "Reference" } } } \ No newline at end of file diff --git a/packages/core-i18n/src/languages/id/common.json b/packages/core-i18n/src/languages/id/common.json index 2f54f0f..a390063 100644 --- a/packages/core-i18n/src/languages/id/common.json +++ b/packages/core-i18n/src/languages/id/common.json @@ -113,6 +113,41 @@ "system_menu": { "history": "Riwayat", "bookmark": "Bookmark" + }, + "fields": { + "id": "ID", + "code": "Kode", + "name": "Nama", + "description": "Deskripsi", + "number": "Nomor", + "status": "Status", + "type": "Tipe", + "category": "Kategori", + "action": "Aksi", + "createdAt": "Tanggal Dibuat", + "updatedAt": "Tanggal Diperbarui", + "createdBy": "Dibuat Oleh", + "updatedBy": "Diperbarui Oleh", + "deletedAt": "Tanggal Dihapus", + "date": "Tanggal", + "amount": "Nominal", + "price": "Harga", + "quantity": "Kuantitas", + "total": "Total", + "balance": "Saldo", + "address": "Alamat", + "phone": "No. Telepon", + "email": "Email", + "user": "Pengguna", + "role": "Peran", + "notes": "Catatan", + "isActive": "Aktif", + "isDefault": "Bawaan", + "isRequired": "Wajib", + "startDate": "Tanggal Mulai", + "endDate": "Tanggal Selesai", + "attachment": "Lampiran", + "reference": "Referensi" } } } \ No newline at end of file diff --git a/packages/ui/src/foundations/enterprise-module/components/data-table/index.tsx b/packages/ui/src/foundations/enterprise-module/components/data-table/index.tsx index 7cb7ddd..51bccbf 100644 --- a/packages/ui/src/foundations/enterprise-module/components/data-table/index.tsx +++ b/packages/ui/src/foundations/enterprise-module/components/data-table/index.tsx @@ -13,7 +13,7 @@ import { } from 'ag-grid-community'; import { Box } from '@mantine/core'; -import { DataGrid } from '../../../../components'; +import { DataGrid, StatusBadge } from '../../../../components'; import { useEnterpriseModuleDataServiceContext, @@ -108,8 +108,20 @@ export function EnterpriseDataTable(props: EnterpriseDataT // Ensure column definitions are referentially stable const finalColumnDefs = useMemo[]>(() => { - return columnDefs; - }, [columnDefs]); + const masterDetailColumn: ColDef = { maxWidth: 50, sortable: false, cellRenderer: 'agGroupCellRenderer' }; + const statusColumn: ColDef = { + maxWidth: 130, + field: 'status' as any, + headerName: t('common:fields.status'), + cellRenderer: ({ value }: any) => , + }; + + const prefixColumn: ColDef[] = [props.masterDetail ? masterDetailColumn : (null as any), statusColumn].filter( + Boolean, + ); + + return [...prefixColumn, ...columnDefs]; + }, [columnDefs, props.masterDetail]); // Default configuration applied to all columns in the grid const defaultColDef = useMemo(() => ({ flex: 1, minWidth: 100, sortable: true, resizable: true }), []);