diff --git a/public/OSPRO.ico b/public/OSPRO.ico new file mode 100644 index 0000000..1135207 Binary files /dev/null and b/public/OSPRO.ico differ diff --git a/public/index.html b/public/index.html index 9b60c7b..0529c99 100644 --- a/public/index.html +++ b/public/index.html @@ -8,13 +8,13 @@ - OSPRO + OSPRO - + - + \ No newline at end of file diff --git a/src/App.js b/src/App.js index 5125e75..f46e383 100644 --- a/src/App.js +++ b/src/App.js @@ -18,6 +18,22 @@ const Page500 = React.lazy(() => import('./views/Pages/Page500')); const SiopasMap = React.lazy(() => import('./views/Map')); class App extends Component { + componentDidMount() { + + try { + const storedData = localStorage.getItem('configApp'); + if (storedData !== null) { + const data = JSON.parse(storedData); + const htmlTitle = data.html_title || 'OSPRO'; + document.title = htmlTitle; + } else { + document.title = 'OSPRO'; + } + } catch (error) { + document.title = 'OSPRO'; + } + } + render() { return ( diff --git a/src/const/en.json b/src/const/en.json index c733e7c..07b20a3 100644 --- a/src/const/en.json +++ b/src/const/en.json @@ -12,6 +12,7 @@ "birthPlace": "Birth Place", "birthDate": "Birth Date", "ChecklistK3Add": "Add Checklist K3", + "company": "Company Name", "cancel": "Cancel", "close": "Close", "color": "Color", diff --git a/src/const/id.json b/src/const/id.json index 353a609..92b395a 100644 --- a/src/const/id.json +++ b/src/const/id.json @@ -12,6 +12,7 @@ "birthPlace": "Tempat Lahir", "birthDate": "Tanggal Lahir", "ChecklistK3Add": "Tambah Ceklis K3", + "company": "Nama Perusahaan", "cancel": "Batal", "close": "Tutup", "color": "Warna", diff --git a/src/containers/DefaultLayout/DefaultHeader.js b/src/containers/DefaultLayout/DefaultHeader.js index c923679..697af47 100644 --- a/src/containers/DefaultLayout/DefaultHeader.js +++ b/src/containers/DefaultLayout/DefaultHeader.js @@ -4,7 +4,8 @@ import { Badge, Nav, NavItem } from 'reactstrap'; import PropTypes from 'prop-types'; import { Menu, Dropdown } from 'antd' import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE } from '../../const/ApiConst'; - +import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react'; +import logo_ospro from '../../assets/img/OSPRO.png' import axios from 'axios'; import './Default.css' const token = window.localStorage.getItem('token'); @@ -194,6 +195,15 @@ class DefaultHeader extends Component { }); } + + getLogo = () => { + return ( +
+ +
+ ) + } + getHeaderMenu = () => { const { fullname, u_group } = this.state; if (u_group == 'kominfo') { @@ -244,12 +254,15 @@ class DefaultHeader extends Component { return ( + + {this.getLogo()} + ); diff --git a/src/containers/DefaultLayout/DefaultLayout.js b/src/containers/DefaultLayout/DefaultLayout.js index 4cdd3cb..85b82c7 100644 --- a/src/containers/DefaultLayout/DefaultLayout.js +++ b/src/containers/DefaultLayout/DefaultLayout.js @@ -38,17 +38,33 @@ class DefaultLayout extends Component { constructor(props) { super(props); + + let role_id = '', token = '', company_id = 0, menu = '' + if (props.location.state && props.location.state.role_id) { + role_id = props.location.state.role_id; + token = props.location.state.token; + company_id = props.location.state.company_id; + menu = props.location.state.menu_login; + } else { + role_id = localStorage.getItem("role_id"); + token = localStorage.getItem("token"); + company_id = localStorage.getItem('company_id'); + menu = localStorage.getItem("menu_login"); + } + this.state = { - role_id: localStorage.getItem('role_id'), - token: localStorage.getItem('token'), + role_id: role_id, + token: token, menu: { items: [] }, routes2: routes, finalRoutes: [], breadrCrumbReady: false, - minimized: true - } + minimized: true, + company_id: company_id + }; } + async componentDidMount() { const menu = localStorage.getItem("menu_login") if (menu) this.setMenu(JSON.parse(menu)) @@ -102,6 +118,8 @@ class DefaultLayout extends Component { e.preventDefault() } await localStorage.removeItem("role_id"); + await localStorage.removeItem("company_id"); + document.getElementById('title').innerText = 'OSPRO'; await window.localStorage.clear(); this.props.history.replace('/login') } @@ -251,15 +269,13 @@ class DefaultLayout extends Component { return (
+ + +
{!window.location.href.includes("dashboard-project") || renderSidebar ? ( - {/* */} -
+ @@ -295,7 +311,20 @@ class DefaultLayout extends Component { exact={route.exact} name={route.name} render={props => ( - + )} /> ) : (null); })} diff --git a/src/routes.js b/src/routes.js index 2719201..ac74528 100644 --- a/src/routes.js +++ b/src/routes.js @@ -22,7 +22,7 @@ const Layer = React.lazy(() => import('./views/Layers/Layer')); const Layers = React.lazy(() => import('./views/Layers/Layers')); const Lembur = React.lazy(() => import('./views/Master/MasterLembur')); const MapConfig = React.lazy(() => import('./views/MapConfig')); -const Menu = React.lazy(() => import('./views/Master/MasterMenu')); +const Menu = React.lazy(() => import('./views/Master/MenuCompany')); const OfficeHours = React.lazy(() => import('./views/Master/MasterOfficeHours')); const Organization = React.lazy(() => import('./views/Master/MasterOrganization')); const PanicButton = React.lazy(() => import('./views/SimproV2/PanicButton')); @@ -31,6 +31,10 @@ const Presensi = React.lazy(() => import('./views/SimproV2/Presence')); const ProjectRole = React.lazy(() => import('./views/Master/RoleProject')); const ProjectType = React.lazy(() => import('./views/SimproV2/ProjectType')); const ProjectPhase = React.lazy(() => import('./views/Master/ProjectPhase')); +const ProjectExpenditure = React.lazy(() => import('./views/Master/ProjectExpenditure')); +const ProjectFinancialHealth = React.lazy(() => import('./views/Master/ProjectFinancialHealth')); +const ProjectScheduleHealth = React.lazy(() => import('./views/Master/ProjectScheduleHealth')); +const ProjectInvoice = React.lazy(() => import('./views/Master/ProjectInvoice')); const Proyek = React.lazy(() => import('./views/Master/Proyek')); const RateCost = React.lazy(() => import('./views/SimproV2/RateCost')); const ResourceMaterial = React.lazy(() => import('./views/SimproV2/ResourceMaterial')); @@ -82,6 +86,10 @@ const routes = [ { path: '/project-role', exact: true, name: 'Project Role', component: ProjectRole }, { path: '/project-type', exact: true, name: 'Project Type', component: ProjectType }, { path: '/project-phase', exact: true, name: 'Project Phase', component: ProjectPhase }, + { path: '/project-expenditure', exact: true, name: 'Project Expenditure', component: ProjectExpenditure }, + { path: '/project-financial-health', exact: true, name: 'Project Financial Health', component: ProjectFinancialHealth }, + { path: '/project-schedule-health', exact: true, name: 'Project Schedule Health', component: ProjectScheduleHealth }, + { path: '/project-invoice', exact: true, name: 'Project Invoice vs Cash In', component: ProjectInvoice }, { path: '/divisi', exact: true, name: 'Divisi', component: Divisi }, { path: '/satuan', exact: true, name: 'Satuan', component: Satuan }, { path: '/config-alert', exact: true, name: 'Config Alert', component: ConfigAlert }, diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 4d1982e..a63d260 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -15,24 +15,19 @@ import { HealthByBudget, HealthBySchedule } from './Components'; import { Link } from 'react-router-dom'; import { Card, CardBody, CardHeader, Input } from "reactstrap"; const DashboardBOD = (props) => { - let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, all_project = ''; - 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; - company_id = props.location.state.company_id; - all_project = props.location.state.all_project; - } else { - role_id = localStorage.getItem("role_id"); - user_id = localStorage.getItem("user_id"); - token = localStorage.getItem("token"); - isLogin = localStorage.getItem("isLogin"); - company_id = localStorage.getItem('company_id'); - all_project = localStorage.getItem('all_project'); + let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = ''; + if (props && props.role_id && props.user_id) { + role_id = props.role_id; + user_id = props.user_id; + token = props.token; + isLogin = props.isLogin; + company_id = props.company_id; + all_project = props.all_project; + role_name = props.role_name; + isLogin = props.isLogin; + hierarchy = props.hierarchy; + user_name = props.user_name; } - let hierarchy = []; - hierarchy.push(JSON.parse(localStorage.getItem("hierarchy"))); const HEADER = { headers: { "Content-Type": "application/json", @@ -66,13 +61,6 @@ const DashboardBOD = (props) => { const [READY_TABLE_DETAIL_EXPENDITURE, SET_READY_TABLE_DETAIL_EXPENDITURE] = useState(false); const [DATA_DETAIL_EXPENDITURE, SET_DATA_DETAIL_EXPENDITURE] = useState([]); - const currentYear = new Date().getFullYear(); - const years = Array.from({ length: 6 }, (_, index) => currentYear - index); - const storedYear = localStorage.getItem('selectedYear'); - const initialYear = storedYear ? storedYear : currentYear.toString(); - - const [searchColumn, setSearchColumn] = useState(initialYear); - useEffect(() => { getCompanyCashFlow(); // expenditure getCompanyExpenditureColor(); // expenditure Color @@ -87,14 +75,13 @@ const DashboardBOD = (props) => { getProjectScheduleHealthPerDivision(); // project by schedule health per division getTotalProjectPerDivision(); // project by division getTotalProjectValuePerDivision(); // project value by division - localStorage.setItem('selectedYear', searchColumn); - }, [searchColumn]) + }, []) // project expenditure const getCompanyCashFlow = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project Expenditure."; @@ -120,31 +107,31 @@ const DashboardBOD = (props) => { // Project Expenditure Color const getCompanyExpenditureColor = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure-color/${company_id}` + const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure-color/${company_id}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) SET_PROJECT_EXPENDITURE_COLOR(result.data.data) } const getCompanyFinancialHealthColor = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${company_id}` + const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${company_id}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) SET_PROJECT_FINANCIAL_HEALTH_COLOR(result.data.data) } const getCompanyScheduleHealthColor = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-detail-schedule-health-color/${company_id}` + const URL = `${BASE_OSPRO}/api/dashboard/get-detail-schedule-health-color/${company_id}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) SET_PROJECT_SCHEDULE_HEALTH_COLOR(result.data.data) } const getCompanyInvoiceColor = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-detail-invoice-color/${company_id}` + const URL = `${BASE_OSPRO}/api/dashboard/get-detail-invoice-color/${company_id}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) SET_PROJECT_INVOICE_COLOR(result.data.data) } const getInvoiceOutstanding = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-invoice-outstanding/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-invoice-outstanding/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project Invoice vs Cash In."; @@ -167,7 +154,7 @@ const DashboardBOD = (props) => { } const getProjectPerScheduleHealth = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-schedule-health/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-schedule-health/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Schedule Health."; @@ -191,7 +178,7 @@ const DashboardBOD = (props) => { } const getProjectPerBudgetHealth = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Budget Health."; @@ -214,7 +201,7 @@ const DashboardBOD = (props) => { } const getProjectBudgetHealthPerDivision = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Schedule Health per Division."; @@ -238,7 +225,7 @@ const DashboardBOD = (props) => { } const getProjectScheduleHealthPerDivision = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Schedule Health."; @@ -261,7 +248,7 @@ const DashboardBOD = (props) => { } const getProjectPerPhase = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-phase/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-phase/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Phase."; @@ -286,7 +273,7 @@ const DashboardBOD = (props) => { } const getTotalProjectPerDivision = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project by Division."; @@ -311,7 +298,7 @@ const DashboardBOD = (props) => { } const getTotalProjectValuePerDivision = async () => { - const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Project Value by Division"; @@ -340,7 +327,7 @@ const DashboardBOD = (props) => { return; } setOpenDetailedView(true); - const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure/${searchColumn}/${company_id}/${all_project}/${hierarchy}` + const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure/${company_id}/${all_project}/${hierarchy}/${role_name}` const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const content = "Get Detail Expenditure"; @@ -459,33 +446,6 @@ const DashboardBOD = (props) => {
{/* */} - - -
-

Dashboard

-
-
-
-

Search by Years

-
-
- setSearchColumn(e.target.value)} - name="select" - > - {years.map((year) => ( - - ))} - -
-
- -
diff --git a/src/views/Dashboard/DashboardCustomer.js b/src/views/Dashboard/DashboardCustomer.js index bdc6e30..8f0f5f6 100644 --- a/src/views/Dashboard/DashboardCustomer.js +++ b/src/views/Dashboard/DashboardCustomer.js @@ -26,18 +26,19 @@ const center = { } const DashboardCustomer = (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 = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name=''; + if (props && props.role_id && props.user_id) { + role_id = props.role_id; + user_id = props.user_id; + token = props.token; + isLogin = props.isLogin; + company_id = props.company_id; + all_project = props.all_project; + role_name = props.role_name; + isLogin = props.isLogin; + hierarchy = props.hierarchy; + user_name = props.user_name; + } const HEADER = { headers: { "Content-Type": "application/json", diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js index a6d73a9..52f81f5 100644 --- a/src/views/Dashboard/DashboardProject.js +++ b/src/views/Dashboard/DashboardProject.js @@ -30,7 +30,9 @@ import { } from "./Components"; import { Fab, Action } from "react-tiny-fab"; import "react-tiny-fab/dist/styles.css"; -import { useHistory, useLocation, useParams } from "react-router-dom"; +import { useHistory, useParams } from "react-router-dom"; +import { Icon } from '@iconify/react'; +import arrowLeft from '@iconify/icons-ion/ios-arrow-back'; const { TextArea } = Input; @@ -63,8 +65,20 @@ const center = { lng: 106.816666, }; -const DashboardProject = () => { - const token = localStorage.getItem("token"); +const DashboardProject = (props) => { + let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = ''; + if (props && props.role_id && props.user_id) { + role_id = props.role_id; + user_id = props.user_id; + token = props.token; + isLogin = props.isLogin; + company_id = props.company_id; + all_project = props.all_project; + role_name = props.role_name; + isLogin = props.isLogin; + hierarchy = props.hierarchy; + user_name = props.user_name; + } const HEADER = { headers: { "Content-Type": "application/json", @@ -72,7 +86,9 @@ const DashboardProject = () => { }, }; const { PROJECT_ID, GANTT_ID, SCURVE } = useParams(); - const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`; + const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}&company_id=${company_id}`; + // const URL_GANTT = `http://localhost:8444/generic-ospro-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}&company_id=${company_id}`; + const mapRef = useRef(); const [projectName, setProjectName] = useState(""); const [projectManagerName, setProjectManagerName] = useState(""); @@ -125,6 +141,8 @@ const DashboardProject = () => { const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [calculationStatus, setCalculationStatus] = useState(false); const [isHierarchy, setIsHierarchy] = useState(null); + const [dataOverdue, setDataOverdue] = useState(null); + const [projectType, setProjectType] = useState(null); let history = useHistory(); useEffect(() => { @@ -135,6 +153,7 @@ const DashboardProject = () => { getGantt(); getGanttParents(); return () => { + console.log("unmount RenderMap"); }; }, []); @@ -143,9 +162,10 @@ const DashboardProject = () => { getSCurve(); } window.addEventListener("message", handleIframeMessage); - + window.addEventListener('message', handleGetOverdue); return () => { window.removeEventListener("message", handleIframeMessage); + window.removeEventListener("message", handleGetOverdue); }; }, [isHierarchy]); @@ -168,8 +188,13 @@ const DashboardProject = () => { useEffect(() => { let deviation = 0; - if (plannedCost && totalCost) { - deviation = plannedCost - totalCost; + // Convert plannedCost and totalCost to numbers + const plannedCostNumber = parseFloat(plannedCost); + const totalCostNumber = parseFloat(totalCost); + + // Check if conversion is successful + if (!isNaN(plannedCostNumber) && !isNaN(totalCostNumber)) { + deviation = plannedCostNumber - totalCostNumber; } setRemToComplete(deviation.toString()); }, [plannedCost, totalCost]); @@ -184,6 +209,7 @@ const DashboardProject = () => { const response = await axios.get(url, HEADER); setManPower(response.data.totalRecord); } catch (error) { + console.error("Failed to get manpower:", error); } }; @@ -200,6 +226,7 @@ const DashboardProject = () => { } setIsReadyGantt(true); } catch (error) { + console.error("Failed to get gantt data:", error); setIsReadyGantt(true); } }; @@ -212,6 +239,7 @@ const DashboardProject = () => { setDataGanttParents(response); setIsReadyGanttParents(true); } catch (error) { + console.error("Failed to get gantt data:", error); setIsReadyGanttParents(true); } }; @@ -229,6 +257,7 @@ const DashboardProject = () => { setAssignedHrCount(assignedList.length); setAssignedHr(assignedList); } catch (error) { + console.error("Failed to get assigned HR:", error); } }; @@ -285,6 +314,7 @@ const DashboardProject = () => { .get(URL, HEADER) .then((res) => res) .catch((err) => err.response); + console.log("getProjectDetail", result); if (!result) { NotificationManager.error(`Could not connect to internet.`, "Failed"); setIsReadyProjectDetail(true); @@ -299,6 +329,8 @@ const DashboardProject = () => { setIsReadyProjectDetail(true); return; } else if (result.status == 200 && result.data.data) { + console.log(result.data.data); + // setComments(result.data.data); setProjectName(result.data.data.nama ? result.data.data.nama : "-"); setProjectManagerName( result.data.data.projectManager ? result.data.data.projectManager : "-" @@ -326,6 +358,7 @@ const DashboardProject = () => { ? result.data.data.header?.planned_end : null ); + setProjectType(result.data.data.type_proyek_id); setActualStart( result.data.data.header?.start_date ? result.data.data.header.start_date @@ -393,6 +426,7 @@ const DashboardProject = () => { let selisihProgress = 0; let planningProgress = 0; let actualProgress = 0; + console.log("test flow ", result.data.data); let statusHealthBySchedule = "on-schedule"; if ( result.data.data.length > 0 && @@ -416,21 +450,13 @@ const DashboardProject = () => { result.data.data[0].data.budget_control.cost_deviation?.toString() ); } - let now = new Date().toISOString().slice(0, 10); - let dates = result.data.data[0].data?.date; - let n = dates.findIndex( - (element) => new Date(now) < new Date(element[0]) - ); - if (n < 0) { - n = dates.length - 1; - } if ( result.data.data.length > 0 && result.data.data[0].data?.percentagePlan && result.data.data[0].data?.percentagePlan.length > 0 ) { - planningProgress = result.data.data[0].data?.percentagePlan[n]; - setPlanningProgress(planningProgress); + planningProgress = result.data.data[0].data?.percentagePlan[result.data.data[0].data?.percentagePlan.length - 1]; + setPlanningProgress(Math.ceil(planningProgress)); } if ( result.data.data.length > 0 && @@ -469,6 +495,7 @@ const DashboardProject = () => { .post(URL, payload, HEADER) .then((res) => res) .catch((err) => err.response); + console.log("getOverdueActivities", result); if (!result) { NotificationManager.error(`Could not connect to internet.`, "Failed"); setIsReadyOverdueActivities(true); @@ -505,6 +532,7 @@ const DashboardProject = () => { .post(URL, payload, HEADER) .then((res) => res) .catch((err) => err.response); + console.log("getIntegrationInvoice", result); if (!result) { NotificationManager.error(`Could not connect to internet.`, "Failed"); setIsReadyIntegrationInvoice(true); @@ -551,6 +579,7 @@ const DashboardProject = () => { .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"); setIsReadyReportDistribution(true); @@ -603,6 +632,7 @@ const DashboardProject = () => { .post(URL, payload, HEADER) .then((res) => res) .catch((err) => err.response); + console.log("getComments", result); if (!result) { NotificationManager.error(`Could not connect to internet.`, "Failed"); setIsReadyComments(true); @@ -623,6 +653,7 @@ const DashboardProject = () => { }; const handleSendComment = async () => { + // console.log('handleSendComment', comment); setIsSendingComment(true); if (comment === "") { NotificationManager.error( @@ -669,6 +700,10 @@ const DashboardProject = () => { setIsSendingComment(false); }; + const handleBack = async () => { + window.parent.location.reload(); + }; + const initMap = () => { let mymap = L.map("map-area", { center: center, @@ -716,6 +751,12 @@ const DashboardProject = () => { } }; + const handleGetOverdue = (event) => { + if (event.data.type === 'dataOverdueUpdate') { + setDataOverdue(event.data.dataOverdue); + } + } + const RenderGantt = useMemo( () => (