mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
wip
This commit is contained in:
@@ -33,6 +33,7 @@ import { DRAWERS } from '@/constants/drawers';
|
||||
function ManualJournalsDataTable({
|
||||
// #withManualJournalsActions
|
||||
setManualJournalsTableState,
|
||||
setManualJournalsSelectedRows,
|
||||
|
||||
// #withAlertsActions
|
||||
openAlert,
|
||||
@@ -67,31 +68,26 @@ function ManualJournalsDataTable({
|
||||
const handlePublishJournal = ({ id }) => {
|
||||
openAlert('journal-publish', { manualJournalId: id });
|
||||
};
|
||||
|
||||
// Handle the journal edit action.
|
||||
const handleEditJournal = ({ id }) => {
|
||||
history.push(`/manual-journals/${id}/edit`);
|
||||
};
|
||||
|
||||
// Handle the journal delete action.
|
||||
const handleDeleteJournal = ({ id }) => {
|
||||
openAlert('journal-delete', { manualJournalId: id });
|
||||
};
|
||||
|
||||
// Handle view detail journal.
|
||||
const handleViewDetailJournal = ({ id }) => {
|
||||
openDrawer(DRAWERS.JOURNAL_DETAILS, {
|
||||
manualJournalId: id,
|
||||
});
|
||||
};
|
||||
|
||||
// Handle cell click.
|
||||
const handleCellClick = (cell, event) => {
|
||||
openDrawer(DRAWERS.JOURNAL_DETAILS, {
|
||||
manualJournalId: cell.row.original.id,
|
||||
});
|
||||
};
|
||||
|
||||
// Local storage memorizing columns widths.
|
||||
const [initialColumnsWidths, , handleColumnResizing] =
|
||||
useMemorizedColumnsWidths(TABLES.MANUAL_JOURNALS);
|
||||
@@ -107,6 +103,12 @@ function ManualJournalsDataTable({
|
||||
},
|
||||
[setManualJournalsTableState],
|
||||
);
|
||||
// Handle selected rows change.
|
||||
const handleSelectedRowsChange = (selectedFlatRows) => {
|
||||
const selectedIds = selectedFlatRows?.map((row) => row.original.id) || [];
|
||||
setManualJournalsSelectedRows(selectedIds);
|
||||
};
|
||||
|
||||
|
||||
// Display manual journal empty status instead of the table.
|
||||
if (isEmptyStatus) {
|
||||
@@ -130,6 +132,7 @@ function ManualJournalsDataTable({
|
||||
pagesCount={pagination.pagesCount}
|
||||
autoResetSortBy={false}
|
||||
autoResetPage={false}
|
||||
onSelectedRowsChange={handleSelectedRowsChange}
|
||||
TableLoadingRenderer={TableSkeletonRows}
|
||||
TableHeaderSkeletonRenderer={TableSkeletonHeader}
|
||||
ContextMenu={ActionsMenu}
|
||||
|
||||
Reference in New Issue
Block a user