mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix: delete and bulk delete accounts.
fix: activate and inactivate accounts.
This commit is contained in:
@@ -63,6 +63,7 @@ export default function DataTable({
|
||||
expandColumnSpace = 1.5,
|
||||
|
||||
updateDebounceTime = 200,
|
||||
selectionColumnWidth = 42,
|
||||
|
||||
// Read this document to know why! https://bit.ly/2Uw9SEc
|
||||
autoResetPage = true,
|
||||
@@ -134,9 +135,9 @@ export default function DataTable({
|
||||
{
|
||||
id: 'selection',
|
||||
disableResizing: true,
|
||||
minWidth: 42,
|
||||
width: 42,
|
||||
maxWidth: 42,
|
||||
minWidth: selectionColumnWidth,
|
||||
width: selectionColumnWidth,
|
||||
maxWidth: selectionColumnWidth,
|
||||
// The header can use the table's getToggleAllRowsSelectedProps method
|
||||
// to render a checkbox
|
||||
Header: ({ getToggleAllRowsSelectedProps }) => (
|
||||
|
||||
@@ -109,14 +109,6 @@ function AccountsChart({
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (errors.find(e => e.type === 'ACCOUNT.HAS.CHILD.ACCOUNTS')) {
|
||||
AppToaster.show({
|
||||
message: formatMessage({
|
||||
id: 'you_could_not_delete_account_has_child_accounts',
|
||||
}),
|
||||
intent: Intent.DANGER,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// Handle confirm account delete
|
||||
@@ -130,6 +122,7 @@ function AccountsChart({
|
||||
}),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
queryCache.invalidateQueries('accounts-table');
|
||||
})
|
||||
.catch((errors) => {
|
||||
setDeleteAccount(false);
|
||||
@@ -215,6 +208,7 @@ function AccountsChart({
|
||||
}),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
queryCache.invalidateQueries('accounts-table');
|
||||
})
|
||||
.catch((errors) => {
|
||||
setBulkDelete(false);
|
||||
@@ -288,6 +282,7 @@ function AccountsChart({
|
||||
}),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
queryCache.invalidateQueries('accounts-table');
|
||||
})
|
||||
.catch((errors) => {
|
||||
setBulkActivate(false);
|
||||
@@ -318,6 +313,7 @@ function AccountsChart({
|
||||
}),
|
||||
intent: Intent.SUCCESS,
|
||||
});
|
||||
queryCache.invalidateQueries('accounts-table');
|
||||
})
|
||||
.catch((errors) => {
|
||||
setBulkInactiveAccounts(false);
|
||||
|
||||
@@ -192,10 +192,7 @@ function AccountsDataTable({
|
||||
[actionMenuList, formatMessage],
|
||||
);
|
||||
|
||||
const selectionColumn = useMemo(
|
||||
() => ({ minWidth: 40, width: 40, maxWidth: 40 }),
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
const handleDatatableFetchData = useCallback((...params) => {
|
||||
onFetchData && onFetchData(...params);
|
||||
@@ -216,14 +213,15 @@ function AccountsDataTable({
|
||||
columns={columns}
|
||||
data={accountsTable}
|
||||
onFetchData={handleDatatableFetchData}
|
||||
manualSortBy={true}
|
||||
selectionColumn={selectionColumn}
|
||||
selectionColumn={true}
|
||||
expandable={true}
|
||||
sticky={true}
|
||||
onSelectedRowsChange={handleSelectedRowsChange}
|
||||
loading={accountsLoading && !isMounted}
|
||||
rowContextMenu={rowContextMenu}
|
||||
expandColumnSpace={1}
|
||||
autoResetExpanded={false}
|
||||
selectionColumnWidth={50}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
padding-bottom: 0.3rem;
|
||||
}
|
||||
.account_name{
|
||||
> div{
|
||||
width: 100%;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.bp3-popover-wrapper--inactive-semafro{
|
||||
margin-left: 8px;
|
||||
margin-right: 6px;
|
||||
|
||||
@@ -256,7 +256,7 @@ export const flatToNestedArray = (
|
||||
if (!item[config.parentId]) {
|
||||
nestedArray.push(item);
|
||||
}
|
||||
if (parentItemId) {
|
||||
if (parentItemId && map[parentItemId]) {
|
||||
map[parentItemId].children.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user