diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 64e8faa9d..fa49e0b22 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -959,6 +959,69 @@ + + invoice_federal_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + invoice_local_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + invoice_state_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + logo_img_path false @@ -5074,6 +5137,27 @@ + + federal_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + invoice_number false @@ -5116,6 +5200,27 @@ + + local_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + ro_number false @@ -5137,6 +5242,27 @@ + + state_tax_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + total false diff --git a/client/src/components/invoice-detail-edit/invoice-detail-edit.container.jsx b/client/src/components/invoice-detail-edit/invoice-detail-edit.container.jsx index 1799e23fc..32add3dc6 100644 --- a/client/src/components/invoice-detail-edit/invoice-detail-edit.container.jsx +++ b/client/src/components/invoice-detail-edit/invoice-detail-edit.container.jsx @@ -3,7 +3,6 @@ import { Form } from "antd"; import moment from "moment"; import queryString from "query-string"; import React, { useEffect } from "react"; -import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; @@ -19,7 +18,7 @@ const mapStateToProps = createStructuredSelector({ export function InvoiceDetailEditContainer({ bodyshop }) { const search = queryString.parse(useLocation().search); - const { t } = useTranslation(); + const [form] = Form.useForm(); const { loading, error, data } = useQuery(QUERY_INVOICE_BY_PK, { diff --git a/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx b/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx index bb8b7ab8c..f549702cb 100644 --- a/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx +++ b/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx @@ -6,17 +6,23 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { INSERT_NEW_INVOICE } from "../../graphql/invoices.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; +import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectInvoiceEnterModal } from "../../redux/modals/modals.selectors"; import InvoiceFormContainer from "../invoice-form/invoice-form.container"; const mapStateToProps = createStructuredSelector({ invoiceEnterModal: selectInvoiceEnterModal, + bodyshop: selectBodyshop, }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("invoiceEnter")), }); -function InvoiceEnterModalContainer({ invoiceEnterModal, toggleModalVisible }) { +function InvoiceEnterModalContainer({ + invoiceEnterModal, + toggleModalVisible, + bodyshop, +}) { const [form] = Form.useForm(); const { t } = useTranslation(); const [enterAgain, setEnterAgain] = useState(false); @@ -113,6 +119,9 @@ function InvoiceEnterModalContainer({ invoiceEnterModal, toggleModalVisible }) { (invoiceEnterModal.context.job && invoiceEnterModal.context.job.id) || null, + federal_tax_rate: bodyshop.invoice_tax_rates.federal_tax_rate || 0, + state_tax_rate: bodyshop.invoice_tax_rates.state_tax_rate || 0, + local_tax_rate: bodyshop.invoice_tax_rates.local_tax_rate || 0, }} > diff --git a/client/src/components/invoice-form/invoice-form.component.jsx b/client/src/components/invoice-form/invoice-form.component.jsx index 76b171f41..9f0d3e800 100644 --- a/client/src/components/invoice-form/invoice-form.component.jsx +++ b/client/src/components/invoice-form/invoice-form.component.jsx @@ -6,6 +6,7 @@ import CurrencyInput from "../form-items-formatted/currency-form-item.component" import JobSearchSelect from "../job-search-select/job-search-select.component"; import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; import InvoiceFormLines from "./invoice-form.lines.component"; +import Dinero from "dinero.js"; export default function InvoiceFormComponent({ form, @@ -107,6 +108,42 @@ export default function InvoiceFormComponent({ > + + + + + + + + + + + {() => { + return ( +
+ {JSON.stringify(form.getFieldsValue(["invoicelines", "total"]))} +
+ ); + }} +
+