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