mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
wip
This commit is contained in:
@@ -14,10 +14,6 @@ const EstimateRejectAlert = React.lazy(
|
||||
() => import('@/containers/Alerts/Estimates/EstimateRejectAlert'),
|
||||
);
|
||||
|
||||
const EstimateBulkDeleteAlert = React.lazy(
|
||||
() => import('@/containers/Alerts/Estimates/EstimateBulkDeleteAlert'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Estimates alert.
|
||||
*/
|
||||
@@ -26,5 +22,4 @@ export default [
|
||||
{ name: 'estimate-deliver', component: EstimateDeliveredAlert },
|
||||
{ name: 'estimate-Approve', component: EstimateApproveAlert },
|
||||
{ name: 'estimate-reject', component: EstimateRejectAlert },
|
||||
{ name: 'estimates-bulk-delete', component: EstimateBulkDeleteAlert },
|
||||
];
|
||||
|
||||
@@ -33,11 +33,13 @@ import withEstimatesActions from './withEstimatesActions';
|
||||
import withSettings from '@/containers/Settings/withSettings';
|
||||
import withSettingsActions from '@/containers/Settings/withSettingsActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withAlertActions from '@/containers/Alert/withAlertActions';
|
||||
|
||||
import { useEstimatesListContext } from './EstimatesListProvider';
|
||||
import { useRefreshEstimates } from '@/hooks/query/estimates';
|
||||
import {
|
||||
useRefreshEstimates,
|
||||
} from '@/hooks/query/estimates';
|
||||
import { useDownloadExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
|
||||
import { useBulkDeleteEstimatesDialog } from './hooks/use-bulk-delete-estimates-dialog';
|
||||
|
||||
import { SaleEstimateAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import { compose } from '@/utils';
|
||||
@@ -72,9 +74,6 @@ function EstimateActionsBar({
|
||||
|
||||
// #withSettingsActions
|
||||
addSetting,
|
||||
|
||||
// #withAlertActions
|
||||
openAlert,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -122,13 +121,16 @@ function EstimateActionsBar({
|
||||
openDrawer(DRAWERS.BRANDING_TEMPLATES, { resource: 'SaleEstimate' });
|
||||
};
|
||||
|
||||
const {
|
||||
openBulkDeleteDialog,
|
||||
isValidatingBulkDeleteEstimates,
|
||||
} = useBulkDeleteEstimatesDialog();
|
||||
|
||||
// Handle bulk estimates delete.
|
||||
const handleBulkDelete = () => {
|
||||
openAlert('estimates-bulk-delete', { estimatesIds: estimatesSelectedRows });
|
||||
openBulkDeleteDialog(estimatesSelectedRows);
|
||||
};
|
||||
|
||||
console.log(estimatesSelectedRows, 'estimatesSelectedRows');
|
||||
|
||||
if (!isEmpty(estimatesSelectedRows)) {
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
@@ -139,6 +141,7 @@ function EstimateActionsBar({
|
||||
text={<T id={'delete'} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={handleBulkDelete}
|
||||
disabled={isValidatingBulkDeleteEstimates}
|
||||
/>
|
||||
</NavbarGroup>
|
||||
</DashboardActionsBar>
|
||||
@@ -238,7 +241,6 @@ function EstimateActionsBar({
|
||||
export default compose(
|
||||
withEstimatesActions,
|
||||
withSettingsActions,
|
||||
withAlertActions,
|
||||
withEstimates(({ estimatesTableState, estimatesSelectedRows }) => ({
|
||||
estimatesFilterRoles: estimatesTableState.filterRoles,
|
||||
estimatesSelectedRows: estimatesSelectedRows || [],
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// @ts-nocheck
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { useValidateBulkDeleteEstimates } from '@/hooks/query/estimates';
|
||||
import { useBulkDeleteDialog } from '@/hooks/dialogs/useBulkDeleteDialog';
|
||||
|
||||
export const useBulkDeleteEstimatesDialog = () => {
|
||||
const validateBulkDeleteMutation = useValidateBulkDeleteEstimates();
|
||||
const {
|
||||
openBulkDeleteDialog,
|
||||
closeBulkDeleteDialog,
|
||||
isValidatingBulkDelete,
|
||||
} = useBulkDeleteDialog(DialogsName.EstimateBulkDelete, validateBulkDeleteMutation);
|
||||
|
||||
return {
|
||||
openBulkDeleteDialog,
|
||||
closeBulkDeleteDialog,
|
||||
isValidatingBulkDeleteEstimates: isValidatingBulkDelete,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user