|
|
|
@ -15,7 +15,7 @@ import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
|
|
|
|
|
import { ToastContainer, toast } from "react-toastify"; |
|
|
|
|
import "react-toastify/dist/ReactToastify.css"; |
|
|
|
|
import './MapMonitoring.css'; |
|
|
|
|
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst'; |
|
|
|
|
import { BASE_SIMPRO_LUMEN_IMAGE, PROYEK_SEARCH } 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'; |
|
|
|
@ -26,9 +26,28 @@ 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'; |
|
|
|
|
import axios from "../../const/interceptorApi"; |
|
|
|
|
const MapMonitoring = ({ ...props }) => { |
|
|
|
|
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = ''; |
|
|
|
|
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { |
|
|
|
|
role_id = props.location.state.role_id; |
|
|
|
|
user_id = props.location.state.user_id; |
|
|
|
|
token = props.location.state.token; |
|
|
|
|
isLogin = props.location.state.isLogin; |
|
|
|
|
|
|
|
|
|
const MapMonitoring = () => { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
role_id = localStorage.getItem("role_id"); |
|
|
|
|
proyek_id = localStorage.getItem("proyek_id"); |
|
|
|
|
user_id = localStorage.getItem("user_id"); |
|
|
|
|
token = localStorage.getItem("token"); |
|
|
|
|
isLogin = localStorage.getItem("isLogin"); |
|
|
|
|
} |
|
|
|
|
const HEADER = { |
|
|
|
|
headers: { |
|
|
|
|
"Content-Type": "application/json", |
|
|
|
|
Authorization: `Bearer ${token}`, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
const GRID_LEFT = 6; |
|
|
|
|
const GRID_MIDDLE = 12; |
|
|
|
|
const GRID_RIGHT = 6; |
|
|
|
@ -155,9 +174,11 @@ const MapMonitoring = () => {
|
|
|
|
|
// init for left content panel, get projects and build tree select antd
|
|
|
|
|
const getMapLeftContent = async () => { |
|
|
|
|
store.dispatch(setMapLoading(true)); |
|
|
|
|
let project = await ApiProject.list(); |
|
|
|
|
// console.log('project', project);
|
|
|
|
|
if (project && project.status && project.data && project.data.length > 0) { |
|
|
|
|
|
|
|
|
|
let project = await ApiProject.search(role_id); |
|
|
|
|
// console.log('projectsearch', projectsearch.data.data);
|
|
|
|
|
console.log('project', project); |
|
|
|
|
if (project && project.data && project.data.length > 0) { |
|
|
|
|
let projectData = [ |
|
|
|
|
{ |
|
|
|
|
"title": 'All', |
|
|
|
|