mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
BIG-232 customer and vendor drawer link.
This commit is contained in:
25
src/components/Customers/CustomerDrawerLink.js
Normal file
25
src/components/Customers/CustomerDrawerLink.js
Normal file
@@ -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 <ButtonLink onClick={handleCustomerDrawer}>{children}</ButtonLink>;
|
||||
}
|
||||
|
||||
export const CustomerDrawerLink = R.compose(withDrawerActions)(
|
||||
CustomerDrawerLinkComponent,
|
||||
);
|
||||
1
src/components/Customers/index.js
Normal file
1
src/components/Customers/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export * from './CustomerDrawerLink';
|
||||
23
src/components/Vendors/VendorDrawerLink.js
Normal file
23
src/components/Vendors/VendorDrawerLink.js
Normal file
@@ -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 <ButtonLink onClick={handleVendorDrawer}>{children}</ButtonLink>;
|
||||
}
|
||||
|
||||
export const VendorDrawerLink = R.compose(withDrawerActions)(VendorDrawerLinkComponent);
|
||||
1
src/components/Vendors/index.js
Normal file
1
src/components/Vendors/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export * from './VendorDrawerLink'
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
Col,
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
VendorDrawerLink,
|
||||
} from 'components';
|
||||
|
||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||
@@ -45,7 +46,9 @@ export default function BillDetailHeader() {
|
||||
<FormatDate value={bill.due_date} />
|
||||
</DetailItem>
|
||||
<DetailItem label={intl.get('vendor_name')}>
|
||||
<ButtonLink>{bill.vendor?.display_name}</ButtonLink>
|
||||
<VendorDrawerLink vendorId={bill.vendor_id}>
|
||||
{bill.vendor?.display_name}
|
||||
</VendorDrawerLink>
|
||||
</DetailItem>
|
||||
<DetailItem label={intl.get('bill.details.bill_number')}>
|
||||
{defaultTo(bill.bill_number, '-')}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ButtonLink,
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
CustomerDrawerLink,
|
||||
} from 'components';
|
||||
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
|
||||
|
||||
@@ -48,7 +49,9 @@ export default function CreditNoteDetailHeader() {
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('customer_name')}>
|
||||
<ButtonLink>{creditNote.customer?.display_name}</ButtonLink>
|
||||
<CustomerDrawerLink customerId={creditNote.customer_id}>
|
||||
{creditNote.customer?.display_name}
|
||||
</CustomerDrawerLink>
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
Row,
|
||||
Col,
|
||||
ButtonLink,
|
||||
CustomerDrawerLink,
|
||||
} from 'components';
|
||||
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
||||
import { EstimateDetailsStatus } from './components';
|
||||
@@ -46,7 +47,9 @@ export default function EstimateDetailHeader() {
|
||||
/>
|
||||
|
||||
<DetailItem label={intl.get('customer_name')}>
|
||||
<ButtonLink>{estimate.customer?.display_name}</ButtonLink>
|
||||
<CustomerDrawerLink customerId={estimate.customer_id}>
|
||||
{estimate.customer?.display_name}
|
||||
</CustomerDrawerLink>
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
FormatDate,
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
CustomerDrawerLink,
|
||||
} from 'components';
|
||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||
import { InvoiceDetailsStatus } from './utils';
|
||||
@@ -50,9 +51,9 @@ export default function InvoiceDetailHeader() {
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('customer_name')}>
|
||||
<ButtonLink onClick={handleCustomerLinkClick}>
|
||||
<CustomerDrawerLink customerId={invoice.customer_id}>
|
||||
{invoice.customer?.display_name}
|
||||
</ButtonLink>
|
||||
</CustomerDrawerLink>
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('invoice.details.invoice_no')}>
|
||||
|
||||
@@ -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, '-')}
|
||||
/>
|
||||
<DetailItem label={intl.get('vendor_name')}>
|
||||
<ButtonLink>{paymentMade.vendor?.display_name}</ButtonLink>
|
||||
<VendorDrawerLink vendorId={paymentMade.vendor_id}>
|
||||
{paymentMade.vendor?.display_name}
|
||||
</VendorDrawerLink>
|
||||
</DetailItem>
|
||||
<DetailItem
|
||||
label={intl.get('payment_account')}
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
ButtonLink,
|
||||
CustomerDrawerLink,
|
||||
} from 'components';
|
||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||
|
||||
@@ -38,7 +39,9 @@ export default function PaymentReceiveDetailHeader() {
|
||||
children={defaultTo(paymentReceive.payment_receive_no, '-')}
|
||||
/>
|
||||
<DetailItem label={intl.get('customer_name')}>
|
||||
<ButtonLink>{paymentReceive.customer?.display_name}</ButtonLink>
|
||||
<CustomerDrawerLink customerId={paymentReceive.customer_id}>
|
||||
{paymentReceive.customer?.display_name}
|
||||
</CustomerDrawerLink>
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem
|
||||
|
||||
@@ -5,6 +5,7 @@ import styled from 'styled-components';
|
||||
|
||||
import {
|
||||
ButtonLink,
|
||||
CustomerDrawerLink,
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
} from 'components';
|
||||
@@ -41,7 +42,9 @@ export default function ReceiptDetailHeader() {
|
||||
children={defaultTo(receipt.receipt_number, '-')}
|
||||
/>
|
||||
<DetailItem label={intl.get('customer_name')}>
|
||||
<ButtonLink>{receipt.customer?.display_name} </ButtonLink>
|
||||
<CustomerDrawerLink customerId={receipt.customer_id}>
|
||||
{receipt.customer?.display_name}
|
||||
</CustomerDrawerLink>
|
||||
</DetailItem>
|
||||
<DetailItem
|
||||
label={intl.get('receipt_date')}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
ButtonLink,
|
||||
CommercialDocHeader,
|
||||
CommercialDocTopHeader,
|
||||
VendorDrawerLink,
|
||||
} from 'components';
|
||||
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
||||
import { VendorCreditDetailsStatus } from './utils';
|
||||
@@ -44,7 +45,9 @@ export default function VendorCreditDetailHeader() {
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem label={intl.get('vendor_name')}>
|
||||
<ButtonLink>{vendorCredit.vendor?.display_name}</ButtonLink>
|
||||
<VendorDrawerLink vendorId={vendorCredit.vendor_id}>
|
||||
{vendorCredit.vendor?.display_name}
|
||||
</VendorDrawerLink>
|
||||
</DetailItem>
|
||||
|
||||
<DetailItem
|
||||
|
||||
Reference in New Issue
Block a user