Browse Source

fix: update props in gantt

pull/1/head
wahyun 6 months ago
parent
commit
3ee8461e69
  1. 5
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  2. 4
      src/views/SimproV2/CreatedProyek/index.js
  3. 20
      src/views/SimproV2/Gantt/index.js

5
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const { Option } = Select const { Option } = Select
const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => { const DialogGantt = ({ openDialog, closeDialog, role_name, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -134,7 +134,8 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
user_id, user_id,
company_id: companyId, company_id: companyId,
dataViewStartDate, dataViewStartDate,
companyName companyName,
role_name
} }
}}> }}>
<Tooltip title="Gantt"> <Tooltip title="Gantt">

4
src/views/SimproV2/CreatedProyek/index.js

@ -156,7 +156,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogDoc, setOpenDialogDoc] = useState(false); const [openDialogDoc, setOpenDialogDoc] = useState(false);
const [proyekName, setProyekName] = useState(""); const [proyekName, setProyekName] = useState("");
const [openDialogProyek, setOpenDialogProyek] = useState(false); const [openDialogProyek, setOpenDialogProyek] = useState(false);
const [companyId, setCompanyId] = useState(props.role_name !== 'Super Admin' ? company_id : 0); const [companyId, setCompanyId] = useState(role_name !== 'Super Admin' ? company_id : 0);
const [companyName, setCompanyName] = useState(''); const [companyName, setCompanyName] = useState('');
// project charter // project charter
const [projectCharter, setProjectCharter] = useState(null); const [projectCharter, setProjectCharter] = useState(null);
@ -1703,6 +1703,7 @@ const CreatedProyek = ({ params, ...props }) => {
token, token,
role_id, role_id,
user_id, user_id,
role_name,
company_id: text.company_id, company_id: text.company_id,
dataViewStartDate, dataViewStartDate,
companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name) companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name)
@ -2124,6 +2125,7 @@ const CreatedProyek = ({ params, ...props }) => {
companyName={companyName} companyName={companyName}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId} companyId={companyId}
role_name={role_name}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
/> />
), ),

20
src/views/SimproV2/Gantt/index.js

@ -3,26 +3,14 @@ import "react-calendar-timeline/lib/Timeline.css";
import {USER_VERSION_GANTT_SEARCH} from "../../../const/ApiConst"; import {USER_VERSION_GANTT_SEARCH} from "../../../const/ApiConst";
import axios from "../../../const/interceptorApi"; import axios from "../../../const/interceptorApi";
import "react-tiny-fab/dist/styles.css"; import "react-tiny-fab/dist/styles.css";
import { useHistory } from "react-router-dom"; import { useHistory, useLocation } from "react-router-dom";
import GanttFrame from "./GanttFrame"; import GanttFrame from "./GanttFrame";
let roCount = 0; let roCount = 0;
const Gantt = (props) => { const Gantt = (props) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', companyId = 0, all_project = null, role_name='', hierarchy=[], user_name='', companyName=''; const location = useLocation();
if (props && props.role_id && props.user_id) { const { isLogin, token, role_id, user_id, company_id, dataViewStartDate, companyName, role_name } = location.state || {};
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
companyId = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
companyName = props.companyName;
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -110,7 +98,7 @@ const Gantt = (props) => {
token={token} token={token}
ro={ro} ro={ro}
role_name={role_name} role_name={role_name}
companyId={companyId} companyId={company_id}
timestamp={timestamp} timestamp={timestamp}
company_name={companyName} company_name={companyName}
/> />

Loading…
Cancel
Save