mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
BIG-344: add branch to manual journal & expense.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { useExpense } from 'hooks/query';
|
||||
import { DrawerLoading } from 'components';
|
||||
import { DrawerHeaderContent, DrawerLoading } from 'components';
|
||||
import { Features } from 'common';
|
||||
import { useFeatureCan } from 'hooks/state';
|
||||
|
||||
const ExpenseDrawerDrawerContext = React.createContext();
|
||||
|
||||
@@ -8,6 +11,9 @@ const ExpenseDrawerDrawerContext = React.createContext();
|
||||
* Expense drawer provider.
|
||||
*/
|
||||
function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||
// Features guard.
|
||||
const { featureCan } = useFeatureCan();
|
||||
|
||||
// Fetch the expense details.
|
||||
const {
|
||||
data: expense,
|
||||
@@ -28,6 +34,17 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||
|
||||
return (
|
||||
<DrawerLoading loading={isExpenseLoading}>
|
||||
<DrawerHeaderContent
|
||||
name="expense-drawer"
|
||||
title={intl.get('expense.drawer.title')}
|
||||
subTitle={
|
||||
featureCan(Features.Branches)
|
||||
? intl.get('expense.drawer.subtitle', {
|
||||
value: expense.branch?.name,
|
||||
})
|
||||
: null
|
||||
}
|
||||
/>
|
||||
<ExpenseDrawerDrawerContext.Provider value={provider} {...props} />
|
||||
</DrawerLoading>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user