+ {/*
this.props.saveMap()}>
@@ -103,21 +99,21 @@ class MapHeader extends Component {
Save Map
*/}
-
-
-
- this.props.printMap() }>
-
-
- Print Map
-
-
-
-
-
-
-
- {/*Account
+
+
+
+ this.props.printMap()}>
+
+
+ Print Map
+
+
+
+
+
+
+
+ {/*Account
Updates42
Messages42
Tasks42
@@ -129,13 +125,13 @@ class MapHeader extends Component {
Projects42
Lock Account*/}
- { localStorage.getItem('user_name') }
- this.props.onLogout(e)}> Logout
-
-
-
-
- )
+ {localStorage.getItem('user_name')}
+ this.props.onLogout(e)}> Logout
+
+
+
+
+ )
}
diff --git a/src/components/PopupContainer/PopupContainer.js b/src/components/PopupContainer/PopupContainer.js
index 6b0ef87..428e3b7 100644
--- a/src/components/PopupContainer/PopupContainer.js
+++ b/src/components/PopupContainer/PopupContainer.js
@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react';
-import {Vector as VectorLayer} from 'ol/layer';
-import {Vector as VectorSource} from 'ol/source';
+import { Vector as VectorLayer } from 'ol/layer';
+import { Vector as VectorSource } from 'ol/source';
import Feature from 'ol/Feature';
import { Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon } from 'ol/geom';
import { Circle as CircleStyle, Fill, Icon as IconOl, Stroke, Style, Text } from 'ol/style';
@@ -32,8 +32,8 @@ import axios from "axios"
import moment from "moment"
import { deleteFeature, getImagePopup, formatLength, formatArea, lightOrDark } from '../../const/GeoserverFunc.js';
import { formatLabel, hideAttr, dateColumns, DATE_TIME_FORMAT } from '../../const/CustomFunc.js'
-import {API_UPLOAD_IMAGE, BASE_IMAGE, BASE_SIMPRO } from '../../const/ApiConst.js'
-import routeDummy from '../../dummy_data/route2.json';
+import { API_UPLOAD_IMAGE, BASE_IMAGE, BASE_SIMPRO } from '../../const/ApiConst.js'
+
class PopupContainer extends Component {
@@ -53,7 +53,7 @@ class PopupContainer extends Component {
featureExtent: null,
mapProjection: this.props.olmap.getView().getProjection(),
fitOption: {
- size: this.props.olmap.getSize(),
+ size: this.props.olmap.getSize(),
duration: 500,
maxZoom: 18
},
@@ -69,7 +69,7 @@ class PopupContainer extends Component {
}
componentDidMount() {
- this.setState({isReady: true});
+ this.setState({ isReady: true });
}
/*componentDidMount() {
@@ -91,18 +91,18 @@ class PopupContainer extends Component {
matchLayerAttribute = (propKey) => {
const { layer_attribute } = this.props;
- for (let i=0; i < layer_attribute.length; i++) {
+ for (let i = 0; i < layer_attribute.length; i++) {
if (layer_attribute[i].attribute !== 'the_geom') {
- if (layer_attribute[i].attribute_label !== null && layer_attribute[i].attribute_label !== '' ) {
- if (propKey == layer_attribute[i].attribute) {
- return layer_attribute[i].attribute_label;
- }
+ if (layer_attribute[i].attribute_label !== null && layer_attribute[i].attribute_label !== '') {
+ if (propKey == layer_attribute[i].attribute) {
+ return layer_attribute[i].attribute_label;
}
- else {
- if (propKey == layer_attribute[i].attribute) {
- return layer_attribute[i].attribute;
- }
+ }
+ else {
+ if (propKey == layer_attribute[i].attribute) {
+ return layer_attribute[i].attribute;
}
+ }
}
}
}
@@ -142,7 +142,7 @@ class PopupContainer extends Component {
else {
return "";
}
-
+
}
getLayerColor = (item) => {
@@ -234,18 +234,18 @@ class PopupContainer extends Component {
{/*Loading...
}
- return(
-
-
this.setState({alert: false, successAler: false, dangerAlert: false})}>
+ return (
+
+ this.setState({ alert: false, successAler: false, dangerAlert: false })}>
{alertMessage}
{this.fillPopupContent()}
- {
+ {
this.state.imagePopupVisible &&
- this.toggleImagePopup()}
- imagePopupTitle={this.state.imagePopupTitle ? this.state.imagePopupTitle : 'Feature Image'}
- id={this.props.popupDataTemp[0].id}
- />
+ this.toggleImagePopup()}
+ imagePopupTitle={this.state.imagePopupTitle ? this.state.imagePopupTitle : 'Feature Image'}
+ id={this.props.popupDataTemp[0].id}
+ />
}
- {
+ {
this.state.imagePreviewVisible &&
-
+
}
{
this.state.editFeatureVisible &&
@@ -772,10 +772,10 @@ class PopupContainer extends Component {
/>
}*/}
- )
+ )
+
+
-
-
}
}
diff --git a/src/const/en.json b/src/const/en.json
index 7e2f728..c733e7c 100644
--- a/src/const/en.json
+++ b/src/const/en.json
@@ -46,6 +46,9 @@
"icon": "Icon",
"inputIcon": "Input Code Icon",
"inputName": "Input Name",
+ "inputaddress": "Input Address",
+ "inputBrithPlace": "Input Birth Place",
+ "inputBrithDate": "Select Birth Date",
"inputDescription": "Input Description",
"inputParentMenu": "Select Parent Menu",
"inputAliasMenu": "Input Menu Alias",
diff --git a/src/containers/DefaultLayout/DefaultHeader.js b/src/containers/DefaultLayout/DefaultHeader.js
index 1740aaf..c8832ad 100644
--- a/src/containers/DefaultLayout/DefaultHeader.js
+++ b/src/containers/DefaultLayout/DefaultHeader.js
@@ -1,14 +1,10 @@
import React, { Component } from 'react';
-import { Link, NavLink } from 'react-router-dom';
-import { Badge, UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem } from 'reactstrap';
+import { NavLink } from 'react-router-dom';
+import { Badge, Nav, NavItem } from 'reactstrap';
import PropTypes from 'prop-types';
-import { Menu, Dropdown, Row, Col } from 'antd'
-import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react';
+import { Menu, Dropdown } from 'antd'
import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE } from '../../const/ApiConst';
-import user_logo from '../../assets/img/avatars/user.png'
-import logo_header_adw from '../../assets/img/logo_adyawinsa.jpg'
-import logo_header_kit from '../../assets/img/logo_kit.png'
-import logo_header_nawakara from '../../assets/img/logo_nawakara.png'
+
import axios from 'axios';
import './Default.css'
const token = window.localStorage.getItem('token');
diff --git a/src/dummy_data/paxel.geojson b/src/dummy_data/paxel.geojson
deleted file mode 100644
index 9140641..0000000
--- a/src/dummy_data/paxel.geojson
+++ /dev/null
@@ -1,101 +0,0 @@
-{
- "type": "FeatureCollection",
- "totalFeatures": "unknown",
- "features": [
- {
- "type": "Feature",
- "id": "paxel_area_code_20210426.5083",
- "geometry": {
- "type": "MultiPolygon",
- "coordinates": [
- [
- [
- [
- 106.522270001261,
- -6.66321000044036
- ],
- [
- 106.536260000699,
- -6.66382999935416
- ],
- [
- 106.556582195013,
- -6.68497003983464
- ],
- [
- 106.541310000657,
- -6.71486999865072
- ],
- [
- 106.542630000375,
- -6.74058999942815
- ],
- [
- 106.550740756582,
- -6.7473471734325
- ],
- [
- 106.533284161136,
- -6.75148465469226
- ],
- [
- 106.524773753407,
- -6.76232523192311
- ],
- [
- 106.498398062322,
- -6.75218427058684
- ],
- [
- 106.46682763259,
- -6.75104031405846
- ],
- [
- 106.459021692598,
- -6.73381922767441
- ],
- [
- 106.481760000125,
- -6.72494999944212
- ],
- [
- 106.504030000085,
- -6.70412999979885
- ],
- [
- 106.51431934866,
- -6.65951255475977
- ],
- [
- 106.522270001261,
- -6.66321000044036
- ]
- ]
- ]
- ]
- },
- "geometry_name": "the_geom",
- "properties": {
- "fid": 37287,
- "desa": "MALASARI",
- "provinsi": "JAWA BARAT",
- "kabkot": "BOGOR",
- "kecamatan": "NANGGUNG",
- "post_code": null,
- "city_code": "",
- "ph_code": "",
- "locker_cod": "",
- "area_code": "",
- "id": 37287,
- "cluster_area_code": "",
- "service_ty": null
- }
- }
- ],
- "crs": {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:EPSG::4326"
- }
- }
-}
\ No newline at end of file
diff --git a/src/dummy_data/route.json b/src/dummy_data/route.json
deleted file mode 100644
index 9bb8756..0000000
--- a/src/dummy_data/route.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "routes": [
- {
- "geometry": "hldhx@lnau`BCG_EaC??cFjAwDjF??uBlKMd@}@z@??aC^yk@z_@se@b[wFdE??wFfE}NfIoGxB_I\\gG}@eHoCyTmPqGaBaHOoD\\??yVrGotA|N??o[N_STiwAtEmHGeHcAkiA}^aMyBiHOkFNoI`CcVvM??gG^gF_@iJwC??eCcA]OoL}DwFyCaCgCcCwDcGwHsSoX??wI_EkUFmq@hBiOqBgTwS??iYse@gYq\\cp@ce@{vA}s@csJqaE}{@iRaqE{lBeRoIwd@_T{]_Ngn@{PmhEwaA{SeF_u@kQuyAw]wQeEgtAsZ}LiCarAkVwI}D??_}RcjEinPspDwSqCgs@sPua@_OkXaMeT_Nwk@ob@gV}TiYs[uTwXoNmT{Uyb@wNg]{Nqa@oDgNeJu_@_G}YsFw]kDuZyDmm@i_@uyIJe~@jCg|@nGiv@zUi_BfNqaAvIow@dEed@dCcf@r@qz@Egs@{Acu@mCum@yIey@gGig@cK_m@aSku@qRil@we@{mAeTej@}Tkz@cLgr@aHko@qOmcEaJw~C{w@kai@qBchBq@kmBS{kDnBscBnFu_Dbc@_~QHeU`IuyDrC_}@bByp@fCyoA?qMbD}{AIkeAgBk_A_A{UsDke@gFej@qH{o@qGgb@qH{`@mMgm@uQus@kL{_@yOmd@ymBgwE}x@ouBwtA__DuhEgaKuWct@gp@cnBii@mlBa_@}|Asj@qrCg^eaC}L{dAaJ_aAiOyjByH{nAuYu`GsAwXyn@ywMyOyqD{_@cfIcDe}@y@aeBJmwA`CkiAbFkhBlTgdDdPyiB`W}xDnSa}DbJyhCrXitAhT}x@bE}Z_@qW_Kwv@qKaaAiBgXvIm}A~JovAxCqW~WanB`XewBbK{_A`K}fBvAmi@xBycBeCauBoF}}@qJioAww@gjHaPopA_NurAyJku@uGmi@cDs[eRaiBkQstAsQkcByNmaCsK_uBcJgbEw@gkB_@ypEqDoqSm@eZcDwjBoGw`BoMegBaU_`Ce_@_uBqb@ytBwkFqiT_fAqfEwe@mfCka@_eC_UmlB}MmaBeWkkDeHwqAoX}~DcBsZmLcxBqOwqE_DkyAuJmrJ\\o~CfIewG|YibQxBssB?es@qGciA}RorAoVajA_nAodD{[y`AgPqp@mKwr@ms@umEaW{dAmb@umAw|@ojBwzDaaJsmBwbEgdCsrFqhAihDquAi`Fux@}_Dui@_eB_u@guCuyAuiHukA_lKszAu|OmaA{wKm}@clHs_A_rEahCssKo\\sgBsSglAqk@yvDcS_wAyTwpBmPc|BwZknFoFscB_GsaDiZmyMyLgtHgQonHqT{hKaPg}Dqq@m~Hym@c`EuiBudIabB{hF{pWifx@snAw`GkFyVqf@y~BkoAi}Lel@wtc@}`@oaXi_C}pZsi@eqGsSuqJ|Lqeb@e]kgPcaAu}SkDwzGhn@gjYh\\qlNZovJieBqja@ed@siO{[ol\\kCmjMe\\isHorCmec@uLebB}EqiBaCg}@m@qwHrT_vFps@kkI`uAszIrpHuzYxx@e{Crw@kpDhN{wBtQarDy@knFgP_yCu\\wyCwyA{kHo~@omEoYmoDaEcPiuAosDagD}rO{{AsyEihCayFilLaiUqm@_bAumFo}DgqA_uByi@swC~AkzDlhA}xEvcBa}Cxk@ql@`rAo|@~bBq{@``Bye@djDww@z_C_cAtn@ye@nfC_eC|gGahH~s@w}@``Fi~FpnAooC|u@wlEaEedRlYkrPvKerBfYs}Arg@m}AtrCkzElw@gjBbh@woBhR{gCwGkgCc[wtCuOapAcFoh@uBy[yBgr@c@iq@o@wvEv@sp@`FajBfCaq@fIipAdy@ewJlUc`ExGuaBdEmbBpBssArAuqBBg}@s@g{AkB{bBif@_bYmC}r@kDgm@sPq_BuJ_s@{X_{AsK_d@eM{d@wVgx@oWcu@??aDmOkNia@wFoSmDyMyCkPiBePwAob@XcQ|@oNdCoSfFwXhEmOnLi\\lbAulB`X_d@|k@au@bc@oc@bqC}{BhwDgcD`l@ed@??bL{G|a@eTje@oS~]cLr~Bgh@|b@}Jv}EieAlv@sPluD{z@nzA_]`|KchCtd@sPvb@wSb{@ko@f`RooQ~e[upZbuIolI|gFafFzu@iq@nMmJ|OeJn^{Qjh@yQhc@uJ~j@iGdd@kAp~BkBxO{@|QsAfYgEtYiGd]}Jpd@wRhVoNzNeK`j@ce@vgK}cJnSoSzQkVvUm^rSgc@`Uql@xIq\\vIgg@~kDyq[nIir@jNoq@xNwc@fYik@tk@su@neB}uBhqEesFjoGeyHtCoD|D}Ed|@ctAbIuOzqB_}D~NgY`\\um@v[gm@v{Cw`G`w@o{AdjAwzBh{C}`Gpp@ypAxn@}mAfz@{bBbNia@??jIab@`CuOlC}YnAcV`@_^m@aeB}@yk@YuTuBg^uCkZiGk\\yGeY}Lu_@oOsZiTe[uWi[sl@mo@soAauAsrBgzBqgAglAyd@ig@asAcyAklA}qAwHkGi{@s~@goAmsAyDeEirB_{B}IsJuEeFymAssAkdAmhAyTcVkFeEoKiH}l@kp@wg@sj@ku@ey@uh@kj@}EsFmG}Jk^_r@_f@m~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL"
- }
- ]
-}
\ No newline at end of file
diff --git a/src/dummy_data/route2.json b/src/dummy_data/route2.json
deleted file mode 100644
index 7d09827..0000000
--- a/src/dummy_data/route2.json
+++ /dev/null
@@ -1,257 +0,0 @@
-{
- "geocoded_waypoints": [
- {
- "geocoder_status": "OK",
- "place_id": "ChIJT2zELKHxaS4RR5fpIKhtekA",
- "types": [
- "street_address"
- ]
- },
- {
- "geocoder_status": "OK",
- "place_id": "ChIJdbdzpG7xaS4RUCaaEC6NIOo",
- "types": [
- "street_address"
- ]
- }
- ],
- "routes": [
- {
- "bounds": {
- "northeast": {
- "lat": -6.245234399999999,
- "lng": 106.8006477
- },
- "southwest": {
- "lat": -6.2623544,
- "lng": 106.7885345
- }
- },
- "copyrights": "Map data ©2021",
- "legs": [
- {
- "distance": {
- "text": "3.0 km",
- "value": 2992
- },
- "duration": {
- "text": "9 mins",
- "value": 552
- },
- "end_address": "Jl. Melawai 5 No.172, RT.3/RW.1, Melawai, Kec. Kby. Baru, Kota Jakarta Selatan, Daerah Khusus Ibukota Jakarta 12160, Indonesia",
- "end_location": {
- "lat": -6.245234399999999,
- "lng": 106.8006477
- },
- "start_address": "Jl. Bri Radio Dalam No.34/4, RT.2/RW.15, Gandaria Utara, Kec. Kby. Baru, Kota Jakarta Selatan, Daerah Khusus Ibukota Jakarta 12140, Indonesia",
- "start_location": {
- "lat": -6.2623544,
- "lng": 106.7885345
- },
- "steps": [
- {
- "distance": {
- "text": "1.5 km",
- "value": 1495
- },
- "duration": {
- "text": "4 mins",
- "value": 221
- },
- "end_location": {
- "lat": -6.2493628,
- "lng": 106.7918222
- },
- "html_instructions": "Head north on Jl. Radio Dalam Raya toward Jl. Dwijaya RayaPass by Alfamart Radio Dalam 4 (on the right)
",
- "polyline": {
- "points": "tbfe@icxjSOEs@M}@K}C]m@KUKg@G[EKAQCaAO_@GGAoB[SEaCa@e@Ga@GuB]yA[{Ba@iAYkA[a@KqAi@w@WaA[KCgAYQCMAw@I}AKUCeAOQCoAUMCoAQyAQc@EcBKe@C}@IC?g@E_AG"
- },
- "start_location": {
- "lat": -6.2623544,
- "lng": 106.7885345
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "0.5 km",
- "value": 532
- },
- "duration": {
- "text": "2 mins",
- "value": 99
- },
- "end_location": {
- "lat": -6.2491213,
- "lng": 106.7959681
- },
- "html_instructions": "Turn right onto Jl. Kramat Pela",
- "maneuver": "turn-right",
- "polyline": {
- "points": "nqce@{wxjSMA\\sBJm@JOBQFa@h@cC@EN_@Le@Hc@?QBQBIDQ@Q@O?UASCSAMCGEGU]QSWWQUq@q@MGQEGAKA"
- },
- "start_location": {
- "lat": -6.2493628,
- "lng": 106.7918222
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "25 m",
- "value": 25
- },
- "duration": {
- "text": "1 min",
- "value": 4
- },
- "end_location": {
- "lat": -6.249124,
- "lng": 106.7961904
- },
- "html_instructions": "Turn right toward Jl. Barito II",
- "maneuver": "turn-right",
- "polyline": {
- "points": "~oce@yqyjSAK@_@"
- },
- "start_location": {
- "lat": -6.2491213,
- "lng": 106.7959681
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "0.2 km",
- "value": 154
- },
- "duration": {
- "text": "1 min",
- "value": 36
- },
- "end_location": {
- "lat": -6.249612600000001,
- "lng": 106.7974484
- },
- "html_instructions": "Turn right onto Jl. Barito II",
- "maneuver": "turn-right",
- "polyline": {
- "points": "~oce@esyjS`@_@P[JSJ]DM@KH}@Bu@"
- },
- "start_location": {
- "lat": -6.249124,
- "lng": 106.7961904
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "0.4 km",
- "value": 414
- },
- "duration": {
- "text": "1 min",
- "value": 77
- },
- "end_location": {
- "lat": -6.2459198,
- "lng": 106.7979545
- },
- "html_instructions": "Turn left onto Jl. Panglima Polim (signs for Senayan/Semanggi)Pass by ATM Bank UOB (on the left)
",
- "maneuver": "turn-left",
- "polyline": {
- "points": "`sce@a{yjSmBMgDUyBQGAyDW[CgAIk@E"
- },
- "start_location": {
- "lat": -6.249612600000001,
- "lng": 106.7974484
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "0.2 km",
- "value": 220
- },
- "duration": {
- "text": "1 min",
- "value": 48
- },
- "end_location": {
- "lat": -6.245905899999999,
- "lng": 106.7999397
- },
- "html_instructions": "Turn right onto Jl. Melawai RayaPass by MM Juice Melawai (on the right)
",
- "maneuver": "turn-right",
- "polyline": {
- "points": "~{be@e~yjS?SAq@?S?A?]Cg@AKD_F"
- },
- "start_location": {
- "lat": -6.2459198,
- "lng": 106.7979545
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "74 m",
- "value": 74
- },
- "duration": {
- "text": "1 min",
- "value": 33
- },
- "end_location": {
- "lat": -6.2452361,
- "lng": 106.7999455
- },
- "html_instructions": "Turn left after HAZEL Brew Coffee (on the right)",
- "maneuver": "turn-left",
- "polyline": {
- "points": "|{be@sjzjSO?C?_@?qAA"
- },
- "start_location": {
- "lat": -6.245905899999999,
- "lng": 106.7999397
- },
- "travel_mode": "DRIVING"
- },
- {
- "distance": {
- "text": "78 m",
- "value": 78
- },
- "duration": {
- "text": "1 min",
- "value": 34
- },
- "end_location": {
- "lat": -6.245234399999999,
- "lng": 106.8006477
- },
- "html_instructions": "Turn right onto Jl. Melawai 9Destination will be on the left
",
- "maneuver": "turn-right",
- "polyline": {
- "points": "vwbe@ujzjSAkC"
- },
- "start_location": {
- "lat": -6.2452361,
- "lng": 106.7999455
- },
- "travel_mode": "DRIVING"
- }
- ],
- "traffic_speed_entry": [],
- "via_waypoint": []
- }
- ],
- "overview_polyline": {
- "points": "tbfe@icxjScAS{Ei@m@KUKcAM_C]mGeAgAOoEy@eE{@mBg@iCaAmA_@yA]eAKsBOwAS}AYiDc@kF_@yBOh@aDJOBQFa@h@cCPe@ViABc@H[Ba@Ai@Ea@IOg@q@i@m@q@q@MGYGKAAK@_@`@_@\\o@Pk@JiABu@mBMaHg@eHg@k@E?SAeAEsAD_FO?c@?qAAAkC"
- },
- "summary": "Jl. Radio Dalam Raya",
- "warnings": [],
- "waypoint_order": []
- }
- ],
- "status": "OK"
-}
\ No newline at end of file
diff --git a/src/dummy_data/route3.geojson b/src/dummy_data/route3.geojson
deleted file mode 100644
index 9304824..0000000
--- a/src/dummy_data/route3.geojson
+++ /dev/null
@@ -1,259 +0,0 @@
-{
- "type": "FeatureCollection",
- "features": [
- {
- "id": "sales.1",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.1",
- "name": "Sales 1"
- },
- "geometry": {
- "type": "LineString",
- "coordinates": [
- [
- 106.78853,
- -6.26235
- ],
- [
- 106.78863,
- -6.26201
- ],
- [
- 106.78884,
- -6.26091
- ],
- [
- 106.7889,
- -6.26068
- ],
- [
- 106.78896,
- -6.26057
- ],
- [
- 106.78903,
- -6.26023
- ],
- [
- 106.78918,
- -6.25959
- ],
- [
- 106.78953,
- -6.25824
- ],
- [
- 106.78961,
- -6.25788
- ],
- [
- 106.7899,
- -6.25684
- ],
- [
- 106.7902,
- -6.25585
- ],
- [
- 106.7904,
- -6.2553
- ],
- [
- 106.79073,
- -6.25461
- ],
- [
- 106.79089,
- -6.25422
- ],
- [
- 106.79104,
- -6.25377
- ],
- [
- 106.7911,
- -6.25342
- ],
- [
- 106.79118,
- -6.25284
- ],
- [
- 106.79128,
- -6.2524
- ],
- [
- 106.79141,
- -6.25193
- ],
- [
- 106.79159,
- -6.25108
- ],
- [
- 106.79175,
- -6.2499
- ],
- [
- 106.79183,
- -6.24929
- ],
- [
- 106.79264,
- -6.2495
- ],
- [
- 106.79272,
- -6.24956
- ],
- [
- 106.79281,
- -6.24958
- ],
- [
- 106.79298,
- -6.24962
- ],
- [
- 106.79364,
- -6.24983
- ],
- [
- 106.79383,
- -6.24992
- ],
- [
- 106.7942,
- -6.25004
- ],
- [
- 106.79438,
- -6.25006
- ],
- [
- 106.79452,
- -6.25011
- ],
- [
- 106.79469,
- -6.25013
- ],
- [
- 106.7949,
- -6.25012
- ],
- [
- 106.79507,
- -6.25009
- ],
- [
- 106.79515,
- -6.25004
- ],
- [
- 106.7954,
- -6.24984
- ],
- [
- 106.79563,
- -6.24963
- ],
- [
- 106.79588,
- -6.24938
- ],
- [
- 106.79592,
- -6.24931
- ],
- [
- 106.79596,
- -6.24918
- ],
- [
- 106.79597,
- -6.24912
- ],
- [
- 106.79603,
- -6.24911
- ],
- [
- 106.79619,
- -6.24912
- ],
- [
- 106.79635,
- -6.24929
- ],
- [
- 106.79659,
- -6.24944
- ],
- [
- 106.79681,
- -6.24953
- ],
- [
- 106.79718,
- -6.24959
- ],
- [
- 106.79745,
- -6.24961
- ],
- [
- 106.79752,
- -6.24906
- ],
- [
- 106.79772,
- -6.24761
- ],
- [
- 106.79792,
- -6.24614
- ],
- [
- 106.79795,
- -6.24592
- ],
- [
- 106.79805,
- -6.24592
- ],
- [
- 106.7984,
- -6.24591
- ],
- [
- 106.79882,
- -6.24588
- ],
- [
- 106.79994,
- -6.24591
- ],
- [
- 106.79994,
- -6.24583
- ],
- [
- 106.79994,
- -6.24565
- ],
- [
- 106.79995,
- -6.24524
- ],
- [
- 106.80065,
- -6.24523
- ]
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/src/dummy_data/sales.geojson b/src/dummy_data/sales.geojson
deleted file mode 100644
index c9e0832..0000000
--- a/src/dummy_data/sales.geojson
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "type": "FeatureCollection",
- "features": [
- {
- "id": "sales.1",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.1",
- "name": "Sales 1"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 106.79569244384766,
- -6.2395378839383016
- ]
- }
- },
- {
- "id": "sales.2",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.2",
- "name": "Sales 2"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 106.78788185119627,
- -6.2620624718682665
- ]
- }
- },
- {
- "id": "sales.3",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.3",
- "name": "Sales 3"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 106.81011199951172,
- -6.249349850172153
- ]
- }
- },
- {
- "id": "sales.4",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.4",
- "name": "Sales 4"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 106.81543350219727,
- -6.215817763782759
- ]
- }
- },
- {
- "id": "sales.5",
- "geometry_name": "the_geom",
- "type": "Feature",
- "properties": {
- "id": "sales.5",
- "name": "Sales 5"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- 106.80745124816895,
- -6.2746041510497355
- ]
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js
index 6e0e016..0921ab6 100644
--- a/src/views/Dashboard/DashboardBOD.js
+++ b/src/views/Dashboard/DashboardBOD.js
@@ -151,7 +151,7 @@ const DashboardBOD = (props) => {
}
const getProjectPerBudgetHealth = async () => {
- const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Budget Health.";
@@ -174,7 +174,7 @@ const DashboardBOD = (props) => {
}
const getProjectBudgetHealthPerDivision = async () => {
- const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Schedule Health per Division.";
@@ -198,7 +198,7 @@ const DashboardBOD = (props) => {
}
const getProjectScheduleHealthPerDivision = async () => {
- const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Schedule Health.";
@@ -246,7 +246,7 @@ const DashboardBOD = (props) => {
}
const getTotalProjectPerDivision = async () => {
- const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Division.";
@@ -271,7 +271,7 @@ const DashboardBOD = (props) => {
}
const getTotalProjectValuePerDivision = async () => {
- const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${moment().format('YYYY')}`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project Value by Division";
@@ -300,7 +300,7 @@ const DashboardBOD = (props) => {
return;
}
setOpenDetailedView(true);
- const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure`
+ const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Detail Expenditure";
diff --git a/src/views/Dashboard/DashboardProject.js.save b/src/views/Dashboard/DashboardProject.js.save
deleted file mode 100644
index f534d5f..0000000
--- a/src/views/Dashboard/DashboardProject.js.save
+++ /dev/null
@@ -1,1698 +0,0 @@
-import React, { useEffect, useMemo, useRef, useState } from "react";
-import axios from "axios";
-import { Row, Col, Button, Input } from "antd";
-import {
- CardDashboard,
- CardExpenditure,
- CardScheduleHealthPerDivision,
-} from "../../components/CardDashboard/CardDashboard";
-import L from "leaflet";
-import { useParams } from "react-router-dom";
-import "../../assets/css/customscroll.css";
-import moment from "moment";
-import { renderFormatRupiah } from "../../const/CustomFunc";
-import { BASE_OSPRO } from "../../const/ApiConst";
-import { SendOutlined } from "@ant-design/icons";
-import {
- NotificationContainer,
- NotificationManager,
-} from "react-notifications";
-import ContentLoader from "react-content-loader";
-import {
- BehindTaskItem,
- Comment,
- HealthByBudget,
- HealthBySchedule,
- ListLoader,
- PopupContent,
- ProgressActualBar,
- ProgressPlanningBar,
- SingleTextLoader,
-} from "./Components";
-import { Fab, Action } from "react-tiny-fab";
-import "react-tiny-fab/dist/styles.css";
-import { useHistory } from "react-router-dom";
-
-const { TextArea } = Input;
-
-const styles = {
- cardContainer: {
- backgroundColor: "#F8F8F8",
- margin: 2,
- paddingLeft: 20,
- paddingRight: 20,
- paddingTop: 10,
- },
- cardHeaderContainer: {
- display: "flex",
- flexDirection: "row",
- marginBottom: 10,
- },
- cardChartContainer: {
- position: "relative",
- height: "21vh",
- margin: "auto",
- paddingBottom: 10,
- justifyContent: "center",
- },
- cardTitle: { color: "#444444", fontSize: 16, fontWeight: "bold" },
- cardSubtitle: { color: "#888888", fontSize: 12 },
-};
-
-const center = {
- lat: -6.2,
- lng: 106.816666,
-};
-
-const DashboardProject = () => {
- const token = localStorage.getItem("token");
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${token}`,
- },
- };
- const { PROJECT_ID, GANTT_ID, SCURVE } = useParams();
- const URL_GANTT = `https://konstruksi-gantt.ospro.id17/04/2024/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`;
- const mapRef = useRef();
- const [projectName, setProjectName] = useState("");
- const [projectManagerName, setProjectManagerName] = useState("");
- const [customerName, setCustomerName] = useState("");
- const [plannedStart, setPlannedStart] = useState(null);
- const [plannedFinish, setPlannedFinish] = useState(null);
- const [plannedCost, setPlannedCost] = useState(null);
- const [totalCost, setTotalCost] = useState(null);
- const [actualStart, setActualStart] = useState(null);
- const [actualFinish, setActualFinish] = useState(null);
- const [estimatedFinish, setEstimatedFinish] = useState(null);
- 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 [currentBudget, setCurrentBudget] = useState(null);
- const [addCostToComplete, setAddCostToComplete] = useState(null);
- const [actualToDate, setActualToDate] = useState(null);
- const [estAtCompletion, setEstAtCompletion] = useState(null);
- const [bcwp, setBcwp] = useState(null);
- const [costDeviation, setCostDeviation] = useState(null);
- const [remToComplete, setRemToComplete] = useState(0);
- const [totalInvoice, setTotalInvoice] = useState(null);
- const [cashIn, setCashIn] = useState(null);
- const [outstandingBalance, setOutstandingBalance] = useState(null);
- const [comment, setComment] = useState("");
- const [comments, setComments] = useState([]);
- const [isReadyComments, setIsReadyComments] = useState(false);
- const [isSendingComment, setIsSendingComment] = useState(false);
- const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false);
- const [isReadySCurve, setIsReadySCurve] = useState(false);
- const [isReadyGantt, setIsReadyGantt] = useState(false);
- const [isReadyOverdueActivities, setIsReadyOverdueActivities] =
- useState(false);
- const [isReadyIntegrationInvoice, setIsReadyIntegrationInvoice] =
- useState(false);
- const [isReadyReportDistribution, setIsReadyReportDistribution] =
- useState(false);
- const [overdueActivities, setOverdueActivities] = useState([]);
- const [healthBySchedule, setHealthBySchedule] = useState("-");
- const [healthByBudget, setHealthByBudget] = useState("-");
- const [reportDistribution, setReportDistribution] = useState([]);
- const [manPower, setManPower] = useState(0);
- const [assignedHr, setAssignedHr] = useState([]);
- const [assignedHrCount, setAssignedHrCount] = useState(0);
- const [actualHrCount, setActualHrCount] = useState(0);
- const [dataGantt, setDataGantt] = useState({});
- const [dataGanttParents, setDataGanttParents] = useState({});
- const [isReadyGanttParents, setIsReadyGanttParents] = useState(false);
- const [calculationStatus, setCalculationStatus] = useState(false);
- const [isHierarchy, setIsHierarchy] = useState(false);
- let history = useHistory();
-
- useEffect(() => {
- getProjectDetail();
- getSCurve();
- getOverdueActivities();
- getReportDistribution();
- getComments();
- getGantt();
- getGanttParents();
- return () => {
- console.log("unmount RenderMap");
- };
- }, []);
-
- useEffect(() => {
- if (activeTabIdx === 1) {
- initMap();
- }
- }, [activeTabIdx]);
-
- useEffect(() => {
- async function fetchData() {
- await Promise.all([
- getManpower(),
- getAssignedHR(),
- ...(assignedHr.length > 0 ? [getActualHR()] : []),
- ]);
- }
- fetchData();
- }, []);
-
- useEffect(() => {
- let deviation = 0;
- if (plannedCost && totalCost) {
- deviation = plannedCost - totalCost;
- }
- setRemToComplete(deviation.toString());
- }, [plannedCost, totalCost]);
-
- const handleRedirect = () => {
- history.push("/projects/" + GANTT_ID + "/" + PROJECT_ID + "/gantt");
- };
-
- const getManpower = async () => {
- const url = `${BASE_OSPRO}/api/project/manpower/${PROJECT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setManPower(response.data.totalRecord);
- } catch (error) {
- console.error("Failed to get manpower:", error);
- }
- };
-
- const getGantt = async () => {
- setIsReadyGantt(false);
- const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setDataGantt(response);
- if (response.data.data.hierarchy_ftth_id) {
- setIsHierarchy(true);
- }
- setIsReadyGantt(true);
- } catch (error) {
- console.error("Failed to get gantt data:", error);
- setIsReadyGantt(true);
- }
- };
-
- const getGanttParents = async () => {
- setIsReadyGanttParents(false);
- const url = `${BASE_OSPRO}/api/hierarchy-ftths/tree-gantt/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setDataGanttParents(response);
- setIsReadyGanttParents(true);
- } catch (error) {
- console.error("Failed to get gantt data:", error);
- setIsReadyGanttParents(true);
- }
- };
-
- const getAssignedHR = async () => {
- const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- const today = moment();
- const assignedList = response.data.data
- .filter((item) =>
- today.isBetween(moment(item.start_date), moment(item.end_date))
- )
- .map((item) => item.user_id);
- setAssignedHrCount(assignedList.length);
- setAssignedHr(assignedList);
- } catch (error) {
- console.error("Failed to get assigned HR:", error);
- }
- };
-
- const getActualHR = async () => {
- const dateStart = moment().startOf("day").toDate();
- const dateEnd = moment().endOf("day").toDate();
- try {
- const payload = {
- paging: { start: 0, length: -1 },
- columns: [
- {
- name: "name",
- logic_operator: "ilike",
- value: "",
- table_name: "m_users",
- },
- {
- name: "clock_in",
- logic_operator: "range",
- value: dateStart,
- value1: dateEnd,
- },
- ],
- joins: [
- {
- name: "m_users",
- column_join: "user_id",
- column_results: ["name", "ktp_number"],
- },
- ],
- orders: { columns: ["id"], ascending: false },
- };
- const url = `${BASE_OSPRO}/api/presence/search`;
- const response = await axios.post(url, payload, HEADER);
- const actualHrCount = response.data.data.filter((item) =>
- assignedHr.includes(item.user_id)
- ).length;
- setActualHrCount(actualHrCount);
- } catch (error) {
- console.error("Failed to get actual HR:", error);
- }
- };
-
- const getProjectDetail = async () => {
- setIsReadyProjectDetail(false);
- let URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`;
- if (GANTT_ID) {
- URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}/${GANTT_ID}`;
- }
- if (SCURVE) {
- URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}/${GANTT_ID}/${SCURVE}`;
- }
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get project detail failed, ${result.data.message}`,
- "Failed"
- );
- 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 : "-"
- );
- setCustomerName(
- result.data.data.company ? result.data.data.company : "-"
- );
- setPlannedStart(
- SCURVE
- ? result.data.data.mulai_proyek
- ? result.data.data.mulai_proyek
- : null
- : result.data.data.header?.planned_start
- ? result.data.data.header?.planned_start
- : null
- );
- setPlannedFinish(
- SCURVE
- ? result.data.data.akhir_proyek
- ? result.data.data.akhir_proyek
- : null
- : result.data.data.header?.planned_end
- ? result.data.data.header?.planned_end
- : null
- );
- setActualStart(
- result.data.data.header?.start_date
- ? result.data.data.header.start_date
- : null
- );
- setEstimatedFinish(
- result.data.data.header?.end_date
- ? result.data.data.header.end_date
- : null
- );
- setPlannedCost(
- result.data.data.rencana_biaya ? result.data.data.rencana_biaya : null
- );
- setIsReadyProjectDetail(true);
- setCalculationStatus(
- result.data.data.calculation_status
- ? result.data.data.calculation_status
- : false
- );
-
- if (
- result.data.data.kode_sortname &&
- result.data.data.kode_sortname !== ""
- ) {
- if (SCURVE) {
- getIntegrationInvoice(result.data.data.kode_sortname, result.data.data.id);
- } else {
- getIntegrationInvoice(result.data.data.kode_sortname, result.data.data.id, GANTT_ID);
- }
- }
- }
- };
-
- const getSCurve = async () => {
- setIsReadySCurve(false);
- let URL = `${BASE_OSPRO}/api/project/get-s-curve`;
- if (SCURVE && SCURVE == "1" && isHierarchy) {
- URL = `${BASE_OSPRO}/api/project/calculate-s-curve`;
- }
-
- const payload = {
- project_id: PROJECT_ID.toString(),
- gantt_id: GANTT_ID.toString(),
- period: "week",
- // "end_date": moment(new Date()).format('YYYY-MM-DD')
- };
- const result = await axios
- .post(URL, payload, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- setIsReadySCurve(true);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get S Curve failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadySCurve(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- let selisihProgress = 0;
- let planningProgress = 0;
- let actualProgress = 0;
- let statusHealthBySchedule = "on-schedule";
- if (
- result.data.data.length > 0 &&
- result.data.data[0].data?.budget_control
- ) {
- setCurrentBudget(
- result.data.data[0].data.budget_control.current_budget?.toString()
- );
- setActualToDate(
- result.data.data[0].data.budget_control.acwp?.toString()
- );
- setBcwp(result.data.data[0].data.budget_control.bcwp?.toString());
- // setRemToComplete(result.data.data[0].data.budget_control.rem_to_complete?.toString())
- setAddCostToComplete(
- result.data.data[0].data.budget_control.add_cost_to_complete?.toString()
- );
- setEstAtCompletion(
- result.data.data[0].data.budget_control.estimated_at_completion?.toString()
- );
- setCostDeviation(
- 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
- ) {
- if (SCURVE && SCURVE == "1") {
- planningProgress =
- result.data.data[0].data?.percentagePlan[
- result.data.data[0].data?.percentagePlan.length - 1
- ];
- } else {
- planningProgress = result.data.data[0].data?.percentagePlan[n];
- }
- setPlanningProgress(planningProgress);
- }
- if (
- result.data.data.length > 0 &&
- result.data.data[0].data?.percentageReal &&
- result.data.data[0].data?.percentageReal.length > 0
- ) {
- actualProgress =
- result.data.data[0].data?.percentageReal[
- result.data.data[0].data?.percentageReal.length - 1
- ];
- setActualProgress(actualProgress);
- }
-
- selisihProgress = planningProgress - actualProgress;
- if (selisihProgress > 0 && selisihProgress <= 5) {
- statusHealthBySchedule = "warning";
- } else if (selisihProgress > 5) {
- statusHealthBySchedule = "danger";
- }
-
- setHealthBySchedule(statusHealthBySchedule);
- setIsReadySCurve(true);
- }
- };
-
- const getOverdueActivities = async () => {
- setIsReadyOverdueActivities(false);
- const URL = `${BASE_OSPRO}/api/project/get-overdue-activities`;
- const payload = {
- id: PROJECT_ID.toString(),
- gantt: GANTT_ID.toString(),
- scurve: SCURVE ? SCURVE.toString() : null,
- till_date: moment(new Date()).format("YYYY-MM-DD"),
- };
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get Overdue Activities failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyOverdueActivities(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- if (result.data.data.overdueActivities) {
- setOverdueActivities(result.data.data.overdueActivities);
- }
- setHealthByBudget(result.data.data.budget_health);
- setIsReadyOverdueActivities(true);
- }
- };
-
- const getIntegrationInvoice = async (kode_sortname, id, gantt_id = null) => {
- setIsReadyIntegrationInvoice(false);
- const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`;
- let payload = {
- search: kode_sortname,
- id: id
- };
- if (gantt_id) {
- payload.gantt_id = gantt_id;
- }
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get integration invoice failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyIntegrationInvoice(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- if (result.data.data.data) {
- let total_invoice = result.data.data.data.total_invoice_amount;
- let cash_in = result.data.data.data.total_invoice_paid_amount;
- let total_cost = result.data.data.data.total_cost;
- let outstanding_balance = total_invoice - cash_in;
- setTotalInvoice(total_invoice ? total_invoice.toString() : null);
- setCashIn(cash_in ? cash_in.toString() : null);
- total_cost = total_cost.toString().split(".")[0];
- setTotalCost(total_cost ? total_cost.toString() : null);
- setOutstandingBalance(
- outstanding_balance ? outstanding_balance.toString() : null
- );
- }
- setIsReadyIntegrationInvoice(true);
- }
- };
-
- const getReportDistribution = async () => {
- setIsReadyReportDistribution(false);
- const URL = `${BASE_OSPRO}/api/project/get-report-distribution`;
- const payload = {
- project_id: PROJECT_ID,
- 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");
- setIsReadyReportDistribution(true);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get report distribution failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyReportDistribution(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- setReportDistribution(result.data.data);
- setIsReadyReportDistribution(true);
- }
- };
-
- const getComments = async () => {
- setIsReadyComments(false);
- const URL = `${BASE_OSPRO}/api/project-comment/search`;
- const payload = {
- columns: [
- {
- name: "project_id",
- logic_operator: "=",
- value: PROJECT_ID.toString(),
- operator: "AND",
- },
- {
- name: "gantt_id",
- logic_operator: "=",
- value: GANTT_ID.toString(),
- operator: "AND",
- },
- ],
- joins: [
- {
- name: "m_users",
- column_join: "sender_id",
- column_results: ["name", "username"],
- },
- ],
- orders: { columns: ["created_at"], ascending: false },
- paging: { start: 0, length: -1 },
- };
-
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get comments failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyComments(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- setComments(result.data.data);
- setIsReadyComments(true);
- }
- };
-
- const handleSendComment = async () => {
- // console.log('handleSendComment', comment);
- setIsSendingComment(true);
- if (comment === "") {
- NotificationManager.error(
- "Please leave a comment before you send it.",
- "Failed"
- );
- setIsSendingComment(false);
- return;
- }
- const URL = `${BASE_OSPRO}/api/project-comment/add`;
- const payload = {
- sender_id: localStorage.getItem("user_id"),
- project_id: PROJECT_ID,
- gantt_id: GANTT_ID,
- comment: comment,
- };
- const result = await axios
- .post(URL, payload, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
-
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- setIsSendingComment(false);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Post comment failed, ${result.data.message}`,
- "Failed"
- );
- setIsSendingComment(false);
- return;
- } else if (result.status === 200) {
- NotificationManager.success(`Post comment success`, "Success");
- resetInputComment();
- getComments();
- }
- };
-
- const resetInputComment = () => {
- setComment("");
- setIsSendingComment(false);
- };
-
- 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
- window.addEventListener("message", handleIframeMessage);
-
- // Clean up the event listener on component unmount
- return () => {
- window.removeEventListener("message", handleIframeMessage);
- };
- }, []);
-
- const handleIframeMessage = (event) => {
- if (event.data && event.data.action === "getUrl") {
- const childUrl = window.location.href;
-
- // Send the URL back to the iframe
- event.source.postMessage(
- { action: "sendUrl", url: childUrl },
- event.origin
- );
- }
- };
-
- const RenderGantt = useMemo(
- () => (
-
- ),
- [activeTabIdx]
- );
-
- const RenderComments = useMemo(() => {
- return (
- <>
-
-
- {!isReadyComments &&
}
- {isReadyComments && comments && comments.length < 1 && (
-
- No comments found.
-
- )}
- {comments &&
- comments.length > 0 &&
- comments.map((item, idx) => (
-
- ))}
-
- >
- );
- }, [comment, comments, isSendingComment, isReadyComments]);
-
- const RenderBehindTasks = useMemo(() => {
- return (
-
- {!isReadyOverdueActivities &&
}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length < 1 && (
-
- No overdue activity found.
-
- )}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length > 0 &&
- overdueActivities.map((item, idx) => {
- let end_date;
- let planned_end;
- let diffDays = 0;
- let message = "";
- if (item.end_date && item.end_date !== null) {
- end_date = moment(item.end_date);
- planned_end = moment(item.planned_end);
- diffDays = end_date.diff(planned_end, "days");
- if (isNaN(diffDays)) {
- return null;
- } else {
- if (diffDays > 0) {
- message = `Overdue by ${diffDays + 1} days`;
- } else {
- return null;
- }
- }
- }
- return (
-
- );
- })}
-
- );
- }, [overdueActivities, isReadyOverdueActivities]);
-
- return (
-
-
-
-
-
-
-
-
-
-
- Project
-
-
- {isReadyProjectDetail &&
- isReadyGanttParents &&
- isReadyGantt ? (
- (() => {
- let parentNames = "";
- for (
- let i = dataGanttParents.data.data.length - 1;
- i >= 0;
- i--
- ) {
- parentNames += " - ";
- parentNames += dataGanttParents.data.data[i].name;
- }
- return SCURVE && SCURVE == "1"
- ? projectName
- ? calculationStatus
- ? projectName + " - S-Curve Ready"
- : projectName + " - S-Curve Loading"
- : null
- : projectName +
- parentNames +
- " - " +
- dataGantt.data.data.name_version;
- })()
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Project Manager
-
-
- {isReadyProjectDetail ? (
- projectManagerName
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Customer
-
-
- {isReadyProjectDetail ? (
- customerName
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Planned Start
-
-
- {isReadyProjectDetail ? (
- plannedStart ? (
- moment(plannedStart).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Actual Start
-
-
- {isReadyProjectDetail ? (
- actualStart ? (
- moment(actualStart).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Planned Finish
-
-
- {isReadyProjectDetail ? (
- plannedFinish ? (
- moment(plannedFinish).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Estimated Finish
-
-
- {isReadyProjectDetail ? (
- estimatedFinish ? (
- moment(estimatedFinish).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Current Budget
-
-
- {isReadyProjectDetail ? (
- plannedCost ? (
- renderFormatRupiah(plannedCost, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Add Cost to Complete
-
-
- {isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- dataGantt.data.data.cost_to_complete.toString(),
- "Rp."
- )
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Actual to Date
-
-
- {isReadyIntegrationInvoice ? (
- totalCost ? (
- renderFormatRupiah(totalCost, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Est. at Completion
-
-
- {isReadyProjectDetail && isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- (parseInt(plannedCost) + dataGantt.data.data.cost_to_complete).toString(),
- "Rp."
- )
- ) : (
- renderFormatRupiah(
- parseInt(plannedCost).toString(),
- "Rp."
- )
- )
- ) : (
-
- )}
-
-
-
-
-
- BCWP (cost vs perform)
-
-
- {isReadySCurve ? (
- bcwp ? (
- renderFormatRupiah(bcwp, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Cost Deviation
-
-
- {isReadyProjectDetail && isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- (dataGantt.data.data.cost_to_complete).toString(),
- "Rp."
- )
- ) : (
- "Rp. 0"
- )
- ) : (
-
- )}
-
-
-
-
-
- Rem. to Complete
-
-
- {isReadyProjectDetail && isReadyIntegrationInvoice ? (
- remToComplete ? (
- renderFormatRupiah(remToComplete, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Committed Cost
-
-
- {isReadyGantt ? (
- dataGantt.data.data.committed_cost ? (
- renderFormatRupiah(
- dataGantt.data.data.committed_cost.toString(),
- "Rp."
- )
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
- setActiveTabIdx(0)}
- >
- S Curve
-
-
-
- setActiveTabIdx(1)}
- >
- Maps
-
-
-
-
-
-
- {/* { activeTabIdx === 0 &&
{RenderGantt}
}
- { activeTabIdx === 1 &&
} */}
-
- {RenderGantt}
-
- {activeTabIdx === 1 && (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
- Progress
-
- {isReadySCurve ? (
-
100 ? 100 : planningProgress}
- />
- ) : (
-
- )}
-
- {isReadySCurve ? (
- 100
- ? parseFloat(
- (actualProgress / planningProgress) * 100
- ).toFixed(2)
- : actualProgress
- }
- />
- ) : (
-
- )}
-
-
-
-
-
-
- {isReadyOverdueActivities && (
-
- )}
- {isReadySCurve && (
-
- )}
-
-
-
-
-
-
- Manpower : {manPower}
-
-
-
-
-
-
- Assigned : {assignedHrCount}
-
-
-
-
- Actual : {actualHrCount}
-
-
-
-
-
-
-
-
- {/*
Health By Schedule
-
*/}
-
- Total Invoice
-
- {isReadyIntegrationInvoice ? (
- totalInvoice ? (
- renderFormatRupiah(totalInvoice, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Cash In
-
- {isReadyIntegrationInvoice ? (
- cashIn ? (
- renderFormatRupiah(cashIn, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
- Outstanding Balance
-
- {isReadyIntegrationInvoice ? (
- outstandingBalance ? (
- renderFormatRupiah(outstandingBalance, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
- {/*
-
setActiveTabCommentIdx(0)}>Behind Task
-
setActiveTabCommentIdx(1)}>Comment From Customer
-
*/}
-
-
- setActiveTabCommentIdx(0)}
- >
- Behind Task
-
-
-
- setActiveTabCommentIdx(1)}
- >
- Comment From Customer
-
-
-
-
- {activeTabCommentIdx === 0 && RenderBehindTasks}
- {activeTabCommentIdx === 1 && RenderComments}
-
-
-
-
-
-
-
-
- );
-};
-
-export default DashboardProject;
diff --git a/src/views/Dashboard/DashboardProject.js.save.1 b/src/views/Dashboard/DashboardProject.js.save.1
deleted file mode 100644
index 6db17c7..0000000
--- a/src/views/Dashboard/DashboardProject.js.save.1
+++ /dev/null
@@ -1,1698 +0,0 @@
-import React, { useEffect, useMemo, useRef, useState } from "react";
-import axios from "axios";
-import { Row, Col, Button, Input } from "antd";
-import {
- CardDashboard,
- CardExpenditure,
- CardScheduleHealthPerDivision,
-} from "../../components/CardDashboard/CardDashboard";
-import L from "leaflet";
-import { useParams } from "react-router-dom";
-import "../../assets/css/customscroll.css";
-import moment from "moment";
-import { renderFormatRupiah } from "../../const/CustomFunc";
-import { BASE_OSPRO } from "../../const/ApiConst";
-import { SendOutlined } from "@ant-design/icons";
-import {
- NotificationContainer,
- NotificationManager,
-} from "react-notifications";
-import ContentLoader from "react-content-loader";
-import {
- BehindTaskItem,
- Comment,
- HealthByBudget,
- HealthBySchedule,
- ListLoader,
- PopupContent,
- ProgressActualBar,
- ProgressPlanningBar,
- SingleTextLoader,
-} from "./Components";
-import { Fab, Action } from "react-tiny-fab";
-import "react-tiny-fab/dist/styles.css";
-import { useHistory } from "react-router-dom";
-
-const { TextArea } = Input;
-
-const styles = {
- cardContainer: {
- backgroundColor: "#F8F8F8",
- margin: 2,
- paddingLeft: 20,
- paddingRight: 20,
- paddingTop: 10,
- },
- cardHeaderContainer: {
- display: "flex",
- flexDirection: "row",
- marginBottom: 10,
- },
- cardChartContainer: {
- position: "relative",
- height: "21vh",
- margin: "auto",
- paddingBottom: 10,
- justifyContent: "center",
- },
- cardTitle: { color: "#444444", fontSize: 16, fontWeight: "bold" },
- cardSubtitle: { color: "#888888", fontSize: 12 },
-};
-
-const center = {
- lat: -6.2,
- lng: 106.816666,
-};
-
-const DashboardProject = () => {
- const token = localStorage.getItem("token");
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${token}`,
- },
- };
- const { PROJECT_ID, GANTT_ID, SCURVE } = useParams();
- const URL_GANTT = `17/04/2024https://konstruksi-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 mapRef = useRef();
- const [projectName, setProjectName] = useState("");
- const [projectManagerName, setProjectManagerName] = useState("");
- const [customerName, setCustomerName] = useState("");
- const [plannedStart, setPlannedStart] = useState(null);
- const [plannedFinish, setPlannedFinish] = useState(null);
- const [plannedCost, setPlannedCost] = useState(null);
- const [totalCost, setTotalCost] = useState(null);
- const [actualStart, setActualStart] = useState(null);
- const [actualFinish, setActualFinish] = useState(null);
- const [estimatedFinish, setEstimatedFinish] = useState(null);
- 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 [currentBudget, setCurrentBudget] = useState(null);
- const [addCostToComplete, setAddCostToComplete] = useState(null);
- const [actualToDate, setActualToDate] = useState(null);
- const [estAtCompletion, setEstAtCompletion] = useState(null);
- const [bcwp, setBcwp] = useState(null);
- const [costDeviation, setCostDeviation] = useState(null);
- const [remToComplete, setRemToComplete] = useState(0);
- const [totalInvoice, setTotalInvoice] = useState(null);
- const [cashIn, setCashIn] = useState(null);
- const [outstandingBalance, setOutstandingBalance] = useState(null);
- const [comment, setComment] = useState("");
- const [comments, setComments] = useState([]);
- const [isReadyComments, setIsReadyComments] = useState(false);
- const [isSendingComment, setIsSendingComment] = useState(false);
- const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false);
- const [isReadySCurve, setIsReadySCurve] = useState(false);
- const [isReadyGantt, setIsReadyGantt] = useState(false);
- const [isReadyOverdueActivities, setIsReadyOverdueActivities] =
- useState(false);
- const [isReadyIntegrationInvoice, setIsReadyIntegrationInvoice] =
- useState(false);
- const [isReadyReportDistribution, setIsReadyReportDistribution] =
- useState(false);
- const [overdueActivities, setOverdueActivities] = useState([]);
- const [healthBySchedule, setHealthBySchedule] = useState("-");
- const [healthByBudget, setHealthByBudget] = useState("-");
- const [reportDistribution, setReportDistribution] = useState([]);
- const [manPower, setManPower] = useState(0);
- const [assignedHr, setAssignedHr] = useState([]);
- const [assignedHrCount, setAssignedHrCount] = useState(0);
- const [actualHrCount, setActualHrCount] = useState(0);
- const [dataGantt, setDataGantt] = useState({});
- const [dataGanttParents, setDataGanttParents] = useState({});
- const [isReadyGanttParents, setIsReadyGanttParents] = useState(false);
- const [calculationStatus, setCalculationStatus] = useState(false);
- const [isHierarchy, setIsHierarchy] = useState(false);
- let history = useHistory();
-
- useEffect(() => {
- getProjectDetail();
- getSCurve();
- getOverdueActivities();
- getReportDistribution();
- getComments();
- getGantt();
- getGanttParents();
- return () => {
- console.log("unmount RenderMap");
- };
- }, []);
-
- useEffect(() => {
- if (activeTabIdx === 1) {
- initMap();
- }
- }, [activeTabIdx]);
-
- useEffect(() => {
- async function fetchData() {
- await Promise.all([
- getManpower(),
- getAssignedHR(),
- ...(assignedHr.length > 0 ? [getActualHR()] : []),
- ]);
- }
- fetchData();
- }, []);
-
- useEffect(() => {
- let deviation = 0;
- if (plannedCost && totalCost) {
- deviation = plannedCost - totalCost;
- }
- setRemToComplete(deviation.toString());
- }, [plannedCost, totalCost]);
-
- const handleRedirect = () => {
- history.push("/projects/" + GANTT_ID + "/" + PROJECT_ID + "/gantt");
- };
-
- const getManpower = async () => {
- const url = `${BASE_OSPRO}/api/project/manpower/${PROJECT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setManPower(response.data.totalRecord);
- } catch (error) {
- console.error("Failed to get manpower:", error);
- }
- };
-
- const getGantt = async () => {
- setIsReadyGantt(false);
- const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setDataGantt(response);
- if (response.data.data.hierarchy_ftth_id) {
- setIsHierarchy(true);
- }
- setIsReadyGantt(true);
- } catch (error) {
- console.error("Failed to get gantt data:", error);
- setIsReadyGantt(true);
- }
- };
-
- const getGanttParents = async () => {
- setIsReadyGanttParents(false);
- const url = `${BASE_OSPRO}/api/hierarchy-ftths/tree-gantt/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- setDataGanttParents(response);
- setIsReadyGanttParents(true);
- } catch (error) {
- console.error("Failed to get gantt data:", error);
- setIsReadyGanttParents(true);
- }
- };
-
- const getAssignedHR = async () => {
- const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`;
- try {
- const response = await axios.get(url, HEADER);
- const today = moment();
- const assignedList = response.data.data
- .filter((item) =>
- today.isBetween(moment(item.start_date), moment(item.end_date))
- )
- .map((item) => item.user_id);
- setAssignedHrCount(assignedList.length);
- setAssignedHr(assignedList);
- } catch (error) {
- console.error("Failed to get assigned HR:", error);
- }
- };
-
- const getActualHR = async () => {
- const dateStart = moment().startOf("day").toDate();
- const dateEnd = moment().endOf("day").toDate();
- try {
- const payload = {
- paging: { start: 0, length: -1 },
- columns: [
- {
- name: "name",
- logic_operator: "ilike",
- value: "",
- table_name: "m_users",
- },
- {
- name: "clock_in",
- logic_operator: "range",
- value: dateStart,
- value1: dateEnd,
- },
- ],
- joins: [
- {
- name: "m_users",
- column_join: "user_id",
- column_results: ["name", "ktp_number"],
- },
- ],
- orders: { columns: ["id"], ascending: false },
- };
- const url = `${BASE_OSPRO}/api/presence/search`;
- const response = await axios.post(url, payload, HEADER);
- const actualHrCount = response.data.data.filter((item) =>
- assignedHr.includes(item.user_id)
- ).length;
- setActualHrCount(actualHrCount);
- } catch (error) {
- console.error("Failed to get actual HR:", error);
- }
- };
-
- const getProjectDetail = async () => {
- setIsReadyProjectDetail(false);
- let URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`;
- if (GANTT_ID) {
- URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}/${GANTT_ID}`;
- }
- if (SCURVE) {
- URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}/${GANTT_ID}/${SCURVE}`;
- }
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get project detail failed, ${result.data.message}`,
- "Failed"
- );
- 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 : "-"
- );
- setCustomerName(
- result.data.data.company ? result.data.data.company : "-"
- );
- setPlannedStart(
- SCURVE
- ? result.data.data.mulai_proyek
- ? result.data.data.mulai_proyek
- : null
- : result.data.data.header?.planned_start
- ? result.data.data.header?.planned_start
- : null
- );
- setPlannedFinish(
- SCURVE
- ? result.data.data.akhir_proyek
- ? result.data.data.akhir_proyek
- : null
- : result.data.data.header?.planned_end
- ? result.data.data.header?.planned_end
- : null
- );
- setActualStart(
- result.data.data.header?.start_date
- ? result.data.data.header.start_date
- : null
- );
- setEstimatedFinish(
- result.data.data.header?.end_date
- ? result.data.data.header.end_date
- : null
- );
- setPlannedCost(
- result.data.data.rencana_biaya ? result.data.data.rencana_biaya : null
- );
- setIsReadyProjectDetail(true);
- setCalculationStatus(
- result.data.data.calculation_status
- ? result.data.data.calculation_status
- : false
- );
-
- if (
- result.data.data.kode_sortname &&
- result.data.data.kode_sortname !== ""
- ) {
- if (SCURVE) {
- getIntegrationInvoice(result.data.data.kode_sortname, result.data.data.id);
- } else {
- getIntegrationInvoice(result.data.data.kode_sortname, result.data.data.id, GANTT_ID);
- }
- }
- }
- };
-
- const getSCurve = async () => {
- setIsReadySCurve(false);
- let URL = `${BASE_OSPRO}/api/project/get-s-curve`;
- if (SCURVE && SCURVE == "1" && isHierarchy) {
- URL = `${BASE_OSPRO}/api/project/calculate-s-curve`;
- }
-
- const payload = {
- project_id: PROJECT_ID.toString(),
- gantt_id: GANTT_ID.toString(),
- period: "week",
- // "end_date": moment(new Date()).format('YYYY-MM-DD')
- };
- const result = await axios
- .post(URL, payload, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- setIsReadySCurve(true);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get S Curve failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadySCurve(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- let selisihProgress = 0;
- let planningProgress = 0;
- let actualProgress = 0;
- let statusHealthBySchedule = "on-schedule";
- if (
- result.data.data.length > 0 &&
- result.data.data[0].data?.budget_control
- ) {
- setCurrentBudget(
- result.data.data[0].data.budget_control.current_budget?.toString()
- );
- setActualToDate(
- result.data.data[0].data.budget_control.acwp?.toString()
- );
- setBcwp(result.data.data[0].data.budget_control.bcwp?.toString());
- // setRemToComplete(result.data.data[0].data.budget_control.rem_to_complete?.toString())
- setAddCostToComplete(
- result.data.data[0].data.budget_control.add_cost_to_complete?.toString()
- );
- setEstAtCompletion(
- result.data.data[0].data.budget_control.estimated_at_completion?.toString()
- );
- setCostDeviation(
- 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
- ) {
- if (SCURVE && SCURVE == "1") {
- planningProgress =
- result.data.data[0].data?.percentagePlan[
- result.data.data[0].data?.percentagePlan.length - 1
- ];
- } else {
- planningProgress = result.data.data[0].data?.percentagePlan[n];
- }
- setPlanningProgress(planningProgress);
- }
- if (
- result.data.data.length > 0 &&
- result.data.data[0].data?.percentageReal &&
- result.data.data[0].data?.percentageReal.length > 0
- ) {
- actualProgress =
- result.data.data[0].data?.percentageReal[
- result.data.data[0].data?.percentageReal.length - 1
- ];
- setActualProgress(actualProgress);
- }
-
- selisihProgress = planningProgress - actualProgress;
- if (selisihProgress > 0 && selisihProgress <= 5) {
- statusHealthBySchedule = "warning";
- } else if (selisihProgress > 5) {
- statusHealthBySchedule = "danger";
- }
-
- setHealthBySchedule(statusHealthBySchedule);
- setIsReadySCurve(true);
- }
- };
-
- const getOverdueActivities = async () => {
- setIsReadyOverdueActivities(false);
- const URL = `${BASE_OSPRO}/api/project/get-overdue-activities`;
- const payload = {
- id: PROJECT_ID.toString(),
- gantt: GANTT_ID.toString(),
- scurve: SCURVE ? SCURVE.toString() : null,
- till_date: moment(new Date()).format("YYYY-MM-DD"),
- };
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get Overdue Activities failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyOverdueActivities(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- if (result.data.data.overdueActivities) {
- setOverdueActivities(result.data.data.overdueActivities);
- }
- setHealthByBudget(result.data.data.budget_health);
- setIsReadyOverdueActivities(true);
- }
- };
-
- const getIntegrationInvoice = async (kode_sortname, id, gantt_id = null) => {
- setIsReadyIntegrationInvoice(false);
- const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`;
- let payload = {
- search: kode_sortname,
- id: id
- };
- if (gantt_id) {
- payload.gantt_id = gantt_id;
- }
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get integration invoice failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyIntegrationInvoice(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- if (result.data.data.data) {
- let total_invoice = result.data.data.data.total_invoice_amount;
- let cash_in = result.data.data.data.total_invoice_paid_amount;
- let total_cost = result.data.data.data.total_cost;
- let outstanding_balance = total_invoice - cash_in;
- setTotalInvoice(total_invoice ? total_invoice.toString() : null);
- setCashIn(cash_in ? cash_in.toString() : null);
- total_cost = total_cost.toString().split(".")[0];
- setTotalCost(total_cost ? total_cost.toString() : null);
- setOutstandingBalance(
- outstanding_balance ? outstanding_balance.toString() : null
- );
- }
- setIsReadyIntegrationInvoice(true);
- }
- };
-
- const getReportDistribution = async () => {
- setIsReadyReportDistribution(false);
- const URL = `${BASE_OSPRO}/api/project/get-report-distribution`;
- const payload = {
- project_id: PROJECT_ID,
- 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");
- setIsReadyReportDistribution(true);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get report distribution failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyReportDistribution(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- setReportDistribution(result.data.data);
- setIsReadyReportDistribution(true);
- }
- };
-
- const getComments = async () => {
- setIsReadyComments(false);
- const URL = `${BASE_OSPRO}/api/project-comment/search`;
- const payload = {
- columns: [
- {
- name: "project_id",
- logic_operator: "=",
- value: PROJECT_ID.toString(),
- operator: "AND",
- },
- {
- name: "gantt_id",
- logic_operator: "=",
- value: GANTT_ID.toString(),
- operator: "AND",
- },
- ],
- joins: [
- {
- name: "m_users",
- column_join: "sender_id",
- column_results: ["name", "username"],
- },
- ],
- orders: { columns: ["created_at"], ascending: false },
- paging: { start: 0, length: -1 },
- };
-
- const result = await axios
- .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);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Get comments failed, ${result.data.message}`,
- "Failed"
- );
- setIsReadyComments(true);
- return;
- } else if (result.status == 200 && result.data.data) {
- setComments(result.data.data);
- setIsReadyComments(true);
- }
- };
-
- const handleSendComment = async () => {
- // console.log('handleSendComment', comment);
- setIsSendingComment(true);
- if (comment === "") {
- NotificationManager.error(
- "Please leave a comment before you send it.",
- "Failed"
- );
- setIsSendingComment(false);
- return;
- }
- const URL = `${BASE_OSPRO}/api/project-comment/add`;
- const payload = {
- sender_id: localStorage.getItem("user_id"),
- project_id: PROJECT_ID,
- gantt_id: GANTT_ID,
- comment: comment,
- };
- const result = await axios
- .post(URL, payload, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
-
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- setIsSendingComment(false);
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(
- `Post comment failed, ${result.data.message}`,
- "Failed"
- );
- setIsSendingComment(false);
- return;
- } else if (result.status === 200) {
- NotificationManager.success(`Post comment success`, "Success");
- resetInputComment();
- getComments();
- }
- };
-
- const resetInputComment = () => {
- setComment("");
- setIsSendingComment(false);
- };
-
- 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
- window.addEventListener("message", handleIframeMessage);
-
- // Clean up the event listener on component unmount
- return () => {
- window.removeEventListener("message", handleIframeMessage);
- };
- }, []);
-
- const handleIframeMessage = (event) => {
- if (event.data && event.data.action === "getUrl") {
- const childUrl = window.location.href;
-
- // Send the URL back to the iframe
- event.source.postMessage(
- { action: "sendUrl", url: childUrl },
- event.origin
- );
- }
- };
-
- const RenderGantt = useMemo(
- () => (
-
- ),
- [activeTabIdx]
- );
-
- const RenderComments = useMemo(() => {
- return (
- <>
-
-
- {!isReadyComments &&
}
- {isReadyComments && comments && comments.length < 1 && (
-
- No comments found.
-
- )}
- {comments &&
- comments.length > 0 &&
- comments.map((item, idx) => (
-
- ))}
-
- >
- );
- }, [comment, comments, isSendingComment, isReadyComments]);
-
- const RenderBehindTasks = useMemo(() => {
- return (
-
- {!isReadyOverdueActivities &&
}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length < 1 && (
-
- No overdue activity found.
-
- )}
- {isReadyOverdueActivities &&
- overdueActivities &&
- overdueActivities.length > 0 &&
- overdueActivities.map((item, idx) => {
- let end_date;
- let planned_end;
- let diffDays = 0;
- let message = "";
- if (item.end_date && item.end_date !== null) {
- end_date = moment(item.end_date);
- planned_end = moment(item.planned_end);
- diffDays = end_date.diff(planned_end, "days");
- if (isNaN(diffDays)) {
- return null;
- } else {
- if (diffDays > 0) {
- message = `Overdue by ${diffDays + 1} days`;
- } else {
- return null;
- }
- }
- }
- return (
-
- );
- })}
-
- );
- }, [overdueActivities, isReadyOverdueActivities]);
-
- return (
-
-
-
-
-
-
-
-
-
-
- Project
-
-
- {isReadyProjectDetail &&
- isReadyGanttParents &&
- isReadyGantt ? (
- (() => {
- let parentNames = "";
- for (
- let i = dataGanttParents.data.data.length - 1;
- i >= 0;
- i--
- ) {
- parentNames += " - ";
- parentNames += dataGanttParents.data.data[i].name;
- }
- return SCURVE && SCURVE == "1"
- ? projectName
- ? calculationStatus
- ? projectName + " - S-Curve Ready"
- : projectName + " - S-Curve Loading"
- : null
- : projectName +
- parentNames +
- " - " +
- dataGantt.data.data.name_version;
- })()
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Project Manager
-
-
- {isReadyProjectDetail ? (
- projectManagerName
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Customer
-
-
- {isReadyProjectDetail ? (
- customerName
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Planned Start
-
-
- {isReadyProjectDetail ? (
- plannedStart ? (
- moment(plannedStart).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Actual Start
-
-
- {isReadyProjectDetail ? (
- actualStart ? (
- moment(actualStart).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Planned Finish
-
-
- {isReadyProjectDetail ? (
- plannedFinish ? (
- moment(plannedFinish).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Estimated Finish
-
-
- {isReadyProjectDetail ? (
- estimatedFinish ? (
- moment(estimatedFinish).format("D MMMM YYYY")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Current Budget
-
-
- {isReadyProjectDetail ? (
- plannedCost ? (
- renderFormatRupiah(plannedCost, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Add Cost to Complete
-
-
- {isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- dataGantt.data.data.cost_to_complete.toString(),
- "Rp."
- )
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
- Actual to Date
-
-
- {isReadyIntegrationInvoice ? (
- totalCost ? (
- renderFormatRupiah(totalCost, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Est. at Completion
-
-
- {isReadyProjectDetail && isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- (parseInt(plannedCost) + dataGantt.data.data.cost_to_complete).toString(),
- "Rp."
- )
- ) : (
- renderFormatRupiah(
- parseInt(plannedCost).toString(),
- "Rp."
- )
- )
- ) : (
-
- )}
-
-
-
-
-
- BCWP (cost vs perform)
-
-
- {isReadySCurve ? (
- bcwp ? (
- renderFormatRupiah(bcwp, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Cost Deviation
-
-
- {isReadyProjectDetail && isReadyGantt ? (
- dataGantt.data.data.cost_to_complete ? (
- renderFormatRupiah(
- (dataGantt.data.data.cost_to_complete).toString(),
- "Rp."
- )
- ) : (
- "Rp. 0"
- )
- ) : (
-
- )}
-
-
-
-
-
- Rem. to Complete
-
-
- {isReadyProjectDetail && isReadyIntegrationInvoice ? (
- remToComplete ? (
- renderFormatRupiah(remToComplete, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Committed Cost
-
-
- {isReadyGantt ? (
- dataGantt.data.data.committed_cost ? (
- renderFormatRupiah(
- dataGantt.data.data.committed_cost.toString(),
- "Rp."
- )
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
- setActiveTabIdx(0)}
- >
- S Curve
-
-
-
- setActiveTabIdx(1)}
- >
- Maps
-
-
-
-
-
-
- {/* { activeTabIdx === 0 &&
{RenderGantt}
}
- { activeTabIdx === 1 &&
} */}
-
- {RenderGantt}
-
- {activeTabIdx === 1 && (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
- Progress
-
- {isReadySCurve ? (
-
100 ? 100 : planningProgress}
- />
- ) : (
-
- )}
-
- {isReadySCurve ? (
- 100
- ? parseFloat(
- (actualProgress / planningProgress) * 100
- ).toFixed(2)
- : actualProgress
- }
- />
- ) : (
-
- )}
-
-
-
-
-
-
- {isReadyOverdueActivities && (
-
- )}
- {isReadySCurve && (
-
- )}
-
-
-
-
-
-
- Manpower : {manPower}
-
-
-
-
-
-
- Assigned : {assignedHrCount}
-
-
-
-
- Actual : {actualHrCount}
-
-
-
-
-
-
-
-
- {/*
Health By Schedule
-
*/}
-
- Total Invoice
-
- {isReadyIntegrationInvoice ? (
- totalInvoice ? (
- renderFormatRupiah(totalInvoice, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
- Cash In
-
- {isReadyIntegrationInvoice ? (
- cashIn ? (
- renderFormatRupiah(cashIn, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
- Outstanding Balance
-
- {isReadyIntegrationInvoice ? (
- outstandingBalance ? (
- renderFormatRupiah(outstandingBalance, "Rp.")
- ) : (
- "-"
- )
- ) : (
-
- )}
-
-
-
-
-
-
-
-
- {/*
-
setActiveTabCommentIdx(0)}>Behind Task
-
setActiveTabCommentIdx(1)}>Comment From Customer
-
*/}
-
-
- setActiveTabCommentIdx(0)}
- >
- Behind Task
-
-
-
- setActiveTabCommentIdx(1)}
- >
- Comment From Customer
-
-
-
-
- {activeTabCommentIdx === 0 && RenderBehindTasks}
- {activeTabCommentIdx === 1 && RenderComments}
-
-
-
-
-
-
-
-
- );
-};
-
-export default DashboardProject;
diff --git a/src/views/DashboardProject/chatDashboard.js b/src/views/DashboardProject/chatDashboard.js
deleted file mode 100644
index b45bcdd..0000000
--- a/src/views/DashboardProject/chatDashboard.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-const ChatDashboard = (props) => {
- const { dataParams } = props;
-
- const renderComment = (items) => {
- return items.map((item, idx) => {
- return (
-
-
-
- {item.comment_by}
-
-
- {item.comment}
-
-
- {item.comment_created}
-
-
-
- )
- })
- }
-
-
- return (
-
-
-
- {renderComment(dataParams)}
-
-
- );
-}
-export default ChatDashboard;
\ No newline at end of file
diff --git a/src/views/DashboardProject/ganttDashboard.js b/src/views/DashboardProject/ganttDashboard.js
deleted file mode 100644
index 49eb582..0000000
--- a/src/views/DashboardProject/ganttDashboard.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import React, { useEffect, useMemo, useState } from 'react';
-import Timeline from 'react-calendar-timeline'
-// make sure you include the timeline stylesheet or the timeline will not be styled
-import 'react-calendar-timeline/lib/Timeline.css'
-import { useParams } from 'react-router-dom';
-// import moment from 'moment';
-// import { USER_VERSION_GANTT_SEARCH, BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
-// import axios from "../../../const/interceptorApi"
-const token = localStorage.getItem("token")
-
-const Gantt = (props) => {
-const { ID } = useParams();
-const { GANTTID } = useParams();
-const url = `https://konstruksi-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 RenderGantt = () => (
-
- )
- return (
-
-
-
- );
-}
-export default Gantt;
diff --git a/src/views/DashboardProject/index.js b/src/views/DashboardProject/index.js
deleted file mode 100644
index 0aa5b31..0000000
--- a/src/views/DashboardProject/index.js
+++ /dev/null
@@ -1,275 +0,0 @@
-import React, { useEffect, useState } from 'react';
-import { Row, Col, Select, Divider } from 'antd';
-import moment from 'moment'
-import Gantt from './ganttDashboard';
-import ChatDashboard from './chatDashboard';
-import axios from 'axios'
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import { useParams } from 'react-router-dom';
-import { Badge } from 'reactstrap';
-import { BASE_OSPRO, BASE_INTEGRATION_V1, TOKEN_ADW } from '../../const/ApiConst';
-import {formatRibuanDecimal} from "../../const/CustomFunc";
-import ProgressBar from "./progressBar";
-import numeral from 'numeral';
-
-function BoxDashboard({ value, title, secondaryTitle, icon, bgColor }) {
- return (
-
- )
-}
-
-function RenderHealthProject({params}){
- if (params == "on-budget") {
- return (On Budget)
- } else if (params == "warning") {
- return (Warning)
- } else {
- return (Danger)
- }
-}
-
-const DashboardProject = () => {
-
- const { ID } = useParams();
- const [STATUSPROJECT, SET_STATUSPROJECT] = useState([])
- const [PROJECTMGR, SET_PROJECTMGR] = useState([])
- const [RO, SET_RO] = useState([])
- // Schedule
- const [STARTDATE, SET_STARTDATE] = useState([])
- const [BASELINEFINISHDATE, SET_BASELINEFINISHDATE] = useState([])
- const [ESTFINISHDATE, SET_ESTFINISHDATE] = useState([])
- // Financials
- const [BCWP, SET_BCWP] = useState([])
- const [ACWP, SET_ACWP] = useState([])
- const [VARIANCE, SET_VARIANCE] = useState([])
- const [PROGRESS, SET_PROGRESS] = useState([])
- const [BUDGET, SET_BUDGET] = useState([])
- const [PROJECTNAME, SET_PROJECTNAME] = useState([])
- const [CURRENCYSYMBOL, SET_CURRENCYSYMBOL] = useState([])
- const [BUDGETHEALTH, SET_BUDGETHEALTH] = useState([])
- const [COMMENT, SET_COMMENT] = useState([])
- const [MANPOWER, SET_MANPOWER] = useState([0])
-
- const token = localStorage.getItem("token")
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
- }
-
- const HEADER_INTEGRASI = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `${TOKEN_ADW}`
- }
- }
-
- const getProjectDetail = async () => {
- const URL = `${BASE_OSPRO}/api/project/dashboard/${ID}`
- const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
-
- if (result.data.code !== 200) {
- NotificationManager.error(result.data.message, 'Failed');
- }
-
- if(result.data.code == 200) {
- let resData = result.data.data;
- SET_BUDGET(resData.rencana_biaya)
- SET_PROJECTMGR(resData.pm)
- SET_RO(resData.company)
- SET_PROJECTNAME(resData.name_project)
- SET_STARTDATE(resData.start)
- SET_BASELINEFINISHDATE(resData.finish)
- SET_CURRENCYSYMBOL(resData.currency_symbol)
- SET_BUDGETHEALTH(resData.budget_health)
- SET_ACWP(resData.actual_cost)
- SET_PROGRESS(resData.progress)
- SET_COMMENT(resData.comment)
- SET_MANPOWER(resData.man_power)
- getDataCostActual(resData.kode_sortname);
- }
- }
-
- const getDataCostActual = async (kode_project) => {
- const URL = `${BASE_INTEGRATION_V1}/api/project_cost?project_no=${kode_project}`
- const result = await axios.get(URL, HEADER_INTEGRASI).then(res => res).catch(err => err.response)
- if (!result.data.data) {
- NotificationManager.error('Integrasi Cost Actual Failed', 'Failed');
- }else {
- SET_ACWP(result.data.data.total_cost)
- }
-
- }
-
- useEffect(() => {
- getProjectDetail();
- }, [])
-
-
- return (
-
-
-
-
-
-
Project
-
{PROJECTNAME}
-
-
-
-
-
-
-
-
-
-
-
-
Date
-
{moment().format("DD-MM-YYYY")}
-
-
-
-
-
-
-
-
SCHEDULE
-
-
-
-
-
-
Start Date
-
{moment(STARTDATE).format("LL")}
-
-
-
-
-
-
-
-
-
-
Baseline Finish Date
-
{moment(BASELINEFINISHDATE).format("LL")}
-
-
-
-
-
-
-
-
-
-
Estimated Finish Date
-
{moment(ESTFINISHDATE).format("LL")}
-
-
-
-
-
-
-
-
-
FINANCIALS
-
-
-
-
-
-
Budget Proyek
-
{`${formatRibuanDecimal(BUDGET)}`}
-
-
-
-
-
-
-
-
-
-
Actual Cost
-
{`${formatRibuanDecimal(ACWP)}`}
-
-
-
-
-
-
-
-
-
-
Variance
-
{`${formatRibuanDecimal(BUDGET - ACWP)}`}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/*
*/}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-export default DashboardProject;
diff --git a/src/views/DashboardProject/progressBar.js b/src/views/DashboardProject/progressBar.js
deleted file mode 100644
index 4eb2209..0000000
--- a/src/views/DashboardProject/progressBar.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from "react";
-
-const ProgressBar = (props) => {
- const { bgcolor, completed } = props;
-
- const containerStyles = {
- height: 25,
- width: '100%',
- backgroundColor: "#e0e0de",
- borderRadius: 50,
- margin: 0
- }
-
- const fillerStyles = {
- height: '100%',
- width: `${completed}%`,
- backgroundColor: bgcolor,
- borderRadius: 'inherit',
- textAlign: 'right'
- }
-
- const labelStyles = {
- padding: 5,
- color: 'white',
- fontWeight: 'bold'
- }
-
- return (
-