mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
fix(invoice details): add branch name.
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FeatureCan, FormattedMessage as T } from 'components';
|
import { FormattedMessage as T } from 'components';
|
||||||
import { Classes, Icon, H4, Button } from '@blueprintjs/core';
|
import { Classes, Icon, H4, Button } from '@blueprintjs/core';
|
||||||
|
|
||||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Features } from 'common';
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,9 +34,7 @@ function DrawerHeaderContent(props) {
|
|||||||
<Icon icon={icon} iconSize={Icon.SIZE_LARGE} />
|
<Icon icon={icon} iconSize={Icon.SIZE_LARGE} />
|
||||||
<H4>
|
<H4>
|
||||||
{title}
|
{title}
|
||||||
<FeatureCan feature={Features.Branches}>
|
|
||||||
<Subtitle>{subTitle}</Subtitle>
|
<Subtitle>{subTitle}</Subtitle>
|
||||||
</FeatureCan>
|
|
||||||
</H4>
|
</H4>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,23 +1,31 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||||
|
import { Features } from 'common';
|
||||||
import { useInvoice } from 'hooks/query';
|
import { useInvoice } from 'hooks/query';
|
||||||
|
import { useFeatureCan } from 'hooks/state';
|
||||||
|
|
||||||
const InvoiceDetailDrawerContext = React.createContext();
|
const InvoiceDetailDrawerContext = React.createContext();
|
||||||
/**
|
/**
|
||||||
* Invoice detail provider.
|
* Invoice detail provider.
|
||||||
*/
|
*/
|
||||||
function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
|
function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
|
||||||
|
// Features guard.
|
||||||
|
const { featureCan } = useFeatureCan();
|
||||||
|
|
||||||
// Fetch sale invoice details.
|
// Fetch sale invoice details.
|
||||||
const { data: invoice, isLoading: isInvoiceLoading } = useInvoice(invoiceId, {
|
const { data: invoice, isLoading: isInvoiceLoading } = useInvoice(invoiceId, {
|
||||||
enabled: !!invoiceId,
|
enabled: !!invoiceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// const isFeatureCan = featureCan(Features.Branches);
|
||||||
|
|
||||||
// Provider.
|
// Provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
invoiceId,
|
invoiceId,
|
||||||
invoice,
|
invoice,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerLoading loading={isInvoiceLoading}>
|
<DrawerLoading loading={isInvoiceLoading}>
|
||||||
<DrawerHeaderContent
|
<DrawerHeaderContent
|
||||||
@@ -25,7 +33,13 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
|
|||||||
title={intl.get('invoice_details.drawer.title', {
|
title={intl.get('invoice_details.drawer.title', {
|
||||||
invoiceNumber: invoice.invoice_no,
|
invoiceNumber: invoice.invoice_no,
|
||||||
})}
|
})}
|
||||||
subTitle={`Branch: ${invoice.branch?.name}`}
|
subTitle={
|
||||||
|
featureCan(Features.Branches)
|
||||||
|
? intl.get('invoice_details.drawer.subtitle', {
|
||||||
|
value: invoice.branch?.name,
|
||||||
|
})
|
||||||
|
: null
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<InvoiceDetailDrawerContext.Provider value={provider} {...props} />
|
<InvoiceDetailDrawerContext.Provider value={provider} {...props} />
|
||||||
</DrawerLoading>
|
</DrawerLoading>
|
||||||
|
|||||||
@@ -914,6 +914,8 @@
|
|||||||
"enter_an_item": "Enter an item...",
|
"enter_an_item": "Enter an item...",
|
||||||
"due_amount": "Due Amount",
|
"due_amount": "Due Amount",
|
||||||
"invoice_details.drawer.title": "Invoice details ({invoiceNumber})",
|
"invoice_details.drawer.title": "Invoice details ({invoiceNumber})",
|
||||||
|
"invoice_details.drawer.subtitle": "Branch: {value}",
|
||||||
|
|
||||||
"setting_your_auto_generated_estimate_number": "Setting your auto-generated estimate number",
|
"setting_your_auto_generated_estimate_number": "Setting your auto-generated estimate number",
|
||||||
"setting_your_auto_generated_journal_number": "Setting your auto-generated journal number",
|
"setting_your_auto_generated_journal_number": "Setting your auto-generated journal number",
|
||||||
"setting_your_auto_generated_invoice_number": "Setting your auto-generated invoice number",
|
"setting_your_auto_generated_invoice_number": "Setting your auto-generated invoice number",
|
||||||
|
|||||||
Reference in New Issue
Block a user