mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -12,6 +12,7 @@ import withEstimatesActions from './withEstimatesActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
import { useEstimatesListContext } from './EstimatesListProvider';
|
||||
import { ActionsMenu, useEstiamtesTableColumns } from './components';
|
||||
@@ -28,6 +29,9 @@ function EstimatesDataTable({
|
||||
|
||||
// #withDrawerActions
|
||||
openDrawer,
|
||||
|
||||
// #withDialogAction
|
||||
openDialog,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -77,6 +81,16 @@ function EstimatesDataTable({
|
||||
history.push(`/invoices/new?from_estimate_id=${id}`, { action: id });
|
||||
};
|
||||
|
||||
// Handle view detail estimate.
|
||||
const handleViewDetailEstimate = ({ id }) => {
|
||||
openDrawer('estimate-detail-drawer', { estimateId: id });
|
||||
};
|
||||
|
||||
// Handle print estimate.
|
||||
const handlePrintEstimate = ({ id }) => {
|
||||
openDialog('estimate-pdf-preview', { estimateId: id });
|
||||
};
|
||||
|
||||
// Handles fetch data.
|
||||
const handleFetchData = useCallback(
|
||||
({ pageIndex, pageSize, sortBy }) => {
|
||||
@@ -120,6 +134,8 @@ function EstimatesDataTable({
|
||||
onDelete: handleDeleteEstimate,
|
||||
onDrawer: handleDrawerEstimate,
|
||||
onConvert: handleConvertToInvoice,
|
||||
onViewDetails: handleViewDetailEstimate,
|
||||
onPrint: handlePrintEstimate,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@@ -129,6 +145,7 @@ export default compose(
|
||||
withEstimatesActions,
|
||||
withAlertsActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
|
||||
@@ -58,15 +58,16 @@ export function ActionsMenu({
|
||||
onDelete,
|
||||
onDrawer,
|
||||
onConvert,
|
||||
onViewDetails,
|
||||
onPrint,
|
||||
},
|
||||
}) {
|
||||
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuItem
|
||||
icon={<Icon icon="reader-18" />}
|
||||
text={intl.get('view_details')}
|
||||
onClick={safeCallback(onViewDetails, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
@@ -119,6 +120,11 @@ export function ActionsMenu({
|
||||
text={intl.get('estimate_paper')}
|
||||
onClick={safeCallback(onDrawer, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||
text={intl.get('print')}
|
||||
onClick={safeCallback(onPrint, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
text={intl.get('delete_estimate')}
|
||||
intent={Intent.DANGER}
|
||||
@@ -149,8 +155,6 @@ function ActionsCell(props) {
|
||||
}
|
||||
|
||||
export function useEstiamtesTableColumns() {
|
||||
|
||||
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -204,7 +208,7 @@ export function useEstiamtesTableColumns() {
|
||||
accessor: 'reference',
|
||||
width: 90,
|
||||
className: 'reference',
|
||||
}
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
|
||||
@@ -85,6 +85,11 @@ function InvoicesDataTable({
|
||||
openDrawer('invoice-detail-drawer', { invoiceId: id });
|
||||
};
|
||||
|
||||
// Handle print invoices.
|
||||
const handlePrintInvoice = ({ id }) => {
|
||||
openDialog('invoice-pdf-preview', { invoiceId: id });
|
||||
};
|
||||
|
||||
// Handles fetch data once the table state change.
|
||||
const handleDataTableFetchData = useCallback(
|
||||
({ pageSize, pageIndex, sortBy }) => {
|
||||
@@ -130,6 +135,7 @@ function InvoicesDataTable({
|
||||
onDrawer: handleDrawerInvoice,
|
||||
onQuick: handleQuickPaymentReceive,
|
||||
onViewDetails: handleViewDetailInvoice,
|
||||
onPrint: handlePrintInvoice,
|
||||
baseCurrency,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -93,7 +93,15 @@ export const handleDeleteErrors = (errors) => {
|
||||
};
|
||||
|
||||
export function ActionsMenu({
|
||||
payload: { onEdit, onDeliver, onDelete, onDrawer, onQuick, onViewDetails },
|
||||
payload: {
|
||||
onEdit,
|
||||
onDeliver,
|
||||
onDelete,
|
||||
onDrawer,
|
||||
onQuick,
|
||||
onViewDetails,
|
||||
onPrint,
|
||||
},
|
||||
row: { original },
|
||||
}) {
|
||||
return (
|
||||
@@ -128,6 +136,11 @@ export function ActionsMenu({
|
||||
text={intl.get('invoice_paper')}
|
||||
onClick={safeCallback(onDrawer, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||
text={intl.get('print')}
|
||||
onClick={safeCallback(onPrint, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
text={intl.get('delete_invoice')}
|
||||
intent={Intent.DANGER}
|
||||
|
||||
@@ -10,6 +10,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import withReceipts from './withReceipts';
|
||||
import withReceiptsActions from './withReceiptsActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
@@ -35,6 +36,9 @@ function ReceiptsDataTable({
|
||||
|
||||
// #withDrawerActions
|
||||
openDrawer,
|
||||
|
||||
// #withDialogAction
|
||||
openDialog,
|
||||
}) {
|
||||
const history = useHistory();
|
||||
|
||||
@@ -75,6 +79,11 @@ function ReceiptsDataTable({
|
||||
openDrawer('receipt-detail-drawer', { receiptId: id });
|
||||
};
|
||||
|
||||
// Handle print receipt.
|
||||
const handlePrintInvoice = ({ id }) => {
|
||||
openDialog('receipt-pdf-preview', { receiptId: id });
|
||||
};
|
||||
|
||||
// Handles the datable fetch data once the state changing.
|
||||
const handleDataTableFetchData = useCallback(
|
||||
({ sortBy, pageIndex, pageSize }) => {
|
||||
@@ -118,6 +127,7 @@ function ReceiptsDataTable({
|
||||
onClose: handleCloseReceipt,
|
||||
onDrawer: handleDrawerReceipt,
|
||||
onViewDetails: handleViewDetailReceipt,
|
||||
onPrint: handlePrintInvoice,
|
||||
baseCurrency,
|
||||
}}
|
||||
/>
|
||||
@@ -128,6 +138,7 @@ export default compose(
|
||||
withAlertsActions,
|
||||
withReceiptsActions,
|
||||
withDrawerActions,
|
||||
withDialogActions,
|
||||
withReceipts(({ receiptTableState }) => ({
|
||||
receiptTableState,
|
||||
})),
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Choose, Money, Icon, If } from 'components';
|
||||
import moment from 'moment';
|
||||
|
||||
export function ActionsMenu({
|
||||
payload: { onEdit, onDelete, onClose, onDrawer, onViewDetails },
|
||||
payload: { onEdit, onDelete, onClose, onDrawer, onViewDetails, onPrint },
|
||||
row: { original: receipt },
|
||||
}) {
|
||||
return (
|
||||
@@ -44,6 +44,11 @@ export function ActionsMenu({
|
||||
text={intl.get('receipt_paper')}
|
||||
onClick={safeCallback(onDrawer, receipt)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||
text={intl.get('print')}
|
||||
onClick={safeCallback(onPrint, receipt)}
|
||||
/>
|
||||
<MenuItem
|
||||
text={intl.get('delete_receipt')}
|
||||
intent={Intent.DANGER}
|
||||
|
||||
Reference in New Issue
Block a user