Browse Source

add calculate progress

pull/1/head
farhantock 11 months ago
parent
commit
b788b7ac7a
  1. 5
      src/const/ApiConst.js
  2. 29
      src/views/SimproV2/CreatedProyek/DialogHierarchy.js

5
src/const/ApiConst.js

@ -727,6 +727,11 @@ export const HIERARCHY_FTTH_DELETE = (id) => {
export const HIERARCHY_FTTH_TREE = (id) => {
return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/tree/${id}`;
};
export const HIERARCHY_FTTH_COUNT_TREE = (id) => {
return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/count-tree/${id}`;
};
export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`;
export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`;

29
src/views/SimproV2/CreatedProyek/DialogHierarchy.js

@ -5,7 +5,7 @@ import { Space, Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css';
import moment from 'moment';
import SweetAlert from 'react-bootstrap-sweetalert';
import { HIERARCHY_FTTH_DELETE, HIERARCHY_FTTH_TREE, VERSION_GANTT_SEARCH, HIERARCHY_FTTH_ADD, USER_LIST } from '../../../const/ApiConst';
import { HIERARCHY_FTTH_DELETE, HIERARCHY_FTTH_TREE, HIERARCHY_FTTH_COUNT_TREE, HIERARCHY_FTTH_ADD, USER_LIST } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications';
import DialogUserGantt from './DialogUserGantt';
@ -13,11 +13,8 @@ import DialogForm from './DialogFormHierarchy'
import DialogFormGantt from './DialogFormGantt';
import DialogGantt from './DialogGantt';
import { useTranslation } from 'react-i18next';
import { async } from '@dabeng/react-orgchart';
import { Link } from 'react-router-dom';
import { use } from 'i18next';
import _ from 'lodash';
const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => {
const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, dataViewStartDate }) => {
const token = localStorage.getItem("token")
const HEADER = {
headers: {
@ -98,6 +95,22 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
setOpenDialogFormGantt(true)
}
const handleHitungProgress = async (id) => {
const url = HIERARCHY_FTTH_COUNT_TREE(id)
const result = await axios
.get(url, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.status == 200) {
setLoading(false);
} else {
setLoading(false);
NotificationManager.error(`Data gagal dihitung silahkan coba lagi!`, 'Failed!!');
}
}
const handleViewGant = (id, name) => {
setParentId(id)
setParentName(name)
@ -196,11 +209,14 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
<Tooltip title="Tambah Data">
<Button size={"sm"} color='success' onClick={() => handleAddWithParent(text.id)}><i className="fa fa-plus"></i></Button>
</Tooltip>{" "}
<Tooltip title="Hitung Progress">
<Button size={"sm"} color='warning' onClick={() => handleHitungProgress(text.id)}><i className="fa fa-calculator"></i></Button>
</Tooltip>{" "}
<Tooltip title="Tambah Gantt">
<Button size={"sm"} color='primary' onClick={() => handleAddGant(text.id)}><i className="fa fa-gears"></i></Button>
</Tooltip>{" "}
{text.dataGantt && (<Tooltip title="Detail Gantt">
<Button size={"sm"} color='info' onClick={() => handleViewGant(text.id, text.name)}><i className="fa fa-info"></i></Button>
<Button size={"sm"} color='info' style={{ color: "#FFFFFF" }} onClick={() => handleViewGant(text.id, text.name)}><i className="fa fa-eye"></i></Button>
</Tooltip>)}
</>
,
@ -320,6 +336,7 @@ const DialogHierarchy = ({ openDialog, closeDialog, toggleDialog, idTask, proyek
hierarchyName={parentName}
idTask={idTask}
openDialogHierarchy={openDialog}
dataViewStartDate={dataViewStartDate}
/>
<DialogFormGantt
idTask={idTask}

Loading…
Cancel
Save