Skip to content

Commit

Permalink
feat: Mark more columns as money columns
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Sep 4, 2024
1 parent 66fb0c9 commit fe5cd5a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ const dateRangeMapper = (data, index, column) => ({
key: column.key,
accessor: `cells[${index}].value`,
width: getColumnWidth(data, `cells.${index}.value`, {
magicSpacing: 10,
magicSpacing: 12,
minWidth: 100,
}),
className: `date-period ${column.key}`,
disableSortBy: true,
textOverview: true,
align: Align.Right,
money: true
});

/**
Expand All @@ -50,11 +51,12 @@ const totalMapper = (data, index, column) => ({
textOverview: true,
Cell: CellTextSpan,
width: getColumnWidth(data, `cells[${index}].value`, {
magicSpacing: 10,
magicSpacing: 12,
minWidth: 100,
}),
disableSortBy: true,
align: Align.Right,
money: true
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ export const useCustomersTransactionsColumns = () => {
textOverview: true,
width: getColumnWidth(tableRows, 'cells[5].value', {
minWidth: 100,
magicSpacing: 10,
magicSpacing: 12,
}),
align: Align.Right,
money: true,
},
{
Header: intl.get('debit'),
Expand All @@ -72,9 +73,10 @@ export const useCustomersTransactionsColumns = () => {
textOverview: true,
width: getColumnWidth(tableRows, 'cells[6].value', {
minWidth: 100,
magicSpacing: 10,
magicSpacing: 12,
}),
align: Align.Right,
money: true,
},
{
Header: intl.get('running_balance'),
Expand All @@ -83,9 +85,10 @@ export const useCustomersTransactionsColumns = () => {
textOverview: true,
width: getColumnWidth(tableRows, 'cells[7].value', {
minWidth: 120,
magicSpacing: 10,
magicSpacing: 12,
}),
align: Align.Right,
money: true,
},
],
[tableRows],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as R from 'ramda';
import { isEmpty } from 'lodash';

import { Align } from '@/constants';
import { CellTextSpan } from '@/components/Datatable/Cells';
import { getColumnWidth } from '@/utils';

const getTableCellValueAccessor = (index) => `cells[${index}].value`;
Expand Down Expand Up @@ -34,6 +33,7 @@ const percentageOfIncomeAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -52,6 +52,7 @@ const percentageOfExpenseAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -70,6 +71,7 @@ const percentageOfColumnAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -88,6 +90,7 @@ const percentageOfRowAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -106,6 +109,7 @@ const previousYearAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -124,6 +128,7 @@ const previousYearChangeAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -142,6 +147,7 @@ const previousYearPercentageAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -160,6 +166,7 @@ const previousPeriodAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -178,6 +185,7 @@ const previousPeriodChangeAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand All @@ -196,6 +204,7 @@ const previousPeriodPercentageAccessor = R.curry((data, column) => {
align: Align.Right,
disableSortBy: true,
textOverview: true,
money: true
};
});

Expand Down Expand Up @@ -274,10 +283,10 @@ const totalColumn = R.curry((data, column) => {
Header: column.label,
accessor,
textOverview: true,
Cell: CellTextSpan,
width,
disableSortBy: true,
align: hasChildren ? Align.Center : Align.Right,
money: true
};
});

Expand Down Expand Up @@ -338,6 +347,7 @@ const dateRangeColumn = R.curry((data, column) => {
disableSortBy: true,
textOverview: true,
align: isDateColumnHasColumns ? Align.Center : Align.Right,
money: true
};
return R.compose(
R.when(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const numericColumnAccessor = R.curry((data, column) => {
...column,
align: Align.Right,
width,
money: true
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const numericColumnAccessor = R.curry((data, column) => {
...column,
align: Align.Right,
width,
money: true
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const percentageColumnAccessor = () => ({
width: 140,
textOverview: true,
align: Align.Right,
money: true
});

/**
Expand All @@ -61,6 +62,7 @@ const totalColumnAccessor = () => ({
width: 140,
textOverview: true,
align: Align.Right,
money: true
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
useVendorsTransactionsCsvExport,
useVendorsTransactionsXlsxExport,
} from '@/hooks/query';
import { Align } from '@/constants';

/**
* Retrieve vendors transactions columns.
Expand Down Expand Up @@ -63,6 +64,8 @@ export const useVendorsTransactionsColumns = () => {
minWidth: 100,
magicSpacing: 10,
}),
money: true,
align: Align.Right,
},
{
Header: intl.get('debit'),
Expand All @@ -73,6 +76,8 @@ export const useVendorsTransactionsColumns = () => {
minWidth: 100,
magicSpacing: 10,
}),
money: true,
align: Align.Right,
},
{
Header: intl.get('running_balance'),
Expand All @@ -83,6 +88,8 @@ export const useVendorsTransactionsColumns = () => {
minWidth: 120,
magicSpacing: 10,
}),
money: true,
align: Align.Right,
},
],
[table],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export function useReceiptsTableColumns() {
align: 'right',
clickable: true,
textOverview: true,
money: true,
className: clsx(CLASSES.FONT_BOLD),
},
{
Expand Down

0 comments on commit fe5cd5a

Please sign in to comment.