From 0fd633cd93fb261ef79f9365ddd3b3e5597596d7 Mon Sep 17 00:00:00 2001 From: farhantock Date: Tue, 28 Nov 2023 10:16:13 +0700 Subject: [PATCH 01/13] update menu in role --- src/views/Master/MasterRoles/DialogForm.js | 80 +++++------------- .../Master/MasterRoles/DialogMenuRoles.js | 84 ++++++------------- 2 files changed, 46 insertions(+), 118 deletions(-) diff --git a/src/views/Master/MasterRoles/DialogForm.js b/src/views/Master/MasterRoles/DialogForm.js index 966c5ee..fab37b4 100644 --- a/src/views/Master/MasterRoles/DialogForm.js +++ b/src/views/Master/MasterRoles/DialogForm.js @@ -5,7 +5,7 @@ import 'antd/dist/antd.css'; import { withTranslation } from 'react-i18next'; import axios from 'axios'; import { Select } from 'antd'; -import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js'; +import { MENU_SEARCH } from '../../../const/ApiConst.js'; const { Option } = Select const token = window.localStorage.getItem('token'); @@ -18,7 +18,6 @@ const config = { } }; - class DialogForm extends Component { constructor(props) { super(props) @@ -30,6 +29,7 @@ class DialogForm extends Component { isParentClick: false, menu: [], selectedMenu: null, + company_id } } @@ -61,60 +61,21 @@ class DialogForm extends Component { } getAllMenu = async () => { - const { companyID } = this.props; - const { roleName } = this.props; - if (roleName !== "Super Admin") { - const payload = { - "paging": { - "start": 0, - "length": -1 - }, - "columns": [{ - "name": "company_id", - "logic_operator": "=", - "value": companyID, - "operator": "AND" - }], - "joins": [{ - "name": "m_menu", - "column_join": "menu_id", - "column_results": [ - "name" - ] - }], - "orders": { "columns": ["id"], "ascending": false } - } - const result = await axios - .post(MENU_COMPANY_SEARCH, payload, config) - .then(res => res) - .catch((error) => error.response); - if (result && result.data && result.data.code == 200) { - this.setState({ menu: result.data.data }); - } - - } else { - const payload = { - "paging": { - "start": 0, - "length": -1 - }, - "columns": [{ - "name": "name", - "logic_operator": "ilike", - "value": "", - "operator": "AND" - }], - "orders": { "columns": ["id"], "ascending": false } - } - const result = await axios - .post(MENU_SEARCH, payload, config) - .then(res => res) - .catch((error) => error.response); - if (result && result.data && result.data.code == 200) { - this.setState({ menu: result.data.data }); - } + const payload = { + "paging": { "start": 0, "length": -1 }, + "columns": [ + { "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" } + ], + "joins": [], + "orders": { "columns": ["id"], "ascending": false } + } + const result = await axios + .post(MENU_SEARCH, payload, config) + .then(res => res) + .catch((error) => error.response); + if (result && result.data && result.data.code == 200) { + this.setState({ menu: result.data.data }); } - } showDialog = () => { @@ -133,13 +94,12 @@ class DialogForm extends Component { } handleSave = () => { - const { companyID } = this.props; const { id, name, description, selectedMenu, - + company_id } = this.state let data = ''; @@ -151,7 +111,7 @@ class DialogForm extends Component { name, description, selectedMenu, - company_id: companyID + company_id } // console.log('data', data); this.props.closeDialog('save', data); @@ -161,7 +121,7 @@ class DialogForm extends Component { name, description, selectedMenu, - company_id: companyID + company_id } this.props.closeDialog('edit', data); } @@ -206,7 +166,7 @@ class DialogForm extends Component { }}> {this.state.menu.map((item) => ( ))} diff --git a/src/views/Master/MasterRoles/DialogMenuRoles.js b/src/views/Master/MasterRoles/DialogMenuRoles.js index 6826a8b..cec1b42 100644 --- a/src/views/Master/MasterRoles/DialogMenuRoles.js +++ b/src/views/Master/MasterRoles/DialogMenuRoles.js @@ -3,8 +3,9 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'rea import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import 'antd/dist/antd.css'; import axios from 'axios'; -import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js'; +import { MENU_SEARCH } from '../../../const/ApiConst.js'; import { withTranslation, WithTranslation } from 'react-i18next'; +const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; const token = window.localStorage.getItem('token'); @@ -51,61 +52,30 @@ class DialogMenuRoles extends Component { } getAllMenu = async () => { - const { companyID } = this.props; - const { roleName } = this.props; - if (roleName !== "Super Admin") { - const payload = { - "paging": { - "start": 0, - "length": -1 - }, - "columns": [{ - "name": "company_id", - "logic_operator": "=", - "value": companyID, - "operator": "AND" - }], - "joins": [{ - "name": "m_menu", - "column_join": "menu_id", - "column_results": [ - "name" - ] - }], - "orders": { "columns": ["id"], "ascending": false } - } - const result = await axios - .post(MENU_COMPANY_SEARCH, payload, config) - .then(res => res) - .catch((error) => error.response); - if (result && result.data && result.data.code == 200) { - this.setState({ menu: result.data.data }, () => { - this.setStateMenu(false); - }); - } else { - } + const payload = { + "paging": { "start": 0, "length": -1 }, + "columns": [ + { "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" } + ], + "joins": [], + "orders": { "columns": ["id"], "ascending": false } + } + + + + const result = await axios + .post(MENU_SEARCH, payload, config) + .then(res => res) + .catch((error) => error.response); + + + if (result && result.data && result.data.code == 200) { + this.setState({ menu: result.data.data }, () => { + this.setStateMenu(false); + }); } else { - const payload = { - "paging": { - "start": 0, - "length": -1 - }, - "columns": [{ - "name": "name", - "logic_operator": "ilike", - "value": "", - "operator": "AND" - }], - "orders": { "columns": ["id"], "ascending": false } - } - const result = await axios - .post(MENU_SEARCH, payload, config) - .then(res => res) - .catch((error) => error.response); - if (result && result.data && result.data.code == 200) { - this.setState({ menu: result.data.data }); - } } + } setStateMenu = edit => { @@ -126,14 +96,13 @@ class DialogMenuRoles extends Component { let copyStateMenu = [...this.state.stateMenu]; this.props.menuRoles.map((val, indexMenu) => { let index = this.getIndexDataMenu(val.menu_id); - console.log('index true', index); + console.log("index true", val.menu_id); if (index >= 0) { copyStateMenu[index] = true; } }) this.setState({ stateMenu: [] }, () => { let check = copyStateMenu.some(this.checkArray); - console.log('icheck', check); if (check === false) { this.setState({ allChecked: true, stateMenu: copyStateMenu }) } else { @@ -182,12 +151,11 @@ class DialogMenuRoles extends Component { renderForm = () => { const { menu, stateMenu } = this.state - console.log('stateMenu', stateMenu); return ( menu.map((val, index) => { return ( - {val.join_first_name ?? val.name} + {val.name} this.handleChangeCheckbox(e.target.checked, index)} defaultChecked={stateMenu[index]} /> ) From 160876b51c0478129a063bcb57fb32b5baeb5070 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Wed, 29 Nov 2023 00:20:41 +0700 Subject: [PATCH 02/13] comment error response --- src/views/Dashboard/DashboardBOD.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 61742de..5d14a67 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -132,7 +132,7 @@ const DashboardBOD = (props) => { } if (result.status !== 200) { - NotificationManager.error(`${content} ${result.data.message}`, "Failed"); + // NotificationManager.error(`${content} ${result.data.message}`, "Failed"); SET_READY_PROJECT_BY_SCHEDULE_HEALTH(true) return; } @@ -203,7 +203,7 @@ const DashboardBOD = (props) => { } if (result.status !== 200) { - NotificationManager.error(`${content} ${result.data.message}`, "Failed"); + // NotificationManager.error(`${content} ${result.data.message}`, "Failed"); SET_READY_PROJECT_SCHEDULE_BUDGET_HEALTH_PER_DIVISION(true); return; } From 4f70295928697e75f17836b78106152677fe3cef Mon Sep 17 00:00:00 2001 From: farhantock Date: Tue, 5 Dec 2023 13:33:33 +0700 Subject: [PATCH 03/13] project carousell --- src/routes.js | 2 +- src/views/Dashboard/DashboardBOD.js | 58 +- .../Dashboard/DashboardProjectCarousell.js | 1782 +++++------------ 3 files changed, 518 insertions(+), 1324 deletions(-) diff --git a/src/routes.js b/src/routes.js index d20246d..2719201 100644 --- a/src/routes.js +++ b/src/routes.js @@ -56,7 +56,7 @@ const routes = [ { path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD }, { path: '/dashboard-customer/:PROJECT_ID/:GANTT_ID/:SCURVE', name: 'DashboardCustomer', component: DashboardCustomer }, { path: '/dashboard-project/:PROJECT_ID/:GANTT_ID', exact: true, name: 'Dashboard Project', component: DashboardProject }, - { path: '/dashboard-project-carousell', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell }, + { path: '/dashboard-perproject', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell }, { path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:SCURVE', exact: true, name: 'Dashboard Project', component: DashboardProject }, { path: '/projects', exact: true, name: 'Projects', component: CreatedProyek }, { path: '/projects/:id/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity }, diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 61742de..7ecb083 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -15,18 +15,18 @@ import { HealthByBudget, HealthBySchedule } from './Components'; import { Link } from 'react-router-dom'; const DashboardBOD = (props) => { - let role_id = '', user_id='',isLogin='',token=''; - if (props.location.state && props.location.state.role_id && props.location.state.user_id) { - role_id = props.location.state.role_id; - user_id = props.location.state.user_id; - token = props.location.state.token; - isLogin = props.location.state.isLogin; - } else { - role_id = localStorage.getItem("role_id"); - user_id = localStorage.getItem("user_id"); - token = localStorage.getItem("token"); - isLogin = localStorage.getItem("isLogin"); - } + let role_id = '', user_id = '', isLogin = '', token = ''; + if (props.location.state && props.location.state.role_id && props.location.state.user_id) { + role_id = props.location.state.role_id; + user_id = props.location.state.user_id; + token = props.location.state.token; + isLogin = props.location.state.isLogin; + } else { + role_id = localStorage.getItem("role_id"); + user_id = localStorage.getItem("user_id"); + token = localStorage.getItem("token"); + isLogin = localStorage.getItem("isLogin"); + } const HEADER = { headers: { "Content-Type": "application/json", @@ -256,9 +256,9 @@ const DashboardBOD = (props) => { return; } - if (result.status == 200 && result.data.data) { - let dataRes = result.data.data; - const filteredData = dataRes.filter(item => item.parent === null); + if (result.status == 200 && result.data.data) { + let dataRes = result.data.data; + const filteredData = dataRes.filter(item => item.parent === null); SET_PROJECT_PER_DIVISION(filteredData); } SET_READY_PROJECT_PER_DIVISION(true); @@ -317,16 +317,16 @@ const DashboardBOD = (props) => { let tableData = []; result.data.data.map((item, idx) => { let statusHealthBySchedule = 'on-schedule'; - let planningProgress = 0; - let actualProgress = 0; - let selisihProgress = 0; + let planningProgress = 0; + let actualProgress = 0; + let selisihProgress = 0; - if(item.scurve && item.scurve[0]) { - planningProgress = item.scurve[0].data.percentagePlan[item.scurve[0].data.percentagePlan.length - 1] - actualProgress = item.scurve[0].data.percentageReal[item.scurve[0].data.percentageReal.length - 1] - } + if (item.scurve && item.scurve[0]) { + planningProgress = item.scurve[0].data.percentagePlan[item.scurve[0].data.percentagePlan.length - 1] + actualProgress = item.scurve[0].data.percentageReal[item.scurve[0].data.percentageReal.length - 1] + } - selisihProgress = planningProgress - actualProgress + selisihProgress = planningProgress - actualProgress if (selisihProgress > 0 && selisihProgress <= 5) { statusHealthBySchedule = 'warning' @@ -433,12 +433,12 @@ const DashboardBOD = (props) => {
- -
- View All Gantt -
- -
+ +
+ All Dashboard +
+ + :
diff --git a/src/views/Dashboard/DashboardProjectCarousell.js b/src/views/Dashboard/DashboardProjectCarousell.js index 5d37ea0..9b21734 100644 --- a/src/views/Dashboard/DashboardProjectCarousell.js +++ b/src/views/Dashboard/DashboardProjectCarousell.js @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useRef, useState } from "react"; import axios from "axios"; -import { Row, Col, Button, Input,Spin } from "antd"; +import { Row, Col, Button, Input, Spin } from "antd"; import { CardDashboard, CardExpenditure, @@ -77,14 +77,8 @@ const DashboardProject = (args) => { Authorization: `Bearer ${token}`, }, }; - const { PROJECT_ID } = useParams(); - const mapRef = useRef(); - const [mymap, setMymap] = useState(null); const [activeTabIdx, setActiveTabIdx] = useState(0); const [activeTabCommentIdx, setActiveTabCommentIdx] = useState(0); - const [planningProgress, setPlanningProgress] = useState(0); - const [actualProgress, setActualProgress] = useState(0); - const [isReadyComments, setIsReadyComments] = useState(false); const [isSendingComment, setIsSendingComment] = useState(false); const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false); const [isReadySCurve, setIsReadySCurve] = useState(false); @@ -95,23 +89,17 @@ const DashboardProject = (args) => { const [healthBySchedule, setHealthBySchedule] = useState("-"); const [allDataMaster, sourceData] = useState([]); const [isHierarchy, setIsHierarchy] = useState(false); - let history = useHistory(); // Carousell const [activeIndex, setActiveIndex] = useState(0); const [animating, setAnimating] = useState(false); const [loading, setLoading] = useState(true); + const [carouselPaused, setCarouselPaused] = useState(false); useEffect(() => { setLoading(true); - getReportDistribution(); - },[]); - - useEffect(() => { - if (activeTabIdx === 1) { - initMap(); - } - }, [activeTabIdx]); + getAllData(); + }, []); const getAllData = async () => { setIsReadyProjectDetail(false); @@ -141,7 +129,7 @@ const DashboardProject = (args) => { return; } else if (result.status == 200 && result.data.data) { const dataResault = result.data.data; - console.log("Resault Data",dataResault); + console.log("Resault Data", dataResault); sourceData(dataResault); setIsReadyGantt(true); setIsReadyProjectDetail(true); @@ -158,63 +146,6 @@ const DashboardProject = (args) => { } }; - const getReportDistribution = async () => { - const URL = `${BASE_OSPRO}/api/project/get-report-distribution`; - const payload = { - project_id: 138, - start_date: moment() - .startOf("month") - .subtract(1, "years") - .format("YYYY-MM-DD"), - end_date: moment(new Date()).subtract(1, "years").format("YYYY-MM-DD"), - }; - const result = await axios - .post(URL, payload, HEADER) - .then((res) => res) - .catch((err) => err.response); - console.log("getReportDistribution", result); - if (!result) { - NotificationManager.error(`Could not connect to internet.`, "Failed"); - return; - } - - if (result.status !== 200) { - NotificationManager.error( - `Get report distribution failed, ${result.data.message}`, - "Failed" - ); - setLoading(false); - return; - } else if (result.status == 200 && result.data.data) { - setLoading(false); - setReportDistribution(result.data.data); - } - }; - - const initMap = () => { - let mymap = L.map("map-area", { - center: center, - zoom: 13, - }); - - setMymap(mymap); - L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { - attribution: - '© OpenStreetMap contributors', - }).addTo(mymap); - }; - - useEffect(() => { - if (mymap) { - if (reportDistribution.length > 0) { - reportDistribution.map((item, idx) => { - L.marker([item.lat, item.lon]) - .addTo(mymap) - .bindPopup(PopupContent(item)); - }); - } - } - }, [mymap, reportDistribution]); useEffect(() => { // Add event listener for receiving messages from the iframe @@ -238,1283 +169,555 @@ const DashboardProject = (args) => { } }; - const next = () => { - if (animating) return; - const nextIndex = activeIndex === dummyData.length - 1 ? 0 : activeIndex + 1; - setActiveIndex(nextIndex); - }; + const next = () => { + if (animating) return; + const nextIndex = activeIndex === allDataMaster.length - 1 ? 0 : activeIndex + 1; + setActiveIndex(nextIndex); + }; - const previous = () => { - if (animating) return; - const nextIndex = activeIndex === 0 ? dummyData.length - 1 : activeIndex - 1; - setActiveIndex(nextIndex); - }; + const previous = () => { + if (animating) return; + const nextIndex = activeIndex === 0 ? allDataMaster.length - 1 : activeIndex - 1; + setActiveIndex(nextIndex); + }; - const goToIndex = (newIndex) => { - if (animating) return; - setActiveIndex(newIndex); - }; + const goToIndex = (newIndex) => { + if (animating) return; + setActiveIndex(newIndex); + }; - const dummyData = [ - { - "project": { - "id": 138, - "nama":"Survey Tanah Bidang", - "budget_health":"on-budget", - "schedule_health":"on-schedule", - "company": "Kementrian PUPR", - "gantt": { - "gantt_id": 896, - "name_version":"Proses Tender", - } - }, - "manpower":1, - "assigned":0, - "actual":0, - "project_manager": "FATHAN", - "activity" : { - "start_date":"-", - "end_date":"13 September 2023", - "planned_start":"-", - "planned_end":"-", - "planning":0, - "actual":0 - }, - "key":1 - }, - { - "project": { - "id": 138, - "nama":"Survey Tanah Bidang", - "budget_health":"on-budget", - "schedule_health":"on-schedule", - "company": "Kementrian PUPR", - "gantt": { - "gantt_id": 897, - "name_version":"Eksekusi", - } - }, - "manpower":1, - "assigned":0, - "actual":0, - "project_manager": "FATHAN", - "activity" : { - "start_date":"11 September 2023", - "end_date":"11 September 2023", - "planned_start":"-", - "planned_end":"-", - "planning":0, - "actual":0 - }, - "key":2 - }, - { - "project": { - "id": 138, - "nama":"Survey Tanah Bidang", - "budget_health":"on-budget", - "schedule_health":"on-schedule", - "company": "Kementrian PUPR", - "gantt": { - "gantt_id": 898, - "name_version":"Document meeting", - } - }, - "manpower":1, - "assigned":0, - "actual":0, - "project_manager": "FATHAN", - "activity" : { - "start_date":"11 September 2023", - "end_date":"11 September 2023", - "planned_start":"-", - "planned_end":"-", - "planning":0, - "actual":0 - }, - "key":3 - } - ] - // const slides = allDataMaster.map((item, index) => { - // let URL_GANTT = ""; - // let version_gantt = ""; - // item.project.gantt.map((itemGantt, index) => { - // URL_GANTT = `http://localhost:8444/adw-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${itemGantt.gantt_id}&proyek_id=${itemGantt.proyek_id}&token=${token}&ro=1`; - // version_gantt = itemGantt.name_version - // }); - // const today = moment(); - // const assignedList = item.assigned - // .filter((itemAssigned) => - // today.isBetween(moment(itemAssigned.start_date), moment(itemAssigned.end_date)) - // ) - // .map((itemMap) => itemMap.user_id); - // // SCurve - // let statusHealthBySchedule = "on-schedule"; - // let selisihProgress = 0; - // let SetplanningProgress = 0; - // let SetactualProgress = 0; - // let now = new Date().toISOString().slice(0, 10); - // let dates = item.SCurve[0].data?.date; - // let n = dates.findIndex( - // (element) => new Date(now) < new Date(element) - // ); - // if ( - // item.SCurve[0].length > 0 && - // item.SCurve[0].data?.percentagePlan && - // item.SCurve[0].data?.percentagePlan.length > 0 - // ) { - // SetplanningProgress = item.SCurve[0].data?.percentagePlan[n]; - // if (n < 0) { - // SetplanningProgress = 100; - // } - // } - // if ( - // item.SCurve[0].length > 0 && - // item.SCurve[0].data?.percentageReal && - // item.SCurve[0].data?.percentageReal.length > 0 - // ) { - // SetactualProgress = - // item.SCurve[0].data?.percentageReal[ - // item.SCurve[0].data?.percentageReal.length - 1 - // ]; - // } - // selisihProgress = SetplanningProgress - SetactualProgress; - // if (selisihProgress > 0 && selisihProgress <= 5) { - // statusHealthBySchedule = "warning"; - // } else if (selisihProgress > 5) { - // statusHealthBySchedule = "danger"; - // } - // return ( - // setAnimating(true)} - // onExited={() => setAnimating(false)} - // key={parseInt(item.key)}> - // - // - // - // - //
- //
- //
- //
- // Project - //
- //
- // {isReadyProjectDetail && - // isReadyGantt ? ( - // (() => { - // let parentNames = ""; - // if (item.hierarchy.length > 0) - // { - // for ( let i = item.hierarchy.length - 1; i >= 0; i--) { - // parentNames += " - "; - // parentNames += item.hierarchy[i].name; - // } - // } - // return item.project.nama + - // parentNames + - // " - " + - // version_gantt - // })() - // ) : ( - // - // )} - //
- //
- //
- // - //
- //
- //
- // - // - //
- //
- //
- //
- // Project Manager - //
- //
- // {isReadyProjectDetail ? ( - // item.project_manager - // ) : ( - // - // )} - //
- //
- //
- // - //
- //
- //
- // - // - //
- //
- //
- //
- // Customer - //
- //
- // {isReadyProjectDetail ? ( - // item.project.company - // ) : ( - // - // )} - //
- //
- //
- // - //
- //
- //
- // - //
- // - // - //
- //
- //
- //
- // Schedule - //
- //
- //
- // - // - // - // Planned Start - // - // - // {isReadyProjectDetail ? ( - // item.activity.planned_start ? ( - // moment(item.activity.planned_start).format("D MMMM YYYY") - // ) : ( - // "-" - // ) - // ) : ( - // - // )} - // - // - // - // - // - // Actual Start - // - // - // {isReadyProjectDetail ? ( - // item.activity.start_date ? ( - // moment(item.activity.start_date).format("D MMMM YYYY") - // ) : ( - // "-" - // ) - // ) : ( - // - // )} - // - // - // - // - // - // Planned Finish - // - // - // {isReadyProjectDetail ? ( - // item.activity.planned_end ? ( - // moment(item.activity.planned_end).format("D MMMM YYYY") - // ) : ( - // "-" - // ) - // ) : ( - // - // )} - // - // - // - // - // - // Estimated Finish - // - // - // {isReadyProjectDetail ? ( - // item.activity.end_date ? ( - // moment(item.activity.end_date).format("D MMMM YYYY") - // ) : ( - // "-" - // ) - // ) : ( - // - // )} - // - // - //
- //
- //
- // - //
- //
- // - // - //
setActiveTabIdx(0)} - // > - // S Curve - //
- // - // - //
setActiveTabIdx(1)} - // > - // Maps - //
- // - //
- // - // - //
- //
- // - //
- // {activeTabIdx === 1 && ( - //
- // )} - //
- // - //
- //
- // - // - //
- // - // - //
- //
- // Progress - //
- // {isReadySCurve ? ( - // 100 ? 100 : SetplanningProgress} - // /> - // ) : ( - // - // )} - //
- // {isReadySCurve ? ( - // 100 || SetactualProgress > 100 - // ? parseFloat( - // (SetactualProgress / SetplanningProgress) * 100 - // ).toFixed(0) - // : SetactualProgress - // } - // /> - // ) : ( - // - // )} - //
- // - //
- // - // - //
- // {isReadyOverdueActivities && ( - // - // )} - // {isReadySCurve && ( - // - // )} - //
- // - // - // - // - //
- // Manpower : {item.manpower} - //
- // - //
- // - // - //
- // Assigned: {item.assigned && assignedList.length} - //
- // - // - //
- // Actual : {item.actual} - //
- // - //
- // - //
- // - // - //
- // - // - //
setActiveTabCommentIdx(0)} - // > - // Behind Task - //
- // - // - //
setActiveTabCommentIdx(1)} - // > - // Comment From Customer - //
- // - //
- //
- // {activeTabCommentIdx === 0 && ( - //
- // {isReadyOverdueActivities && item.overdueActivities != [] && item.overdueActivities.length > 0 ? ( - // item.overdueActivities.map((overdueItem, idx) => { - // let end_date; - // let planned_end; - // let diffDays = 0; - // let message = ""; - // if (overdueItem.end_date && overdueItem.end_date !== null) { - // end_date = moment(overdueItem.end_date); - // planned_end = moment(overdueItem.planned_end); - // diffDays = end_date.diff(planned_end, "days"); + const renderProjectIssues = (issues) => { + return issues.map((data, index) => ( +
+
Tingkat Kepelikan Isu {data.level_issue}
+
Penjelasan {data.description}
+
+ )); + }; + - // if (isNaN(diffDays)) { - // return null; - // } else { - // if (diffDays > 0) { - // message = `Overdue by ${diffDays + 1} days`; - // } else { - // return null; - // } - // } - // } + const renderProjectRisks = (risks) => ( + risks.map((data, index) => ( +
+
Tingkat Dampak Resiko {data.level_risk}
+
Penjelasan {data.description}
+
Pencegahan {data.preventive_risk}
+
+ )) + ); - // return ; - // }) - // ) : ( - //
- // No overdue activity found. - //
- // )} - //
- // )} - // {activeTabCommentIdx === 1 &&( - //
- // {item.project_comment && item.project_comment != [] ? ( - // item.project_comment.map((commentItem, idx) => { - // return - // }) - // ) : ( - //
- // No comments found. - //
- // )} - //
- // )} - //
- //
- // - //
- //
- // - //
- // - //
- // ); - // }); - const slides = dummyData.map((item, index) => { - const URL_GANTT = `https://konstruksi-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${item.project.gantt.gantt_id}&proyek_id=${item.project.id}&token=${token}&ro=1`; + const slides = allDataMaster.map((item, index) => { + let URL_GANTT = ""; + let version_gantt = ""; + if (item.gantt !== null) { + URL_GANTT = `http://localhost:8444/adw-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${item.gantt.id}&proyek_id=${item.gantt.proyek_id}&token=${token}&ro=1`; + version_gantt = item.gantt.name_version + } else { + URL_GANTT = ""; + version_gantt = ""; + } + return ( setAnimating(true)} onExited={() => setAnimating(false)} key={parseInt(item.key)}> - - - - + + + + +
-
- Project -
-
- {item.project ? ( - item.project.nama + "-" + item.project.gantt.name_version - ) : ( - - )} -
+ Project
-
- +
+ {item.project ? ( + item.project.nama + "-" + item.project?.gantt?.name_version + ) : ( + + )}
+
+ +
- - +
+ + +
-
- Project Manager -
-
- {item.project_manager ? ( - item.project_manager - ) : ( - - )} -
+ Project Manager
-
- +
+ {item.project_manager ? ( + item.project_manager + ) : ( + + )}
+
+ +
- - +
+ + +
-
- Customer -
-
- {item.project ? ( + Customer +
+
+ {item.project ? ( + item.project.company !== "" && item.project.company !== undefined ? ( item.project.company ) : ( - - )} -
-
-
- + "-" + ) + ) : ( + + )} +
+
+ +
- - +
+ + + + +
+
+ Schedule +
+ + + + + + Planned Start + + + {item.project ? ( + item.project.mulai_proyek + ) : ( + + )} + + + + + + Planned Finish + + + {item.project ? ( + item.project.akhir_proyek + ) : ( + + )} + + + + + + + + Actual Start + + + {item.activity ? ( + item.activity.start_date + ) : ( + + )} + + + + + + Actual Finish + + + {item.activity ? ( + item.activity.end_date + ) : ( + + )} + + + + +
+ +
+
- +
setActiveTabIdx(0)} > -
-
-
- Schedule -
-
-
- - - - Planned Start - - - {item.activity ? ( - item.activity.planned_start - ) : ( - - )} - - - - - - Actual Start - - - {item.activity ? ( - item.activity.start_date - ) : ( - - )} - - - - - - Planned Finish - - - {item.activity ? ( - item.activity.planned_end - ) : ( - - )} - - - - - - Estimated Finish - - - {item.activity ? ( - item.activity.end_date - ) : ( - - )} - - -
-
+ S Curve +
+ + +
setActiveTabIdx(1)} + > + Issue & Risk
-
- - + + +
setActiveTabIdx(0)} > - S Curve +
- - + {activeTabIdx === 1 && ( + + +
+ Issue +
+
+ {console.log('item.project_issue', item.project_issue)} + {item.project_issue && item.project_issue.length > 0 ? ( + renderProjectIssues(item.project_issue) + ) :
+ tidak ada data +
} +
+ + +
+ Risk +
+
+ {console.log('item.project_risk', item.project_risk)} + {item.project_risk && item.project_risk.length > 0 ? ( + renderProjectRisks(item.project_risk) + ) :
+ tidak ada data +
} +
+ +
+ )} +
+ +
+
+ + +
+ + +
setActiveTabIdx(1)} > - Maps + Progress
- - - - -
+ {item.activity ? ( + 100 ? 100 : item.activity.planning} + /> + ) : ( + + )} +
+ {item.activity ? ( + 100 || item.activity.actual > 100 + ? parseFloat( + (item.activity.actual / item.activity.planning) * 100 + ).toFixed(0) + : item.activity.actual + } + /> + ) : ( + + )} +
+ +
+ + +
+ {item.project.budget_health && ( + + )} + {item.project.schedule_health && ( + + )} +
+ + + +
- + Manpower : {item.manpower}
- {activeTabIdx === 1 && ( -
- )} -
- -
-
- - -
- - -
+ + + +
- Progress + Assigned: {item.assigned}
- {item.activity ? ( - 100 ? 100 : item.activity.planning} - /> - ) : ( - - )} -
- {item.activity ? ( - 100 || item.activity.actual > 100 - ? parseFloat( - (item.activity.actual / item.activity.planning) * 100 - ).toFixed(0) - : item.activity.actual - } - /> - ) : ( - - )} -
- -
- - -
- {item.project.budget_health && ( - - )} - {item.project.schedule_health && ( - - )} -
- - - - -
- Manpower : {item.manpower} -
- -
- + + +
+ Actual : {item.actual} +
+ +
+ +
+ + +
+
setActiveTabCommentIdx(0)} > - Assigned: {item.assigned} + Behind Task
setActiveTabCommentIdx(1)} > - Actual : {item.actual} + Comment From Customer
- - - -
- - -
setActiveTabCommentIdx(0)} - > - Behind Task -
- - -
setActiveTabCommentIdx(1)} - > - Comment From Customer -
- -
-
{activeTabCommentIdx === 0 && ( -
{ > No overdue activity found.
- )} + )} {activeTabCommentIdx === 1 && ( <> -
-