Prevent previously claimed tasks.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import {
|
||||
Alert,
|
||||
Checkbox,
|
||||
Col,
|
||||
Form,
|
||||
Radio,
|
||||
Row,
|
||||
Select,
|
||||
Skeleton,
|
||||
Space,
|
||||
Table,
|
||||
Spin,
|
||||
Typography,
|
||||
} from "antd";
|
||||
import React from "react";
|
||||
@@ -16,10 +14,8 @@ import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import EmployeeTeamSearchSelectComponent from "../employee-team-search-select/employee-team-search-select.component";
|
||||
import JobSearchSelectComponent from "../job-search-select/job-search-select.component";
|
||||
import ReadOnlyFormItemComponent from "../form-items-formatted/read-only-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import JobSearchSelectComponent from "../job-search-select/job-search-select.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -33,7 +29,12 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(TimeTicketTaskModalComponent);
|
||||
|
||||
export function TimeTicketTaskModalComponent({ bodyshop, form, loading }) {
|
||||
export function TimeTicketTaskModalComponent({
|
||||
bodyshop,
|
||||
form,
|
||||
loading,
|
||||
completedTasks,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -57,13 +58,18 @@ export function TimeTicketTaskModalComponent({ bodyshop, form, loading }) {
|
||||
</Form.Item>
|
||||
<Space wrap>
|
||||
<Form.Item name="task" label={t("timetickets.labels.task")}>
|
||||
<Radio.Group
|
||||
optionType="button"
|
||||
options={bodyshop.md_tasks_presets.presets.map((preset) => ({
|
||||
value: preset.name,
|
||||
label: preset.name,
|
||||
}))}
|
||||
/>
|
||||
{loading ? (
|
||||
<Spin />
|
||||
) : (
|
||||
<Radio.Group
|
||||
optionType="button"
|
||||
options={bodyshop.md_tasks_presets.presets.map((preset) => ({
|
||||
value: preset.name,
|
||||
label: preset.name,
|
||||
disabled: completedTasks.includes(preset.name),
|
||||
}))}
|
||||
/>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item dependencies={["task"]}>
|
||||
{() => {
|
||||
@@ -75,20 +81,24 @@ export function TimeTicketTaskModalComponent({ bodyshop, form, loading }) {
|
||||
if (!task) return null;
|
||||
return (
|
||||
<table className="bill-inventory-table">
|
||||
<tr>
|
||||
<td>{t("bodyshop.fields.md_tasks_presets.percent")}</td>
|
||||
<td>{`${theTaskPreset.percent || 0}%`}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{t("bodyshop.fields.md_tasks_presets.hourstype")}</td>
|
||||
<td>{theTaskPreset.hourstype.join(", ")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{t("bodyshop.fields.md_tasks_presets.nextstatus")}
|
||||
</td>
|
||||
<td>{theTaskPreset.nextstatus}</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{t("bodyshop.fields.md_tasks_presets.percent")}</td>
|
||||
<td>{`${theTaskPreset.percent || 0}%`}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{t("bodyshop.fields.md_tasks_presets.hourstype")}
|
||||
</td>
|
||||
<td>{theTaskPreset.hourstype.join(", ")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{t("bodyshop.fields.md_tasks_presets.nextstatus")}
|
||||
</td>
|
||||
<td>{theTaskPreset.nextstatus}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user