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 LayoutFormRow from "../layout-form-row/layout-form-row.component";

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

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

  return (
    <Collapse
      defaultActiveKey={expanded && "rates"}
      items={[
        {
          key: "cieca_pfl",
          label: t("jobs.labels.cieca_pfl"),
          forceRender: true,
          children: (
            <>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAB")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAB", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAB", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAB", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAB", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAB", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAB", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAB", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAB", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAB", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAD")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAD", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAD", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAD", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAD", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAD", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAD", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAD", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAD", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAD", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAE")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAE", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAE", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAE", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAE", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAE", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAE", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAE", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAE", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAE", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAF")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAF", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAF", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAF", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAF", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAF", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAF", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAF", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAF", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAF", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAG")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAG", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAG", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAG", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAG", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAG", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAG", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAG", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAG", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAG", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAM")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAM", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAM", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAM", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAM", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAM", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAM", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAM", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAM", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAM", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAR")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAR", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAR", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAR", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAR", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAR", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAR", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAR", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAR", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAR", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAS")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAS", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAS", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAS", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAS", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAS", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAS", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAS", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAS", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAS", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
              <LayoutFormRow header={t("joblines.fields.lbr_types.LAU")}>
                <Form.Item label={t("jobs.fields.cieca_pfl.lbr_adjp")} name={["cieca_pfl", "LAU", "lbr_adjp"]}>
                  <InputNumber min={-100} max={100} precision={4} disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tax_in")}
                  name={["cieca_pfl", "LAU", "lbr_tax_in"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item shouldUpdate>
                  {() => {
                    return (
                      <Form.Item
                        label={t("jobs.fields.cieca_pfl.lbr_taxp")}
                        name={["cieca_pfl", "LAU", "lbr_taxp"]}
                        rules={[
                          {
                            required: form.getFieldValue(["cieca_pfl", "LAU", "lbr_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.cieca_pfl.lbr_tx_in1")}
                  name={["cieca_pfl", "LAU", "lbr_tx_in1"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in2")}
                  name={["cieca_pfl", "LAU", "lbr_tx_in2"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in3")}
                  name={["cieca_pfl", "LAU", "lbr_tx_in3"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in4")}
                  name={["cieca_pfl", "LAU", "lbr_tx_in4"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
                <Form.Item
                  label={t("jobs.fields.cieca_pfl.lbr_tx_in5")}
                  name={["cieca_pfl", "LAU", "lbr_tx_in5"]}
                  valuePropName="checked"
                >
                  <Switch disabled={jobRO} />
                </Form.Item>
              </LayoutFormRow>
            </>
          )
        }
      ]}
    />
  );
}

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