mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
Fix: expenses.
This commit is contained in:
@@ -15,14 +15,13 @@ export function ExpenseFormFooterRight() {
|
|||||||
return (
|
return (
|
||||||
<ExpensesTotalLines>
|
<ExpensesTotalLines>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'manual_journal.details.subtotal'} />}
|
title={<T id={'expense.label.subtotal'} />}
|
||||||
value={formattedSubtotal}
|
value={formattedSubtotal}
|
||||||
borderStyle={TotalLineBorderStyle.None}
|
borderStyle={TotalLineBorderStyle.None}
|
||||||
/>
|
/>
|
||||||
<TotalLine
|
<TotalLine
|
||||||
title={<T id={'manual_journal.details.total'} />}
|
title={<T id={'expense.label.total'} />}
|
||||||
value={formattedTotal}
|
value={formattedTotal}
|
||||||
// borderStyle={TotalLineBorderStyle.SingleDark}
|
|
||||||
textStyle={TotalLineTextStyle.Bold}
|
textStyle={TotalLineTextStyle.Bold}
|
||||||
/>
|
/>
|
||||||
</ExpensesTotalLines>
|
</ExpensesTotalLines>
|
||||||
|
|||||||
@@ -5,22 +5,17 @@ import 'style/pages/Expense/PageForm.scss';
|
|||||||
|
|
||||||
import ExpenseForm from './ExpenseForm';
|
import ExpenseForm from './ExpenseForm';
|
||||||
import { ExpenseFormPageProvider } from './ExpenseFormPageProvider';
|
import { ExpenseFormPageProvider } from './ExpenseFormPageProvider';
|
||||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
|
||||||
import { compose } from 'utils';
|
|
||||||
/**
|
/**
|
||||||
* Expense page form.
|
* Expense page form.
|
||||||
*/
|
*/
|
||||||
function ExpenseFormPage({
|
export default function ExpenseFormPage() {
|
||||||
// #withCurrentOrganization
|
|
||||||
organization: { base_currency },
|
|
||||||
}) {
|
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const expenseId = parseInt(id, 10);
|
const expenseId = parseInt(id, 10);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ExpenseFormPageProvider expenseId={expenseId} baseCurrency={base_currency}>
|
<ExpenseFormPageProvider expenseId={expenseId}>
|
||||||
<ExpenseForm />
|
<ExpenseForm />
|
||||||
</ExpenseFormPageProvider>
|
</ExpenseFormPageProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default compose(withCurrentOrganization())(ExpenseFormPage);
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { createContext } from 'react';
|
import React, { createContext } from 'react';
|
||||||
import { isEqual, isUndefined } from 'lodash';
|
|
||||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||||
import { Features } from 'common';
|
import { Features } from 'common';
|
||||||
import { useFeatureCan } from 'hooks/state';
|
import { useFeatureCan } from 'hooks/state';
|
||||||
@@ -18,7 +17,7 @@ const ExpenseFormPageContext = createContext();
|
|||||||
/**
|
/**
|
||||||
* Accounts chart data provider.
|
* Accounts chart data provider.
|
||||||
*/
|
*/
|
||||||
function ExpenseFormPageProvider({ query, expenseId, baseCurrency, ...props }) {
|
function ExpenseFormPageProvider({ query, expenseId, ...props }) {
|
||||||
// Features guard.
|
// Features guard.
|
||||||
const { featureCan } = useFeatureCan();
|
const { featureCan } = useFeatureCan();
|
||||||
const isBranchFeatureCan = featureCan(Features.Branches);
|
const isBranchFeatureCan = featureCan(Features.Branches);
|
||||||
@@ -52,23 +51,15 @@ function ExpenseFormPageProvider({ query, expenseId, baseCurrency, ...props }) {
|
|||||||
|
|
||||||
// Submit form payload.
|
// Submit form payload.
|
||||||
const [submitPayload, setSubmitPayload] = React.useState({});
|
const [submitPayload, setSubmitPayload] = React.useState({});
|
||||||
const [selectCustomer, setSelectCustomer] = React.useState(null);
|
|
||||||
|
|
||||||
// Detarmines whether the form in new mode.
|
// Detarmines whether the form in new mode.
|
||||||
const isNewMode = !expenseId;
|
const isNewMode = !expenseId;
|
||||||
|
|
||||||
// Determines whether the foreign customer.
|
|
||||||
const isForeignCustomer =
|
|
||||||
!isEqual(selectCustomer?.currency_code, baseCurrency) &&
|
|
||||||
!isUndefined(selectCustomer?.currency_code);
|
|
||||||
|
|
||||||
// Provider payload.
|
// Provider payload.
|
||||||
const provider = {
|
const provider = {
|
||||||
isNewMode,
|
isNewMode,
|
||||||
isForeignCustomer,
|
|
||||||
expenseId,
|
expenseId,
|
||||||
submitPayload,
|
submitPayload,
|
||||||
selectCustomer,
|
|
||||||
|
|
||||||
currencies,
|
currencies,
|
||||||
customers,
|
customers,
|
||||||
@@ -85,7 +76,6 @@ function ExpenseFormPageProvider({ query, expenseId, baseCurrency, ...props }) {
|
|||||||
createExpenseMutate,
|
createExpenseMutate,
|
||||||
editExpenseMutate,
|
editExpenseMutate,
|
||||||
setSubmitPayload,
|
setSubmitPayload,
|
||||||
setSelectCustomer,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function ExpenseFormSelectBranch() {
|
|||||||
function ExpenseBranchSelectButton({ label }) {
|
function ExpenseBranchSelectButton({ label }) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
text={intl.get('invoice.branch_button.label', { label })}
|
text={intl.get('expense.branch_button.label', { label })}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
small={true}
|
small={true}
|
||||||
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
icon={<Icon icon={'branch-16'} iconSize={16} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user