mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
BIG-344: add branch to manual journal & expense.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
import { useExpense } from 'hooks/query';
|
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();
|
const ExpenseDrawerDrawerContext = React.createContext();
|
||||||
|
|
||||||
@@ -8,6 +11,9 @@ const ExpenseDrawerDrawerContext = React.createContext();
|
|||||||
* Expense drawer provider.
|
* Expense drawer provider.
|
||||||
*/
|
*/
|
||||||
function ExpenseDrawerProvider({ expenseId, ...props }) {
|
function ExpenseDrawerProvider({ expenseId, ...props }) {
|
||||||
|
// Features guard.
|
||||||
|
const { featureCan } = useFeatureCan();
|
||||||
|
|
||||||
// Fetch the expense details.
|
// Fetch the expense details.
|
||||||
const {
|
const {
|
||||||
data: expense,
|
data: expense,
|
||||||
@@ -28,6 +34,17 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DrawerLoading loading={isExpenseLoading}>
|
<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} />
|
<ExpenseDrawerDrawerContext.Provider value={provider} {...props} />
|
||||||
</DrawerLoading>
|
</DrawerLoading>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import React, { lazy } from 'react';
|
import React, { lazy } from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
|
|
||||||
import { Drawer, DrawerSuspense } from 'components';
|
import { Drawer, DrawerSuspense } from 'components';
|
||||||
import withDrawers from 'containers/Drawer/withDrawers';
|
import withDrawers from 'containers/Drawer/withDrawers';
|
||||||
|
|
||||||
@@ -22,7 +20,6 @@ function ExpenseDrawer({
|
|||||||
<Drawer
|
<Drawer
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
name={name}
|
name={name}
|
||||||
title={intl.get('expense.drawer.title')}
|
|
||||||
size={'65%'}
|
size={'65%'}
|
||||||
style={{ minWidth: '700px', maxWidth: '900px' }}
|
style={{ minWidth: '700px', maxWidth: '900px' }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import React from 'react';
|
|||||||
import { Tag, Intent, Classes, Tooltip, Position } from '@blueprintjs/core';
|
import { Tag, Intent, Classes, Tooltip, Position } from '@blueprintjs/core';
|
||||||
|
|
||||||
import { T, Choose, FormatNumberCell, If, Icon } from '../../../components';
|
import { T, Choose, FormatNumberCell, If, Icon } from '../../../components';
|
||||||
|
import { Features } from 'common';
|
||||||
|
import { useFeatureCan } from 'hooks/state';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note column accessor.
|
* Note column accessor.
|
||||||
@@ -46,8 +48,9 @@ export function ManualJournalDetailsStatus({ manualJournal }) {
|
|||||||
/**
|
/**
|
||||||
* Retrieve read-only manual journal entries columns.
|
* Retrieve read-only manual journal entries columns.
|
||||||
*/
|
*/
|
||||||
export const useManualJournalEntriesColumns = () =>
|
export const useManualJournalEntriesColumns = () => {
|
||||||
React.useMemo(
|
const { featureCan } = useFeatureCan();
|
||||||
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: intl.get('account_name'),
|
Header: intl.get('account_name'),
|
||||||
@@ -70,6 +73,17 @@ export const useManualJournalEntriesColumns = () =>
|
|||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
className: 'note',
|
className: 'note',
|
||||||
},
|
},
|
||||||
|
...(featureCan(Features.Branches)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
Header: intl.get('branch'),
|
||||||
|
width: 130,
|
||||||
|
accessor: 'branch.name',
|
||||||
|
disableSortBy: true,
|
||||||
|
className: 'branch',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
Header: intl.get('credit'),
|
Header: intl.get('credit'),
|
||||||
accessor: 'credit',
|
accessor: 'credit',
|
||||||
@@ -93,5 +107,6 @@ export const useManualJournalEntriesColumns = () =>
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[featureCan],
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -2005,8 +2005,10 @@
|
|||||||
"estimate.warehouse_button.label": "المخزن: {label}",
|
"estimate.warehouse_button.label": "المخزن: {label}",
|
||||||
"receipt.branch_button.label": "الفرع: {label}",
|
"receipt.branch_button.label": "الفرع: {label}",
|
||||||
"receipt.warehouse_button.label": "المخزن: {label}",
|
"receipt.warehouse_button.label": "المخزن: {label}",
|
||||||
"warehouse_transfer.empty_status.title": "إدارة عمليات النقل بين المستودعات",
|
"warehouse_transfer.empty_status.title": "إدارة عمليات النقل بين المخازن",
|
||||||
"warehouse_transfer.empty_status.description": "غالبًا ماتحتاج الاعمال ذات مستودعات متعددة لطلبات نقل البضائع من مستودع إلى آخر عندما تكون في حاجة ماسة إلى البائعين.",
|
"warehouse_transfer.empty_status.description": "غالبًا ماتحتاج الاعمال ذات مخازن متعددة لطلبات نقل البضائع من مخزن إلى آخر عندما تكون في حاجة ماسة إلى البائعين.",
|
||||||
|
"warehouse_transfer.form.reason.label": "أسباب النقل",
|
||||||
|
"warehouse_transfer.form.reason.placeholder": "Enter the reason behind the transfer order.",
|
||||||
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به ",
|
"item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به ",
|
||||||
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "لا يمكن أن تكون الكمية صفراً أو فارغة.",
|
"warehouse_transfer.quantity_cannot_be_zero_or_empty": "لا يمكن أن تكون الكمية صفراً أو فارغة.",
|
||||||
"invoice.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
|
"invoice.validation.due_date": "يجب أن يكون حقل {path} في وقت لاحق من {min}",
|
||||||
|
|||||||
@@ -1756,6 +1756,7 @@
|
|||||||
"payment_made.drawer.subtitle": "Branch: {value}",
|
"payment_made.drawer.subtitle": "Branch: {value}",
|
||||||
"manual_journal.drawer.title": "Manual journal details ({number})",
|
"manual_journal.drawer.title": "Manual journal details ({number})",
|
||||||
"expense.drawer.title": "Expense details",
|
"expense.drawer.title": "Expense details",
|
||||||
|
"expense.drawer.subtitle": "Branch: {value}",
|
||||||
"global_error.you_dont_have_permissions": "You do not have permissions to access this page.",
|
"global_error.you_dont_have_permissions": "You do not have permissions to access this page.",
|
||||||
"global_error.transactions_locked": "Transactions before {lockedToDate} has been locked. Hence action cannot be performed.",
|
"global_error.transactions_locked": "Transactions before {lockedToDate} has been locked. Hence action cannot be performed.",
|
||||||
"global_error.authorized_user_inactive": "The authorized user is inactive.",
|
"global_error.authorized_user_inactive": "The authorized user is inactive.",
|
||||||
|
|||||||
Reference in New Issue
Block a user