feat(server): table sheet pdf

This commit is contained in:
Ahmed Bouhuolia
2024-02-21 14:55:06 +02:00
parent f6f6bc31b6
commit d16ec7cda9
3 changed files with 34 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import { kebabCase } from 'lodash';
import { ITableRow } from '@/interfaces';
export const formatNumber = (balance, { noCents, divideOn1000 }): string => {
let formattedBalance: number = parseFloat(balance);
@@ -10,4 +11,20 @@ export const formatNumber = (balance, { noCents, divideOn1000 }): string => {
formattedBalance /= 1000;
}
return formattedBalance;
};
};
export const tableClassNames = (rows: ITableRow[]) => {
return rows.map((row) => {
const classNames =
row?.rowTypes?.map((rowType) => `row-type--${kebabCase(rowType)}`) || [];
if (row.id) {
classNames.push(`row-id--${kebabCase(row.id)}`);
}
return {
...row,
classNames,
};
});
};