import { Collapse, Form, InputNumber, Switch } from "antd";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import InstanceRenderManager from "../../utils/instanceRenderMgr";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";

const mapStateToProps = createStructuredSelector({
  jobRO: selectJobReadOnly
});

export function JobsDetailRatesParts({ jobRO, expanded, form }) {
  const { t } = useTranslation();

  return (
    <Collapse
      defaultActiveKey={expanded && "rates"}
      items={[
        {
          key: "rates",
          label: t("jobs.labels.parts_tax_rates"),
          forceRender: true,
          children: (
            <>
              <LayoutFormRow header={t("joblines.fields.part_types.PAA")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAA", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAA", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAA", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAA", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAA", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAA", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAA", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAA", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAA", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAA", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAA", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAC")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAC", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAC", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAC", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAC", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAC", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAC", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAC", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAC", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAC", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAC", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAC", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAL")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAL", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAL", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAL", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAL", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAL", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAL", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAL", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAL", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAL", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAL", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAL", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAG")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAG", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAG", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAG", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAG", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAG", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAG", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAG", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAG", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAG", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAG", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAG", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAM")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAM", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAM", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAM", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAM", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAM", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAM", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAM", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAM", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAM", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAM", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAM", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAN")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAN", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAN", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAN", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAN", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAN", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAN", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAN", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAN", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAN", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAN", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAN", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAO")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAO", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAO", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAO", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAO", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAO", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAO", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAO", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAO", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAO", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAO", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAO", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAP")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAP", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAP", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAP", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAP", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAP", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAP", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAP", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAP", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAP", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAP", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAP", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAR")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAR", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAR", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAR", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAR", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAR", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAR", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAR", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAR", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAR", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAR", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAR", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PAS")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PAS", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PAS", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PAS", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PAS", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PAS", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PAS", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PAS", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PAS", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PAS", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PAS", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PAS", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.PASL")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "PASL", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "PASL", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "PASL", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "PASL", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                        name={["parts_tax_rates", "PASL", "prt_tax_rt"]}
                        rules={[
                          {
                            required: form.getFieldValue(["parts_tax_rates", "PASL", "prt_tax_in"])
                            //message: t("general.validation.required"),
                          }
                        ]}
                      >
                        <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                      </Form.Item>
                    );
                  }}
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in1")}
                  name={["parts_tax_rates", "PASL", "prt_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in2")}
                  name={["parts_tax_rates", "PASL", "prt_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in3")}
                  name={["parts_tax_rates", "PASL", "prt_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in4")}
                  name={["parts_tax_rates", "PASL", "prt_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tx_in5")}
                  name={["parts_tax_rates", "PASL", "prt_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.CCDR")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "CCDR", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "CCDR", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "CCDR", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "CCDR", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                  name={["parts_tax_rates", "CCDR", "prt_tax_rt"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.CCF")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "CCF", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "CCF", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "CCF", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "CCF", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                  name={["parts_tax_rates", "CCF", "prt_tax_rt"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.CCM")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "CCM", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "CCM", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "CCM", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "CCM", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                  name={["parts_tax_rates", "CCM", "prt_tax_rt"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.CCC")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "CCC", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "CCC", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "CCC", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "CCC", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                  name={["parts_tax_rates", "CCC", "prt_tax_rt"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.part_types.CCD")}>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_discp")}
                  name={["parts_tax_rates", "CCD", "prt_discp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mktyp")}
                  name={["parts_tax_rates", "CCD", "prt_mktyp"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_mkupp")}
                  name={["parts_tax_rates", "CCD", "prt_mkupp"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_in")}
                  name={["parts_tax_rates", "CCD", "prt_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.parts_tax_rates.prt_tax_rt")}
                  name={["parts_tax_rates", "CCD", "prt_tax_rt"]}
                >
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("jobs.labels.cieca_pfo")}>
                <Form.Item label={t("jobs.fields.tax_tow_rt")} name="tax_tow_rt">
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item label={t("jobs.fields.tax_str_rt")} name="tax_str_rt">
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                {InstanceRenderManager({ imex: true, rome: false }) ? (
                  <>
                    <Form.Item label={t("jobs.fields.tax_paint_mat_rt")} name="tax_paint_mat_rt">
                      <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                    </Form.Item>
                    <Form.Item label={t("jobs.fields.tax_shop_mat_rt")} name="tax_shop_mat_rt">
                      <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                    </Form.Item>{" "}
                  </>
                ) : null}
                <Form.Item label={t("jobs.fields.tax_sub_rt")} name="tax_sub_rt">
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                {InstanceRenderManager({ imex: true, rome: false }) ? (
                  <Form.Item label={t("jobs.fields.tax_lbr_rt")} name="tax_lbr_rt">
                    <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                  </Form.Item>
                ) : null}
                <Form.Item label={t("jobs.fields.tax_levies_rt")} name="tax_levies_rt">
                  <InputNumber min={0} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
            </>
          )
        }
      ]}
    />
  );
}

export default connect(mapStateToProps, null)(JobsDetailRatesParts);
