mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -15,6 +15,8 @@ import QuickPaymentReceiveFormDialog from 'containers/Dialogs/QuickPaymentReceiv
|
|||||||
import QuickPaymentMadeFormDialog from 'containers/Dialogs/QuickPaymentMadeFormDialog';
|
import QuickPaymentMadeFormDialog from 'containers/Dialogs/QuickPaymentMadeFormDialog';
|
||||||
import AllocateLandedCostDialog from 'containers/Dialogs/AllocateLandedCostDialog';
|
import AllocateLandedCostDialog from 'containers/Dialogs/AllocateLandedCostDialog';
|
||||||
import InvoicePdfPreviewDialog from 'containers/Dialogs/InvoicePdfPreviewDialog';
|
import InvoicePdfPreviewDialog from 'containers/Dialogs/InvoicePdfPreviewDialog';
|
||||||
|
import EstimatePdfPreviewDialog from 'containers/Dialogs/EstimatePdfPreviewDialog';
|
||||||
|
import ReceiptPdfPreviewDialog from '../containers/Dialogs/ReceiptPdfPreviewDialog';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialogs container.
|
* Dialogs container.
|
||||||
@@ -35,7 +37,9 @@ export default function DialogsContainer() {
|
|||||||
<QuickPaymentReceiveFormDialog dialogName={'quick-payment-receive'} />
|
<QuickPaymentReceiveFormDialog dialogName={'quick-payment-receive'} />
|
||||||
<QuickPaymentMadeFormDialog dialogName={'quick-payment-made'} />
|
<QuickPaymentMadeFormDialog dialogName={'quick-payment-made'} />
|
||||||
<AllocateLandedCostDialog dialogName={'allocate-landed-cost'} />
|
<AllocateLandedCostDialog dialogName={'allocate-landed-cost'} />
|
||||||
<InvoicePdfPreviewDialog dialog={'invoice-pdf-preview'} />
|
<InvoicePdfPreviewDialog dialogName={'invoice-pdf-preview'} />
|
||||||
|
<EstimatePdfPreviewDialog dialogName={'estimate-pdf-preview'} />
|
||||||
|
<ReceiptPdfPreviewDialog dialogName={'receipt-pdf-preview'} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import InvoiceDetailDrawer from 'containers/Drawers/InvoiceDetailDrawer';
|
|||||||
import ReceiptDetailDrawer from 'containers/Drawers/ReceiptDetailDrawer';
|
import ReceiptDetailDrawer from 'containers/Drawers/ReceiptDetailDrawer';
|
||||||
import PaymentReceiveDetailDrawer from 'containers/Drawers/PaymentReceiveDetailDrawer';
|
import PaymentReceiveDetailDrawer from 'containers/Drawers/PaymentReceiveDetailDrawer';
|
||||||
import PaymentMadeDetailDrawer from 'containers/Drawers/PaymentMadeDetailDrawer';
|
import PaymentMadeDetailDrawer from 'containers/Drawers/PaymentMadeDetailDrawer';
|
||||||
|
import EstimateDetailDrawer from '../containers/Drawers/EstimateDetailDrawer';
|
||||||
|
|
||||||
export default function DrawersContainer() {
|
export default function DrawersContainer() {
|
||||||
return (
|
return (
|
||||||
@@ -24,6 +25,7 @@ export default function DrawersContainer() {
|
|||||||
<ExpenseDrawer name={'expense-drawer'} />
|
<ExpenseDrawer name={'expense-drawer'} />
|
||||||
<BillDrawer name={'bill-drawer'} />
|
<BillDrawer name={'bill-drawer'} />
|
||||||
<InvoiceDetailDrawer name={'invoice-detail-drawer'} />
|
<InvoiceDetailDrawer name={'invoice-detail-drawer'} />
|
||||||
|
<EstimateDetailDrawer name={'estimate-detail-drawer'} />
|
||||||
<ReceiptDetailDrawer name={'receipt-detail-drawer'} />
|
<ReceiptDetailDrawer name={'receipt-detail-drawer'} />
|
||||||
<PaymentReceiveDetailDrawer name={'payment-receive-detail-drawer'} />
|
<PaymentReceiveDetailDrawer name={'payment-receive-detail-drawer'} />
|
||||||
<PaymentMadeDetailDrawer name={'payment-made-detail-drawer'} />
|
<PaymentMadeDetailDrawer name={'payment-made-detail-drawer'} />
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { AnchorButton } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
import { DialogContent, PdfDocumentPreview, T } from 'components';
|
||||||
|
import { usePdfEstimate } from 'hooks/query';
|
||||||
|
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
function EstimatePdfPreviewDialogContent({
|
||||||
|
subscriptionForm: { estimateId },
|
||||||
|
dialogName,
|
||||||
|
// #withDialogActions
|
||||||
|
closeDialog,
|
||||||
|
}) {
|
||||||
|
const { isLoading, pdfUrl } = usePdfEstimate(estimateId);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DialogContent>
|
||||||
|
<div class="dialog__header-actions">
|
||||||
|
<AnchorButton
|
||||||
|
href={pdfUrl}
|
||||||
|
target={'__blank'}
|
||||||
|
minimal={true}
|
||||||
|
outlined={true}
|
||||||
|
>
|
||||||
|
<T id={'pdf_preview.preview.button'} />
|
||||||
|
</AnchorButton>
|
||||||
|
|
||||||
|
<AnchorButton
|
||||||
|
href={pdfUrl}
|
||||||
|
download={'estimate.pdf'}
|
||||||
|
minimal={true}
|
||||||
|
outlined={true}
|
||||||
|
>
|
||||||
|
<T id={'pdf_preview.download.button'} />
|
||||||
|
</AnchorButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PdfDocumentPreview
|
||||||
|
height={760}
|
||||||
|
width={1000}
|
||||||
|
isLoading={isLoading}
|
||||||
|
url={pdfUrl}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(withDialogActions)(EstimatePdfPreviewDialogContent);
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { T, Dialog, DialogSuspense } from 'components';
|
||||||
|
import { CLASSES } from 'common/classes';
|
||||||
|
|
||||||
|
import withDialogRedux from 'components/DialogReduxConnect';
|
||||||
|
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
// Lazy loading the content.
|
||||||
|
const PdfPreviewDialogContent = React.lazy(() =>
|
||||||
|
import('./EstimatePdfPreviewDialogContent'),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Estimate PDF preview dialog.
|
||||||
|
*/
|
||||||
|
function EstimatePdfPreviewDialog({
|
||||||
|
dialogName,
|
||||||
|
payload = { estimateId: null },
|
||||||
|
isOpen,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
name={dialogName}
|
||||||
|
title={<T id={'estimate_preview.dialog.title'} />}
|
||||||
|
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||||
|
autoFocus={true}
|
||||||
|
canEscapeKeyClose={true}
|
||||||
|
isOpen={isOpen}
|
||||||
|
style={{ width: '1000px' }}
|
||||||
|
>
|
||||||
|
<DialogSuspense>
|
||||||
|
<PdfPreviewDialogContent
|
||||||
|
dialogName={dialogName}
|
||||||
|
subscriptionForm={payload}
|
||||||
|
/>
|
||||||
|
</DialogSuspense>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(withDialogRedux())(EstimatePdfPreviewDialog);
|
||||||
@@ -8,17 +8,18 @@ import withDialogActions from 'containers/Dialog/withDialogActions';
|
|||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
function InvoicePdfPreviewDialogContent({
|
function InvoicePdfPreviewDialogContent({
|
||||||
|
subscriptionForm: { invoiceId },
|
||||||
// #withDialog
|
// #withDialog
|
||||||
closeDialog,
|
closeDialog,
|
||||||
}) {
|
}) {
|
||||||
const { isLoading, pdfUrl } = usePdfInvoice(1);
|
const { isLoading, pdfUrl } = usePdfInvoice(invoiceId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<div class="dialog__header-actions">
|
<div class="dialog__header-actions">
|
||||||
<AnchorButton
|
<AnchorButton
|
||||||
href={pdfUrl}
|
href={pdfUrl}
|
||||||
download={'invoice.pdf'}
|
target={'__blank'}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
outlined={true}
|
outlined={true}
|
||||||
>
|
>
|
||||||
@@ -27,7 +28,7 @@ function InvoicePdfPreviewDialogContent({
|
|||||||
|
|
||||||
<AnchorButton
|
<AnchorButton
|
||||||
href={pdfUrl}
|
href={pdfUrl}
|
||||||
target={'__blank'}
|
download={'invoice.pdf'}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
outlined={true}
|
outlined={true}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { AnchorButton } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
import { DialogContent, PdfDocumentPreview, T } from 'components';
|
||||||
|
import { usePdfReceipt } from 'hooks/query';
|
||||||
|
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
function ReceiptPdfPreviewDialogContent({
|
||||||
|
subscriptionForm: { receiptId },
|
||||||
|
// #withDialogActions
|
||||||
|
closeDialog,
|
||||||
|
}) {
|
||||||
|
const { isLoading, pdfUrl } = usePdfReceipt(receiptId);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DialogContent>
|
||||||
|
<div class="dialog__header-actions">
|
||||||
|
<AnchorButton
|
||||||
|
href={pdfUrl}
|
||||||
|
target={'__blank'}
|
||||||
|
minimal={true}
|
||||||
|
outlined={true}
|
||||||
|
>
|
||||||
|
<T id={'pdf_preview.preview.button'} />
|
||||||
|
</AnchorButton>
|
||||||
|
|
||||||
|
<AnchorButton
|
||||||
|
href={pdfUrl}
|
||||||
|
download={'receipt.pdf'}
|
||||||
|
minimal={true}
|
||||||
|
outlined={true}
|
||||||
|
>
|
||||||
|
<T id={'pdf_preview.download.button'} />
|
||||||
|
</AnchorButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PdfDocumentPreview
|
||||||
|
height={760}
|
||||||
|
width={1000}
|
||||||
|
isLoading={isLoading}
|
||||||
|
url={pdfUrl}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(withDialogActions)(ReceiptPdfPreviewDialogContent);
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { T, Dialog, DialogSuspense } from 'components';
|
||||||
|
import { CLASSES } from 'common/classes';
|
||||||
|
|
||||||
|
import withDialogRedux from 'components/DialogReduxConnect';
|
||||||
|
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
// Lazy loading the content.
|
||||||
|
const PdfPreviewDialogContent = React.lazy(() =>
|
||||||
|
import('./ReceiptPdfPreviewDialogContent'),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receipt Pdf preview dialog.
|
||||||
|
*/
|
||||||
|
function ReceiptPdfPreviewDialog({
|
||||||
|
dialogName,
|
||||||
|
payload = { receiptId: null },
|
||||||
|
isOpen,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
name={dialogName}
|
||||||
|
title={<T id={'receipt_preview.dialog.title'} />}
|
||||||
|
className={classNames(CLASSES.DIALOG_PDF_PREVIEW)}
|
||||||
|
autoFocus={true}
|
||||||
|
canEscapeKeyClose={true}
|
||||||
|
isOpen={isOpen}
|
||||||
|
style={{ width: '1000px' }}
|
||||||
|
>
|
||||||
|
<DialogSuspense>
|
||||||
|
<PdfPreviewDialogContent
|
||||||
|
dialogName={dialogName}
|
||||||
|
subscriptionForm={payload}
|
||||||
|
/>
|
||||||
|
</DialogSuspense>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default compose(withDialogRedux())(ReceiptPdfPreviewDialog);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Tabs, Tab } from '@blueprintjs/core';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import EstimateDetailTab from './EstimateDetailTab';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Estimate view detail
|
||||||
|
*/
|
||||||
|
export default function EstimateDetail() {
|
||||||
|
return (
|
||||||
|
<div className="view-detail-drawer">
|
||||||
|
<Tabs animate={true} large={true}>
|
||||||
|
<Tab
|
||||||
|
title={intl.get('details')}
|
||||||
|
id={'details'}
|
||||||
|
panel={<EstimateDetailTab />}
|
||||||
|
/>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import 'style/components/Drawers/ViewDetail/ViewDetail.scss';
|
||||||
|
|
||||||
|
import EstimateDetail from './EstimateDetail';
|
||||||
|
import { EstimateDetailDrawerProvider } from './EstimateDetailDrawerProvider';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Estimate detail drawer content.
|
||||||
|
*/
|
||||||
|
export default function EstimateDetailDrawerContent({
|
||||||
|
// #ownProp
|
||||||
|
estimate,
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<EstimateDetailDrawerProvider estimateId={estimate}>
|
||||||
|
<EstimateDetail />
|
||||||
|
</EstimateDetailDrawerProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||||
|
|
||||||
|
const EstimateDetailDrawerContext = React.createContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Estimate detail provider.
|
||||||
|
*/
|
||||||
|
function EstimateDetailDrawerProvider({ estimateId, ...props }) {
|
||||||
|
const provider = {
|
||||||
|
estimateId,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DashboardInsider>
|
||||||
|
<DrawerHeaderContent
|
||||||
|
name="estimate-detail-drawer"
|
||||||
|
title={intl.get('estimate_details')}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EstimateDetailDrawerContext.Provider value={provider} {...props} />
|
||||||
|
</DashboardInsider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const useEstimateDetailDrawerContext = () =>
|
||||||
|
React.useContext(EstimateDetailDrawerContext);
|
||||||
|
|
||||||
|
export { EstimateDetailDrawerProvider, useEstimateDetailDrawerContext };
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
NavbarGroup,
|
||||||
|
Classes,
|
||||||
|
NavbarDivider,
|
||||||
|
Intent,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
|
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
||||||
|
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
|
import { Icon, FormattedMessage as T } from 'components';
|
||||||
|
|
||||||
|
import { safeCallback, compose } from 'utils';
|
||||||
|
|
||||||
|
function EstimateDetailTab({
|
||||||
|
// #withDialogActions
|
||||||
|
openDialog,
|
||||||
|
|
||||||
|
// #withAlertsActions
|
||||||
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
|
}) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
const { estimateId } = useEstimateDetailDrawerContext();
|
||||||
|
|
||||||
|
// Handle edit sale estimate.
|
||||||
|
const onEditEstimate = () => {
|
||||||
|
return estimateId
|
||||||
|
? (history.push(`/estimates/${estimateId}/edit`),
|
||||||
|
closeDrawer('estimate-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle delete sale estimate.
|
||||||
|
const onDeleteEstimate = () => {
|
||||||
|
return estimateId
|
||||||
|
? (openAlert('estimate-delete', { estimateId }),
|
||||||
|
closeDrawer('estimate-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle print estimate.
|
||||||
|
const onPrintEstimate = () => {
|
||||||
|
openDialog('estimate-pdf-preview', { estimateId });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DashboardActionsBar>
|
||||||
|
<NavbarGroup>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="pen-18" />}
|
||||||
|
text={<T id={'edit_estimate'} />}
|
||||||
|
onClick={safeCallback(onEditEstimate)}
|
||||||
|
/>
|
||||||
|
<NavbarDivider />
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="print-16" />}
|
||||||
|
text={<T id={'print'} />}
|
||||||
|
onClick={safeCallback(onPrintEstimate)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
|
text={<T id={'delete'} />}
|
||||||
|
intent={Intent.DANGER}
|
||||||
|
onClick={safeCallback(onDeleteEstimate)}
|
||||||
|
/>
|
||||||
|
</NavbarGroup>
|
||||||
|
</DashboardActionsBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(
|
||||||
|
withDialogActions,
|
||||||
|
withAlertsActions,
|
||||||
|
withDrawerActions,
|
||||||
|
)(EstimateDetailTab);
|
||||||
26
client/src/containers/Drawers/EstimateDetailDrawer/index.js
Normal file
26
client/src/containers/Drawers/EstimateDetailDrawer/index.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
|
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
const EstimateDetailDrawerContent = React.lazy(() =>
|
||||||
|
import('./EstimateDetailDrawerContent'),
|
||||||
|
);
|
||||||
|
|
||||||
|
function EstimateDetailDrawer({
|
||||||
|
name,
|
||||||
|
// #withDrawer
|
||||||
|
isOpen,
|
||||||
|
payload: { estimateId },
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Drawer isOpen={isOpen} name={name} size={'750px'}>
|
||||||
|
<DrawerSuspense>
|
||||||
|
<EstimateDetailDrawerContent estimate={estimateId} />
|
||||||
|
</DrawerSuspense>
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(withDrawers())(EstimateDetailDrawer);
|
||||||
@@ -3,13 +3,14 @@ import { Tabs, Tab } from '@blueprintjs/core';
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
|
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
|
||||||
|
import InvoiceDetailTab from './InvoiceDetailTab';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice view detail.
|
* Invoice view detail.
|
||||||
*/
|
*/
|
||||||
export default function InvoiceDetail() {
|
export default function InvoiceDetail() {
|
||||||
const { transactions } = useInvoiceDetailDrawerContext();
|
const { transactions, invoiceId } = useInvoiceDetailDrawerContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="view-detail-drawer">
|
<div className="view-detail-drawer">
|
||||||
@@ -19,7 +20,11 @@ export default function InvoiceDetail() {
|
|||||||
defaultSelectedTabId="journal_entries"
|
defaultSelectedTabId="journal_entries"
|
||||||
renderActiveTabPanelOnly={false}
|
renderActiveTabPanelOnly={false}
|
||||||
>
|
>
|
||||||
<Tab title={intl.get('details')} disabled={true} />
|
<Tab
|
||||||
|
title={intl.get('details')}
|
||||||
|
id={'details'}
|
||||||
|
panel={<InvoiceDetailTab invoiceId={invoiceId} />}
|
||||||
|
/>
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('journal_entries')}
|
title={intl.get('journal_entries')}
|
||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
|
|||||||
//provider.
|
//provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
transactions,
|
transactions,
|
||||||
|
invoiceId,
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<DashboardInsider loading={isTransactionLoading}>
|
<DashboardInsider loading={isTransactionLoading}>
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
NavbarGroup,
|
||||||
|
Classes,
|
||||||
|
NavbarDivider,
|
||||||
|
Intent,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
|
|
||||||
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
|
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
|
import { Icon, FormattedMessage as T } from 'components';
|
||||||
|
|
||||||
|
import { safeCallback, compose } from 'utils';
|
||||||
|
|
||||||
|
function InvoiceDetailTab({
|
||||||
|
invoiceId,
|
||||||
|
// #withDialogActions
|
||||||
|
openDialog,
|
||||||
|
|
||||||
|
// #withAlertsActions
|
||||||
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
|
}) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
// Handle edit sale invoice.
|
||||||
|
const onEditInvoice = () => {
|
||||||
|
return invoiceId
|
||||||
|
? (history.push(`/invoices/${invoiceId}/edit`),
|
||||||
|
closeDrawer('invoice-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle delete sale invoice.
|
||||||
|
const onDeleteInvoice = () => {
|
||||||
|
return invoiceId
|
||||||
|
? (openAlert('invoice-delete', { invoiceId }),
|
||||||
|
closeDrawer('invoice-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle print invoices.
|
||||||
|
const onPrintInvoice = () => {
|
||||||
|
openDialog('invoice-pdf-preview', { invoiceId });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DashboardActionsBar>
|
||||||
|
<NavbarGroup>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="pen-18" />}
|
||||||
|
text={<T id={'edit_invoice'} />}
|
||||||
|
onClick={safeCallback(onEditInvoice)}
|
||||||
|
/>
|
||||||
|
<NavbarDivider />
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="print-16" />}
|
||||||
|
text={<T id={'print'} />}
|
||||||
|
onClick={safeCallback(onPrintInvoice)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
|
text={<T id={'delete'} />}
|
||||||
|
intent={Intent.DANGER}
|
||||||
|
onClick={safeCallback(onDeleteInvoice)}
|
||||||
|
/>
|
||||||
|
</NavbarGroup>
|
||||||
|
</DashboardActionsBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(
|
||||||
|
withDialogActions,
|
||||||
|
withDrawerActions,
|
||||||
|
withAlertsActions,
|
||||||
|
)(InvoiceDetailTab);
|
||||||
@@ -3,18 +3,23 @@ import { Tabs, Tab } from '@blueprintjs/core';
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
|
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
|
||||||
|
import ReceiptDetailTab from './ReceiptDetailTab';
|
||||||
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
|
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receipt view detail.
|
* Receipt view detail.
|
||||||
*/
|
*/
|
||||||
export default function ReceiptDetail() {
|
export default function ReceiptDetail() {
|
||||||
const { transactions } = useReceiptDetailDrawerContext();
|
const { transactions, receiptId } = useReceiptDetailDrawerContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="view-detail-drawer">
|
<div className="view-detail-drawer">
|
||||||
<Tabs animate={true} large={true} defaultSelectedTabId="journal_entries">
|
<Tabs animate={true} large={true} defaultSelectedTabId="journal_entries">
|
||||||
<Tab title={intl.get('details')} id={'details'} disabled={true} />
|
<Tab
|
||||||
|
title={intl.get('details')}
|
||||||
|
id={'details'}
|
||||||
|
panel={<ReceiptDetailTab receiptId={receiptId} />}
|
||||||
|
/>
|
||||||
<Tab
|
<Tab
|
||||||
title={intl.get('journal_entries')}
|
title={intl.get('journal_entries')}
|
||||||
id={'journal_entries'}
|
id={'journal_entries'}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
|
|||||||
//provider.
|
//provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
transactions,
|
transactions,
|
||||||
|
receiptId,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
NavbarGroup,
|
||||||
|
Classes,
|
||||||
|
NavbarDivider,
|
||||||
|
Intent,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
|
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
|
||||||
|
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
|
import { Icon, FormattedMessage as T } from 'components';
|
||||||
|
|
||||||
|
import { safeCallback, compose } from 'utils';
|
||||||
|
|
||||||
|
function ReceiptDetailTab({
|
||||||
|
receiptId,
|
||||||
|
// #withDialogActions
|
||||||
|
openDialog,
|
||||||
|
|
||||||
|
// #withAlertsActions
|
||||||
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
|
}) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
// Handle edit sale receipt.
|
||||||
|
const onEditReceipt = () => {
|
||||||
|
return receiptId
|
||||||
|
? (history.push(`/receipts/${receiptId}/edit`),
|
||||||
|
closeDrawer('receipt-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle delete sale receipt.
|
||||||
|
const onDeleteReceipt = () => {
|
||||||
|
return receiptId
|
||||||
|
? (openAlert('receipt-delete', { receiptId }),
|
||||||
|
closeDrawer('receipt-detail-drawer'))
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
// Handle print receipt.
|
||||||
|
const onPrintReceipt = () => {
|
||||||
|
openDialog('receipt-pdf-preview', { receiptId });
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<DashboardActionsBar>
|
||||||
|
<NavbarGroup>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="pen-18" />}
|
||||||
|
text={<T id={'edit_receipt'} />}
|
||||||
|
onClick={safeCallback(onEditReceipt)}
|
||||||
|
/>
|
||||||
|
<NavbarDivider />
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="print-16" />}
|
||||||
|
text={<T id={'print'} />}
|
||||||
|
onClick={safeCallback(onPrintReceipt)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon={'trash-16'} iconSize={16} />}
|
||||||
|
text={<T id={'delete'} />}
|
||||||
|
intent={Intent.DANGER}
|
||||||
|
onClick={safeCallback(onDeleteReceipt)}
|
||||||
|
/>
|
||||||
|
</NavbarGroup>
|
||||||
|
</DashboardActionsBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(
|
||||||
|
withDialogActions,
|
||||||
|
withDrawerActions,
|
||||||
|
withAlertsActions,
|
||||||
|
)(ReceiptDetailTab);
|
||||||
@@ -12,6 +12,7 @@ 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 withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
import { useEstimatesListContext } from './EstimatesListProvider';
|
import { useEstimatesListContext } from './EstimatesListProvider';
|
||||||
import { ActionsMenu, useEstiamtesTableColumns } from './components';
|
import { ActionsMenu, useEstiamtesTableColumns } from './components';
|
||||||
@@ -28,6 +29,9 @@ function EstimatesDataTable({
|
|||||||
|
|
||||||
// #withDrawerActions
|
// #withDrawerActions
|
||||||
openDrawer,
|
openDrawer,
|
||||||
|
|
||||||
|
// #withDialogAction
|
||||||
|
openDialog,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -77,6 +81,16 @@ function EstimatesDataTable({
|
|||||||
history.push(`/invoices/new?from_estimate_id=${id}`, { action: id });
|
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.
|
// Handles fetch data.
|
||||||
const handleFetchData = useCallback(
|
const handleFetchData = useCallback(
|
||||||
({ pageIndex, pageSize, sortBy }) => {
|
({ pageIndex, pageSize, sortBy }) => {
|
||||||
@@ -120,6 +134,8 @@ function EstimatesDataTable({
|
|||||||
onDelete: handleDeleteEstimate,
|
onDelete: handleDeleteEstimate,
|
||||||
onDrawer: handleDrawerEstimate,
|
onDrawer: handleDrawerEstimate,
|
||||||
onConvert: handleConvertToInvoice,
|
onConvert: handleConvertToInvoice,
|
||||||
|
onViewDetails: handleViewDetailEstimate,
|
||||||
|
onPrint: handlePrintEstimate,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -129,6 +145,7 @@ export default compose(
|
|||||||
withEstimatesActions,
|
withEstimatesActions,
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
withDrawerActions,
|
withDrawerActions,
|
||||||
|
withDialogActions,
|
||||||
withSettings(({ organizationSettings }) => ({
|
withSettings(({ organizationSettings }) => ({
|
||||||
baseCurrency: organizationSettings?.baseCurrency,
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -58,15 +58,16 @@ export function ActionsMenu({
|
|||||||
onDelete,
|
onDelete,
|
||||||
onDrawer,
|
onDrawer,
|
||||||
onConvert,
|
onConvert,
|
||||||
|
onViewDetails,
|
||||||
|
onPrint,
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={<Icon icon="reader-18" />}
|
icon={<Icon icon="reader-18" />}
|
||||||
text={intl.get('view_details')}
|
text={intl.get('view_details')}
|
||||||
|
onClick={safeCallback(onViewDetails, original)}
|
||||||
/>
|
/>
|
||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -119,6 +120,11 @@ export function ActionsMenu({
|
|||||||
text={intl.get('estimate_paper')}
|
text={intl.get('estimate_paper')}
|
||||||
onClick={safeCallback(onDrawer, original)}
|
onClick={safeCallback(onDrawer, original)}
|
||||||
/>
|
/>
|
||||||
|
<MenuItem
|
||||||
|
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||||
|
text={intl.get('print')}
|
||||||
|
onClick={safeCallback(onPrint, original)}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('delete_estimate')}
|
text={intl.get('delete_estimate')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
@@ -149,8 +155,6 @@ function ActionsCell(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useEstiamtesTableColumns() {
|
export function useEstiamtesTableColumns() {
|
||||||
|
|
||||||
|
|
||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@@ -204,7 +208,7 @@ export function useEstiamtesTableColumns() {
|
|||||||
accessor: 'reference',
|
accessor: 'reference',
|
||||||
width: 90,
|
width: 90,
|
||||||
className: 'reference',
|
className: 'reference',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ function InvoicesDataTable({
|
|||||||
openDrawer('invoice-detail-drawer', { invoiceId: id });
|
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.
|
// Handles fetch data once the table state change.
|
||||||
const handleDataTableFetchData = useCallback(
|
const handleDataTableFetchData = useCallback(
|
||||||
({ pageSize, pageIndex, sortBy }) => {
|
({ pageSize, pageIndex, sortBy }) => {
|
||||||
@@ -130,6 +135,7 @@ function InvoicesDataTable({
|
|||||||
onDrawer: handleDrawerInvoice,
|
onDrawer: handleDrawerInvoice,
|
||||||
onQuick: handleQuickPaymentReceive,
|
onQuick: handleQuickPaymentReceive,
|
||||||
onViewDetails: handleViewDetailInvoice,
|
onViewDetails: handleViewDetailInvoice,
|
||||||
|
onPrint: handlePrintInvoice,
|
||||||
baseCurrency,
|
baseCurrency,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -93,7 +93,15 @@ export const handleDeleteErrors = (errors) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEdit, onDeliver, onDelete, onDrawer, onQuick, onViewDetails },
|
payload: {
|
||||||
|
onEdit,
|
||||||
|
onDeliver,
|
||||||
|
onDelete,
|
||||||
|
onDrawer,
|
||||||
|
onQuick,
|
||||||
|
onViewDetails,
|
||||||
|
onPrint,
|
||||||
|
},
|
||||||
row: { original },
|
row: { original },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
@@ -128,6 +136,11 @@ export function ActionsMenu({
|
|||||||
text={intl.get('invoice_paper')}
|
text={intl.get('invoice_paper')}
|
||||||
onClick={safeCallback(onDrawer, original)}
|
onClick={safeCallback(onDrawer, original)}
|
||||||
/>
|
/>
|
||||||
|
<MenuItem
|
||||||
|
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||||
|
text={intl.get('print')}
|
||||||
|
onClick={safeCallback(onPrint, original)}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('delete_invoice')}
|
text={intl.get('delete_invoice')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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 withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
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';
|
||||||
@@ -35,6 +36,9 @@ function ReceiptsDataTable({
|
|||||||
|
|
||||||
// #withDrawerActions
|
// #withDrawerActions
|
||||||
openDrawer,
|
openDrawer,
|
||||||
|
|
||||||
|
// #withDialogAction
|
||||||
|
openDialog,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -75,6 +79,11 @@ function ReceiptsDataTable({
|
|||||||
openDrawer('receipt-detail-drawer', { receiptId: id });
|
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.
|
// Handles the datable fetch data once the state changing.
|
||||||
const handleDataTableFetchData = useCallback(
|
const handleDataTableFetchData = useCallback(
|
||||||
({ sortBy, pageIndex, pageSize }) => {
|
({ sortBy, pageIndex, pageSize }) => {
|
||||||
@@ -118,6 +127,7 @@ function ReceiptsDataTable({
|
|||||||
onClose: handleCloseReceipt,
|
onClose: handleCloseReceipt,
|
||||||
onDrawer: handleDrawerReceipt,
|
onDrawer: handleDrawerReceipt,
|
||||||
onViewDetails: handleViewDetailReceipt,
|
onViewDetails: handleViewDetailReceipt,
|
||||||
|
onPrint: handlePrintInvoice,
|
||||||
baseCurrency,
|
baseCurrency,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -128,6 +138,7 @@ export default compose(
|
|||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
withReceiptsActions,
|
withReceiptsActions,
|
||||||
withDrawerActions,
|
withDrawerActions,
|
||||||
|
withDialogActions,
|
||||||
withReceipts(({ receiptTableState }) => ({
|
withReceipts(({ receiptTableState }) => ({
|
||||||
receiptTableState,
|
receiptTableState,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -16,7 +16,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, onDrawer, onViewDetails },
|
payload: { onEdit, onDelete, onClose, onDrawer, onViewDetails, onPrint },
|
||||||
row: { original: receipt },
|
row: { original: receipt },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
@@ -44,6 +44,11 @@ export function ActionsMenu({
|
|||||||
text={intl.get('receipt_paper')}
|
text={intl.get('receipt_paper')}
|
||||||
onClick={safeCallback(onDrawer, receipt)}
|
onClick={safeCallback(onDrawer, receipt)}
|
||||||
/>
|
/>
|
||||||
|
<MenuItem
|
||||||
|
icon={<Icon icon={'print-16'} iconSize={16} />}
|
||||||
|
text={intl.get('print')}
|
||||||
|
onClick={safeCallback(onPrint, receipt)}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={intl.get('delete_receipt')}
|
text={intl.get('delete_receipt')}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { useQueryClient, useMutation } from 'react-query';
|
import { useQueryClient, useMutation } from 'react-query';
|
||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
|
|
||||||
import { transformPagination } from 'utils';
|
import { transformPagination } from 'utils';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
|
||||||
@@ -170,6 +172,14 @@ export function useRejectEstimate(props) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the estimate pdf document data,
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function usePdfEstimate(estimateId) {
|
||||||
|
return useRequestPdf(`sales/estimates/${estimateId}`);
|
||||||
|
}
|
||||||
|
|
||||||
export function useRefreshEstimates() {
|
export function useRefreshEstimates() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export function useInvoice(invoiceId, props, requestProps) {
|
|||||||
* Retrieve the invoice pdf document data.
|
* Retrieve the invoice pdf document data.
|
||||||
*/
|
*/
|
||||||
export function usePdfInvoice(invoiceId) {
|
export function usePdfInvoice(invoiceId) {
|
||||||
return useRequestPdf(`/sales/invoices/${invoiceId}`);
|
return useRequestPdf(`sales/invoices/${invoiceId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useQueryClient, useMutation } from 'react-query';
|
import { useQueryClient, useMutation } from 'react-query';
|
||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { transformPagination } from 'utils';
|
import { transformPagination } from 'utils';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
@@ -142,6 +143,13 @@ export function useReceipt(id, props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the receipt pdf document data.
|
||||||
|
*/
|
||||||
|
export function usePdfReceipt(ReceiptId) {
|
||||||
|
return useRequestPdf(`sales/receipts/${ReceiptId}`);
|
||||||
|
}
|
||||||
|
|
||||||
export function useRefreshReceipts() {
|
export function useRefreshReceipts() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
|
|||||||
@@ -1219,6 +1219,9 @@
|
|||||||
"pdf_preview.dialog.title": "PDF Preview",
|
"pdf_preview.dialog.title": "PDF Preview",
|
||||||
"pdf_preview.download.button": "Download",
|
"pdf_preview.download.button": "Download",
|
||||||
"pdf_preview.preview.button": "Preview",
|
"pdf_preview.preview.button": "Preview",
|
||||||
"invoice_preview.dialog.title": "Invoice PDF Preview"
|
"invoice_preview.dialog.title": "Invoice PDF Preview",
|
||||||
|
"estimate_preview.dialog.title": "Estimate PDF Preview",
|
||||||
|
"receipt_preview.dialog.title":"Receipt PDF Preview"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1206,5 +1206,7 @@
|
|||||||
"pdf_preview.dialog.title": "PDF Preview",
|
"pdf_preview.dialog.title": "PDF Preview",
|
||||||
"pdf_preview.download.button": "Download",
|
"pdf_preview.download.button": "Download",
|
||||||
"pdf_preview.preview.button": "Preview",
|
"pdf_preview.preview.button": "Preview",
|
||||||
"invoice_preview.dialog.title": "Invoice PDF Preview"
|
"invoice_preview.dialog.title": "Invoice PDF Preview",
|
||||||
|
"estimate_preview.dialog.title":"Estimate PDF Preview",
|
||||||
|
"receipt_preview.dialog.title":"Receipt PDF Preview"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user