mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +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 './Tags';
|
||||||
export * from './CommercialDoc';
|
export * from './CommercialDoc';
|
||||||
export * from './Card';
|
export * from './Card';
|
||||||
|
export * from './Customers'
|
||||||
|
export * from './Vendors'
|
||||||
|
|
||||||
const Hint = FieldHint;
|
const Hint = FieldHint;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
Col,
|
Col,
|
||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
|
VendorDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
|
|
||||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||||
@@ -45,7 +46,9 @@ export default function BillDetailHeader() {
|
|||||||
<FormatDate value={bill.due_date} />
|
<FormatDate value={bill.due_date} />
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
<DetailItem label={intl.get('vendor_name')}>
|
<DetailItem label={intl.get('vendor_name')}>
|
||||||
<ButtonLink>{bill.vendor?.display_name}</ButtonLink>
|
<VendorDrawerLink vendorId={bill.vendor_id}>
|
||||||
|
{bill.vendor?.display_name}
|
||||||
|
</VendorDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
<DetailItem label={intl.get('bill.details.bill_number')}>
|
<DetailItem label={intl.get('bill.details.bill_number')}>
|
||||||
{defaultTo(bill.bill_number, '-')}
|
{defaultTo(bill.bill_number, '-')}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
ButtonLink,
|
ButtonLink,
|
||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
|
CustomerDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
|
import { useCreditNoteDetailDrawerContext } from './CreditNoteDetailDrawerProvider';
|
||||||
|
|
||||||
@@ -48,7 +49,9 @@ export default function CreditNoteDetailHeader() {
|
|||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('customer_name')}>
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
<ButtonLink>{creditNote.customer?.display_name}</ButtonLink>
|
<CustomerDrawerLink customerId={creditNote.customer_id}>
|
||||||
|
{creditNote.customer?.display_name}
|
||||||
|
</CustomerDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem
|
<DetailItem
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
Col,
|
Col,
|
||||||
ButtonLink,
|
ButtonLink,
|
||||||
|
CustomerDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
||||||
import { EstimateDetailsStatus } from './components';
|
import { EstimateDetailsStatus } from './components';
|
||||||
@@ -46,7 +47,9 @@ export default function EstimateDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<DetailItem label={intl.get('customer_name')}>
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
<ButtonLink>{estimate.customer?.display_name}</ButtonLink>
|
<CustomerDrawerLink customerId={estimate.customer_id}>
|
||||||
|
{estimate.customer?.display_name}
|
||||||
|
</CustomerDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem
|
<DetailItem
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
FormatDate,
|
FormatDate,
|
||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
|
CustomerDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
import { InvoiceDetailsStatus } from './utils';
|
import { InvoiceDetailsStatus } from './utils';
|
||||||
@@ -50,9 +51,9 @@ export default function InvoiceDetailHeader() {
|
|||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('customer_name')}>
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
<ButtonLink onClick={handleCustomerLinkClick}>
|
<CustomerDrawerLink customerId={invoice.customer_id}>
|
||||||
{invoice.customer?.display_name}
|
{invoice.customer?.display_name}
|
||||||
</ButtonLink>
|
</CustomerDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('invoice.details.invoice_no')}>
|
<DetailItem label={intl.get('invoice.details.invoice_no')}>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
ButtonLink,
|
ButtonLink,
|
||||||
|
VendorDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
|
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
|
||||||
|
|
||||||
@@ -38,7 +39,9 @@ export default function PaymentMadeDetailHeader() {
|
|||||||
children={defaultTo(paymentMade.payment_number, '-')}
|
children={defaultTo(paymentMade.payment_number, '-')}
|
||||||
/>
|
/>
|
||||||
<DetailItem label={intl.get('vendor_name')}>
|
<DetailItem label={intl.get('vendor_name')}>
|
||||||
<ButtonLink>{paymentMade.vendor?.display_name}</ButtonLink>
|
<VendorDrawerLink vendorId={paymentMade.vendor_id}>
|
||||||
|
{paymentMade.vendor?.display_name}
|
||||||
|
</VendorDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('payment_account')}
|
label={intl.get('payment_account')}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
ButtonLink,
|
ButtonLink,
|
||||||
|
CustomerDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
@@ -38,7 +39,9 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
children={defaultTo(paymentReceive.payment_receive_no, '-')}
|
children={defaultTo(paymentReceive.payment_receive_no, '-')}
|
||||||
/>
|
/>
|
||||||
<DetailItem label={intl.get('customer_name')}>
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
<ButtonLink>{paymentReceive.customer?.display_name}</ButtonLink>
|
<CustomerDrawerLink customerId={paymentReceive.customer_id}>
|
||||||
|
{paymentReceive.customer?.display_name}
|
||||||
|
</CustomerDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem
|
<DetailItem
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import styled from 'styled-components';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
ButtonLink,
|
ButtonLink,
|
||||||
|
CustomerDrawerLink,
|
||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
@@ -41,7 +42,9 @@ export default function ReceiptDetailHeader() {
|
|||||||
children={defaultTo(receipt.receipt_number, '-')}
|
children={defaultTo(receipt.receipt_number, '-')}
|
||||||
/>
|
/>
|
||||||
<DetailItem label={intl.get('customer_name')}>
|
<DetailItem label={intl.get('customer_name')}>
|
||||||
<ButtonLink>{receipt.customer?.display_name} </ButtonLink>
|
<CustomerDrawerLink customerId={receipt.customer_id}>
|
||||||
|
{receipt.customer?.display_name}
|
||||||
|
</CustomerDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('receipt_date')}
|
label={intl.get('receipt_date')}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
ButtonLink,
|
ButtonLink,
|
||||||
CommercialDocHeader,
|
CommercialDocHeader,
|
||||||
CommercialDocTopHeader,
|
CommercialDocTopHeader,
|
||||||
|
VendorDrawerLink,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
import { useVendorCreditDetailDrawerContext } from './VendorCreditDetailDrawerProvider';
|
||||||
import { VendorCreditDetailsStatus } from './utils';
|
import { VendorCreditDetailsStatus } from './utils';
|
||||||
@@ -44,7 +45,9 @@ export default function VendorCreditDetailHeader() {
|
|||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem label={intl.get('vendor_name')}>
|
<DetailItem label={intl.get('vendor_name')}>
|
||||||
<ButtonLink>{vendorCredit.vendor?.display_name}</ButtonLink>
|
<VendorDrawerLink vendorId={vendorCredit.vendor_id}>
|
||||||
|
{vendorCredit.vendor?.display_name}
|
||||||
|
</VendorDrawerLink>
|
||||||
</DetailItem>
|
</DetailItem>
|
||||||
|
|
||||||
<DetailItem
|
<DetailItem
|
||||||
|
|||||||
Reference in New Issue
Block a user