This commit is contained in:
a.bouhuolia
2021-02-23 10:52:40 +02:00
21 changed files with 335 additions and 239 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import DrawerTemplate from 'containers/Drawers/DrawerTemplate';
import PaperTemplate from 'containers/Drawers/PaperTemplate';
import PaperTemplate from 'containers/Drawers/PaperTemplate/PaperTemplate';
import withDrawers from 'containers/Drawer/withDrawers';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
@@ -18,10 +18,11 @@ function EstimateDrawer({
const handleDrawerClose = () => {
closeDrawer(name);
};
return (
<DrawerTemplate isOpen={isOpen} isClose={handleDrawerClose}>
<PaperTemplate />
<PaperTemplate />
</DrawerTemplate>
);
}

View File

@@ -11,6 +11,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import withEstimatesActions from './withEstimatesActions';
import withSettings from 'containers/Settings/withSettings';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { useEstimatesListContext } from './EstimatesListProvider';
import { ActionsMenu, useEstiamtesTableColumns } from './components';
@@ -24,6 +25,9 @@ function EstimatesDataTable({
// #withAlertsActions
openAlert,
// #withDrawerActions
openDrawer,
}) {
const history = useHistory();
@@ -62,6 +66,11 @@ function EstimatesDataTable({
const handleRejectEstimate = ({ id }) => {
openAlert('estimate-reject', { estimateId: id });
};
// Handle drawer estimate.
const handleDrawerEstimate = () => {
openDrawer('estimate-drawer', {});
};
// Handles fetch data.
const handleFetchData = useCallback(
@@ -104,6 +113,7 @@ function EstimatesDataTable({
onReject: handleRejectEstimate,
onDeliver: handleDeliverEstimate,
onDelete: handleDeleteEstimate,
onDrawer: handleDrawerEstimate,
}}
/>
);
@@ -112,6 +122,7 @@ function EstimatesDataTable({
export default compose(
withEstimatesActions,
withAlertsActions,
withDrawerActions,
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),

View File

@@ -49,7 +49,7 @@ export const statusAccessor = (row) => (
*/
export function ActionsMenu({
row: { original },
payload: { onEdit, onDeliver, onReject, onApprove, onDelete },
payload: { onEdit, onDeliver, onReject, onApprove, onDelete ,onDrawer },
}) {
const { formatMessage } = useIntl();
@@ -100,6 +100,10 @@ export function ActionsMenu({
/>
</Choose.When>
</Choose>
<MenuItem
text={formatMessage({ id: 'estimate_paper' })}
onClick={() => onDrawer()}
/>
<MenuItem
text={formatMessage({ id: 'delete_estimate' })}
intent={Intent.DANGER}