IO-1299 Resolve tax ratds not saving on bill enter save and new
This commit is contained in:
@@ -48,6 +48,23 @@ function BillEnterModalContainer({
|
|||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const client = useApolloClient();
|
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) => {
|
const handleFinish = async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { upload, location, ...remainingValues } = values;
|
const { upload, location, ...remainingValues } = values;
|
||||||
@@ -190,7 +207,7 @@ function BillEnterModalContainer({
|
|||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
form.setFieldsValue({ billlines: [] });
|
form.setFieldsValue(formValues);
|
||||||
} else {
|
} else {
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
}
|
}
|
||||||
@@ -208,23 +225,6 @@ function BillEnterModalContainer({
|
|||||||
if (enterAgain) form.submit();
|
if (enterAgain) form.submit();
|
||||||
}, [enterAgain, form]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
if (billEnterModal.visible) {
|
if (billEnterModal.visible) {
|
||||||
form.setFieldsValue(formValues);
|
form.setFieldsValue(formValues);
|
||||||
|
|||||||
Reference in New Issue
Block a user