IO-1067 Shop Config class dynamically required.

This commit is contained in:
Patrick Fic
2021-05-10 16:40:06 -07:00
parent 8bf3891535
commit b8e5034a67
2 changed files with 20 additions and 26 deletions

View File

@@ -5,30 +5,21 @@ import {
SyncOutlined, SyncOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import { useMutation } from "@apollo/client"; import { useMutation } from "@apollo/client";
import { import { Alert, Button, Card, Input, notification, Space, Table } from "antd";
Alert,
Button,
Card,
Input,
notification,
Space,
Table,
Tag,
} from "antd";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { import {
DELETE_ALL_AVAILABLE_JOBS, DELETE_ALL_AVAILABLE_JOBS,
DELETE_AVAILABLE_JOB, DELETE_AVAILABLE_JOB,
} from "../../graphql/available-jobs.queries"; } from "../../graphql/available-jobs.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter"; import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { TimeAgoFormatter } from "../../utils/DateFormatter"; import { TimeAgoFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters"; import { alphaSort } from "../../utils/sorters";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
}); });

View File

@@ -267,19 +267,6 @@ export default function ShopInfoGeneral({ form }) {
> >
<Select mode="tags" /> <Select mode="tags" />
</Form.Item> </Form.Item>
<Form.Item
name={["md_classes"]}
label={t("bodyshop.fields.md_classes")}
rules={[
{
required: true,
//message: t("general.validation.required"),
type: "array",
},
]}
>
<Select mode="tags" />
</Form.Item>
<Form.Item <Form.Item
name={["enforce_class"]} name={["enforce_class"]}
label={t("bodyshop.fields.enforce_class")} label={t("bodyshop.fields.enforce_class")}
@@ -287,6 +274,22 @@ export default function ShopInfoGeneral({ form }) {
> >
<Switch /> <Switch />
</Form.Item> </Form.Item>
<Form.Item
name={["md_classes"]}
label={t("bodyshop.fields.md_classes")}
dependencies={["enforce_class"]}
rules={[
({ getFieldValue }) => {
return {
required: getFieldValue("enforce_class"),
//message: t("general.validation.required"),
type: "array",
};
},
]}
>
<Select mode="tags" />
</Form.Item>
</LayoutFormRow> </LayoutFormRow>
<LayoutFormRow header={t("bodyshop.labels.scoreboardsetup")}> <LayoutFormRow header={t("bodyshop.labels.scoreboardsetup")}>
<Form.Item <Form.Item