configuration for how fields look and EnhancedTable component for enhanced table display

This commit is contained in:
2026-04-01 18:47:23 +05:30
parent 344106f1a4
commit 44567496a1
8 changed files with 298 additions and 512 deletions

View File

@@ -0,0 +1,50 @@
/**
* This file contains application-specific overrides and configuration
* for the generic Admin Panel.
*/
export interface FieldOverride {
displayField?: string;
formatter?: (value: any) => string;
}
export interface ResourceOverride {
fields?: Record<string, FieldOverride>;
}
export const configuration: Record<string, ResourceOverride> = {
expenses: {
fields: {
payee: {
displayField: "name",
},
payor: {
displayField: "username",
},
account: {
displayField: "nickname",
},
tags: {
displayField: "name",
},
occurred_at: {
formatter: (val: string) => {
const date = new Date(val);
const day = date.getDate();
const month = date.toLocaleString('default', { month: 'long' });
const year = date.getFullYear();
const suffix = (day: number) => {
if (day > 3 && day < 21) return 'th';
switch (day % 10) {
case 1: return "st";
case 2: return "nd";
case 3: return "rd";
default: return "th";
}
};
return `${day}${suffix(day)} ${month} ${year}`;
}
}
},
},
};