diff --git a/src/components/Customers/CustomerDrawerLink.js b/src/components/Customers/CustomerDrawerLink.js new file mode 100644 index 000000000..e99c20244 --- /dev/null +++ b/src/components/Customers/CustomerDrawerLink.js @@ -0,0 +1,25 @@ +import React from 'react'; +import * as R from 'ramda'; + +import { ButtonLink } from 'components'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; + +function CustomerDrawerLinkComponent({ + // #ownProps + children, + customerId, + + // #withDrawerActions + openDrawer, +}) { + // Handle view customer drawer. + const handleCustomerDrawer = () => { + openDrawer('customer-details-drawer', { customerId }); + }; + + return {children}; +} + +export const CustomerDrawerLink = R.compose(withDrawerActions)( + CustomerDrawerLinkComponent, +); diff --git a/src/components/Customers/index.js b/src/components/Customers/index.js new file mode 100644 index 000000000..124141b39 --- /dev/null +++ b/src/components/Customers/index.js @@ -0,0 +1 @@ +export * from './CustomerDrawerLink'; diff --git a/src/components/Vendors/VendorDrawerLink.js b/src/components/Vendors/VendorDrawerLink.js new file mode 100644 index 000000000..91b528e6f --- /dev/null +++ b/src/components/Vendors/VendorDrawerLink.js @@ -0,0 +1,23 @@ +import React from 'react'; +import * as R from 'ramda'; + +import { ButtonLink } from 'components'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; + +function VendorDrawerLinkComponent({ + // #ownProps + children, + vendorId, + + // #withDrawerActions + openDrawer, +}) { + // Handle view customer drawer. + const handleVendorDrawer = () => { + openDrawer('vendor-details-drawer', { vendorId }); + }; + + return {children}; +} + +export const VendorDrawerLink = R.compose(withDrawerActions)(VendorDrawerLinkComponent); diff --git a/src/components/Vendors/index.js b/src/components/Vendors/index.js new file mode 100644 index 000000000..8f9cc7544 --- /dev/null +++ b/src/components/Vendors/index.js @@ -0,0 +1 @@ +export * from './VendorDrawerLink' \ No newline at end of file diff --git a/src/components/index.js b/src/components/index.js index feb3f934c..04a2b4138 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -92,6 +92,8 @@ export * from './TextStatus'; export * from './Tags'; export * from './CommercialDoc'; export * from './Card'; +export * from './Customers' +export * from './Vendors' const Hint = FieldHint; diff --git a/src/containers/Drawers/BillDrawer/BillDetailHeader.js b/src/containers/Drawers/BillDrawer/BillDetailHeader.js index f002ac457..0ce3dc3b0 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailHeader.js +++ b/src/containers/Drawers/BillDrawer/BillDetailHeader.js @@ -12,6 +12,7 @@ import { Col, CommercialDocHeader, CommercialDocTopHeader, + VendorDrawerLink, } from 'components'; import { useBillDrawerContext } from './BillDrawerProvider'; @@ -45,7 +46,9 @@ export default function BillDetailHeader() { - {bill.vendor?.display_name} + + {bill.vendor?.display_name} + {defaultTo(bill.bill_number, '-')} diff --git a/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailHeader.js b/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailHeader.js index 1b630d40b..ead8b8243 100644 --- a/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailHeader.js +++ b/src/containers/Drawers/CreditNoteDetailDrawer/CreditNoteDetailHeader.js @@ -13,6 +13,7 @@ import { ButtonLink, CommercialDocHeader, CommercialDocTopHeader, + CustomerDrawerLink, } from 'components'; import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider'; @@ -48,7 +49,9 @@ export default function CreditNoteDetailHeader() { - {creditNote.customer?.display_name} + + {creditNote.customer?.display_name} + - {estimate.customer?.display_name} + + {estimate.customer?.display_name} + - + {invoice.customer?.display_name} - + diff --git a/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailHeader.js b/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailHeader.js index 20af0d818..6e36411f5 100644 --- a/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailHeader.js +++ b/src/containers/Drawers/PaymentMadeDetailDrawer/PaymentMadeDetailHeader.js @@ -11,6 +11,7 @@ import { CommercialDocHeader, CommercialDocTopHeader, ButtonLink, + VendorDrawerLink, } from 'components'; import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider'; @@ -38,7 +39,9 @@ export default function PaymentMadeDetailHeader() { children={defaultTo(paymentMade.payment_number, '-')} /> - {paymentMade.vendor?.display_name} + + {paymentMade.vendor?.display_name} + - {paymentReceive.customer?.display_name} + + {paymentReceive.customer?.display_name} + - {receipt.customer?.display_name} + + {receipt.customer?.display_name} + - {vendorCredit.vendor?.display_name} + + {vendorCredit.vendor?.display_name} +