diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js
new file mode 100644
index 000000000..948d082c0
--- /dev/null
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveActionsBar.js
@@ -0,0 +1,77 @@
+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 { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
+
+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 PaymentReceiveActionsBar({
+ // #withAlertsActions
+ openAlert,
+
+ // #withDrawerActions
+ closeDrawer,
+}) {
+ const history = useHistory();
+
+ const { paymentReceiveId } = usePaymentReceiveDetailContext();
+
+
+ // Handle edit payment receive.
+ const onEditPaymentReceive = () => {
+ return paymentReceiveId
+ ? (history.push(`/payment-receives/${paymentReceiveId}/edit`),
+ closeDrawer('payment-receive-detail-drawer'))
+ : null;
+ };
+
+ // Handle delete payment receive.
+ const onDeletePaymentReceive = () => {
+ return paymentReceiveId
+ ? (openAlert('payment-receive-delete', { paymentReceiveId }),
+ closeDrawer('payment-receive-detail-drawer'))
+ : null;
+ };
+
+ return (
+
+
+ }
+ text={}
+ onClick={safeCallback(onEditPaymentReceive)}
+ />
+
+ }
+ text={}
+ intent={Intent.DANGER}
+ onClick={safeCallback(onDeletePaymentReceive)}
+ />
+
+
+ );
+}
+
+export default compose(
+ withDialogActions,
+ withDrawerActions,
+ withAlertsActions,
+)(PaymentReceiveActionsBar);
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetail.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetail.js
index 091338a47..fbb50862a 100644
--- a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetail.js
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetail.js
@@ -1,6 +1,7 @@
import React from 'react';
import { Tabs, Tab } from '@blueprintjs/core';
import intl from 'react-intl-universal';
+import PaymentReceiveDetailTab from './PaymentReceiveDetailTab';
import JournalEntriesTable from '../../JournalEntriesTable/JournalEntriesTable';
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
@@ -14,7 +15,11 @@ export default function PaymentReceiveDetail() {
return (
-
+ }
+ />
+
+
+
Subtotal
+
{formatted_amount}
+
+
+
+
+ );
+}
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailHeader.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailHeader.js
new file mode 100644
index 000000000..610f1317c
--- /dev/null
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailHeader.js
@@ -0,0 +1,57 @@
+import React from 'react';
+import intl from 'react-intl-universal';
+import moment from 'moment';
+
+import { defaultTo } from 'lodash';
+
+import { Card, DetailsMenu, DetailItem } from 'components';
+
+import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
+
+/**
+ * Payment receive detail header.
+ */
+export default function PaymentReceiveDetailHeader() {
+ const {
+ paymentReceive: {
+ formatted_amount,
+ payment_receive_no,
+ customer,
+ deposit_account,
+ formatted_payment_date,
+ statement,
+ created_at,
+ },
+ } = usePaymentReceiveDetailContext();
+
+ return (
+
+
+
+ {formatted_amount}
+
+
+ {payment_receive_no}
+
+
+ {customer?.display_name}
+
+
+ {deposit_account?.name}
+
+
+ {formatted_payment_date}
+
+
+
+
+
+ {defaultTo(statement, '—')}
+
+
+ {moment(created_at).format('YYYY MMM DD')}
+
+
+
+ );
+}
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
index 73496f207..ecd24488d 100644
--- a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailProvider.js
@@ -1,7 +1,7 @@
import React from 'react';
import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components';
-import { useTransactionsByReference } from 'hooks/query';
+import { useTransactionsByReference, usePaymentReceive } from 'hooks/query';
const PaymentReceiveDetailContext = React.createContext();
@@ -9,6 +9,11 @@ const PaymentReceiveDetailContext = React.createContext();
* Payment receive detail provider.
*/
function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
+ const { data: paymentReceive, isFetching: isPaymentReceiveLoading } =
+ usePaymentReceive(paymentReceiveId, {
+ enabled: !!paymentReceiveId,
+ });
+
// Handle fetch transaction by reference.
const {
data: { transactions },
@@ -22,10 +27,10 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
);
//provider.
- const provider = { transactions };
+ const provider = { transactions, paymentReceive, paymentReceiveId };
return (
-
+
+
+
+
+ );
+}
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailTable.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailTable.js
new file mode 100644
index 000000000..93cf142de
--- /dev/null
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/PaymentReceiveDetailTable.js
@@ -0,0 +1,18 @@
+import React from 'react';
+import { usePaymentReceiveEntriesColumns } from './utils';
+import { DataTable, Card } from 'components';
+
+import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
+
+export default function PaymentReceiveDetailTable() {
+ const columns = usePaymentReceiveEntriesColumns();
+ const {
+ paymentReceive: { entries },
+ } = usePaymentReceiveDetailContext();
+
+ return (
+
+
+
+ );
+}
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/index.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/index.js
index 526064ebd..8bb926f75 100644
--- a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/index.js
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/index.js
@@ -18,7 +18,15 @@ function PaymentReceiveDetailDrawer({
payload: { paymentReceiveId },
}) {
return (
-
+
diff --git a/client/src/containers/Drawers/PaymentReceiveDetailDrawer/utils.js b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/utils.js
new file mode 100644
index 000000000..364b7b4da
--- /dev/null
+++ b/client/src/containers/Drawers/PaymentReceiveDetailDrawer/utils.js
@@ -0,0 +1,35 @@
+import React from 'react';
+import intl from 'react-intl-universal';
+import moment from 'moment';
+
+export const usePaymentReceiveEntriesColumns = () =>
+ React.useMemo(() => [
+ {
+ Header: intl.get('date'),
+ accessor: (row) => moment(row.payment_date).format('YYYY MMM DD'),
+ width: 100,
+ disableSortBy: true,
+ },
+ {
+ Header: intl.get('invoice_no'),
+ accessor: 'invoice.invoice_no',
+ width: 150,
+ disableSortBy: true,
+ },
+ {
+ Header: intl.get('invoice_amount'),
+ accessor: 'invoice.balance',
+ },
+ {
+ Header: intl.get('amount_due'),
+ accessor: 'invoice.amount_due',
+ width: 100,
+ disableSortBy: true,
+ },
+ {
+ Header: intl.get('payment_amount'),
+ accessor: 'invoice.payment_amount',
+ width: 100,
+ disableSortBy: true,
+ },
+ ]);