fix: correção dos valores da coluna
This commit is contained in:
parent
0d7d3986f4
commit
b0a40fcc16
|
|
@ -251,22 +251,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) {
|
|||
width: 130,
|
||||
sortable: true,
|
||||
resizable: true,
|
||||
valueFormatter: (params: any) => {
|
||||
renderCell: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "-";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "-";
|
||||
return new Intl.NumberFormat("pt-BR", {
|
||||
const formatted = new Intl.NumberFormat("pt-BR", {
|
||||
style: "currency",
|
||||
currency: "BRL",
|
||||
}).format(numValue);
|
||||
},
|
||||
cellClassName: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "text-gray-500";
|
||||
return numValue < 0 ? "text-red-600" : "text-gray-900";
|
||||
return (
|
||||
<span className={numValue < 0 ? "text-red-600" : "text-gray-900"}>
|
||||
{formatted}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -276,22 +274,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) {
|
|||
width: 140,
|
||||
sortable: true,
|
||||
resizable: true,
|
||||
valueFormatter: (params: any) => {
|
||||
renderCell: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "-";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "-";
|
||||
return new Intl.NumberFormat("pt-BR", {
|
||||
const formatted = new Intl.NumberFormat("pt-BR", {
|
||||
style: "currency",
|
||||
currency: "BRL",
|
||||
}).format(numValue);
|
||||
},
|
||||
cellClassName: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "text-gray-500";
|
||||
return numValue < 0 ? "text-red-600" : "text-gray-900";
|
||||
return (
|
||||
<span className={numValue < 0 ? "text-red-600" : "text-gray-900"}>
|
||||
{formatted}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -301,22 +297,20 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) {
|
|||
width: 130,
|
||||
sortable: true,
|
||||
resizable: true,
|
||||
valueFormatter: (params: any) => {
|
||||
renderCell: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "-";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "-";
|
||||
return new Intl.NumberFormat("pt-BR", {
|
||||
const formatted = new Intl.NumberFormat("pt-BR", {
|
||||
style: "currency",
|
||||
currency: "BRL",
|
||||
}).format(numValue);
|
||||
},
|
||||
cellClassName: (params: any) => {
|
||||
const value = params.value;
|
||||
if (value === null || value === undefined || value === "" || value === 0) return "text-gray-500";
|
||||
const numValue = typeof value === "string" ? parseFloat(value) : Number(value);
|
||||
if (isNaN(numValue)) return "text-gray-500";
|
||||
return numValue < 0 ? "text-red-600" : "text-gray-900";
|
||||
return (
|
||||
<span className={numValue < 0 ? "text-red-600" : "text-gray-900"}>
|
||||
{formatted}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -341,7 +335,7 @@ export default function AnaliticoComponent({ filtros }: AnaliticoProps) {
|
|||
width: 80,
|
||||
sortable: true,
|
||||
resizable: true,
|
||||
valueFormatter: (params: any) => params.value || "-",
|
||||
renderCell: (params: any) => params.value || "-",
|
||||
},
|
||||
] as any, []);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue