IO-233 Add CDK Control List.

This commit is contained in:
Patrick Fic
2021-12-01 13:37:03 -08:00
parent cdc0c8bb37
commit 1483f5f7c8
8 changed files with 123 additions and 3 deletions

View File

@@ -1,14 +1,16 @@
import { DeleteFilled } from "@ant-design/icons";
import { DeleteFilled, DownOutlined } from "@ant-design/icons";
import {
Button,
Card,
Divider,
Dropdown,
Form,
Input,
InputNumber,
Select,
Space,
Statistic,
Menu,
Typography,
} from "antd";
import Dinero from "dinero.js";
@@ -252,6 +254,42 @@ export function DmsPostForm({ bodyshop, socket, job }) {
}}
</Form.Item>
<Dropdown
overlay={
<Menu>
{bodyshop.cdk_configuration.controllist &&
bodyshop.cdk_configuration.controllist.map(
(key, idx) => (
<Menu.Item
key={idx}
onClick={() => {
form.setFieldsValue({
payers: form
.getFieldValue("payers")
.map((row, mapIndex) => {
if (index !== mapIndex) return row;
return {
...row,
controlnumber: key.controlnumber,
};
}),
});
}}
>
{key.name}
</Menu.Item>
)
)}
</Menu>
}
>
<a href=" #" onClick={(e) => e.preventDefault()}>
{t("bodyshop.labels.dms.cdk.controllist")}{" "}
<DownOutlined />
</a>
</Dropdown>
<DeleteFilled
onClick={() => {
remove(field.name);

View File

@@ -201,6 +201,63 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
}}
</Form.List>
</LayoutFormRow>
<LayoutFormRow header={t("bodyshop.labels.dms.cdk.controllist")}>
<Form.List name={["cdk_configuration", "controllist"]}>
{(fields, { add, remove }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key}>
<LayoutFormRow noDivider>
<Form.Item
label={t("jobs.fields.dms.payer.name")}
key={`${index}name`}
name={[field.name, "name"]}
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<Form.Item
label={t("jobs.fields.dms.payer.controlnumber")}
key={`${index}controlnumber`}
name={[field.name, "controlnumber"]}
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<DeleteFilled
onClick={() => {
remove(field.name);
}}
/>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</LayoutFormRow>
</>
)}