- Merge client update into test-beta
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,55 +1,57 @@
|
||||
import { Popconfirm, Button } from "antd";
|
||||
import {Button, Popconfirm} from "antd";
|
||||
import React from "react";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectJobReadOnly} from "../../redux/application/application.selectors";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {connect} from "react-redux";
|
||||
import _ from "lodash";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
|
||||
export function JobsMarkPstExempt({ jobRO, form }) {
|
||||
const { t } = useTranslation();
|
||||
export function JobsMarkPstExempt({jobRO, form}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
const handleConfirm = () => {
|
||||
const newPartRates = _.cloneDeep(form.getFieldValue("parts_tax_rates"));
|
||||
const handleConfirm = () => {
|
||||
const newPartRates = _.cloneDeep(form.getFieldValue("parts_tax_rates"));
|
||||
|
||||
Object.keys(newPartRates).forEach((key) => {
|
||||
newPartRates[key] = {
|
||||
...newPartRates[key],
|
||||
prt_tax_in: false,
|
||||
prt_tax_rt: 0,
|
||||
};
|
||||
});
|
||||
Object.keys(newPartRates).forEach((key) => {
|
||||
newPartRates[key] = {
|
||||
...newPartRates[key],
|
||||
prt_tax_in: false,
|
||||
prt_tax_rt: 0,
|
||||
};
|
||||
});
|
||||
|
||||
form.setFieldsValue({
|
||||
state_tax_rate: 0,
|
||||
tax_lbr_rt: 0,
|
||||
tax_levies_rt: 0,
|
||||
tax_sub_rt: 0,
|
||||
tax_shop_mat_rt: 0,
|
||||
tax_paint_mat_rt: 0,
|
||||
tax_str_rt: 0,
|
||||
tax_tow_rt: 0,
|
||||
parts_tax_rates: newPartRates,
|
||||
});
|
||||
};
|
||||
form.setFieldsValue({
|
||||
state_tax_rate: 0,
|
||||
tax_lbr_rt: 0,
|
||||
tax_levies_rt: 0,
|
||||
tax_sub_rt: 0,
|
||||
tax_shop_mat_rt: 0,
|
||||
tax_paint_mat_rt: 0,
|
||||
tax_str_rt: 0,
|
||||
tax_tow_rt: 0,
|
||||
parts_tax_rates: newPartRates,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Popconfirm
|
||||
onConfirm={handleConfirm}
|
||||
disabled={jobRO}
|
||||
okText={t("general.labels.yes")}
|
||||
cancelText={t("general.labels.no")}
|
||||
title={t("jobs.actions.markpstexemptconfirm")}
|
||||
>
|
||||
<Button type="link" disabled={jobRO}>
|
||||
{t("jobs.actions.markpstexempt")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
);
|
||||
return (
|
||||
<Popconfirm
|
||||
onConfirm={handleConfirm}
|
||||
disabled={jobRO}
|
||||
okText={t("general.labels.yes")}
|
||||
cancelText={t("general.labels.no")}
|
||||
title={t("jobs.actions.markpstexemptconfirm")}
|
||||
>
|
||||
<Button type="link" disabled={jobRO}>
|
||||
{t("jobs.actions.markpstexempt")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(JobsMarkPstExempt);
|
||||
|
||||
Reference in New Issue
Block a user