mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
Fix: sales.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import styled from 'styled-components';
|
||||
import { FFormGroup, FEditableText, FormattedMessage as T } from 'components';
|
||||
|
||||
@@ -13,20 +14,20 @@ export function InvoiceFormFooterLeft() {
|
||||
>
|
||||
<FEditableText
|
||||
name={'invoice_message'}
|
||||
placeholder={
|
||||
<T id={'thanks_for_your_business_and_have_a_great_day'} />
|
||||
}
|
||||
placeholder={intl.get('invoice_form.invoice_message.placeholder')}
|
||||
/>
|
||||
</InvoiceMsgFormGroup>
|
||||
|
||||
{/* --------- Terms and conditions --------- */}
|
||||
<TermsConditsFormGroup
|
||||
label={<T id={'terms_conditions'} />}
|
||||
label={<T id={'invoice_form.label.invoice_message'} />}
|
||||
name={'terms_conditions'}
|
||||
>
|
||||
<FEditableText
|
||||
name={'terms_conditions'}
|
||||
placeholder={<T id={'terms_and_conditions.placeholder'} />}
|
||||
placeholder={intl.get(
|
||||
'invoice_form.terms_and_conditions.placeholder',
|
||||
)}
|
||||
/>
|
||||
</TermsConditsFormGroup>
|
||||
</React.Fragment>
|
||||
|
||||
@@ -22,23 +22,23 @@ export function InvoiceFormFooterRight() {
|
||||
return (
|
||||
<InvoiceTotalLines labelColWidth={'180px'} amountColWidth={'180px'}>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.subtotal'} />}
|
||||
title={<T id={'invoice_form.label.subtotal'} />}
|
||||
value={formattedSubtotal}
|
||||
borderStyle={TotalLineBorderStyle.None}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.total'} />}
|
||||
title={<T id={'invoice_form.label.total'} />}
|
||||
value={formattedTotal}
|
||||
borderStyle={TotalLineBorderStyle.SingleDark}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.payment_amount'} />}
|
||||
title={<T id={'invoice_form.label.payment_amount'} />}
|
||||
value={formattedPaymentTotal}
|
||||
borderStyle={TotalLineBorderStyle.None}
|
||||
/>
|
||||
<TotalLine
|
||||
title={<T id={'invoice.details.due_amount'} />}
|
||||
title={<T id={'invoice_form.label.due_amount'} />}
|
||||
value={formattedDueTotal}
|
||||
textStyle={TotalLineTextStyle.Bold}
|
||||
/>
|
||||
|
||||
@@ -92,19 +92,18 @@ function InvoiceFormHeaderFields({
|
||||
)}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
>
|
||||
<ControlCustomerGroup>
|
||||
<CustomerSelectField
|
||||
contacts={customers}
|
||||
selectedContactId={value}
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
}}
|
||||
popoverFill={true}
|
||||
allowCreate={true}
|
||||
/>
|
||||
</ControlCustomerGroup>
|
||||
<CustomerSelectField
|
||||
contacts={customers}
|
||||
selectedContactId={value}
|
||||
defaultSelectText={<T id={'select_customer_account'} />}
|
||||
onContactSelected={(customer) => {
|
||||
form.setFieldValue('customer_id', customer.id);
|
||||
form.setFieldValue('currency_code', customer?.currency_code);
|
||||
}}
|
||||
popoverFill={true}
|
||||
allowCreate={true}
|
||||
/>
|
||||
|
||||
{value && (
|
||||
<CustomerButtonLink customerId={value}>
|
||||
<T id={'view_customer_details'} />
|
||||
@@ -240,12 +239,6 @@ export default compose(
|
||||
})),
|
||||
)(InvoiceFormHeaderFields);
|
||||
|
||||
const ControlCustomerGroup = styled(ControlGroup)`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transform: none;
|
||||
`;
|
||||
|
||||
const CustomerButtonLink = styled(CustomerDrawerLink)`
|
||||
font-size: 11px;
|
||||
margin-top: 6px;
|
||||
|
||||
@@ -5,23 +5,17 @@ import 'style/pages/SaleInvoice/PageForm.scss';
|
||||
|
||||
import InvoiceForm from './InvoiceForm';
|
||||
import { InvoiceFormProvider } from './InvoiceFormProvider';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* Invoice form page.
|
||||
*/
|
||||
function InvoiceFormPage({
|
||||
// #withCurrentOrganization
|
||||
organization: { base_currency },
|
||||
}) {
|
||||
export default function InvoiceFormPage() {
|
||||
const { id } = useParams();
|
||||
const idAsInteger = parseInt(id, 10);
|
||||
|
||||
return (
|
||||
<InvoiceFormProvider invoiceId={idAsInteger} baseCurrency={base_currency}>
|
||||
<InvoiceFormProvider invoiceId={idAsInteger}>
|
||||
<InvoiceForm />
|
||||
</InvoiceFormProvider>
|
||||
);
|
||||
}
|
||||
export default compose(withCurrentOrganization())(InvoiceFormPage);
|
||||
|
||||
@@ -85,7 +85,6 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
|
||||
|
||||
// Form submit payload.
|
||||
const [submitPayload, setSubmitPayload] = useState();
|
||||
const [selectCustomer, setSelectCustomer] = useState(null);
|
||||
|
||||
// Detarmines whether the form in new mode.
|
||||
const isNewMode = !invoiceId;
|
||||
@@ -93,9 +92,6 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
|
||||
// Determines whether the warehouse and branches are loading.
|
||||
const isFeatureLoading = isWarehouesLoading || isBranchesLoading;
|
||||
|
||||
// Determines whether the foreign customer.
|
||||
const isForeignCustomer = true;
|
||||
|
||||
const provider = {
|
||||
invoice,
|
||||
items,
|
||||
@@ -104,8 +100,6 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
|
||||
estimateId,
|
||||
invoiceId,
|
||||
submitPayload,
|
||||
selectCustomer,
|
||||
baseCurrency,
|
||||
branches,
|
||||
warehouses,
|
||||
|
||||
@@ -116,14 +110,12 @@ function InvoiceFormProvider({ invoiceId, baseCurrency, ...props }) {
|
||||
isWarehouesLoading,
|
||||
isBranchesLoading,
|
||||
isFeatureLoading,
|
||||
isForeignCustomer,
|
||||
isBranchesSuccess,
|
||||
isWarehousesSuccess,
|
||||
|
||||
createInvoiceMutate,
|
||||
editInvoiceMutate,
|
||||
setSubmitPayload,
|
||||
setSelectCustomer,
|
||||
isNewMode,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user