Fix: purchases.

This commit is contained in:
elforjani13
2022-03-22 23:59:05 +02:00
parent a913b84723
commit 4e53b3a2d5
18 changed files with 79 additions and 174 deletions

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components'; import styled from 'styled-components';
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components'; import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
@@ -6,12 +7,13 @@ export function BillFormFooterLeft() {
return ( return (
<React.Fragment> <React.Fragment>
{/* --------- note --------- */} {/* --------- note --------- */}
<TermsConditsFormGroup label={<T id={'note'} />} name={'note'}> <TermsConditsFormGroup
label={<T id={'bill_form.label.note'} />}
name={'note'}
>
<FEditableText <FEditableText
name={'note'} name={'note'}
placeholder={ placeholder={intl.get('bill_form.label.note.placeholder')}
'Enter the terms and conditions of your business to be displayed in your transaction'
}
/> />
</TermsConditsFormGroup> </TermsConditsFormGroup>
</React.Fragment> </React.Fragment>

View File

@@ -21,23 +21,23 @@ export function BillFormFooterRight() {
return ( return (
<BillTotalLines labelColWidth={'180px'} amountColWidth={'180px'}> <BillTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine <TotalLine
title={<T id={'bill.details.subtotal'} />} title={<T id={'bill_form.label.subtotal'} />}
value={formattedSubtotal} value={formattedSubtotal}
borderStyle={TotalLineBorderStyle.None} borderStyle={TotalLineBorderStyle.None}
/> />
<TotalLine <TotalLine
title={<T id={'bill.details.total'} />} title={<T id={'bill_form.label.total'} />}
value={formattedTotal} value={formattedTotal}
borderStyle={TotalLineBorderStyle.SingleDark} borderStyle={TotalLineBorderStyle.SingleDark}
textStyle={TotalLineTextStyle.Bold} textStyle={TotalLineTextStyle.Bold}
/> />
<TotalLine <TotalLine
title={<T id={'bill.details.payment_amount'} />} title={<T id={'bill_form.label.total'} />}
value={formattedPaymentTotal} value={formattedPaymentTotal}
borderStyle={TotalLineBorderStyle.None} borderStyle={TotalLineBorderStyle.None}
/> />
<TotalLine <TotalLine
title={<T id={'bill.details.due_amount'} />} title={<T id={'bill_form.label.total'} />}
value={formattedDueTotal} value={formattedDueTotal}
textStyle={TotalLineTextStyle.Bold} textStyle={TotalLineTextStyle.Bold}
/> />

View File

@@ -59,19 +59,18 @@ function BillFormHeader() {
)} )}
labelInfo={<FieldRequiredHint />} labelInfo={<FieldRequiredHint />}
> >
<ControlVendorGroup> <VendorSelectField
<VendorSelectField contacts={vendors}
contacts={vendors} selectedContactId={value}
selectedContactId={value} defaultSelectText={<T id={'select_vender_account'} />}
defaultSelectText={<T id={'select_vender_account'} />} onContactSelected={(contact) => {
onContactSelected={(contact) => { form.setFieldValue('vendor_id', contact.id);
form.setFieldValue('vendor_id', contact.id); form.setFieldValue('currency_code', contact?.currency_code);
form.setFieldValue('currency_code', contact?.currency_code); }}
}} popoverFill={true}
popoverFill={true} allowCreate={true}
allowCreate={true} />
/>
</ControlVendorGroup>
{value && ( {value && (
<VendorButtonLink vendorId={value}> <VendorButtonLink vendorId={value}>
<T id={'view_vendor_details'} /> <T id={'view_vendor_details'} />
@@ -175,12 +174,6 @@ function BillFormHeader() {
export default compose(withDialogActions)(BillFormHeader); export default compose(withDialogActions)(BillFormHeader);
const ControlVendorGroup = styled(ControlGroup)`
display: flex;
align-items: center;
transform: none;
`;
const VendorButtonLink = styled(VendorDrawerLink)` const VendorButtonLink = styled(VendorDrawerLink)`
font-size: 11px; font-size: 11px;
margin-top: 6px; margin-top: 6px;

View File

@@ -4,22 +4,15 @@ import { useParams } from 'react-router-dom';
import BillForm from './BillForm'; import BillForm from './BillForm';
import { BillFormProvider } from './BillFormProvider'; import { BillFormProvider } from './BillFormProvider';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { compose } from 'utils';
import 'style/pages/Bills/PageForm.scss'; import 'style/pages/Bills/PageForm.scss';
function BillFormPage({ export default function BillFormPage() {
// #withCurrentOrganization
organization: { base_currency },
}) {
const { id } = useParams(); const { id } = useParams();
const billId = parseInt(id, 10); const billId = parseInt(id, 10);
return ( return (
<BillFormProvider billId={billId} baseCurrency={base_currency}> <BillFormProvider billId={billId}>
<BillForm /> <BillForm />
</BillFormProvider> </BillFormProvider>
); );
} }
export default compose(withCurrentOrganization())(BillFormPage);

View File

@@ -38,7 +38,7 @@ const stringifiedFilterRoles = JSON.stringify([
/** /**
* Bill form provider. * Bill form provider.
*/ */
function BillFormProvider({ billId, baseCurrency, ...props }) { function BillFormProvider({ billId, ...props }) {
// Features guard. // Features guard.
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isWarehouseFeatureCan = featureCan(Features.Warehouses); const isWarehouseFeatureCan = featureCan(Features.Warehouses);
@@ -86,7 +86,6 @@ function BillFormProvider({ billId, baseCurrency, ...props }) {
// Form submit payload. // Form submit payload.
const [submitPayload, setSubmitPayload] = useState({}); const [submitPayload, setSubmitPayload] = useState({});
const [selectVendor, setSelectVendor] = React.useState(null);
// Create and edit bills mutations. // Create and edit bills mutations.
const { mutateAsync: createBillMutate } = useCreateBill(); const { mutateAsync: createBillMutate } = useCreateBill();
@@ -97,11 +96,6 @@ function BillFormProvider({ billId, baseCurrency, ...props }) {
// Determines whether the warehouse and branches are loading. // Determines whether the warehouse and branches are loading.
const isFeatureLoading = isWarehouesLoading || isBranchesLoading; const isFeatureLoading = isWarehouesLoading || isBranchesLoading;
// Determines whether the foreign vendor.
const isForeignVendor =
!isEqual(selectVendor?.currency_code, baseCurrency) &&
!isUndefined(selectVendor?.currency_code);
const provider = { const provider = {
accounts, accounts,
vendors, vendors,
@@ -109,9 +103,6 @@ function BillFormProvider({ billId, baseCurrency, ...props }) {
bill, bill,
warehouses, warehouses,
branches, branches,
baseCurrency,
selectVendor,
setSelectVendor,
submitPayload, submitPayload,
isNewMode, isNewMode,
@@ -123,7 +114,6 @@ function BillFormProvider({ billId, baseCurrency, ...props }) {
isFeatureLoading, isFeatureLoading,
isBranchesSuccess, isBranchesSuccess,
isWarehousesSuccess, isWarehousesSuccess,
isForeignVendor,
createBillMutate, createBillMutate,
editBillMutate, editBillMutate,

View File

@@ -94,7 +94,7 @@ function BillFormSelectWarehouse() {
function BillWarehouseSelectButton({ label }) { function BillWarehouseSelectButton({ label }) {
return ( return (
<Button <Button
text={intl.get('invoice.warehouse_button.label', { label })} text={intl.get('bill.warehouse_button.label', { label })}
minimal={true} minimal={true}
small={true} small={true}
icon={<Icon icon={'warehouse-16'} iconSize={16} />} icon={<Icon icon={'warehouse-16'} iconSize={16} />}
@@ -105,7 +105,7 @@ function BillWarehouseSelectButton({ label }) {
function BillBranchSelectButton({ label }) { function BillBranchSelectButton({ label }) {
return ( return (
<Button <Button
text={intl.get('invoice.branch_button.label', { label })} text={intl.get('bill.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} />}

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components'; import styled from 'styled-components';
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components'; import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
@@ -6,12 +7,13 @@ export function VendorCreditNoteFormFooterLeft() {
return ( return (
<React.Fragment> <React.Fragment>
{/* --------- Terms and conditions --------- */} {/* --------- Terms and conditions --------- */}
<TermsConditsFormGroup label={<T id={'note'} />} name={'note'}> <TermsConditsFormGroup
label={<T id={'vendor_credit_form.label.note'} />}
name={'note'}
>
<FEditableText <FEditableText
name={'note'} name={'note'}
placeholder={ placeholder={intl.get('vendor_credit_form.note.placeholder')}
'Enter the terms and conditions of your business to be displayed in your transaction'
}
/> />
</TermsConditsFormGroup> </TermsConditsFormGroup>
</React.Fragment> </React.Fragment>

View File

@@ -18,14 +18,13 @@ export function VendorCreditNoteFormFooterRight() {
amountColWidth={'180px'} amountColWidth={'180px'}
> >
<TotalLine <TotalLine
title={<T id={'credit_note.drawer.label_subtotal'} />} title={<T id={'vendor_credit_form.label.subtotal'} />}
value={formattedSubtotal} value={formattedSubtotal}
borderStyle={TotalLineBorderStyle.None} borderStyle={TotalLineBorderStyle.None}
/> />
<TotalLine <TotalLine
title={<T id={'credit_note.drawer.label_total'} />} title={<T id={'vendor_credit_form.label.total'} />}
value={formattedTotal} value={formattedTotal}
// borderStyle={TotalLineBorderStyle.SingleDark}
textStyle={TotalLineTextStyle.Bold} textStyle={TotalLineTextStyle.Bold}
/> />
</VendorCreditNoteTotalLines> </VendorCreditNoteTotalLines>

View File

@@ -93,19 +93,18 @@ function VendorCreditNoteFormHeaderFields({
className={classNames(CLASSES.FILL, 'form-group--vendor')} className={classNames(CLASSES.FILL, 'form-group--vendor')}
labelInfo={<FieldRequiredHint />} labelInfo={<FieldRequiredHint />}
> >
<ControlVendorGroup> <VendorSelectField
<VendorSelectField contacts={vendors}
contacts={vendors} selectedContactId={value}
selectedContactId={value} defaultSelectText={<T id={'select_vender_account'} />}
defaultSelectText={<T id={'select_vender_account'} />} onContactSelected={(contact) => {
onContactSelected={(contact) => { form.setFieldValue('vendor_id', contact.id);
form.setFieldValue('vendor_id', contact.id); form.setFieldValue('currency_code', contact?.currency_code);
form.setFieldValue('currency_code', contact?.currency_code); }}
}} popoverFill={true}
popoverFill={true} allowCreate={true}
allowCreate={true} />
/>
</ControlVendorGroup>
{value && ( {value && (
<VendorButtonLink vendorId={value}> <VendorButtonLink vendorId={value}>
<T id={'view_vendor_details'} /> <T id={'view_vendor_details'} />
@@ -214,12 +213,6 @@ export default compose(
})), })),
)(VendorCreditNoteFormHeaderFields); )(VendorCreditNoteFormHeaderFields);
const ControlVendorGroup = styled(ControlGroup)`
display: flex;
align-items: center;
transform: none;
`;
const VendorButtonLink = styled(VendorDrawerLink)` const VendorButtonLink = styled(VendorDrawerLink)`
font-size: 11px; font-size: 11px;
margin-top: 6px; margin-top: 6px;

View File

@@ -6,26 +6,16 @@ import '../../../../style/pages/VendorsCreditNote/PageForm.scss';
import VendorCreditNoteForm from './VendorCreditNoteForm'; import VendorCreditNoteForm from './VendorCreditNoteForm';
import { VendorCreditNoteFormProvider } from './VendorCreditNoteFormProvider'; import { VendorCreditNoteFormProvider } from './VendorCreditNoteFormProvider';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { compose } from 'utils';
/** /**
* Vendor Credit note form pages. * Vendor Credit note form pages.
*/ */
function VendorCreditNoteFormPage({ export default function VendorCreditNoteFormPage() {
// #withCurrentOrganization
organization: { base_currency },
}) {
const { id } = useParams(); const { id } = useParams();
const idAsInteger = parseInt(id, 10); const idAsInteger = parseInt(id, 10);
return ( return (
<VendorCreditNoteFormProvider <VendorCreditNoteFormProvider vendorCreditId={idAsInteger}>
vendorCreditId={idAsInteger}
baseCurrency={base_currency}
>
<VendorCreditNoteForm /> <VendorCreditNoteForm />
</VendorCreditNoteFormProvider> </VendorCreditNoteFormProvider>
); );
} }
export default compose(withCurrentOrganization())(VendorCreditNoteFormPage);

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { isEmpty, pick, isEqual, isUndefined } from 'lodash'; import { isEmpty, pick } from 'lodash';
import DashboardInsider from 'components/Dashboard/DashboardInsider'; import DashboardInsider from 'components/Dashboard/DashboardInsider';
import { transformToEditForm } from './utils'; import { transformToEditForm } from './utils';
import { Features } from 'common'; import { Features } from 'common';
@@ -22,11 +22,7 @@ const VendorCreditNoteFormContext = React.createContext();
/** /**
* Vendor Credit note data provider. * Vendor Credit note data provider.
*/ */
function VendorCreditNoteFormProvider({ function VendorCreditNoteFormProvider({ vendorCreditId, ...props }) {
vendorCreditId,
baseCurrency,
...props
}) {
const { state } = useLocation(); const { state } = useLocation();
const billId = state?.billId; const billId = state?.billId;
@@ -79,7 +75,6 @@ function VendorCreditNoteFormProvider({
// Form submit payload. // Form submit payload.
const [submitPayload, setSubmitPayload] = React.useState(); const [submitPayload, setSubmitPayload] = React.useState();
const [selectVendor, setSelectVendor] = React.useState(null);
// Create and edit vendor credit mutations. // Create and edit vendor credit mutations.
const { mutateAsync: createVendorCreditMutate } = useCreateVendorCredit(); const { mutateAsync: createVendorCreditMutate } = useCreateVendorCredit();
@@ -91,11 +86,6 @@ function VendorCreditNoteFormProvider({
// Determines whether the warehouse and branches are loading. // Determines whether the warehouse and branches are loading.
const isFeatureLoading = isWarehouesLoading || isBranchesLoading; const isFeatureLoading = isWarehouesLoading || isBranchesLoading;
// Determines whether the foreign vendor.
const isForeignVendor =
!isEqual(selectVendor?.currency_code, baseCurrency) &&
!isUndefined(selectVendor?.currency_code);
const newVendorCredit = !isEmpty(bill) const newVendorCredit = !isEmpty(bill)
? transformToEditForm({ ? transformToEditForm({
...pick(bill, ['vendor_id', 'currency_code', 'entries']), ...pick(bill, ['vendor_id', 'currency_code', 'entries']),
@@ -109,9 +99,6 @@ function VendorCreditNoteFormProvider({
vendorCredit, vendorCredit,
warehouses, warehouses,
branches, branches,
baseCurrency,
selectVendor,
setSelectVendor,
submitPayload, submitPayload,
isNewMode, isNewMode,
newVendorCredit, newVendorCredit,
@@ -120,7 +107,6 @@ function VendorCreditNoteFormProvider({
isFeatureLoading, isFeatureLoading,
isBranchesSuccess, isBranchesSuccess,
isWarehousesSuccess, isWarehousesSuccess,
isForeignVendor,
createVendorCreditMutate, createVendorCreditMutate,
editVendorCreditMutate, editVendorCreditMutate,

View File

@@ -95,7 +95,7 @@ function VendorCreditFormSelectWarehouse() {
function VendorCreditNoteWarehouseSelectButton({ label }) { function VendorCreditNoteWarehouseSelectButton({ label }) {
return ( return (
<Button <Button
text={intl.get('invoice.warehouse_button.label', { label })} text={intl.get('vendor_credit.warehouse_button.label', { label })}
minimal={true} minimal={true}
small={true} small={true}
icon={<Icon icon={'warehouse-16'} iconSize={16} />} icon={<Icon icon={'warehouse-16'} iconSize={16} />}
@@ -106,7 +106,7 @@ function VendorCreditNoteWarehouseSelectButton({ label }) {
function VendorCreditNoteBranchSelectButton({ label }) { function VendorCreditNoteBranchSelectButton({ label }) {
return ( return (
<Button <Button
text={intl.get('invoice.branch_button.label', { label })} text={intl.get('vendor_credit.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} />}

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components'; import styled from 'styled-components';
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components'; import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
@@ -8,14 +9,12 @@ export function PaymentMadeFormFooterLeft() {
{/* --------- Statement--------- */} {/* --------- Statement--------- */}
<StatementFormGroup <StatementFormGroup
name={'statement'} name={'statement'}
label={<T id={'statement'} />} label={<T id={'payment_made_form.label.statement'} />}
hintText={'Will be displayed on the Payment'} hintText={'Will be displayed on the Payment'}
> >
<FEditableText <FEditableText
name={'statement'} name={'statement'}
placeholder={ placeholder={intl.get('payment_made_form.statement.placeholder')}
<T id={'thanks_for_your_business_and_have_a_great_day'} />
}
/> />
</StatementFormGroup> </StatementFormGroup>
</React.Fragment> </React.Fragment>

View File

@@ -11,17 +11,17 @@ import { usePaymentMadeTotals } from './utils';
export function PaymentMadeFormFooterRight() { export function PaymentMadeFormFooterRight() {
const { formattedSubtotal, formattedTotal } = usePaymentMadeTotals(); const { formattedSubtotal, formattedTotal } = usePaymentMadeTotals();
return ( return (
<PaymentMadeTotalLines labelColWidth={'180px'} amountColWidth={'180px'}> <PaymentMadeTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
<TotalLine <TotalLine
title={<T id={'estimate.details.subtotal'} />} title={<T id={'payment_made_form.label.subtotal'} />}
value={formattedSubtotal} value={formattedSubtotal}
borderStyle={TotalLineBorderStyle.None} borderStyle={TotalLineBorderStyle.None}
/> />
<TotalLine <TotalLine
title={<T id={'estimate.details.total'} />} title={<T id={'payment_made_form.label.total'} />}
value={formattedTotal} value={formattedTotal}
// borderStyle={TotalLineBorderStyle.SingleDark}
textStyle={TotalLineTextStyle.Bold} textStyle={TotalLineTextStyle.Bold}
/> />
</PaymentMadeTotalLines> </PaymentMadeTotalLines>

View File

@@ -54,15 +54,8 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
} = useFormikContext(); } = useFormikContext();
// Payment made form context. // Payment made form context.
const { const { vendors, accounts, isNewMode, setPaymentVendorId } =
vendors, usePaymentMadeFormContext();
accounts,
isNewMode,
setPaymentVendorId,
isForeignVendor,
baseCurrency,
selectVendor,
} = usePaymentMadeFormContext();
// Sumation of payable full-amount. // Sumation of payable full-amount.
const payableFullAmount = useMemo( const payableFullAmount = useMemo(
@@ -101,21 +94,20 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
className={classNames('form-group--select-list', Classes.FILL)} className={classNames('form-group--select-list', Classes.FILL)}
labelInfo={<FieldRequiredHint />} labelInfo={<FieldRequiredHint />}
> >
<ControlVendorGroup> <VendorSelectField
<VendorSelectField contacts={vendors}
contacts={vendors} selectedContactId={value}
selectedContactId={value} defaultSelectText={<T id={'select_vender_account'} />}
defaultSelectText={<T id={'select_vender_account'} />} onContactSelected={(contact) => {
onContactSelected={(contact) => { form.setFieldValue('vendor_id', contact.id);
form.setFieldValue('vendor_id', contact.id); form.setFieldValue('currency_code', contact?.currency_code);
form.setFieldValue('currency_code', contact?.currency_code); setPaymentVendorId(contact.id);
setPaymentVendorId(contact.id); }}
}} disabled={!isNewMode}
disabled={!isNewMode} popoverFill={true}
popoverFill={true} allowCreate={true}
allowCreate={true} />
/>
</ControlVendorGroup>
{value && ( {value && (
<VendorButtonLink vendorId={value}> <VendorButtonLink vendorId={value}>
<T id={'view_vendor_details'} /> <T id={'view_vendor_details'} />
@@ -278,12 +270,6 @@ function PaymentMadeFormHeaderFields({ organization: { base_currency } }) {
export default compose(withCurrentOrganization())(PaymentMadeFormHeaderFields); export default compose(withCurrentOrganization())(PaymentMadeFormHeaderFields);
const ControlVendorGroup = styled(ControlGroup)`
display: flex;
align-items: center;
transform: none;
`;
const VendorButtonLink = styled(VendorDrawerLink)` const VendorButtonLink = styled(VendorDrawerLink)`
font-size: 11px; font-size: 11px;
margin-top: 6px; margin-top: 6px;

View File

@@ -6,25 +6,15 @@ import { PaymentMadeFormProvider } from './PaymentMadeFormProvider';
import 'style/pages/PaymentMade/PageForm.scss'; import 'style/pages/PaymentMade/PageForm.scss';
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
import { compose } from 'utils';
/** /**
* Payment made - Page form. * Payment made - Page form.
*/ */
function PaymentMadeFormPage({ export default function PaymentMadeFormPage() {
// #withCurrentOrganization
organization: { base_currency },
}) {
const { id: paymentMadeId } = useParams(); const { id: paymentMadeId } = useParams();
return ( return (
<PaymentMadeFormProvider <PaymentMadeFormProvider paymentMadeId={paymentMadeId}>
paymentMadeId={paymentMadeId}
baseCurrency={base_currency}
>
<PaymentMadeForm /> <PaymentMadeForm />
</PaymentMadeFormProvider> </PaymentMadeFormProvider>
); );
} }
export default compose(withCurrentOrganization())(PaymentMadeFormPage);

View File

@@ -1,5 +1,4 @@
import React, { createContext, useContext } from 'react'; import React, { createContext, useContext } from 'react';
import { isEqual, isUndefined } from 'lodash';
import { Features } from 'common'; import { Features } from 'common';
import { useFeatureCan } from 'hooks/state'; import { useFeatureCan } from 'hooks/state';
import { import {
@@ -20,21 +19,14 @@ const PaymentMadeFormContext = createContext();
/** /**
* Payment made form provider. * Payment made form provider.
*/ */
function PaymentMadeFormProvider({ function PaymentMadeFormProvider({ query, paymentMadeId, ...props }) {
query,
paymentMadeId,
baseCurrency,
...props
}) {
const [submitPayload, setSubmitPayload] = React.useState({}); const [submitPayload, setSubmitPayload] = React.useState({});
const [paymentVendorId, setPaymentVendorId] = React.useState(null); const [paymentVendorId, setPaymentVendorId] = React.useState(null);
const [selectVendor, setSelectVendor] = React.useState(null);
// Features guard. // Features guard.
const { featureCan } = useFeatureCan(); const { featureCan } = useFeatureCan();
const isBranchFeatureCan = featureCan(Features.Branches); const isBranchFeatureCan = featureCan(Features.Branches);
// Handle fetch accounts data. // Handle fetch accounts data.
const { data: accounts, isLoading: isAccountsLoading } = useAccounts(); const { data: accounts, isLoading: isAccountsLoading } = useAccounts();
@@ -67,7 +59,6 @@ function PaymentMadeFormProvider({
isSuccess: isBranchesSuccess, isSuccess: isBranchesSuccess,
} = useBranches(query, { enabled: isBranchFeatureCan }); } = useBranches(query, { enabled: isBranchFeatureCan });
// Fetch payment made settings. // Fetch payment made settings.
useSettings(); useSettings();
@@ -79,11 +70,6 @@ function PaymentMadeFormProvider({
const isFeatureLoading = isBranchesLoading; const isFeatureLoading = isBranchesLoading;
// Determines whether the foreign vendor.
const isForeignVendor =
!isEqual(selectVendor?.currency_code, baseCurrency) &&
!isUndefined(selectVendor?.currency_code);
// Provider payload. // Provider payload.
const provider = { const provider = {
paymentMadeId, paymentMadeId,
@@ -94,9 +80,6 @@ function PaymentMadeFormProvider({
items, items,
branches, branches,
submitPayload, submitPayload,
baseCurrency,
selectVendor,
setSelectVendor,
paymentVendorId, paymentVendorId,
isNewMode, isNewMode,
@@ -108,7 +91,6 @@ function PaymentMadeFormProvider({
isPaymentLoading, isPaymentLoading,
isFeatureLoading, isFeatureLoading,
isBranchesSuccess, isBranchesSuccess,
isForeignVendor,
createPaymentMadeMutate, createPaymentMadeMutate,
editPaymentMadeMutate, editPaymentMadeMutate,

View File

@@ -65,7 +65,7 @@ function PaymentMadeFormSelectBranch() {
function PaymentMadeBranchSelectButton({ label }) { function PaymentMadeBranchSelectButton({ label }) {
return ( return (
<Button <Button
text={intl.get('invoice.branch_button.label', { label })} text={intl.get('payment_made.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} />}