|
|
|
@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react'
|
|
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; |
|
|
|
|
import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap'; |
|
|
|
|
import axios from "../../../const/interceptorApi"; |
|
|
|
|
import { VERSION_GANTT_ADD, VERSION_GANTT_EDIT } from '../../../const/ApiConst'; |
|
|
|
|
import { VERSION_GANTT_ADD, VERSION_GANTT_EDIT, USER_VERSION_GANTT_ADD } from '../../../const/ApiConst'; |
|
|
|
|
import { Select } from 'antd'; |
|
|
|
|
import 'antd/dist/antd.css'; |
|
|
|
|
|
|
|
|
|
const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parentId, dataEdit, typeDialog}) => { |
|
|
|
|
const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parentId, dataEdit, typeDialog, user_id }) => { |
|
|
|
|
const token = localStorage.getItem("token") |
|
|
|
|
const HEADER = { |
|
|
|
|
headers: { |
|
|
|
@ -30,8 +30,7 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
useEffect(() => { |
|
|
|
|
if(typeDialog === "Edit") |
|
|
|
|
{ |
|
|
|
|
if (typeDialog === "Edit") { |
|
|
|
|
setId(dataEdit.id); |
|
|
|
|
setName(dataEdit.name_version); |
|
|
|
|
setDesctription(dataEdit.description); |
|
|
|
@ -77,6 +76,14 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask, parent
|
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
|
|
|
|
|
if (result && result.status == 200) { |
|
|
|
|
const formData = { |
|
|
|
|
user_id: user_id, |
|
|
|
|
version_gantt_id: result.data.id |
|
|
|
|
} |
|
|
|
|
await axios |
|
|
|
|
.post(USER_VERSION_GANTT_ADD, formData, HEADER) |
|
|
|
|
.then(res => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
closeDialog('Save') |
|
|
|
|
} else { |
|
|
|
|
closeDialog('failed') |
|
|
|
|