diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index bd45d8c5e..8e6081232 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -48,6 +48,23 @@ function BillEnterModalContainer({ const [loading, setLoading] = useState(false); const client = useApolloClient(); + const formValues = useMemo(() => { + return { + ...billEnterModal.context.bill, + jobid: + (billEnterModal.context.job && billEnterModal.context.job.id) || null, + federal_tax_rate: + (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.federal_tax_rate) || + 0, + state_tax_rate: + (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.state_tax_rate) || + 0, + local_tax_rate: + (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.local_tax_rate) || + 0, + }; + }, [billEnterModal, bodyshop]); + const handleFinish = async (values) => { setLoading(true); const { upload, location, ...remainingValues } = values; @@ -190,7 +207,7 @@ function BillEnterModalContainer({ if (enterAgain) { form.resetFields(); - form.setFieldsValue({ billlines: [] }); + form.setFieldsValue(formValues); } else { toggleModalVisible(); } @@ -208,23 +225,6 @@ function BillEnterModalContainer({ if (enterAgain) form.submit(); }, [enterAgain, form]); - const formValues = useMemo(() => { - return { - ...billEnterModal.context.bill, - jobid: - (billEnterModal.context.job && billEnterModal.context.job.id) || null, - federal_tax_rate: - (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.federal_tax_rate) || - 0, - state_tax_rate: - (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.state_tax_rate) || - 0, - local_tax_rate: - (bodyshop.bill_tax_rates && bodyshop.bill_tax_rates.local_tax_rate) || - 0, - }; - }, [billEnterModal, bodyshop]); - useEffect(() => { if (billEnterModal.visible) { form.setFieldsValue(formValues);