This commit is contained in:
a.bouhuolia
2021-09-08 16:32:59 +02:00
49 changed files with 305 additions and 216 deletions

View File

@@ -24,7 +24,7 @@ import EstimatesEmptyStatus from './EstimatesEmptyStatus';
import { statusAccessor } from './components';
import withEstimates from './withEstimates';
import withEstimateActions from './withEstimateActions';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
// Estimates transactions datatable.
function EstimatesDataTable({
@@ -38,8 +38,8 @@ function EstimatesDataTable({
// #withEstimatesActions
addEstimatesTableQueries,
// #withSettings
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
// #ownProps
onEditEstimate,
@@ -50,7 +50,6 @@ function EstimatesDataTable({
onDrawerEstimate,
onSelectedRowsChange,
}) {
const isLoaded = useIsValuePassed(estimatesLoading, false);
const handleEditEstimate = useCallback(
@@ -171,7 +170,7 @@ function EstimatesDataTable({
{
id: 'amount',
Header: intl.get('amount'),
accessor: (r) => <Money amount={r.amount} currency={baseCurrency} />,
accessor: (r) => <Money amount={r.amount} currency={base_currency} />,
width: 140,
className: 'amount',
@@ -293,7 +292,5 @@ export default compose(
estimatesCurrentViewId,
}),
),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(EstimatesDataTable);

View File

@@ -20,6 +20,7 @@ import EstimateFormFooter from './EstimateFormFooter';
import EstimateFormDialogs from './EstimateFormDialogs';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { AppToaster } from 'components';
import { ERROR } from 'common/errors';
@@ -35,7 +36,9 @@ function EstimateForm({
estimateNextNumber,
estimateNumberPrefix,
estimateIncrementMode,
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const history = useHistory();
const {
@@ -55,14 +58,14 @@ function EstimateForm({
const initialValues = useMemo(
() => ({
...(!isEmpty(estimate)
? { ...transformToEditForm(estimate), currency_code: baseCurrency }
? { ...transformToEditForm(estimate), currency_code: base_currency }
: {
...defaultEstimate,
...(estimateIncrementMode && {
estimate_number: estimateNumber,
}),
entries: orderingLinesIndexes(defaultEstimate.entries),
currency_code: baseCurrency,
currency_code: base_currency,
}),
}),
[estimate, estimateNumber, estimateIncrementMode],
@@ -172,10 +175,10 @@ function EstimateForm({
}
export default compose(
withSettings(({ estimatesSettings, organizationSettings }) => ({
withSettings(({ estimatesSettings }) => ({
estimateNextNumber: estimatesSettings?.nextNumber,
estimateNumberPrefix: estimatesSettings?.numberPrefix,
estimateIncrementMode: estimatesSettings?.autoIncrement,
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(EstimateForm);

View File

@@ -6,7 +6,7 @@ import intl from 'react-intl-universal';
import { CLASSES } from 'common/classes';
import EstimateFormHeaderFields from './EstimateFormHeaderFields';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { getEntriesTotal } from 'containers/Entries/utils';
import { PageFormBigNumber } from 'components';
@@ -14,8 +14,8 @@ import { compose } from 'utils';
// Estimate form top header.
function EstimateFormHeader({
// #withSettings
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const { values } = useFormikContext();
@@ -32,14 +32,10 @@ function EstimateFormHeader({
<PageFormBigNumber
label={intl.get('amount')}
amount={totalDueAmount}
currencyCode={baseCurrency}
currencyCode={base_currency}
/>
</div>
);
}
export default compose(
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(EstimateFormHeader);
export default compose(withCurrentOrganization())(EstimateFormHeader);

View File

@@ -9,7 +9,6 @@ import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
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 withDialogActions from 'containers/Dialog/withDialogActions';
@@ -91,6 +90,10 @@ function EstimatesDataTable({
openDialog('estimate-pdf-preview', { estimateId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('estimate-detail-drawer', { estimateId: cell.row.original.id });
};
// Handles fetch data.
const handleFetchData = useCallback(
({ pageIndex, pageSize, sortBy }) => {
@@ -127,6 +130,7 @@ function EstimatesDataTable({
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
ContextMenu={ActionsMenu}
onCellClick={handleCellClick}
payload={{
onApprove: handleApproveEstimate,
onEdit: handleEditEstimate,
@@ -148,7 +152,4 @@ export default compose(
withAlertsActions,
withDrawerActions,
withDialogActions,
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(EstimatesDataTable);

View File

@@ -164,6 +164,7 @@ export function useEstiamtesTableColumns() {
Cell: DateCell,
width: 140,
className: 'estimate_date',
clickable: true,
},
{
id: 'customer',
@@ -171,6 +172,7 @@ export function useEstiamtesTableColumns() {
accessor: 'customer.display_name',
width: 140,
className: 'customer_id',
clickable: true,
},
{
id: 'expiration_date',
@@ -179,6 +181,7 @@ export function useEstiamtesTableColumns() {
Cell: DateCell,
width: 140,
className: 'expiration_date',
clickable: true,
},
{
id: 'estimate_number',
@@ -187,6 +190,7 @@ export function useEstiamtesTableColumns() {
row.estimate_number ? `#${row.estimate_number}` : null,
width: 140,
className: 'estimate_number',
clickable: true,
},
{
id: 'amount',
@@ -194,6 +198,7 @@ export function useEstiamtesTableColumns() {
accessor: AmountAccessor,
width: 140,
className: 'amount',
clickable: true,
},
{
id: 'status',
@@ -201,6 +206,7 @@ export function useEstiamtesTableColumns() {
accessor: (row) => statusAccessor(row),
width: 140,
className: 'status',
clickable: true,
},
{
id: 'reference_no',
@@ -208,6 +214,7 @@ export function useEstiamtesTableColumns() {
accessor: 'reference',
width: 90,
className: 'reference',
clickable: true,
},
],
[],

View File

@@ -20,6 +20,7 @@ import InvoiceFormDialogs from './InvoiceFormDialogs';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withMediaActions from 'containers/Media/withMediaActions';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { AppToaster } from 'components';
import { compose, orderingLinesIndexes, transactionNumber } from 'utils';
@@ -34,7 +35,9 @@ function InvoiceForm({
invoiceNextNumber,
invoiceNumberPrefix,
invoiceIncrementMode,
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const history = useHistory();
@@ -58,7 +61,7 @@ function InvoiceForm({
const initialValues = useMemo(
() => ({
...(!isEmpty(invoice)
? { ...transformToEditForm(invoice), currency_code: baseCurrency }
? { ...transformToEditForm(invoice), currency_code: base_currency }
: {
...defaultInvoice,
...(invoiceIncrementMode && {
@@ -66,7 +69,7 @@ function InvoiceForm({
}),
entries: orderingLinesIndexes(defaultInvoice.entries),
...newInvoice,
currency_code: baseCurrency,
currency_code: base_currency,
}),
}),
[invoice, newInvoice, invoiceNumber, invoiceIncrementMode],
@@ -171,10 +174,10 @@ function InvoiceForm({
export default compose(
withDashboardActions,
withMediaActions,
withSettings(({ invoiceSettings, organizationSettings }) => ({
withSettings(({ invoiceSettings }) => ({
invoiceNextNumber: invoiceSettings?.nextNumber,
invoiceNumberPrefix: invoiceSettings?.numberPrefix,
invoiceIncrementMode: invoiceSettings?.incrementMode,
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(InvoiceForm);

View File

@@ -9,7 +9,7 @@ import InvoiceFormHeaderFields from './InvoiceFormHeaderFields';
import { getEntriesTotal } from 'containers/Entries/utils';
import { PageFormBigNumber } from 'components';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { compose } from 'redux';
@@ -17,8 +17,8 @@ import { compose } from 'redux';
* Invoice form header section.
*/
function InvoiceFormHeader({
// #withSettings
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const { values } = useFormikContext();
@@ -34,13 +34,9 @@ function InvoiceFormHeader({
<PageFormBigNumber
label={intl.get('due_amount')}
amount={totalDueAmount}
currencyCode={baseCurrency}
currencyCode={base_currency}
/>
</div>
);
}
export default compose(
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(InvoiceFormHeader);
export default compose(withCurrentOrganization())(InvoiceFormHeader);

View File

@@ -11,7 +11,6 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withInvoices from './withInvoices';
import withInvoiceActions from './withInvoiceActions';
import withSettings from 'containers/Settings/withSettings';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withDialogActions from 'containers/Dialog/withDialogActions';
@@ -29,9 +28,6 @@ function InvoicesDataTable({
// #withInvoices
invoicesTableState,
// #withSettings
baseCurrency,
// #withAlertsActions
openAlert,
@@ -90,6 +86,10 @@ function InvoicesDataTable({
openDialog('invoice-pdf-preview', { invoiceId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('invoice-detail-drawer', { invoiceId: cell.row.original.id });
};
// Handles fetch data once the table state change.
const handleDataTableFetchData = useCallback(
({ pageSize, pageIndex, sortBy }) => {
@@ -129,6 +129,7 @@ function InvoicesDataTable({
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
ContextMenu={ActionsMenu}
onCellClick={handleCellClick}
payload={{
onDelete: handleDeleteInvoice,
onDeliver: handleDeliverInvoice,
@@ -137,7 +138,6 @@ function InvoicesDataTable({
onQuick: handleQuickPaymentReceive,
onViewDetails: handleViewDetailInvoice,
onPrint: handlePrintInvoice,
baseCurrency,
}}
/>
</DashboardContentTable>
@@ -151,7 +151,4 @@ export default compose(
withDrawerActions,
withDialogActions,
withInvoices(({ invoicesTableState }) => ({ invoicesTableState })),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(InvoicesDataTable);

View File

@@ -174,6 +174,7 @@ export function useInvoicesTableColumns() {
accessor: (r) => moment(r.invoice_date).format('YYYY MMM DD'),
width: 110,
className: 'invoice_date',
clickable: true,
},
{
id: 'customer',
@@ -181,6 +182,7 @@ export function useInvoicesTableColumns() {
accessor: 'customer.display_name',
width: 180,
className: 'customer_id',
clickable: true,
},
{
@@ -189,6 +191,7 @@ export function useInvoicesTableColumns() {
accessor: 'invoice_no',
width: 100,
className: 'invoice_no',
clickable: true,
},
{
id: 'balance',
@@ -198,6 +201,7 @@ export function useInvoicesTableColumns() {
),
width: 120,
className: 'balance',
clickable: true,
},
{
id: 'status',
@@ -205,6 +209,7 @@ export function useInvoicesTableColumns() {
accessor: (row) => statusAccessor(row),
width: 160,
className: 'status',
clickable: true,
},
{
id: 'due_date',
@@ -212,6 +217,7 @@ export function useInvoicesTableColumns() {
accessor: (r) => moment(r.due_date).format('YYYY MMM DD'),
width: 110,
className: 'due_date',
clickable: true,
},
{
id: 'reference_no',
@@ -219,8 +225,9 @@ export function useInvoicesTableColumns() {
accessor: 'reference_no',
width: 90,
className: 'reference_no',
clickable: true,
},
],
[],
);
}
}

View File

@@ -18,6 +18,8 @@ import PaymentReceiveFormDialogs from './PaymentReceiveFormDialogs';
import { PaymentReceiveInnerProvider } from './PaymentReceiveInnerProvider';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import {
EditPaymentReceiveFormSchema,
CreatePaymentReceiveFormSchema,
@@ -37,7 +39,9 @@ function PaymentReceiveForm({
paymentReceiveNextNumber,
paymentReceiveNumberPrefix,
paymentReceiveAutoIncrement,
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const history = useHistory();
@@ -68,7 +72,7 @@ function PaymentReceiveForm({
payment_receive_no: nextPaymentNumber,
deposit_account_id: defaultTo(preferredDepositAccount, ''),
}),
currency_code: baseCurrency,
currency_code: base_currency,
}),
}),
[
@@ -198,12 +202,12 @@ function PaymentReceiveForm({
}
export default compose(
withSettings(({ paymentReceiveSettings, organizationSettings }) => ({
withSettings(({ paymentReceiveSettings }) => ({
paymentReceiveSettings,
paymentReceiveNextNumber: paymentReceiveSettings?.nextNumber,
paymentReceiveNumberPrefix: paymentReceiveSettings?.numberPrefix,
paymentReceiveAutoIncrement: paymentReceiveSettings?.autoIncrement,
preferredDepositAccount: paymentReceiveSettings?.depositAccount,
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(PaymentReceiveForm);

View File

@@ -7,7 +7,7 @@ import { FormattedMessage as T } from 'components';
import { CLASSES } from 'common/classes';
import PaymentReceiveHeaderFields from './PaymentReceiveHeaderFields';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { compose } from 'utils';
@@ -15,8 +15,8 @@ import { compose } from 'utils';
* Payment receive form header.
*/
function PaymentReceiveFormHeader({
// #withSettings
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
// Formik form context.
const { values } = useFormikContext();
@@ -38,7 +38,7 @@ function PaymentReceiveFormHeader({
<T id={'amount_received'} />
</span>
<h1 class="big-amount__number">
<Money amount={paymentFullAmount} currency={baseCurrency} />
<Money amount={paymentFullAmount} currency={base_currency} />
</h1>
</div>
</div>
@@ -47,8 +47,4 @@ function PaymentReceiveFormHeader({
);
}
export default compose(
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(PaymentReceiveFormHeader);
export default compose(withCurrentOrganization())(PaymentReceiveFormHeader);

View File

@@ -37,6 +37,7 @@ import { ACCOUNT_TYPE } from 'common/accountTypes';
import withDialogActions from 'containers/Dialog/withDialogActions';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import {
useObservePaymentNoSettings,
@@ -51,7 +52,8 @@ import { toSafeInteger } from 'lodash';
* Payment receive header fields.
*/
function PaymentReceiveHeaderFields({
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
// #withDialogActions
openDialog,
@@ -192,7 +194,7 @@ function PaymentReceiveHeaderFields({
helperText={<ErrorMessage name="full_amount" />}
>
<ControlGroup>
<InputPrependText text={baseCurrency} />
<InputPrependText text={base_currency} />
<MoneyInputGroup
value={value}
onChange={(value) => {
@@ -209,7 +211,7 @@ function PaymentReceiveHeaderFields({
minimal={true}
>
<T id={'receive_full_amount'} /> (
<Money amount={totalDueAmount} currency={baseCurrency} />)
<Money amount={totalDueAmount} currency={base_currency} />)
</Button>
</FormGroup>
)}
@@ -313,11 +315,11 @@ function PaymentReceiveHeaderFields({
}
export default compose(
withSettings(({ organizationSettings, paymentReceiveSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
withSettings(({ paymentReceiveSettings }) => ({
paymentReceiveNextNumber: paymentReceiveSettings?.nextNumber,
paymentReceiveNumberPrefix: paymentReceiveSettings?.numberPrefix,
paymentReceiveAutoIncrement: paymentReceiveSettings?.autoIncrement,
})),
withDialogActions,
withCurrentOrganization(),
)(PaymentReceiveHeaderFields);

View File

@@ -12,7 +12,6 @@ import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withAlertsActions from 'containers/Alert/withAlertActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import withSettings from 'containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
@@ -67,6 +66,13 @@ function PaymentReceivesDataTable({
openDrawer('payment-receive-detail-drawer', { paymentReceiveId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('payment-receive-detail-drawer', {
paymentReceiveId: cell.row.original.id,
});
};
// Handle datatable fetch once the table's state changing.
const handleDataTableFetchData = useCallback(
({ pageIndex, pageSize, sortBy }) => {
@@ -105,6 +111,7 @@ function PaymentReceivesDataTable({
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
ContextMenu={ActionsMenu}
onCellClick={handleCellClick}
payload={{
onDelete: handleDeletePaymentReceive,
onEdit: handleEditPaymentReceive,
@@ -123,7 +130,4 @@ export default compose(
withPaymentReceives(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
})),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(PaymentReceivesDataTable);

View File

@@ -89,6 +89,7 @@ export function usePaymentReceivesColumns() {
accessor: PaymentDateAccessor,
width: 140,
className: 'payment_date',
clickable: true,
},
{
id: 'customer',
@@ -96,6 +97,7 @@ export function usePaymentReceivesColumns() {
accessor: 'customer.display_name',
width: 160,
className: 'customer_id',
clickable: true,
},
{
id: 'amount',
@@ -103,6 +105,7 @@ export function usePaymentReceivesColumns() {
accessor: AmountAccessor,
width: 120,
className: 'amount',
clickable: true,
},
{
id: 'payment_receive_no',
@@ -111,6 +114,7 @@ export function usePaymentReceivesColumns() {
row.payment_receive_no ? `#${row.payment_receive_no}` : null,
width: 140,
className: 'payment_receive_no',
clickable: true,
},
{
id: 'deposit_account',
@@ -118,6 +122,7 @@ export function usePaymentReceivesColumns() {
accessor: 'deposit_account.name',
width: 140,
className: 'deposit_account_id',
clickable: true,
},
{
id: 'reference_no',
@@ -125,6 +130,7 @@ export function usePaymentReceivesColumns() {
accessor: 'reference_no',
width: 140,
className: 'reference_no',
clickable: true,
},
],
[],

View File

@@ -23,6 +23,7 @@ import ReceiptFormDialogs from './ReceiptFormDialogs';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { AppToaster } from 'components';
import { compose, orderingLinesIndexes, transactionNumber } from 'utils';
@@ -37,7 +38,9 @@ function ReceiptForm({
receiptNumberPrefix,
receiptAutoIncrement,
preferredDepositAccount,
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const history = useHistory();
@@ -59,7 +62,7 @@ function ReceiptForm({
const initialValues = useMemo(
() => ({
...(!isEmpty(receipt)
? { ...transformToEditForm(receipt), currency_code: baseCurrency }
? { ...transformToEditForm(receipt), currency_code: base_currency }
: {
...defaultReceipt,
...(receiptAutoIncrement && {
@@ -67,7 +70,7 @@ function ReceiptForm({
}),
deposit_account_id: parseInt(preferredDepositAccount),
entries: orderingLinesIndexes(defaultReceipt.entries),
currency_code: baseCurrency,
currency_code: base_currency,
}),
}),
[receipt, preferredDepositAccount, nextReceiptNumber, receiptAutoIncrement],
@@ -104,7 +107,7 @@ function ReceiptForm({
...omit(values, ['receipt_number_manually', 'receipt_number']),
...(values.receipt_number_manually && {
receipt_number: values.receipt_number,
currency_code: baseCurrency,
currency_code: base_currency,
}),
closed: submitPayload.status,
entries: entries.map((entry) => ({ ...omit(entry, ['total']) })),
@@ -178,11 +181,11 @@ function ReceiptForm({
export default compose(
withDashboardActions,
withSettings(({ receiptSettings, organizationSettings }) => ({
withSettings(({ receiptSettings }) => ({
receiptNextNumber: receiptSettings?.nextNumber,
receiptNumberPrefix: receiptSettings?.numberPrefix,
receiptAutoIncrement: receiptSettings?.autoIncrement,
preferredDepositAccount: receiptSettings?.preferredDepositAccount,
baseCurrency: organizationSettings?.baseCurrency,
})),
withCurrentOrganization(),
)(ReceiptForm);

View File

@@ -7,7 +7,7 @@ import { CLASSES } from 'common/classes';
import { PageFormBigNumber } from 'components';
import ReceiptFormHeaderFields from './ReceiptFormHeaderFields';
import withSettings from 'containers/Settings/withSettings';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { getEntriesTotal } from 'containers/Entries/utils';
import { compose } from 'redux';
@@ -18,8 +18,8 @@ import { compose } from 'redux';
function ReceiptFormHeader({
// #ownProps
onReceiptNumberChanged,
// #withSettings
baseCurrency,
// #withCurrentOrganization
organization: { base_currency },
}) {
const { values } = useFormikContext();
@@ -37,14 +37,10 @@ function ReceiptFormHeader({
<PageFormBigNumber
label={intl.get('due_amount')}
amount={totalDueAmount}
currencyCode={baseCurrency}
currencyCode={base_currency}
/>
</div>
);
}
export default compose(
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(ReceiptFormHeader);
export default compose(withCurrentOrganization())(ReceiptFormHeader);

View File

@@ -13,7 +13,6 @@ 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';
import { useReceiptsListContext } from './ReceiptsListProvider';
import { useReceiptsTableColumns, ActionsMenu } from './components';
@@ -28,9 +27,6 @@ function ReceiptsDataTable({
// #withReceipts
receiptTableState,
// #withSettings
baseCurrency,
// #withAlertsActions
openAlert,
@@ -99,6 +95,10 @@ function ReceiptsDataTable({
if (isEmptyStatus) {
return <ReceiptsEmptyStatus />;
}
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('receipt-detail-drawer', { receiptId: cell.row.original.id });
};
return (
<DashboardContentTable>
@@ -122,6 +122,7 @@ function ReceiptsDataTable({
TableLoadingRenderer={TableSkeletonRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader}
ContextMenu={ActionsMenu}
onCellClick={handleCellClick}
payload={{
onEdit: handleEditReceipt,
onDelete: handleDeleteReceipt,
@@ -129,7 +130,6 @@ function ReceiptsDataTable({
onDrawer: handleDrawerReceipt,
onViewDetails: handleViewDetailReceipt,
onPrint: handlePrintInvoice,
baseCurrency,
}}
/>
</DashboardContentTable>
@@ -144,7 +144,4 @@ export default compose(
withReceipts(({ receiptTableState }) => ({
receiptTableState,
})),
withSettings(({ organizationSettings }) => ({
baseCurrency: organizationSettings?.baseCurrency,
})),
)(ReceiptsDataTable);

View File

@@ -106,6 +106,7 @@ export function useReceiptsTableColumns() {
accessor: (r) => moment(r.receipt_date).format('YYYY MMM DD'),
width: 140,
className: 'receipt_date',
clickable: true,
},
{
id: 'customer',
@@ -113,6 +114,7 @@ export function useReceiptsTableColumns() {
accessor: 'customer.display_name',
width: 140,
className: 'customer_id',
clickable: true,
},
{
id: 'receipt_number',
@@ -120,6 +122,7 @@ export function useReceiptsTableColumns() {
accessor: 'receipt_number',
width: 140,
className: 'receipt_number',
clickable: true,
},
{
id: 'deposit_account',
@@ -127,6 +130,7 @@ export function useReceiptsTableColumns() {
accessor: 'deposit_account.name',
width: 140,
className: 'deposit_account',
clickable: true,
},
{
id: 'amount',
@@ -134,6 +138,7 @@ export function useReceiptsTableColumns() {
accessor: (r) => <Money amount={r.amount} currency={r.currency_code} />,
width: 140,
className: 'amount',
clickable: true,
},
{
id: 'status',
@@ -141,6 +146,7 @@ export function useReceiptsTableColumns() {
accessor: StatusAccessor,
width: 140,
className: 'status',
clickable: true,
},
{
id: 'reference_no',
@@ -148,6 +154,7 @@ export function useReceiptsTableColumns() {
accessor: 'reference_no',
width: 140,
className: 'reference_no',
clickable: true,
},
],
[],