Nombres de las columnas para mostrar/ocultar
This commit is contained in:
parent
e8f40b1495
commit
a7543497b0
@ -418,7 +418,7 @@
|
|||||||
"columns": {
|
"columns": {
|
||||||
"proforma_reference": "Num.",
|
"proforma_reference": "Num.",
|
||||||
"series": "Serie",
|
"series": "Serie",
|
||||||
"reference": "Reference",
|
"reference": "Referencia",
|
||||||
"status": "Estado",
|
"status": "Estado",
|
||||||
"proforma_date": "Fecha",
|
"proforma_date": "Fecha",
|
||||||
"operation_date": "Fecha de operación",
|
"operation_date": "Fecha de operación",
|
||||||
@ -431,9 +431,10 @@
|
|||||||
"recipient_postal_code": "Código postal",
|
"recipient_postal_code": "Código postal",
|
||||||
"recipient_country": "País",
|
"recipient_country": "País",
|
||||||
"subtotal_amount": "Subtotal",
|
"subtotal_amount": "Subtotal",
|
||||||
"discount_amount": "Descuentos",
|
"discount_amount": "Dtos.",
|
||||||
|
"taxable_amount": "Base imp.",
|
||||||
"taxes_amount": "Impuestos",
|
"taxes_amount": "Impuestos",
|
||||||
"total_amount": "Importe total"
|
"total_amount": "Total"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"archived": {
|
"archived": {
|
||||||
|
|||||||
@ -132,6 +132,7 @@ export function useProformasGridColumns(
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.proforma_reference"),
|
||||||
cellClassName: "font-mono text-sm font-medium",
|
cellClassName: "font-mono text-sm font-medium",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -149,6 +150,7 @@ export function useProformasGridColumns(
|
|||||||
),
|
),
|
||||||
cell: ({ row }) => DateHelper.format(row.original.proformaDate),
|
cell: ({ row }) => DateHelper.format(row.original.proformaDate),
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.proforma_date"),
|
||||||
cellClassName: "text-muted-foreground",
|
cellClassName: "text-muted-foreground",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -170,6 +172,9 @@ export function useProformasGridColumns(
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.status"),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Cliente
|
// Cliente
|
||||||
@ -194,16 +199,20 @@ export function useProformasGridColumns(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.recipient"),
|
||||||
cellClassName: "max-w-128",
|
cellClassName: "max-w-128",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "series",
|
id: "series",
|
||||||
accessorKey: "series",
|
accessorKey: "series",
|
||||||
header: "Serie",
|
header: t("pages.proformas.list.columns.series"),
|
||||||
enableHiding: true,
|
enableHiding: true,
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
cell: ({ row }) => row.original.series || <EmptyCellValue />,
|
cell: ({ row }) => row.original.series || <EmptyCellValue />,
|
||||||
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.series"),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "reference",
|
id: "reference",
|
||||||
@ -223,6 +232,7 @@ export function useProformasGridColumns(
|
|||||||
<EmptyCellValue />
|
<EmptyCellValue />
|
||||||
),
|
),
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.reference"),
|
||||||
cellClassName: "hidden lg:table-cell max-w-16 text-muted-foreground",
|
cellClassName: "hidden lg:table-cell max-w-16 text-muted-foreground",
|
||||||
headerClassName: "hidden lg:table-cell",
|
headerClassName: "hidden lg:table-cell",
|
||||||
},
|
},
|
||||||
@ -240,6 +250,7 @@ export function useProformasGridColumns(
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.subtotal_amount"),
|
||||||
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
||||||
headerClassName: "hidden 2xl:table-cell text-right",
|
headerClassName: "hidden 2xl:table-cell text-right",
|
||||||
},
|
},
|
||||||
@ -247,9 +258,10 @@ export function useProformasGridColumns(
|
|||||||
{
|
{
|
||||||
id: "totalDiscountAmountFmt",
|
id: "totalDiscountAmountFmt",
|
||||||
accessorKey: "totalDiscountAmountFmt",
|
accessorKey: "totalDiscountAmountFmt",
|
||||||
header: "Dtos",
|
header: t("pages.proformas.list.columns.discount_amount"),
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.discount_amount"),
|
||||||
cellClassName:
|
cellClassName:
|
||||||
"hidden 2xl:table-cell text-right tabular-nums font-medium text-muted-foreground",
|
"hidden 2xl:table-cell text-right tabular-nums font-medium text-muted-foreground",
|
||||||
headerClassName: "hidden 2xl:table-cell text-right",
|
headerClassName: "hidden 2xl:table-cell text-right",
|
||||||
@ -258,9 +270,10 @@ export function useProformasGridColumns(
|
|||||||
{
|
{
|
||||||
id: "taxableAmountFmt",
|
id: "taxableAmountFmt",
|
||||||
accessorKey: "taxableAmountFmt",
|
accessorKey: "taxableAmountFmt",
|
||||||
header: "Base Imp.",
|
header: t("pages.proformas.list.columns.taxable_amount"),
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.taxable_amount"),
|
||||||
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
||||||
headerClassName: "hidden 2xl:table-cell text-right",
|
headerClassName: "hidden 2xl:table-cell text-right",
|
||||||
},
|
},
|
||||||
@ -268,9 +281,10 @@ export function useProformasGridColumns(
|
|||||||
{
|
{
|
||||||
id: "taxesAmountFmt",
|
id: "taxesAmountFmt",
|
||||||
accessorKey: "taxesAmountFmt",
|
accessorKey: "taxesAmountFmt",
|
||||||
header: "Impuestos",
|
header: t("pages.proformas.list.columns.taxes_amount"),
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.taxes_amount"),
|
||||||
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
cellClassName: "hidden 2xl:table-cell text-right tabular-nums font-medium",
|
||||||
headerClassName: "hidden 2xl:table-cell text-right",
|
headerClassName: "hidden 2xl:table-cell text-right",
|
||||||
},
|
},
|
||||||
@ -278,9 +292,10 @@ export function useProformasGridColumns(
|
|||||||
{
|
{
|
||||||
id: "totalAmountFmt",
|
id: "totalAmountFmt",
|
||||||
accessorKey: "totalAmountFmt",
|
accessorKey: "totalAmountFmt",
|
||||||
header: "Total",
|
header: t("pages.proformas.list.columns.total_amount"),
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
meta: {
|
meta: {
|
||||||
|
title: t("pages.proformas.list.columns.total_amount"),
|
||||||
cellClassName: "hidden xl:table-cell text-right tabular-nums font-semibold",
|
cellClassName: "hidden xl:table-cell text-right tabular-nums font-semibold",
|
||||||
headerClassName: "hidden xl:table-cell text-right",
|
headerClassName: "hidden xl:table-cell text-right",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -60,16 +60,15 @@ export function DataTableViewOptions<TData>({ table }: { table: Table<TData> })
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getColumnLabel = <TData, TValue>(column: Column<TData, TValue>): string => {
|
const getColumnLabel = <TData, TValue>(column: Column<TData, TValue>): string => {
|
||||||
let label = String(column.id);
|
const meta = column.columnDef.meta as { title?: string } | undefined;
|
||||||
|
let label = meta?.title ?? String(column.id);
|
||||||
const h = column.columnDef.header;
|
const h = column.columnDef.header;
|
||||||
|
|
||||||
// header como string literal
|
// header como string literal
|
||||||
if (typeof h === "string") label = h;
|
if (typeof h === "string") label = meta?.title ?? h;
|
||||||
|
|
||||||
// header función → intentar obtener title si lo usas en tus componentes
|
// Para cabeceras dinámicas, usamos un título explícito para no exponer ids técnicos.
|
||||||
if (typeof h === "function") {
|
if (typeof h === "function") {
|
||||||
// tu DataTableColumnHeader recibe `title` como prop → está en column.columnDef.meta
|
|
||||||
const meta = column.columnDef.meta as { title?: string } | undefined;
|
|
||||||
label = meta?.title ?? column.id;
|
label = meta?.title ?? column.id;
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user