This commit is contained in:
Ahmed Bouhuolia
2025-11-12 21:34:30 +02:00
parent a0bc9db9a6
commit 2383091b6e
29 changed files with 279 additions and 78 deletions

View File

@@ -123,6 +123,22 @@ function InvoiceActionsBar({
openAlert('invoices-bulk-delete', { invoicesIds: invoicesSelectedRows });
};
if (!isEmpty(invoicesSelectedRows)) {
return (
<DashboardActionsBar>
<NavbarGroup>
<Button
className={Classes.MINIMAL}
icon={<Icon icon="trash-16" iconSize={16} />}
text={<T id={'delete'} />}
intent={Intent.DANGER}
onClick={handleBulkDelete}
/>
</NavbarGroup>
</DashboardActionsBar>
);
}
return (
<DashboardActionsBar>
<NavbarGroup>
@@ -155,16 +171,6 @@ function InvoiceActionsBar({
</AdvancedFilterPopover>
<NavbarDivider />
<If condition={!isEmpty(invoicesSelectedRows)}>
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'trash-16'} iconSize={16} />}
text={<T id={'delete'} />}
intent={Intent.DANGER}
onClick={handleBulkDelete}
/>
</If>
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'print-16'} iconSize={'16'} />}
@@ -224,9 +230,9 @@ export default compose(
withInvoiceActions,
withSettingsActions,
withAlertActions,
withInvoices(({ invoicesTableState }) => ({
withInvoices(({ invoicesTableState, invoicesSelectedRows }) => ({
invoicesFilterRoles: invoicesTableState.filterRoles,
invoicesSelectedRows: invoicesTableState?.selectedRows || [],
invoicesSelectedRows,
})),
withSettings(({ invoiceSettings }) => ({
invoicesTableSize: invoiceSettings?.tableSize,

View File

@@ -3,17 +3,19 @@ import { connect } from 'react-redux';
import {
getInvoicesTableStateFactory,
isInvoicesTableStateChangedFactory,
getInvoicesSelectedRowsFactory,
} from '@/store/Invoice/invoices.selector';
export default (mapState) => {
const getInvoicesTableState = getInvoicesTableStateFactory();
const isInvoicesTableStateChanged = isInvoicesTableStateChangedFactory();
const getSelectedRows = getInvoicesSelectedRowsFactory();
const mapStateToProps = (state, props) => {
const mapped = {
invoicesTableState: getInvoicesTableState(state, props),
invoicesTableStateChanged: isInvoicesTableStateChanged(state, props),
invoicesSelectedRows: state.invoices?.selectedRows || [],
invoicesSelectedRows: getSelectedRows(state, props),
};
return mapState ? mapState(mapped, state, props) : mapped;
};