diff --git a/.env b/.env
index 495d264..1925e46 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,4 @@
-PORT=3000
-CHOKIDAR_USEPOLLING=true
-GENERATE_SOURCEMAP=false
\ No newline at end of file
+PORT=3000
+CHOKIDAR_USEPOLLING=true
+GENERATE_SOURCEMAP=false
+SKIP_PREFLIGHT_CHECK=true
diff --git a/src/appredux/modules/map/actions.js b/src/appredux/modules/map/actions.js
index db12266..0462355 100644
--- a/src/appredux/modules/map/actions.js
+++ b/src/appredux/modules/map/actions.js
@@ -158,11 +158,41 @@ export const getUserHistory = async (userId, dateString) => {
"features": []
}
+ // build waypoint line
+ let featureLine = {
+ "type": "Feature",
+ "properties": {},
+ "geometry": {
+ "type": "LineString",
+ "coordinates": []
+ }
+ }
+
+ userHistory.data.map((n, idx) => {
+ featureLine.geometry.coordinates.push([parseFloat(n.lon), parseFloat(n.lat)])
+
+ if (idx > startIdx && idx < endIdx) {
+ let featureOnTrip = {
+ "type": "Feature",
+ "properties": {
+ "type": "Working",
+ "wptime": n.wptime
+ },
+ "geometry": {
+ "type": "Point",
+ "coordinates": [parseFloat(n.lon), parseFloat(n.lat)]
+ }
+ }
+ featureCollection.features.push(featureOnTrip);
+ }
+ });
+ featureCollection.features.push(featureLine);
+
// set waypoint start
let featurePointStart = {
"type": "Feature",
"properties": {
- "type": "start",
+ "type": "Start",
"wptime": userHistory.data[startIdx].wptime
},
"geometry": {
@@ -176,7 +206,7 @@ export const getUserHistory = async (userId, dateString) => {
let featurePointEnd = {
"type": "Feature",
"properties": {
- "type": "end",
+ "type": "End",
"wptime": userHistory.data[endIdx].wptime
},
"geometry": {
@@ -186,21 +216,6 @@ export const getUserHistory = async (userId, dateString) => {
}
featureCollection.features.push(featurePointEnd);
- // build waypoint line
- let featureLine = {
- "type": "Feature",
- "properties": {},
- "geometry": {
- "type": "LineString",
- "coordinates": []
- }
- }
-
- userHistory.data.map(n => {
- featureLine.geometry.coordinates.push([parseFloat(n.lon), parseFloat(n.lat)])
- });
- featureCollection.features.push(featureLine);
-
store.dispatch(setUserHistory(featureCollection));
store.dispatch(setIsSearchingRoute(false));
}
diff --git a/src/assets/img/map/pin_route_on_trip.png b/src/assets/img/map/pin_route_on_trip.png
new file mode 100644
index 0000000..a3c9d0c
Binary files /dev/null and b/src/assets/img/map/pin_route_on_trip.png differ
diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js
index 07b56d8..cbed48f 100644
--- a/src/const/ApiConst.js
+++ b/src/const/ApiConst.js
@@ -1,471 +1,678 @@
-import { appConfig, MAP_ID } from './MapConst';
-const roleName = window.localStorage.getItem('role_name');
-const HOST = "https://osmap.id"; // online
-
-export const API_ADW = "http://ospro-api.adyawinsa.com:9083/api/";
-
-export const BASE_URL_GEOHR_API = "https://oslog.id/geohr-api";
-export const BASE_URL_GEOHR_API2 = "http://siopas.co.id/custom-php/api/geohr";
-
-export const BASE_API = `${HOST}/osmap-php/index.php`;
-
-export const BASE_IMAGE = `${HOST}/osmap-php`;
-export const BASE_IMAGE_EMPLOYEE = "https://oslog.id/geohr-api/assets/images/employee/"
-
-export const SIOPAS_API = `${BASE_API}/siopas`
-
-export const API_LOGIN = `${SIOPAS_API}/user/login`
-
-export const API_LOG = `${SIOPAS_API}/user/log`
-
-export const API_USER_SESSION = `${SIOPAS_API}/user/get_valid_session`
-
-export const API_GET_COLUMN_TABLE = `${BASE_API}/map/getColumnNameAndType`
-export const API_CREATE_NEW_LAYER = `${BASE_API}/map/createlayer`
-
-export const API_LOAD_MAP = `${SIOPAS_API}/map/load/${MAP_ID}`
-export const API_UPDATE_MAP = `${SIOPAS_API}/map/update`
-
-export const API_UPLOAD_IMAGE = `${SIOPAS_API}/feature/uploadimage`
-export const API_GET_IMAGE = `${SIOPAS_API}/feature/getimage`
-
-export const API_UPDATE_FEATURE = `${SIOPAS_API}/feature/update`
-
-export const API_GET_CHART_TIPE_GEOMETRY = `${SIOPAS_API}/dashboard/chart/tipe-geometry?map_id=${MAP_ID}`
-export const API_GET_CHART_KATEGORI = `${SIOPAS_API}/dashboard/chart/tipe-kategori?map_id=${MAP_ID}`
-
-export const API_LIST_DATA_COUNTRY = `${SIOPAS_API}/country`
-export const API_INSERT_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/insertDataCountry`
-export const API_UPDATE_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/updateDataCountry`
-export const API_DELETE_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/deleteDataCountry`
-
-export const API_LIST_DATA_DISTRICT = `${SIOPAS_API}/district`
-export const API_INSERT_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/insertDataDistrict`
-export const API_UPDATE_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/updateDataDistrict`
-export const API_DELETE_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/deleteDataDistrict`
-
-export const API_LIST_DATA_SUBDISTRICT = `${SIOPAS_API}/subdistrict`
-export const API_INSERT_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/insertDataSubdistrict`
-export const API_UPDATE_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/updateDataSubdistrict`
-export const API_DELETE_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/deleteDataSubdistrict`
-
-export const API_LIST_DATA_PROVINCE = `${SIOPAS_API}/province`
-export const API_UPDATE_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/updateDataProvince`
-export const API_INSERT_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/insertDataProvince`
-export const API_DELETE_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/deleteDataProvince`
-
-export const API_LIST_DATA_VILLAGE = `${SIOPAS_API}/village`
-export const API_UPDATE_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/updateDataVillage`
-export const API_INSERT_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/insertDataVillage`
-export const API_DELETE_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/deleteDataVillage`
-
-export const API_LIST_DATA_USERS = `${SIOPAS_API}/user?group_id=${window.localStorage.getItem('group_id')}`
-export const API_INSERT_DATA_USERS = `${API_LIST_DATA_USERS}/insertDataUser`
-export const API_UPDATE_DATA_USERS = `${API_LIST_DATA_USERS}/updateDataUser`
-export const API_DELETE_DATA_USERS = `${API_LIST_DATA_USERS}/deleteDataUser`
-
-export const API_LAYER_LIST = `${SIOPAS_API}/layer?workspace=${appConfig.workspace_name}`
-export const API_LAYER_LABEL = `${SIOPAS_API}/layer/getsearchlabel`
-export const API_LAYER_DETAIL = `${SIOPAS_API}/layer/?resourcebase_ptr_id=`
-export const API_LAYER_DETAIL_UPDATE = `${SIOPAS_API}/layer/updatelayerdetail`
-export const API_LAYER_ATTRIBUTE = `${SIOPAS_API}/layer/getlayerattribute/`
-export const API_LAYER_ATTRIBUTE_UPDATE = `${SIOPAS_API}/layer/updatelayerattribute`
-export const API_LAYER_ATTRIBUTE_BY_LAYERNAME = `${SIOPAS_API}/layer/getlayerattribute?name=`
-export const API_LAYER_SEARCH_LABEL = `${SIOPAS_API}/layer/getsearchlabel/`
-export const API_LAYER_SEARCH_LABEL_UPDATE = `${SIOPAS_API}/layer/updatelayersearchlabel`
-
-
-
-
-export const API_GEOHR_GROUP_SALES_SEARCH = `${BASE_URL_GEOHR_API}/group-sales/search`;
-export const API_GEOHR_SALES_MONITORING = `${BASE_URL_GEOHR_API}/sales/monitoring`;
-export const API_GEOHR_SALES_SEARCH = `${BASE_URL_GEOHR_API}/sales/search`;
-export const API_GEOHR_OFFICE_MONITORING = `${BASE_URL_GEOHR_API}/office/monitoring`;
-export const API_GEOHR_CUSTOMER_MONITORING = `${BASE_URL_GEOHR_API}/customer/monitoring`;
-export const API_GEOHR_EMPLOYEE_MONITORING = `${BASE_URL_GEOHR_API}/employee/monitoring`;
-export const API_GEOHR_WAYPOINT_SALES_MONITORING = (salesId) => `${BASE_URL_GEOHR_API}/waypoint-sales/monitoring?salesId=${salesId}`;
-export const API_GEOHR_WAYPOINT_EMPLOYEE_MONITORING = (employeeId) => `${BASE_URL_GEOHR_API}/waypoint-employee/monitoring?employeeId=${employeeId}`;
-export const API_GEOHR_DAILY_INFO = `${BASE_URL_GEOHR_API}/dashboard-status-sales`;
-export const API_BROADCAST = `${BASE_URL_GEOHR_API}/broadcast`
-
-export const API_GEOHR_EMPLOYEE_DIVISION_LIST = `${BASE_URL_GEOHR_API2}/employee_devision.php?act=get_data`;
-export const API_GEOHR_KARYAWAN = `${BASE_URL_GEOHR_API2}/employee.php?`;
-export const API_GEOHR_ROLES = `${BASE_URL_GEOHR_API2}/roles.php?`;
-export const API_GEOHR_MENU = `${BASE_URL_GEOHR_API2}/menu.php?`;
-export const API_GEOHR_TASK = `${BASE_URL_GEOHR_API2}/task_report.php?`;
-export const API_GEOHR_DIVISI_KARYAWAN = `${BASE_URL_GEOHR_API2}/employee_devision.php?`;
-export const API_GEOHR_IZIN = `${BASE_URL_GEOHR_API2}/paid_leave.php?`;
-export const API_GEOHR_PRESENSI = `${BASE_URL_GEOHR_API2}/clock_in_out.php?`;
-export const API_GET_DATA_OFFICE_HOURS = `${BASE_URL_GEOHR_API2}/employee_office_hours.php?`;
-export const API_GEOHR_SETTING_OFFICE_HOURS = (type) => `${BASE_URL_GEOHR_API2}/employee_office_hours.php?act=setting&type=${type}`;
-export const API_GEOHR_EDIT_OFFICE_HOURS = (id) => `${BASE_URL_GEOHR_API2}/employee_office_hours.php?act=edit&id=${id}`;
-export const API_DAILY_INFO = `${BASE_URL_GEOHR_API2}/employee.php?act=get_daily&role_name=${roleName}`;
-export const API_DAILY_INFO_DETAIL = (start, length) => `${BASE_URL_GEOHR_API2}/employee.php?act=get_daily_detail&start=${start}&length=${length}&role_name=${roleName}`;
-
-
-
-export const APP_MODE = 'ADW' // KIT / ADW / NAWAKARA / IU
-export const BASE_SIMPRO = "https://oslog.id/simpro-api/v1";
-export const BASE_SIMPRO_V2 = "https://oslog.id/simpro-api/v2";
-export const BASE_SIMPRO_LUMENNIAGA = "https://ospro-api.odm-iu.com/api";
-export const BASE_INTEGRATION_V1 = "http://ospro-api.adyawinsa.com:9083";
-export const TOKEN_ADW = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA";
-
-// export let BASE_OSPRO = "https://ospro-api.ospro.id";
-export let BASE_OSPRO = "https://adw-api.ospro.id";
-// export let BASE_OSPRO = "http://localhost:8444/adw-backend";
-// export let BASE_OSPRO = "http://192.168.1.123:8444"; // local
-// export let BASE_OSPRO = "http://103.73.125.81:8444"; // ip public adw
-export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
-export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-
-// switch (APP_MODE) {
-// case 'KIT':
-// BASE_OSPRO = "https://kit-api.oslogdev.com"
-
-// //for KIT server
-// // BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// // BASE_SIMPRO_LUMEN_IMAGE = `${BASE_SIMPRO_LUMEN}/assets/image`;
-// // BASE_SIMPRO_LUMEN_FILE = `${BASE_SIMPRO_LUMEN}/assets/file/project`;
-
-// break;
-// case 'ADW':
-// // BASE_OSPRO = "https://adw-api.ospro.id"
-// BASE_OSPRO = "http://103.73.125.81:8444";
-
-// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
-// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-
-// break;
-// case 'IU':
-// BASE_OSPRO = "https://api-iu.ospro.id"
-
-// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
-// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-
-// break;
-// default:
-// BASE_OSPRO = "https://ospro-api.ospro.id"
-// }
-
-export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`
-export const USERROLE_SEARCH = `${BASE_SIMPRO}/user-role/search`
-export const USERROLE_EDIT = (id) => { return `${BASE_SIMPRO}/user-role/edit/${id}` }
-export const USERROLE_DELETE = (id) => { return `${BASE_SIMPRO}/user-role/delete/${id}` }
-
-export const USERPROYEK_ADD = `${BASE_SIMPRO}/user-to-proyek/add`
-export const USERPROYEK_ADD_DETAIL = `${BASE_SIMPRO}/user-to-proyek/add-detail`
-export const USERPROYEK_LIST = `${BASE_SIMPRO}/user-to-proyek/list`
-export const USERPROYEK_SEARCH = `${BASE_SIMPRO}/user-to-proyek/search`
-export const USERPROYEK_EDIT = (id) => { return `${BASE_SIMPRO}/user-to-proyek/edit/${id}` }
-export const USERPROYEK_DELETE = (id) => { return `${BASE_SIMPRO}/user-to-proyek/delete/${id}` }
-
-
-
-
-export const PRESENSI_ADD = `${BASE_SIMPRO}/clock-in-out/add`
-export const PRESENSI_SEARCH = `${BASE_SIMPRO}/clock-in-out/search`
-export const PRESENSI_EDIT = (id) => { return `${BASE_SIMPRO}/clock-in-out/edit/${id}` }
-export const PRESENSI_DELETE = (id) => { return `${BASE_SIMPRO}/clock-in-out/delete/${id}` }
-
-
-export const PLANNING_ADD = `${BASE_SIMPRO}/laporan-planning/add`
-export const PLANNING_SEARCH = `${BASE_SIMPRO}/laporan-planning/search`
-export const PLANNING_EDIT = (id) => { return `${BASE_SIMPRO}/laporan-planning/edit/${id}` }
-export const PLANNING_DELETE = (id) => { return `${BASE_SIMPRO}/laporan-planning/delete/${id}` }
-
-
-
-export const ALERT_ADD = `${BASE_SIMPRO}/alert/add`
-export const ALERT_SEARCH = `${BASE_SIMPRO}/alert/search`
-export const ALERT_EDIT = (id) => { return `${BASE_SIMPRO}/alert/edit/${id}` }
-export const ALERT_DELETE = (id) => { return `${BASE_SIMPRO}/alert/delete/${id}` }
-
-export const ALERTUSER_ADD = `${BASE_SIMPRO}/alert-to-user/add`
-export const ALERTUSER_SEARCH = `${BASE_SIMPRO}/alert-to-user/search`
-export const ALERTUSER_EDIT = (id) => { return `${BASE_SIMPRO}/alert-to-user/edit/${id}` }
-export const ALERTUSER_DELETE = (id) => { return `${BASE_SIMPRO}/alert-to-user/delete/${id}` }
-
-export const ALERTUSER_STATUSVIEW = (id) => { return `${BASE_SIMPRO}/alert-to-user/edit-status-view/${id}` }
-export const ALERT_STATUSVIEW = (id) => { return `${BASE_SIMPRO}/alert/edit-status-view/${id}` }
-
-export const SUBPROYEK_ADD = `${BASE_SIMPRO}/sub-proyek/add`
-export const SUBPROYEK_SEARCH = `${BASE_SIMPRO}/sub-proyek/search`
-export const SUBPROYEK_EDIT = (id) => { return `${BASE_SIMPRO}/sub-proyek/edit/${id}` }
-export const SUBPROYEK_DELETE = (id) => { return `${BASE_SIMPRO}/sub-proyek/delete/${id}` }
-
-export const USER_PROYEK_SEARCH = `${BASE_SIMPRO}/user-proyek/search`
-export const PLANNING_REALISASI_SEARCH = `${BASE_SIMPRO}/planning-realisasi/search`
-
-export const DASHBOARD_PROYEK = `${BASE_SIMPRO}/dashboard-proyek/list`
-export const DASHBOARD_PROYEK_SEARCH = `${BASE_SIMPRO}/dashboard-proyek/search`
-export const SIMPRO_BASE_IMAGE = `https://oslog.id/simpro-api/assets/images`
-
-export const API_BROADCAST_SIMPRO = `${BASE_SIMPRO}/broadcast`
-export const USER_WASPANG = `${BASE_SIMPRO}/user-role/search`
-export const USER_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/user-to-proyek`
-export const API_SIMPRO_WAYPOINT_WASPANG_MONITORING = (userId) => `${BASE_SIMPRO}/waypoint-monitoring/${userId}/search`;
-
-
-export const SATUAN_KERJA_GET = `${BASE_SIMPRO}/satuan/list`
-
-export const DASHBOARD_STATUS_SEARCH = `${BASE_SIMPRO}/dashboard-status/search`
-export const GANTT_CONTROL_MONITORING_SEARCH = `${BASE_SIMPRO}/proyek-monitoring/search-detail`
-
-export const MATERIAL_TO_PROYEK_ADD = `${BASE_SIMPRO}/material-to-proyek/add`
-export const MATERIAL_TO_PROYEK_ADD_DETAIL = `${BASE_SIMPRO}/material-to-proyek/add-detail`
-export const MATERIAL_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/material-to-proyek/search`
-export const MATERIAL_TO_PROYEK_EDIT = (id) => { return `${BASE_SIMPRO}/material-to-proyek/edit/${id}` }
-export const MATERIAL_TO_PROYEK_DELETE = (id) => { return `${BASE_SIMPRO}/material-to-proyek/delete/${id}` }
-
-export const TOOLS_TO_PROYEK_ADD = `${BASE_SIMPRO}/tools-to-proyek/add`
-export const TOOLS_TO_PROYEK_ADD_DETAIL = `${BASE_SIMPRO}/tools-to-proyek/add-detail`
-export const TOOLS_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/tools-to-proyek/search`
-export const TOOLS_TO_PROYEK_EDIT = (id) => { return `${BASE_SIMPRO}/tools-to-proyek/edit/${id}` }
-export const TOOLS_TO_PROYEK_DELETE = (id) => { return `${BASE_SIMPRO}/tools-to-proyek/delete/${id}` }
-
-export const USER_LOGIN_V2 = `${BASE_SIMPRO_LUMEN}/login`
-export const USER_TO_PROYEK = `${BASE_SIMPRO_LUMEN}/user-to-project/assign`
-export const TOOLS_ASSIGN_PROYEK = `${BASE_SIMPRO_LUMEN}/tools-to-project/assign`
-export const MATERIAL_ASSIGN_PROYEK = `${BASE_SIMPRO_LUMEN}/material-to-project/assign`
-export const TOOLS_CREATE = `${BASE_SIMPRO_LUMEN}/req-tools/create`
-
-export const USER_ADD = `${BASE_SIMPRO_LUMEN}/human-resource/add`
-export const USER_SEARCH = `${BASE_SIMPRO_LUMEN}/human-resource/search`
-export const USER_LIST = `${BASE_SIMPRO_LUMEN}/human-resource/list`
-export const USER_SYNC = `${BASE_SIMPRO_LUMEN}/human-resource/sync`
-export const USER_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/human-resource/update/${id}` }
-export const USER_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/human-resource/delete/${id}` }
-
-export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`
-export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`
-export const ABSENSI_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/permit/edit/${id}` }
-export const ABSENSI_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/permit/delete/${id}` }
-
-export const K3_ADD = `${BASE_SIMPRO_LUMEN}/report-k3/add`
-export const K3_SEARCH = `${BASE_SIMPRO_LUMEN}/report-k3/search`
-export const K3_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/report-k3/edit/${id}` }
-export const K3_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/report-k3/delete/${id}` }
-
-export const DOCUMENT_ADD = `${BASE_SIMPRO_LUMEN}/document-project/upload`
-export const DOCUMENT_GET = (id) => { return `${BASE_SIMPRO_LUMEN}/document-project/get/${id}` }
-export const DOCUMENT_SEARCH = `${BASE_SIMPRO_LUMEN}/document-project/search`
-export const DOCUMENT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/document-project/update/${id}` }
-export const DOCUMENT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}` }
-export const DOCUMENT_DOWNLOAD = (id) => { return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}` }
-
-export const ROLE_ADD = `${BASE_SIMPRO_LUMEN}/role/add`
-export const ROLE_SEARCH = `${BASE_SIMPRO_LUMEN}/role/search`
-export const ROLE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/role/update/${id}` }
-export const ROLE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/role/delete/${id}` }
-
-export const REQUEST_MATERIAL_ADD = `${BASE_SIMPRO_LUMEN}/request-material/add`
-export const REQUEST_MATERIAL_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/request-material/update/${id}` }
-export const REQUEST_MATERIAL_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/request-material/delete/${id}` }
-export const REQUEST_MATERIAL_SEARCH = `${BASE_SIMPRO_LUMEN}/request-material/search`
-export const REQUEST_MATERIAL_UPDATE_WAREHOUSE_SITE = (id) => { return `${BASE_SIMPRO_LUMEN}/request-material/update-warehouse-site/${id}` }
-
-export const MENU_ADD = `${BASE_SIMPRO_LUMEN}/menu/add`
-export const MENU_MANAGEMENT = (id) => { return `${BASE_SIMPRO_LUMEN}/menu/management/${id}` }
-export const MENU_SEARCH = `${BASE_SIMPRO_LUMEN}/menu/search`
-export const MENU_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/menu/update/${id}` }
-export const MENU_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/menu/delete/${id}` }
-
-export const ROLEMENU_ADD = `${BASE_SIMPRO_LUMEN}/role-menu/add`
-export const ROLEMENU_SEARCH = `${BASE_SIMPRO_LUMEN}/role-menu/search`
-export const ROLEMENU_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/role-menu/update/${id}` }
-export const ROLEMENU_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/role-menu/delete/${id}` }
-export const ROLEMENU_DELETE_ROLE = (id) => { return `${BASE_SIMPRO_LUMEN}/role-menu/delete-byrole/${id}` }
-
-export const PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/project/add`
-export const PROYEK_LIST = `${BASE_SIMPRO_LUMEN}/project/list`
-export const PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/project/search`
-export const PROYEK_SEARCH_DETAIL = `${BASE_SIMPRO_LUMEN}/project/search`
-export const PROYEK_GET_ID = (id) => { return `${BASE_SIMPRO_LUMEN}/project/edit/${id}` }
-export const PROYEK_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project/update/${id}` }
-export const PROYEK_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project/delete/${id}` }
-
-export const PROJECT_ROLE_ADD = `${BASE_SIMPRO_LUMEN}/project-role/add`
-export const PROJECT_ROLE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-role/search`
-export const PROJECT_ROLE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-role/update/${id}` }
-export const PROJECT_ROLE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-role/delete/${id}` }
-
-export const PROJECT_TYPE_ADD = `${BASE_SIMPRO_LUMEN}/project-type/add`
-export const PROJECT_TYPE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-type/search`
-export const PROJECT_TYPE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-type/update/${id}` }
-export const PROJECT_TYPE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-type/delete/${id}` }
-export const TYPE_PROYEK = `${BASE_SIMPRO_LUMEN}/project-type/list`
-
-export const PROJECT_PHASE_ADD = `${BASE_SIMPRO_LUMEN}/project-phase/add`
-export const PROJECT_PHASE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-phase/search`
-export const PROJECT_PHASE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-phase/update/${id}` }
-export const PROJECT_PHASE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-phase/delete/${id}` }
-export const PHASE_PROYEK = `${BASE_SIMPRO_LUMEN}/project-phase/list`
-
-export const PROJECT_CHARTER_ADD = `${BASE_SIMPRO_LUMEN}/project-charter/add`
-export const PROJECT_CHARTER_SEARCH = `${BASE_SIMPRO_LUMEN}/project-charter/search`
-export const PROJECT_CHARTER_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-charter/update/${id}` }
-
-export const CONFIGALERT_ADD = `${BASE_SIMPRO_LUMEN}/config-alert/add`
-export const CONFIGALERT_SEARCH = `${BASE_SIMPRO_LUMEN}/config-alert/search`
-export const CONFIGALERT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/config-alert/update/${id}` }
-export const CONFIGALERT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/config-alert/delete/${id}` }
-
-export const CALERTUSER_ADD = `${BASE_SIMPRO_LUMEN}/config-alert-to-user/add`
-export const CALERTUSER_SEARCH = `${BASE_SIMPRO_LUMEN}/config-alert-to-user/search`
-export const CALERTUSER_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/config-alert-to-user/update/${id}` }
-export const CALERTUSER_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/config-alert-to-user/delete/${id}` }
-
-export const MATERIAL_RESOURCE_ADD = `${BASE_SIMPRO_LUMEN}/material-resource/add`
-export const MATERIAL_RESOURCE_SEARCH = `${BASE_SIMPRO_LUMEN}/material-resource/search`
-export const MATERIAL_RESOURCE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/material-resource/update/${id}` }
-export const MATERIAL_RESOURCE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/material-resource/delete/${id}` }
-export const MATERIAL_RESOURCE_LIST = `${BASE_SIMPRO_LUMEN}/material-resource/list`
-
-export const TOOLS_RESOURCE_ADD = `${BASE_SIMPRO_LUMEN}/tools-resource/add`
-export const TOOLS_RESOURCE_SEARCH = `${BASE_SIMPRO_LUMEN}/tools-resource/search`
-export const TOOLS_RESOURCE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/tools-resource/update/${id}` }
-export const TOOLS_RESOURCE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/tools-resource/delete/${id}` }
-export const TOOLS_RESOURCE_LIST = `${BASE_SIMPRO_LUMEN}/tools-resource/list`
-
-export const VERSION_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/version-gantt/add`
-export const VERSION_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/version-gantt/search`
-export const VERSION_GANTT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/version-gantt/update/${id}` }
-export const VERSION_GANTT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/version-gantt/delete/${id}` }
-export const VERSION_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/version-gantt/list`
-
-export const USER_VERSION_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/add`
-export const USER_VERSION_GANTT_ADDS = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/add-multiple`
-export const USER_VERSION_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/search`
-export const USER_VERSION_GANTT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/update/${id}` }
-export const USER_VERSION_GANTT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/delete/${id}` }
-export const USER_VERSION_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/list`
-
-export const REQUEST_TOOLS_ADD = `${BASE_SIMPRO_LUMEN}/req-tools/add`
-export const REQUEST_TOOLS_SEARCH = `${BASE_SIMPRO_LUMEN}/req-tools/search`
-export const REQUEST_TOOLS_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/req-tools/update/${id}` }
-export const REQUEST_TOOLS_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/req-tools/delete/${id}` }
-
-export const DIVISI_ADD = `${BASE_SIMPRO_LUMEN}/divisi/add`
-export const DIVISI_SEARCH = `${BASE_SIMPRO_LUMEN}/divisi/search`
-export const DIVISI_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/divisi/update/${id}` }
-export const DIVISI_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/divisi/delete/${id}` }
-export const DIVISI_LIST = `${BASE_SIMPRO_LUMEN}/divisi/list`
-
-export const SHIFT_ADD = `${BASE_SIMPRO_LUMEN}/shift/add`
-export const SHIFT_SEARCH = `${BASE_SIMPRO_LUMEN}/shift/search`
-export const SHIFT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/shift/update/${id}` }
-export const SHIFT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/shift/delete/${id}` }
-export const SHIFT_LIST = `${BASE_SIMPRO_LUMEN}/shift/list`
-
-export const USER_SHIFT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-shift/add`
-export const USER_SHIFT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-shift/search`
-export const USER_SHIFT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-shift/delete/${id}` }
-export const USER_SHIFT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-shift/list`
-
-export const RATE_SALLARY_ADD = `${BASE_SIMPRO_LUMEN}/rate-sallary/add`
-export const RATE_SALLARY_SEARCH = `${BASE_SIMPRO_LUMEN}/rate-sallary/search`
-export const RATE_SALLARY_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/rate-sallary/update/${id}` }
-export const RATE_SALLARY_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/rate-sallary/delete/${id}` }
-export const RATE_SALLARY_LIST = `${BASE_SIMPRO_LUMEN}/rate-sallary/list`
-
-export const TEMPLATE_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/template-gantt/add`
-export const TEMPLATE_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/template-gantt/search`
-export const TEMPLATE_GANTT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/template-gantt/update/${id}` }
-export const TEMPLATE_GANTT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/template-gantt/delete/${id}` }
-export const TEMPLATE_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/template-gantt/list`
-export const TEMPLATE_GANTT_TREE = (id) => { return `${BASE_SIMPRO_LUMEN}/template-gantt/get-tree/${id}` }
-
-export const PROJECT_PARTICIPANT_ADD = `${BASE_SIMPRO_LUMEN}/project-participants/add`
-export const PROJECT_PARTICIPANT_SEARCH = `${BASE_SIMPRO_LUMEN}/project-participants/search`
-export const PROJECT_PARTICIPANT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-participants/update/${id}` }
-export const PROJECT_PARTICIPANT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-participants/delete/${id}` }
-export const PROJECT_PARTICIPANT_DELETE_BY_PROYEK = (id) => { return `${BASE_SIMPRO_LUMEN}/project-participants/delete-by-proyek/${id}` }
-export const PROJECT_PARTICIPANT_LIST = `${BASE_SIMPRO_LUMEN}/project-participants/list`
-export const PROJECT_PARTICIPANT_WHERE_CUSTOM = (where, id) => { return `${BASE_SIMPRO_LUMEN}/project-participants/${where}/${id}` }
-
-export const PROJECT_APPROVAL_ADD = `${BASE_SIMPRO_LUMEN}/project-approval/add`
-export const PROJECT_APPROVAL_SEARCH = `${BASE_SIMPRO_LUMEN}/project-approval/search`
-export const PROJECT_APPROVAL_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-approval/update/${id}` }
-export const PROJECT_APPROVAL_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-approval/delete/${id}` }
-export const PROJECT_APPROVAL_DELETE_BY_PROYEK = (id) => { return `${BASE_SIMPRO_LUMEN}/project-approval/delete-by-proyek/${id}` }
-export const PROJECT_APPROVAL_LIST = `${BASE_SIMPRO_LUMEN}/project-approval/list`
-export const PROJECT_APPROVAL_WHERE_CUSTOM = (where, id) => { return `${BASE_SIMPRO_LUMEN}/project-approval/${where}/${id}` }
-
-export const PROJECT_MILESTONE_ADD = `${BASE_SIMPRO_LUMEN}/project-milestone/add`
-export const PROJECT_MILESTONE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-milestone/search`
-export const PROJECT_MILESTONE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-milestone/update/${id}` }
-export const PROJECT_MILESTONE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-milestone/delete/${id}` }
-export const PROJECT_MILESTONE_DELETE_BY_PROYEK = (id) => { return `${BASE_SIMPRO_LUMEN}/project-milestone/delete-by-proyek/${id}` }
-export const PROJECT_MILESTONE_LIST = `${BASE_SIMPRO_LUMEN}/project-milestone/list`
-export const PROJECT_MILESTONE_WHERE_CUSTOM = (where, id) => { return `${BASE_SIMPRO_LUMEN}/project-milestone/${where}/${id}` }
-
-
-export const PRESENCE_ADD = `${BASE_SIMPRO_LUMEN}/presence/add`
-export const PRESENCE_SEARCH = `${BASE_SIMPRO_LUMEN}/presence/search`
-export const PRESENCE_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/presence/update/${id}` }
-export const PRESENCE_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/presence/delete/${id}` }
-export const PRESENCE_LIST = `${BASE_SIMPRO_LUMEN}/presence/list`
-
-export const SATUAN_ADD = `${BASE_SIMPRO_LUMEN}/satuan/add`
-export const SATUAN_SEARCH = `${BASE_SIMPRO_LUMEN}/satuan/search`
-export const SATUAN_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/satuan/update/${id}` }
-export const SATUAN_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/satuan/delete/${id}` }
-export const SATUAN_LIST = `${BASE_SIMPRO_LUMEN}/satuan/list`
-
-export const CHECKLIST_K3_ADD = `${BASE_SIMPRO_LUMEN}/checklist-k3/add`
-export const CHECKLIST_K3_SEARCH = `${BASE_SIMPRO_LUMEN}/checklist-k3/search`
-export const CHECKLIST_K3_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/checklist-k3/update/${id}` }
-export const CHECKLIST_K3_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/checklist-k3/delete/${id}` }
-export const CHECKLIST_K3_LIST = `${BASE_SIMPRO_LUMEN}/checklist-k3/list`
-
-export const ASSIGN_HR_PROJECT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-proyek/add`
-export const ASSIGN_HR_PROJECT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-proyek/search`
-export const ASSIGN_HR_PROJECT_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-proyek/update/${id}` }
-export const ASSIGN_HR_PROJECT_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}` }
-export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`
-
-export const IMAGE_GET_BY_ID = (id, category) => { return `${BASE_SIMPRO_LUMEN}/image/${id}/${category}` }
-export const IMAGE_SEARCH = `${BASE_SIMPRO_LUMEN}/image/search`
-export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`
-
-export const DASHBOARD_COST_PLANNING_ACTUAL = `${BASE_SIMPRO_LUMEN}/dashboard/cost-planning-actual`
-export const DASHBOARD_PERSENTASE_PROGRESS_PROYEK = `${BASE_SIMPRO_LUMEN}/dashboard/percentage-planning-actual`
-export const DASHBOARD_REPORT_POINTS = `${BASE_SIMPRO_LUMEN}/report-activity/search-point`
-export const DASHBOARD_STATUS_PROYEK = `${BASE_SIMPRO_LUMEN}/dashboard/status-proyek`
-export const DASHBOARD_KURVA_S = `${BASE_SIMPRO_LUMEN}/activity/get-curva-s`
-
-export const CURRENCY_LIST = `${BASE_SIMPRO_LUMEN}/currency/list`
-
-export const GET_PERCENTAGE_PERDAY = `${BASE_SIMPRO_LUMEN}/activity/get-percentage`
-
-export const FOLDER_DOCUMENT_PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/add`
-export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`
-export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) => `${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`
-export const FOLDER_DOCUMENT_PROYEK_DELETE = (id) => `${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}`
-export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) => `${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`
-
-export const PROJECT_TO_CHECKLIST_K3_ADD = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/add`
-export const PROJECT_TO_CHECKLIST_K3_ADDS = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/add-multiple`
-export const PROJECT_TO_CHECKLIST_K3_SEARCH = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/search`
-export const PROJECT_TO_CHECKLIST_K3_EDIT = (id) => { return `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/update/${id}` }
-export const PROJECT_TO_CHECKLIST_K3_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/delete/${id}` }
-export const PROJECT_TO_CHECKLIST_K3_LIST = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/list`
-
-
-export const CONTROL_MONITORING_SEARCH = `${BASE_SIMPRO_LUMEN}/control-monitoring/search`
-export const API_PANIC_BUTTON_SIMPRO = `${BASE_SIMPRO_LUMEN}/panic-button`
-export const PANIC_BUTTON_SEARCH = `${BASE_SIMPRO_LUMEN}/panic-button/search`;
-export const PANIC_BUTTON_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/panic-button/update/${id}` }
-
-export const HIERARCHY_FTTH_GET = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`
-export const HIERARCHY_FTTH_ADD = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`
-export const HIERARCHY_FTTH_SEARCH = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/search`
-export const HIERARCHY_FTTH_SHOW = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` }
-export const HIERARCHY_FTTH_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` }
-export const HIERARCHY_FTTH_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` }
-export const HIERARCHY_FTTH_TREE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/tree/${id}` }
-export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`
+import { appConfig, MAP_ID } from "./MapConst";
+const roleName = window.localStorage.getItem("role_name");
+const HOST = "https://osmap.id"; // online
+
+export const API_ADW = "http://ospro-api.adyawinsa.com:9083/api/";
+
+export const BASE_URL_GEOHR_API = "https://oslog.id/geohr-api";
+export const BASE_URL_GEOHR_API2 = "http://siopas.co.id/custom-php/api/geohr";
+
+export const BASE_API = `${HOST}/osmap-php/index.php`;
+
+export const BASE_IMAGE = `${HOST}/osmap-php`;
+export const BASE_IMAGE_EMPLOYEE =
+ "https://oslog.id/geohr-api/assets/images/employee/";
+
+export const SIOPAS_API = `${BASE_API}/siopas`;
+
+export const API_LOGIN = `${SIOPAS_API}/user/login`;
+
+export const API_LOG = `${SIOPAS_API}/user/log`;
+
+export const API_USER_SESSION = `${SIOPAS_API}/user/get_valid_session`;
+
+export const API_GET_COLUMN_TABLE = `${BASE_API}/map/getColumnNameAndType`;
+export const API_CREATE_NEW_LAYER = `${BASE_API}/map/createlayer`;
+
+export const API_LOAD_MAP = `${SIOPAS_API}/map/load/${MAP_ID}`;
+export const API_UPDATE_MAP = `${SIOPAS_API}/map/update`;
+
+export const API_UPLOAD_IMAGE = `${SIOPAS_API}/feature/uploadimage`;
+export const API_GET_IMAGE = `${SIOPAS_API}/feature/getimage`;
+
+export const API_UPDATE_FEATURE = `${SIOPAS_API}/feature/update`;
+
+export const API_GET_CHART_TIPE_GEOMETRY = `${SIOPAS_API}/dashboard/chart/tipe-geometry?map_id=${MAP_ID}`;
+export const API_GET_CHART_KATEGORI = `${SIOPAS_API}/dashboard/chart/tipe-kategori?map_id=${MAP_ID}`;
+
+export const API_LIST_DATA_COUNTRY = `${SIOPAS_API}/country`;
+export const API_INSERT_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/insertDataCountry`;
+export const API_UPDATE_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/updateDataCountry`;
+export const API_DELETE_DATA_COUNTRY = `${API_LIST_DATA_COUNTRY}/deleteDataCountry`;
+
+export const API_LIST_DATA_DISTRICT = `${SIOPAS_API}/district`;
+export const API_INSERT_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/insertDataDistrict`;
+export const API_UPDATE_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/updateDataDistrict`;
+export const API_DELETE_DATA_DISTRICT = `${API_LIST_DATA_DISTRICT}/deleteDataDistrict`;
+
+export const API_LIST_DATA_SUBDISTRICT = `${SIOPAS_API}/subdistrict`;
+export const API_INSERT_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/insertDataSubdistrict`;
+export const API_UPDATE_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/updateDataSubdistrict`;
+export const API_DELETE_DATA_SUBDISTRICT = `${API_LIST_DATA_SUBDISTRICT}/deleteDataSubdistrict`;
+
+export const API_LIST_DATA_PROVINCE = `${SIOPAS_API}/province`;
+export const API_UPDATE_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/updateDataProvince`;
+export const API_INSERT_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/insertDataProvince`;
+export const API_DELETE_DATA_PROVINCE = `${API_LIST_DATA_PROVINCE}/deleteDataProvince`;
+
+export const API_LIST_DATA_VILLAGE = `${SIOPAS_API}/village`;
+export const API_UPDATE_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/updateDataVillage`;
+export const API_INSERT_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/insertDataVillage`;
+export const API_DELETE_DATA_VILLAGE = `${API_LIST_DATA_VILLAGE}/deleteDataVillage`;
+
+export const API_LIST_DATA_USERS = `${SIOPAS_API}/user?group_id=${window.localStorage.getItem(
+ "group_id"
+)}`;
+export const API_INSERT_DATA_USERS = `${API_LIST_DATA_USERS}/insertDataUser`;
+export const API_UPDATE_DATA_USERS = `${API_LIST_DATA_USERS}/updateDataUser`;
+export const API_DELETE_DATA_USERS = `${API_LIST_DATA_USERS}/deleteDataUser`;
+
+export const API_LAYER_LIST = `${SIOPAS_API}/layer?workspace=${appConfig.workspace_name}`;
+export const API_LAYER_LABEL = `${SIOPAS_API}/layer/getsearchlabel`;
+export const API_LAYER_DETAIL = `${SIOPAS_API}/layer/?resourcebase_ptr_id=`;
+export const API_LAYER_DETAIL_UPDATE = `${SIOPAS_API}/layer/updatelayerdetail`;
+export const API_LAYER_ATTRIBUTE = `${SIOPAS_API}/layer/getlayerattribute/`;
+export const API_LAYER_ATTRIBUTE_UPDATE = `${SIOPAS_API}/layer/updatelayerattribute`;
+export const API_LAYER_ATTRIBUTE_BY_LAYERNAME = `${SIOPAS_API}/layer/getlayerattribute?name=`;
+export const API_LAYER_SEARCH_LABEL = `${SIOPAS_API}/layer/getsearchlabel/`;
+export const API_LAYER_SEARCH_LABEL_UPDATE = `${SIOPAS_API}/layer/updatelayersearchlabel`;
+
+export const API_GEOHR_GROUP_SALES_SEARCH = `${BASE_URL_GEOHR_API}/group-sales/search`;
+export const API_GEOHR_SALES_MONITORING = `${BASE_URL_GEOHR_API}/sales/monitoring`;
+export const API_GEOHR_SALES_SEARCH = `${BASE_URL_GEOHR_API}/sales/search`;
+export const API_GEOHR_OFFICE_MONITORING = `${BASE_URL_GEOHR_API}/office/monitoring`;
+export const API_GEOHR_CUSTOMER_MONITORING = `${BASE_URL_GEOHR_API}/customer/monitoring`;
+export const API_GEOHR_EMPLOYEE_MONITORING = `${BASE_URL_GEOHR_API}/employee/monitoring`;
+export const API_GEOHR_WAYPOINT_SALES_MONITORING = (salesId) =>
+ `${BASE_URL_GEOHR_API}/waypoint-sales/monitoring?salesId=${salesId}`;
+export const API_GEOHR_WAYPOINT_EMPLOYEE_MONITORING = (employeeId) =>
+ `${BASE_URL_GEOHR_API}/waypoint-employee/monitoring?employeeId=${employeeId}`;
+export const API_GEOHR_DAILY_INFO = `${BASE_URL_GEOHR_API}/dashboard-status-sales`;
+export const API_BROADCAST = `${BASE_URL_GEOHR_API}/broadcast`;
+
+export const API_GEOHR_EMPLOYEE_DIVISION_LIST = `${BASE_URL_GEOHR_API2}/employee_devision.php?act=get_data`;
+export const API_GEOHR_KARYAWAN = `${BASE_URL_GEOHR_API2}/employee.php?`;
+export const API_GEOHR_ROLES = `${BASE_URL_GEOHR_API2}/roles.php?`;
+export const API_GEOHR_MENU = `${BASE_URL_GEOHR_API2}/menu.php?`;
+export const API_GEOHR_TASK = `${BASE_URL_GEOHR_API2}/task_report.php?`;
+export const API_GEOHR_DIVISI_KARYAWAN = `${BASE_URL_GEOHR_API2}/employee_devision.php?`;
+export const API_GEOHR_IZIN = `${BASE_URL_GEOHR_API2}/paid_leave.php?`;
+export const API_GEOHR_PRESENSI = `${BASE_URL_GEOHR_API2}/clock_in_out.php?`;
+export const API_GET_DATA_OFFICE_HOURS = `${BASE_URL_GEOHR_API2}/employee_office_hours.php?`;
+export const API_GEOHR_SETTING_OFFICE_HOURS = (type) =>
+ `${BASE_URL_GEOHR_API2}/employee_office_hours.php?act=setting&type=${type}`;
+export const API_GEOHR_EDIT_OFFICE_HOURS = (id) =>
+ `${BASE_URL_GEOHR_API2}/employee_office_hours.php?act=edit&id=${id}`;
+export const API_DAILY_INFO = `${BASE_URL_GEOHR_API2}/employee.php?act=get_daily&role_name=${roleName}`;
+export const API_DAILY_INFO_DETAIL = (start, length) =>
+ `${BASE_URL_GEOHR_API2}/employee.php?act=get_daily_detail&start=${start}&length=${length}&role_name=${roleName}`;
+
+export const APP_MODE = "ADW"; // KIT / ADW / NAWAKARA / IU
+export const BASE_SIMPRO = "https://oslog.id/simpro-api/v1";
+export const BASE_SIMPRO_V2 = "https://oslog.id/simpro-api/v2";
+export const BASE_SIMPRO_LUMENNIAGA = "https://ospro-api.odm-iu.com/api";
+export const BASE_INTEGRATION_V1 = "http://ospro-api.adyawinsa.com:9083";
+export const TOKEN_ADW =
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA";
+
+// export let BASE_OSPRO = "https://ospro-api.ospro.id";
+export let BASE_OSPRO = "https://adw-api.ospro.id";
+// export let BASE_OSPRO = "http://localhost:8444";
+// export let BASE_OSPRO = "http://103.73.125.81:8444"; // ip public adw
+export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
+export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
+export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
+
+// switch (APP_MODE) {
+// case 'KIT':
+// BASE_OSPRO = "https://kit-api.oslogdev.com"
+
+// //for KIT server
+// // BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
+// // BASE_SIMPRO_LUMEN_IMAGE = `${BASE_SIMPRO_LUMEN}/assets/image`;
+// // BASE_SIMPRO_LUMEN_FILE = `${BASE_SIMPRO_LUMEN}/assets/file/project`;
+
+// break;
+// case 'ADW':
+// // BASE_OSPRO = "https://adw-api.ospro.id"
+// BASE_OSPRO = "http://103.73.125.81:8444";
+
+// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
+// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
+// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
+
+// break;
+// case 'IU':
+// BASE_OSPRO = "https://api-iu.ospro.id"
+
+// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
+// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
+// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
+
+// break;
+// default:
+// BASE_OSPRO = "https://ospro-api.ospro.id"
+// }
+
+export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`;
+export const USERROLE_SEARCH = `${BASE_SIMPRO}/user-role/search`;
+export const USERROLE_EDIT = (id) => {
+ return `${BASE_SIMPRO}/user-role/edit/${id}`;
+};
+export const USERROLE_DELETE = (id) => {
+ return `${BASE_SIMPRO}/user-role/delete/${id}`;
+};
+
+export const USERPROYEK_ADD = `${BASE_SIMPRO}/user-to-proyek/add`;
+export const USERPROYEK_ADD_DETAIL = `${BASE_SIMPRO}/user-to-proyek/add-detail`;
+export const USERPROYEK_LIST = `${BASE_SIMPRO}/user-to-proyek/list`;
+export const USERPROYEK_SEARCH = `${BASE_SIMPRO}/user-to-proyek/search`;
+export const USERPROYEK_EDIT = (id) => {
+ return `${BASE_SIMPRO}/user-to-proyek/edit/${id}`;
+};
+export const USERPROYEK_DELETE = (id) => {
+ return `${BASE_SIMPRO}/user-to-proyek/delete/${id}`;
+};
+
+export const PRESENSI_ADD = `${BASE_SIMPRO}/clock-in-out/add`;
+export const PRESENSI_SEARCH = `${BASE_SIMPRO}/clock-in-out/search`;
+export const PRESENSI_EDIT = (id) => {
+ return `${BASE_SIMPRO}/clock-in-out/edit/${id}`;
+};
+export const PRESENSI_DELETE = (id) => {
+ return `${BASE_SIMPRO}/clock-in-out/delete/${id}`;
+};
+
+export const PLANNING_ADD = `${BASE_SIMPRO}/laporan-planning/add`;
+export const PLANNING_SEARCH = `${BASE_SIMPRO}/laporan-planning/search`;
+export const PLANNING_EDIT = (id) => {
+ return `${BASE_SIMPRO}/laporan-planning/edit/${id}`;
+};
+export const PLANNING_DELETE = (id) => {
+ return `${BASE_SIMPRO}/laporan-planning/delete/${id}`;
+};
+
+export const ALERT_ADD = `${BASE_SIMPRO}/alert/add`;
+export const ALERT_SEARCH = `${BASE_SIMPRO}/alert/search`;
+export const ALERT_EDIT = (id) => {
+ return `${BASE_SIMPRO}/alert/edit/${id}`;
+};
+export const ALERT_DELETE = (id) => {
+ return `${BASE_SIMPRO}/alert/delete/${id}`;
+};
+
+export const ALERTUSER_ADD = `${BASE_SIMPRO}/alert-to-user/add`;
+export const ALERTUSER_SEARCH = `${BASE_SIMPRO}/alert-to-user/search`;
+export const ALERTUSER_EDIT = (id) => {
+ return `${BASE_SIMPRO}/alert-to-user/edit/${id}`;
+};
+export const ALERTUSER_DELETE = (id) => {
+ return `${BASE_SIMPRO}/alert-to-user/delete/${id}`;
+};
+
+export const ALERTUSER_STATUSVIEW = (id) => {
+ return `${BASE_SIMPRO}/alert-to-user/edit-status-view/${id}`;
+};
+export const ALERT_STATUSVIEW = (id) => {
+ return `${BASE_SIMPRO}/alert/edit-status-view/${id}`;
+};
+
+export const SUBPROYEK_ADD = `${BASE_SIMPRO}/sub-proyek/add`;
+export const SUBPROYEK_SEARCH = `${BASE_SIMPRO}/sub-proyek/search`;
+export const SUBPROYEK_EDIT = (id) => {
+ return `${BASE_SIMPRO}/sub-proyek/edit/${id}`;
+};
+export const SUBPROYEK_DELETE = (id) => {
+ return `${BASE_SIMPRO}/sub-proyek/delete/${id}`;
+};
+
+export const USER_PROYEK_SEARCH = `${BASE_SIMPRO}/user-proyek/search`;
+export const PLANNING_REALISASI_SEARCH = `${BASE_SIMPRO}/planning-realisasi/search`;
+
+export const DASHBOARD_PROYEK = `${BASE_SIMPRO}/dashboard-proyek/list`;
+export const DASHBOARD_PROYEK_SEARCH = `${BASE_SIMPRO}/dashboard-proyek/search`;
+export const SIMPRO_BASE_IMAGE = `https://oslog.id/simpro-api/assets/images`;
+
+export const API_BROADCAST_SIMPRO = `${BASE_SIMPRO}/broadcast`;
+export const USER_WASPANG = `${BASE_SIMPRO}/user-role/search`;
+export const USER_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/user-to-proyek`;
+export const API_SIMPRO_WAYPOINT_WASPANG_MONITORING = (userId) =>
+ `${BASE_SIMPRO}/waypoint-monitoring/${userId}/search`;
+
+export const SATUAN_KERJA_GET = `${BASE_SIMPRO}/satuan/list`;
+
+export const DASHBOARD_STATUS_SEARCH = `${BASE_SIMPRO}/dashboard-status/search`;
+export const GANTT_CONTROL_MONITORING_SEARCH = `${BASE_SIMPRO}/proyek-monitoring/search-detail`;
+
+export const MATERIAL_TO_PROYEK_ADD = `${BASE_SIMPRO}/material-to-proyek/add`;
+export const MATERIAL_TO_PROYEK_ADD_DETAIL = `${BASE_SIMPRO}/material-to-proyek/add-detail`;
+export const MATERIAL_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/material-to-proyek/search`;
+export const MATERIAL_TO_PROYEK_EDIT = (id) => {
+ return `${BASE_SIMPRO}/material-to-proyek/edit/${id}`;
+};
+export const MATERIAL_TO_PROYEK_DELETE = (id) => {
+ return `${BASE_SIMPRO}/material-to-proyek/delete/${id}`;
+};
+
+export const TOOLS_TO_PROYEK_ADD = `${BASE_SIMPRO}/tools-to-proyek/add`;
+export const TOOLS_TO_PROYEK_ADD_DETAIL = `${BASE_SIMPRO}/tools-to-proyek/add-detail`;
+export const TOOLS_TO_PROYEK_SEARCH = `${BASE_SIMPRO}/tools-to-proyek/search`;
+export const TOOLS_TO_PROYEK_EDIT = (id) => {
+ return `${BASE_SIMPRO}/tools-to-proyek/edit/${id}`;
+};
+export const TOOLS_TO_PROYEK_DELETE = (id) => {
+ return `${BASE_SIMPRO}/tools-to-proyek/delete/${id}`;
+};
+
+export const USER_LOGIN_V2 = `${BASE_SIMPRO_LUMEN}/login`;
+export const USER_TO_PROYEK = `${BASE_SIMPRO_LUMEN}/user-to-project/assign`;
+export const TOOLS_ASSIGN_PROYEK = `${BASE_SIMPRO_LUMEN}/tools-to-project/assign`;
+export const MATERIAL_ASSIGN_PROYEK = `${BASE_SIMPRO_LUMEN}/material-to-project/assign`;
+export const TOOLS_CREATE = `${BASE_SIMPRO_LUMEN}/req-tools/create`;
+
+export const USER_ADD = `${BASE_SIMPRO_LUMEN}/human-resource/add`;
+export const USER_SEARCH = `${BASE_SIMPRO_LUMEN}/human-resource/search`;
+export const USER_LIST = `${BASE_SIMPRO_LUMEN}/human-resource/list`;
+export const USER_SYNC = `${BASE_SIMPRO_LUMEN}/human-resource/sync`;
+export const USER_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/human-resource/update/${id}`;
+};
+export const USER_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/human-resource/delete/${id}`;
+};
+
+export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`;
+export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`;
+export const ABSENSI_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/permit/edit/${id}`;
+};
+export const ABSENSI_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/permit/delete/${id}`;
+};
+
+export const K3_ADD = `${BASE_SIMPRO_LUMEN}/report-k3/add`;
+export const K3_SEARCH = `${BASE_SIMPRO_LUMEN}/report-k3/search`;
+export const K3_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/report-k3/edit/${id}`;
+};
+export const K3_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/report-k3/delete/${id}`;
+};
+
+export const DOCUMENT_ADD = `${BASE_SIMPRO_LUMEN}/document-project/upload`;
+export const DOCUMENT_GET = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/document-project/get/${id}`;
+};
+export const DOCUMENT_SEARCH = `${BASE_SIMPRO_LUMEN}/document-project/search`;
+export const DOCUMENT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/document-project/update/${id}`;
+};
+export const DOCUMENT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}`;
+};
+export const DOCUMENT_DOWNLOAD = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}`;
+};
+
+export const ROLE_ADD = `${BASE_SIMPRO_LUMEN}/role/add`;
+export const ROLE_SEARCH = `${BASE_SIMPRO_LUMEN}/role/search`;
+export const ROLE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/role/update/${id}`;
+};
+export const ROLE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/role/delete/${id}`;
+};
+
+export const REQUEST_MATERIAL_ADD = `${BASE_SIMPRO_LUMEN}/request-material/add`;
+export const REQUEST_MATERIAL_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/request-material/update/${id}`;
+};
+export const REQUEST_MATERIAL_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/request-material/delete/${id}`;
+};
+export const REQUEST_MATERIAL_SEARCH = `${BASE_SIMPRO_LUMEN}/request-material/search`;
+export const REQUEST_MATERIAL_UPDATE_WAREHOUSE_SITE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/request-material/update-warehouse-site/${id}`;
+};
+
+export const MENU_ADD = `${BASE_SIMPRO_LUMEN}/menu/add`;
+export const MENU_MANAGEMENT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/menu/management/${id}`;
+};
+export const MENU_SEARCH = `${BASE_SIMPRO_LUMEN}/menu/search`;
+export const MENU_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/menu/update/${id}`;
+};
+export const MENU_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/menu/delete/${id}`;
+};
+
+export const ROLEMENU_ADD = `${BASE_SIMPRO_LUMEN}/role-menu/add`;
+export const ROLEMENU_SEARCH = `${BASE_SIMPRO_LUMEN}/role-menu/search`;
+export const ROLEMENU_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/role-menu/update/${id}`;
+};
+export const ROLEMENU_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/role-menu/delete/${id}`;
+};
+export const ROLEMENU_DELETE_ROLE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/role-menu/delete-byrole/${id}`;
+};
+
+export const PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/project/add`;
+export const PROYEK_LIST = `${BASE_SIMPRO_LUMEN}/project/list`;
+export const PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/project/search`;
+export const PROYEK_SEARCH_DETAIL = `${BASE_SIMPRO_LUMEN}/project/search`;
+// export const PROYEK_SEARCH_BY_USER = (id) => {
+// return `${BASE_SIMPRO_LUMEN}/project-by-customer/${id}`;
+// };
+export const PROYEK_GET_ID = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project/edit/${id}`;
+};
+export const PROYEK_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project/update/${id}`;
+};
+export const PROYEK_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project/delete/${id}`;
+};
+
+export const PROJECT_ROLE_ADD = `${BASE_SIMPRO_LUMEN}/project-role/add`;
+export const PROJECT_ROLE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-role/search`;
+export const PROJECT_ROLE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-role/update/${id}`;
+};
+export const PROJECT_ROLE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-role/delete/${id}`;
+};
+
+export const PROJECT_TYPE_ADD = `${BASE_SIMPRO_LUMEN}/project-type/add`;
+export const PROJECT_TYPE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-type/search`;
+export const PROJECT_TYPE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-type/update/${id}`;
+};
+export const PROJECT_TYPE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-type/delete/${id}`;
+};
+export const TYPE_PROYEK = `${BASE_SIMPRO_LUMEN}/project-type/list`;
+
+export const PROJECT_PHASE_ADD = `${BASE_SIMPRO_LUMEN}/project-phase/add`;
+export const PROJECT_PHASE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-phase/search`;
+export const PROJECT_PHASE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-phase/update/${id}`;
+};
+export const PROJECT_PHASE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-phase/delete/${id}`;
+};
+export const PHASE_PROYEK = `${BASE_SIMPRO_LUMEN}/project-phase/list`;
+
+export const PROJECT_CHARTER_ADD = `${BASE_SIMPRO_LUMEN}/project-charter/add`;
+export const PROJECT_CHARTER_SEARCH = `${BASE_SIMPRO_LUMEN}/project-charter/search`;
+export const PROJECT_CHARTER_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-charter/update/${id}`;
+};
+
+export const CONFIGALERT_ADD = `${BASE_SIMPRO_LUMEN}/config-alert/add`;
+export const CONFIGALERT_SEARCH = `${BASE_SIMPRO_LUMEN}/config-alert/search`;
+export const CONFIGALERT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/config-alert/update/${id}`;
+};
+export const CONFIGALERT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/config-alert/delete/${id}`;
+};
+
+export const CALERTUSER_ADD = `${BASE_SIMPRO_LUMEN}/config-alert-to-user/add`;
+export const CALERTUSER_SEARCH = `${BASE_SIMPRO_LUMEN}/config-alert-to-user/search`;
+export const CALERTUSER_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/config-alert-to-user/update/${id}`;
+};
+export const CALERTUSER_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/config-alert-to-user/delete/${id}`;
+};
+
+export const MATERIAL_RESOURCE_ADD = `${BASE_SIMPRO_LUMEN}/material-resource/add`;
+export const MATERIAL_RESOURCE_SEARCH = `${BASE_SIMPRO_LUMEN}/material-resource/search`;
+export const MATERIAL_RESOURCE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/material-resource/update/${id}`;
+};
+export const MATERIAL_RESOURCE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/material-resource/delete/${id}`;
+};
+export const MATERIAL_RESOURCE_LIST = `${BASE_SIMPRO_LUMEN}/material-resource/list`;
+
+export const TOOLS_RESOURCE_ADD = `${BASE_SIMPRO_LUMEN}/tools-resource/add`;
+export const TOOLS_RESOURCE_SEARCH = `${BASE_SIMPRO_LUMEN}/tools-resource/search`;
+export const TOOLS_RESOURCE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/tools-resource/update/${id}`;
+};
+export const TOOLS_RESOURCE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/tools-resource/delete/${id}`;
+};
+export const TOOLS_RESOURCE_LIST = `${BASE_SIMPRO_LUMEN}/tools-resource/list`;
+
+export const VERSION_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/version-gantt/add`;
+export const VERSION_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/version-gantt/search`;
+export const VERSION_GANTT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/version-gantt/update/${id}`;
+};
+export const VERSION_GANTT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/version-gantt/delete/${id}`;
+};
+export const VERSION_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/version-gantt/list`;
+
+export const USER_VERSION_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/add`;
+export const USER_VERSION_GANTT_ADDS = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/add-multiple`;
+export const USER_VERSION_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/search`;
+export const USER_VERSION_GANTT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/update/${id}`;
+};
+export const USER_VERSION_GANTT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/delete/${id}`;
+};
+export const USER_VERSION_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-version-gantt/list`;
+
+export const REQUEST_TOOLS_ADD = `${BASE_SIMPRO_LUMEN}/req-tools/add`;
+export const REQUEST_TOOLS_SEARCH = `${BASE_SIMPRO_LUMEN}/req-tools/search`;
+export const REQUEST_TOOLS_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/req-tools/update/${id}`;
+};
+export const REQUEST_TOOLS_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/req-tools/delete/${id}`;
+};
+
+export const DIVISI_ADD = `${BASE_SIMPRO_LUMEN}/divisi/add`;
+export const DIVISI_SEARCH = `${BASE_SIMPRO_LUMEN}/divisi/search`;
+export const DIVISI_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/divisi/update/${id}`;
+};
+export const DIVISI_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/divisi/delete/${id}`;
+};
+export const DIVISI_LIST = `${BASE_SIMPRO_LUMEN}/divisi/list`;
+
+export const SHIFT_ADD = `${BASE_SIMPRO_LUMEN}/shift/add`;
+export const SHIFT_SEARCH = `${BASE_SIMPRO_LUMEN}/shift/search`;
+export const SHIFT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/shift/update/${id}`;
+};
+export const SHIFT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/shift/delete/${id}`;
+};
+export const SHIFT_LIST = `${BASE_SIMPRO_LUMEN}/shift/list`;
+
+export const USER_SHIFT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-shift/add`;
+export const USER_SHIFT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-shift/search`;
+export const USER_SHIFT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/user-to-shift/delete/${id}`;
+};
+export const USER_SHIFT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-shift/list`;
+
+export const RATE_SALLARY_ADD = `${BASE_SIMPRO_LUMEN}/rate-sallary/add`;
+export const RATE_SALLARY_SEARCH = `${BASE_SIMPRO_LUMEN}/rate-sallary/search`;
+export const RATE_SALLARY_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/rate-sallary/update/${id}`;
+};
+export const RATE_SALLARY_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/rate-sallary/delete/${id}`;
+};
+export const RATE_SALLARY_LIST = `${BASE_SIMPRO_LUMEN}/rate-sallary/list`;
+
+export const TEMPLATE_GANTT_ADD = `${BASE_SIMPRO_LUMEN}/template-gantt/add`;
+export const TEMPLATE_GANTT_SEARCH = `${BASE_SIMPRO_LUMEN}/template-gantt/search`;
+export const TEMPLATE_GANTT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/template-gantt/update/${id}`;
+};
+export const TEMPLATE_GANTT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/template-gantt/delete/${id}`;
+};
+export const TEMPLATE_GANTT_LIST = `${BASE_SIMPRO_LUMEN}/template-gantt/list`;
+export const TEMPLATE_GANTT_TREE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/template-gantt/get-tree/${id}`;
+};
+
+export const PROJECT_PARTICIPANT_ADD = `${BASE_SIMPRO_LUMEN}/project-participants/add`;
+export const PROJECT_PARTICIPANT_SEARCH = `${BASE_SIMPRO_LUMEN}/project-participants/search`;
+export const PROJECT_PARTICIPANT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-participants/update/${id}`;
+};
+export const PROJECT_PARTICIPANT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-participants/delete/${id}`;
+};
+export const PROJECT_PARTICIPANT_DELETE_BY_PROYEK = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-participants/delete-by-proyek/${id}`;
+};
+export const PROJECT_PARTICIPANT_LIST = `${BASE_SIMPRO_LUMEN}/project-participants/list`;
+export const PROJECT_PARTICIPANT_WHERE_CUSTOM = (where, id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-participants/${where}/${id}`;
+};
+
+export const PROJECT_APPROVAL_ADD = `${BASE_SIMPRO_LUMEN}/project-approval/add`;
+export const PROJECT_APPROVAL_SEARCH = `${BASE_SIMPRO_LUMEN}/project-approval/search`;
+export const PROJECT_APPROVAL_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-approval/update/${id}`;
+};
+export const PROJECT_APPROVAL_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-approval/delete/${id}`;
+};
+export const PROJECT_APPROVAL_DELETE_BY_PROYEK = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-approval/delete-by-proyek/${id}`;
+};
+export const PROJECT_APPROVAL_LIST = `${BASE_SIMPRO_LUMEN}/project-approval/list`;
+export const PROJECT_APPROVAL_WHERE_CUSTOM = (where, id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-approval/${where}/${id}`;
+};
+
+export const PROJECT_MILESTONE_ADD = `${BASE_SIMPRO_LUMEN}/project-milestone/add`;
+export const PROJECT_MILESTONE_SEARCH = `${BASE_SIMPRO_LUMEN}/project-milestone/search`;
+export const PROJECT_MILESTONE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-milestone/update/${id}`;
+};
+export const PROJECT_MILESTONE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-milestone/delete/${id}`;
+};
+export const PROJECT_MILESTONE_DELETE_BY_PROYEK = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-milestone/delete-by-proyek/${id}`;
+};
+export const PROJECT_MILESTONE_LIST = `${BASE_SIMPRO_LUMEN}/project-milestone/list`;
+export const PROJECT_MILESTONE_WHERE_CUSTOM = (where, id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-milestone/${where}/${id}`;
+};
+
+export const PRESENCE_ADD = `${BASE_SIMPRO_LUMEN}/presence/add`;
+export const PRESENCE_SEARCH = `${BASE_SIMPRO_LUMEN}/presence/search`;
+export const PRESENCE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/presence/update/${id}`;
+};
+export const PRESENCE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/presence/delete/${id}`;
+};
+export const PRESENCE_LIST = `${BASE_SIMPRO_LUMEN}/presence/list`;
+
+export const SATUAN_ADD = `${BASE_SIMPRO_LUMEN}/satuan/add`;
+export const SATUAN_SEARCH = `${BASE_SIMPRO_LUMEN}/satuan/search`;
+export const SATUAN_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/satuan/update/${id}`;
+};
+export const SATUAN_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/satuan/delete/${id}`;
+};
+export const SATUAN_LIST = `${BASE_SIMPRO_LUMEN}/satuan/list`;
+
+export const CHECKLIST_K3_ADD = `${BASE_SIMPRO_LUMEN}/checklist-k3/add`;
+export const CHECKLIST_K3_SEARCH = `${BASE_SIMPRO_LUMEN}/checklist-k3/search`;
+export const CHECKLIST_K3_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/checklist-k3/update/${id}`;
+};
+export const CHECKLIST_K3_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/checklist-k3/delete/${id}`;
+};
+export const CHECKLIST_K3_LIST = `${BASE_SIMPRO_LUMEN}/checklist-k3/list`;
+
+export const ASSIGN_HR_PROJECT_ADD = `${BASE_SIMPRO_LUMEN}/user-to-proyek/add`;
+export const ASSIGN_HR_PROJECT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-proyek/search`;
+export const ASSIGN_HR_PROJECT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/user-to-proyek/update/${id}`;
+};
+export const ASSIGN_HR_PROJECT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}`;
+};
+export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`;
+
+export const IMAGE_GET_BY_ID = (id, category) => {
+ return `${BASE_SIMPRO_LUMEN}/image/${id}/${category}`;
+};
+export const IMAGE_SEARCH = `${BASE_SIMPRO_LUMEN}/image/search`;
+export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`;
+
+export const DASHBOARD_COST_PLANNING_ACTUAL = `${BASE_SIMPRO_LUMEN}/dashboard/cost-planning-actual`;
+export const DASHBOARD_PERSENTASE_PROGRESS_PROYEK = `${BASE_SIMPRO_LUMEN}/dashboard/percentage-planning-actual`;
+export const DASHBOARD_REPORT_POINTS = `${BASE_SIMPRO_LUMEN}/report-activity/search-point`;
+export const DASHBOARD_STATUS_PROYEK = `${BASE_SIMPRO_LUMEN}/dashboard/status-proyek`;
+export const DASHBOARD_KURVA_S = `${BASE_SIMPRO_LUMEN}/activity/get-curva-s`;
+
+export const CURRENCY_LIST = `${BASE_SIMPRO_LUMEN}/currency/list`;
+
+export const GET_PERCENTAGE_PERDAY = `${BASE_SIMPRO_LUMEN}/activity/get-percentage`;
+
+export const FOLDER_DOCUMENT_PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/add`;
+export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`;
+export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) =>
+ `${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`;
+export const FOLDER_DOCUMENT_PROYEK_DELETE = (id) =>
+ `${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}`;
+export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) =>
+ `${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`;
+
+export const PROJECT_TO_CHECKLIST_K3_ADD = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/add`;
+export const PROJECT_TO_CHECKLIST_K3_ADDS = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/add-multiple`;
+export const PROJECT_TO_CHECKLIST_K3_SEARCH = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/search`;
+export const PROJECT_TO_CHECKLIST_K3_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/update/${id}`;
+};
+export const PROJECT_TO_CHECKLIST_K3_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/delete/${id}`;
+};
+export const PROJECT_TO_CHECKLIST_K3_LIST = `${BASE_SIMPRO_LUMEN}/project-to-checklist-k3/list`;
+
+export const CONTROL_MONITORING_SEARCH = `${BASE_SIMPRO_LUMEN}/control-monitoring/search`;
+export const API_PANIC_BUTTON_SIMPRO = `${BASE_SIMPRO_LUMEN}/panic-button`;
+export const PANIC_BUTTON_SEARCH = `${BASE_SIMPRO_LUMEN}/panic-button/search`;
+export const PANIC_BUTTON_UPDATE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/panic-button/update/${id}`;
+};
+
+export const HIERARCHY_FTTH_GET = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`;
+export const HIERARCHY_FTTH_ADD = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths`;
+export const HIERARCHY_FTTH_SEARCH = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/search`;
+export const HIERARCHY_FTTH_SHOW = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`;
+};
+export const HIERARCHY_FTTH_UPDATE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`;
+};
+export const HIERARCHY_FTTH_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`;
+};
+export const HIERARCHY_FTTH_TREE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/tree/${id}`;
+};
+export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`;
diff --git a/src/views/Dashboard/DashboardProject.js b/src/views/Dashboard/DashboardProject.js
index 1c87cbd..ac105d5 100644
--- a/src/views/Dashboard/DashboardProject.js
+++ b/src/views/Dashboard/DashboardProject.js
@@ -1,975 +1,1670 @@
-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 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 }
-}
+ 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.200000,
- lng: 106.816666
-}
+ 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://adw-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');
- }
- }, [])
+ 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://adw-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(() => {
- if (activeTabIdx === 1) {
- initMap();
- }
- }, [activeTabIdx]);
-
- useEffect(() => {
- async function fetchData() {
- await Promise.all([
- getManpower(),
- getAssignedHR(),
- ...(assignedHr.length > 0 ? [getActualHR()] : [])
- ])
- }
- fetchData()
- }, [])
+ useEffect(() => {
+ getProjectDetail();
+ getSCurve();
+ getOverdueActivities();
+ getReportDistribution();
+ getComments();
+ getGantt();
+ getGanttParents();
+ return () => {
+ console.log("unmount RenderMap");
+ };
+ }, []);
- useEffect(() => {
- let deviation = 0;
- if (plannedCost && totalCost) {
- deviation = plannedCost - totalCost;
- }
- setRemToComplete(deviation.toString())
+ useEffect(() => {
+ if (activeTabIdx === 1) {
+ initMap();
+ }
+ }, [activeTabIdx]);
- }, [plannedCost, totalCost]);
+ useEffect(() => {
+ async function fetchData() {
+ await Promise.all([
+ getManpower(),
+ getAssignedHR(),
+ ...(assignedHr.length > 0 ? [getActualHR()] : []),
+ ]);
+ }
+ fetchData();
+ }, []);
- const handleRedirect = () => {
- history.push("/projects/" + GANTT_ID + "/" + PROJECT_ID + "/gantt");
+ useEffect(() => {
+ let deviation = 0;
+ if (plannedCost && totalCost) {
+ deviation = plannedCost - totalCost;
}
+ setRemToComplete(deviation.toString());
+ }, [plannedCost, totalCost]);
- 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 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 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 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 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);
- const URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`;
- 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;
- }
+ 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);
+ }
+ };
- 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(result.data.data?.mulai_proyek ? result.data.data.mulai_proyek : null)
- setPlannedFinish(result.data.data?.akhir_proyek ? result.data.data.akhir_proyek : 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 !== '') {
- getIntegrationInvoice(result.data.data.kode_sortname)
- }
- }
+ const getProjectDetail = async () => {
+ setIsReadyProjectDetail(false);
+ const URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`;
+ 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;
}
- 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 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(
+ result.data.data?.mulai_proyek ? result.data.data.mulai_proyek : null
+ );
+ setPlannedFinish(
+ result.data.data?.akhir_proyek ? result.data.data.akhir_proyek : 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.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);
- }
+ if (
+ result.data.data.kode_sortname &&
+ result.data.data.kode_sortname !== ""
+ ) {
+ getIntegrationInvoice(result.data.data.kode_sortname);
+ }
+ }
+ };
- selisihProgress = planningProgress - actualProgress;
- if (selisihProgress > 0 && selisihProgress <= 5) {
- statusHealthBySchedule = 'warning'
- }
- else if (selisihProgress > 5) {
- statusHealthBySchedule = 'danger'
- }
+ 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`;
+ }
- setHealthBySchedule(statusHealthBySchedule)
- setIsReadySCurve(true);
- }
+ 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;
}
- 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 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);
+ }
- 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);
- }
- }
+ selisihProgress = planningProgress - actualProgress;
+ if (selisihProgress > 0 && selisihProgress <= 5) {
+ statusHealthBySchedule = "warning";
+ } else if (selisihProgress > 5) {
+ statusHealthBySchedule = "danger";
+ }
- const getIntegrationInvoice = async (kode_sortname) => {
- setIsReadyIntegrationInvoice(false);
- const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`;
- const payload = {
- "search": kode_sortname
- }
- 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;
- }
+ setHealthBySchedule(statusHealthBySchedule);
+ setIsReadySCurve(true);
+ }
+ };
- 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 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;
}
- 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 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);
+ }
+ };
- 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 getIntegrationInvoice = async (kode_sortname) => {
+ setIsReadyIntegrationInvoice(false);
+ const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`;
+ const payload = {
+ search: kode_sortname,
+ };
+ 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;
}
- 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 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);
+ }
+ };
- 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 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;
}
- 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.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);
+ }
+ };
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- setIsSendingComment(false);
- return;
- }
+ 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 },
+ };
- 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 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;
}
- const resetInputComment = () => {
- setComment('');
- setIsSendingComment(false);
+ 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 initMap = () => {
- let mymap = L.map('map-area', {
- center: center,
- zoom: 13
- });
+ 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);
- setMymap(mymap);
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(mymap);
+ if (!result) {
+ NotificationManager.error(`Could not connect to internet.`, "Failed");
+ setIsSendingComment(false);
+ return;
}
- useEffect(() => {
- if (mymap) {
- if (reportDistribution.length > 0) {
- reportDistribution.map((item, idx) => {
- L.marker([item.lat, item.lon]).addTo(mymap).bindPopup(PopupContent(item));
- });
- }
- }
- }, [mymap, reportDistribution])
+ 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();
+ }
+ };
- useEffect(() => {
- // Add event listener for receiving messages from the iframe
- window.addEventListener('message', handleIframeMessage);
+ const resetInputComment = () => {
+ setComment("");
+ setIsSendingComment(false);
+ };
- // Clean up the event listener on component unmount
- return () => {
- window.removeEventListener('message', handleIframeMessage);
- };
- }, []);
+ const initMap = () => {
+ let mymap = L.map("map-area", {
+ center: center,
+ zoom: 13,
+ });
- const handleIframeMessage = (event) => {
- if (event.data && event.data.action === 'getUrl') {
- const childUrl = window.location.href;
+ setMymap(mymap);
+ L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
+ attribution:
+ '© OpenStreetMap contributors',
+ }).addTo(mymap);
+ };
- // Send the URL back to the iframe
- event.source.postMessage({ action: 'sendUrl', url: childUrl }, event.origin);
+ 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 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
- })}
+ 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.
- )
- }, [overdueActivities, isReadyOverdueActivities])
+ )}
+ {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
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
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")
+ ) : (
+ "-"
+ )
+ ) : (
+
+ )}
+
-
-
-
-
-
-
- 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
-
- {isReadySCurve ?
- plannedCost !== null && bcwp !== null ?
- plannedCost > bcwp ? renderFormatRupiah(plannedCost, 'Rp.') : renderFormatRupiah(bcwp, 'Rp.')
- : '-'
- :
- }
-
-
-
-
- BCWP (cost vs perform)
-
- {isReadySCurve ?
- bcwp ? renderFormatRupiah(bcwp, 'Rp.') : '-'
- :
- }
-
- Cost Deviation
-
- {isReadyProjectDetail && isReadyIntegrationInvoice ?
- totalCost > plannedCost ? renderFormatRupiah((totalCost - plannedCost).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.') : '-'
- :
- }
-
-
-
-
-
-
+
+
+ Actual Start
+
+
+ {isReadyProjectDetail ? (
+ actualStart ? (
+ moment(actualStart).format("D MMMM YYYY")
+ ) : (
+ "-"
+ )
+ ) : (
+
+ )}
+
-
-
-
- setActiveTabIdx(0)}>S Curve
-
-
- setActiveTabIdx(1)}>Maps
-
-
-
-
-
- {/* { activeTabIdx === 0 &&
{RenderGantt}
}
+
+
+
+ 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
+
+
+ {isReadySCurve ? (
+ plannedCost !== null && bcwp !== null ? (
+ plannedCost > bcwp ? (
+ renderFormatRupiah(plannedCost, "Rp.")
+ ) : (
+ renderFormatRupiah(bcwp, "Rp.")
+ )
+ ) : (
+ "-"
+ )
+ ) : (
+
+ )}
+
+
+
+
+
+ BCWP (cost vs perform)
+
+
+ {isReadySCurve ? (
+ bcwp ? (
+ renderFormatRupiah(bcwp, "Rp.")
+ ) : (
+ "-"
+ )
+ ) : (
+
+ )}
+
+
+
+ Cost Deviation
+
+
+ {isReadyProjectDetail && isReadyIntegrationInvoice ? (
+ totalCost > plannedCost ? (
+ renderFormatRupiah(
+ (totalCost - plannedCost).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 &&
}
-
-
-
+
+ {RenderGantt}
+
+ {activeTabIdx === 1 && (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+ Progress
+
+ {isReadySCurve ? (
+
100 ? 100 : planningProgress}
+ />
+ ) : (
+
+ )}
+
+ {isReadySCurve ? (
+ 100
+ ? parseFloat(
+ (actualProgress / planningProgress) * 100
+ ).toFixed(2)
+ : actualProgress
+ }
+ />
+ ) : (
+
+ )}
+
+
+
+
+
+
+ {isReadyOverdueActivities && (
+
+ )}
+ {isReadySCurve && (
+
+ )}
+
+
+
+
+
+
+ Manpower : {manPower}
+
+
+
+
+
+
+ Assigned : {assignedHrCount}
-
-
-
-
-
-
-
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
+
+
+
+ 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.') : '-'
- :
- }
-
-
-
-
-
-
-
-
- {/*
+
+ 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}
-
-
-
-
-
-
+
+
+ setActiveTabCommentIdx(0)}
+ >
+ Behind Task
+
+
+
+ setActiveTabCommentIdx(1)}
+ >
+ Comment From Customer
+
+
+
+
+ {activeTabCommentIdx === 0 && RenderBehindTasks}
+ {activeTabCommentIdx === 1 && RenderComments}
+
+
+
-
- );
-}
+
+
+
+
+ );
+};
export default DashboardProject;
diff --git a/src/views/MapMonitoring/index.js b/src/views/MapMonitoring/index.js
index 322e485..83ec348 100644
--- a/src/views/MapMonitoring/index.js
+++ b/src/views/MapMonitoring/index.js
@@ -17,11 +17,15 @@ import "react-toastify/dist/ReactToastify.css";
import './MapMonitoring.css';
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst';
import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png';
+import pinRouteStart from '../../assets/img/map/pin_route_green.png';
+import pinRouteEnd from '../../assets/img/map/pin_route_red.png';
+import pinRouteOnTrip from '../../assets/img/map/pin_route_on_trip.png';
import 'leaflet.markercluster/dist/MarkerCluster.Default.css'
import 'leaflet.markercluster/dist/MarkerCluster.css'
import 'leaflet.markercluster/dist/leaflet.markercluster.js'
import 'leaflet-control-geocoder/dist/Control.Geocoder.css'
import 'leaflet-control-geocoder/dist/Control.Geocoder.js'
+import moment from 'moment';
const MapMonitoring = () => {
@@ -81,8 +85,50 @@ const MapMonitoring = () => {
if (mymap) {
removeLayerByName('userHistoryLayer');
if (userHistory) {
+ var startIcon = new L.Icon({
+ iconSize: [60, 60],
+ iconAnchor: [30, 47],
+ popupAnchor: [1, -24],
+ iconUrl: pinRouteStart
+ });
+ var endIcon = new L.Icon({
+ iconSize: [60, 60],
+ iconAnchor: [30, 47],
+ popupAnchor: [1, -24],
+ iconUrl: pinRouteEnd
+ });
+ var onTripIcon = new L.Icon({
+ iconSize: [60, 60],
+ iconAnchor: [30, 47],
+ popupAnchor: [1, -24],
+ iconUrl: pinRouteOnTrip
+ });
let userHistoryLayer = L.geoJson(userHistory, {
- name: 'userHistoryLayer'
+ name: 'userHistoryLayer',
+ onEachFeature: function(feature, layer) {
+ var popupText = `Status: ${feature.properties.type}
+ Time: ${feature.properties.wptime ? moment(feature.properties.wptime).format("DD-MM-YYYY HH:mm:ss") : '-'}`;
+
+ layer.bindPopup(popupText, {
+ closeButton: true,
+ // offset: L.point(0, -20)
+ });
+ layer.on('click', function() {
+ layer.openPopup();
+ });
+ },
+ pointToLayer: function(feature, latlng) {
+ var type = feature.properties.type;
+ if (type === 'Start') {
+ return L.marker(latlng, {icon: startIcon});
+ }
+ else if (type === "Working") {
+ return L.marker(latlng, {icon: onTripIcon});
+ }
+ else if (type === "End") {
+ return L.marker(latlng, {icon: endIcon});
+ }
+ },
});
userHistoryLayer.addTo(mymap);
mymap.fitBounds(userHistoryLayer.getBounds());
diff --git a/src/views/SimproV2/CreatedProyek/AsignCustProject.js b/src/views/SimproV2/CreatedProyek/AsignCustProject.js
new file mode 100644
index 0000000..d845546
--- /dev/null
+++ b/src/views/SimproV2/CreatedProyek/AsignCustProject.js
@@ -0,0 +1,294 @@
+import React, { useEffect, useState, useMemo } from 'react'
+import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
+import { Button, Form } from 'reactstrap';
+import { Table, Tooltip } from 'antd';
+import 'antd/dist/antd.css';
+import moment from 'moment';
+import { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst';
+import axios from "../../../const/interceptorApi"
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import FormAsignCust from './DialogAssignCust';
+import { formatThousand } from '../../../const/CustomFunc';
+
+const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsResource, proyekName }) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const [dataUserToProject, setdataUserToProject] = useState([])
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [idDelete, setIdDelete] = useState(0)
+ const [openDialogFormTools, setOpenDialogFormTools] = useState(false)
+ const [dataEdit, setDataEdit] = useState(null)
+ const [listUser, setListUser] = useState([])
+ const [listRole, setListRole] = useState([])
+
+ useEffect(() => {
+ if (idTask > 0) {
+ getDataAssignHr();
+ }
+ }, [openDialog]);
+
+ useEffect(() => {
+ if (openDialog) {
+ getDataProjectRole();
+ getDataUser();
+ }
+ }, [dataUserToProject])
+
+ const getDataAssignHr = async () => {
+ const payload = {
+ "paging": {
+ "start": 0,
+ "length": -1
+ },
+ "columns": [
+ { "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" },
+ { "name": "proyek_id", "logic_operator": "=", "value": idTask }
+ ],
+ "joins": [
+ { "name": "m_users", "column_join": "user_id", "column_results": ["name"] },
+ { "name": "m_role_proyek", "column_join": "project_role", "column_results": ["name"] },
+ ],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+ const URL = ASSIGN_HR_PROJECT_SEARCH
+ const result = await axios
+ .post(URL, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || []
+ const filteredData = dataRes.filter(item => item.is_customer === true);
+ setdataUserToProject(filteredData);
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ }
+ }
+
+ const getDataUser = async () => {
+ const HEADER_ADW = {
+ headers: {
+ "Authorization": `${TOKEN_ADW}`
+ }
+ }
+ const result = await axios
+ .get(USER_LIST, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.data.length != 0) {
+ let dataRes = result.data.data
+ setListUser(dataRes)
+ }
+ }
+
+ const getDataProjectRole = async () => {
+ const payload = {
+ "paging": {
+ "start": 0,
+ "length": -1
+ },
+ "columns": [
+ { "name": "created_by", "logic_operator": "ilike", "value": "" },
+ ],
+ "joins": [],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+
+ const result = await axios
+ .post(PROJECT_ROLE_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || []
+ setListRole(dataRes);
+ } else {
+ }
+ }
+
+ const handleDelete = (id) => {
+ setIdDelete(id)
+ setAlertDelete(true)
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onConfirmDelete = async () => {
+ let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete)
+ const result = await axios.delete(urlDel, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataAssignHr()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data assign human resource berhasil dihapus`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data assign human resource gagal dihapus`, 'Failed!!');
+ }
+ }
+
+
+ const handleOpenDialogFormTools = () => {
+ setOpenDialogFormTools(true)
+ }
+
+ const handleCancel = () => {
+ closeDialog('cancel', 'none')
+ }
+
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+ {
+ title: 'Action',
+ dataIndex: '',
+ key: 'x',
+ className: "nowrap",
+ render: (text, record) => <>
+
+ {" "}>,
+ },
+ { title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" },
+ { title: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" },
+ { title: 'Percentage Available User', dataIndex: 'max_used', key: 'max_used', className: "nowrap", render: (text, record) => record.max_used ? formatThousand(record.max_used) : '-' },
+ { title: 'Standard Rate', dataIndex: 'standart_rate', key: 'standart_rate', className: "nowrap", render: (text, record) => record.standart_rate ? formatThousand(record.standart_rate) : '-' },
+ { title: 'UOM Standard Rate', dataIndex: 'uom_standart_rate', key: 'uom_standart_rate', className: "nowrap" },
+ { title: 'Overtime Rate', dataIndex: 'overtime_rate', key: 'overtime_rate', className: "nowrap", render: (text, record) => record.overtime_rate ? formatThousand(record.overtime_rate) : '-' },
+ { title: 'UOM Overtime Rate', dataIndex: 'uom_overtime_rate', key: 'uom_overtime_rate', className: "nowrap" },
+
+ ];
+
+ return (
+
+ )
+ }, [dataUserToProject])
+
+ const renderForm = () => {
+ return (
+
+ {RenderTable}
+
+ )
+ }
+
+ const handleCloseDialogFormTools = (type, data) => {
+ if(type=="add"){
+ addDataAssignHr(data);
+ }else if(type=="edit"){
+ editDataAssignHr(data);
+ }else{
+ setDataEdit(null)
+ setOpenDialogFormTools(false)
+ }
+ }
+
+ const addDataAssignHr = async (payload) => {
+ const result = await axios
+ .post(ASSIGN_HR_PROJECT_ADD, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataAssignHr();
+ NotificationManager.success('assign human resource berhasil!!', 'Success');
+ setDataEdit(null)
+ setOpenDialogFormTools(false)
+ } else {
+ NotificationManager.error('assign human resource gagal!!', 'Failed');
+ }
+ }
+
+ const editDataAssignHr = async (payload) => {
+ let url = ASSIGN_HR_PROJECT_EDIT(payload.id)
+ const result = await axios
+ .put(url, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataAssignHr();
+ NotificationManager.success('assign human resource berhasil diedit!!', 'Success');
+ setDataEdit(null)
+ setOpenDialogFormTools(false)
+ } else {
+ NotificationManager.error('assign human resource gagal diedit!!', 'Failed');
+ }
+ }
+
+ const toogleDialogFormTools = () => {
+ if (openDialogFormTools) {
+ setDataEdit(null)
+ }
+ setOpenDialogFormTools(!openDialogFormTools)
+ }
+
+
+ return (
+ <>
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+
+
+
+ Assign Customer - {proyekName}
+
+
+ {renderForm()}
+
+
+
+ >
+ )
+
+}
+
+export default AssignHrProject;
diff --git a/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js b/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
index 9609392..349d2b8 100644
--- a/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
+++ b/src/views/SimproV2/CreatedProyek/DataRequestMaterial.js
@@ -1,239 +1,239 @@
-import React, { useEffect, useState, useMemo } from 'react'
-import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
-import { Button } from 'reactstrap';
-import { Table, Tooltip } from 'antd';
-import 'antd/dist/antd.css';
-import moment from 'moment';
-import SweetAlert from 'react-bootstrap-sweetalert';
-import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst';
-import axios from "../../../const/interceptorApi"
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import DialogRequest from './FormRequestMaterial';
-import { renderLabelStatus } from '../../../const/CustomFunc';
-const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => {
- const token = localStorage.getItem("token")
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
- }
- const [dataResource, setDataResource] = useState([])
- const [openDialogReq, setOpenDialogReq] = useState(false)
- const [alertDelete, setAlertDelete] = useState(false)
- const [idDelete, setIdDelete] = useState(0)
- const [dataEdit, setDataEdit] = useState(null)
-
- useEffect(() => {
- if (idTask > 0) {
- getDataRequestMaterial();
- }
- }, [idTask])
-
- useEffect(() => {
- if (!openDialog) {
- setDataResource([]);
- } else {
-
- }
- }, [openDialog])
-
-
- const getDataRequestMaterial = async () => {
- const payload = {
- "columns": [
- { "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" },
- { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
- ],
- "joins": [],
- "orders": { "columns": ["id"], "ascending": true },
- "paging": { "start": 0, "length": 25 }
- }
-
- const result = await axios
- .post(REQUEST_MATERIAL_SEARCH, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
- console.log("result", result)
- if (result && result.status == 200) {
- setDataResource(result.data.data);
- } else {
-
- }
- }
-
- const handleCancel = () => {
- setDataResource([]);
- setDataEdit(null)
- closeDialog('cancel', 'none')
- }
-
- const handleDelete = (id) => {
- setIdDelete(id)
- setAlertDelete(true)
- }
-
- const handleEdit = async (data) => {
- await setDataEdit(data)
- setOpenDialogReq(true)
- }
-
- const RenderTable = useMemo(() => {
- const columns = [
- {
- title: 'Action',
- dataIndex: '',
- key: 'id',
- className: "nowrap",
- render: (text, record) => <>
-
- {text.status == "fom" ? <>
-
- {" "}
-
- > : "-"}
- >,
- },
- { title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) },
- { title: 'Description', dataIndex: 'description', key: 'description' },
- { title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
- { title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => ({text ? text : "-"}
) },
- { title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => ({text ? text : "-"}
) },
- { title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => ({text ? text : "-"}
) },
- { title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
- { title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- { title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
- ];
-
- return (
-
- )
- }, [dataResource])
-
- const closeDialogReq = (type, data) => {
- if (type == "add") {
- saveRequestMaterial(data);
- } else if (type == "edit") {
- updateRequestMaterial(data);
- } else {
- setOpenDialogReq(false);
- setDataEdit(null)
- }
-
- }
-
- const toggleDialogReq = () => {
- setOpenDialogReq(!openDialogReq)
- }
-
- const openDialogRequest = () => {
- setOpenDialogReq(true)
- }
-
- const saveRequestMaterial = async (data) => {
- const result = await axios
- .post(REQUEST_MATERIAL_ADD, data, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- getDataRequestMaterial();
- NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success');
- setOpenDialogReq(false);
- setDataEdit(null)
- } else {
- NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed');
- }
- }
-
- const updateRequestMaterial = async (data) => {
- let url = REQUEST_MATERIAL_EDIT(data.id)
- const result = await axios
- .put(url, data, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- getDataRequestMaterial();
- NotificationManager.success('Data request material berhasill diedit!!', 'Success');
- setOpenDialogReq(false);
- setDataEdit(null)
- } else {
- NotificationManager.error('Data request material gagal diedit!!', 'Failed');
- }
- }
-
- const cancelDelete = () => {
- setAlertDelete(false)
- setIdDelete(0)
- }
-
- const onConfirmDelete = async () => {
- let urlDel = REQUEST_MATERIAL_DELETE(idDelete)
- const result = await axios.delete(urlDel, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataRequestMaterial()
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!');
- } else {
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!');
- }
- }
-
- return (
- <>
-
-
- Request Material Resource - {proyekName}
-
-
-
- {RenderTable}
-
-
- {/*
-
- */}
-
-
- cancelDelete()}
- focusCancelBtn
- >
- Delete this data
-
-
- >
- )
-
-}
-
-export default DialogFormMaterial;
\ No newline at end of file
+import React, { useEffect, useState, useMemo } from 'react'
+import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
+import { Button } from 'reactstrap';
+import { Table, Tooltip } from 'antd';
+import 'antd/dist/antd.css';
+import moment from 'moment';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import { REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_ADD, REQUEST_MATERIAL_DELETE, REQUEST_MATERIAL_EDIT } from '../../../const/ApiConst';
+import axios from "../../../const/interceptorApi"
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import DialogRequest from './FormRequestMaterial';
+import { renderLabelStatus } from '../../../const/CustomFunc';
+const DialogFormMaterial = ({ openDialog, closeDialog, toggleDialog, idTask, materialResource, proyekName }) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const [dataResource, setDataResource] = useState([])
+ const [openDialogReq, setOpenDialogReq] = useState(false)
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [idDelete, setIdDelete] = useState(0)
+ const [dataEdit, setDataEdit] = useState(null)
+
+ useEffect(() => {
+ if (idTask > 0) {
+ // getDataRequestMaterial();
+ }
+ }, [idTask])
+
+ useEffect(() => {
+ if (!openDialog) {
+ setDataResource([]);
+ } else {
+
+ }
+ }, [openDialog])
+
+
+ const getDataRequestMaterial = async () => {
+ const payload = {
+ "columns": [
+ { "name": "description", "logic_operator": "ilike", "value": "", "operator": "AND" },
+ { "name": "proyek_id", "logic_operator": "=", "value": idTask, "operator": "AND" }
+ ],
+ "joins": [],
+ "orders": { "columns": ["id"], "ascending": true },
+ "paging": { "start": 0, "length": 25 }
+ }
+
+ const result = await axios
+ .post(REQUEST_MATERIAL_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ console.log("result", result)
+ if (result && result.status == 200) {
+ setDataResource(result.data.data);
+ } else {
+
+ }
+ }
+
+ const handleCancel = () => {
+ setDataResource([]);
+ setDataEdit(null)
+ closeDialog('cancel', 'none')
+ }
+
+ const handleDelete = (id) => {
+ setIdDelete(id)
+ setAlertDelete(true)
+ }
+
+ const handleEdit = async (data) => {
+ await setDataEdit(data)
+ setOpenDialogReq(true)
+ }
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+ {
+ title: 'Action',
+ dataIndex: '',
+ key: 'id',
+ className: "nowrap",
+ render: (text, record) => <>
+
+ {text.status == "fom" ? <>
+
+ {" "}
+
+ > : "-"}
+ >,
+ },
+ { title: 'Status', dataIndex: 'status', key: 'status', render: (text, record) => renderLabelStatus(text) },
+ { title: 'Description', dataIndex: 'description', key: 'description' },
+ { title: 'Required Date', dataIndex: 'required_date', key: 'required_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
+ { title: 'QTY', dataIndex: 'qty', key: 'qty', render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'UOM', dataIndex: 'uom', key: 'uom', render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'QTY Received', dataIndex: 'qty_received', key: 'qty_received', className: "nowrap", render: (text, record) => ({text ? text : "-"}
) },
+ { title: 'FOM Date', dataIndex: 'fom_date', key: 'fom_date', className: "nowrap", render: (text, record) => ({moment(text).format("D-M-YYYY")}
) },
+ { title: 'PR Date', dataIndex: 'pr_date', key: 'pr_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'PO Date', dataIndex: 'po_date', key: 'po_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'Received Date', dataIndex: 'received_date', key: 'received_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ { title: 'Delivery Date', dataIndex: 'delivery_date', key: 'delivery_date', className: "nowrap", render: (text, record) => ({text ? moment(text).format("D-M-YYYY") : "-"}
) },
+ ];
+
+ return (
+
+ )
+ }, [dataResource])
+
+ const closeDialogReq = (type, data) => {
+ if (type == "add") {
+ saveRequestMaterial(data);
+ } else if (type == "edit") {
+ updateRequestMaterial(data);
+ } else {
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ }
+
+ }
+
+ const toggleDialogReq = () => {
+ setOpenDialogReq(!openDialogReq)
+ }
+
+ const openDialogRequest = () => {
+ setOpenDialogReq(true)
+ }
+
+ const saveRequestMaterial = async (data) => {
+ const result = await axios
+ .post(REQUEST_MATERIAL_ADD, data, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataRequestMaterial();
+ NotificationManager.success('Data request material berhasill ditambahkan!!', 'Success');
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ } else {
+ NotificationManager.error('Data request material gagal ditambahkan!!', 'Failed');
+ }
+ }
+
+ const updateRequestMaterial = async (data) => {
+ let url = REQUEST_MATERIAL_EDIT(data.id)
+ const result = await axios
+ .put(url, data, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ getDataRequestMaterial();
+ NotificationManager.success('Data request material berhasill diedit!!', 'Success');
+ setOpenDialogReq(false);
+ setDataEdit(null)
+ } else {
+ NotificationManager.error('Data request material gagal diedit!!', 'Failed');
+ }
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onConfirmDelete = async () => {
+ let urlDel = REQUEST_MATERIAL_DELETE(idDelete)
+ const result = await axios.delete(urlDel, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataRequestMaterial()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data request material berhasil dihapus`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data request material gagal dihapus`, 'Failed!!');
+ }
+ }
+
+ return (
+ <>
+
+
+ Request Material Resource - {proyekName}
+
+
+
+ {RenderTable}
+
+
+ {/*
+
+ */}
+
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+
+ >
+ )
+
+}
+
+export default DialogFormMaterial;
diff --git a/src/views/SimproV2/CreatedProyek/DialogAssignCust.js b/src/views/SimproV2/CreatedProyek/DialogAssignCust.js
new file mode 100644
index 0000000..1bc885b
--- /dev/null
+++ b/src/views/SimproV2/CreatedProyek/DialogAssignCust.js
@@ -0,0 +1,173 @@
+import React, { useEffect, useState } from 'react'
+import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
+import { Button, Form } from 'reactstrap';
+import axios from "../../../const/interceptorApi";
+import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH, USER_LIST} from '../../../const/ApiConst';
+import { Transfer } from 'antd';
+import 'antd/dist/antd.css';
+
+const role_id = localStorage.getItem('role_id');
+const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const [id, setId] = useState(0)
+ const [targetKeys, setTargetKeys] = useState([])
+ const [assignCustomer, setAssignCustomer] = useState([])
+
+
+ const handleCLearData = () => {
+ setId(0)
+ setTargetKeys([])
+ }
+
+ useEffect(() => {
+ if(!openDialog){
+ handleCLearData()
+ } else {
+ getDataAssignCustomer();
+ }
+ }, [openDialog])
+
+ useEffect(() => {
+ if(idGantt && idGantt > 0){
+ getUserGantt()
+ }
+ }, [idGantt])
+
+ const getDataAssignCustomer = async () => {
+ const result = await axios
+ .get(USER_LIST, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ let dataRes = result.data.data;
+ const filteredData = dataRes.filter(item => item.role_id === 44);
+ setTransferUser(filteredData);
+ } else {
+
+ }
+ }
+
+ const setTransferUser = (data) => {
+ const finalData = []
+ data.map((val, index) => {
+ let data = {
+ key: val.id,
+ title: val.name
+ }
+ finalData.push(data)
+ });
+ setAssignCustomer(finalData)
+ }
+
+ const getUserGantt = async () => {
+ const payload = {
+ "columns": [
+ { "name": "version_gantt_id", "logic_operator": "=", "value": idGantt, "operator": "AND" }
+ ]
+ }
+ const result = await axios
+ .post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if(result && result.status==200){
+ console.log("cek resource get user gantt",result.data.data)
+ setUserGantt(result.data.data);
+ }else{
+
+ }
+ }
+
+ const setUserGantt = (data) => {
+ let newTargetKeys = []
+ data.map((val,index)=> {
+ newTargetKeys.push(val.user_id)
+ });
+ setTargetKeys(newTargetKeys)
+ }
+
+ const handleSave = async () => {
+ await saveVersionGantt()
+ handleCLearData()
+ }
+
+ const saveVersionGantt= async () => {
+
+ const formData = {
+ user_id:targetKeys,
+ version_gantt_id:idGantt
+ }
+
+ const result = await axios
+ .post(USER_VERSION_GANTT_ADDS, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if(result && result.status==200){
+ closeDialog('success')
+ }else{
+ closeDialog('failed')
+ }
+ }
+
+ const handleCancel = () => {
+ closeDialog('cancel')
+ handleCLearData()
+ }
+
+ const handleChange = targetKeys => {
+ setTargetKeys(targetKeys)
+ };
+
+ const renderForm = () => {
+ return (
+
+ item.title}
+ listStyle={{
+ width: 250,
+ height: 300,
+ }}
+ />
+
+ )
+ }
+
+
+ return (
+ <>
+
+ Add Customer
+
+ {renderForm()}
+
+
+ {' '}
+
+
+
+ >
+ )
+
+}
+
+export default DialogAssignCust;
diff --git a/src/views/SimproV2/CreatedProyek/index.js b/src/views/SimproV2/CreatedProyek/index.js
index 474ef70..76b1086 100644
--- a/src/views/SimproV2/CreatedProyek/index.js
+++ b/src/views/SimproV2/CreatedProyek/index.js
@@ -9,56 +9,57 @@ import DialogForm from "./DialogForm";
import DialogFormProyek from "./DialogFormProyek";
import { FileExcelOutlined, FilePdfOutlined } from "@ant-design/icons";
import {
- NotificationContainer,
- NotificationManager,
+ NotificationContainer,
+ NotificationManager,
} from "react-notifications";
import {
- Pagination,
- Table,
- Button,
- Tooltip,
- Popover,
- Skeleton,
- Spin,
+ Pagination,
+ Table,
+ Button,
+ Tooltip,
+ Popover,
+ Skeleton,
+ Spin,
} from "antd";
import {
- PROJECT_APPROVAL_ADD,
- PROJECT_APPROVAL_EDIT,
- PROJECT_PARTICIPANT_ADD,
- PROJECT_PARTICIPANT_EDIT,
- PROJECT_MILESTONE_ADD,
- PROJECT_MILESTONE_EDIT,
- PROJECT_PARTICIPANT_DELETE_BY_PROYEK,
- PROJECT_MILESTONE_DELETE_BY_PROYEK,
- PROJECT_APPROVAL_DELETE_BY_PROYEK,
- USER_LIST,
- TYPE_PROYEK,
- PROYEK_ADD,
- PROYEK_SEARCH,
- PROYEK_EDIT,
- PROYEK_DELETE,
- TOOLS_RESOURCE_SEARCH,
- MATERIAL_RESOURCE_SEARCH,
- USER_SEARCH,
- PROJECT_CHARTER_SEARCH,
- HIERARCHY_FTTH_SEARCH,
- TOOLS_RESOURCE_LIST,
- MATERIAL_RESOURCE_LIST,
- PROYEK_GET_ID,
- PROJECT_MILESTONE_SEARCH,
- PROJECT_PARTICIPANT_SEARCH,
- PROJECT_APPROVAL_SEARCH,
- CHECKLIST_K3_LIST,
- VERSION_GANTT_SEARCH,
- PHASE_PROYEK,
- DIVISI_LIST,
- BASE_OSPRO
+ PROJECT_APPROVAL_ADD,
+ PROJECT_APPROVAL_EDIT,
+ PROJECT_PARTICIPANT_ADD,
+ PROJECT_PARTICIPANT_EDIT,
+ PROJECT_MILESTONE_ADD,
+ PROJECT_MILESTONE_EDIT,
+ PROJECT_PARTICIPANT_DELETE_BY_PROYEK,
+ PROJECT_MILESTONE_DELETE_BY_PROYEK,
+ PROJECT_APPROVAL_DELETE_BY_PROYEK,
+ USER_LIST,
+ TYPE_PROYEK,
+ PROYEK_ADD,
+ PROYEK_SEARCH,
+ PROYEK_SEARCH_BY_USER,
+ PROYEK_EDIT,
+ PROYEK_DELETE,
+ TOOLS_RESOURCE_SEARCH,
+ MATERIAL_RESOURCE_SEARCH,
+ USER_SEARCH,
+ PROJECT_CHARTER_SEARCH,
+ HIERARCHY_FTTH_SEARCH,
+ TOOLS_RESOURCE_LIST,
+ MATERIAL_RESOURCE_LIST,
+ PROYEK_GET_ID,
+ PROJECT_MILESTONE_SEARCH,
+ PROJECT_PARTICIPANT_SEARCH,
+ PROJECT_APPROVAL_SEARCH,
+ CHECKLIST_K3_LIST,
+ VERSION_GANTT_SEARCH,
+ PHASE_PROYEK,
+ DIVISI_LIST,
+ BASE_OSPRO,
} from "../../../const/ApiConst";
import {
- formatNumber,
- formatRupiah,
- formatThousand,
- renderFormatRupiah,
+ formatNumber,
+ formatRupiah,
+ formatThousand,
+ renderFormatRupiah,
} from "../../../const/CustomFunc";
import moment from "moment";
// import DialogFormResource from './DialogFormResource';
@@ -70,6 +71,7 @@ import DialogGantt from "./DialogGantt";
import DialogHierarchy from "./DialogHierarchy";
// import DialogAsignHr from './AsignHrProject';
import AssignHrProject from "./AsignHrProject";
+import AssignCustProject from "./AsignCustProject";
import AssignK3Project from "./AssignK3Project";
import ViewProject from "./ViewProject";
import { Icon } from "@iconify/react";
@@ -80,63 +82,65 @@ import { Link, useHistory } from "react-router-dom";
const url = "";
const proyek_id = localStorage.getItem("proyek_id");
const role_id = localStorage.getItem("role_id");
+const user_id = localStorage.getItem("user_id");
const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => {
const history = useHistory();
- const token = localStorage.getItem("token");
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${token}`,
- },
- };
-
- const [idTask, setidTask] = useState(0);
- const [dataTable, setDatatable] = useState([]);
- const [search, setSearch] = useState("");
- const [currentPage, setCurrentPage] = useState(1);
- const [totalPage, setTotalPage] = useState(0);
- const [openDialog, setOpenDialog] = useState(false);
- const [openDialogViewDetail, setOpenDialogViewDetail] = useState(false);
- const [openDialogMaterial, setOpenDialogMaterial] = useState(false);
- const [openDialogTools, setOpenDialogTools] = useState(false);
- const [openDialogGantt, setOpenDialogGantt] = useState(false);
- const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false);
- const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false);
- const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false);
- const [dataK3, setDataK3] = useState([]); // transfer list
- const [idDelete, setIdDelete] = useState(0);
- const [alertDelete, setAlertDelete] = useState(false);
- const [rowsPerPage, setRowsPerPage] = useState(10);
- const [dataExport, setDataExport] = useState([]);
- const [userProyek, setUserProyek] = useState([]);
- const [materialProyek, setMaterialProyek] = useState([]);
- const [dataCharter, setDataCharter] = useState(null);
- const [dataView, setDataView] = useState([]);
- const [materialResource, setMaterialResource] = useState([]);
- const [toolsResource, setToolsResource] = useState([]);
- const [dataTypeProyek, setDataTypeProyek] = useState([]);
- const [dataPhaseProject, setDataPhaseProject] = useState([]);
- const [dataDivisions, setDataDivisions] = useState([]);
- const [dataPm, setDataPM] = useState([]);
- const [openDialogDoc, setOpenDialogDoc] = useState(false);
- const [proyekName, setProyekName] = useState("");
- const [openDialogProyek, setOpenDialogProyek] = useState(false);
- // project charter
- const [projectCharter, setProjectCharter] = useState(null);
- const [projectParticipant, setProjectParticipant] = useState(null);
- const [projectMilestone, setProjectMilestone] = useState(null);
- const [projectApproval, setProjectApproval] = useState(null);
-
- const [loadVersionGantt, setLoadVersionGantt] = useState(false);
- const [loadHierarchy, setLoadHierarchy] = useState(false);
- const [dataVersionGantt, setDataVersionGantt] = useState([]);
- const [dataHierarchy, setDataHierarchy] = useState([]);
- const [dataDetail, setDataDetail] = useState(null);
- const [loading, setLoading] = useState(true);
-
- const pageName = params.name;
+ const token = localStorage.getItem("token");
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${token}`,
+ },
+ };
+
+ const [idTask, setidTask] = useState(0);
+ const [dataTable, setDatatable] = useState([]);
+ const [search, setSearch] = useState("");
+ const [currentPage, setCurrentPage] = useState(1);
+ const [totalPage, setTotalPage] = useState(0);
+ const [openDialog, setOpenDialog] = useState(false);
+ const [openDialogViewDetail, setOpenDialogViewDetail] = useState(false);
+ const [openDialogMaterial, setOpenDialogMaterial] = useState(false);
+ const [openDialogTools, setOpenDialogTools] = useState(false);
+ const [openDialogGantt, setOpenDialogGantt] = useState(false);
+ const [openDialogHierarchy, setOpenDialogHierarchy] = useState(false);
+ const [openDialogAsignHR, setOpenDialogAsignHR] = useState(false);
+ const [openDialogAsignCust, setOpenDialogAsignCust] = useState(false);
+ const [openDialogAssignK3, setOpenDialogAssignK3] = useState(false);
+ const [dataK3, setDataK3] = useState([]); // transfer list
+ const [idDelete, setIdDelete] = useState(0);
+ const [alertDelete, setAlertDelete] = useState(false);
+ const [rowsPerPage, setRowsPerPage] = useState(10);
+ const [dataExport, setDataExport] = useState([]);
+ const [userProyek, setUserProyek] = useState([]);
+ const [materialProyek, setMaterialProyek] = useState([]);
+ const [dataCharter, setDataCharter] = useState(null);
+ const [dataView, setDataView] = useState([]);
+ const [materialResource, setMaterialResource] = useState([]);
+ const [toolsResource, setToolsResource] = useState([]);
+ const [dataTypeProyek, setDataTypeProyek] = useState([]);
+ const [dataPhaseProject, setDataPhaseProject] = useState([]);
+ const [dataDivisions, setDataDivisions] = useState([]);
+ const [dataPm, setDataPM] = useState([]);
+ const [openDialogDoc, setOpenDialogDoc] = useState(false);
+ const [proyekName, setProyekName] = useState("");
+ const [openDialogProyek, setOpenDialogProyek] = useState(false);
+ // project charter
+ const [projectCharter, setProjectCharter] = useState(null);
+ const [projectParticipant, setProjectParticipant] = useState(null);
+ const [projectMilestone, setProjectMilestone] = useState(null);
+ const [projectApproval, setProjectApproval] = useState(null);
+
+ const [loadVersionGantt, setLoadVersionGantt] = useState(false);
+ const [loadHierarchy, setLoadHierarchy] = useState(false);
+ const [dataVersionGantt, setDataVersionGantt] = useState([]);
+ const [dataHierarchy, setDataHierarchy] = useState([]);
+ const [dataDetail, setDataDetail] = useState(null);
+ const [loading, setLoading] = useState(true);
+
+ const pageName = params.name;
useEffect(() => {
if (openDialogMaterial) {
@@ -163,855 +167,905 @@ const CreatedProyek = ({ params, ...props }) => {
handleGetDivisions();
handleGetDataPm();
}
- }, [openDialogProyek])
-
- useEffect(() => {
- getDataProyek();
- }, [search, rowsPerPage, currentPage]);
-
- useEffect(() => {
- if (dataExport.length > 0) {
- exportExcel();
- }
- }, [dataExport]);
-
- useEffect(() => {
- if (!openDialog) {
- setidTask(0);
- }
- }, [openDialogDoc]);
-
- const handleSearch = (e) => {
- const value = e.target.value;
- setSearch(value);
- setCurrentPage(1);
- };
-
- const handleGetTipeProject = async () => {
- const result = await axios
- .get(TYPE_PROYEK, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (result && result.data && result.data.code === 200) {
- setDataTypeProyek(result.data.data);
- } else {
- }
- };
-
- const handleGetPhaseProject = async () => {
- const result = await axios
- .get(PHASE_PROYEK, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (result && result.data && result.data.code === 200) {
- setDataPhaseProject(result.data.data);
- }
- };
-
- const handleGetDivisions = async () => {
- const result = await axios
- .get(DIVISI_LIST, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (result && result.data && result.data.code === 200) {
- setDataDivisions(result.data.data);
- }
- };
-
- const handleGetDataPm = async () => {
- const result = await axios
- .get(USER_LIST, HEADER)
- .then((res) => res)
- .catch((err) => err.response);
- if (result && result.data && result.data.code === 200) {
- setDataPM(result.data.data);
- } else {
- }
- };
-
- const handleDashboard = async (text) => {
- const URL = `${BASE_OSPRO}/api/project/detail/${text.id}`;
- const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- return;
- }
-
- if (result.status !== 200) {
- NotificationManager.error(`Get project detail failed, ${result.data.message}`, "Failed");
- return;
- }
- else if (result.status == 200 && result.data.data) {
- history.push(`dashboard-customer/${text.id}/${result.data.gantt.last_gantt_id}/1`);
- }
- }
-
- const getDataProyek = async () => {
- let start = 0;
-
- if (currentPage !== 1 && currentPage > 1) {
- start = currentPage * rowsPerPage - rowsPerPage;
- }
-
- const payload = {
- columns: [
- {
- name: "nama",
- logic_operator: "ilike",
- value: search,
- operator: "AND",
- },
- ],
- select: ["id", "nama", "rencana_biaya", "type_proyek_id", "currency_symbol", "mulai_proyek", "akhir_proyek"],
- joins: [
- {
- name: "m_users",
- column_join: "pm_id",
- column_results: ["name", "username"],
- },
- {
- name: "m_type_proyek",
- column_join: "type_proyek_id",
- column_results: ["name", "description"],
- },
- // { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
- ],
- orders: { columns: ["id"], ascending: false },
- paging: { start: start, length: rowsPerPage },
- };
-
- if (parseInt(role_id) !== 1) {
- payload["columns"] = [
- { name: "id", logic_operator: "=", value: proyek_id, operator: "AND" },
- ];
- }
-
-
- const result = await axios
- .post(PROYEK_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data || [];
-
- setDatatable(dataRes);
- setTotalPage(result.data.totalRecord);
- setLoading(false);
- } else {
- setLoading(false);
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getDataMaterialResource = async () => {
- const result = await axios
- .get(MATERIAL_RESOURCE_LIST, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data || [];
- setMaterialResource(dataRes);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getdataGantt = async (idTask) => {
- setLoadVersionGantt(true);
- const payload = {
- select: ["id", "name_version"],
- columns: [
- {
- name: "proyek_id",
- logic_operator: "=",
- value: idTask,
- operator: "AND",
- },
- ],
- };
- const result = await axios
- .post(VERSION_GANTT_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.status == 200) {
- setDataVersionGantt(result.data.data);
- setLoadVersionGantt(false);
- } else {
- NotificationManager.error(
- `Data gantt project gagal terload silahkan coba lagi!`,
- "Failed!!"
- );
- }
- };
-
- const getDataToolsResource = async () => {
- const result = await axios
- .get(TOOLS_RESOURCE_LIST, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data || [];
- setToolsResource(dataRes);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getDataK3 = async () => {
- const result = await axios
- .get(CHECKLIST_K3_LIST, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data || [];
- const finalData = [];
- if (dataRes.length > 0) {
- dataRes.map((val, index) => {
- let data = {
- key: val.id,
- title: val.name,
- };
- finalData.push(data);
- });
- }
- setDataK3(finalData);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const handleOpenDialog = (id) => {
- setOpenDialog(true);
- setidTask(id);
- };
-
- const handleOpenDialogProyek = (id) => {
- setOpenDialogProyek(true);
- setidTask(id);
- };
-
- const handleOpenDialogGantt = (data) => {
- setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogGantt(true);
- };
-
- const handleOpenDialogHierarchy = (data) => {
- setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogHierarchy(true);
- };
-
- const toggleDialogGantt = () => {
- setOpenDialogGantt(!openDialogGantt);
- };
-
- const closeDialogGantt = () => {
- setOpenDialogGantt(false);
- };
-
- const toggleDialogHierarchy = () => {
- setOpenDialogHierarchy(!openDialogHierarchy);
- };
-
- const closeDialogHierarchy = () => {
- setOpenDialogHierarchy(false);
- };
-
- const handleOpenDialogMaterial = (data) => {
- setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogMaterial(true);
- };
-
- const handleOpenAsignHr = (data) => {
- setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogAsignHR(true);
- };
-
- const handleOpenAssignK3 = (data) => {
- setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogAssignK3(true);
- };
-
- const handleOpenDialogTools = (data) => {
- setOpenDialogTools(true);
- setidTask(data.id);
- setProyekName(data.nama);
- setUserProyek(data.user_proyeks);
- };
-
- const handleOpenDialogViewDetail = async (data) => {
- setidTask(data.id);
- // setDataView(data)
- await getDataProject(data.id);
- await getProjectMilestone(data.id);
- await getProjectParticipant(data.id);
- await getProjectApproval(data.id);
- // await getDataProjectCharter(data.id);
- setOpenDialogViewDetail(true);
- };
+ }, [openDialogProyek]);
- const getProjectDetail = async (id) => {
- const URL = `${BASE_OSPRO}/api/project/detail/${id}`;
- const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
- if (!result) {
- NotificationManager.error(`Could not connect to internet.`, "Failed");
- return;
- }
+ useEffect(() => {
+ role_id !== "44" ? getDataProyek() : getDataProyekByCustomer();
+ }, [search, rowsPerPage, currentPage]);
- if (result.status !== 200) {
- NotificationManager.error(`Get project detail failed, ${result.data.message}`, "Failed");
- return;
- }
- else if (result.status == 200 && result.data.data) {
- history.push(`/dashboard-project/${id}/${result.data.gantt.last_gantt_id}/1`);
+ useEffect(() => {
+ if (dataExport.length > 0) {
+ exportExcel();
+ }
+ }, [dataExport]);
+
+ useEffect(() => {
+ if (!openDialog) {
+ setidTask(0);
+ }
+ }, [openDialogDoc]);
+
+ const handleSearch = (e) => {
+ const value = e.target.value;
+ setSearch(value);
+ setCurrentPage(1);
+ };
+
+ const handleGetTipeProject = async () => {
+ const result = await axios
+ .get(TYPE_PROYEK, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (result && result.data && result.data.code === 200) {
+ setDataTypeProyek(result.data.data);
+ } else {
+ }
+ };
+
+ const handleGetPhaseProject = async () => {
+ const result = await axios
+ .get(PHASE_PROYEK, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (result && result.data && result.data.code === 200) {
+ setDataPhaseProject(result.data.data);
+ }
+ };
+
+ const handleGetDivisions = async () => {
+ const result = await axios
+ .get(DIVISI_LIST, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (result && result.data && result.data.code === 200) {
+ setDataDivisions(result.data.data);
+ }
+ };
+
+ const handleGetDataPm = async () => {
+ const result = await axios
+ .get(USER_LIST, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (result && result.data && result.data.code === 200) {
+ setDataPM(result.data.data);
+ } else {
+ }
+ };
+
+ const handleDashboard = async (text) => {
+ const URL = `${BASE_OSPRO}/api/project/detail/${text.id}`;
+ const result = await axios
+ .get(URL, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (!result) {
+ NotificationManager.error(`Could not connect to internet.`, "Failed");
+ return;
+ }
+
+ if (result.status !== 200) {
+ NotificationManager.error(
+ `Get project detail failed, ${result.data.message}`,
+ "Failed"
+ );
+ return;
+ } else if (result.status == 200 && result.data.data) {
+ history.push(
+ `dashboard-customer/${text.id}/${result.data.gantt.last_gantt_id}/1`
+ );
+ }
+ };
+
+ const getDataProyek = async () => {
+ let start = 0;
+
+ if (currentPage !== 1 && currentPage > 1) {
+ start = currentPage * rowsPerPage - rowsPerPage;
+ }
+
+ const payload = {
+ columns: [
+ {
+ name: "nama",
+ logic_operator: "ilike",
+ value: search,
+ operator: "AND",
+ },
+ ],
+ select: [
+ "id",
+ "nama",
+ "rencana_biaya",
+ "type_proyek_id",
+ "currency_symbol",
+ "mulai_proyek",
+ "akhir_proyek",
+ ],
+ joins: [
+ {
+ name: "m_users",
+ column_join: "pm_id",
+ column_results: ["name", "username"],
+ },
+ {
+ name: "m_type_proyek",
+ column_join: "type_proyek_id",
+ column_results: ["name", "description"],
+ },
+ // { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
+ ],
+ orders: { columns: ["id"], ascending: false },
+ paging: { start: start, length: rowsPerPage },
+ };
+
+ if (parseInt(role_id) !== 1) {
+ payload["columns"] = [
+ { name: "id", logic_operator: "=", value: proyek_id, operator: "AND" },
+ ];
+ }
+
+ const result = await axios
+ .post(PROYEK_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || [];
+
+ setDatatable(dataRes);
+ setTotalPage(result.data.totalRecord);
+ setLoading(false);
+ } else {
+ setLoading(false);
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getDataProyekByCustomer = async () => {
+ const url = `${BASE_OSPRO}/api/project-by-customer/${user_id}`;
+ const result = await axios
+ .get(url, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || [];
+ setDatatable(dataRes);
+ setTotalPage(result.data.totalRecord);
+ setLoading(false);
+ } else {
+ setLoading(false);
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getDataMaterialResource = async () => {
+ const result = await axios
+ .get(MATERIAL_RESOURCE_LIST, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || [];
+ setMaterialResource(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getdataGantt = async (idTask) => {
+ setLoadVersionGantt(true);
+ const payload = {
+ select: ["id", "name_version"],
+ columns: [
+ {
+ name: "proyek_id",
+ logic_operator: "=",
+ value: idTask,
+ operator: "AND",
+ },
+ ],
+ };
+ const result = await axios
+ .post(VERSION_GANTT_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ setDataVersionGantt(result.data.data);
+ setLoadVersionGantt(false);
+ } else {
+ NotificationManager.error(
+ `Data gantt project gagal terload silahkan coba lagi!`,
+ "Failed!!"
+ );
+ }
+ };
+
+ const getDataToolsResource = async () => {
+ const result = await axios
+ .get(TOOLS_RESOURCE_LIST, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || [];
+ setToolsResource(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getDataK3 = async () => {
+ const result = await axios
+ .get(CHECKLIST_K3_LIST, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data || [];
+ const finalData = [];
+ if (dataRes.length > 0) {
+ dataRes.map((val, index) => {
+ let data = {
+ key: val.id,
+ title: val.name,
+ };
+ finalData.push(data);
+ });
}
- }
+ setDataK3(finalData);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const handleOpenDialog = (id) => {
+ setOpenDialog(true);
+ setidTask(id);
+ };
+
+ const handleOpenDialogProyek = (id) => {
+ setOpenDialogProyek(true);
+ setidTask(id);
+ };
+
+ const handleOpenDialogGantt = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogGantt(true);
+ };
+
+ const handleOpenDialogHierarchy = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogHierarchy(true);
+ };
+
+ const toggleDialogGantt = () => {
+ setOpenDialogGantt(!openDialogGantt);
+ };
+
+ const closeDialogGantt = () => {
+ setOpenDialogGantt(false);
+ };
+
+ const toggleDialogHierarchy = () => {
+ setOpenDialogHierarchy(!openDialogHierarchy);
+ };
+
+ const closeDialogHierarchy = () => {
+ setOpenDialogHierarchy(false);
+ };
+
+ const handleOpenDialogMaterial = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogMaterial(true);
+ };
+
+ const handleOpenAsignHr = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogAsignHR(true);
+ };
+
+ const handleOpenAsignCust = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogAsignCust(true);
+ };
+
+ const handleOpenAssignK3 = (data) => {
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogAssignK3(true);
+ };
+
+ const handleOpenDialogTools = (data) => {
+ setOpenDialogTools(true);
+ setidTask(data.id);
+ setProyekName(data.nama);
+ setUserProyek(data.user_proyeks);
+ };
+
+ const handleOpenDialogViewDetail = async (data) => {
+ setidTask(data.id);
+ // setDataView(data)
+ await getDataProject(data.id);
+ await getProjectMilestone(data.id);
+ await getProjectParticipant(data.id);
+ await getProjectApproval(data.id);
+ // await getDataProjectCharter(data.id);
+ setOpenDialogViewDetail(true);
+ };
+
+ const getProjectDetail = async (id) => {
+ const URL = `${BASE_OSPRO}/api/project/detail/${id}`;
+ const result = await axios
+ .get(URL, HEADER)
+ .then((res) => res)
+ .catch((err) => err.response);
+ if (!result) {
+ NotificationManager.error(`Could not connect to internet.`, "Failed");
+ return;
+ }
+
+ if (result.status !== 200) {
+ NotificationManager.error(
+ `Get project detail failed, ${result.data.message}`,
+ "Failed"
+ );
+ return;
+ } else if (result.status == 200 && result.data.data) {
+ history.push(
+ `/dashboard-project/${id}/${result.data.gantt.last_gantt_id}/1`
+ );
+ }
+ };
const handleSCurve = async (data) => {
- getProjectDetail(data.id)
+ getProjectDetail(data.id);
};
- const getDataProject = async (proyek_id) => {
- const url = PROYEK_GET_ID(proyek_id);
- const result = await axios
- .get(url, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data;
- setProjectCharter(dataRes);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getProjectMilestone = async (id) => {
- const payload = {
- columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
- joins: [],
- orders: { columns: ["id"], ascending: true },
- paging: { start: 0, length: -1 },
- };
- // const url = PROJECT_MI(proyek_id)
- const result = await axios
- .post(PROJECT_MILESTONE_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data;
- setProjectMilestone(dataRes);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getProjectParticipant = async (id) => {
- const payload = {
- columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
- joins: [],
- orders: { columns: ["id"], ascending: true },
- paging: { start: 0, length: -1 },
- };
- // const url = PROJECT_MI(proyek_id)
- const result = await axios
- .post(PROJECT_PARTICIPANT_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data;
- setProjectParticipant(dataRes);
-
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const getProjectApproval = async (id) => {
- const payload = {
- columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
- joins: [],
- orders: { columns: ["id"], ascending: true },
- paging: { start: 0, length: -1 },
- };
- // const url = PROJECT_MI(proyek_id)
- const result = await axios
- .post(PROJECT_APPROVAL_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- let dataRes = result.data.data;
- setProjectApproval(dataRes);
- } else {
- NotificationManager.error("Gagal Mengambil Data!!", "Failed");
- }
- };
-
- const handleCloseDialog = (type, payload) => {
- if (type === "add") saveProyek(payload);
-
- if (type === "edit") editProyek(payload);
- setidTask(0);
- setOpenDialog(false);
- };
-
- const handleCloseDialogProyek = (type, payload) => {
- if (type === "add") saveProyek(payload);
-
- if (type === "edit") editProyek(payload);
- setidTask(0);
- setOpenDialogProyek(false);
- };
-
- const handleCloseDialogView = () => {
- setProjectApproval(null);
- setProjectParticipant(null);
- setProjectMilestone(null);
- setProjectCharter(null);
- setOpenDialogViewDetail(false);
- };
-
- const toggleAddDialog = () => setOpenDialog(!openDialog);
- const toggleAddDialogProyek = () => setOpenDialogProyek(!openDialogProyek);
- const toggleAddDialogView = () => {
- if (openDialogViewDetail) {
- setProjectApproval(null);
- setProjectParticipant(null);
- setProjectMilestone(null);
- setProjectCharter(null);
- }
- setOpenDialogViewDetail(!openDialogViewDetail);
- };
-
- const onConfirmDelete = async () => {
- let urlDel = PROYEK_DELETE(idDelete);
- const result = await axios
- .delete(urlDel, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataProyek();
- setIdDelete(0);
- setAlertDelete(false);
- NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!");
- } else {
- setIdDelete(0);
- setAlertDelete(false);
- NotificationManager.error(`Data proyek gagal dihapus`, "Failed!!");
- }
- };
-
- const saveProyek = async (data) => {
- const formData = data;
-
- const result = await axios
- .post(PROYEK_ADD, formData, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
- if (result && result.data && result.data.code === 200) {
- const { participants, milestones, approval } = data.projectCharter;
- const resultParticipant = await saveParticipant(
- result.data.data_result.id,
- participants
- );
- const resultMilestone = await saveMilestone(
- result.data.data_result.id,
- milestones
- );
- const resultApproval = await saveApproval(
- result.data.data_result.id,
- approval
- );
- if (
- resultParticipant === "berhasil" &&
- resultMilestone === "berhasil" &&
- resultApproval === "berhasil"
- ) {
- // getDataProyek();
- NotificationManager.success(
- `Data proyek berhasil ditambah`,
- "Success!!"
- );
- } else {
- NotificationManager.success(`${result.data.message}`, "Success!!");
- }
-
- getDataProyek();
- } else {
- NotificationManager.error(`${result.data.message}`, "Failed!!");
- }
- };
-
- const saveParticipant = async (id, data) => {
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- tittle: res.title,
- name: res.name,
- };
- return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- const result = arr.map((res) => res.data.code == 200);
- if (result.length > 0) {
- return "gagal";
- }
-
- return "berhasil";
- };
-
- const saveMilestone = async (id, data) => {
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- status: res.status,
- due_date: res.due,
- deadline: res.deadline,
- };
- return axios.post(PROJECT_MILESTONE_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- const result = arr.map((res) => res.data.code !== 200);
- if (result.length > 0) {
- return "gagal";
- }
-
- return "berhasil";
- };
-
- const saveApproval = async (id, data) => {
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- tittle: res.title,
- name: res.name,
- date_approval: res.date,
- };
- return axios.post(PROJECT_APPROVAL_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- const result = arr.map((res) => res.data.code !== 200);
- if (result.length > 0) {
- return "gagal";
- }
-
- return "berhasil";
- };
-
- const editProyek = async (data) => {
- const { participants, milestones, approval } = data.projectCharter;
- let urlEdit = PROYEK_EDIT(data.id);
- const formData = data;
-
- const result = await axios
- .put(urlEdit, formData, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
- const resultParticipant = await editParticipant(data.id, participants);
- const resultMilestone = await editMilestone(data.id, milestones);
- const resultApproval = await editApproval(data.id, approval);
- if (result && result.status === 200) {
- getDataProyek();
- NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!");
- } else {
- NotificationManager.error(`${result.data.message}`, "Failed!!");
- }
- };
-
- const editParticipant = async (id, data) => {
- await axios.delete(PROJECT_PARTICIPANT_DELETE_BY_PROYEK(id), HEADER);
- // if (restDelete){
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- tittle: res.tittle ? res.tittle : res.title,
- name: res.name,
- };
- return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- const result = arr.map((res) => res.data.code !== 200);
- if (result.length > 0) {
- return "gagal";
- }
-
- return "berhasil";
- };
-
- const editMilestone = async (id, data) => {
- await axios.delete(PROJECT_MILESTONE_DELETE_BY_PROYEK(id), HEADER);
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- status: res.status,
- due_date: res.due_date ? res.due_date : res.due,
- deadline: res.deadline,
- };
- return axios.post(PROJECT_MILESTONE_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- const result = arr.map((res) => res.data.code !== 200);
- if (result.length > 0) {
- return "gagal";
- }
- return "berhasil";
- };
-
- const editApproval = async (id, data) => {
- await axios.delete(PROJECT_APPROVAL_DELETE_BY_PROYEK(id), HEADER);
- const request = data.map((res) => {
- const payload = {
- proyek_id: parseInt(id),
- tittle: res.tittle ? res.tittle : res.title,
- name: res.name,
- date_approval: res.date ? res.date : res.date_approval,
- };
- return axios.post(PROJECT_APPROVAL_ADD, payload, HEADER);
- });
- const arr = await Promise.all(request)
- .then((values) => values)
- .catch((err) => err.response);
- // if(arr)
-
- // const result = arr.map(res => res.data.code !== 200)
- // if (result.length > 0) {
- // return "gagal"
- // }
- // return "berhasil"
- };
-
- const handleDelete = async (id) => {
- await setAlertDelete(true);
- await setIdDelete(id);
- };
-
- const onShowSizeChange = (current, pageSize) => {
- setRowsPerPage(pageSize);
- };
-
- const onPagination = (current, pageSize) => {
- setCurrentPage(current);
- };
-
- const handleExportExcel = async () => {
- const payload = {
- paging: { start: 0, length: -1 },
- joins: [],
- orders: { columns: ["id"], ascending: false },
- };
-
- if (parseInt(role_id) !== 1) {
- payload["columns"] = [
- { name: "id", logic_operator: "=", value: proyek_id, operator: "AND" },
- ];
- }
-
- const result = await axios
- .post(PROYEK_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- let resData = result.data.data;
- const excelData = [];
- resData.map((n, index) => {
- let dataRow = {
- Sortname: n.kode_sortname ? n.kode_sortname : "",
- "Nama Project": n.nama ? n.nama : "",
- "Tanggal Mulai": n.mulai_proyek
- ? moment(n.mulai_proyek).format(format)
- : "-",
- "Tanggal Selesai": n.akhir_proyek
- ? moment(n.akhir_proyek).format(format)
- : "-",
- "Area Kerja": n.area_kerja ? n.area_kerja : "",
- Perusahaan: n.company ? n.company : "",
- Keterangan: n.keterangan ? n.keterangan : "",
- "Dianggap sukses ketika": n.considered_success_when
- ? n.considered_success_when
- : "",
- "Tujuan Proyek": n.project_objectives ? n.project_objectives : "",
- "Resiko potensial": n.potential_risk ? n.potential_risk : "",
- "Rencana Biaya": n.rencana_biaya
- ? formatThousand(n.rencana_biaya)
- : "-",
- "Testing Environment": n.testing_environment
- ? n.testing_environment
- : "-",
- };
- excelData.push(dataRow);
- });
- await setDataExport(excelData);
- } else {
- NotificationManager.error("Gagal Export Data!!", "Failed");
- }
- };
-
- const handleExportPdf = async () => {
- const doc = new jsPDF();
-
- const headers = [
- ["Project Name", "Budget", "Project Type", "PM", "Time Project"],
- ];
- const payload = {
- columns: [
- {
- name: "nama",
- logic_operator: "ilike",
- value: search,
- operator: "AND",
- },
- ],
- joins: [
- {
- name: "m_users",
- column_join: "pm_id",
- column_results: ["name", "username"],
- },
- {
- name: "m_type_proyek",
- column_join: "type_proyek_id",
- column_results: ["name", "description"],
- },
- // { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
- ],
+ const getDataProject = async (proyek_id) => {
+ const url = PROYEK_GET_ID(proyek_id);
+ const result = await axios
+ .get(url, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data;
+ setProjectCharter(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getProjectMilestone = async (id) => {
+ const payload = {
+ columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
+ joins: [],
+ orders: { columns: ["id"], ascending: true },
+ paging: { start: 0, length: -1 },
+ };
+ // const url = PROJECT_MI(proyek_id)
+ const result = await axios
+ .post(PROJECT_MILESTONE_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data;
+ setProjectMilestone(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getProjectParticipant = async (id) => {
+ const payload = {
+ columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
+ joins: [],
+ orders: { columns: ["id"], ascending: true },
+ paging: { start: 0, length: -1 },
+ };
+ // const url = PROJECT_MI(proyek_id)
+ const result = await axios
+ .post(PROJECT_PARTICIPANT_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data;
+ setProjectParticipant(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const getProjectApproval = async (id) => {
+ const payload = {
+ columns: [{ name: "proyek_id", logic_operator: "=", value: id }],
+ joins: [],
+ orders: { columns: ["id"], ascending: true },
+ paging: { start: 0, length: -1 },
+ };
+ // const url = PROJECT_MI(proyek_id)
+ const result = await axios
+ .post(PROJECT_APPROVAL_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let dataRes = result.data.data;
+ setProjectApproval(dataRes);
+ } else {
+ NotificationManager.error("Gagal Mengambil Data!!", "Failed");
+ }
+ };
+
+ const handleCloseDialog = (type, payload) => {
+ if (type === "add") saveProyek(payload);
+
+ if (type === "edit") editProyek(payload);
+ setidTask(0);
+ setOpenDialog(false);
+ };
+
+ const handleCloseDialogProyek = (type, payload) => {
+ if (type === "add") saveProyek(payload);
+
+ if (type === "edit") editProyek(payload);
+ setidTask(0);
+ setOpenDialogProyek(false);
+ };
+
+ const handleCloseDialogView = () => {
+ setProjectApproval(null);
+ setProjectParticipant(null);
+ setProjectMilestone(null);
+ setProjectCharter(null);
+ setOpenDialogViewDetail(false);
+ };
+
+ const toggleAddDialog = () => setOpenDialog(!openDialog);
+ const toggleAddDialogProyek = () => setOpenDialogProyek(!openDialogProyek);
+ const toggleAddDialogView = () => {
+ if (openDialogViewDetail) {
+ setProjectApproval(null);
+ setProjectParticipant(null);
+ setProjectMilestone(null);
+ setProjectCharter(null);
+ }
+ setOpenDialogViewDetail(!openDialogViewDetail);
+ };
+
+ const onConfirmDelete = async () => {
+ let urlDel = PROYEK_DELETE(idDelete);
+ const result = await axios
+ .delete(urlDel, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ role_id !== "44" ? getDataProyek() : getDataProyekByCustomer();
+
+ setIdDelete(0);
+ setAlertDelete(false);
+ NotificationManager.success(`Data proyek berhasil dihapus`, "Success!!");
+ } else {
+ setIdDelete(0);
+ setAlertDelete(false);
+ NotificationManager.error(`Data proyek gagal dihapus`, "Failed!!");
+ }
+ };
+
+ const saveProyek = async (data) => {
+ const formData = data;
+
+ const result = await axios
+ .post(PROYEK_ADD, formData, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code === 200) {
+ const { participants, milestones, approval } = data.projectCharter;
+ const resultParticipant = await saveParticipant(
+ result.data.data_result.id,
+ participants
+ );
+ const resultMilestone = await saveMilestone(
+ result.data.data_result.id,
+ milestones
+ );
+ const resultApproval = await saveApproval(
+ result.data.data_result.id,
+ approval
+ );
+ if (
+ resultParticipant === "berhasil" &&
+ resultMilestone === "berhasil" &&
+ resultApproval === "berhasil"
+ ) {
+ // getDataProyek();
+ NotificationManager.success(
+ `Data proyek berhasil ditambah`,
+ "Success!!"
+ );
+ } else {
+ NotificationManager.success(`${result.data.message}`, "Success!!");
+ }
+
+ role_id !== "44" ? getDataProyek() : getDataProyekByCustomer();
+ } else {
+ NotificationManager.error(`${result.data.message}`, "Failed!!");
+ }
+ };
+
+ const saveParticipant = async (id, data) => {
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ tittle: res.title,
+ name: res.name,
+ };
+ return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ const result = arr.map((res) => res.data.code == 200);
+ if (result.length > 0) {
+ return "gagal";
+ }
+
+ return "berhasil";
+ };
+
+ const saveMilestone = async (id, data) => {
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ status: res.status,
+ due_date: res.due,
+ deadline: res.deadline,
+ };
+ return axios.post(PROJECT_MILESTONE_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ const result = arr.map((res) => res.data.code !== 200);
+ if (result.length > 0) {
+ return "gagal";
+ }
+
+ return "berhasil";
+ };
+
+ const saveApproval = async (id, data) => {
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ tittle: res.title,
+ name: res.name,
+ date_approval: res.date,
+ };
+ return axios.post(PROJECT_APPROVAL_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ const result = arr.map((res) => res.data.code !== 200);
+ if (result.length > 0) {
+ return "gagal";
+ }
+
+ return "berhasil";
+ };
+
+ const editProyek = async (data) => {
+ const { participants, milestones, approval } = data.projectCharter;
+ let urlEdit = PROYEK_EDIT(data.id);
+ const formData = data;
+
+ const result = await axios
+ .put(urlEdit, formData, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+ const resultParticipant = await editParticipant(data.id, participants);
+ const resultMilestone = await editMilestone(data.id, milestones);
+ const resultApproval = await editApproval(data.id, approval);
+ if (result && result.status === 200) {
+ role_id !== "44" ? getDataProyek() : getDataProyekByCustomer();
+ NotificationManager.success(`Data proyek berhasil Ubah`, "Success!!");
+ } else {
+ NotificationManager.error(`${result.data.message}`, "Failed!!");
+ }
+ };
+
+ const editParticipant = async (id, data) => {
+ await axios.delete(PROJECT_PARTICIPANT_DELETE_BY_PROYEK(id), HEADER);
+ // if (restDelete){
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ tittle: res.tittle ? res.tittle : res.title,
+ name: res.name,
+ };
+ return axios.post(PROJECT_PARTICIPANT_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ const result = arr.map((res) => res.data.code !== 200);
+ if (result.length > 0) {
+ return "gagal";
+ }
+
+ return "berhasil";
+ };
+
+ const editMilestone = async (id, data) => {
+ await axios.delete(PROJECT_MILESTONE_DELETE_BY_PROYEK(id), HEADER);
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ status: res.status,
+ due_date: res.due_date ? res.due_date : res.due,
+ deadline: res.deadline,
+ };
+ return axios.post(PROJECT_MILESTONE_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ const result = arr.map((res) => res.data.code !== 200);
+ if (result.length > 0) {
+ return "gagal";
+ }
+ return "berhasil";
+ };
+
+ const editApproval = async (id, data) => {
+ await axios.delete(PROJECT_APPROVAL_DELETE_BY_PROYEK(id), HEADER);
+ const request = data.map((res) => {
+ const payload = {
+ proyek_id: parseInt(id),
+ tittle: res.tittle ? res.tittle : res.title,
+ name: res.name,
+ date_approval: res.date ? res.date : res.date_approval,
+ };
+ return axios.post(PROJECT_APPROVAL_ADD, payload, HEADER);
+ });
+ const arr = await Promise.all(request)
+ .then((values) => values)
+ .catch((err) => err.response);
+ // if(arr)
+
+ // const result = arr.map(res => res.data.code !== 200)
+ // if (result.length > 0) {
+ // return "gagal"
+ // }
+ // return "berhasil"
+ };
+
+ const handleDelete = async (id) => {
+ await setAlertDelete(true);
+ await setIdDelete(id);
+ };
+
+ const onShowSizeChange = (current, pageSize) => {
+ setRowsPerPage(pageSize);
+ };
+
+ const onPagination = (current, pageSize) => {
+ setCurrentPage(current);
+ };
+
+ const handleExportExcel = async () => {
+ const payload = {
+ paging: { start: 0, length: -1 },
+ joins: [],
orders: { columns: ["id"], ascending: false },
- };
-
- const result = await axios
- .post(PROYEK_SEARCH, payload, HEADER)
- .then((res) => res)
- .catch((error) => error.response);
- if (result && result.data && result.data.code == 200) {
- let resData = result.data.data;
- const data = resData.map((elt) => [
- elt.nama,
- `Rp. ${formatThousand(elt.rencana_biaya)}`,
- elt.join_second_name,
- elt.join_first_name,
- `${moment(elt.mulai_proyek).format(format)} - ${moment(
- elt.akhir_proyek
- ).format(format)}`,
- ]);
- // Or use javascript directly:
- doc.text(4, 15, "Project Charter");
- autoTable(doc, {
- startY: 20,
- margin: { horizontal: 4 },
- styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 },
- columnStyles: { text: { columnWidth: "auto" } },
- head: headers,
- body: data,
- });
- }
- doc.save("Project.pdf");
- // const unit = "pt";
- // const size = "A4"; // Use A1, A2, A3 or A4
- // const orientation = "portrait"; // portrait or landscape
-
- // const marginLeft = 40;
- // const doc = new jsPDF(orientation, unit, size);
-
- // doc.setFontSize(15);
- // const dataPeople = [
- // { name: "Keanu Reeves", profession: "Actor" },
- // { name: "Lionel Messi", profession: "Football Player" },
- // { name: "Cristiano Ronaldo", profession: "Football Player" },
- // { name: "Jack Nicklaus", profession: "Golf Player" },
- // ];
- // const title = "My Awesome Report";
- // const headers = [["NAME", "PROFESSION"]];
-
- // const data = dataPeople.map((elt) => [elt.name, elt.profession]);
-
- // let content = {
- // startY: 50,
- // head: headers,
- // body: data,
- // };
-
- // doc.text(title, marginLeft, 40);
- // doc.autoTable(content);
- // doc.save("report.pdf");
- };
-
- const exportExcel = () => {
- const dataExcel = dataExport || [];
- const fileName = `Data ${pageName}.xlsx`;
- const ws = XLSX.utils.json_to_sheet(dataExcel);
- const wb = XLSX.utils.book_new();
- XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
-
- XLSX.writeFile(wb, fileName);
- setDataExport([]);
- };
-
- const cancelDelete = () => {
- setAlertDelete(false);
- setIdDelete(0);
- };
-
- const handleOpenDokumen = async (data) => {
- await setidTask(data.id);
- setProyekName(data.nama);
- setOpenDialogDoc(true);
- };
-
- const popupMenu = (text, record) => {
- return (
-
-
handleOpenDialogViewDetail(text)}
- >
-
-
-
- Project Charter
-
-
handleOpenDokumen(text)}>
-
-
-
- Project Documents
-
-
handleOpenAsignHr(text)}>
-
-
-
- Assign Human Resource
-
-
handleOpenAssignK3(text)}>
-
-
-
- Assign Checklist K3
-
- {/*
res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data;
+ const excelData = [];
+ resData.map((n, index) => {
+ let dataRow = {
+ Sortname: n.kode_sortname ? n.kode_sortname : "",
+ "Nama Project": n.nama ? n.nama : "",
+ "Tanggal Mulai": n.mulai_proyek
+ ? moment(n.mulai_proyek).format(format)
+ : "-",
+ "Tanggal Selesai": n.akhir_proyek
+ ? moment(n.akhir_proyek).format(format)
+ : "-",
+ "Area Kerja": n.area_kerja ? n.area_kerja : "",
+ Perusahaan: n.company ? n.company : "",
+ Keterangan: n.keterangan ? n.keterangan : "",
+ "Dianggap sukses ketika": n.considered_success_when
+ ? n.considered_success_when
+ : "",
+ "Tujuan Proyek": n.project_objectives ? n.project_objectives : "",
+ "Resiko potensial": n.potential_risk ? n.potential_risk : "",
+ "Rencana Biaya": n.rencana_biaya
+ ? formatThousand(n.rencana_biaya)
+ : "-",
+ "Testing Environment": n.testing_environment
+ ? n.testing_environment
+ : "-",
+ };
+ excelData.push(dataRow);
+ });
+ await setDataExport(excelData);
+ } else {
+ NotificationManager.error("Gagal Export Data!!", "Failed");
+ }
+ };
+
+ const handleExportPdf = async () => {
+ const doc = new jsPDF();
+
+ const headers = [
+ ["Project Name", "Budget", "Project Type", "PM", "Time Project"],
+ ];
+ const payload = {
+ columns: [
+ {
+ name: "nama",
+ logic_operator: "ilike",
+ value: search,
+ operator: "AND",
+ },
+ ],
+ joins: [
+ {
+ name: "m_users",
+ column_join: "pm_id",
+ column_results: ["name", "username"],
+ },
+ {
+ name: "m_type_proyek",
+ column_join: "type_proyek_id",
+ column_results: ["name", "description"],
+ },
+ // { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
+ ],
+ orders: { columns: ["id"], ascending: false },
+ };
+
+ const result = await axios
+ .post(PROYEK_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data;
+ const data = resData.map((elt) => [
+ elt.nama,
+ `Rp. ${formatThousand(elt.rencana_biaya)}`,
+ elt.join_second_name,
+ elt.join_first_name,
+ `${moment(elt.mulai_proyek).format(format)} - ${moment(
+ elt.akhir_proyek
+ ).format(format)}`,
+ ]);
+ // Or use javascript directly:
+ doc.text(4, 15, "Project Charter");
+ autoTable(doc, {
+ startY: 20,
+ margin: { horizontal: 4 },
+ styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 },
+ columnStyles: { text: { columnWidth: "auto" } },
+ head: headers,
+ body: data,
+ });
+ }
+ doc.save("Project.pdf");
+ // const unit = "pt";
+ // const size = "A4"; // Use A1, A2, A3 or A4
+ // const orientation = "portrait"; // portrait or landscape
+
+ // const marginLeft = 40;
+ // const doc = new jsPDF(orientation, unit, size);
+
+ // doc.setFontSize(15);
+ // const dataPeople = [
+ // { name: "Keanu Reeves", profession: "Actor" },
+ // { name: "Lionel Messi", profession: "Football Player" },
+ // { name: "Cristiano Ronaldo", profession: "Football Player" },
+ // { name: "Jack Nicklaus", profession: "Golf Player" },
+ // ];
+ // const title = "My Awesome Report";
+ // const headers = [["NAME", "PROFESSION"]];
+
+ // const data = dataPeople.map((elt) => [elt.name, elt.profession]);
+
+ // let content = {
+ // startY: 50,
+ // head: headers,
+ // body: data,
+ // };
+
+ // doc.text(title, marginLeft, 40);
+ // doc.autoTable(content);
+ // doc.save("report.pdf");
+ };
+
+ const exportExcel = () => {
+ const dataExcel = dataExport || [];
+ const fileName = `Data ${pageName}.xlsx`;
+ const ws = XLSX.utils.json_to_sheet(dataExcel);
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
+
+ XLSX.writeFile(wb, fileName);
+ setDataExport([]);
+ };
+
+ const cancelDelete = () => {
+ setAlertDelete(false);
+ setIdDelete(0);
+ };
+
+ const handleOpenDokumen = async (data) => {
+ await setidTask(data.id);
+ setProyekName(data.nama);
+ setOpenDialogDoc(true);
+ };
+
+ const popupMenu = (text, record) => {
+ return (
+
+
handleOpenDialogViewDetail(text)}
+ >
+
+
+
+ Project Charter
+
+
handleOpenDokumen(text)}>
+
+
+
+ Project Documents
+
+
handleOpenAsignHr(text)}>
+
+
+
+ Assign Human Resource
+
+
handleOpenAsignCust(text)}>
+
+
+
+ Assign Customer
+
+
handleOpenAssignK3(text)}>
+
+
+
+ Assign Checklist K3
+
+ {/*
handleOpenDialogMaterial(text)}
>
@@ -1020,511 +1074,544 @@ const CreatedProyek = ({ params, ...props }) => {
Request Material Resource
*/}
- {/*
handleOpenDialogTools(text)}>
+ {/*
handleOpenDialogTools(text)}>
Request Tools
*/}
- {/*
*/}
+ {/*
*/}
{
/*text.type_proyek_id != 9 ?*/
-
handleOpenDialogGantt(text)}>
-
-
-
- Gantt
-
+
handleOpenDialogGantt(text)}>
+
+
+
+ Gantt
+
/*: null*/
}
-
handleSCurve(text)}>
+
handleSCurve(text)}>
+
+
+
+ S Curve
+
+ {/* */}
+
handleOpenDialogProyek(text.id)}
+ >
+
+
+
+ Edit Project
+
+
handleDelete(text.id)}>
+
+
+
+ Delete Project
+
+
+ );
+ };
+
+ const popupMenuGantt = (text, record) => {
+ return (
+
+ {text.type_proyek_id !== 9 && loadVersionGantt && (
+
+
+
+ )}
+
+ {!loadVersionGantt && text.type_proyek_id !== 9 && (
+ <>
+ {dataVersionGantt.slice(0, 8).map((res) => (
+
+
+
+
+
+ {res.name_version}
+
+
+ ))}
+ {dataVersionGantt.length > 0 && (
+
+ )}
+ >
+ )}
+ {text.type_proyek_id == 9 ? (
+
handleOpenDialogHierarchy(text)}
+ >
-
+
- S Curve
+ More Hierarchy Menu ...
- {/* */}
-
handleOpenDialogProyek(text.id)}
- >
-
-
-
- Edit Project
-
-
handleDelete(text.id)}>
-
-
-
- Delete Project
-
-
- );
- };
-
- const popupMenuGantt = (text, record) => {
- return (
-
- {text.type_proyek_id !== 9 && loadVersionGantt && (
-
-
-
- )}
-
- {(!loadVersionGantt && text.type_proyek_id !== 9) && (
- <>
- {dataVersionGantt.slice(0, 8).map((res) => (
-
-
-
-
-
- {res.name_version}
-
-
- ))}
- {dataVersionGantt.length > 0 && (
-
- )}
- >
- )}
- {text.type_proyek_id == 9 ?
-
handleOpenDialogHierarchy(text)}
- >
-
-
-
- More Hierarchy Menu ...
-
:
-
handleOpenDialogGantt(text)}
- >
-
-
-
- More Gantt Menu ...
-
}
-
- );
- };
-
- const RenderTable = useMemo(() => {
- const columns = [
- {
- title: "Action",
- dataIndex: "",
- key: "x",
- render: (text, record) => (
- role_id == "44"
- ?
- <>
-
-
-
- >
- :
- <>
-
-
-
-
- {
- text.type_proyek_id == 9 ?
- :
-
- }
-
- >
- ),
- },
- { title: "Project Name", dataIndex: "nama", key: "nama" },
- {
- title: "Budget",
- dataIndex: "rencana_biaya",
- key: "rencana_biaya",
- // render: (text, record) => { return renderFormatRupiah(text, "Rp") }
- render: (text, record) => {
- return record.currency_symbol
- ? `${record.currency_symbol} ${formatThousand(text)}`
- : `${formatThousand(text)}`;
- },
- },
- {
- title: "Project Type",
- dataIndex: "color_progress",
- key: "color_progress",
- render: (text, record) => (
- <>{record.join_second_name ? record.join_second_name : "-"}>
- ),
- },
- {
- title: "PM",
- dataIndex: "pic",
- key: "pic",
- render: (text, record) => (
- <>{record.join_first_name ? record.join_first_name : "-"}>
- ),
- },
- {
- title: "Time Project",
- dataIndex: "akhir_proyek",
- key: "akhir_proyek",
- render: (text, record) => (
- <>
- {moment(record.mulai_proyek).format(format)} -{" "}
- {moment(record.akhir_proyek).format(format)}
- >
- ),
- },
- ];
-
- return (
-
- );
- }, [dataTable, dataVersionGantt, loadVersionGantt]);
-
- const handleCloseDialogDoc = () => {
- setOpenDialogDoc(false);
- setidTask(0);
- };
-
- const handleCloseDialogAsignHr = () => {
- setidTask(0);
- setOpenDialogAsignHR(false);
- };
-
- const handleCloseDialogAssignK3 = (status) => {
- if (status == "success") {
- NotificationManager.success(
- `Assign K3 to Project berhasil disimpan!`,
- "Success!!"
- );
- } else if (status == "failed") {
- NotificationManager.error(
- `Assign K3 to Project gagal disimpan!`,
- "Failed!!"
- );
- }
- setidTask(0);
- setOpenDialogAssignK3(false);
- };
-
- const RenderDialogForm = useMemo(
- () => (
-
toggleAddDialog}
- idTask={idTask}
- dataTypeProyek={dataTypeProyek}
- dataPhaseProject={dataPhaseProject}
- dataPM={dataPm}
- />
- ),
- [openDialog]
- );
-
- const RenderDialogFormProyek = useMemo(
- () => (
- toggleAddDialogProyek}
- idTask={idTask}
- dataTypeProyek={dataTypeProyek}
- dataPhaseProject={dataPhaseProject}
- dataDivisions={dataDivisions}
- dataPM={dataPm}
- />
- ),
- [openDialogProyek, dataPm, dataDivisions, dataPhaseProject, dataTypeProyek, idTask]
- );
-
- const RenderDialogFormMaterial = useMemo(
- () => (
- setOpenDialogMaterial(false)}
- toggleDialog={() => setOpenDialogMaterial(!openDialogMaterial)}
- idTask={idTask}
- userProyek={userProyek}
- materialProyek={materialProyek}
- materialResource={materialResource}
- proyekName={proyekName}
- />
- ),
- [openDialogMaterial, proyekName, materialResource, materialProyek, userProyek, idTask]
- );
-
- const RenderDialogTableTools = useMemo(
- () => (
- setOpenDialogTools(false)}
- toggleDialog={() => setOpenDialogTools(!openDialogTools)}
- idTask={idTask}
- toolsResource={toolsResource}
- userProyek={userProyek}
- proyekName={proyekName}
- />
- ),
- [openDialogTools, proyekName, userProyek, toolsResource, idTask]
- );
-
- // DialogAsignHr
- const RenderDialogAsignHr = useMemo(
- () => (
- setOpenDialogAsignHR(false)}
- toggleDialog={() => setOpenDialogAsignHR(!openDialogAsignHR)}
- handleClose={handleCloseDialogAsignHr}
- idTask={idTask}
- proyekName={proyekName}
- />
- ),
- [openDialogAsignHR]
- );
-
- // DialogAssignK3
- const RenderDialogAssignK3 = useMemo(
- () => (
- {
- if (openDialogAssignK3) {
- setidTask(0);
- }
- setOpenDialogAssignK3(!openDialogAssignK3);
- }}
- idTask={idTask}
- proyekName={proyekName}
- dataK3={dataK3}
- />
- ),
- [openDialogAssignK3, dataK3]
- );
-
- const RenderDialogDoc = useMemo(
- () => (
- setOpenDialogDoc(false)}
- toggleDialog={() => setOpenDialogDoc(!openDialogDoc)}
- handleClose={handleCloseDialogDoc}
- idTask={idTask}
- proyekName={proyekName}
- />
- ),
- [openDialogDoc]
- );
-
- const ViewProyek = useMemo(
- () => (
-
- ),
- [openDialogViewDetail]
- );
-
- const renderDialogGantt = useMemo(
- () => (
-
- ),
- [openDialogGantt]
- );
-
- const renderDialogHierarchy = useMemo(
- () => (
-
- ),
- [openDialogHierarchy]
- );
-
- return (
-
-
-
cancelDelete()}
- focusCancelBtn
- >
- Delete this data
-
- {ViewProyek}
- {RenderDialogForm}
- {RenderDialogFormProyek}
- {RenderDialogFormMaterial}
- {RenderDialogTableTools}
- {RenderDialogDoc}
- {renderDialogGantt}
- {renderDialogHierarchy}
- {RenderDialogAsignHr}
- {RenderDialogAssignK3}
-
-
- Project Information
-
-
-
-
-
- {
- role_id == "44" // role kustomer
- ?
- null
- :
-
-
-
- }
-
- Close}
- title="Export"
- trigger="click"
- placement="leftBottom"
- content={
- <>
- }
- type="link"
- block
- onClick={() => handleExportExcel()}
- >
- Export to Excel
-
-
- }
- type="link"
- block
- onClick={() => handleExportPdf()}
- >
- Export to PDF
-
- >
- }
- // visible={visible}
- // onVisibleChange={handleVisibleChange}
- >
-
-
-
-
-
-
-
-
- {RenderTable}
-
-
-
-
-
-
- );
+ ) : (
+ handleOpenDialogGantt(text)}
+ >
+
+
+
+ More Gantt Menu ...
+
+ )}
+
+ );
+ };
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+ {
+ title: "Action",
+ dataIndex: "",
+ key: "x",
+ render: (text, record) =>
+ role_id == "44" ? (
+ <>
+
+
+
+ >
+ ) : (
+ <>
+
+
+
+
+ {text.type_proyek_id == 9 ? (
+
+ ) : (
+
+ )}
+
+ >
+ ),
+ },
+ { title: "Project Name", dataIndex: "nama", key: "nama" },
+ {
+ title: "Budget",
+ dataIndex: "rencana_biaya",
+ key: "rencana_biaya",
+ // render: (text, record) => { return renderFormatRupiah(text, "Rp") }
+ render: (text, record) => {
+ return record.currency_symbol
+ ? `${record.currency_symbol} ${formatThousand(text)}`
+ : `${formatThousand(text)}`;
+ },
+ },
+ {
+ title: "Project Type",
+ dataIndex: "color_progress",
+ key: "color_progress",
+ render: (text, record) => (
+ <>{record.join_second_name ? record.join_second_name : "-"}>
+ ),
+ },
+ {
+ title: "PM",
+ dataIndex: "pic",
+ key: "pic",
+ render: (text, record) => (
+ <>{record.join_first_name ? record.join_first_name : "-"}>
+ ),
+ },
+ {
+ title: "Time Project",
+ dataIndex: "akhir_proyek",
+ key: "akhir_proyek",
+ render: (text, record) => (
+ <>
+ {moment(record.mulai_proyek).format(format)} -{" "}
+ {moment(record.akhir_proyek).format(format)}
+ >
+ ),
+ },
+ ];
+
+ return (
+
+ );
+ }, [dataTable, dataVersionGantt, loadVersionGantt]);
+
+ const handleCloseDialogDoc = () => {
+ setOpenDialogDoc(false);
+ setidTask(0);
+ };
+
+ const handleCloseDialogAsignHr = () => {
+ setidTask(0);
+ setOpenDialogAsignHR(false);
+ };
+
+ const handleCloseDialogAsignCust = () => {
+ setidTask(0);
+ setOpenDialogAsignCust(false);
+ };
+
+ const handleCloseDialogAssignK3 = (status) => {
+ if (status == "success") {
+ NotificationManager.success(
+ `Assign K3 to Project berhasil disimpan!`,
+ "Success!!"
+ );
+ } else if (status == "failed") {
+ NotificationManager.error(
+ `Assign K3 to Project gagal disimpan!`,
+ "Failed!!"
+ );
+ }
+ setidTask(0);
+ setOpenDialogAssignK3(false);
+ };
+
+ const RenderDialogForm = useMemo(
+ () => (
+
toggleAddDialog}
+ idTask={idTask}
+ dataTypeProyek={dataTypeProyek}
+ dataPhaseProject={dataPhaseProject}
+ dataPM={dataPm}
+ />
+ ),
+ [openDialog]
+ );
+
+ const RenderDialogFormProyek = useMemo(
+ () => (
+ toggleAddDialogProyek}
+ idTask={idTask}
+ dataTypeProyek={dataTypeProyek}
+ dataPhaseProject={dataPhaseProject}
+ dataDivisions={dataDivisions}
+ dataPM={dataPm}
+ />
+ ),
+ [
+ openDialogProyek,
+ dataPm,
+ dataDivisions,
+ dataPhaseProject,
+ dataTypeProyek,
+ idTask,
+ ]
+ );
+
+ const RenderDialogFormMaterial = useMemo(
+ () => (
+ setOpenDialogMaterial(false)}
+ toggleDialog={() => setOpenDialogMaterial(!openDialogMaterial)}
+ idTask={idTask}
+ userProyek={userProyek}
+ materialProyek={materialProyek}
+ materialResource={materialResource}
+ proyekName={proyekName}
+ />
+ ),
+ [
+ openDialogMaterial,
+ proyekName,
+ materialResource,
+ materialProyek,
+ userProyek,
+ idTask,
+ ]
+ );
+
+ const RenderDialogTableTools = useMemo(
+ () => (
+ setOpenDialogTools(false)}
+ toggleDialog={() => setOpenDialogTools(!openDialogTools)}
+ idTask={idTask}
+ toolsResource={toolsResource}
+ userProyek={userProyek}
+ proyekName={proyekName}
+ />
+ ),
+ [openDialogTools, proyekName, userProyek, toolsResource, idTask]
+ );
+
+ // DialogAsignHr
+ const RenderDialogAsignHr = useMemo(
+ () => (
+ setOpenDialogAsignHR(false)}
+ toggleDialog={() => setOpenDialogAsignHR(!openDialogAsignHR)}
+ handleClose={handleCloseDialogAsignHr}
+ idTask={idTask}
+ proyekName={proyekName}
+ />
+ ),
+ [openDialogAsignHR]
+ );
+
+ // DialogAsignCust
+ const RenderDialogAsignCust = useMemo(
+ () => (
+ setOpenDialogAsignCust(false)}
+ toggleDialog={() => setOpenDialogAsignCust(!openDialogAsignCust)}
+ handleClose={handleCloseDialogAsignCust}
+ idTask={idTask}
+ proyekName={proyekName}
+ />
+ ),
+ [openDialogAsignCust]
+ );
+
+ // DialogAssignK3
+ const RenderDialogAssignK3 = useMemo(
+ () => (
+ {
+ if (openDialogAssignK3) {
+ setidTask(0);
+ }
+ setOpenDialogAssignK3(!openDialogAssignK3);
+ }}
+ idTask={idTask}
+ proyekName={proyekName}
+ dataK3={dataK3}
+ />
+ ),
+ [openDialogAssignK3, dataK3]
+ );
+
+ const RenderDialogDoc = useMemo(
+ () => (
+ setOpenDialogDoc(false)}
+ toggleDialog={() => setOpenDialogDoc(!openDialogDoc)}
+ handleClose={handleCloseDialogDoc}
+ idTask={idTask}
+ proyekName={proyekName}
+ />
+ ),
+ [openDialogDoc]
+ );
+
+ const ViewProyek = useMemo(
+ () => (
+
+ ),
+ [openDialogViewDetail]
+ );
+
+ const renderDialogGantt = useMemo(
+ () => (
+
+ ),
+ [openDialogGantt]
+ );
+
+ const renderDialogHierarchy = useMemo(
+ () => (
+
+ ),
+ [openDialogHierarchy]
+ );
+
+ return (
+
+
+
cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+ {ViewProyek}
+ {RenderDialogForm}
+ {RenderDialogFormProyek}
+ {RenderDialogFormMaterial}
+ {RenderDialogTableTools}
+ {RenderDialogDoc}
+ {renderDialogGantt}
+ {renderDialogHierarchy}
+ {RenderDialogAsignHr}
+ {RenderDialogAsignCust}
+ {RenderDialogAssignK3}
+
+
+ Project Information
+
+
+
+
+
+ {role_id == "44" ? null : ( // role kustomer
+
+
+
+ )}
+
+ Close}
+ title="Export"
+ trigger="click"
+ placement="leftBottom"
+ content={
+ <>
+ }
+ type="link"
+ block
+ onClick={() => handleExportExcel()}
+ >
+ Export to Excel
+
+
+ }
+ type="link"
+ block
+ onClick={() => handleExportPdf()}
+ >
+ Export to PDF
+
+ >
+ }
+ // visible={visible}
+ // onVisibleChange={handleVisibleChange}
+ >
+
+
+
+
+
+
+
+
+ {RenderTable}
+
+
+
+
+
+
+ );
};
export default CreatedProyek;
diff --git a/src/views/SimproV2/Gantt/index.js b/src/views/SimproV2/Gantt/index.js
index c491af4..c1c2dda 100644
--- a/src/views/SimproV2/Gantt/index.js
+++ b/src/views/SimproV2/Gantt/index.js
@@ -1,103 +1,114 @@
-import React, { useEffect, useMemo, useState } from 'react';
-import Timeline from 'react-calendar-timeline'
-import 'react-calendar-timeline/lib/Timeline.css'
-import { USER_VERSION_GANTT_SEARCH, BASE_SIMPRO_LUMEN, BASE_URL_GANTT } from '../../../const/ApiConst';
-import axios from "../../../const/interceptorApi"
-import { Fab, Action } from 'react-tiny-fab';
-import 'react-tiny-fab/dist/styles.css';
-import { useHistory } from "react-router-dom";
-import GanttFrame from './GanttFrame';
-const token = localStorage.getItem("token")
-const userId = parseInt(localStorage.getItem("user_id"));
-const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
-}
-
-let roCount = 0;
-
-const Gantt = (props) => {
- const versionGanttId = props.match.params ? props.match.params.id : 0;
- const idProject = props.match.params.project ? props.match.params.project : 0;
- const timestamp = props.match.params.timestamp ? props.match.params.timestamp : 0;
-
- const [ro, setRo] = useState(1)
- const [listUserGant, setListUserGantt] = useState([])
- const [ready, setReady] = useState(false)
- let history = useHistory();
-
- useEffect(() => {
- document.getElementsByClassName("breadcrumb-item active").innerHTML = "Gantt Project";
- getDataUserGantt();
- }, []);
-
- useEffect(() => {
- cekPermission();
- }, [listUserGant])
-
- useEffect(() => {
- }, [ro])
-
- const getDataUserGantt = async () => {
- const payload = {
- "columns": [
- { "name": "version_gantt_id", "logic_operator": "=", "value": versionGanttId, "operator": "AND" }
- ]
- }
- const result = await axios
- .post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.status == 200) {
- setUserGantt(result.data.data);
- } else {
- cekPermission()
- }
- }
-
- const setUserGantt = (data) => {
- let newTargetKeys = []
- data.map((val, index) => {
- newTargetKeys.push(val.user_id)
- });
- setListUserGantt(newTargetKeys)
- }
-
- const handleRedirect = () => {
- history.push("/dashboard-project/"+idProject+"/"+versionGanttId);
- }
-
- const cekPermission = () => {
- let check = listUserGant.includes(userId)
- if (check) {
- setRo(0)
- } else {
- setRo(1)
- }
- if (roCount >= 1) {
- setReady(true)
- }
- roCount = roCount + 1;
- }
-
- return (
- <>
-
- {ready && (
-
- )}
-
- >
- );
-}
-
-export default Gantt;
+import React, { useEffect, useMemo, useState } from "react";
+import Timeline from "react-calendar-timeline";
+import "react-calendar-timeline/lib/Timeline.css";
+import {
+ USER_VERSION_GANTT_SEARCH,
+ BASE_SIMPRO_LUMEN,
+ BASE_URL_GANTT,
+} from "../../../const/ApiConst";
+import axios from "../../../const/interceptorApi";
+import { Fab, Action } from "react-tiny-fab";
+import "react-tiny-fab/dist/styles.css";
+import { useHistory } from "react-router-dom";
+import GanttFrame from "./GanttFrame";
+const token = localStorage.getItem("token");
+const userId = parseInt(localStorage.getItem("user_id"));
+const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${token}`,
+ },
+};
+
+let roCount = 0;
+
+const Gantt = (props) => {
+ const versionGanttId = props.match.params ? props.match.params.id : 0;
+ const idProject = props.match.params.project ? props.match.params.project : 0;
+ const timestamp = props.match.params.timestamp
+ ? props.match.params.timestamp
+ : 0;
+
+ const [ro, setRo] = useState(1);
+ const [listUserGant, setListUserGantt] = useState([]);
+ const [ready, setReady] = useState(false);
+ let history = useHistory();
+
+ useEffect(() => {
+ document.getElementsByClassName("breadcrumb-item active").innerHTML =
+ "Gantt Project";
+ getDataUserGantt();
+ }, []);
+
+ useEffect(() => {
+ cekPermission();
+ }, [listUserGant]);
+
+ useEffect(() => {}, [ro]);
+
+ const getDataUserGantt = async () => {
+ const payload = {
+ columns: [
+ {
+ name: "version_gantt_id",
+ logic_operator: "=",
+ value: versionGanttId,
+ operator: "AND",
+ },
+ ],
+ };
+ const result = await axios
+ .post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
+ .then((res) => res)
+ .catch((error) => error.response);
+
+ if (result && result.status == 200) {
+ setUserGantt(result.data.data);
+ } else {
+ cekPermission();
+ }
+ };
+
+ const setUserGantt = (data) => {
+ let newTargetKeys = [];
+ data.map((val, index) => {
+ newTargetKeys.push(val.user_id);
+ });
+ setListUserGantt(newTargetKeys);
+ };
+
+ const handleRedirect = () => {
+ history.push("/dashboard-project/" + idProject + "/" + versionGanttId);
+ };
+
+ const cekPermission = () => {
+ let check = listUserGant.includes(userId);
+ if (check) {
+ setRo(0);
+ } else {
+ setRo(1);
+ }
+ if (roCount >= 1) {
+ setReady(true);
+ }
+ roCount = roCount + 1;
+ };
+
+ return (
+ <>
+
+ {ready && (
+
+ )}
+
+ >
+ );
+};
+
+export default Gantt;