diff --git a/docs/WhatsApp Image 2022-07-07 at 11.53.46 AM.jpeg b/docs/WhatsApp Image 2022-07-07 at 11.53.46 AM.jpeg deleted file mode 100644 index 76a24c7..0000000 Binary files a/docs/WhatsApp Image 2022-07-07 at 11.53.46 AM.jpeg and /dev/null differ diff --git a/src/assets/img/brand/logo.svg b/src/assets/img/brand/logo.svg deleted file mode 100644 index 8437742..0000000 --- a/src/assets/img/brand/logo.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/img/brand/logo_bmd_denpasar.png b/src/assets/img/brand/logo_bmd_denpasar.png deleted file mode 100644 index 759180d..0000000 Binary files a/src/assets/img/brand/logo_bmd_denpasar.png and /dev/null differ diff --git a/src/assets/img/brand/logo_kominfo.jpeg b/src/assets/img/brand/logo_kominfo.jpeg deleted file mode 100644 index 4345765..0000000 Binary files a/src/assets/img/brand/logo_kominfo.jpeg and /dev/null differ diff --git a/src/assets/img/brand/logo_siopas.png b/src/assets/img/brand/logo_siopas.png deleted file mode 100644 index 041d9e9..0000000 Binary files a/src/assets/img/brand/logo_siopas.png and /dev/null differ diff --git a/src/assets/img/brand/logo_siopas_old.png b/src/assets/img/brand/logo_siopas_old.png deleted file mode 100644 index 4afc248..0000000 Binary files a/src/assets/img/brand/logo_siopas_old.png and /dev/null differ diff --git a/src/assets/img/brand/sygnet.svg b/src/assets/img/brand/sygnet.svg deleted file mode 100644 index 4967443..0000000 --- a/src/assets/img/brand/sygnet.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/assets/img/logo-surveyor-indonesia-2.png b/src/assets/img/logo-surveyor-indonesia-2.png deleted file mode 100644 index 6ddf492..0000000 Binary files a/src/assets/img/logo-surveyor-indonesia-2.png and /dev/null differ diff --git a/src/assets/img/logo-surveyor-indonesia.png b/src/assets/img/logo-surveyor-indonesia.png deleted file mode 100644 index df1dfc4..0000000 Binary files a/src/assets/img/logo-surveyor-indonesia.png and /dev/null differ diff --git a/src/assets/img/logo_adyawinsa.jpg b/src/assets/img/logo_adyawinsa.jpg deleted file mode 100644 index 3aed73b..0000000 Binary files a/src/assets/img/logo_adyawinsa.jpg and /dev/null differ diff --git a/src/assets/img/logo_kit.png b/src/assets/img/logo_kit.png deleted file mode 100644 index 8f9a56a..0000000 Binary files a/src/assets/img/logo_kit.png and /dev/null differ diff --git a/src/assets/img/logo_nawakara.png b/src/assets/img/logo_nawakara.png deleted file mode 100644 index df2ed5f..0000000 Binary files a/src/assets/img/logo_nawakara.png and /dev/null differ diff --git a/src/assets/img/yokke.png b/src/assets/img/yokke.png deleted file mode 100644 index 2d3b32f..0000000 Binary files a/src/assets/img/yokke.png and /dev/null differ diff --git a/src/components/MapHeader/MapHeader.js b/src/components/MapHeader/MapHeader.js index f529f0c..3b0a4a4 100644 --- a/src/components/MapHeader/MapHeader.js +++ b/src/components/MapHeader/MapHeader.js @@ -1,20 +1,16 @@ import React, { Component } from 'react'; -import { Link, NavLink } from 'react-router-dom'; -import { Badge, UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem, - InputGroup, Input, InputGroupAddon, InputGroupText, Button, UncontrolledTooltip +import { NavLink } from 'react-router-dom'; +import { + UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem, + UncontrolledTooltip } from 'reactstrap'; import PropTypes from 'prop-types'; -import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react'; -import logo from '../../assets/img/brand/logo_siopas.png' -import logo_bmd_denpasar from '../../assets/img/brand/logo_bmd_denpasar.png' import user_logo from '../../assets/img/avatars/user.png' -import sygnet from '../../assets/img/brand/sygnet.svg' -import { Icon, InlineIcon } from '@iconify/react'; -import saveOutline from '@iconify/icons-ion/save-outline'; +import { Icon } from '@iconify/react'; import printOutline from '@iconify/icons-ion/print-outline'; import { - AppHeader + AppHeader } from '@coreui/react'; import { mappify, @@ -23,7 +19,7 @@ import { import { nominatimBaseUrl } from '../../const/MapConst'; const propTypes = { - children: PropTypes.node, + children: PropTypes.node, }; const defaultProps = {}; @@ -31,71 +27,71 @@ const defaultProps = {}; class MapHeader extends Component { - getHeaderMenu = () => { - let u_group = localStorage.getItem('u_group'); - if (u_group == 'kominfo') { - return ( - - Dashboard - - ) - } - else { - return ( - - Dashboard - - ) - } - } - - getLogo = () => { - return ( -
- OSPRO -
- ) - } + getHeaderMenu = () => { + let u_group = localStorage.getItem('u_group'); + if (u_group == 'kominfo') { + return ( + + Dashboard + + ) + } + else { + return ( + + Dashboard + + ) + } + } + + getLogo = () => { + return ( +
+ OSPRO +
+ ) + } render() { - const { children, ...attributes } = this.props; + const { children, ...attributes } = this.props; - return ( - - {/* + {/**/} - { this.getLogo() } + {this.getLogo()} - - + + ) } 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 { {/*
this.showImageFeature(selectedPopupData)}>*/}
- { this.renderImageSlider(selectedPopupData) } + {this.renderImageSlider(selectedPopupData)}
- { this.renderOneRowFeature(popupProperties) } + {this.renderOneRowFeature(popupProperties)}
- { this.renderButtonFooter(selectedPopupData) } + {this.renderButtonFooter(selectedPopupData)}
@@ -261,7 +261,7 @@ class PopupContainer extends Component { for (let key in popupProperties) { - if (typeof(popupProperties[key]) === 'object') { + if (typeof (popupProperties[key]) === 'object') { for (let prop in popupProperties[key]) { modPopupProperties[prop] = popupProperties[key][prop]; } @@ -271,7 +271,7 @@ class PopupContainer extends Component { } for (let key in modPopupProperties) { - if (typeof(modPopupProperties[key]) === 'object') { + if (typeof (modPopupProperties[key]) === 'object') { delete modPopupProperties[key]; } } @@ -293,7 +293,7 @@ class PopupContainer extends Component { const row = []; for (let key in popupProperties) { - + let propKey = this.matchLayerAttribute(key); if (propKey !== undefined) { @@ -310,7 +310,7 @@ class PopupContainer extends Component { renderButtonFooter = (selectedPopupData) => { let layer_name = selectedPopupData.id && selectedPopupData.id.substr(0, selectedPopupData.id.indexOf(".")); - return( + return ( ) : - () + {this.props.activeStateAddGeometry ? + () : + () } Edit Geometry @@ -354,27 +354,27 @@ class PopupContainer extends Component { Delete Feature - { layer_name && (layer_name === "m_sales" || layer_name === "m_employee" || layer_name === "m_waspang" || layer_name === "m_presensi") && - <> - - - Show Route - - } + {layer_name && (layer_name === "m_sales" || layer_name === "m_employee" || layer_name === "m_waspang" || layer_name === "m_presensi") && + <> + + + Show Route + + } ) } renderImageSlider = (selectedPopupData) => { - if (this.props.popupDataTemp[0].id == selectedPopupData.id) { + if (this.props.popupDataTemp[0].id == selectedPopupData.id) { return ; } else { return @@ -466,13 +466,13 @@ class PopupContainer extends Component {
- { popupDataTemp.map((item, index) => { - return ( { + return ( this.chooseOneFeature(item)}> - - - ) - }) } + + + ) + })}
{this.getFeaturesLabel(item)} {this.getLayerTitle(item)}
{this.getFeaturesLabel(item)} {this.getLayerTitle(item)}
@@ -492,73 +492,73 @@ class PopupContainer extends Component { showImageFeature = (selectedPopupData) => { console.log('show images', selectedPopupData); - this.setState({imagePopupTitle: selectedPopupData.id}); + this.setState({ imagePopupTitle: selectedPopupData.id }); this.toggleImagePopup(); } getFrontPhotoLicense = event => { this.setState({ - photo_feature: event.target.files[0], - image_feature: URL.createObjectURL(event.target.files[0]), - imagePreviewVisible: true + photo_feature: event.target.files[0], + image_feature: URL.createObjectURL(event.target.files[0]), + imagePreviewVisible: true }) } toggleImagePopup = () => { - this.setState({imagePopupVisible: !this.state.imagePopupVisible}); + this.setState({ imagePopupVisible: !this.state.imagePopupVisible }); } handleUploadImage = async () => { - const {photo_feature, image_feature, imagePopupTitle} = this.state - - const category = imagePopupTitle.split("."); - let type = category[0] - let id = category[1] - let imageType = '' - - if(type==="m_office"){ - imageType="office" - }else if(type==="m_sales"){ - imageType="m_sales" - }else if(type==="m_employee"){ - imageType="employee" - }else{ - imageType="customer" - } - const formData = new FormData() - formData.append('ref_id', id) - formData.append('files', photo_feature) - let url = `${BASE_SIMPRO}/image/${imageType}/upload`; - const result = await axios.post(url, formData) - .then(res => res) - .catch((error) => error.response); + const { photo_feature, image_feature, imagePopupTitle } = this.state + + const category = imagePopupTitle.split("."); + let type = category[0] + let id = category[1] + let imageType = '' + + if (type === "m_office") { + imageType = "office" + } else if (type === "m_sales") { + imageType = "m_sales" + } else if (type === "m_employee") { + imageType = "employee" + } else { + imageType = "customer" + } + const formData = new FormData() + formData.append('ref_id', id) + formData.append('files', photo_feature) + let url = `${BASE_SIMPRO}/image/${imageType}/upload`; + const result = await axios.post(url, formData) + .then(res => res) + .catch((error) => error.response); - return result + return result } toggleImagePreview = async param => { - if(param == "upload"){ - const result = await this.handleUploadImage() - console.log("response upload image",result); - if (result == undefined) { - alert('Upload Failed'); - return; + if (param == "upload") { + const result = await this.handleUploadImage() + console.log("response upload image", result); + if (result == undefined) { + alert('Upload Failed'); + return; + } + else { + if (result.data.code == 200) { + alert('Successfully uploaded image'); + this.toggleImagePopup(); } else { - if (result.data.code == 200) { - alert('Successfully uploaded image'); - this.toggleImagePopup(); - } - else { - console.log('err',result); - alert(result.data); - return; - } + console.log('err', result); + alert(result.data); + return; } + } } - this.setState({imagePreviewVisible: !this.state.imagePreviewVisible}); + this.setState({ imagePreviewVisible: !this.state.imagePreviewVisible }); } showTable = (selectedPopupData) => { @@ -566,16 +566,16 @@ class PopupContainer extends Component { } toggleShowTable = () => { - this.setState({mapTableVisible: !this.state.mapTableVisible}) + this.setState({ mapTableVisible: !this.state.mapTableVisible }) } editFeature = (selectedPopupData) => { console.log('edit feature', selectedPopupData); - this.setState({selectedPopupData: selectedPopupData}, () => this.toggleEditFeature()); + this.setState({ selectedPopupData: selectedPopupData }, () => this.toggleEditFeature()); } toggleEditFeature = () => { - this.setState({editFeatureVisible: !this.state.editFeatureVisible}) + this.setState({ editFeatureVisible: !this.state.editFeatureVisible }) } /*goToFeature = (selectedPopupData) => { @@ -662,7 +662,7 @@ class PopupContainer extends Component { } toggleEditGeometry = () => { - this.setState({editGeometryVisible: !this.state.editGeometryVisible}) + this.setState({ editGeometryVisible: !this.state.editGeometryVisible }) } deleteFeature = async (selectedPopupData) => { @@ -707,38 +707,38 @@ class PopupContainer extends Component { console.log('imageArr', imageArr); }*/ - + render() { let { isReady, alert, alertMessage, successAlert, dangerAlert } = this.state; if (!isReady) { return
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 Raya
Pass 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 Raya
Pass 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 9
Destination 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 ( - <> -
-