165 lines
5.9 KiB
JavaScript
165 lines
5.9 KiB
JavaScript
import { DeleteFilled } from "@ant-design/icons";
|
|
import {
|
|
Button,
|
|
Checkbox,
|
|
Col,
|
|
Form,
|
|
Input,
|
|
InputNumber,
|
|
Row,
|
|
Space,
|
|
Switch,
|
|
} from "antd";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
|
|
|
export default function ShopInfoTaskPresets({ form }) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<>
|
|
<LayoutFormRow noDivider>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.enable_tasks")}
|
|
valuePropName="checked"
|
|
name={["md_tasks_presets", "enable_tasks"]}
|
|
>
|
|
<Switch />
|
|
</Form.Item>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.use_approvals")}
|
|
valuePropName="checked"
|
|
name={["md_tasks_presets", "use_approvals"]}
|
|
>
|
|
<Switch />
|
|
</Form.Item>
|
|
</LayoutFormRow>
|
|
|
|
<LayoutFormRow header={t("bodyshop.labels.md_tasks_presets")}>
|
|
<Form.List name={["md_tasks_presets", "presets"]}>
|
|
{(fields, { add, remove, move }) => {
|
|
return (
|
|
<div>
|
|
{fields.map((field, index) => (
|
|
<Form.Item key={field.key}>
|
|
<LayoutFormRow noDivider>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.name")}
|
|
key={`${index}name`}
|
|
name={[field.name, "name"]}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
//message: t("general.validation.required"),
|
|
},
|
|
]}
|
|
>
|
|
<Input />
|
|
</Form.Item>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.hourstype")}
|
|
key={`${index}hourstype`}
|
|
name={[field.name, "hourstype"]}
|
|
rules={[
|
|
{
|
|
required: true,
|
|
//message: t("general.validation.required"),
|
|
},
|
|
]}
|
|
>
|
|
<Checkbox.Group>
|
|
<Row>
|
|
<Col span={8}>
|
|
<Checkbox
|
|
value="LAB"
|
|
style={{ lineHeight: "32px" }}
|
|
>
|
|
{t("joblines.fields.lbr_types.LAB")}
|
|
</Checkbox>
|
|
</Col>
|
|
<Col span={8}>
|
|
<Checkbox
|
|
value="LAR"
|
|
style={{ lineHeight: "32px" }}
|
|
>
|
|
{t("joblines.fields.lbr_types.LAR")}
|
|
</Checkbox>
|
|
</Col>
|
|
<Col span={8}>
|
|
<Checkbox
|
|
value="LAM"
|
|
style={{ lineHeight: "32px" }}
|
|
>
|
|
{t("joblines.fields.lbr_types.LAM")}
|
|
</Checkbox>
|
|
</Col>
|
|
<Col span={8}>
|
|
<Checkbox
|
|
value="LAF"
|
|
style={{ lineHeight: "32px" }}
|
|
>
|
|
{t("joblines.fields.lbr_types.LAF")}
|
|
</Checkbox>
|
|
</Col>
|
|
<Col span={8}>
|
|
<Checkbox
|
|
value="LAG"
|
|
style={{ lineHeight: "32px" }}
|
|
>
|
|
{t("joblines.fields.lbr_types.LAG")}
|
|
</Checkbox>
|
|
</Col>
|
|
</Row>
|
|
</Checkbox.Group>
|
|
</Form.Item>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.percent")}
|
|
key={`${index}percent`}
|
|
name={[field.name, "percent"]}
|
|
>
|
|
<InputNumber min={0} max={100} />
|
|
</Form.Item>
|
|
<Form.Item
|
|
label={t("bodyshop.fields.md_tasks_presets.memo")}
|
|
key={`${index}memo`}
|
|
name={[field.name, "memo"]}
|
|
>
|
|
<Input />
|
|
</Form.Item>
|
|
<Space wrap>
|
|
<DeleteFilled
|
|
onClick={() => {
|
|
remove(field.name);
|
|
}}
|
|
/>
|
|
<FormListMoveArrows
|
|
move={move}
|
|
index={index}
|
|
total={fields.length}
|
|
/>
|
|
</Space>
|
|
</LayoutFormRow>
|
|
</Form.Item>
|
|
))}
|
|
<Form.Item>
|
|
<Button
|
|
type="dashed"
|
|
onClick={() => {
|
|
add();
|
|
}}
|
|
style={{ width: "100%" }}
|
|
>
|
|
{t("bodyshop.actions.add_task_preset")}
|
|
</Button>
|
|
</Form.Item>
|
|
</div>
|
|
);
|
|
}}
|
|
</Form.List>
|
|
</LayoutFormRow>
|
|
</>
|
|
);
|
|
}
|