- Progress Commit

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-03-20 22:19:52 -04:00
parent f31ae9ac6d
commit ab2323e5c1
11 changed files with 454 additions and 64 deletions

View File

@@ -0,0 +1,107 @@
import {Col, Form, Input, Row, Select, Switch} from "antd";
import React from "react";
import {useTranslation} from "react-i18next";
import {FormDatePicker} from "../form-date-picker/form-date-picker.component.jsx";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors.js";
import {connect} from "react-redux";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({});
export default connect(
mapStateToProps,
mapDispatchToProps
)(TaskUpsertModalComponent);
export function TaskUpsertModalComponent({form, bodyshop}) {
const {t} = useTranslation();
return (
<>
<Row gutter={[16, 16]}>
<Col span={8}>
<Form.Item
label={t("tasks.fields.completed")}
name="completed"
valuePropName="checked"
>
<Switch/>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
label={t("tasks.fields.assigned_to")}
name="assigned_to"
>
<Select placeholder={t("tasks.labels.selectemployee")}>
{bodyshop.employees.map((employee) => (
<Select.Option key={employee.id} value={employee.user_email}>
{employee.first_name} {employee.last_name}
</Select.Option>
))}
</Select>
</Form.Item>
</Col>
<Col span={8}>
<Form.Item
label={t("tasks.fields.priority")}
name="priority"
initialValue={1}
>
<Select
options={[
{value: 3, label: t("tasks.fields.priority.low")},
{value: 2, label: t("tasks.fields.priority.medium")},
{value: 1, label: t("tasks.fields.priority.high")},
]}
/>
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
label={t("tasks.fields.title")}
name="title"
rules={[
{
required: true,
},
]}
>
<Input placeholder={t("tasks.labels.titleplaceholder")}/>
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
label={t("tasks.fields.description")}
name="description"
>
<Input.TextArea
rows={4}
placeholder={t("tasks.labels.descriptionplaceholder")}
/>
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
label={t("tasks.fields.due_date")}
name="due_date"
>
<FormDatePicker/>
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
label={t("tasks.fields.remind_at")}
name="remind_at"
>
<FormDatePicker/>
</Form.Item>
</Col>
</Row>
</>
);
}