const API_ENDPOINT = "https://141.ir/api";
const MAP_ENDPOINT = "https://rmsmap.rmto.ir";
const MAP_MIN_ZOOM = 5;
const MAP_MAX_ZOOM = 10;
const API_TEST = "https://rms.rmto.ir";
var globalqueryparam = "";
var frommDate, toDate;
var mapradar = null;
var WindowWidth = null;
var marker141Layers = null;
var markersproject = null;
var markerLayers1 = null;
var markerLayers2 = null;
var markerLayers3 = null;
var markerLayers4 = null;
var markerLayers5 = null;
var marker141List = [];
var projectbamamap = [];
var rookeshbama = [];
var hadesemap = [];
var erteghamap = [];
var abniemap = [];
var rahdarmap = [];
var sharyanimap = [];
var aslimap = [];
var faryimap = [];
var roostayimap = [];
var darhaltajhiz = [];
var dardastmonaghsese = [];
var updateroostayi = [];
var motale = [];
var ejrafal = [];
var ejramotevaghef = [];
var updatefirst = [];
var efteteha = [];
var year1395 = [];
var secondyear = [];
var thirsyear = [];
var fourthyear = [];
var fifthyear = [];
var globalcolor = "";
var routeControls = [];
var routecolor = [];
var routeControlsPath = [];
var isSetEndAbrarMarker = false;
var isSetStartAbrarMarker = false;
var marker141LayersWithoutCluster = null;
var itempoint = null;
var provincesArray;
var citiesArray;
var iranGeoJSON;
var iranMapGeo;
var iranArrayCount = 0;
var iranCityCount = 0;
var keepMapFeatureColor = null;
var fullCityGeoJSONTemp = new Object();
var fullCityGeoJSON = null;
var iranCityMapGeo;
var flagProvince = 0;
var flagCity = 0;
var HopeData;
var statusSet;
var markerlis1 = [];
var markerlis2 = [];
var markerlis3 = [];
var markerlis4 = [];
var markerlis5 = [];
var markerlis6 = [];
var markerlis7 = [];
var markerlis8 = [];
var markerrashtnew = [];
var markerlisfirooz = [];
var markerlistamo = [];
var markerlist;
var markerchaloos = [];
var markersemnan = [];
var markertabriz = [];
var markerkermanshah = [];
var firoozlayer = [];
var amollayer = [];
var rashtlayer = [];
var markerfiroozkooh = [];
var markeramol = [];
var markerrasht = [];
var newrashtlayer = [];
var chalooslayer = [];
var semnanlayer = [];
var tabrizlayer = [];
var kermanlayer = [];
var ekipmarker = null;
var issetekipmarker = false;
var endAbrarMarker = null;
var isSetEndAbrarMarker = false;
var smarkerGhRa;
var emarkerGhRa;
var smarkerKarCh;
var emarkerKarCh;
var smarkerThSe;
var emarkerThSe;
var smarkerThKer;
var emarkerThKer;
var smarkerfirooz;
var emarkerfirooz;
var smarkertabriz;
var emarkertabriz;
var tabrizpoly = null;
var machinarydatavalid = "";
var ekiplistvalid = "";
var smarkerrasht;
var emarkerrasht;
var rashtpoly = null;
var startmarkerpin = [];
var endmarkerpin = [];
var project_update_list = [];
var projectarraymachine = [];
var ekiplist = [];
var smarkeramol;
var emarkeramol;
var amolpoly = null;
var firstpolyline = null;
var firoozpoly = null;
var forthpolyline = null;
var fifthpolyline = null;
var seventhpolyline = null;
var startAbrarMarker = null;
var isSetStartAbrarMarker = false;
var routeControls = [];
var routecolor = [];
var routeControlsPath = [];
var routingArray = [];
var showfastreactionmarker = [];
var slideIndexlayer = 1;
var ppList = [];
var ptList = [];
var atList = [];
var psList = [];
var pyList = [];
var priority = [];
var followup = [];
var list_sub;
var pprahdar = [];
var statusrahdar = [];
var typerahdar = [];
var pointrahdar = -1;
var ppfast = [];
var ppsafety = [];
var featurefast = [];
var activityfast = [];
//coridor line
var selectedCoridor = 0;
var selectedCoridorArr = [];
var poly_1 = null;
var poly_2 = null;
var poly_3 = null;
var poly_4 = null;
var poly_5 = null;
var poly_6 = null;
var poly_7 = null;
var poly_8 = null;
var layer_1 = [];
var layer_2 = [];
var layer_3 = [];
var layer_4 = [];
var layer_5 = [];
var layer_6 = [];
var layer_7 = [];
var layer_8 = [];
var marker_1 = [];
var marker_2 = [];
var marker_3 = [];
var marker_4 = [];
var marker_5 = [];
var marker_6 = [];
var marker_7 = [];
var marker_8 = [];
var marker_1_list = [];
var marker_2_list = [];
var marker_3_list = [];
var marker_4_list = [];
var marker_5_list = [];
var marker_6_list = [];
var marker_7_list = [];
var marker_8_list = [];
var coridorMarkerArray = [];
var coridorArray = [];
var ajaxCheck = false;
var querylength = 0;
var queryparams = "";
var urlParams;
var currentFilterQueryfrom;
var currentFilterQueryto;
(() => {
const heightHeader = $('.header').height()
document.getElementById('map').style.setProperty('height', `calc(100vh - ${heightHeader}px)`)
})()
UncheckAll();
var toDatefast, frommDatefast, toDatesafety, frommDatesafety;
var startAbrarDivIcon = L.divIcon({
html: `
`,
iconSize: [55, 75],
iconAnchor: [33, 64],
});
var endAbrarDivIcon = L.divIcon({
html: `
`,
iconSize: [55, 75],
iconAnchor: [33, 64],
});
var startAbrarDivIconrahdar = L.divIcon({
html: `
`,
iconSize: [55, 75],
iconAnchor: [33, 64],
});
var endAbrarDivIconrahdar = L.divIcon({
html: `
`,
iconSize: [55, 75],
iconAnchor: [33, 64],
});
frommDatefast = $("#fastreact-fromdate").persianDatepicker({
observer: true,
format: "YYYY/MM/DD",
altField: ".observer-example-alt",
autoClose: true,
onSelect: function (unix) {
frommDatefast.touched = true;
$("#fastreact-todate").prop("disabled", "");
if (
frommDatefast.getState().selected.unixDate >=
toDatefast.getState().selected.unixDate
) {
toDatefast.setDate(frommDatefast.getState().selected.unixDate);
}
if (
toDatefast &&
toDatefast.options &&
toDatefast.options.minDate != unix
) {
let cachedValue = toDatefast.getState().selected.unixDate;
toDatefast.options = { minDate: unix };
if (toDatefast.touched) {
toDatefast.setDate(cachedValue);
}
}
},
});
toDatefast = $("#fastreact-todate").persianDatepicker({
format: "YYYY/MM/DD",
autoClose: true,
format: "YYYY/MM/DD",
autoClose: true,
onSelect: function (unix) {
toDatefast.touched = true;
},
});
frommDatesafety = $("#safety-fromdate").persianDatepicker({
observer: true,
format: "YYYY/MM/DD",
altField: ".observer-example-alt",
autoClose: true,
onSelect: function (unix) {
frommDatesafety.touched = true;
$("#safety-todate").prop("disabled", "");
if (
frommDatesafety.getState().selected.unixDate >=
toDatesafety.getState().selected.unixDate
) {
toDatesafety.setDate(frommDatesafety.getState().selected.unixDate);
}
if (
toDatesafety &&
toDatesafety.options &&
toDatesafety.options.minDate != unix
) {
let cachedValue = toDatesafety.getState().selected.unixDate;
toDatesafety.options = { minDate: unix };
if (toDatesafety.touched) {
toDatesafety.setDate(cachedValue);
}
}
},
});
toDatesafety = $("#safety-todate").persianDatepicker({
format: "YYYY/MM/DD",
autoClose: true,
format: "YYYY/MM/DD",
autoClose: true,
onSelect: function (unix) {
toDatesafety.touched = true;
},
});
function drawStartToEndPath(pathType, source, dest, pathColor) {
if (routeControlsPath.length) {
$(routeControlsPath).each(function (index, control) {
map.removeControl(control);
routeControlsPath.splice(routeControlsPath.indexOf(index), 1);
});
}
if (polylinePath != null) {
map.removeLayer(polylinePath);
}
switch (pathType) {
case "line": {
polylinePath = L.polyline(
[
[source[0], source[1]],
[dest[0], dest[1]],
],
{
color: pathColor,
opacity: 0.8,
weight: 3,
}
).addTo(map);
break;
}
case "axis": {
$.get(
`https://rmsmap.rmto.ir/route/v1/driving/${source[1]},${source[0]};${dest[1]},${dest[0]}?overview=full&alternatives=false`,
function (data) {
alert("ppp");
routeControlsPath.push(
L.Routing.control({
waypoints: [
L.latLng(parseFloat(source[0]), parseFloat(source[1])),
L.latLng(parseFloat(dest[0]), parseFloat(dest[1])),
],
fitSelectedRoutes: false,
draggableWaypoints: true,
createMarker: function () {
return null;
},
lineOptions: {
addWaypoints: false,
styles: [
{
color: pathColor,
opacity: 0.8,
weight: 3,
},
],
},
})
.on("routesfound", function (e) {
for (let index = 0; index < popupArraysPath.length; index++) {
if (popupArraysPath[index] !== null) {
map.removeLayer(popupArraysPath[index]);
}
}
})
.addTo(map)
);
}
);
$(".leaflet-control-container").css("display", "none");
$(".leaflet-routing-container-hide").css("display", "none");
break;
}
}
}
function calculateRouteCoridor(first, last, num) {
let routeArray = [];
let result = new Promise(function (resolve, reject) {
if (num == 0) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.4013785,35.7006177;52.8579311,36.4636399?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
}
if (num == 1) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.4013785,35.7006177;52.3499009,36.4718947?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
}
if (num == 2) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/49.5846102,37.2793607;49.589109420776374,37.01365617294853;49.39663410186768,36.76501688279228;49.41307067871094,36.71865951515749;49.53460693359376,36.618903290216785;49.59546089172364,36.3709172544364;49.81874942779541,36.31037025501364;50.006663,36.2804074?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
}
if (num == 3) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/50.006663,36.2804074;49.5846102,37.2793607?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
} else if (num == 4) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.0073853,35.8121955;51.4222349,36.6506071?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
} else if (num == 5) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.4013785,35.7006177;53.3882906,35.5834074?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
} else if (num == 6) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.4013785,35.7006177;46.2961952,38.0739964?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
} else if (num == 7) {
$.get(
"https://rmsmap.rmto.ir/route/v1/driving/51.4013785,35.7006177;50.21301269531251,35.00862766620555;49.531173706054695,35.12440157992044;48.740158081054695,35.09463077862675;47.0735891,34.3239414?overview=full&alternatives=true&steps=true",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
} else {
$.get(
"https://rmsmap.rmto.ir" +
"/route/v1/driving/" +
first[1] +
"," +
first[0] +
";" +
last[1] +
"," +
last[0] +
"?overview=full&alternatives=false",
function (data) {
resolve(decode(data.routes[0].geometry, 6));
}
);
}
});
result.then((response) => {
routeArray = response;
showCoridorLayer(routeArray, num);
console.log(routeArray);
if (num == 0) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
firoozpoly = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
firoozpoly.addTo(map);
}
if (num == 1) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
amolpoly = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
amolpoly.addTo(map);
} else if (num == 2) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
firstpolyline = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
firstpolyline.addTo(map);
} else if (num == 3) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
rashtpoly = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
rashtpoly.addTo(map);
} else if (num == 4) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
forthpolyline = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
forthpolyline.addTo(map);
} else if (num == 5) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
fifthpolyline = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
fifthpolyline.addTo(map);
} else if (num == 6) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
tabrizpoly = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
tabrizpoly.addTo(map);
} else if (num == 7) {
var myarray = [];
for (i = 0; i < routeArray.length; i++) {
myarray.push(
new L.LatLng(routeArray[i][0] * 10, routeArray[i][1] * 10)
);
}
seventhpolyline = new L.Polyline(myarray, {
color: "blue",
weight: 5,
opacity: 0.5,
smoothFactor: 1,
});
seventhpolyline.addTo(map);
}
});
if (
num != 0 &&
num != 1 &&
num != 2 &&
num != 6 &&
num != 7 &&
num != 5 &&
num != 4 &&
num != 3
) {
routeControls.push(
L.Routing.control({
routeWhileDragging: true,
reverseWaypoints: true,
addWaypoints: false,
waypoints: [L.latLng(first[0], first[1]), L.latLng(last[0], last[1])],
lineOptions: {
styles: [
{
color: "#5789f2",
opacity: 1,
weight: 5,
},
],
},
createMarker: function (i, wp) {
if (i == 0) {
return L.marker(wp.latLng, { icon: startAbrarDivIcon });
} else {
return L.marker(wp.latLng, { icon: endAbrarDivIcon });
}
},
}).addTo(map)
);
} else if (num == 0) {
smarkerfirooz = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerfirooz = L.marker([last[0], last[1]], {
icon: endAbrarDivIcon,
}).addTo(map);
} else if (num == 1) {
smarkeramol = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkeramol = L.marker([last[0], last[1]], { icon: endAbrarDivIcon }).addTo(
map
);
} else if (num == 2) {
smarkerGhRa = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerGhRa = L.marker([last[0], last[1]], { icon: endAbrarDivIcon }).addTo(
map
);
} else if (num == 3) {
smarkerrasht = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerrasht = L.marker([last[0], last[1]], {
icon: endAbrarDivIcon,
}).addTo(map);
} else if (num == 4) {
smarkerKarCh = L.marker([35.8121955, 51.0073853], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerKarCh = L.marker([last[0], last[1]], {
icon: endAbrarDivIcon,
}).addTo(map);
} else if (num == 5) {
smarkerThSe = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerThSe = L.marker([last[0], last[1]], { icon: endAbrarDivIcon }).addTo(
map
);
} else if (num == 6) {
smarkertabriz = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkertabriz = L.marker([last[0], last[1]], {
icon: endAbrarDivIcon,
}).addTo(map);
} else if (num == 7) {
smarkerThKer = L.marker([first[0], first[1]], {
icon: startAbrarDivIcon,
}).addTo(map);
emarkerThKer = L.marker([last[0], last[1]], {
icon: endAbrarDivIcon,
}).addTo(map);
}
for (var i = 0; i < routeControls.length; i++) { }
if ($(".leaflet-routing-container").length) {
$(".leaflet-routing-container").remove();
}
}
function drawPath() {
if (routeControls.length) {
$(routeControls).each(function (index, control) {
mapradar.removeControl(control);
routeControls.splice(routeControls.indexOf(index), 1);
});
}
routeControls.push(
L.Routing.control({
waypoints: [
L.latLng(
parseFloat(startAbrarMarker.getLatLng().lat),
parseFloat(startAbrarMarker.getLatLng().lng)
),
L.latLng(
parseFloat(endAbrarMarker.getLatLng().lat),
parseFloat(endAbrarMarker.getLatLng().lng)
),
],
fitSelectedRoutes: false,
draggableWaypoints: true,
createMarker: function () {
return null;
},
lineOptions: {
addWaypoints: false,
styles: [
{
color: "#28a745",
opacity: 0.8,
weight: 5,
},
],
},
})
.on("routingstart ", function (e) { })
.addTo(mapradar)
);
$(".leaflet-control-container").css("display", "none");
$(".leaflet-routing-container-hide").css("display", "none");
}
var greenIcon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var redIcon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var sBlueIcon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var purpleIcon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var pinkIcon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var greenIconFix = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var yellowicon = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var redIconFix = L.divIcon({
className: "custom-div-icon",
html: " ",
iconSize: [30, 42],
});
var rahdariIconO = L.icon({
iconUrl: "../../dist/images/icons/tollHouseO_pin.png",
iconSize: [12, 12],
});
var rahdariIconY = L.icon({
iconUrl: "../../dist/images/icons/tollHouse_pin.png",
iconSize: [10, 10],
});
var bounds = [
[42.9130026312, 75.6166317076],
[20.5782370061, 30.5092252948],
];
var map = L.map("map", {
maxBounds: bounds,
minZoom: 6,
zoomControl: false,
}).setView([35.5468992, 51.7300532], 7);
L.tileLayer(MAP_ENDPOINT + "/141map/{z}/{x}/{y}.png", {}).addTo(map);
L.PrintPreview().addTo(map);
$(document).ready(function () {
document.location.search.length != 0 ? (querylength = 1) : (querylength = 0);
urlParams = new URLSearchParams(window.location.search);
queryparams = window.location.search;
function onLocationFound(e) {
var radius = e.accuracy / 2;
L.circle(e.latlng, radius).addTo(map);
}
map.locate({ setView: true, maxZoom: 16 });
map.on("locationfound", onLocationFound);
var urlParams = new URLSearchParams(window.location.search);
globalqueryparam = urlParams.get("type");
if (globalqueryparam == "allpoints") {
$(".guid-custom-box-allpoint").css("display", "block");
showallpoint();
} else if (globalqueryparam == "fastreact") {
$(".guid-custom-box-fast").css("display", "block");
$(".filterTitle").on("click", function () {
if ($(this).parent().children(".filterGroup").css("display") == "none") {
$(this).parent().children(".filterGroup").show(1000);
} else {
$(this).parent().children(".filterGroup").hide(1000);
}
});
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces",
type: "GET",
success: function (data) {
var list_rahdar = data.data;
for (let index = 0; index < list_rahdar.length; index++) {
$("#all-pro-fast").append(
"" +
list_rahdar[index].name_fa +
"
"
);
}
showboxfast();
},
});
showfastreaction();
} else if (globalqueryparam == "pro") {
$.ajax({
url: "https://rms.rmto.ir/csi/operation",
type: "GET",
cache: false,
contentType: false,
processData: false,
async: false,
success: function (res) {
operation_res = res;
$.each(operation_res, function (key, value) {
$(".operation_nature").append(
`
${value.farsi}
`
);
});
},
error: function (error) {
hideLoaderScreen();
Swal.fire({
icon: "error",
title: "خطا",
text: "مشکل در در دریافت ماهیت پروژه",
confirmButtonText: "بستن",
});
console.log(error);
},
});
$(".guid-custom-box").css("display", "block");
$(".filterTitle").on("click", function () {
if ($(this).parent().children(".filterGroup").css("display") == "none") {
$(this).parent().children(".filterGroup").show(1000);
} else {
$(this).parent().children(".filterGroup").hide(1000);
}
});
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces",
type: "GET",
success: function (data) {
list_province = data.data;
for (let index = 0; index < list_province.length; index++) {
$("#all-pro-pro").append(
"" +
list_province[index].name_fa +
"
"
);
}
checkboxchecked();
},
});
$(".chBox1").on("change", function () {
showLoaderScreen();
removeProjectLayer();
var test = parseInt(this.id.substr(2));
if (this.checked) {
ptList.push(parseInt(this.id.substr(2)));
} else {
var index = ptList.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
ptList.splice(index, 1);
}
}
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
$(".chBox2").on("change", function () {
showLoaderScreen();
removeProjectLayer();
if (this.checked) {
atList.push(parseInt(parseInt(this.id.substr(2))));
} else {
var index = atList.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
atList.splice(index, 1);
}
}
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
$(".chBox3").on("change", function () {
showLoaderScreen();
removeProjectLayer();
if (this.checked) {
psList.push(parseInt(this.id.substr(2)));
} else {
var index = psList.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
psList.splice(index, 1);
}
}
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
$(".chBox6").on("change", function () {
showLoaderScreen();
removeProjectLayer();
if (this.checked) {
priority.push(parseInt(this.id.substr(2)));
} else {
var index = priority.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
priority.splice(index, 1);
}
}
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
$(".chBox7").on("change", function () {
showLoaderScreen();
removeProjectLayer();
if (this.checked) {
followup.push(parseInt(this.id.substr(2)));
} else {
var index = followup.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
followup.splice(index, 1);
}
}
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
$(".chBox4").on("change", function () {
showLoaderScreen();
removeProjectLayer();
if (this.checked) {
pyList.push(parseInt(this.id.substr(2)));
} else {
var index = pyList.indexOf(parseInt(this.id.substr(2)));
if (index > -1) {
pyList.splice(index, 1);
}
}
var currentDate = {};
currentFilterYear = parseInt(this.id.substr(2));
currentDate.from = moment(currentFilterYear, "jYYYY");
currentFilterQueryfrom = currentDate.from
.locale("en")
.format("YYYY-MM-DD");
currentDate.to = moment(currentFilterYear, "jYYYY");
currentDate.to.add(1, "year");
currentFilterQueryto = currentDate.to.locale("en").format("YYYY-MM-DD");
$.post("https://rms.rmto.ir/api/public/bamamap", {
province: ppList,
project_type: ptList,
axis: atList,
last_status: psList,
from_date: currentFilterQueryfrom,
to_date: currentFilterQueryto,
priority: priority,
followup: followup,
}).done(function (data) {
hideLoaderScreen();
showPointOnMap(data.data);
});
});
} else if (globalqueryparam == "rahdari") {
$(".guid-custom-box").css("display", "none");
$("body").find(".queen-size-nav-rahdari").addClass("stylescroll");
WindowWidth = $(window).width();
$("#select-city").empty();
$("#select-city").append('انتخاب شهرستان ');
$("#province-id").on("change", function () {
init_data_filter();
if ($("#province-id").val() == 0) {
$("#select-city").attr("disabled", true);
} else {
$("#select-city").attr("disabled", false);
}
});
$.ajax({
url: "https://rms.rmto.ir/api/get-items-and-subs",
type: "GET",
success: function (data) {
list_sub = data.data;
},
});
showDailyRahdariActivity();
} else if (globalqueryparam == "251points") {
$(".guid-custom-box-251points").css("display", "block");
showAccident251Points();
} else if (globalqueryparam == "qarargah") {
showgharargah();
} else if (globalqueryparam == "camp") {
showwintercamp();
} else if (globalqueryparam == "campNew") {
$(".guid-custom-boxcamp").css("display", "block");
$(".filterTitle").on("click", function () {
if ($(this).parent().children(".filterGroup").css("display") == "none") {
$(this).parent().children(".filterGroup").show(1000);
} else {
$(this).parent().children(".filterGroup").hide(1000);
}
});
showcamp();
} else if (globalqueryparam == "rahdari") {
WindowWidth = $(window).width();
showDailyRahdariActivity();
} else if (globalqueryparam == "rahdar") {
$(".filterTitle").on("click", function () {
if ($(this).parent().children(".filterGroup").css("display") == "none") {
$(this).parent().children(".filterGroup").show(1000);
} else {
$(this).parent().children(".filterGroup").hide(1000);
}
});
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces",
type: "GET",
success: function (data) {
var list_rahdar = data.data;
for (let index = 0; index < list_rahdar.length; index++) {
$("#all-pro").append(
"" +
list_rahdar[index].name_fa +
"
"
);
}
checkboxshowrahdar();
},
});
showrahdarkhane();
} else if (globalqueryparam == "barkhordari") {
$(".list-province").removeClass("d-none");
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces",
type: "GET",
cache: false,
contentType: false,
processData: false,
success: function (result) {
provincesArray = result.data;
renderprovince(provincesArray);
},
error: function (error) { },
});
$.ajax({
url: "https://141.ir/api/provinces35geojson",
type: "GET",
success: function (response) {
iranGeoJSON = JSON.parse(response);
},
});
$.ajax({
url: "https://141.ir/api/cities430geojson",
type: "GET",
success: function (response) {
fullCityGeoJSON = JSON.parse(response);
},
});
function addCityFeaturesToMap() {
keepMapFeatureColor = null;
if (fullCityGeoJSONTemp) {
iranCityMapGeo = L.geoJson(fullCityGeoJSONTemp, {
style: initStyleCityMapFeatures,
onEachFeature: onEachCityFeature,
});
iranCityMapGeo.addTo(map);
}
}
function getForArrayFeatureColor(arrayNum) {
if (keepMapFeatureColor) {
return { num: -1, color: keepMapFeatureColor };
} else {
return arrayNum >= 83
? { num: arrayNum, color: "#a366ff" }
: arrayNum >= 67
? { num: arrayNum, color: "#80b3ff" }
: arrayNum >= 50
? { num: arrayNum, color: "#66cc66" }
: arrayNum >= 31
? { num: arrayNum, color: "#ffeda0" }
: { num: arrayNum, color: "#ff704d" };
}
}
function fillcolorme(featureRow) {
for (let i = 0; i < provincesArray.length; i++) {
if (i == featureRow) {
return provincesArray[i].abrar_process;
}
}
}
function initStyleMapFeatures() {
let getRandom = null;
getRandom = getForArrayFeatureColor(fillcolorme(iranArrayCount));
let makeStyle = {
fillColor: getRandom.color,
weight: 2,
opacity: 1,
color: "white",
fillOpacity: 0.7,
};
if (getRandom.num != -1) {
if (iranArrayCount == 35) {
iranArrayCount = 0;
}
iranArrayCount++;
}
return makeStyle;
}
function highlightMapFeature(e) {
let targetAtt = e.target.feature.properties;
let featureLayer = null;
if (e.target) {
featureLayer = e.target;
} else {
featureLayer = e;
}
keepMapFeatureColor = featureLayer.options.fillColor;
featureLayer.setStyle({
weight: 4,
color: "#666",
fillOpacity: 0.85,
});
if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
featureLayer.bringToFront();
}
if (e.target) {
if (flagProvince == 0) {
let popup = L.popup();
for (let i = 0; i < provincesArray.length; i++) {
if (targetAtt.province_id == provincesArray[i].id) {
popup
.setLatLng([
provincesArray[i].center_lat,
provincesArray[i].center_long,
])
.setContent(
`
`
)
.openOn(map);
}
}
$(`#target${targetAtt.province_id}`)
.css("transform", "scale(1.1)")
.animate({
marginTop: "10px",
marginBottom: "10px",
});
$("html .list-province")
.stop()
.animate({
scrollTop:
$(`#target${targetAtt.province_id}`).offset().top - 380.59,
});
}
}
if (targetAtt.city_id) {
if (flagCity == 0) {
let popup = L.popup();
for (let i = 0; i < citiesArray.length; i++) {
if (targetAtt.city_id == citiesArray[i].id) {
popup
.setLatLng(e.latlng)
.setContent(
`
`
)
.openOn(map);
}
}
}
$(`#target${targetAtt.city_id}`)
.css("transform", "scale(1.1)")
.animate({
marginTop: "10px",
marginBottom: "10px",
});
$("html .list-province")
.stop()
.animate({
scrollTop: $(`#target${targetAtt.city_id}`).offset().top - 380.59,
});
}
}
function resetMapFeatureHighlight(e) {
let targetAtt = e.target.feature.properties;
let featureLayer = null;
if (e.target) {
featureLayer = e.target;
} else {
featureLayer = e;
}
iranMapGeo.resetStyle(featureLayer);
keepMapFeatureColor = null;
$(`#target${targetAtt.province_id}`).css("transform", "").animate({
marginTop: "",
marginBottom: "",
});
$(`#target${targetAtt.city_id}`).css("transform", "").animate({
marginTop: "",
marginBottom: "",
});
$("html .list-province").stop().animate({
scrollTop: 0,
});
}
function zoomMapToFeature(e) {
if ($(".backStack").has("d-none")) {
$(".backStack")
.removeClass("d-none")
.addClass("animate__animated animate__backInLeft");
} else {
$(".backStack")
.addClass("d-none")
.removeClass("animate__animated animate__backInLeft");
}
let IdProvince = e.target.feature.properties.province_id;
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces/" + IdProvince,
type: "GET",
cache: false,
contentType: false,
processData: false,
success: function (result) {
citiesArray = result.data;
},
error: function (error) { },
});
let featureLayer = null;
let featuresLayerCity = [];
if (e.target) {
featureLayer = e.target;
} else {
featureLayer = e;
}
map.flyToBounds(featureLayer.getBounds());
showLoaderScreen();
removeFeaturesFromMap();
fullCityGeoJSONTemp.type = "FeatureCollection";
$.each(fullCityGeoJSON.features, function (key, value) {
if (
value &&
featureLayer.feature.properties.province_id ===
value.properties.province_id
) {
featuresLayerCity.push(value);
} else {
}
});
setTimeout(function () {
fullCityGeoJSONTemp.features = featuresLayerCity;
for (let i = 0; i < fullCityGeoJSONTemp.features.length; i++) {
for (let j = 0; j < citiesArray.length; j++) {
if (
fullCityGeoJSONTemp.features[i].properties.city_id ==
citiesArray[j].id
) {
fullCityGeoJSONTemp.features[i].properties["abrar_process"] =
citiesArray[j].abrar_process;
}
}
}
statusSet = true;
renderprovince(fullCityGeoJSONTemp.features, statusSet);
addCityFeaturesToMap();
}, 1000);
setTimeout(function () {
hideLoaderScreen();
}, 1500);
flagProvince = 1;
iranCityCount = 0;
}
$(".backStack").on("click", function () {
removeFeaturesCity();
});
function onEachFeature(feature, featureLayer) {
featureLayer.on({
mouseover: highlightMapFeature,
mouseout: resetMapFeatureHighlight,
click: zoomMapToFeature,
});
}
function onEachCityFeature(feature, featureLayer) {
featureLayer.on({
mouseover: highlightMapFeature,
mouseout: resetMapFeatureHighlight,
});
}
function getRandomFeatureColor(arrayNum) {
if (keepMapFeatureColor) {
return { num: -1, color: keepMapFeatureColor };
} else {
return arrayNum.abrar_process >= 83
? { num: arrayNum, color: "#a366ff" }
: arrayNum.abrar_process >= 67
? { num: arrayNum, color: "#80b3ff" }
: arrayNum.abrar_process >= 50
? { num: arrayNum, color: "#66cc66" }
: arrayNum.abrar_process >= 31
? { num: arrayNum, color: "#ffeda0" }
: { num: arrayNum, color: "#ff704d" };
}
}
function fillcolorCity(featureRow) {
for (let i = 0; i < fullCityGeoJSONTemp.features.length; i++) {
if (i == featureRow) {
return fullCityGeoJSONTemp.features[i].properties;
}
}
}
function initStyleCityMapFeatures(feature) {
let getRandom = getRandomFeatureColor(fillcolorCity(iranCityCount));
let makeStyle = {
fillColor: getRandom.color,
weight: 2,
opacity: 1,
color: "white",
fillOpacity: 0.5,
};
if (iranCityCount == fullCityGeoJSONTemp.features.length) {
iranCityCount = 0;
}
iranCityCount++;
return makeStyle;
}
function removeFeaturesFromMap() {
if (iranMapGeo) {
map.removeLayer(iranMapGeo);
}
}
function removeFeaturesCity() {
if (fullCityGeoJSONTemp.features) {
map.removeLayer(iranCityMapGeo);
statusSet = false;
flagProvince = 0;
}
setTimeout(() => {
iranMapGeo = L.geoJson(iranGeoJSON, {
style: initStyleMapFeatures,
onEachFeature: onEachFeature,
});
iranMapGeo.addTo(map);
}, 1000);
renderprovince(provincesArray);
}
setTimeout(() => {
iranMapGeo = L.geoJson(iranGeoJSON, {
style: initStyleMapFeatures,
onEachFeature: onEachFeature,
});
iranMapGeo.addTo(map);
}, 1000);
function renderprovince(data, ajaze) {
if ($(".province-data").children().length) {
$(".province-data").children().remove();
}
data.forEach((element) => {
if (ajaze) {
$(".province-data").append(`
`);
} else {
$(".province-data").append(`
`);
}
});
$(".progressBar-province span").each(function (index, element) {
if ($(element).text() >= "83") {
$(element).parent().css({
backgroundColor: "#a366ff",
height: "100%",
borderRadius: "10px",
});
} else if ($(element).text() >= "67") {
$(element).parent().css({
backgroundColor: "#80b3ff",
height: "100%",
borderRadius: "10px",
});
} else if ($(element).text() >= "50") {
$(element).parent().css({
backgroundColor: "#66cc66",
height: "100%",
borderRadius: "10px",
});
} else if ($(element).text() >= "31") {
$(element).parent().css({
backgroundColor: "#ffeda0",
height: "100%",
borderRadius: "10px",
});
} else {
$(element).parent().css({
backgroundColor: "#ff704d",
height: "100%",
borderRadius: "10px",
});
}
});
}
} else if (globalqueryparam == "safety_and_privacy") {
$(".guid-custom-box-safety").css("display", "block");
$(".filterTitle").on("click", function () {
if ($(this).parent().children(".filterGroup").css("display") == "none") {
$(this).parent().children(".filterGroup").show(1000);
} else {
$(this).parent().children(".filterGroup").hide(1000);
}
});
$.ajax({
url: "https://rms.rmto.ir/public/contents/provinces",
type: "GET",
success: function (data) {
var list_rahdar = data.data;
for (let index = 0; index < list_rahdar.length; index++) {
$("#all-pro-safety").append(
"" +
list_rahdar[index].name_fa +
"
"
);
}
showboxsafety();
},
});
showsafetyreaction();
}
});
$(document).mouseup(function (e) {
var container = $(".left-menu-view-chartt");
if (!container.is(e.target) && container.has(e.target).length === 0) {
$(".left-menu-view-chartt").css("left", "-1600px");
}
});
if ($("#pp1").prop("checked") == true) {
alert("byyyyyy");
}
function showrahdarkhane() {
$(".guid-custom-box-rahdar").css("display", "block");
remove141Layer();
showLoaderScreen();
$.get(API_TEST + "/rahdari-points", function (result) {
data = result.data;
let markerG = [];
marker141Layers = L.markerClusterGroup();
for (let i = 0; i < data.length; i++) {
setIcon = rahdariIconY;
if (data[i].lat == null) {
}
if (
data[i].lat == "-" ||
data[i].lng == "-" ||
data[i].lat == "0" ||
data[i].lng == "0" ||
data[i].lat == null ||
data[i].lng == null
) {
continue;
}
let marker = L.marker([data[i].lat, data[i].lng], {
icon: setIcon,
content: data[i],
})
.on("click", function (e) {
$("[data-mask]").inputmask();
let datatext = this.options.content;
$("#houserahdar").val(datatext.name);
$("#rahdarid").val(datatext.id);
$("#edarekol").val(datatext.province_name);
$("#mainCity").val(datatext.city_name);
$("#sit").val(datatext.status); //action
$("#type").val(datatext.type);
$("#phone").val(datatext.phone);
$("#ekipnum").val(datatext.team_num);
$("#personelnum").val(datatext.staff_num);
$("#masol").val(datatext.responsible_name);
$("#masolmobile").val(datatext.responsible_mobile);
$("#janeshin").val(datatext.successor_name);
$("#janeshinmobile").val(datatext.successor_mobile);
$("#lightmachine").val(datatext.machines_light);
$("#meduimachin").val(datatext.machines_sheavy);
$("#bigmachin").val(datatext.machines_heavy);
$("#lat-rahdar").val(datatext.lat);
$("#lng-rahdar").val(datatext.lng);
})
.bindPopup(getPopupContentRahdar(data[i], result.edit_id), {
className: "customPopupStyle",
});
// if (result.edit_id == data[i].province_id) {
// markerG.push(marker);
// } else {
marker141List.push(marker);
// }
}
marker141Layers.addLayers(marker141List);
map.addLayer(marker141Layers);
hideLoaderScreen();
});
$(".status").on("change", function () {
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
statusrahdar.push(parseInt(this.value));
} else {
var index = statusrahdar.indexOf(parseInt(this.value));
if (index > -1) {
statusrahdar.splice(index, 1);
}
}
showLoaderScreen();
$.get("https://rms.rmto.ir/api/public/rahdarKhanehMapFilter", {
province_id: pprahdar,
status: statusrahdar,
type: typerahdar,
}).done(function (data) {
show_filter_rahdar(data.data, pointrahdar);
});
});
$(".type").on("change", function () {
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
typerahdar.push(parseInt(this.value));
} else {
var index = typerahdar.indexOf(parseInt(this.value));
if (index > -1) {
typerahdar.splice(index, 1);
}
}
showLoaderScreen();
$.get("https://rms.rmto.ir/api/public/rahdarKhanehMapFilter", {
province_id: pprahdar,
status: statusrahdar,
type: typerahdar,
}).done(function (data) {
show_filter_rahdar(data.data, pointrahdar);
});
});
}
function showAccident251Points() {
remove141Layer();
showLoaderScreen();
$.get(API_TEST + "/accident-251-points", function (result) {
let roadAccidentPoints = result.data;
let markerG = [];
for (let i = 0; i < roadAccidentPoints.length; i++) {
try {
let setIcon = null;
if (roadAccidentPoints[i].progress == "100") {
if (result.edit_id == roadAccidentPoints[i].province_id) {
setIcon = greenIcon;
} else {
setIcon = greenIconFix;
}
} else {
if (result.edit_id == roadAccidentPoints[i].province_id) {
setIcon = redIcon;
} else {
setIcon = redIconFix;
}
}
let marker = L.marker(
[roadAccidentPoints[i].lat, roadAccidentPoints[i].lng],
{
icon: setIcon,
content: roadAccidentPoints[i],
}
)
.on("click", function (e) {
$("[data-mask]").inputmask();
let valueprogress = "";
let datatext = this.options.content;
$("#pointid").val(datatext.id);
$("#opration").val(datatext.operation); //oparation
$("#target").val(datatext.target); //target
$("#action").val(datatext.actions); //action
$("#ac-point-lat").val(datatext.lat);
$("#ac-point-lng").val(datatext.lng);
valueprogress = datatext.progress;
let test =
'\
';
$("#sliderphysici").empty();
$("#sliderphysici").append(
' پیشرفت فیزیکی '
);
$("#sliderphysici").append(test);
$(".ex2").slider({
min: 0,
max: 100,
formatter: function (value) {
return value + "٪";
},
tooltip: "always",
tooltip_position: "bottom",
});
$("#end-date").persianDatepicker({
format: "MMMM YYY",
autoClose: true,
viewMode: "month",
dayPicker: {
enabled: false,
},
});
$("#cost").val(datatext.cost); //cost
$("#end-date").val(datatext.end_date); //end-date
})
.bindPopup(
getPopupContentAccident_251(roadAccidentPoints[i], result.edit_id),
{ className: "customPopupStyle" }
);
markerG.push(marker);
} catch (e) { }
}
marker141Layers = L.layerGroup(markerG);
map.addLayer(marker141Layers);
hideLoaderScreen();
});
}
function showfastreaction() {
var showFastReactionPoint = true;
$("#fastreact_search_option").on("click", function () {
showLoaderScreen();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (
$("#fastreact-fromdate").val() != " " &&
$("#fastreact-todate").val() != " "
) {
let startDatefast = moment(
frommDatefast.getState().selected.year +
"/" +
frommDatefast.getState().selected.month +
"/" +
frommDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let endDatefast = moment(
toDatefast.getState().selected.year +
"/" +
toDatefast.getState().selected.month +
"/" +
toDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
if (showFastReactionPoint) {
$.get(
"https://rms.rmto.ir/public/homeprojects/fast/points" +
"?end-date=" +
endDatefast +
"&start-date=" +
startDatefast,
{
ProvinceId: ppfast,
FeatureType: featurefast,
Status: activityfast,
}
).done(function (data) {
hideLoaderScreen();
show_fast_points(data);
});
} else {
$.ajax({
url:
API_TEST +
"/public/homeprojects/fast/points" +
"?end-date=" +
endDatefast +
"&start-date=" +
startDatefast,
type: "GET",
success: function (result) {
hideLoaderScreen();
show_point(result.data);
},
error: function (error) { },
});
}
}
});
$(".FeatureType").on("change", function () {
showLoaderScreen();
let startDatefeauture = moment(
frommDatefast.getState().selected.year +
"/" +
frommDatefast.getState().selected.month +
"/" +
frommDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let endDatefeautre = moment(
toDatefast.getState().selected.year +
"/" +
toDatefast.getState().selected.month +
"/" +
toDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
featurefast.push(parseInt(this.value));
} else {
var index = featurefast.indexOf(parseInt(this.value));
if (index > -1) {
featurefast.splice(index, 1);
}
}
$.get(
"https://rms.rmto.ir/public/homeprojects/fast/points" +
"?end-date=" +
endDatefeautre +
"&start-date=" +
startDatefeauture,
{
ProvinceId: ppfast,
FeatureType: featurefast,
Status: activityfast,
}
).done(function (data) {
hideLoaderScreen();
show_fast_points(data);
});
});
$(".activity").on("change", function () {
showLoaderScreen();
let startDateactivity = moment(
frommDatefast.getState().selected.year +
"/" +
frommDatefast.getState().selected.month +
"/" +
frommDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let enddateacitivity = moment(
toDatefast.getState().selected.year +
"/" +
toDatefast.getState().selected.month +
"/" +
toDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
activityfast.push(parseInt(this.value));
} else {
var index = activityfast.indexOf(parseInt(this.value));
if (index > -1) {
activityfast.splice(index, 1);
}
}
$.get(
"https://rms.rmto.ir/public/homeprojects/fast/points" +
"?end-date=" +
enddateacitivity +
"&start-date=" +
startDateactivity,
{
ProvinceId: ppfast,
FeatureType: featurefast,
Status: activityfast,
}
).done(function (data) {
hideLoaderScreen();
show_fast_points(data);
});
});
}
function showsafetyreaction() {
$("#safety_search_option").on("click", function () {
showLoaderScreen();
console.log(marker141Layers != null);
console.log(
$("#safety-fromdate").val() != " " &&
$("#safety-todate").val() != " "
);
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (
$("#safety-fromdate").val() != " " &&
$("#safety-todate").val() != " "
) {
let startDatesafety = moment(
frommDatesafety.getState().selected.year +
"/" +
frommDatesafety.getState().selected.month +
"/" +
frommDatesafety.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let endDatesafety = moment(
toDatesafety.getState().selected.year +
"/" +
toDatesafety.getState().selected.month +
"/" +
toDatesafety.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
$.get(
"https://rms.rmto.ir/v2/safety_and_privacy/report/map" +
"?date_to=" +
endDatesafety +
"&date_from=" +
startDatesafety,
"&province_id=" +
ppsafety
).done(function (data) {
hideLoaderScreen();
show_safety_points(data);
});
}
});
$(".FeatureType").on("change", function () {
showLoaderScreen();
let startDatefeauture = moment(
frommDatefast.getState().selected.year +
"/" +
frommDatefast.getState().selected.month +
"/" +
frommDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let endDatefeautre = moment(
toDatefast.getState().selected.year +
"/" +
toDatefast.getState().selected.month +
"/" +
toDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
featurefast.push(parseInt(this.value));
} else {
var index = featurefast.indexOf(parseInt(this.value));
if (index > -1) {
featurefast.splice(index, 1);
}
}
$.get(
"https://rms.rmto.ir/public/homeprojects/fast/points" +
"?end-date=" +
endDatefeautre +
"&start-date=" +
startDatefeauture,
{
ProvinceId: ppfast,
FeatureType: featurefast,
Status: activityfast,
}
).done(function (data) {
hideLoaderScreen();
show_fast_points(data);
});
});
$(".activity").on("change", function () {
showLoaderScreen();
let startDateactivity = moment(
frommDatefast.getState().selected.year +
"/" +
frommDatefast.getState().selected.month +
"/" +
frommDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
let enddateacitivity = moment(
toDatefast.getState().selected.year +
"/" +
toDatefast.getState().selected.month +
"/" +
toDatefast.getState().selected.date,
"jYYYY/jM/jD"
).format("YYYY-MM-DD");
remove141Layer();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
if (this.checked) {
activityfast.push(parseInt(this.value));
} else {
var index = activityfast.indexOf(parseInt(this.value));
if (index > -1) {
activityfast.splice(index, 1);
}
}
$.get(
"https://rms.rmto.ir/public/homeprojects/fast/points" +
"?end-date=" +
enddateacitivity +
"&start-date=" +
startDateactivity,
{
ProvinceId: ppfast,
FeatureType: featurefast,
Status: activityfast,
}
).done(function (data) {
hideLoaderScreen();
show_fast_points(data);
});
});
}
function showallpoint() {
remove141Layer();
showLoaderScreen();
if (marker141Layers != null) {
marker141List = [];
map.removeLayer(marker141Layers);
}
if (marker141LayersWithoutCluster != null) {
map.removeLayer(marker141LayersWithoutCluster);
}
$.ajax({
url: API_TEST + "/accident-points",
type: "GET",
success: function (result) {
let roadAccidentPoints = result.data;
hideLoaderScreen();
let markerG = [];
for (let i = 0; i < roadAccidentPoints.length; i++) {
if (
roadAccidentPoints[i].progress == "100" ||
(roadAccidentPoints[i].accident251_point &&
roadAccidentPoints[i].accident251_point.progress == "100")
) {
if (result.edit_id == roadAccidentPoints[i].province_id) {
setIcon = greenIcon;
} else {
setIcon = "#28a745";
}
} else {
if (result.edit_id == roadAccidentPoints[i].province_id) {
setIcon = redIcon;
} else {
setIcon = "#dc3545";
}
}
try {
let marker = null;
if (result.edit_id == roadAccidentPoints[i].province_id) {
marker = L.marker(
[roadAccidentPoints[i].lat, roadAccidentPoints[i].lng],
{
icon: setIcon,
content: roadAccidentPoints[i],
}
)
.on("click", function (e) {
$("[data-mask]").inputmask();
let valueprogress = "";
let contentData = this.options.content;
$("#allpointid").val(contentData.id);
$("#allend-date").persianDatepicker({
format: "MMMM YYY",
autoClose: true,
viewMode: "month",
dayPicker: {
enabled: false,
},
});
if (contentData.accident251_point) {
$("#alloperation").val(
contentData.accident251_point.operation
);
$("#alltarget").val(contentData.accident251_point.target);
$("#allaction").val(contentData.accident251_point.actions);
$("#allcost").val(contentData.accident251_point.cost);
$("#allend-date").val(contentData.accident251_point.end_date);
valueprogress = contentData.accident251_point.progress;
} else {
$("#alloperation").val("-");
$("#alltarget").val("-");
$("#allaction").val("-");
$("#allcost").val(contentData.cost);
$("#allcost").val(contentData.cost);
$("#allend-date").val("-");
valueprogress = contentData.progress;
}
$("#allac-point-lat").val(contentData.lat);
$("#allac-point-lng").val(contentData.lng);
let test =
'\
';
$("#allsliderphysici").empty();
$("#allsliderphysici").append(
' پیشرفت فیزیکی '
);
$("#allsliderphysici").append(test);
$(".allex2").slider({
min: 0,
max: 100,
formatter: function (value) {
return value + "٪";
},
tooltip: "always",
tooltip_position: "bottom",
});
})
.bindPopup(
getPopupContentAccident(roadAccidentPoints[i], result.edit_id),
{ className: "customPopupStyle" }
);
} else {
marker = L.circleMarker(
[roadAccidentPoints[i].lat, roadAccidentPoints[i].lng],
{
color: setIcon,
stroke: false,
radius: 3,
fillOpacity: 1,
}
).bindPopup(
getPopupContentAccident(roadAccidentPoints[i], result.edit_id),
{ className: "customPopupStyle" }
);
}
markerG.push(marker);
} catch (e) { }
}
marker141Layers = L.layerGroup(markerG);
map.addLayer(marker141Layers);
},
error: function (error) { },
});
}
function getPopupContentAccident(data, edit_id) {
let popupTitle251 = "";
if (data.accident251_point) {
popupTitle251 = " (اولویت ۲۵۱ نقطه)";
}
if (edit_id == data.province_id) {
if (data.accident251_point) {
return (
'\
\
'
);
} else if (
(data.target && data.target != "-") ||
(data.operation && data.operation != "-")
) {
return (
'\
\
'
);
} else {
return (
'\