|
|
|
|
@ -28,8 +28,12 @@ export const MakeWorkingModal = ({ selectedIds, onClose, onSuccess }) => {
|
|
|
|
|
return await getPoints(params);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const [hasError, setHasError] = useState(false);
|
|
|
|
|
|
|
|
|
|
const [dataSource, setDataSource] = useState([]);
|
|
|
|
|
|
|
|
|
|
const [updateError, setUpdateError] = useState(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setDataSource(data?.results);
|
|
|
|
|
}, [data]);
|
|
|
|
|
@ -58,12 +62,19 @@ export const MakeWorkingModal = ({ selectedIds, onClose, onSuccess }) => {
|
|
|
|
|
|
|
|
|
|
const updateStatusPromise = updateStatus(updateStatusParams);
|
|
|
|
|
|
|
|
|
|
Promise.all([...updatePostamatPromises, updateStatusPromise]).then(() => {
|
|
|
|
|
queryClient.invalidateQueries(["on-approval-points"]);
|
|
|
|
|
setPopup(null);
|
|
|
|
|
onSuccess();
|
|
|
|
|
onClose();
|
|
|
|
|
});
|
|
|
|
|
Promise.all([...updatePostamatPromises, updateStatusPromise])
|
|
|
|
|
.then(() => {
|
|
|
|
|
queryClient.invalidateQueries(["on-approval-points"]);
|
|
|
|
|
setUpdateError(null);
|
|
|
|
|
setPopup(null);
|
|
|
|
|
onSuccess();
|
|
|
|
|
onClose();
|
|
|
|
|
})
|
|
|
|
|
.catch(() =>
|
|
|
|
|
setUpdateError(
|
|
|
|
|
"Введенные идентификаторы уже существуют, попробуйте другие"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
@ -73,13 +84,27 @@ export const MakeWorkingModal = ({ selectedIds, onClose, onSuccess }) => {
|
|
|
|
|
onCancel={onClose}
|
|
|
|
|
width={800}
|
|
|
|
|
footer={[
|
|
|
|
|
<Button key="ok-button" type="primary" onClick={handleUpdate}>
|
|
|
|
|
updateError && (
|
|
|
|
|
<span key="error" className="mr-2 text-primary">
|
|
|
|
|
{updateError}
|
|
|
|
|
</span>
|
|
|
|
|
),
|
|
|
|
|
<Button
|
|
|
|
|
key="ok-button"
|
|
|
|
|
type="primary"
|
|
|
|
|
onClick={handleUpdate}
|
|
|
|
|
disabled={hasError}
|
|
|
|
|
>
|
|
|
|
|
Обновить статус
|
|
|
|
|
</Button>,
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
{dataSource && (
|
|
|
|
|
<MakeWorkingTable data={dataSource} onChange={setDataSource} />
|
|
|
|
|
<MakeWorkingTable
|
|
|
|
|
data={dataSource}
|
|
|
|
|
onChange={setDataSource}
|
|
|
|
|
setHasError={setHasError}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
|