3745 lines
131 KiB
JavaScript
3745 lines
131 KiB
JavaScript
const API_ENDPOINT = "https://141.ir/api";
|
|
const MAP_ENDPOINT = "https://testmap.141.ir";
|
|
const MAP_MIN_ZOOM = 6;
|
|
const MAP_MAX_ZOOM = 15;
|
|
const API_TEST = "http://192.168.1.75/rms_new/public/index.php";
|
|
var globalqueryparam = "";
|
|
var frommDate, toDate;
|
|
var mapradar = null;
|
|
var marker141Layers = null;
|
|
var marker141List = [];
|
|
var marker141Layers = null;
|
|
var globalcolor = "";
|
|
var routeControls = [];
|
|
var routecolor = [];
|
|
var routeControlsPath = [];
|
|
var isSetEndAbrarMarker = false;
|
|
var isSetStartAbrarMarker = false;
|
|
var marker141LayersWithoutCluster = null;
|
|
var frommDate, tooDate;
|
|
//pooria
|
|
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;
|
|
//End pooria
|
|
// testing
|
|
var routeControls = [];
|
|
var routecolor = [];
|
|
var routeControlsPath = [];
|
|
//testing
|
|
|
|
// map marker
|
|
var startAbrarDivIconrahdar = L.divIcon({
|
|
html: `
|
|
<div id="pin-marker-startrahdar" class="pin-marker">
|
|
<div class="map-pin-marker">
|
|
<div class="pin-main-circle"></div>
|
|
<div class="pin-white-circle"></div>
|
|
<div class="pin-title-circle">
|
|
<span class="title-circle-text">شروع</span>
|
|
</div>
|
|
<div class="pin-main-line"></div>
|
|
</div>
|
|
<div class="pin-main-shadow">
|
|
<div class="shadow-dot">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`,
|
|
iconSize: [55, 75],
|
|
iconAnchor: [33, 64],
|
|
});
|
|
var endAbrarDivIconrahdar = L.divIcon({
|
|
html: `
|
|
<div id="pin-marker-endrahdar" class="pin-marker">
|
|
<div class="map-pin-marker">
|
|
<div class="pin-main-circle"></div>
|
|
<div class="pin-white-circle"></div>
|
|
<div class="pin-title-circle">
|
|
<span class="title-circle-text">پایان</span>
|
|
</div>
|
|
<div class="pin-main-line"></div>
|
|
</div>
|
|
<div class="pin-main-shadow">
|
|
<div class="shadow-dot">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`,
|
|
iconSize: [55, 75],
|
|
iconAnchor: [33, 64],
|
|
});
|
|
//route need code
|
|
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://testmap.141.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]);
|
|
}
|
|
}
|
|
|
|
/*let popup = new L.Popup({
|
|
'maxWidth': '300',
|
|
'maxHeight': '150',
|
|
'className': 'customRouteEstimate'
|
|
});
|
|
|
|
let popupLocation = new L.LatLng(e.routes[0].coordinates[parseInt(e.routes[0]
|
|
.coordinates
|
|
.length /
|
|
2)].lat,
|
|
e.routes[0].coordinates[parseInt(e.routes[0].coordinates.length / 2)]
|
|
.lng);
|
|
let popupContent = "<span style=\"color:#FF5630 ; font-size:11px\">مسافت : </span>" + parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2) + " کیلومتر";
|
|
popup.setLatLng(popupLocation);
|
|
popup.setContent(popupContent);
|
|
popupArraysPath.push(popup);
|
|
map.addLayer(popup);*/
|
|
})
|
|
.addTo(map)
|
|
);
|
|
}
|
|
);
|
|
|
|
$(".leaflet-control-container").css("display", "none");
|
|
$(".leaflet-routing-container-hide").css("display", "none");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function calculateRouteCoridor(first, last, num) {
|
|
let routeArray = [];
|
|
// if (routeControls.length) {
|
|
// // alert("hi")
|
|
// $(routeControls).each(function (index, control) {
|
|
// map.removeControl(control);
|
|
// routeControls.splice(routeControls.indexOf(index), 1);
|
|
// });
|
|
// }
|
|
|
|
let result = new Promise(function (resolve, reject) {
|
|
console.log("nummmmm", num);
|
|
if (num == 0) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/51.4013785,35.7006177;52.8579311,36.4636399?overview=full&alternatives=true&steps=true&hints=C9UogA3VKIAAAAAARQAAAAAAAAAAAAAAAAAAADdAN0IAAAAAAAAAAAAAAABFAAAAAAAAAAAAAAC_AQAAIlIQA7-_IAKjUhADir8gAgAAbwARLKj6",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
}
|
|
if (num == 1) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/51.4013785,35.7006177;52.3499009,36.4718947?overview=full&alternatives=true&steps=true&hints=C9UogA3VKIAAAAAARQAAAAAAAAAAAAAAAAAAADdAN0IAAAAAAAAAAAAAAABFAAAAAAAAAAAAAAC_AQAAIlIQA7-_IAKjUhADir8gAgAAbwARLKj6;BGE-gAVhPoALAAAAAAAAAGMAAAAAAAAA9NXyQAAAAAD2RolCAAAAAAsAAAAAAAAAYwAAAAAAAAC_AQAAY8weA_aELALNyx4DV4QsAgMA3woRLKj6",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
}
|
|
if (num == 2) {
|
|
$.get(
|
|
"https://testmap.141.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&hints=itQMgKOuPIAYAAAAAAAAAAAAAAAAAAAAylbYQQAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC_AQAADp30AkfYOALimfQCgdY4AgAArw8RLKj6;mVIBgECFD4AHAAAAAgAAAIMAAAB0AwAAmN51QbFihEA79YlD7x7qRAcAAAACAAAAgwAAAHQDAAC_AQAAG6v0AhLJNAJ1q_QCmMg0AgQAvwMRLKj6;bAkAgOPdLYAKAAAACgAAAAgAAABGAAAAls_iQZ5QwEEWe7FBrp87QwoAAAAKAAAACAAAAEYAAAC_AQAAMLzxAiL9MAKau_ECWf0wAgEAjwERLKj6;WQkAgISGAYAnAAAADgAAAIQGAAABAQAAczG7Qtog-UERoHVFrYgWRCcAAAAOAAAAhAYAAAEBAAC_AQAAi_vxAixIMALP-_ECREgwAhEADxURLKj6;UgkAgGdsGIBBAAAAIgAAAAAAAACJCgAAhN0LQ8sSjEIAAAAAjE-xRUEAAAAiAAAAAAAAAIkKAAC_AQAAENbzAqnBLgKP1vMCl8IuAgAAHwcRLKj6;9AgAgF5sGIARAAAAFAAAADMGAABPAgAAFgMTQjFOKEKcqFFFOFOcRBEAAAAUAAAAMwYAAE8CAAC_AQAAu8P0Agn2KgJFxPQC5fkqAjQATxERLKj6;7lcZgP___38sAAAAbQIAAAYAAACSAAAApbDRQjSWqkRVFF9Bp6esQywAAABtAgAABgAAAJIAAAC_AQAAgSz4Am0NKgJ9LPgCYg0qAgEAnwYRLKj6;e3cTgJd3E4BAAAAAHQAAAGUAAAAAAAAA_O4tQpWml0HLjoZCAAAAAEAAAAAdAAAAZQAAAAAAAAC_AQAARwr7Ak-XKQKHCvsCV5gpAgIAnxERLKj6",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
}
|
|
if (num == 3) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/50.006663,36.2804074;49.5846102,37.2793607?overview=full&alternatives=true&steps=true&hints=e3cTgJd3E4BAAAAAHQAAAGUAAAAAAAAA_O4tQpWml0HLjoZCAAAAAEAAAAAdAAAAZQAAAAAAAAC_AQAARwr7Ak-XKQKHCvsCV5gpAgIAnxERLKj6;itQMgKOuPIAYAAAAAAAAAAAAAAAAAAAAylbYQQAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAC_AQAADp30AkfYOALimfQCgdY4AgAArw8RLKj6",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
} else if (num == 4) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/51.0073853,35.8121955;51.4222349,36.6506071?overview=full&alternatives=true&steps=true&hints=;",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
} else if (num == 5) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/51.4013785,35.7006177;53.3882906,35.5834074?overview=full&alternatives=true&steps=true",
|
|
function (data) {
|
|
console.log(data.routes[0].geometry);
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
} else if (num == 6) {
|
|
$.get(
|
|
"https://testmap.141.ir/route/v1/driving/51.4013785,35.7006177;46.2961952,38.0739964?overview=full&alternatives=true&steps=true&hints=C9UogA3VKIAAAAAARQAAAAAAAAAAAAAAAAAAADdAN0IAAAAAAAAAAAAAAABFAAAAAAAAAAAAAAC_AQAAIlIQA7-_IAKjUhADir8gAgAAbwARLKj6;2hQHgP___38EAAAACAAAABgAAAAIAAAAVh5JQJxEEkCgQ4NBl56tQAQAAAAIAAAAGAAAAAgAAAC_AQAAcmzCAm32RAKDbMICjPZEAgMADwcRLKj6",
|
|
function (data) {
|
|
console.log(data.routes[0].geometry);
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
} else if (num == 7) {
|
|
$.get(
|
|
"https://testmap.141.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&hints=C9UogA3VKIAAAAAARQAAAAAAAAAAAAAAAAAAADdAN0IAAAAAAAAAAAAAAABFAAAAAAAAAAAAAAC_AQAAIlIQA7-_IAKjUhADir8gAgAAbwARLKj6;2Gw8gOJsPIBuBAAAGAAAAHQNAAAiBQAArgQWRW_mRUJ3juNF-68tRW4EAAAYAAAAdA0AACIFAAC_AQAAVyX-Anj-FQKVMP4CdDAWAgYATwYRLKj6;TNQ1gP___38AAAAAUgAAAHYAAACIAAAAAAAAAEuuiUH4AsRBuhvjQQAAAAApAAAAOwAAAEQAAAC_AQAAS8TzAvvtFwImyfMCsvQXAgEALxIRLKj6;x54JgP___38hAAAARwEAADkCAAAAAAAAgJKhQoW-M0TRFq5EAAAAACEAAABHAQAAOQIAAAAAAAC_AQAArcbnAmxrFwI-t-cCZ4AXAgIA7w4RLKj6;idQHgP___38DAAAABwAAAA4AAAAHAAAAFW7OQAhf0UCc5s5BBL9OQQMAAAAHAAAADgAAAAcAAAC_AQAAVEnOAvi7CwI1Sc4C5b0LAgIAfwURLKj6",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
} else {
|
|
console.log("else milad");
|
|
$.get(
|
|
"https://testmap.141.ir" +
|
|
"/route/v1/driving/" +
|
|
first[1] +
|
|
"," +
|
|
first[0] +
|
|
";" +
|
|
last[1] +
|
|
"," +
|
|
last[0] +
|
|
"?overview=full&alternatives=false",
|
|
function (data) {
|
|
// console.log(data.routes[0].geometry)
|
|
// console.log("decoooooooode",decode(data.routes[0].geometry, 6));
|
|
resolve(decode(data.routes[0].geometry, 6));
|
|
}
|
|
);
|
|
}
|
|
});
|
|
|
|
result
|
|
.then((response) => {
|
|
// alert("hiii")
|
|
routeArray = response;
|
|
// console.log("routeArray" , routeArray);
|
|
showCoridorLayer(routeArray, num);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
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)
|
|
);
|
|
}
|
|
// var pointA = new L.LatLng(35.635308, 51.22496);
|
|
// var pointB = new L.LatLng(33.984461, 62.70641);
|
|
// var pointList = [pointA, pointB];
|
|
console.log("myarray ", myarray);
|
|
seventhpolyline = new L.Polyline(myarray, {
|
|
color: "blue",
|
|
weight: 5,
|
|
opacity: 0.5,
|
|
smoothFactor: 1,
|
|
});
|
|
seventhpolyline.addTo(map);
|
|
}
|
|
})
|
|
.catch((error) => console.log(error));
|
|
|
|
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);
|
|
}
|
|
|
|
// var pointA = new L.LatLng(28.635308, 77.22496);
|
|
// var pointB = new L.LatLng(28.984461, 77.70641);
|
|
// var pointList = [pointA, pointB];
|
|
|
|
for (var i = 0; i < routeControls.length; i++) {
|
|
console.log("routeControls", routeControls[i].options.waypoints[1].lat);
|
|
}
|
|
console.log("routeControls", routeControls);
|
|
if ($(".leaflet-routing-container").length) {
|
|
$(".leaflet-routing-container").remove();
|
|
}
|
|
}
|
|
|
|
function drawPath(update) {
|
|
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) {
|
|
console.log("eeeeee", e);
|
|
})
|
|
.addTo(mapradar)
|
|
);
|
|
console.log("routeControls", routeControls);
|
|
|
|
$(".leaflet-control-container").css("display", "none");
|
|
$(".leaflet-routing-container-hide").css("display", "none");
|
|
}
|
|
|
|
var greenIcon = L.divIcon({
|
|
className: "custom-div-icon",
|
|
html: "<span class='beacon beacon-green'></span>",
|
|
iconSize: [30, 42],
|
|
// iconAnchor: [15, 42]
|
|
});
|
|
var redIcon = L.divIcon({
|
|
className: "custom-div-icon",
|
|
html: "<span class='beacon beacon-red'></span>",
|
|
iconSize: [30, 42],
|
|
// iconAnchor: [15, 42]
|
|
});
|
|
var greenIconFix = L.divIcon({
|
|
className: "custom-div-icon",
|
|
html: "<span class='beacon beacon-green-fix'></span>",
|
|
iconSize: [30, 42],
|
|
// iconAnchor: [15, 42]
|
|
});
|
|
var redIconFix = L.divIcon({
|
|
className: "custom-div-icon",
|
|
html: "<span class='beacon beacon-red-fix'></span>",
|
|
iconSize: [30, 42],
|
|
// iconAnchor: [15, 42]
|
|
});
|
|
var rahdariIconO = L.icon({
|
|
iconUrl: "../../dist/images/icons/tollHouseO_pin.png",
|
|
iconSize: [22, 22],
|
|
});
|
|
var rahdariIconY = L.icon({
|
|
iconUrl: "../../dist/images/icons/tollHouse_pin.png",
|
|
iconSize: [26, 26],
|
|
});
|
|
var bounds = [
|
|
[42.9130026312, 75.6166317076],
|
|
[20.5782370061, 30.5092252948],
|
|
];
|
|
var map = L.map("map", {
|
|
maxBounds: bounds,
|
|
minZoom: MAP_MIN_ZOOM,
|
|
zoomControl: false,
|
|
}).setView([35.5468992, 51.7300532], 7);
|
|
L.tileLayer(MAP_ENDPOINT + "/141map/{z}/{x}/{y}.png", {}).addTo(map);
|
|
$(document).ready(function () {
|
|
var urlParams = new URLSearchParams(window.location.search);
|
|
console.log(urlParams.get("type"));
|
|
globalqueryparam = urlParams.get("type");
|
|
if (globalqueryparam == "allpoints") {
|
|
showallpoint();
|
|
}else if (globalqueryparam == "fastreact") {
|
|
showfastreaction();
|
|
}else if (globalqueryparam == "pro") {
|
|
getMaintenanceProjects();
|
|
$(".guid-custom-box").css("display", "block");
|
|
}else if (globalqueryparam == "rahdar") {
|
|
showrahdarkhane();
|
|
}else if (globalqueryparam == "251points") {
|
|
showAccident251Points();
|
|
}else if (globalqueryparam == "rahdari") {
|
|
showDailyRahdariActivity();
|
|
}else if (globalqueryparam == "barkhordari") {
|
|
$.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(
|
|
`<div class="parent-popup-enjoyment text-center">
|
|
<div class="d-flex flex-column ">
|
|
<span style="font-size: 10px;" class="font-weight-bold">${provincesArray[i].name_fa}</span>
|
|
<div style="color:rgb(255, 159, 107)" class="d-flex justify-content-center mt-1">
|
|
<span class="ml-1">مقدار</span>
|
|
<span style="font-family:IRANSansFaNum">${provincesArray[i].abrar_process}%</span>
|
|
</div>
|
|
</div>
|
|
<div class="line-popup"></div>
|
|
<a href="${provincesArray[i].abrar_link}" class="btn-download">
|
|
<div class="d-flex flex-column mt-2">
|
|
<i style="color:rgb(255, 159, 107);font-size:15px" class="fa fa-download"></i>
|
|
<span style="font-size: 10px;" class="font-weight-bold">
|
|
دانلود فایل
|
|
</span>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
`
|
|
)
|
|
.openOn(map);
|
|
}
|
|
}
|
|
//Start Province
|
|
$(`#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,
|
|
});
|
|
//End Province
|
|
}
|
|
//Start City
|
|
|
|
//End City
|
|
}
|
|
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(
|
|
`<div class="parent-popup-enjoyment text-center">
|
|
<div class="d-flex flex-column ">
|
|
<span style="font-size: 10px;" class="font-weight-bold">${citiesArray[i].name_fa}</span>
|
|
<div style="color:rgb(255, 159, 107)" class="d-flex justify-content-center mt-1">
|
|
<span class="ml-1">مقدار</span>
|
|
<span style="font-family:IRANSansFaNum">${citiesArray[i].abrar_process}%</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
)
|
|
.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();
|
|
// removeCityFeaturesFromMap();
|
|
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 () {
|
|
//todo pooria
|
|
|
|
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,
|
|
//click: zoomMapToFeature
|
|
});
|
|
}
|
|
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) {
|
|
console.log(featureRow);
|
|
for (let i = 0; i < fullCityGeoJSONTemp.features.length; i++) {
|
|
if (i == featureRow) {
|
|
console.log(fullCityGeoJSONTemp.features[i].properties);
|
|
return fullCityGeoJSONTemp.features[i].properties;
|
|
}
|
|
}
|
|
}
|
|
function initStyleCityMapFeatures(feature) {
|
|
// let getRandom = getRandomFeatureColor(fillcolorCity(iranCityCount));
|
|
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(`
|
|
<div class="parent-popup" id=target${
|
|
element.properties.city_id
|
|
} class="mt-3">
|
|
<div class="d-flex justify-content-between">
|
|
<div class="province-title">${
|
|
element.properties.city_name
|
|
}</div>
|
|
<div class="ml-5"><span style="color:rgb(255, 159, 107);font-family:IRANSansFaNum">${
|
|
element.properties.abrar_process
|
|
}%</span></div>
|
|
</div>
|
|
<div class="parent-progressBar-province">
|
|
<div class="progressBar-province" style="width:${
|
|
element.properties.abrar_process == "-"
|
|
? 5
|
|
: element.properties.abrar_process
|
|
}%"><span class="d-none">${
|
|
element.properties.abrar_process
|
|
}</span></div>
|
|
</div>
|
|
</div>
|
|
`);
|
|
} else {
|
|
$(".province-data").append(`
|
|
<div class="parent-popup" id=target${element.id} class="mt-3">
|
|
<div class="d-flex justify-content-between">
|
|
<div class="province-title">${element.name_fa}</div>
|
|
<div class="ml-5"><span style="color:rgb(255, 159, 107);font-family:IRANSansFaNum">${
|
|
element.abrar_process
|
|
}%</span></div>
|
|
</div>
|
|
<div class="parent-progressBar-province">
|
|
<div class="progressBar-province" style="width:${
|
|
element.abrar_process == "-"
|
|
? 0
|
|
: element.abrar_process
|
|
}%"><span class="d-none">${
|
|
element.abrar_process
|
|
}</span></div>
|
|
</div>
|
|
</div>
|
|
`);
|
|
}
|
|
});
|
|
|
|
$(".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",
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
$(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");
|
|
}
|
|
});
|
|
function showrahdarkhane() {
|
|
remove141Layer();
|
|
showLoaderScreen();
|
|
$.get(API_TEST + "/rahdari-points", function (result) {
|
|
console.log("ressss", result);
|
|
data = result.data;
|
|
let markerG = [];
|
|
marker141Layers = L.markerClusterGroup();
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (result.edit_id == data[i].province_id) {
|
|
setIcon = rahdariIconO;
|
|
} else {
|
|
setIcon = rahdariIconY;
|
|
}
|
|
|
|
if (
|
|
data[i].lat == "-" ||
|
|
data[i].lng == "-" ||
|
|
data[i].lat == "0" ||
|
|
data[i].lng == "0"
|
|
) {
|
|
continue;
|
|
}
|
|
|
|
let marker = L.marker([data[i].lat, data[i].lng], {
|
|
icon: setIcon,
|
|
content: data[i],
|
|
})
|
|
.on("click", function (e) {
|
|
console.log("eeeeeee", e);
|
|
$("[data-mask]").inputmask();
|
|
console.log("test", this.options.content);
|
|
|
|
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);
|
|
}
|
|
}
|
|
marker141LayersWithoutCluster = L.layerGroup(markerG);
|
|
marker141Layers.addLayers(marker141List);
|
|
map.addLayer(marker141Layers);
|
|
map.addLayer(marker141LayersWithoutCluster);
|
|
hideLoaderScreen();
|
|
});
|
|
}
|
|
function showAccident251Points() {
|
|
remove141Layer();
|
|
showLoaderScreen();
|
|
|
|
$.get(API_TEST + "/accident-251-points", function (result) {
|
|
|
|
let roadAccidentPoints = result.data;
|
|
console.log("|test" ,roadAccidentPoints )
|
|
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) {
|
|
console.log("testtt" ,result.edit_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],
|
|
}
|
|
)
|
|
// console
|
|
// .log("nn", marker)
|
|
.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 =
|
|
'<div class="project-slider status-slider-body pr-2 pl-2 mb-5 mt-1">\
|
|
<input class="ex2" type="text" data-slider-step="1" data-slider-value="' +
|
|
valueprogress +
|
|
'"/></div> ';
|
|
|
|
$("#sliderphysici").empty();
|
|
|
|
$("#sliderphysici").append(
|
|
'<label class="slider-label label-allpoint-style" for="inputAddress2"> پیشرفت فیزیکی</label>'
|
|
);
|
|
$("#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
|
|
//$("#cost").attr('min', datatext.cost);//cost
|
|
$("#end-date").val(datatext.end_date); //end-date
|
|
})
|
|
.bindPopup(
|
|
getPopupContentAccident_251(roadAccidentPoints[i], result.edit_id),
|
|
{ className: "customPopupStyle" }
|
|
);
|
|
console.log("mm" ,marker )
|
|
markerG.push(marker);
|
|
console.log("mmerkerg", markerG);
|
|
} catch (e) {}
|
|
}
|
|
marker141Layers = L.layerGroup(markerG);
|
|
map.addLayer(marker141Layers);
|
|
hideLoaderScreen();
|
|
});
|
|
}
|
|
function showfastreaction() {
|
|
$("#modal-fastreact").modal("show");
|
|
toDate = $("#fastreact-todate").persianDatepicker({
|
|
format: "YYYY/MM/DD",
|
|
autoClose: true,
|
|
format: "YYYY/MM/DD",
|
|
autoClose: true,
|
|
onSelect: function (unix) {
|
|
toDate.touched = true;
|
|
},
|
|
});
|
|
let test = moment(
|
|
toDate.getState().selected.year +
|
|
"/" +
|
|
toDate.getState().selected.month +
|
|
"/" +
|
|
toDate.getState().selected.date,
|
|
"jYYYY/jM/jD"
|
|
).format("YYYY-MM-DD");
|
|
console.log("hh", test);
|
|
frommDate = $("#fastreact-fromdate").persianDatepicker({
|
|
observer: true,
|
|
format: "YYYY/MM/DD",
|
|
altField: ".observer-example-alt",
|
|
autoClose: true,
|
|
onSelect: function (unix) {
|
|
frommDate.touched = true;
|
|
if (
|
|
frommDate.getState().selected.unixDate >=
|
|
toDate.getState().selected.unixDate
|
|
) {
|
|
toDate.setDate(frommDate.getState().selected.unixDate);
|
|
}
|
|
if (toDate && toDate.options && toDate.options.minDate != unix) {
|
|
let cachedValue = toDate.getState().selected.unixDate;
|
|
|
|
toDate.options = { minDate: unix };
|
|
|
|
if (toDate.touched) {
|
|
toDate.setDate(cachedValue);
|
|
}
|
|
}
|
|
},
|
|
});
|
|
// //search option for date of fastreact
|
|
var showFastReactionPoint = true;
|
|
$("#fastreact_search_option").on("click", function () {
|
|
$("#modal-fastreact").modal("hide");
|
|
if (
|
|
$("#fastreact-fromdate").val() != " " &&
|
|
$("#fastreact-todate").val() != " "
|
|
) {
|
|
let startDate = moment(
|
|
frommDate.getState().selected.year +
|
|
"/" +
|
|
frommDate.getState().selected.month +
|
|
"/" +
|
|
frommDate.getState().selected.date,
|
|
"jYYYY/jM/jD"
|
|
).format("YYYY-MM-DD");
|
|
console.log("lll", startDate);
|
|
let endDate = moment(
|
|
toDate.getState().selected.year +
|
|
"/" +
|
|
toDate.getState().selected.month +
|
|
"/" +
|
|
toDate.getState().selected.date,
|
|
"jYYYY/jM/jD"
|
|
).format("YYYY-MM-DD");
|
|
console.log("lll", endDate);
|
|
if (showFastReactionPoint) {
|
|
showFastFunction(startDate, endDate);
|
|
} else {
|
|
console.log(startDate, endDate);
|
|
$.ajax({
|
|
url:
|
|
API_TEST +
|
|
"/public/homeprojects/fast/points" +
|
|
"?end-date=" +
|
|
endDate +
|
|
"&start-date=" +
|
|
startDate,
|
|
type: "GET",
|
|
success: function (result) {
|
|
console.log("resssss", result.data);
|
|
// show_point(result.data);
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
function showFastFunction(startDate, endDate) {
|
|
showLoaderScreen();
|
|
$.ajax({
|
|
url:
|
|
API_TEST +
|
|
"/public/homeprojects/fast/points" +
|
|
"?end-date=" +
|
|
endDate +
|
|
"&start-date=" +
|
|
startDate,
|
|
type: "GET",
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (result) {
|
|
console.log(result);
|
|
hideLoaderScreen();
|
|
// showFastReactionPoint = false;
|
|
|
|
let roadMaintenancePoints = result.data;
|
|
|
|
let markerG = [];
|
|
|
|
for (let i = 0; i < roadMaintenancePoints.length; i++) {
|
|
try {
|
|
let setIcon = null;
|
|
let pos = null;
|
|
|
|
if (roadMaintenancePoints[i].rms_status == 0) {
|
|
setIcon = redIcon;
|
|
pos = [
|
|
roadMaintenancePoints[i].lat,
|
|
roadMaintenancePoints[i].lng,
|
|
];
|
|
console.log("pos", pos);
|
|
} else {
|
|
setIcon = greenIcon;
|
|
pos = roadMaintenancePoints[i].rms_start_latlng;
|
|
}
|
|
|
|
if (pos != null) {
|
|
let marker = L.marker(pos, {
|
|
icon: setIcon,
|
|
content: roadMaintenancePoints[i],
|
|
}).bindPopup(
|
|
getPopupContentFastReaction(roadMaintenancePoints[i]),
|
|
{
|
|
className: "customPopupStyle",
|
|
}
|
|
);
|
|
markerG.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
}
|
|
marker141Layers = L.layerGroup(markerG);
|
|
// marker141Layers.addLayers(marker141List);
|
|
map.addLayer(marker141Layers);
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
},
|
|
});
|
|
}
|
|
}
|
|
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) {
|
|
console.log(result);
|
|
let roadAccidentPoints = result.data;
|
|
hideLoaderScreen();
|
|
//console.log(roadAccidentPoints);
|
|
|
|
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();
|
|
//console.log(this.options.content)
|
|
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);
|
|
//$("#allcost").attr('min', 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);
|
|
//$("#allcost").attr('min', contentData.cost);
|
|
$("#allend-date").val("-");
|
|
valueprogress = contentData.progress;
|
|
}
|
|
|
|
$("#allac-point-lat").val(contentData.lat);
|
|
$("#allac-point-lng").val(contentData.lng);
|
|
|
|
let test =
|
|
'<div class="project-slider status-slider-body pr-2 pl-2 mb-5 mt-1">\
|
|
<input class="allex2" type="text" data-slider-step="1" data-slider-value="' +
|
|
valueprogress +
|
|
'"/></div> ';
|
|
|
|
$("#allsliderphysici").empty();
|
|
|
|
$("#allsliderphysici").append(
|
|
'<label class="allslider-label label-allpoint-style" for="inputAddress2"> پیشرفت فیزیکی</label>'
|
|
);
|
|
$("#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) {
|
|
console.log(e);
|
|
}
|
|
}
|
|
marker141Layers = L.layerGroup(markerG);
|
|
map.addLayer(marker141Layers);
|
|
},
|
|
error: function (error) {
|
|
//console.log(error);
|
|
},
|
|
});
|
|
}
|
|
function getPopupContentAccident(data, edit_id) {
|
|
let popupTitle251 = "";
|
|
|
|
if (data.accident251_point) {
|
|
popupTitle251 = " (اولویت ۲۵۱ نقطه)";
|
|
}
|
|
|
|
if (edit_id == data.province_id) {
|
|
if (data.accident251_point) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.accident251_point.province +
|
|
"، محور: " +
|
|
data.accident251_point.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-12" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.operation +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent">\
|
|
<div class="col-12" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.target +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.actions +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.cost +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.end_date +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point btn btn-danger" onclick="showAccidentPointEditModal()">بروزرسانی</button>\
|
|
</div>\
|
|
</div>\
|
|
'
|
|
);
|
|
} else if (
|
|
(data.target && data.target != "-") ||
|
|
(data.operation && data.operation != "-")
|
|
) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
(data.operation ? data.operation : "-") +
|
|
'</div></div>\
|
|
<div class="col-6" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
(data.target ? data.target : "-") +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
(data.actions ? data.actions : "-") +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.cost +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
(data.end_date ? data.end_date : "-") +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point btn btn-danger" onclick="showAccidentPointEditModal()">بروزرسانی</button>\
|
|
</div>\
|
|
</div>\
|
|
'
|
|
);
|
|
} else {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> ابتدای محور</span><div class="popUpBoxContent">' +
|
|
data.axis_start +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> انتهای محور</span><div class="popUpBoxContent">' +
|
|
data.axis_end +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> فاصله از ابتدای محور</span><div class="popUpBoxContent">' +
|
|
data.distance +
|
|
" " +
|
|
"کیلومتر" +
|
|
'</div> </div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> توصیف هندسی نقطه</span><div class="popUpBoxContent">' +
|
|
data.geometric_desc +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div> </div>\
|
|
<div class="col-4" style="text-align:center"><span class="header-popupcontent-allpoints"> طول جغرافیایی</span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point btn btn-danger" onclick="showAccidentPointEditModal()">بروزرسانی</button>\
|
|
</div>\
|
|
</div>'
|
|
);
|
|
}
|
|
} else {
|
|
if (data.accident251_point) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.accident251_point.province +
|
|
"، محور: " +
|
|
data.accident251_point.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.operation +
|
|
'</div></div>\
|
|
<div class="col-6" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.target +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.actions +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.cost +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
data.accident251_point.end_date +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
"</div></div>\
|
|
</div>\
|
|
</div>\
|
|
"
|
|
);
|
|
} else if (
|
|
(data.target && data.target != "-") ||
|
|
(data.operation && data.operation != "-")
|
|
) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
(data.operation ? data.operation : "-") +
|
|
'</div></div>\
|
|
<div class="col-6" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
(data.target ? data.target : "-") +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
(data.actions ? data.actions : "-") +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.cost +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="popUpBox col-4" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
(data.end_date ? data.end_date : "-") +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
"</div></div>\
|
|
</div>\
|
|
</div>\
|
|
"
|
|
);
|
|
} else {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقاط پرتصادف' +
|
|
popupTitle251 +
|
|
'</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> ابتدای محور</span><div class="popUpBoxContent">' +
|
|
data.axis_start +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> انتهای محور</span><div class="popUpBoxContent">' +
|
|
data.axis_end +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> فاصله از ابتدای محور</span><div class="popUpBoxContent">' +
|
|
data.distance +
|
|
" " +
|
|
"کیلومتر" +
|
|
'</div> </div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> توصیف هندسی نقطه</span><div class="popUpBoxContent">' +
|
|
data.geometric_desc +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; text-align:center"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div> </div>\
|
|
<div class="col-4" style="text-align:center"><span class="header-popupcontent-allpoints"> طول جغرافیایی</span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
"</div></div>\
|
|
</div>\
|
|
</div>"
|
|
);
|
|
}
|
|
}
|
|
}
|
|
function showLoaderScreen() {
|
|
$(".divloader").css("display", "flex").hide().fadeIn();
|
|
}
|
|
function hideLoaderScreen() {
|
|
$(".divloader").fadeOut();
|
|
}
|
|
function getPopupContentFastReaction(data) {
|
|
console.log("hii");
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle popup-fastreact-redesign">\
|
|
<img src="../dist/images/layer-icons/emergency.svg" alt="">\
|
|
<span class="popupHeader popupheader-fastreact-redesign">واکنش سریع (کد پیگیری: ' +
|
|
data.uid +
|
|
')</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.ProvinceName +
|
|
"، شهرستان " +
|
|
data.TownName +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6 popup-header-fast popup-header-fast1" style="text-align:center"><span class="popupheader-fastreact-style"> موضوع شکایت </span><div class="popUpBoxContent">' +
|
|
data.Title +
|
|
'</div></div>\
|
|
<div class="col-6 popup-header-fast popup-header-fast2" style="text-align:center"><span class="popupheader-fastreact-style"> نوع شکایت </span><div class="popUpBoxContent">' +
|
|
data.EventTypeTitle +
|
|
'</div></div>\
|
|
<div class="popupContent col-12 popup-header-fast">\
|
|
<div style="text-align:center"><span class="popupheader-fastreact-style"> توضیح شکایت </span><div class="popUpBoxContent">' +
|
|
data.Description +
|
|
"</div></div>\
|
|
</div>"
|
|
);
|
|
}
|
|
function remove141Layer() {
|
|
if (marker141Layers != null) {
|
|
marker141List = [];
|
|
map.removeLayer(marker141Layers);
|
|
|
|
$(".left-menu-141 > .item-menu-141.item-141-active").removeClass(
|
|
"item-141-active"
|
|
);
|
|
}
|
|
|
|
if (marker141LayersWithoutCluster != null) {
|
|
map.removeLayer(marker141LayersWithoutCluster);
|
|
}
|
|
}
|
|
//mohammad modal
|
|
function getpopcounterrahdari(data, num) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../../dist/images/icons/tollHouse.svg" alt="">\
|
|
<span class="popupHeader"> راهدارخانه (' +
|
|
data.name +
|
|
') </span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province_name +
|
|
"، شهرستان: " +
|
|
data.city_name +
|
|
'</div>\
|
|
<div class="popupContent">\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> وضعیت </span><div class="popUpBoxContent">' +
|
|
data.status +
|
|
'</div></div>\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> نوع </span><div class="popUpBoxContent">' +
|
|
data.type +
|
|
'</div></div>\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> تلفن </span><div class="popUpBoxContent">' +
|
|
data.phone +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> تعداد اکیپ </span><div class="popUpBoxContent">' +
|
|
data.team_num +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> تعداد پرسنل </span><div class="popUpBoxContent">' +
|
|
data.staff_num +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> مسئول </span><div class="popUpBoxContent">' +
|
|
data.responsible_name +
|
|
"<br>" +
|
|
data.responsible_mobile +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> جانشین </span><div class="popUpBoxContent">' +
|
|
data.successor_name +
|
|
"<br>" +
|
|
data.successor_mobile +
|
|
'</div></div>\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> ماشینآلات سبک </span><div class="popUpBoxContent">' +
|
|
data.machines_light +
|
|
'</div></div>\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> ماشینآلات نیمه سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_sheavy +
|
|
'</div></div>\
|
|
<div class="popUpBoxlevel" style="width:75px"><span> ماشینآلات سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_heavy +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox" style="width:75px"><span> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point" onclick="showrahdarModalcoridor(' +
|
|
data.id +
|
|
')">بروزرسانی</button>\
|
|
</div>\
|
|
</div>'
|
|
);
|
|
}
|
|
//mohammad mohammad
|
|
function getPopupContentAccident_251(data, edit_id) {
|
|
if (edit_id == data.province_id) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقطه پرتصادف</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
data.operation +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
data.target +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter col-12">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
data.actions +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.cost +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
data.end_date +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="text-align:center;"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point btn btn-danger" onclick="showAccident251PointEditModal()">بروزرسانی</button>\
|
|
</div>\
|
|
'
|
|
);
|
|
} else {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../../dist/images/icons/por_accident_village.svg" alt="">\
|
|
<span class="popupHeader">نقطه پرتصادف</span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province +
|
|
"، محور: " +
|
|
data.native_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> عملیات مورد نیاز </span><div class="popUpBoxContent">' +
|
|
data.operation +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f;"><span class="header-popupcontent-allpoints"> هدف کمی </span><div class="popUpBoxContent">' +
|
|
data.target +
|
|
'</div></div> </div>\
|
|
<div class="popupFooter col-12">\
|
|
<span class="header-popupcontent-allpoints"> اقدامات انجام شده </span><div class="popUpBoxContent">' +
|
|
data.actions +
|
|
'</div> </div>\
|
|
</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> اعتبارات هزینه شده (میلیون ریال) </span><div class="popUpBoxContent">' +
|
|
data.cost +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> پیشرفت فیزیکی (درصد) </span><div class="popUpBoxContent">' +
|
|
data.progress +
|
|
"٪" +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تاریخ خاتمه </span><div class="popUpBoxContent">' +
|
|
data.end_date +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="text-align:center;"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
"</div></div>\
|
|
</div>"
|
|
);
|
|
}
|
|
}
|
|
function getPopupContentRahdar(data, edit_id) {
|
|
if (edit_id == data.province_id) {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../../dist/images/icons/tollHouse.svg" alt="">\
|
|
<span class="popupHeader"> راهدارخانه (' +
|
|
data.name +
|
|
') </span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province_name +
|
|
"، شهرستان: " +
|
|
data.city_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> وضعیت </span><div class="popUpBoxContent">' +
|
|
data.status +
|
|
'</div></div>\
|
|
<div class="col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> نوع </span><div class="popUpBoxContent">' +
|
|
data.type +
|
|
'</div></div>\
|
|
<div class="col-12" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تلفن </span><div class="popUpBoxContent">' +
|
|
data.phone +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تعداد اکیپ </span><div class="popUpBoxContent">' +
|
|
data.team_num +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تعداد پرسنل </span><div class="popUpBoxContent">' +
|
|
data.staff_num +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> مسئول </span><div class="popUpBoxContent">' +
|
|
data.responsible_name +
|
|
"<br>" +
|
|
data.responsible_mobile +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> جانشین </span><div class="popUpBoxContent">' +
|
|
data.successor_name +
|
|
"<br>" +
|
|
data.successor_mobile +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات سبک </span><div class="popUpBoxContent">' +
|
|
data.machines_light +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات نیمه سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_sheavy +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_heavy +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="text-align:center;"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
'</div></div>\
|
|
</div>\
|
|
<div class="popupContent-button">\
|
|
<button class="popup-btn-edit-point btn btn-danger" onclick="showrahdarModal(' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
", " +
|
|
parseFloat(data.l).toFixed(5) +
|
|
')">بروزرسانی</button>\
|
|
</div>\
|
|
</div>'
|
|
);
|
|
} else {
|
|
return (
|
|
'\
|
|
<div class="popup">\
|
|
<div class="popupTitle">\
|
|
<img src="../../dist/images/icons/tollHouse.svg" alt="">\
|
|
<span class="popupHeader"> راهدارخانه (' +
|
|
data.name +
|
|
') </span>\
|
|
</div>\
|
|
<div class="popupHeaderContent"><div class="popUpBanner">اداره کل ' +
|
|
data.province_name +
|
|
"، شهرستان: " +
|
|
data.city_name +
|
|
'</div>\
|
|
<div class="popupContent row col-12">\
|
|
<div class="col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> وضعیت </span><div class="popUpBoxContent">' +
|
|
data.status +
|
|
'</div></div>\
|
|
<div class="col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> نوع </span><div class="popUpBoxContent">' +
|
|
data.type +
|
|
'</div></div>\
|
|
<div class="col-12" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تلفن </span><div class="popUpBoxContent">' +
|
|
data.phone +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تعداد اکیپ </span><div class="popUpBoxContent">' +
|
|
data.team_num +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> تعداد پرسنل </span><div class="popUpBoxContent">' +
|
|
data.staff_num +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> مسئول </span><div class="popUpBoxContent">' +
|
|
data.responsible_name +
|
|
"<br>" +
|
|
data.responsible_mobile +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> جانشین </span><div class="popUpBoxContent">' +
|
|
data.successor_name +
|
|
"<br>" +
|
|
data.successor_mobile +
|
|
'</div></div>\
|
|
<div class=" col-4" style="border-left:2px solid #ff5c0f; border-bottom:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات سبک </span><div class="popUpBoxContent">' +
|
|
data.machines_light +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-left:2px solid #ff5c0f; border-bottom: 2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات نیمه سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_sheavy +
|
|
'</div></div>\
|
|
<div class="col-4" style="border-bottom: 2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> ماشینآلات سنگین </span><div class="popUpBoxContent">' +
|
|
data.machines_heavy +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="border-left:2px solid #ff5c0f; text-align:center;"><span class="header-popupcontent-allpoints"> عرض جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lat).toFixed(5) +
|
|
'</div></div>\
|
|
<div class="popUpBox col-6" style="text-align:center;"><span class="header-popupcontent-allpoints"> طول جغرافیایی </span><div class="popUpBoxContent">' +
|
|
parseFloat(data.lng).toFixed(5) +
|
|
"</div></div>\
|
|
</div>\
|
|
</div>"
|
|
);
|
|
}
|
|
}
|
|
function showAccidentPointEditModal() {
|
|
$("#allpointedit").modal("show");
|
|
}
|
|
$("#editpoints").on("click", function () {
|
|
saveEditedPoint();
|
|
});
|
|
|
|
function saveEditedPoint() {
|
|
if (accident251EditedPointValidate()) {
|
|
formData = new FormData();
|
|
|
|
formData.append("actions", $("#action").val());
|
|
formData.append("progress", $(".ex2").slider("getValue"));
|
|
formData.append("cost", $("#cost").val());
|
|
formData.append("end_date", $("#end-date").val());
|
|
|
|
let lat = $("#ac-point-lat").val().slice(1, -1);
|
|
let lng = $("#ac-point-lng").val().slice(1, -1);
|
|
lat = lat.replace(/_/g, "");
|
|
lng = lng.replace(/_/g, "");
|
|
formData.append("lat", lat);
|
|
formData.append("lng", lng);
|
|
|
|
for (let i = 0; i < $("input[name=modalUpFile]")[0].files.length; i++) {
|
|
formData.append(
|
|
"point_files_" + i,
|
|
$("input[name=modalUpFile]")[0].files[i]
|
|
);
|
|
}
|
|
|
|
//if ($('.ex2').slider('getValue') >= $('.ex2').attr('data-slider-value')) {
|
|
$("#pointedit").modal("hide");
|
|
showLoaderScreen();
|
|
$.ajax({
|
|
url: "/accident-251-points/" + $("#pointid").val(),
|
|
type: "POST",
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
data: formData,
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (result) {
|
|
//console.log(result);
|
|
showAccident251Points();
|
|
},
|
|
error: function (error) {
|
|
//console.log(error);
|
|
hideLoaderScreen();
|
|
},
|
|
});
|
|
/*} else {
|
|
$('#sliderphysici').find('.slider-label').text('پیشرفت فیزیکی (مقدار جدید نباید از درصد قبلی کمتر باشد)');
|
|
$('#sliderphysici').find('.slider-label').css('color', 'red');
|
|
}*/
|
|
}
|
|
}
|
|
//allpoint edit modal start
|
|
$("#alleditpoints").on("click", function () {
|
|
saveAccidentEditedPoint();
|
|
});
|
|
function saveAccidentEditedPoint() {
|
|
if (accidentEditedPointValidate()) {
|
|
formData = new FormData();
|
|
|
|
formData.append("operation", $("#alloperation").val());
|
|
formData.append("target", $("#alltarget").val());
|
|
formData.append("actions", $("#allaction").val());
|
|
formData.append("progress", $(".allex2").slider("getValue"));
|
|
formData.append("cost", $("#allcost").val());
|
|
formData.append("end_date", $("#allend-date").val());
|
|
|
|
let lat = $("#allac-point-lat").val().slice(1, -1);
|
|
let lng = $("#allac-point-lng").val().slice(1, -1);
|
|
lat = lat.replace(/_/g, "");
|
|
lng = lng.replace(/_/g, "");
|
|
formData.append("lat", lat);
|
|
formData.append("lng", lng);
|
|
|
|
for (let i = 0; i < $("input[name=allmodalUpFile]")[0].files.length; i++) {
|
|
formData.append(
|
|
"point_files_" + i,
|
|
$("input[name=allmodalUpFile]")[0].files[i]
|
|
);
|
|
}
|
|
$("#allpointedit").modal("hide");
|
|
showLoaderScreen();
|
|
$.ajax({
|
|
url: "/accident-points/" + $("#allpointid").val(),
|
|
type: "POST",
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
data: formData,
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (result) {
|
|
showRoadAccidentLayerWithoutCluster();
|
|
},
|
|
error: function (error) {
|
|
hideLoaderScreen();
|
|
},
|
|
});
|
|
}
|
|
}
|
|
function accidentEditedPointValidate() {
|
|
let isValidate = true;
|
|
if (
|
|
!$("#alloperation").val() ||
|
|
!checkPersianWordValidation($("#alloperation").val())
|
|
) {
|
|
$("#alloperation").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#alloperation").removeClass("is-invalid");
|
|
}
|
|
|
|
if (
|
|
!$("#alltarget").val() ||
|
|
!checkPersianWordValidation($("#alltarget").val())
|
|
) {
|
|
$("#alltarget").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#alltarget").removeClass("is-invalid");
|
|
}
|
|
|
|
if (
|
|
!$("#allaction").val() ||
|
|
!checkPersianWordValidation($("#allaction").val())
|
|
) {
|
|
$("#allaction").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#allaction").removeClass("is-invalid");
|
|
}
|
|
|
|
if (!$("#allcost").val()) {
|
|
$("#allcost").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#allcost").removeClass("is-invalid");
|
|
}
|
|
|
|
if (!$("#allend-date").val()) {
|
|
$("#allend-date").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#allend-date").removeClass("is-invalid");
|
|
}
|
|
|
|
if (!$("#allac-point-lat").val()) {
|
|
$("#allac-point-lat").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#allac-point-lat").removeClass("is-invalid");
|
|
}
|
|
|
|
if (!$("#allac-point-lng").val()) {
|
|
$("#allac-point-lng").addClass("is-invalid");
|
|
isValidate = false;
|
|
} else {
|
|
$("#allac-point-lng").removeClass("is-invalid");
|
|
}
|
|
|
|
return isValidate;
|
|
}
|
|
// allpoint edit modal end
|
|
|
|
// rahdar edit modal end
|
|
function showrahdarModal(start, end) {
|
|
$(".basic").spectrum({
|
|
color: "#fff",
|
|
change: function (color) {
|
|
$("#basic-log").text("رنگ " + color.toHexString());
|
|
globalcolor = color.toHexString();
|
|
console.log("gloo", globalcolor);
|
|
console.log("hexx", color.toHexString());
|
|
},
|
|
});
|
|
$("#rahdaredit").modal("show");
|
|
if (mapradar == null) {
|
|
setTimeout(() => {
|
|
// alert("hiiii")
|
|
createLeafletMap([35.6892, 51.389], [35.6892, 51.389], 0);
|
|
}, 200);
|
|
} else {
|
|
initialMarkerMapValue(35.6892, 51.389, 0);
|
|
}
|
|
|
|
//alert('این بخش به صورت آزمایشی فعال است و تغییرات ذخیره نمیشود.')
|
|
}
|
|
|
|
function showrahdarModalcoridor(id) {
|
|
$("#basic-log").css("display", "none");
|
|
|
|
console.log("test", globalmodaldata);
|
|
console.log(id);
|
|
var lat = null;
|
|
var lng = null;
|
|
for (var i = 0; i < globalmodaldata.length; i++) {
|
|
console.log("i");
|
|
if (globalmodaldata[i].id == id) {
|
|
$("[data-mask]").inputmask();
|
|
$("#houserahdar").val(globalmodaldata[i].name);
|
|
$("#rahdarid").val(globalmodaldata[i].id);
|
|
$("#edarekol").val(globalmodaldata[i].province_name);
|
|
$("#mainCity").val(globalmodaldata[i].city_name);
|
|
$("#sit").val(globalmodaldata[i].status); //action
|
|
$("#type").val(globalmodaldata[i].type);
|
|
$("#phone").val(globalmodaldata[i].phone);
|
|
$("#ekipnum").val(globalmodaldata[i].team_num);
|
|
$("#personelnum").val(globalmodaldata[i].staff_num);
|
|
$("#masol").val(globalmodaldata[i].responsible_name);
|
|
$("#masolmobile").val(globalmodaldata[i].responsible_mobile);
|
|
$("#janeshin").val(globalmodaldata[i].successor_name);
|
|
$("#janeshinmobile").val(globalmodaldata[i].successor_mobile);
|
|
$("#lightmachine").val(globalmodaldata[i].machines_light);
|
|
$("#meduimachin").val(globalmodaldata[i].machines_sheavy);
|
|
$("#bigmachin").val(globalmodaldata[i].machines_heavy);
|
|
$("#lat-rahdar").val(globalmodaldata[i].lat);
|
|
$("#lng-rahdar").val(globalmodaldata[i].lng);
|
|
lat = globalmodaldata[i].lat;
|
|
lng = globalmodaldata[i].lng;
|
|
startmarkerpin = [
|
|
globalmodaldata[i].lat_from,
|
|
globalmodaldata[i].lng_from,
|
|
];
|
|
endmarkerpin = [globalmodaldata[i].lat_to, globalmodaldata[i].lng_to];
|
|
}
|
|
}
|
|
$(".basic").spectrum({
|
|
color: "#fff",
|
|
change: function (color) {
|
|
$("#basic-log").css("display", "block");
|
|
|
|
$("#basic-log").text("رنگ " + color.toHexString());
|
|
globalcolor = color.toHexString();
|
|
console.log("gloo", globalcolor);
|
|
console.log("hexx", color.toHexString());
|
|
},
|
|
});
|
|
$("#rahdaredit").modal("show");
|
|
if (mapradar == null) {
|
|
setTimeout(() => {
|
|
console.log("far fara far", lat, lng);
|
|
if (endmarkerpin[0] != null) {
|
|
createLeafletMap([lat, lng], startmarkerpin, endmarkerpin, 1);
|
|
} else {
|
|
createLeafletMap([lat, lng], startmarkerpin, endmarkerpin, 0);
|
|
}
|
|
}, 200);
|
|
} else {
|
|
if (endmarkerpin[0] != null) {
|
|
initialMarkerMapValue(lat, lng, startmarkerpin, endmarkerpin, 1);
|
|
} else {
|
|
initialMarkerMapValue(lat, lng, startmarkerpin, endmarkerpin, 0);
|
|
}
|
|
}
|
|
|
|
//alert('این بخش به صورت آزمایشی فعال است و تغییرات ذخیره نمیشود.')
|
|
}
|
|
|
|
$("#editrahdar").on("click", function () {
|
|
saveRahdariEdited();
|
|
});
|
|
|
|
function saveRahdariEdited() {
|
|
console.log("glo", globalcolor);
|
|
// if (rahdariEditedValidate()) {
|
|
// console.log("input[name=abrar-project-latlng-start]", "input[name=abrar-project-latlng-start]".val())
|
|
// console.log("input[name=abrar-project-latlng-end]", "input[name=abrar-project-latlng-end]".val())
|
|
console.log(endAbrarMarker.getLatLng().lat.toFixed(6));
|
|
|
|
console.log(endAbrarMarker.getLatLng().lng.toFixed(6));
|
|
console.log(startAbrarMarker.getLatLng().lat.toFixed(6));
|
|
|
|
console.log(startAbrarMarker.getLatLng().lng.toFixed(6));
|
|
|
|
formData = new FormData();
|
|
|
|
formData.append("status", $("#sit").val());
|
|
formData.append("type", $("#type").val());
|
|
formData.append("phone", $("#phone").val());
|
|
formData.append("team_num", $("#ekipnum").val());
|
|
formData.append("staff_num", $("#personelnum").val());
|
|
formData.append("responsible_name", $("#masol").val());
|
|
formData.append("responsible_mobile", $("#masolmobile").val());
|
|
formData.append("successor_name", $("#janeshin").val());
|
|
formData.append("successor_mobile", $("#janeshinmobile").val());
|
|
formData.append("machines_light", $("#lightmachine").val());
|
|
formData.append("machines_sheavy", $("#meduimachin").val());
|
|
formData.append("machines_heavy", $("#bigmachin").val());
|
|
//new paramas yasiu
|
|
formData.append("lat-from", startAbrarMarker.getLatLng().lat.toFixed(6));
|
|
formData.append("lng-from", startAbrarMarker.getLatLng().lng.toFixed(6));
|
|
// formData.append("geometry",);
|
|
formData.append("color", globalcolor);
|
|
formData.append("lat-to", endAbrarMarker.getLatLng().lat.toFixed(6));
|
|
formData.append("lng-to", endAbrarMarker.getLatLng().lng.toFixed(6));
|
|
|
|
let lat = $("#lat-rahdar").val().slice(1, -1);
|
|
let lng = $("#lng-rahdar").val().slice(1, -1);
|
|
lat = lat.replace(/_/g, "");
|
|
lng = lng.replace(/_/g, "");
|
|
formData.append("lat", lat);
|
|
formData.append("lng", lng);
|
|
|
|
for (
|
|
let i = 0;
|
|
i < $("input[name=modalUpFileRahdari_overview]")[0].files.length;
|
|
i++
|
|
) {
|
|
formData.append(
|
|
"overview_files_" + i,
|
|
$("input[name=modalUpFileRahdari_overview]")[0].files[i]
|
|
);
|
|
}
|
|
|
|
for (
|
|
let i = 0;
|
|
i < $("input[name=modalUpFileRahdari_machinery]")[0].files.length;
|
|
i++
|
|
) {
|
|
formData.append(
|
|
"machinery_files_" + i,
|
|
$("input[name=modalUpFileRahdari_machinery]")[0].files[i]
|
|
);
|
|
}
|
|
|
|
for (
|
|
let i = 0;
|
|
i < $("input[name=modalUpFileRahdari_store]")[0].files.length;
|
|
i++
|
|
) {
|
|
formData.append(
|
|
"store_files_" + i,
|
|
$("input[name=modalUpFileRahdari_store]")[0].files[i]
|
|
);
|
|
}
|
|
|
|
for (
|
|
let i = 0;
|
|
i < $("input[name=modalUpFileRahdari_office]")[0].files.length;
|
|
i++
|
|
) {
|
|
formData.append(
|
|
"office_files_" + i,
|
|
$("input[name=modalUpFileRahdari_office]")[0].files[i]
|
|
);
|
|
}
|
|
|
|
for (
|
|
let i = 0;
|
|
i < $("input[name=modalUpFileRahdari_others]")[0].files.length;
|
|
i++
|
|
) {
|
|
formData.append(
|
|
"others_files_" + i,
|
|
$("input[name=modalUpFileRahdari_others]")[0].files[i]
|
|
);
|
|
}
|
|
for (var pair of formData.entries()) {
|
|
console.log(pair[0] + ", " + pair[1]);
|
|
}
|
|
$("#rahdaredit").modal("hide");
|
|
showLoaderScreen();
|
|
|
|
$.ajax({
|
|
url: "/rahdari-points/" + $("#rahdarid").val(),
|
|
type: "POST",
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
data: formData,
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (result) {
|
|
hideLoaderScreen();
|
|
console.log("ressd", result);
|
|
if (result.data.color) {
|
|
drawPathwithColor(
|
|
result.data.lat_from,
|
|
result.data.lng_from,
|
|
result.data.lat_to,
|
|
result.data.lng_to,
|
|
result.data.color
|
|
);
|
|
}
|
|
},
|
|
error: function (error) {
|
|
hideLoaderScreen();
|
|
},
|
|
});
|
|
}
|
|
|
|
function createLeafletMap(ekipP, startP, endP, update) {
|
|
console.log("ekipP", ekipP);
|
|
console.log("startP", startP);
|
|
console.log("endP", endP);
|
|
console.log("update", update);
|
|
|
|
console.log("createLeafletMap");
|
|
|
|
let bounds = [
|
|
[42.9130026312, 75.6166317076],
|
|
[20.5782370061, 35.5092252948],
|
|
];
|
|
mapradar = new L.map("abrar-map", {
|
|
maxBounds: bounds,
|
|
minZoom: 6,
|
|
}).setView(ekipP, 14);
|
|
|
|
L.tileLayer("https://testmap.141.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
|
mapradar
|
|
);
|
|
if (endP[0] != null) {
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(startP);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(endP);
|
|
$("#pin-marker-startrahdar").removeClass("pin-move").addClass("pin-set");
|
|
startAbrarMarker = new L.marker(startP, {
|
|
icon: startAbrarDivIconrahdar,
|
|
draggable: true,
|
|
}).addTo(mapradar);
|
|
ekipmarker = new L.marker(ekipP, {
|
|
icon: rahdariIconO,
|
|
draggable: true,
|
|
}).addTo(mapradar);
|
|
|
|
isSetStartAbrarMarker = true;
|
|
endAbrarMarker = new L.marker(endP, {
|
|
icon: endAbrarDivIconrahdar,
|
|
draggable: true,
|
|
}).addTo(mapradar);
|
|
isSetEndAbrarMarker = true;
|
|
$("#pin-marker-endrahdar").removeClass("pin-move").addClass("pin-set");
|
|
$("#pin-marker-startrahdar")
|
|
.removeClass("pin-move pin-warn")
|
|
.addClass("pin-set");
|
|
checkMarkersAndDrawPath(update);
|
|
|
|
startAbrarMarker.on("click", function () {
|
|
console.log("clickstart");
|
|
if (!isSetStartAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetStartAbrarMarker = true;
|
|
|
|
$("#pin-marker-startrahdar")
|
|
.removeClass("pin-move pin-warn")
|
|
.addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
let markerLatLng = [
|
|
startAbrarMarker.getLatLng().lat,
|
|
startAbrarMarker.getLatLng().lng + 0.0008,
|
|
];
|
|
|
|
mapradar.setView(markerLatLng);
|
|
}
|
|
});
|
|
} else {
|
|
$("#pin-marker-startrahdar").removeClass("pin-set").addClass("pin-move");
|
|
startAbrarMarker = new L.marker(ekipP, {
|
|
icon: startAbrarDivIconrahdar,
|
|
draggable: true,
|
|
}).addTo(mapradar);
|
|
ekipmarker = new L.marker(ekipP, {
|
|
icon: rahdariIconO,
|
|
draggable: true,
|
|
}).addTo(mapradar);
|
|
|
|
endAbrarMarker = new L.marker(endP, {
|
|
icon: endAbrarDivIconrahdar,
|
|
draggable: true,
|
|
});
|
|
startAbrarMarker.on("click", function () {
|
|
console.log("clickstart");
|
|
if (!isSetStartAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetStartAbrarMarker = true;
|
|
|
|
$("#pin-marker-startrahdar")
|
|
.removeClass("pin-move pin-warn")
|
|
.addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
let markerLatLng = [
|
|
startAbrarMarker.getLatLng().lat,
|
|
startAbrarMarker.getLatLng().lng + 0.0008,
|
|
];
|
|
|
|
mapradar.setView(markerLatLng);
|
|
|
|
endAbrarMarker.setLatLng(markerLatLng);
|
|
endAbrarMarker.addTo(mapradar);
|
|
}
|
|
});
|
|
}
|
|
|
|
mapradar.on("move", function () {
|
|
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-startrahdar").removeClass("pin-set").addClass("pin-move");
|
|
}
|
|
|
|
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-endrahdar").removeClass("pin-set").addClass("pin-move");
|
|
}
|
|
});
|
|
|
|
mapradar.on("moveend", function () {
|
|
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-startrahdar").removeClass("pin-move pin-set");
|
|
}
|
|
|
|
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-endrahdar").removeClass("pin-move pin-set");
|
|
}
|
|
});
|
|
|
|
if (endAbrarMarker) {
|
|
endAbrarMarker.on("click", function () {
|
|
console.log("clickend");
|
|
if (!isSetEndAbrarMarker) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetEndAbrarMarker = true;
|
|
|
|
$("#pin-marker-endrahdar").removeClass("pin-move").addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(
|
|
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
endAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
checkMarkersAndDrawPath(update);
|
|
}
|
|
});
|
|
|
|
endAbrarMarker.on("drag", function () {
|
|
$("#pin-marker-endrahdar").addClass("pin-move");
|
|
checkMarkersAndDrawPath(update);
|
|
});
|
|
|
|
endAbrarMarker.on("dragend", function () {
|
|
$("#pin-marker-endrahdar").removeClass("pin-move");
|
|
|
|
if (
|
|
$("#pin-marker-endrahdar").hasClass("pin-set") ||
|
|
isSetEndAbrarMarker
|
|
) {
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(
|
|
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
endAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#pin-marker-endrahdar").addClass("pin-set");
|
|
checkMarkersAndDrawPath(update);
|
|
} else {
|
|
mapradar.setView(endAbrarMarker.getLatLng());
|
|
}
|
|
});
|
|
}
|
|
//mohammad add this
|
|
function checkMarkersAndDrawPath(update) {
|
|
if (
|
|
$("#pin-marker-startrahdar").hasClass("pin-set") &&
|
|
!$("#pin-marker-startrahdar").hasClass("pin-move") &&
|
|
$("#pin-marker-endrahdar").hasClass("pin-set") &&
|
|
!$("#pin-marker-endrahdar").hasClass("pin-move")
|
|
) {
|
|
drawPath(update);
|
|
}
|
|
}
|
|
//mohammad add this
|
|
|
|
startAbrarMarker.on("drag", function () {
|
|
$("#pin-marker-startrahdar").addClass("pin-move");
|
|
checkMarkersAndDrawPath(update);
|
|
});
|
|
|
|
startAbrarMarker.on("dragend", function () {
|
|
$("#pin-marker-startrahdar").removeClass("pin-move");
|
|
|
|
if (
|
|
$("#pin-marker-startrahdar").hasClass("pin-set") ||
|
|
isSetStartAbrarMarker
|
|
) {
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#pin-marker-startrahdar").addClass("pin-set");
|
|
checkMarkersAndDrawPath(update);
|
|
} else {
|
|
mapradar.setView(startAbrarMarker.getLatLng());
|
|
}
|
|
});
|
|
}
|
|
|
|
function initialMarkerMapValue(latP, lngP, startPin, endPin, update) {
|
|
console.log("initialMarkerMapValue");
|
|
if (endPin[0] == null) {
|
|
if (isSetStartAbrarMarker) {
|
|
endAbrarMarker.remove();
|
|
}
|
|
isSetEndAbrarMarker = false;
|
|
startAbrarMarker.setLatLng([latP, lngP]);
|
|
endAbrarMarker.setLatLng([latP, lngP]);
|
|
|
|
isSetStartAbrarMarker = false;
|
|
removeStartToEndPath(0);
|
|
$("#pin-marker-endrahdar").removeClass("pin-marker pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val("");
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val("");
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
console.log("createLeafletMap");
|
|
$("#pin-marker-startrahdar").removeClass("pin-set").addClass("pin-move");
|
|
startAbrarMarker.on("click", function () {
|
|
console.log("clickstart");
|
|
if (!isSetStartAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetStartAbrarMarker = true;
|
|
|
|
$("#pin-marker-startrahdar")
|
|
.removeClass("pin-move pin-warn")
|
|
.addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
let markerLatLng = [
|
|
startAbrarMarker.getLatLng().lat,
|
|
startAbrarMarker.getLatLng().lng + 0.0008,
|
|
];
|
|
|
|
mapradar.setView(markerLatLng);
|
|
|
|
endAbrarMarker.setLatLng(markerLatLng);
|
|
endAbrarMarker.addTo(mapradar);
|
|
}
|
|
});
|
|
} else {
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(startPin);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(endPin);
|
|
isSetEndAbrarMarker = true;
|
|
isSetStartAbrarMarker = true;
|
|
startAbrarMarker.setLatLng(startPin);
|
|
endAbrarMarker.setLatLng(endPin);
|
|
checkMarkersAndDrawPath(update);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#pin-marker-startrahdar").removeClass("pin-move").addClass("pin-set");
|
|
$("#pin-marker-endrahdar").removeClass("pin-move").addClass("pin-set");
|
|
startAbrarMarker.on("click", function () {
|
|
console.log("clickstart");
|
|
if (!isSetStartAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetStartAbrarMarker = true;
|
|
|
|
$("#pin-marker-startrahdar")
|
|
.removeClass("pin-move pin-warn")
|
|
.addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
let markerLatLng = [
|
|
startAbrarMarker.getLatLng().lat,
|
|
startAbrarMarker.getLatLng().lng + 0.0008,
|
|
];
|
|
|
|
mapradar.setView(markerLatLng);
|
|
}
|
|
});
|
|
}
|
|
|
|
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) {
|
|
console.log("eeeeee", e);
|
|
})
|
|
.addTo(mapradar)
|
|
);
|
|
|
|
mapradar.setView([latP, lngP], 9);
|
|
ekipmarker.setLatLng([latP, lngP]);
|
|
|
|
mapradar.on("move", function () {
|
|
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-startrahdar").removeClass("pin-set").addClass("pin-move");
|
|
}
|
|
|
|
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-endrahdar").removeClass("pin-set").addClass("pin-move");
|
|
}
|
|
});
|
|
|
|
mapradar.on("moveend", function () {
|
|
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
|
startAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-startrahdar").removeClass("pin-move pin-set");
|
|
}
|
|
|
|
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
$("#pin-marker-endrahdar").removeClass("pin-move pin-set");
|
|
}
|
|
});
|
|
|
|
if (endAbrarMarker) {
|
|
endAbrarMarker.on("click", function () {
|
|
console.log("clickend");
|
|
if (!isSetEndAbrarMarker) {
|
|
endAbrarMarker.setLatLng(L.latLng(mapradar.getCenter()));
|
|
isSetEndAbrarMarker = true;
|
|
|
|
$("#pin-marker-endrahdar").removeClass("pin-move").addClass("pin-set");
|
|
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(
|
|
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
endAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
|
|
checkMarkersAndDrawPath(update);
|
|
}
|
|
});
|
|
|
|
endAbrarMarker.on("drag", function () {
|
|
$("#pin-marker-endrahdar").addClass("pin-move");
|
|
checkMarkersAndDrawPath(update);
|
|
});
|
|
|
|
endAbrarMarker.on("dragend", function () {
|
|
$("#pin-marker-endrahdar").removeClass("pin-move");
|
|
|
|
if (
|
|
$("#pin-marker-endrahdar").hasClass("pin-set") ||
|
|
isSetEndAbrarMarker
|
|
) {
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").val(
|
|
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
endAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-end]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#pin-marker-endrahdar").addClass("pin-set");
|
|
checkMarkersAndDrawPath(update);
|
|
} else {
|
|
mapradar.setView(endAbrarMarker.getLatLng());
|
|
}
|
|
});
|
|
}
|
|
|
|
startAbrarMarker.on("drag", function () {
|
|
$("#pin-marker-startrahdar").addClass("pin-move");
|
|
checkMarkersAndDrawPath(update);
|
|
});
|
|
|
|
startAbrarMarker.on("dragend", function () {
|
|
$("#pin-marker-startrahdar").removeClass("pin-move");
|
|
|
|
if (
|
|
$("#pin-marker-startrahdar").hasClass("pin-set") ||
|
|
isSetStartAbrarMarker
|
|
) {
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").val(
|
|
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
|
startAbrarMarker.getLatLng().lng.toFixed(6)
|
|
);
|
|
$("#rahdaredit input[name=abrar-project-latlng-start]").removeClass(
|
|
"is-invalid-input"
|
|
);
|
|
$("#pin-marker-startrahdar").addClass("pin-set");
|
|
checkMarkersAndDrawPath(update);
|
|
} else {
|
|
mapradar.setView(startAbrarMarker.getLatLng());
|
|
}
|
|
});
|
|
}
|
|
function removeStartToEndPath(update) {
|
|
if (routeControls.length) {
|
|
$(routeControls).each(function (index, control) {
|
|
mapradar.removeControl(control);
|
|
|
|
routeControls.splice(routeControls.indexOf(index), 1);
|
|
});
|
|
}
|
|
}
|
|
// rahdar edit modal end
|
|
//route in end
|
|
function removeStartToEndPath(update) {
|
|
if (routeControls.length) {
|
|
$(routeControls).each(function (index, control) {
|
|
mapradar.removeControl(control);
|
|
|
|
routeControls.splice(routeControls.indexOf(index), 1);
|
|
});
|
|
}
|
|
}
|
|
//route in end
|
|
function showAccident251PointEditModal() {
|
|
$("#pointedit").modal("show");
|
|
//alert('این بخش به صورت آزمایشی فعال است و تغییرات ذخیره نمیشود.')
|
|
}
|
|
// showlayer
|
|
function showlayer(index) {
|
|
if (marker141Layers != null) {
|
|
marker141List = [];
|
|
map.removeLayer(marker141Layers);
|
|
}
|
|
|
|
if (marker141LayersWithoutCluster != null) {
|
|
map.removeLayer(marker141LayersWithoutCluster);
|
|
}
|
|
|
|
//showLoaderScreen();
|
|
function clickfindshow(index) {
|
|
itempoint = index + 1;
|
|
// console.log("item", itempoint)
|
|
}
|
|
|
|
switch (index) {
|
|
case 0: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
break;
|
|
}
|
|
case 1: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 2: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 3: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 4: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 5: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 6: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 7: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 8: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 9: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 10: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 11: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 12: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 13: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 14: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
case 15: {
|
|
$("#choosetime").modal("show");
|
|
clickfindshow(index);
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
frommDate = $("#datepickfromdate").persianDatepicker({
|
|
format: "YYYY/MM/DD",
|
|
autoClose: true,
|
|
onSelect: function (unix) {
|
|
frommDate.touched = true;
|
|
|
|
$("#datepicktodate").prop("disabled", "");
|
|
|
|
if (
|
|
frommDate.getState().selected.unixDate >=
|
|
tooDate.getState().selected.unixDate
|
|
) {
|
|
tooDate.setDate(frommDate.getState().selected.unixDate);
|
|
}
|
|
|
|
if (tooDate && tooDate.options && tooDate.options.minDate != unix) {
|
|
let cachedValue = tooDate.getState().selected.unixDate;
|
|
|
|
tooDate.options = { minDate: unix };
|
|
|
|
if (tooDate.touched) {
|
|
tooDate.setDate(cachedValue);
|
|
}
|
|
}
|
|
},
|
|
});
|
|
|
|
tooDate = $("#datepicktodate").persianDatepicker({
|
|
format: "YYYY/MM/DD",
|
|
autoClose: true,
|
|
onSelect: function (unix) {
|
|
tooDate.touched = true;
|
|
},
|
|
});
|
|
var showFastReactionPoint = false;
|
|
$("#chooseclock").on("click", function () {
|
|
// console.log("hiihii", itempoint)
|
|
$("#choosetime").modal("hide");
|
|
|
|
if (
|
|
$("#datepickfromdate").val() != " " &&
|
|
$("#datepicktodate").val() != " "
|
|
) {
|
|
let startDate = moment(
|
|
frommDate.getState().selected.year +
|
|
"/" +
|
|
frommDate.getState().selected.month +
|
|
"/" +
|
|
frommDate.getState().selected.date,
|
|
"jYYYY/jM/jD"
|
|
).format("YYYY-MM-DD");
|
|
let endDate = moment(
|
|
tooDate.getState().selected.year +
|
|
"/" +
|
|
tooDate.getState().selected.month +
|
|
"/" +
|
|
tooDate.getState().selected.date,
|
|
"jYYYY/jM/jD"
|
|
).format("YYYY-MM-DD");
|
|
|
|
if (showFastReactionPoint) {
|
|
showFastFunction(startDate, endDate);
|
|
} else {
|
|
showLoaderScreen();
|
|
$.ajax({
|
|
url:
|
|
"/homeprojects/roaditems/points" +
|
|
"?item=" +
|
|
itempoint +
|
|
"&end-date=" +
|
|
endDate +
|
|
"&start-date=" +
|
|
startDate,
|
|
type: "GET",
|
|
success: function (result) {
|
|
// console.log("resssss", result.data);
|
|
show_point(result.data);
|
|
|
|
// hideLoaderScreen();
|
|
},
|
|
error: function (error) {
|
|
//console.log(error);
|
|
hideLoaderScreen();
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
// showlayer
|
|
function showDailyRahdariActivity() {
|
|
$(".parent_menu_vertical").css("visibility", "unset");
|
|
// something for vertical menu
|
|
fisheyeMenu({
|
|
growRatio: 1.7,
|
|
verticalLimit: 10,
|
|
horizontalLimit: 1.8,
|
|
});
|
|
|
|
function fisheyeMenu(options) {
|
|
// get all items from fisheye-menu
|
|
var items = Array.prototype.slice.call(
|
|
document.querySelectorAll(".fisheye-menu button.layerButton")
|
|
);
|
|
var item = items[0];
|
|
//get horizontal center point of each item
|
|
var itemsMiddle = items.map(function (item) {
|
|
return item.offsetLeft + item.offsetWidth / 2;
|
|
});
|
|
//get vertical center point of each item
|
|
var itemsVertMiddle = items.map(function (item) {
|
|
return item.offsetTop + item.offsetHeight / 2;
|
|
});
|
|
|
|
var itemWidth = item.offsetWidth;
|
|
// vertical limits of function running
|
|
var topLimit = item.offsetParent.offsetTop - (options.verticalLimit || 10);
|
|
var bottomLimit =
|
|
item.offsetParent.offsetTop +
|
|
item.offsetHeight +
|
|
(options.verticalLimit || 10);
|
|
// ratio of new size to default
|
|
var growRatio = options.growRatio || 1.8;
|
|
// horizontal limit of grow reaction for single item
|
|
var limit = item.offsetWidth * (options.horizontalLimit || 1.5);
|
|
|
|
var sizeDiff = Math.round(itemWidth * (growRatio - 1));
|
|
|
|
var removeGoDown = function (evt) {
|
|
evt.target.parentNode.classList.remove("go-down");
|
|
};
|
|
var setListeners = (function () {
|
|
items.forEach(function (itm, index) {
|
|
itm.addEventListener("transitionend", removeGoDown);
|
|
});
|
|
})();
|
|
|
|
var makeItemBigger = function (x, y) {
|
|
var verticallyCorrect = y > topLimit && y < bottomLimit ? true : false;
|
|
|
|
// if mouse out from vertically cirrect area make items small with transition
|
|
if (!verticallyCorrect && !item.parentNode.classList.contains("go-down")) {
|
|
item.parentNode.classList.add("go-down");
|
|
}
|
|
|
|
// if (verticallyCorrect) {
|
|
// let menuWidth = $('.menu_vertical').css('width');
|
|
// $('.menu_vertical').css('width', 'calc(' + menuWidth + ' + 50px')
|
|
// }
|
|
|
|
items.forEach(function (item, index) {
|
|
|
|
var middlePoint = itemsMiddle[index];
|
|
// horizontal distance from center point to cursor
|
|
var dist = Math.abs(x - middlePoint);
|
|
|
|
// if distance is bigger than limit in any direction
|
|
// ratio is equal to 1 (item size not changed)
|
|
var ratio = dist > limit ? 1 : dist / limit;
|
|
|
|
ratio = verticallyCorrect ? ratio : 1;
|
|
|
|
var newSize = itemWidth + (1 - ratio) * sizeDiff;
|
|
// add negative top margin to item equal to half size difference
|
|
// to stay item vertical centered
|
|
var newMarginTop = -((1 - ratio) * (sizeDiff / 2));
|
|
item.style.width = newSize + "px";
|
|
item.style.height = newSize + "px";
|
|
item.style.marginTop = newMarginTop + "px";
|
|
});
|
|
};
|
|
|
|
document.body.addEventListener("mousemove", function (e) {
|
|
// position of cursor
|
|
var pointerX = e.pageX;
|
|
var pointerY = e.pageY;
|
|
makeItemBigger(pointerX, pointerY);
|
|
});
|
|
}
|
|
// something for vertical menu
|
|
}
|
|
function getMaintenanceProjects() {
|
|
showLoaderScreen();
|
|
$.ajax({
|
|
url: "https://rms.rmto.ir/public/road-maintenance-project/getpoints",
|
|
type: "GET",
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (result) {
|
|
// console.log(result.data[2]);
|
|
|
|
let markerG = [];
|
|
let markerGConstructionRural = [];
|
|
let markerGTechnicalBuilding = [];
|
|
let markerGUpgradeSafety = [];
|
|
let markerGTollhouseManagement = [];
|
|
let markerGDangerPrevention = [];
|
|
let roadMaintenancePoints = result.data;
|
|
let roadConstructionRuralPoints = result.RoadConstructionRural;
|
|
let roadTechnicalBuildingPoints = result.RoadTechnicalBuilding;
|
|
let roadUpgradeSafetyPoints = result.RoadUpgradeSafety;
|
|
let roadTollhouseManagementPoints = result.RoadTollhouseManagement;
|
|
let roadDangerPreventionPoints = result.RoadDangerPrevention;
|
|
// console.log("all "+result)
|
|
$.each(roadMaintenancePoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = greenIcon;
|
|
if (value.physical_progress < "50") setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 1), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
1
|
|
);
|
|
});
|
|
markerG.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
$.each(roadConstructionRuralPoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = redIconFix;
|
|
// if (value.physical_progress < "50")
|
|
// setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 2), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
// console.log("imagekol" , imagekol)
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
2
|
|
);
|
|
});
|
|
markerGConstructionRural.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
$.each(roadTechnicalBuildingPoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = technicalBuildingIcon;
|
|
// if (value.physical_progress < "50")
|
|
// setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 3), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
// console.log("imagekol" , imagekol)
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
3
|
|
);
|
|
});
|
|
markerGTechnicalBuilding.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
$.each(roadUpgradeSafetyPoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = upgradeSafetyIcon;
|
|
// if (value.physical_progress < "50")
|
|
// setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 4), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
// console.log("imagekol" , imagekol)
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
4
|
|
);
|
|
});
|
|
markerGUpgradeSafety.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
$.each(roadTollhouseManagementPoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = tollhouseManagementIcon;
|
|
// if (value.physical_progress < "50")
|
|
// setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 5), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
// console.log("imagekol" , imagekol)
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
5
|
|
);
|
|
});
|
|
markerGTollhouseManagement.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
$.each(roadDangerPreventionPoints, function (key, value) {
|
|
// console.log( value.id );
|
|
try {
|
|
// console.log(value.physical_progress);
|
|
// imagekol = value.images
|
|
// console.log("imagekol" , imagekol)
|
|
let setIcon = dangerPreventionIcon;
|
|
// if (value.physical_progress < "50")
|
|
// setIcon = redIconFix;
|
|
|
|
if (value.start_latlng != null) {
|
|
let marker = L.marker(value.start_latlng, {
|
|
icon: setIcon,
|
|
// content: roadMaintenancePoints[i],
|
|
})
|
|
.bindPopup(getPopupContentMaintenance(value, 6), {
|
|
className: "customPopupStyle",
|
|
})
|
|
.on("click", function (e) {
|
|
(imagekol = value.images),
|
|
// console.log("imagekol" , imagekol)
|
|
GenerateTablestart(
|
|
value.id,
|
|
value.project_distance_update,
|
|
6
|
|
);
|
|
});
|
|
markerGDangerPrevention.push(marker);
|
|
} else {
|
|
console.log("Number of null coordinates!");
|
|
}
|
|
//marker141Layers.push(marker);
|
|
//map.addLayer(marker)
|
|
} catch (e) {
|
|
//
|
|
}
|
|
});
|
|
// console.log("roadMaintenancePoints" , roadMaintenancePoints.length)
|
|
|
|
// for (let i = 0; i < roadMaintenancePoints.length; i++) {
|
|
|
|
// }
|
|
marker141Layers = L.layerGroup(markerG);
|
|
marker141LayersConstructionRural = L.layerGroup(markerGConstructionRural);
|
|
marker141LayersTechnicalBuilding = L.layerGroup(markerGTechnicalBuilding);
|
|
marker141LayersUpgradeSafety = L.layerGroup(markerGUpgradeSafety);
|
|
marker141LayersDangerPrevention = L.layerGroup(markerGDangerPrevention);
|
|
marker141LayersTollhouseManagement = L.layerGroup(
|
|
markerGTollhouseManagement
|
|
);
|
|
// marker141Layers.addLayers(marker141List);
|
|
map.addLayer(marker141Layers);
|
|
map.addLayer(marker141LayersConstructionRural);
|
|
map.addLayer(marker141LayersTechnicalBuilding);
|
|
map.addLayer(marker141LayersUpgradeSafety);
|
|
map.addLayer(marker141LayersDangerPrevention);
|
|
map.addLayer(marker141LayersTollhouseManagement);
|
|
console.log("hi every thing is ok");
|
|
hideLoaderScreen();
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
hideLoaderScreen();
|
|
},
|
|
});
|
|
}
|
|
|
|
$("#rishe1").on("click", function () {
|
|
if ($("#rishe1").is(":checked")) {
|
|
$("#rishe1").removeAttr("checked");
|
|
map.addLayer(marker141Layers);
|
|
} else {
|
|
$("#rishe1").attr("Checked", "Checked");
|
|
map.removeLayer(marker141Layers);
|
|
}
|
|
});
|
|
$("#rishe2").on("click", function () {
|
|
if ($("#rishe2").is(":checked")) {
|
|
$("#rishe2").removeAttr("checked");
|
|
map.addLayer(marker141LayersDangerPrevention);
|
|
} else {
|
|
$("#rishe2").attr("Checked", "Checked");
|
|
map.removeLayer(marker141LayersDangerPrevention);
|
|
}
|
|
});
|
|
$("#rishe3").on("click", function () {
|
|
if ($("#rishe3").is(":checked")) {
|
|
$("#rishe3").removeAttr("checked");
|
|
map.addLayer(marker141LayersUpgradeSafety);
|
|
} else {
|
|
$("#rishe3").attr("Checked", "Checked");
|
|
map.removeLayer(marker141LayersUpgradeSafety);
|
|
}
|
|
});
|
|
$("#rishe4").on("click", function () {
|
|
if ($("#rishe4").is(":checked")) {
|
|
$("#rishe4").removeAttr("checked");
|
|
map.addLayer(marker141LayersTechnicalBuilding);
|
|
} else {
|
|
$("#rishe4").attr("Checked", "Checked");
|
|
map.removeLayer(marker141LayersTechnicalBuilding);
|
|
}
|
|
});
|
|
$("#rishe5").on("click", function () {
|
|
if ($("#rishe5").is(":checked")) {
|
|
$("#rishe5").removeAttr("checked");
|
|
map.addLayer(marker141LayersTollhouseManagement);
|
|
} else {
|
|
$("#rishe5").attr("Checked", "Checked");
|
|
map.removeLayer(marker141LayersTollhouseManagement);
|
|
}
|
|
});
|
|
$("#rishe6").on("click", function () {
|
|
if ($("#rishe6").is(":checked")) {
|
|
$("#rishe6").removeAttr("checked");
|
|
map.addLayer(marker141LayersConstructionRural);
|
|
} else {
|
|
$("#rishe6").attr("Checked", "Checked");
|
|
map.removeLayer(marker141LayersConstructionRural);
|
|
}
|
|
}); |