mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: drawer.
This commit is contained in:
@@ -11,6 +11,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
|||||||
import withEstimatesActions from './withEstimatesActions';
|
import withEstimatesActions from './withEstimatesActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { useEstimatesListContext } from './EstimatesListProvider';
|
import { useEstimatesListContext } from './EstimatesListProvider';
|
||||||
import { ActionsMenu, useEstiamtesTableColumns } from './components';
|
import { ActionsMenu, useEstiamtesTableColumns } from './components';
|
||||||
@@ -24,6 +25,9 @@ function EstimatesDataTable({
|
|||||||
|
|
||||||
// #withAlertsActions
|
// #withAlertsActions
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
openDrawer,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -63,6 +67,11 @@ function EstimatesDataTable({
|
|||||||
openAlert('estimate-reject', { estimateId: id });
|
openAlert('estimate-reject', { estimateId: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle drawer estimate.
|
||||||
|
const handleDrawerEstimate = () => {
|
||||||
|
openDrawer('estimate-drawer', {});
|
||||||
|
};
|
||||||
|
|
||||||
// Handles fetch data.
|
// Handles fetch data.
|
||||||
const handleFetchData = useCallback(
|
const handleFetchData = useCallback(
|
||||||
({ pageIndex, pageSize, sortBy }) => {
|
({ pageIndex, pageSize, sortBy }) => {
|
||||||
@@ -104,6 +113,7 @@ function EstimatesDataTable({
|
|||||||
onReject: handleRejectEstimate,
|
onReject: handleRejectEstimate,
|
||||||
onDeliver: handleDeliverEstimate,
|
onDeliver: handleDeliverEstimate,
|
||||||
onDelete: handleDeleteEstimate,
|
onDelete: handleDeleteEstimate,
|
||||||
|
onDrawer: handleDrawerEstimate,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -112,6 +122,7 @@ function EstimatesDataTable({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withEstimatesActions,
|
withEstimatesActions,
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
|
withDrawerActions,
|
||||||
withSettings(({ organizationSettings }) => ({
|
withSettings(({ organizationSettings }) => ({
|
||||||
baseCurrency: organizationSettings?.baseCurrency,
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export const statusAccessor = (row) => (
|
|||||||
*/
|
*/
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
row: { original },
|
row: { original },
|
||||||
payload: { onEdit, onDeliver, onReject, onApprove, onDelete },
|
payload: { onEdit, onDeliver, onReject, onApprove, onDelete ,onDrawer },
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
@@ -100,6 +100,10 @@ export function ActionsMenu({
|
|||||||
/>
|
/>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
</Choose>
|
</Choose>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'estimate_paper' })}
|
||||||
|
onClick={() => onDrawer()}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_estimate' })}
|
text={formatMessage({ id: 'delete_estimate' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import withInvoices from './withInvoices';
|
|||||||
import withInvoiceActions from './withInvoiceActions';
|
import withInvoiceActions from './withInvoiceActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { useInvoicesTableColumns, ActionsMenu } from './components';
|
import { useInvoicesTableColumns, ActionsMenu } from './components';
|
||||||
import { useInvoicesListContext } from './InvoicesListProvider';
|
import { useInvoicesListContext } from './InvoicesListProvider';
|
||||||
@@ -32,6 +33,9 @@ function InvoicesDataTable({
|
|||||||
|
|
||||||
// #withAlertsActions
|
// #withAlertsActions
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
openDrawer,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -62,6 +66,11 @@ function InvoicesDataTable({
|
|||||||
history.push(`/invoices/${invoice.id}/edit`);
|
history.push(`/invoices/${invoice.id}/edit`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle drawer invoice.
|
||||||
|
const handleDrawerInvoice = () => {
|
||||||
|
openDrawer('invoice-drawer', {});
|
||||||
|
};
|
||||||
|
|
||||||
// Handles fetch data once the table state change.
|
// Handles fetch data once the table state change.
|
||||||
const handleDataTableFetchData = useCallback(
|
const handleDataTableFetchData = useCallback(
|
||||||
({ pageSize, pageIndex, sortBy }) => {
|
({ pageSize, pageIndex, sortBy }) => {
|
||||||
@@ -104,6 +113,7 @@ function InvoicesDataTable({
|
|||||||
onDelete: handleDeleteInvoice,
|
onDelete: handleDeleteInvoice,
|
||||||
onDeliver: handleDeliverInvoice,
|
onDeliver: handleDeliverInvoice,
|
||||||
onEdit: handleEditInvoice,
|
onEdit: handleEditInvoice,
|
||||||
|
onDrawer: handleDrawerInvoice,
|
||||||
baseCurrency,
|
baseCurrency,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -114,6 +124,7 @@ export default compose(
|
|||||||
withDashboardActions,
|
withDashboardActions,
|
||||||
withInvoiceActions,
|
withInvoiceActions,
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
|
withDrawerActions,
|
||||||
withInvoices(({ invoicesTableState }) => ({ invoicesTableState })),
|
withInvoices(({ invoicesTableState }) => ({ invoicesTableState })),
|
||||||
withSettings(({ organizationSettings }) => ({
|
withSettings(({ organizationSettings }) => ({
|
||||||
baseCurrency: organizationSettings?.baseCurrency,
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ProgressBar,
|
ProgressBar,
|
||||||
Popover,
|
Popover,
|
||||||
Position,
|
Position,
|
||||||
Button
|
Button,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@@ -18,11 +18,9 @@ import { Money, AppToaster } from 'components';
|
|||||||
import { formatMessage } from 'services/intl';
|
import { formatMessage } from 'services/intl';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
|
||||||
|
|
||||||
const calculateStatus = (paymentAmount, balanceAmount) => {
|
const calculateStatus = (paymentAmount, balanceAmount) => {
|
||||||
return round(paymentAmount / balanceAmount, 2);
|
return round(paymentAmount / balanceAmount, 2);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export const statusAccessor = (row) => {
|
export const statusAccessor = (row) => {
|
||||||
return (
|
return (
|
||||||
@@ -95,7 +93,7 @@ export const handleDeleteErrors = (errors) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEdit, onDeliver, onDelete },
|
payload: { onEdit, onDeliver, onDelete, onDrawer },
|
||||||
row: { original },
|
row: { original },
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -119,6 +117,10 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onDeliver, original)}
|
onClick={safeCallback(onDeliver, original)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'invoice_paper' })}
|
||||||
|
onClick={() => onDrawer()}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_invoice' })}
|
text={formatMessage({ id: 'delete_invoice' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
|||||||
import withPaymentReceives from './withPaymentReceives';
|
import withPaymentReceives from './withPaymentReceives';
|
||||||
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import { usePaymentReceivesColumns, ActionsMenu } from './components';
|
import { usePaymentReceivesColumns, ActionsMenu } from './components';
|
||||||
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
|
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
|
||||||
@@ -27,6 +28,9 @@ function PaymentReceivesDataTable({
|
|||||||
|
|
||||||
// #withAlertsActions
|
// #withAlertsActions
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
openDrawer,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -53,6 +57,11 @@ function PaymentReceivesDataTable({
|
|||||||
openAlert('payment-receive-delete', { paymentReceiveId: id });
|
openAlert('payment-receive-delete', { paymentReceiveId: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle drawer payment receive.
|
||||||
|
const handleDrawerPaymentReceive = () => {
|
||||||
|
openDrawer('payment-receive-drawer', {});
|
||||||
|
};
|
||||||
|
|
||||||
// Handle datatable fetch once the table's state changing.
|
// Handle datatable fetch once the table's state changing.
|
||||||
const handleDataTableFetchData = useCallback(
|
const handleDataTableFetchData = useCallback(
|
||||||
({ pageIndex, pageSize, sortBy }) => {
|
({ pageIndex, pageSize, sortBy }) => {
|
||||||
@@ -93,6 +102,7 @@ function PaymentReceivesDataTable({
|
|||||||
payload={{
|
payload={{
|
||||||
onDelete: handleDeletePaymentReceive,
|
onDelete: handleDeletePaymentReceive,
|
||||||
onEdit: handleEditPaymentReceive,
|
onEdit: handleEditPaymentReceive,
|
||||||
|
onDrawer: handleDrawerPaymentReceive,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -101,6 +111,7 @@ function PaymentReceivesDataTable({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withPaymentReceivesActions,
|
withPaymentReceivesActions,
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
|
withDrawerActions,
|
||||||
withPaymentReceives(({ paymentReceivesTableState }) => ({
|
withPaymentReceives(({ paymentReceivesTableState }) => ({
|
||||||
paymentReceivesTableState,
|
paymentReceivesTableState,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { safeCallback } from 'utils';
|
|||||||
*/
|
*/
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
row: { original: paymentReceive },
|
row: { original: paymentReceive },
|
||||||
payload: { onEdit, onDelete },
|
payload: { onEdit, onDelete, onDrawer },
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
@@ -34,6 +34,10 @@ export function ActionsMenu({
|
|||||||
text={formatMessage({ id: 'edit_payment_receive' })}
|
text={formatMessage({ id: 'edit_payment_receive' })}
|
||||||
onClick={safeCallback(onEdit, paymentReceive)}
|
onClick={safeCallback(onEdit, paymentReceive)}
|
||||||
/>
|
/>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'payment_receive_paper' })}
|
||||||
|
onClick={() => onDrawer()}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_payment_receive' })}
|
text={formatMessage({ id: 'delete_payment_receive' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
|||||||
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||||
|
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
import withReceipts from './withReceipts';
|
import withReceipts from './withReceipts';
|
||||||
import withReceiptsActions from './withReceiptsActions';
|
import withReceiptsActions from './withReceiptsActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
@@ -31,6 +32,9 @@ function ReceiptsDataTable({
|
|||||||
|
|
||||||
// #withAlertsActions
|
// #withAlertsActions
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
openDrawer,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -61,6 +65,11 @@ function ReceiptsDataTable({
|
|||||||
openAlert('receipt-close', { receiptId: receipt.id });
|
openAlert('receipt-close', { receiptId: receipt.id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle drawer receipts.
|
||||||
|
const handleDrawerReceipt = () => {
|
||||||
|
openDrawer('receipt-drawer', {});
|
||||||
|
};
|
||||||
|
|
||||||
// Handles the datable fetch data once the state changing.
|
// Handles the datable fetch data once the state changing.
|
||||||
const handleDataTableFetchData = useCallback(
|
const handleDataTableFetchData = useCallback(
|
||||||
({ sortBy, pageIndex, pageSize }) => {
|
({ sortBy, pageIndex, pageSize }) => {
|
||||||
@@ -102,6 +111,7 @@ function ReceiptsDataTable({
|
|||||||
onEdit: handleEditReceipt,
|
onEdit: handleEditReceipt,
|
||||||
onDelete: handleDeleteReceipt,
|
onDelete: handleDeleteReceipt,
|
||||||
onClose: handleCloseReceipt,
|
onClose: handleCloseReceipt,
|
||||||
|
onDrawer:handleDrawerReceipt,
|
||||||
baseCurrency,
|
baseCurrency,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -111,6 +121,7 @@ function ReceiptsDataTable({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
withReceiptsActions,
|
withReceiptsActions,
|
||||||
|
withDrawerActions,
|
||||||
withReceipts(({ receiptTableState }) => ({
|
withReceipts(({ receiptTableState }) => ({
|
||||||
receiptTableState,
|
receiptTableState,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Choose, Money, Icon, If } from 'components';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEdit, onDelete, onClose },
|
payload: { onEdit, onDelete, onClose ,onDrawer },
|
||||||
row: { original: receipt },
|
row: { original: receipt },
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -38,6 +38,10 @@ export function ActionsMenu({
|
|||||||
onClick={safeCallback(onClose, receipt)}
|
onClick={safeCallback(onClose, receipt)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'receipt_paper' })}
|
||||||
|
onClick={() => onDrawer()}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_receipt' })}
|
text={formatMessage({ id: 'delete_receipt' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
Reference in New Issue
Block a user