Browse Source

Merge pull request 'dev-wahyun' (#105) from dev-wahyun into staging

Reviewed-on: ordo/adw-frontend#105
pull/2/head
ibnu 1 year ago
parent
commit
112fe2f95a
  1. 1
      .env
  2. 970
      src/const/ApiConst.js
  3. 2485
      src/views/Dashboard/DashboardProject.js
  4. 2
      src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
  5. 2949
      src/views/SimproV2/CreatedProyek/index.js
  6. 179
      src/views/SimproV2/Gantt/index.js

1
.env

@ -1,3 +1,4 @@
PORT=3000
CHOKIDAR_USEPOLLING=true
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true

970
src/const/ApiConst.js

File diff suppressed because it is too large Load Diff

2485
src/views/Dashboard/DashboardProject.js

File diff suppressed because it is too large Load Diff

2
src/views/SimproV2/CreatedProyek/DataRequestMaterial.js

@ -26,7 +26,7 @@ const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, mat
useEffect(() => {
if (idTask > 0) {
getDataRequestMaterial();
// getDataRequestMaterial();
}
}, [idTask])

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

File diff suppressed because it is too large Load Diff

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

@ -1,103 +1,114 @@
import React, { useEffect, useMemo, useState } from 'react';
import Timeline from 'react-calendar-timeline'
import 'react-calendar-timeline/lib/Timeline.css'
import { USER_VERSION_GANTT_SEARCH, BASE_SIMPRO_LUMEN, BASE_URL_GANTT } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi"
import { Fab, Action } from 'react-tiny-fab';
import 'react-tiny-fab/dist/styles.css';
import React, { useEffect, useMemo, useState } from "react";
import Timeline from "react-calendar-timeline";
import "react-calendar-timeline/lib/Timeline.css";
import {
USER_VERSION_GANTT_SEARCH,
BASE_SIMPRO_LUMEN,
BASE_URL_GANTT,
} from "../../../const/ApiConst";
import axios from "../../../const/interceptorApi";
import { Fab, Action } from "react-tiny-fab";
import "react-tiny-fab/dist/styles.css";
import { useHistory } from "react-router-dom";
import GanttFrame from './GanttFrame';
const token = localStorage.getItem("token")
import GanttFrame from "./GanttFrame";
const token = localStorage.getItem("token");
const userId = parseInt(localStorage.getItem("user_id"));
const HEADER = {
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
}
}
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
let roCount = 0;
const Gantt = (props) => {
const versionGanttId = props.match.params ? props.match.params.id : 0;
const idProject = props.match.params.project ? props.match.params.project : 0;
const timestamp = props.match.params.timestamp ? props.match.params.timestamp : 0;
const versionGanttId = props.match.params ? props.match.params.id : 0;
const idProject = props.match.params.project ? props.match.params.project : 0;
const timestamp = props.match.params.timestamp
? props.match.params.timestamp
: 0;
const [ro, setRo] = useState(1)
const [listUserGant, setListUserGantt] = useState([])
const [ready, setReady] = useState(false)
let history = useHistory();
const [ro, setRo] = useState(1);
const [listUserGant, setListUserGantt] = useState([]);
const [ready, setReady] = useState(false);
let history = useHistory();
useEffect(() => {
document.getElementsByClassName("breadcrumb-item active").innerHTML = "Gantt Project";
getDataUserGantt();
}, []);
useEffect(() => {
document.getElementsByClassName("breadcrumb-item active").innerHTML =
"Gantt Project";
getDataUserGantt();
}, []);
useEffect(() => {
cekPermission();
}, [listUserGant])
useEffect(() => {
cekPermission();
}, [listUserGant]);
useEffect(() => {
}, [ro])
useEffect(() => {}, [ro]);
const getDataUserGantt = async () => {
const payload = {
"columns": [
{ "name": "version_gantt_id", "logic_operator": "=", "value": versionGanttId, "operator": "AND" }
]
}
const result = await axios
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
.then(res => res)
.catch((error) => error.response);
const getDataUserGantt = async () => {
const payload = {
columns: [
{
name: "version_gantt_id",
logic_operator: "=",
value: versionGanttId,
operator: "AND",
},
],
};
const result = await axios
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.status == 200) {
setUserGantt(result.data.data);
} else {
cekPermission()
}
}
if (result && result.status == 200) {
setUserGantt(result.data.data);
} else {
cekPermission();
}
};
const setUserGantt = (data) => {
let newTargetKeys = []
data.map((val, index) => {
newTargetKeys.push(val.user_id)
});
setListUserGantt(newTargetKeys)
}
const setUserGantt = (data) => {
let newTargetKeys = [];
data.map((val, index) => {
newTargetKeys.push(val.user_id);
});
setListUserGantt(newTargetKeys);
};
const handleRedirect = () => {
history.push("/dashboard-project/"+idProject+"/"+versionGanttId);
}
const handleRedirect = () => {
history.push("/dashboard-project/" + idProject + "/" + versionGanttId);
};
const cekPermission = () => {
let check = listUserGant.includes(userId)
if (check) {
setRo(0)
} else {
setRo(1)
}
if (roCount >= 1) {
setReady(true)
}
roCount = roCount + 1;
}
const cekPermission = () => {
let check = listUserGant.includes(userId);
if (check) {
setRo(0);
} else {
setRo(1);
}
if (roCount >= 1) {
setReady(true);
}
roCount = roCount + 1;
};
return (
<>
<div style={{ margin: "-15px", marginBottom: "-30px" }}>
{ready && (
<GanttFrame
versionGanttId={versionGanttId}
idProject={idProject}
token={token}
ro={ro}
timestamp={timestamp}
/>
)}
</div>
</>
);
}
return (
<>
<div style={{ margin: "-15px", marginBottom: "-30px" }}>
{ready && (
<GanttFrame
versionGanttId={versionGanttId}
idProject={idProject}
token={token}
ro={ro}
timestamp={timestamp}
/>
)}
</div>
</>
);
};
export default Gantt;

Loading…
Cancel
Save