var PERMISSIONS = [] var hideChartLable = getWidth() < 508 ? false : true; var daynamestr = ""; var dayshowname = ""; var monthnum = 0; var monthshowname = ""; var newMoment = moment(); daynamestr = newMoment.format("dddd"); monthnum = newMoment.format("jMM"); if (monthnum == 1) { monthshowname = "فروردین"; } else if (monthnum == 2) { monthshowname = "اردیبهشت"; } else if (monthnum == 3) { monthshowname = "خرداد"; } else if (monthnum == 4) { monthshowname = "تیر"; } else if (monthnum == 5) { monthshowname = "مرداد"; } else if (monthnum == 6) { monthshowname = "شهریور"; } else if (monthnum == 7) { monthshowname = "مهر"; } else if (monthnum == 8) { monthshowname = "آبان"; } else if (monthnum == 9) { monthshowname = "آذر"; } else if (monthnum == 10) { monthshowname = "دی"; } else if (monthnum == 11) { monthshowname = "بهمن"; } else if (monthnum == 12) { monthshowname = "اسفند "; } if (daynamestr == "Monday") { dayshowname = "دوشنبه"; } else if (daynamestr == "Tuesday") { dayshowname = "سه شنبه"; } else if (daynamestr == "Wednesday") { dayshowname = "چهارشنبه"; } else if (daynamestr == "Thursday") { dayshowname = "پنجشنبه"; } else if (daynamestr == "Friday") { dayshowname = "جمعه"; } else if (daynamestr == "Saturday") { dayshowname = "شنبه"; } else if (daynamestr == "Sunday") { dayshowname = "یکشنبه"; } document.getElementById("dayname").innerHTML = dayshowname + " "; document.getElementById("showday").innerHTML = newMoment.format("jDD") + " "; document.getElementById("showmonth").innerHTML = monthshowname + " "; document.getElementById("showyear").innerHTML = newMoment.format("jYYYY") + " "; var Bdata = null; var WindowWidth = null; WindowWidth = $(window).width(); var picturenumber; var imagekol = ""; Chart.defaults.global.defaultFontFamily = "IRANSansFaNum"; var chartColors = [ "#ed145b", "#92278f", "#662d91", "#2e3192", "#0054a6", "#00aeef", "#00a651", "#39b54a", "#8dc63f", "#fff200", "#f7941d", "#f26522", "#4962ac", ]; var Chartmostgreen = [ "rgba(204, 255, 102)", "rgba(204, 255, 0)", "rgba(204, 255, 204)", ]; var chartleastred = [ "rgba(255, 153, 102)", "rgba(204, 102, 102)", "rgba(255, 0, 0)", ]; $(document).ready(function () { // Swal.fire({ // icon: "warning", // title: "اطلاع رسانی", // text: "به دلیل مشکلات زیر ساختی نقشه در تمامی صفحات دارای مشکل میباشد باشماره (84498080) تماس بگیرید", // showCancelButton: true, // showConfirmButton: false, // cancelButtonText: "بستن", // }) $.ajax({ url: "https://rms.rmto.ir/webapi/user/get-permission", type: "GET", cache: false, async: false, contentType: false, processData: false, beforeSend: function () { showLoaderScreen(); }, success: function (result) { PERMISSIONS = result.data hideLoaderScreen(); }, error: function () { hideLoaderScreen(); Swal.fire({ icon: "error", title: "خطا", text: 'مشکل در دریافت سطح دسترسی', confirmButtonText: "بروزرسانی صفحه", showLoaderOnConfirm: true, preConfirm: () => { location.reload(true); }, }); } }) /// [START] road_item_btn if (!($.inArray('add-road-item', PERMISSIONS) != -1)) $('#startfaliat').remove() /// [END] road_item_btn showFastReactionCounter(); picturenumber = Math.floor(Math.random() * 18) + 1; if (picturenumber == 1) { imagekol = "../dist/images/modalrms/100.jpg"; } else if (picturenumber == 2) { imagekol = "../dist/images/modalrms/101.jpg"; } else if (picturenumber == 3) { imagekol = "../dist/images/modalrms/102.jpg"; } else if (picturenumber == 4) { imagekol = "../dist/images/modalrms/103.jpg"; } else if (picturenumber == 5) { imagekol = "../dist/images/modalrms/104.jpg"; } else if (picturenumber == 6) { imagekol = "../dist/images/modalrms/105.jpg"; } else if (picturenumber == 7) { imagekol = "../dist/images/modalrms/106.jpg"; } else if (picturenumber == 8) { imagekol = "../dist/images/modalrms/107.jpg"; } else if (picturenumber == 9) { imagekol = "../dist/images/modalrms/108.jpg"; } else if (picturenumber == 10) { imagekol = "../dist/images/modalrms/109.jpg"; } else if (picturenumber == 11) { imagekol = "../dist/images/modalrms/110.jpg"; } else if (picturenumber == 12) { imagekol = "../dist/images/modalrms/111.jpg"; } else if (picturenumber == 13) { imagekol = "../dist/images/modalrms/112.jpg"; } else if (picturenumber == 14) { imagekol = "../dist/images/modalrms/111.jpg"; } else if (picturenumber == 15) { imagekol = "../dist/images/modalrms/111.jpg"; } else if (picturenumber == 16) { imagekol = "../dist/images/modalrms/111.jpg"; } else if (picturenumber == 17) { imagekol = "../dist/images/modalrms/111.jpg"; } else if (picturenumber == 18) { imagekol = "../dist/images/modalrms/13.jpg"; } $(".bodypic").css({ "background-image": "url(" + imagekol + ")" }); if (WindowWidth <= 800) { $(".logoPart").empty(); $(".logoPart").append( '
\ \ \
\
\ \ تماس با ما\ \
' ); } //for rahdari projects $.ajax({ url: "https://rms.rmto.ir/public/bama-homepage", type: "GET", beforeSend: function () { showLoaderScreen(); }, success: function (result) { ShowBi(result); hideLoaderScreen(); }, error: function (error) { hideLoaderScreen(); }, }); //for rahdari projects //for money camp //for money camp }); $("#gharargah").on("click", function () { let labels = []; //Asli let lenghtAsliBarf = 0; let lenghtAsliseyl = 0; let lenghtAsliRizesh = 0; let lenghtAsliSayer = 0; let lenghtAsliTofan = 0; let cntAsliBarf = 0; let cntAsliseyl = 0; let cntAsliRizesh = 0; let cntAsliSayer = 0; let cntAsliTofan = 0; //End Asli //Fari let lenghtFariBarf = 0; let lenghtFariseyl = 0; let lenghtFariRizesh = 0; let lenghtFariSayer = 0; let lenghtFariTofan = 0; let cntFariBarf = 0; let cntFariseyl = 0; let cntFariRizesh = 0; let cntFariSayer = 0; let cntFariTofan = 0; //End Fari //Rostayi let lenghtRostayiBarf = 0; let lenghtRostayiseyl = 0; let lenghtRostayiRizesh = 0; let lenghtRostayiSayer = 0; let lenghtRostayiTofan = 0; let cntRostayiBarf = 0; let cntRostayiseyl = 0; let cntRostayiRizesh = 0; let cntRostayiSayer = 0; let cntRostayiTofan = 0; //End Rostayi // Bozorgrah let lenghtBozorgrahBarf = 0; let lenghtBozorgrahseyl = 0; let lenghtBozorgrahRizesh = 0; let lenghtBozorgrahSayer = 0; let lenghtBozorgrahTofan = 0; let cntBozorgrahBarf = 0; let cntBozorgrahseyl = 0; let cntBozorgrahRizesh = 0; let cntBozorgrahSayer = 0; let cntBozorgrahTofan = 0; //End Bozorgrah //Azadrah let lenghtAzadrahBarf = 0; let lenghtAzadrahseyl = 0; let lenghtAzadrahRizesh = 0; let lenghtAzadrahSayer = 0; let lenghtAzadrahTofan = 0; let cntAzadrahBarf = 0; let cntAzadrahseyl = 0; let cntAzadrahRizesh = 0; let cntAzadrahSayer = 0; let cntAzadrahTofan = 0; //End Azadrah $.ajax({ url: "https://rms.rmto.ir/api/statics/camp", type: "GET", beforeSend: function () { showLoaderScreen(); }, success: function (res) { $("#bl_len_length").each(function () { var $this = $(this); $({ countNum: $this.text() }).animate({ countNum: res.charts.staticks[0].bl_len, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.round(this.countNum)); }, complete: function () { $this.text(Math.round(this.countNum)); }, }); }); campMoney = res.charts.staticks[0].money; $(".money_camp").text(campMoney); campMoney = res.charts.staticks[0].dmg; $(".car_camp").text(campMoney); campMoney = res.charts.staticks[0].car; $(".rahdar_camp").text(campMoney); campMoney = res.charts.staticks[0].rahdar; $(".dmg_camp").text(campMoney); //gharargah var ghararfirsttext = document .getElementById("ghararfirst") .getContext("2d"); var ghararfirst = new Chart(ghararfirsttext, { type: "doughnut", data: { datasets: [{ data: [ res.charts.pies[0].cnt, res.charts.pies[1].cnt, res.charts.pies[2].cnt, res.charts.pies[3].cnt, ], backgroundColor: [ chartColors[0], chartColors[1], chartColors[2], chartColors[3], chartColors[4], ], // labels: [ // "برف" + " (" + res.charts.pies[0].cnt + ")", // "سیل" + " (" + res.charts.pies[1].cnt + ")", // "رانش و ریزش" + " (" + res.charts.pies[2].cnt + ")", // "سایر" + " (" + res.charts.pies[3].cnt + ")" // ], },], // labels: ["برف", "سیل", "رانش و ریزش", "سایر"], labels: [ "برف" + " (" + res.charts.pies[0].cnt + ")", "سیل" + " (" + res.charts.pies[1].cnt + ")", "رانش و ریزش" + " (" + res.charts.pies[2].cnt + ")", "سایر" + " (" + res.charts.pies[3].cnt + ")" ], }, options: { plugins: { datalabels: { anchor: "center", align: "center", offset: 10, color: "#fffff", }, }, responsive: true, legend: { // display: hideChartLable, position: "left", rtl: true, labels: { boxWidth: 13, fontSize: 11, fontStyle: "bold", fontColor: "#000", }, }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }); var ghararsectext = document .getElementById("ghararsecond") .getContext("2d"); var ghararsecond = new Chart(ghararsectext, { type: "doughnut", data: { datasets: [{ data: [ res.charts.pies[0].lenght, res.charts.pies[1].lenght, res.charts.pies[2].lenght, res.charts.pies[3].lenght, ], backgroundColor: [ chartColors[0], chartColors[1], chartColors[2], chartColors[3], chartColors[4], ], },], // labels: ["برف", "سیل", "رانش و ریزش", "سایر"], labels: [ "برف" + " (" + res.charts.pies[0].lenght + ")", "سیل" + " (" + res.charts.pies[1].lenght + ")", "رانش و ریزش" + " (" + res.charts.pies[2].lenght + ")", "سایر" + " (" + res.charts.pies[3].lenght + ")" ], }, options: { plugins: { datalabels: { anchor: "center", align: "center", offset: 10, color: "#fffff", }, }, responsive: true, legend: { // display: hideChartLable, position: "left", rtl: true, labels: { boxWidth: 13, fontSize: 11, fontStyle: "bold", fontColor: "#000", }, }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }); var ghararthirdtext = document .getElementById("ghararthird") .getContext("2d"); var ghararsecond = new Chart(ghararthirdtext, { type: "bar", data: { labels: ["اصلی", "فرعی", "روستایی", "بزرگراه", "آزادراه"], datasets: [{ label: "برف طول", type: "bar", stack: "cnt", backgroundColor: "#4929ac", }, { label: "سیل طول", type: "bar", stack: "cnt", backgroundColor: "#202be0", }, { label: "رانش طول", type: "bar", stack: "cnt", backgroundColor: "#a83297", }, { label: "سایر طول", type: "bar", stack: "cnt", backgroundColor: "#7332a8", }, { label: "طوفان طول", type: "bar", stack: "cnt", backgroundColor: "#db7676", }, { label: "برف", type: "bar", stack: "lenght", backgroundColor: "#f8981f", }, { label: "سیل", type: "bar", stack: "lenght", backgroundColor: "red", backgroundColorHover: "#3e95cd", }, { label: "رانش", type: "bar", stack: "lenght", backgroundColor: "yellow", backgroundColorHover: "#3e95cd", }, { label: "سایر", type: "bar", stack: "lenght", backgroundColor: "blue", backgroundColorHover: "#3e95cd", }, { label: "طوفان", type: "bar", stack: "lenght", backgroundColor: "orange", backgroundColorHover: "#3e95cd", }, ], }, options: { plugins: { datalabels: { anchor: "center", align: "center", offset: 10, color: "#fffff", }, }, responsive: true, legend: { display: false, position: "left", rtl: true, labels: { boxWidth: 13, }, }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }); res.charts.stack.forEach(function (element) { labels.push(element.axis_type_fa); if (element.axis_type == 5) { if (element.blockage_cause == 1) { lenghtBozorgrahBarf += element.lenght; cntBozorgrahBarf += element.cnt; } if (element.blockage_cause == 2) { lenghtBozorgrahseyl += element.lenght; cntBozorgrahseyl += element.cnt; } if (element.blockage_cause == 3) { lenghtBozorgrahRizesh += element.lenght; cntBozorgrahRizesh += element.cnt; } if (element.blockage_cause == 4) { lenghtBozorgrahSayer += element.lenght; cntBozorgrahSayer += element.cnt; } if (element.blockage_cause == 5) { lenghtBozorgrahTofan += element.lenght; cntBozorgrahTofan += element.cnt; } } if (element.axis_type == 2) { if (element.blockage_cause == 1) { lenghtAsliBarf += element.lenght; cntAsliBarf += element.cnt; } if (element.blockage_cause == 2) { lenghtAsliseyl += element.lenght; cntAsliseyl += element.cnt; } if (element.blockage_cause == 3) { lenghtAsliRizesh += element.lenght; cntAsliRizesh += element.cnt; } if (element.blockage_cause == 4) { lenghtAsliSayer += element.lenght; cntAsliSayer += element.cnt; } if (element.blockage_cause == 5) { lenghtAsliTofan += element.lenght; cntAsliTofan += element.cnt; } } if (element.axis_type == 3) { if (element.blockage_cause == 1) { lenghtFariBarf += element.lenght; cntFariBarf += element.cnt; } if (element.blockage_cause == 2) { lenghtFariseyl += element.lenght; cntFariseyl += element.cnt; } if (element.blockage_cause == 3) { lenghtFariRizesh += element.lenght; cntFariRizesh += element.cnt; } if (element.blockage_cause == 4) { lenghtFariSayer += element.lenght; cntFariSayer += element.cnt; } if (element.blockage_cause == 5) { lenghtFariTofan += element.lenght; cntFariTofan += element.cnt; } } if (element.axis_type == 4) { if (element.blockage_cause == 1) { lenghtRostayiBarf += element.lenght; cntRostayiBarf += element.cnt; } if (element.blockage_cause == 2) { lenghtRostayiseyl += element.lenght; cntRostayiseyl += element.cnt; } if (element.blockage_cause == 3) { lenghtRostayiRizesh += element.lenght; cntRostayiRizesh += element.cnt; } if (element.blockage_cause == 4) { lenghtRostayiSayer += element.lenght; cntRostayiSayer += element.cnt; } if (element.blockage_cause == 5) { lenghtRostayiTofan += element.lenght; cntRostayiTofan += element.cnt; } } if (element.axis_type == 1) { if (element.blockage_cause == 1) { lenghtAzadrahBarf += element.lenght; cntAzadrahBarf += element.cnt; } if (element.blockage_cause == 2) { lenghtAzadrahseyl += element.lenght; cntAzadrahseyl += element.cnt; } if (element.blockage_cause == 3) { lenghtAzadrahRizesh += element.lenght; cntAzadrahRizesh += element.cnt; } if (element.blockage_cause == 4) { lenghtAzadrahSayer += element.lenght; cntAzadrahSayer += element.cnt; } if (element.blockage_cause == 5) { lenghtAzadrahTofan += element.lenght; cntAzadrahTofan += element.cnt; } } }); ghararsecond.data.datasets[0].data = [ cntAsliBarf, cntFariBarf, cntRostayiBarf, cntBozorgrahBarf, cntAzadrahBarf, ]; ghararsecond.data.datasets[1].data = [ cntAsliseyl, cntFariseyl, cntRostayiseyl, cntBozorgrahseyl, cntAzadrahseyl, ]; ghararsecond.data.datasets[2].data = [ cntAsliRizesh, cntFariRizesh, cntRostayiRizesh, cntBozorgrahRizesh, cntAzadrahRizesh, ]; ghararsecond.data.datasets[3].data = [ cntAsliSayer, cntFariSayer, cntRostayiSayer, cntBozorgrahSayer, cntAzadrahSayer, ]; ghararsecond.data.datasets[4].data = [ cntAsliTofan, cntFariTofan, cntRostayiTofan, cntBozorgrahTofan, cntAzadrahTofan, ]; ghararsecond.data.datasets[5].data = [ lenghtAsliBarf, lenghtFariBarf, lenghtRostayiBarf, lenghtBozorgrahBarf, lenghtAzadrahBarf, ]; ghararsecond.data.datasets[6].data = [ lenghtAsliseyl, lenghtFariseyl, lenghtRostayiseyl, lenghtBozorgrahseyl, lenghtAzadrahseyl, ]; ghararsecond.data.datasets[7].data = [ lenghtAsliRizesh, lenghtFariRizesh, lenghtRostayiRizesh, lenghtBozorgrahRizesh, lenghtAzadrahRizesh, ]; ghararsecond.data.datasets[8].data = [ lenghtAsliSayer, lenghtFariSayer, lenghtRostayiSayer, lenghtBozorgrahSayer, lenghtAzadrahSayer, ]; ghararsecond.data.datasets[9].data = [ lenghtAsliTofan, lenghtFariTofan, lenghtRostayiTofan, lenghtBozorgrahTofan, lenghtAzadrahTofan, ]; ghararsecond.update(); hideLoaderScreen(); }, error: function (error) { hideLoaderScreen(); console.log(error); }, }); }); $("#fastreact").on("click", function () { $.ajax({ url: "https://rms.rmto.ir/api/statics/road-observed", type: "GET", beforeSend: function () { showLoaderScreen(); }, success: function (result) { $(".counter-for-fast-one").each(function () { var $this = $(this), countTo = result.all.today; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-fast-two").each(function () { var $this = $(this), countTo = result.all.week; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-fast-three").each(function () { var $this = $(this), countTo = result.all.month; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-fast-fourth").each(function () { var $this = $(this), countTo = result.all.year; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); var frChart = document.getElementById("frChartFirst").getContext("2d"); var myChartFastR = new Chart( frChart, { type: "pie", data: { datasets: [{ data: [ result.chart.today.today_done, result.chart.today.today_not_done, ], backgroundColor: [chartColors[12], chartColors[11]], label: [ "رسیدگی شده" + " (" + result.chart.today.today_done + ")", "در حال بررسی" + " (" + result.chart.today.today_not_done + ")" ], },], labels: ["رسیدگی شده", "در حال بررسی"], }, options: { plugins: { datalabels: { anchor: "center", align: "end", offset: 10, color: "#fffff", }, }, responsive: true, legendCallback: function (legendarray) { var legendHtml = []; legendHtml.push('
'); for ( var i = 0; i < legendarray.data.datasets[0].data.length; i++ ) { legendHtml.push( '
' ); if (legendarray.data.datasets[0].label) { legendHtml.push( '
 ' + legendarray.data.datasets[0].label[i] + "
" ); } } legendHtml.push("
"); return legendHtml.join(""); }, legend: { display: false, // position: "bottom", // labels:{ // boxWidth: 13 // } }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }, newlegendFirst ); var newlegendFirst = (document.getElementById( "htmllegend" ).innerHTML = myChartFastR.generateLegend()); var frChartSecond = document .getElementById("frChartSecond") .getContext("2d"); var myChartFastRSecond = new Chart( frChartSecond, { type: "pie", data: { datasets: [{ data: [ result.chart.weak.weak_done, result.chart.weak.weak_not_done, ], backgroundColor: [chartColors[12], chartColors[11]], label: [ "رسیدگی شده" + " (" + result.chart.weak.weak_done + ")", "در حال بررسی" + " (" + result.chart.weak.weak_not_done + ")" ], },], labels: ["رسیدگی شده", "در حال بررسی"], }, options: { plugins: { datalabels: { anchor: "center", align: "end", offset: 10, color: "#fffff", }, }, responsive: true, legendCallback: function (legendarray) { var legendHtml = []; legendHtml.push('
'); for ( var i = 0; i < legendarray.data.datasets[0].data.length; i++ ) { legendHtml.push( '
' ); if (legendarray.data.datasets[0].label) { legendHtml.push( '
 ' + legendarray.data.datasets[0].label[i] + "
" ); } } legendHtml.push("
"); return legendHtml.join(""); }, legend: { display: false, // position: "bottom", // labels:{ // boxWidth: 13 // } }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }, newlegendSecond ); var newlegendSecond = (document.getElementById( "htmllegendSecond" ).innerHTML = myChartFastRSecond.generateLegend()); var frChartThird = document .getElementById("frChartThird") .getContext("2d"); var myChartFastRThird = new Chart( frChartThird, { type: "pie", data: { datasets: [{ data: [ result.chart.month.month_done, result.chart.month.month_not_done, ], backgroundColor: [chartColors[12], chartColors[11]], label: [ "رسیدگی شده" + " (" + result.chart.month.month_done + ")", "در حال بررسی" + " (" + result.chart.month.month_not_done + ")" ], },], labels: ["رسیدگی شده", "در حال بررسی"], }, options: { plugins: { datalabels: { anchor: "center", align: "end", offset: 10, color: "#fffff", }, }, responsive: true, legendCallback: function (legendarray) { var legendHtml = []; legendHtml.push('
'); for ( var i = 0; i < legendarray.data.datasets[0].data.length; i++ ) { legendHtml.push( '
' ); if (legendarray.data.datasets[0].label) { legendHtml.push( '
 ' + legendarray.data.datasets[0].label[i] + "
" ); } } legendHtml.push("
"); return legendHtml.join(""); }, legend: { display: false, // position: "bottom", // labels:{ // boxWidth: 13 // } }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }, newlegendThird ); var newlegendThird = (document.getElementById( "htmllegendThird" ).innerHTML = myChartFastRThird.generateLegend()); var frChartfourth = document .getElementById("frChartfourth") .getContext("2d"); var myChartFastfourth = new Chart( frChartfourth, { type: "pie", data: { datasets: [{ data: [ result.chart.year.year_done, result.chart.year.year_not_done, ], backgroundColor: [chartColors[12], chartColors[11]], label: [ "رسیدگی شده" + " (" + result.chart.year.year_done + ")", "در حال بررسی" + " (" + result.chart.year.year_not_done + ")" ], },], labels: ["رسیدگی شده", "در حال بررسی"], }, options: { plugins: { datalabels: { anchor: "center", align: "end", offset: 10, color: "#fffff", }, }, responsive: true, legendCallback: function (legendarray) { var legendHtml = []; legendHtml.push('
'); for ( var i = 0; i < legendarray.data.datasets[0].data.length; i++ ) { legendHtml.push( '
' ); if (legendarray.data.datasets[0].label) { legendHtml.push( '
 ' + legendarray.data.datasets[0].label[i] + "
" ); } } legendHtml.push("
"); return legendHtml.join(""); }, legend: { display: false, // position: "bottom", // labels:{ // boxWidth: 13 // } }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }, newlegendThird ); var newlegendThird = (document.getElementById( "htmllegendfourth" ).innerHTML = myChartFastfourth.generateLegend()); hideLoaderScreen(); }, error: function (error) { console.log(error); }, }); }); $("#roozanepro").on("click", function () { $.ajax({ url: "https://rms.rmto.ir/api/statics/road-item", type: "GET", beforeSend: function () { showLoaderScreen(); }, success: function (result) { $(".counter-for-daily-first").each(function () { var $this = $(this), countTo = result.today; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-second").each(function () { var $this = $(this), countTo = result.week; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-third").each(function () { var $this = $(this), countTo = result.month; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-fourth").each(function () { var $this = $(this), countTo = result.year; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-four").each(function () { var $this = $(this), countTo = result.patrol_today; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-five").each(function () { var $this = $(this), countTo = result.patrol_week; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-six").each(function () { var $this = $(this), countTo = result.patrol_month; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); $(".counter-for-daily-seven").each(function () { var $this = $(this), countTo = result.patrol_year; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); hideLoaderScreen(); }, error: function (error) { console.log(error); }, }); }); function ShowBi(res) { $(".counter-for-rahdari").each(function () { var $this = $(this), countTo = res.count_all; $({ countNum: $this.text() }).animate({ countNum: countTo, }, { duration: 2000, easing: "linear", step: function () { $this.text(Math.floor(this.countNum)); }, complete: function () { $this.text(this.countNum); }, }); }); var FirstChartLeft = document.getElementById("myChartfirst").getContext("2d"); var myChartFirstLeft = new Chart(FirstChartLeft, { type: "doughnut", data: { datasets: [{ data: res.type_sperate.data, backgroundColor: [ chartColors[0], chartColors[1], chartColors[2], chartColors[3], chartColors[4], chartColors[5], ], },], labels: [ res.type_sperate.label[0] + " (" + res.type_sperate.data[0] + ")", res.type_sperate.label[1] + " (" + res.type_sperate.data[1] + ")", res.type_sperate.label[2] + " (" + res.type_sperate.data[2] + ")", res.type_sperate.label[3] + " (" + res.type_sperate.data[3] + ")", res.type_sperate.label[4] + " (" + res.type_sperate.data[4] + ")", res.type_sperate.label[5] + " (" + res.type_sperate.data[5] + ")", ], }, options: { plugins: { datalabels: { anchor: "center", align: "center", offset: 10, color: "#fffff", }, }, responsive: true, legend: { display: hideChartLable, position: "left", rtl: true, labels: { boxWidth: 13, fontSize: 16, fontStyle: "bold", fontColor: "#000", }, }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }); var SecondChartLeft = document .getElementById("myChartsecond") .getContext("2d"); //yasiucameback // console.log(res.status_sperate.label.concat(res.status_sperate.data)); var myChartSecLeft = new Chart(SecondChartLeft, { type: "doughnut", data: { datasets: [{ data: res.status_sperate.data, backgroundColor: [ chartColors[0], chartColors[1], chartColors[2], chartColors[3], ], },], labels: [ res.status_sperate.label[0] + " (" + res.status_sperate.data[0] + ")", res.status_sperate.label[1] + " (" + res.status_sperate.data[1] + ")", res.status_sperate.label[2] + " (" + res.status_sperate.data[2] + ")", res.status_sperate.label[3] + " (" + res.status_sperate.data[3] + ")", ] }, options: { legend: { fontColor: "#000", }, plugins: { datalabels: { anchor: "center", align: "end", offset: 10, color: "#fffff", }, }, responsive: true, legend: { display: hideChartLable, position: "left", labels: { boxWidth: 13, fontSize: 16, fontStyle: "bold", fontColor: "#000", }, }, title: { display: false, text: "تفکیک پروژه های راه روستایی", position: "bottom", }, tooltips: { enabled: true, }, }, }); } function createColors(count) { var point = 280 / (count - 1); var step = 0; var colors = []; for (let i = 0; i < count; i++) { var hsv = { h: Math.floor(step), s: 90, v: 71, }; colors[i] = Color(hsv).toCSS(); step += point; } return colors; } function updateLegendAction(e, datasetIndex) { var index = datasetIndex; var ci = e.view.chart; var meta = ci.getDatasetMeta(index); // See controller.isDatasetVisible comment meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null; document.getElementById("label" + index).style.opacity = document.getElementById("label" + index).style.opacity === "0.2" ? "1" : "0.2"; // We hid a dataset ... rerender the chart ci.update(); } //chooseheader $("#rahdariproject").on("click", function () { $(".projectbody").css("display", "block"); $(".rozaneproject").css("display", "none"); $(".fastreaction").css("display", "none"); $(".gharargahcard").css("display", "none"); // rendercountall(); }); $("#roozanepro").on("click", function () { $(".projectbody").css("display", "none"); $(".rozaneproject").css("display", "block"); $(".fastreaction").css("display", "none"); $(".gharargahcard").css("display", "none"); // renderroaditems(); }); $("#fastreact").on("click", function () { $(".projectbody").css("display", "none"); $(".rozaneproject").css("display", "none"); $(".fastreaction").css("display", "block"); $(".gharargahcard").css("display", "none"); // roadvakonesh(); }); $("#gharargah").on("click", function () { $(".projectbody").css("display", "none"); $(".rozaneproject").css("display", "none"); $(".fastreaction").css("display", "none"); $(".gharargahcard").css("display", "block"); // roadgharargah(); }); $("#showprojectmodal").on("click", function () { $("#modalprojectchoose").modal("show"); }); $("#startfaliat").on("click", function () { $("#submitproject").modal("show"); }); //hover for home header var flag = [1, 0, 0, 0]; //on click start $("#rahdariproject").on("click", function () { flag = [1, 0, 0, 0]; $(".headericon1").attr( "src", "./dist/images/new-design/rahdariProject-active.svg" ); $(".headericon2").attr("src", "./dist/images/new-design/dailyWork.svg"); $(".headericon3").attr("src", "./dist/images/new-design/fastReaction.svg"); $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement.svg" ); }); $("#roozanepro").on("click", function () { flag = [0, 1, 0, 0]; $(".headericon1").attr("src", "./dist/images/new-design/rahdariProject.svg"); $(".headericon2").attr( "src", "./dist/images/new-design/dailyWork-active.svg" ); $(".headericon3").attr("src", "./dist/images/new-design/fastReaction.svg"); $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement.svg" ); }); $("#fastreact").on("click", function () { flag = [0, 0, 1, 0]; $(".headericon1").attr("src", "./dist/images/new-design/rahdariProject.svg"); $(".headericon2").attr("src", "./dist/images/new-design/dailyWork.svg"); $(".headericon3").attr( "src", "./dist/images/new-design/fastReaction-active.svg" ); $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement.svg" ); }); $("#gharargah").on("click", function () { flag = [0, 0, 0, 1]; $(".headericon1").attr("src", "./dist/images/new-design/rahdariProject.svg"); $(".headericon2").attr("src", "./dist/images/new-design/dailyWork.svg"); $(".headericon3").attr("src", "./dist/images/new-design/fastReaction.svg"); $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement-active.svg" ); }); //on click end if (flag[0] == 1) { $(".headericon1").attr( "src", "./dist/images/new-design/rahdariProject-active.svg" ); } $("#rahdariproject").on("mouseenter", function () { if (flag[0] != 1) { $(".headericon1").attr( "src", "./dist/images/new-design/rahdariProject-hover.svg" ); } }); $("#rahdariproject").on("mouseleave", function () { if (flag[0] != 1) { $(".headericon1").attr( "src", "./dist/images/new-design/rahdariProject.svg" ); } }); $("#roozanepro").on("mouseenter", function () { if (flag[1] != 1) { $(".headericon2").attr( "src", "./dist/images/new-design/dailyWork-hover.svg" ); } }); $("#roozanepro").on("mouseleave", function () { if (flag[1] != 1) { $(".headericon2").attr("src", "./dist/images/new-design/dailyWork.svg"); } }); $("#fastreact").on("mouseenter", function () { if (flag[2] != 1) { $(".headericon3").attr( "src", "./dist/images/new-design/fastReaction-hover.svg" ); } }); $("#fastreact").on("mouseleave", function () { if (flag[2] != 1) { $(".headericon3").attr("src", "./dist/images/new-design/fastReaction.svg"); } }); $("#gharargah").on("mouseenter", function () { if (flag[3] != 1) { $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement-hover.svg" ); } }); $("#gharargah").on("mouseleave", function () { if (flag[3] != 1) { $(".headericon4").attr( "src", "./dist/images/new-design/camp&crisisManagement.svg" ); } }); //hover for home header // // samm coding start // //slider for mobile start // $(".second-menu-img").click(function () { // $(".queen-size-nav").toggle({ direction: "right" }, 50); // if ( // $(".second-menu-img").attr("src") == // "./dist/images/new-design/burger-list.svg" // ) { // $(".second-menu-img").attr("src", "./dist/images/new-design/delete.svg"); // $(".queen-size-nav").css("position", "absolute"); // $(".queen-size-nav").css("z-index", "2"); // $(".queen-size-nav").css("width", "30%"); // $(".queen-size-nav").css("height", "100%"); // $(".second-top-menu").css("z-index", "2"); // } else if ( // $(".second-menu-img").attr("src") == "./dist/images/new-design/delete.svg" // ) { // $(".second-menu-img").attr( // "src", // "./dist/images/new-design/burger-list.svg" // ); // $(".second-top-menu").css("margin-right", "0px"); // $(".queen-size-nav").css("width", "0%"); // $(".queen-size-nav").css("height", "0%"); // } // }); // //slider for mobile end // $(".queen-res").click(function () { // $(".first-step-res").slideToggle(300); // if ($(".forth-step-res").css("display") == "block") { // $(".forth-step-res").slideUp(300); // } else if ($(".sixth-step-res").css("display") == "block") { // $(".sixth-step-res").slideUp(300); // } else if ($(".seventh-step-res").css("display") == "block") { // $(".seventh-step-res").slideUp(300); // } // if ($(".first-step-res").css("display") == "block") { // $(".arrow-changing1").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } // setTimeout(() => { // if ($(".first-step-res").css("display") == "none") { // $(".arrow-changing1").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".forth-step-res").css("display") == "none") { // $(".arrow-changing2").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".sixth-step-res").css("display") == "none") { // $(".arrow-changing3").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".seventh-step-res").css("display") == "none") { // $(".arrow-changing4").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // }); // $(".inside-queen-res").click(function () { // $(".second-step-res").slideToggle(300); // if ( // $(".arrow-changing-inside1").attr("src") == // "./dist/images/new-design/arrow-left.svg" // ) { // $(".arrow-changing-inside1").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } else if ( // $(".arrow-changing-inside1").attr("src") == // "./dist/images/new-design/arrow-down.svg" // ) { // $(".arrow-changing-inside1").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }); // $(".again-inside-queen-res").click(function () { // $(".third-step-res").slideToggle(300); // if ( // $(".arrow-changing-inside2").attr("src") == // "./dist/images/new-design/arrow-left.svg" // ) { // $(".arrow-changing-inside2").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } else if ( // $(".arrow-changing-inside2").attr("src") == // "./dist/images/new-design/arrow-down.svg" // ) { // $(".arrow-changing-inside2").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }); // $(".second-queen-res").click(function () { // $(".forth-step-res").slideToggle(300); // if ($(".first-step-res").css("display") == "block") { // $(".first-step-res").slideUp(300); // } else if ($(".sixth-step-res").css("display") == "block") { // $(".sixth-step-res").slideUp(300); // } else if ($(".seventh-step-res").css("display") == "block") { // $(".seventh-step-res").slideUp(300); // } // if ($(".forth-step-res").css("display") == "block") { // $(".arrow-changing2").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } // setTimeout(() => { // if ($(".forth-step-res").css("display") == "none") { // $(".arrow-changing2").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".first-step-res").css("display") == "none") { // $(".arrow-changing1").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".sixth-step-res").css("display") == "none") { // $(".arrow-changing3").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".seventh-step-res").css("display") == "none") { // $(".arrow-changing4").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // }); // $(".inside-second-queen-res").click(function () { // $(".fivth-step-res").slideToggle(300); // $(".third-step-res").slideToggle(300); // if ( // $(".arrow-changing-inside3").attr("src") == // "./dist/images/new-design/arrow-left.svg" // ) { // $(".arrow-changing-inside3").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } else if ( // $(".arrow-changing-inside3").attr("src") == // "./dist/images/new-design/arrow-down.svg" // ) { // $(".arrow-changing-inside3").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }); // $(".third-queen-res").click(function () { // $(".sixth-step-res").slideToggle(300); // if ($(".forth-step-res").css("display") == "block") { // $(".forth-step-res").slideUp(300); // } else if ($(".first-step-res").css("display") == "block") { // $(".first-step-res").slideUp(300); // } else if ($(".seventh-step-res").css("display") == "block") { // $(".seventh-step-res").slideUp(300); // } // if ($(".sixth-step-res").css("display") == "block") { // $(".arrow-changing3").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } // setTimeout(() => { // if ($(".sixth-step-res").css("display") == "none") { // $(".arrow-changing3").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".first-step-res").css("display") == "none") { // $(".arrow-changing1").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".forth-step-res").css("display") == "none") { // $(".arrow-changing2").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".seventh-step-res").css("display") == "none") { // $(".arrow-changing4").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // }); // $(".forth-queen-res").click(function () { // $(".seventh-step-res").slideToggle(300); // if ($(".forth-step-res").css("display") == "block") { // $(".forth-step-res").slideUp(300); // } else if ($(".sixth-step-res").css("display") == "block") { // $(".sixth-step-res").slideUp(300); // } else if ($(".first-step-res").css("display") == "block") { // $(".first-step-res").slideUp(300); // } // if ($(".seventh-step-res").css("display") == "block") { // $(".arrow-changing4").attr( // "src", // "./dist/images/new-design/arrow-down.svg" // ); // } // setTimeout(() => { // if ($(".seventh-step-res").css("display") == "none") { // $(".arrow-changing4").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".first-step-res").css("display") == "none") { // $(".arrow-changing1").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".forth-step-res").css("display") == "none") { // $(".arrow-changing2").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // setTimeout(() => { // if ($(".sixth-step-res").css("display") == "none") { // $(".arrow-changing3").attr( // "src", // "./dist/images/new-design/arrow-left.svg" // ); // } // }, 320); // }); // $(".fivth-queen-res").click(function () { // $(".eight-step-res").slideToggle(300); // }); // // samm coding end function getWidth() { return Math.max( document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.documentElement.clientWidth ); } function showLoaderScreen() { $(".divloader").css("display", "flex").hide().fadeIn(); } function hideLoaderScreen() { $(".divloader").fadeOut(); } function showFastReactionCounter() { $.ajax({ url: "https://rms.rmto.ir/webapi/fast-reaction/count", type: "GET", cache: false, contentType: false, processData: false, beforeSend: function () { showLoaderScreen(); }, success: function (result) { hideLoaderScreen(); if (result.data > 0) { $("#fast-counter").text(result.data); $("#fast-counter").show(); } }, error: function (error) { hideLoaderScreen(); console.log(error); }, }); } // $("#rahdariproject").on("click", function () { // if ($(".projectbody").css("display") == "block") { // $("body").css("margin-bottom", "0px"); // } // }); // $("#roozanepro").on("click", function () { // if ($(".rozaneproject").css("display") == "block") { // $("body").css("margin-bottom", "0px"); // } // }); // $("#fastreact").on("click", function () { // if ($(".fastreaction").css("display") == "block") { // $("body").css("margin-bottom", "0px"); // } // }); // $("#gharargah").on("click", function () { // if ($(".gharargahcard").css("display") == "block") { // $("body").css("margin-bottom", "90px"); // } // }); $("#road_report").on("click", function (event) { event.preventDefault(); // Swal.fire({ // icon: "info", // title: "اطلاع رسانی", // text: "این قسمت در حال ساخت و به روزرسانی میباشد.", // showCancelButton: true, // showConfirmButton: false, // cancelButtonText: "بستن", // }) });