mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: receipt drawer.
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import EstimateDrawer from 'containers/Sales/Estimate/EstimateDrawer';
|
import EstimateDrawer from 'containers/Sales/Estimate/EstimateDrawer';
|
||||||
import InvoiceDrawer from 'containers/Sales/Invoice/InvoiceDrawer';
|
import InvoiceDrawer from 'containers/Sales/Invoice/InvoiceDrawer';
|
||||||
|
import ReceiptDrawer from 'containers/Sales/Receipt/ReceiptDrawer';
|
||||||
|
|
||||||
export default function DrawersContainer() {
|
export default function DrawersContainer() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<EstimateDrawer name={'estimate-drawer'} />
|
<EstimateDrawer name={'estimate-drawer'} />
|
||||||
<InvoiceDrawer name={'invoice-drawer'} />
|
<InvoiceDrawer name={'invoice-drawer'} />
|
||||||
|
<ReceiptDrawer name={'receipt-drawer'} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function InvoiceDrawer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerTemplate isOpen={isOpen} isClose={handleDrawerClose}>
|
<DrawerTemplate isOpen={isOpen} isClose={handleDrawerClose}>
|
||||||
<PaperTemplate propLabels={propLabels} />
|
<PaperTemplate labels={propLabels.labels} />
|
||||||
</DrawerTemplate>
|
</DrawerTemplate>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
43
client/src/containers/Sales/Receipt/ReceiptDrawer.js
Normal file
43
client/src/containers/Sales/Receipt/ReceiptDrawer.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import DrawerTemplate from 'containers/Drawers/DrawerTemplate';
|
||||||
|
import PaperTemplate from 'containers/Drawers/PaperTemplate';
|
||||||
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
|
const ReceiptDrawer = ({
|
||||||
|
name,
|
||||||
|
//#withDrawer
|
||||||
|
isOpen,
|
||||||
|
payload,
|
||||||
|
|
||||||
|
closeDrawer,
|
||||||
|
}) => {
|
||||||
|
// handle close Drawer
|
||||||
|
const handleDrawerClose = () => {
|
||||||
|
closeDrawer(name);
|
||||||
|
};
|
||||||
|
|
||||||
|
const propLabels = {
|
||||||
|
labels: {
|
||||||
|
name: 'Receipt',
|
||||||
|
billedTo: 'Billed to',
|
||||||
|
date: 'Receipt date',
|
||||||
|
refNo: 'Receipt No.',
|
||||||
|
billedFrom: 'Billed from',
|
||||||
|
amount: 'Receipt amount',
|
||||||
|
dueDate: 'Due date',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<DrawerTemplate isOpen={isOpen} isClose={handleDrawerClose}>
|
||||||
|
<PaperTemplate labels={propLabels.labels} />
|
||||||
|
</DrawerTemplate>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default compose(withDrawers(), withDrawerActions)(ReceiptDrawer);
|
||||||
@@ -55,6 +55,7 @@ function ReceiptsDataTable({
|
|||||||
onEditReceipt,
|
onEditReceipt,
|
||||||
onDeleteReceipt,
|
onDeleteReceipt,
|
||||||
onCloseReceipt,
|
onCloseReceipt,
|
||||||
|
onDrawerReceipt,
|
||||||
onSelectedRowsChange,
|
onSelectedRowsChange,
|
||||||
}) {
|
}) {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -93,6 +94,11 @@ function ReceiptsDataTable({
|
|||||||
onClick={() => onCloseReceipt(receipt)}
|
onClick={() => onCloseReceipt(receipt)}
|
||||||
/>
|
/>
|
||||||
</If>
|
</If>
|
||||||
|
|
||||||
|
<MenuItem
|
||||||
|
text={formatMessage({ id: 'receipt_paper' })}
|
||||||
|
onClick={() => onDrawerReceipt()}
|
||||||
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={formatMessage({ id: 'delete_receipt' })}
|
text={formatMessage({ id: 'delete_receipt' })}
|
||||||
intent={Intent.DANGER}
|
intent={Intent.DANGER}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import withReceipts from './withReceipts';
|
|||||||
import withReceiptActions from './withReceiptActions';
|
import withReceiptActions from './withReceiptActions';
|
||||||
import withViewsActions from 'containers/Views/withViewsActions';
|
import withViewsActions from 'containers/Views/withViewsActions';
|
||||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -33,6 +34,9 @@ function ReceiptsList({
|
|||||||
// #withAlertsActions,
|
// #withAlertsActions,
|
||||||
openAlert,
|
openAlert,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
openDrawer,
|
||||||
|
|
||||||
//#withReceiptActions
|
//#withReceiptActions
|
||||||
requestFetchReceiptsTable,
|
requestFetchReceiptsTable,
|
||||||
addReceiptsTableQueries,
|
addReceiptsTableQueries,
|
||||||
@@ -78,6 +82,10 @@ function ReceiptsList({
|
|||||||
[history],
|
[history],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleReceiptDrawer = useCallback(() => {
|
||||||
|
openDrawer('receipt-drawer', {});
|
||||||
|
}, [openDrawer]);
|
||||||
|
|
||||||
const handleSelectedRowsChange = useCallback(
|
const handleSelectedRowsChange = useCallback(
|
||||||
(estimate) => {
|
(estimate) => {
|
||||||
setSelectedRows(estimate);
|
setSelectedRows(estimate);
|
||||||
@@ -105,6 +113,7 @@ function ReceiptsList({
|
|||||||
onDeleteReceipt={handleDeleteReceipt}
|
onDeleteReceipt={handleDeleteReceipt}
|
||||||
onEditReceipt={handleEditReceipt}
|
onEditReceipt={handleEditReceipt}
|
||||||
onCloseReceipt={handleCloseReceipt}
|
onCloseReceipt={handleCloseReceipt}
|
||||||
|
onDrawerReceipt={handleReceiptDrawer}
|
||||||
onSelectedRowsChange={handleSelectedRowsChange}
|
onSelectedRowsChange={handleSelectedRowsChange}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
@@ -124,4 +133,5 @@ export default compose(
|
|||||||
receiptTableQuery,
|
receiptTableQuery,
|
||||||
})),
|
})),
|
||||||
withAlertsActions,
|
withAlertsActions,
|
||||||
|
withDrawerActions,
|
||||||
)(ReceiptsList);
|
)(ReceiptsList);
|
||||||
|
|||||||
@@ -969,6 +969,7 @@ export default {
|
|||||||
voucher_number: 'Voucher number',
|
voucher_number: 'Voucher number',
|
||||||
voucher: 'Voucher',
|
voucher: 'Voucher',
|
||||||
view_paper: 'View Paper',
|
view_paper: 'View Paper',
|
||||||
estimate_paper:'Estimate Paper',
|
estimate_paper: 'Estimate Paper',
|
||||||
invoice_paper:'Invoice Paper',
|
invoice_paper: 'Invoice Paper',
|
||||||
|
receipt_paper: 'Receipt Paper',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user