|
|
|
|
@ -2,16 +2,11 @@ import { Alert, Button, Modal, Spin } from "antd";
|
|
|
|
|
import { useQueryClient } from "@tanstack/react-query";
|
|
|
|
|
import { usePointSelection } from "../../../stores/usePointSelection";
|
|
|
|
|
import { STATUSES } from "../../../config";
|
|
|
|
|
import { useMemo, useState } from "react";
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import { useUpdateStatus } from "../../../hooks/useUpdateStatus";
|
|
|
|
|
import { ArrowRightOutlined } from "@ant-design/icons";
|
|
|
|
|
import { Title } from "../../../components/Title";
|
|
|
|
|
import { usePendingPointsFilters } from "../../../stores/usePendingPointsFilters";
|
|
|
|
|
import { useLastMLRun } from "../../../api.js";
|
|
|
|
|
|
|
|
|
|
const TASK_STATUSES = {
|
|
|
|
|
finished: "Завершено"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const TakeToWorkButton = ({ disabled }) => {
|
|
|
|
|
const { filters } = usePendingPointsFilters();
|
|
|
|
|
@ -19,11 +14,6 @@ export const TakeToWorkButton = ({ disabled }) => {
|
|
|
|
|
const { selection } = usePointSelection();
|
|
|
|
|
const queryClient = useQueryClient();
|
|
|
|
|
const [isModalOpened, setIsModalOpened] = useState(false);
|
|
|
|
|
const { data: statusData } = useLastMLRun();
|
|
|
|
|
|
|
|
|
|
const disableButton = useMemo(() => {
|
|
|
|
|
return statusData?.task_status !== TASK_STATUSES.finished
|
|
|
|
|
}, [statusData])
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
mutate: updateStatus,
|
|
|
|
|
@ -89,7 +79,7 @@ export const TakeToWorkButton = ({ disabled }) => {
|
|
|
|
|
block
|
|
|
|
|
className={"mt-2"}
|
|
|
|
|
onClick={() => setIsModalOpened(true)}
|
|
|
|
|
disabled={disabled || disableButton}
|
|
|
|
|
disabled={disabled}
|
|
|
|
|
>
|
|
|
|
|
<span className="mr-1">Взять в работу</span>
|
|
|
|
|
<ArrowRightOutlined />
|
|
|
|
|
|