var provcincedata = [] var citydata = [] var count_all = null var datakolupgrade var datadanger_prevention var datatechnical_building var dataconstruction_rural var datamaintenance_project var datatollhouse_management var objprovince = {} var flagquery = 0 var queryparams = "" var urlParams var fromDate, toDate; var specifydate; var yearparams; var filterstring = "" var provincesarray = []; function showLoaderScreen() { $(".divloader").css("display", "flex").hide().fadeIn(); } function hideLoaderScreen() { $(".divloader").fadeOut(); } $(document).ready(function () { getprovince() if (document.location.search.length) { flagquery = 1 urlParams = new URLSearchParams(window.location.search); queryparams = window.location.search; if (urlParams.get('p_t') != null) { showLoaderScreen() showheaderfilter(queryparams) $.ajax({ url: "https://rms.rmto.ir/api/public/bama" + window.location.search, type: "POST", success: function (result) { hideLoaderScreen() console.log("result", result) showprojectdatafilter(result.data, urlParams.get('p_t')) showcountall(result.counts) projecttypebama(result.project_status) axisnumber(result.axis_type_count) showyearless(result.project_years) showcitynumberproject(result.province_count) if (urlParams.get('p_c') != null) { showcityname(urlParams.get('p_c'), result.data[0].cities[0].name) } hideLoaderScreen() }, error: function (error) { }, }); } else { showLoaderScreen() showheaderfilter(queryparams) $.ajax({ url: "https://rms.rmto.ir/api/public/bama" + window.location.search, type: "POST", success: function (result) { hideLoaderScreen() console.log("result", result) showeachcard(result.data) showcountall(result.count_all) projecttypebama(result.project_status) axisnumber(result.axis_type_count) showyearless(result.project_years) showcitynumberproject(result.province_count) if (urlParams.get('p_c') != null) { if (result.data.construction_rural.length != 0) { // alert(result.data.construction_rural[0].cities ) showcityname(urlParams.get('p_c'), result.data.construction_rural[0].cities[0].name) // alert("hiiii") } else if (result.data.danger_prevention.length != 0) { // alert("hi") // alert(result.data.danger_prevention[0].cities[0].name) showcityname(urlParams.get('p_c'), result.data.danger_prevention[0].cities[0].name) } else if (result.data.maintenance_project.length != 0) { // alert(result.data.maintenance_project[0].cities) showcityname(urlParams.get('p_c'), result.data.maintenance_project[0].cities[0].name) } else if (result.data.technical_building.length != 0) { // alert(result.data.technical_building[0].cities) showcityname(urlParams.get('p_c'), result.data.technical_building[0].cities[0].name) } else if (result.data.tollhouse_management.length != 0) { // alert(result.data.tollhouse_management[0].cities) showcityname(urlParams.get('p_c'), result.data.tollhouse_management[0].cities[0].name) } else if (result.data.upgrade_safety.length != 0) { // alert(result.data.upgrade_safety[0].cities) showcityname(urlParams.get('p_c'), result.data.upgrade_safety[0].cities[0].name) } } hideLoaderScreen() }, error: function (error) { }, }); } } else { flagquery = 0 //yasiucomeback showprovincefilter() showLoaderScreen() $.ajax({ url: "https://rms.rmto.ir/api/public/bama", type: "POST", success: function (result) { hideLoaderScreen() console.log("ress", result) console.log("testttttttt", result.project_status) showeachcard(result.data) // showyearlist(result.project_years) showyearless(result.project_years) showcountall(result.count_all) showcountproject(result.counts) showcitynumberproject(result.province_count) axisnumber(result.axis_type_count) projecttypebama(result.project_status) }, error: function (error) { }, }); } $(".projecttypeid").on("click", function () { if ($("#dropdown-projecttypeid").css("display") == "none") { $(".projecttypeid").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $("#dropdown-projecttypeid").show(1000) } else { $(".projecttypeid").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $("#dropdown-projecttypeid").hide(1000) } }) }) $(".projectostan").on("click", function () { if ($("#dropdown-province").css("display") == "none") { $(".projectostan").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $("#dropdown-province").show(1000) } else { $(".projectostan").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $("#dropdown-province").hide(1000) } }) $(".projectcity").on("click", function () { if ($(".dropdown-city").css("display") == "none") { $(".projectcity").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $(".dropdown-city").show(1000) } else { $(".projectcity").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $(".dropdown-city").hide(1000) } }) $(".projecttypeimage").on("click", function () { if ($(".mehvarshowdiv").css("display") == "none") { $(".projecttypeimage").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $(".mehvarshowdiv").show(1000) } else { $(".projecttypeimage").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $(".mehvarshowdiv").hide(1000) } }) $(".imagestatusproject").on("click", function () { if ($(".statusdivproject").css("display") == "none") { $(".imagestatusproject").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $(".statusdivproject").show(1000) } else { $(".imagestatusproject").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $(".statusdivproject").hide(1000) } }) $(".imagedivyear").on("click", function () { if ($(".divyearshown").css("display") == "none") { $(".imagedivyear").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $(".divyearshown").show(1000) } else { $(".imagedivyear").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $(".divyearshown").hide(1000) } }) $(".projectimportanceimage").on("click", function () { if ($(".projectimportancediv").css("display") == "none") { $(".projectimportanceimage").attr("src", "../dist/images/bamaicons/down-chevron.svg"); $(".projectimportancediv").show(1000) } else { $(".projectimportanceimage").attr("src", "../dist/images/bamaicons/arrow-left.svg"); $(".projectimportancediv").hide(1000) } }) function paginateshowwwww() { var width = $(window).width(); if (width < 766) { console.log("peeeee") $('div.content').removeClass('col-sm-6').addClass('col-sm-12'); } // Number of items and limits the number of items per page var numberOfItems = $("#projectcontent .content").length; var limitPerPage = 10; // Total pages rounded upwards var totalPages = Math.ceil(numberOfItems / limitPerPage); // Number of buttons at the top, not counting prev/next, // but including the dotted buttons. // Must be at least 5: var paginationSize = 7; var currentPage; function showPage(whichPage) { if (whichPage < 1 || whichPage > totalPages) return false; currentPage = whichPage; $("#exampleshowpage .content").hide() .slice((currentPage - 1) * limitPerPage, currentPage * limitPerPage).show(); // Replace the navigation items (not prev/next): $(".pagination li").slice(1, -1).remove(); getPageList(totalPages, currentPage, paginationSize).forEach(item => { $("
  • ").addClass("page-item") .addClass(item ? "current-page" : "disabled") .toggleClass("active", item === currentPage).append( $("").addClass("page-link").attr({ href: "javascript:void(0)" }).text(item || "...") ).insertBefore("#next-page"); }); // Disable prev/next when at first/last page: $("#previous-page").toggleClass("disabled", currentPage === 1); $("#next-page").toggleClass("disabled", currentPage === totalPages); return true; } // Include the prev/next buttons: $(".pagination").append( $("
  • ").addClass("page-item").attr({ id: "previous-page" }).append( $("").addClass("page-link").attr({ href: "javascript:void(0)" }).text("قبلی") ), $("
  • ").addClass("page-item").attr({ id: "next-page" }).append( $("").addClass("page-link").attr({ href: "javascript:void(0)" }).text("بعدی") ) ); // Show the page links $("#exampleshowpage").show(); showPage(1); // Use event delegation, as these items are recreated later $(document).on("click", ".pagination li.current-page:not(.active)", function () { return showPage(+$(this).text()); }); $("#next-page").on("click", function () { return showPage(currentPage + 1); }); $("#previous-page").on("click", function () { return showPage(currentPage - 1); }); } function getPageList(totalPages, page, maxLength) { if (maxLength < 5) throw "maxLength must be at least 5"; function range(start, end) { return Array.from(Array(end - start + 1), (_, i) => i + start); } var sideWidth = maxLength < 9 ? 1 : 2; var leftWidth = (maxLength - sideWidth * 2 - 3) >> 1; var rightWidth = (maxLength - sideWidth * 2 - 2) >> 1; if (totalPages <= maxLength) { // no breaks in list return range(1, totalPages); } if (page <= maxLength - sideWidth - 1 - rightWidth) { // no break on left of page return range(1, maxLength - sideWidth - 1) .concat(0, range(totalPages - sideWidth + 1, totalPages)); } if (page >= totalPages - sideWidth - 1 - rightWidth) { // no break on right of page return range(1, sideWidth) .concat(0, range(totalPages - sideWidth - 1 - rightWidth - leftWidth, totalPages)); } // Breaks on both sides return range(1, sideWidth) .concat(0, range(page - leftWidth, page + rightWidth), 0, range(totalPages - sideWidth + 1, totalPages)); } function showeachcard(data) { var lidata = "" datakolupgrade = data.upgrade_safety datadanger_prevention = data.danger_prevention datatechnical_building = data.technical_building dataconstruction_rural = data.construction_rural datamaintenance_project = data.maintenance_project datatollhouse_management = data.tollhouse_management for (var i = 0; i < datakolupgrade.length; i++) { if (datakolupgrade[i].path != null) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datakolupgrade[i].province_fa + ' \ تاریخ شروع : ' + datakolupgrade[i].contract_date + '\
    \
    \ شهرستان : ' + datakolupgrade[i].city_1_fa + '\
    \
    \ نام محور : ' + datakolupgrade[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datakolupgrade[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datakolupgrade[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datakolupgrade[i].project_status_fa) + ' \
    \
    \
    \
    ' } else { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datakolupgrade[i].province_fa + ' \ تاریخ شروع : ' + datakolupgrade[i].contract_date + '\
    \
    \ شهرستان : ' + datakolupgrade[i].city_1_fa + '\
    \
    \ نام محور : ' + datakolupgrade[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datakolupgrade[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datakolupgrade[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datakolupgrade[i].project_status_fa) + ' \
    \
    \
    \
    ' } } for (var i = 0; i < datadanger_prevention.length; i++) { if (datadanger_prevention[i].path != null) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datadanger_prevention[i].province_fa + ' \ تاریخ شروع : ' + datadanger_prevention[i].contract_date + '\
    \
    \ شهرستان : ' + datadanger_prevention[i].city_1_fa + '\
    \
    \ نام محور : ' + datadanger_prevention[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datadanger_prevention[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datadanger_prevention[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datadanger_prevention[i].project_status_fa) + ' \
    \
    \
    \
    ' } else { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datadanger_prevention[i].province_fa + ' \ تاریخ شروع : ' + datadanger_prevention[i].contract_date + '\
    \
    \ شهرستان : ' + datadanger_prevention[i].city_1_fa + '\
    \
    \ نام محور : ' + datadanger_prevention[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datadanger_prevention[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datadanger_prevention[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datadanger_prevention[i].project_status_fa) + ' \
    \
    \
    \
    ' } } for (var i = 0; i < datatechnical_building.length; i++) { if (datatechnical_building[i].path != null) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datatechnical_building[i].province_fa + ' \ تاریخ شروع : ' + datatechnical_building[i].contract_date + '\
    \
    \ شهرستان : ' + datatechnical_building[i].city_1_fa + '\
    \
    \ نام محور : ' + datatechnical_building[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datatechnical_building[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datatechnical_building[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datatechnical_building[i].project_status_fa) + ' \
    \
    \
    \
    ' } else { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datatechnical_building[i].province_fa + ' \ تاریخ شروع : ' + datatechnical_building[i].contract_date + '\
    \
    \ شهرستان : ' + datatechnical_building[i].city_1_fa + '\
    \
    \ نام محور : ' + datatechnical_building[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datatechnical_building[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datatechnical_building[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datatechnical_building[i].project_status_fa) + ' \
    \
    \
    \
    ' } } for (var i = 0; i < datamaintenance_project.length; i++) { if (datamaintenance_project[i].path != null) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datamaintenance_project[i].province_fa + ' \ تاریخ شروع : ' + datamaintenance_project[i].contract_date + '\
    \
    \ شهرستان : ' + datamaintenance_project[i].city_1_fa + '\
    \
    \ نام محور : ' + datamaintenance_project[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    از 3' + datamaintenance_project[i].rate + '
    \
    \
    \ عنوان پروژه:' + datamaintenance_project[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datamaintenance_project[i].project_status_fa) + ' \
    \
    \
    \
    ' } else { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datamaintenance_project[i].province_fa + ' \ تاریخ شروع : ' + datamaintenance_project[i].contract_date + '\
    \
    \ شهرستان : ' + datamaintenance_project[i].city_1_fa + '\
    \
    \ نام محور : ' + datamaintenance_project[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datamaintenance_project[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datamaintenance_project[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datamaintenance_project[i].project_status_fa) + ' \
    \
    \
    \
    ' } } for (var i = 0; i < datatollhouse_management.length; i++) { // if () if (datatollhouse_management[i].path != null) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datatollhouse_management[i].province_fa + ' \ تاریخ شروع : ' + datatollhouse_management[i].contract_date + '\
    \
    \ شهرستان : ' + datatollhouse_management[i].city_1_fa + '\
    \
    \ نام محور : ' + datatollhouse_management[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datatollhouse_management[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datatollhouse_management[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datatollhouse_management[i].project_status_fa) + ' \
    \
    \
    \
    ' } else { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + datatollhouse_management[i].province_fa + ' \ تاریخ شروع : ' + datatollhouse_management[i].contract_date + '\
    \
    \ شهرستان : ' + datatollhouse_management[i].city_1_fa + '\
    \
    \ نام محور : ' + datatollhouse_management[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(datatollhouse_management[i].rate) + '
    \
    \
    \ عنوان پروژه:' + datatollhouse_management[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(datatollhouse_management[i].project_status_fa) + ' \
    \
    \
    \
    ' } } $("#projectcontent").append(lidata) paginateshowwwww() } $("#rookeshnegah").on('click', function () { if (flagquery == 1) { if (queryparams.indexOf("p_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_t=1" } else { window.location.href = window.location.href + "&p_t=1" } } else { window.location.href = window.location.href + "?p_t=1" } }) $("#hadesekhisz").on('click', function () { if (flagquery == 1) { if (queryparams.indexOf("p_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_t=2" } else { window.location.href = window.location.href + "&p_t=2" } } else { window.location.href = window.location.href + "?p_t=2" } }) $("#abnienegah").on('click', function () { if (flagquery == 1) { if (queryparams.indexOf("p_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_t=4" } else { window.location.href = window.location.href + "&p_t=4" } } else { window.location.href = window.location.href + "?p_t=4" } }) $("#rahdarkhanebeh").on('click', function () { if (flagquery == 1) { if (queryparams.indexOf("p_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_t=5" } else { window.location.href = window.location.href + "&p_t=5" } } else { window.location.href = window.location.href + "?p_t=5" } }) $("#erteghayeimeni").on('click', function () { if (flagquery == 1) { if (queryparams.indexOf("p_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_t=3" } else { window.location.href = window.location.href + "&p_t=3" } } else { window.location.href = window.location.href + "?p_t=3" } }) function showprojectdatafilter(data, number) { var lidata = "" for (var i = 0; i < data.length; i++) { lidata = lidata + '
    \
    \
    \
    \ اداره کل :' + data[i].province_fa + ' \ تاریخ شروع : ' + data[i].contract_date + '\
    \
    \ شهرستان : ' + data[i].city_1_fa + '\
    \
    \ نام محور : ' + data[i].axis_name + ' \
    \
    \ \
    \
    \
    \
    \
    \ \
    ' + showrating(data[i].rate) + '
    \
    \
    \ عنوان پروژه :' + data[i].project_name + ' \
    \
    \ آخرین وضعیت پروژه :' + showprojectfa(data[i].project_status_fa) + ' \
    \
    \
    \
    ' } $("#projectcontent").append(lidata) paginateshowwwww() } function showimagefilter(data) { if (data != null) { return "https://rms.rmto.ir/storage" + data.slice(6) } else { return "../dist/images/notavailable.jpg" } } function showcountall(num) { $("#countall").append( '' + num + '' ) counternum() } function counternum() { $('.count-this').each(function () { // Start the counting from a specified number - in this case, 0! $(this).prop('Counter', 0).animate({ Counter: $(this).text() }, { // Speed of counter in ms, default animation style duration: 2000, easing: 'swing', step: function (now) { // Round up the number $(this).text(Math.ceil(now)); } }); }); } // function showyearlist(obj) { // var fullnum = 0; // $.each(obj, function (key, value) { // if (value != 0) { // if (parseInt(key) > 1395) { // // $("#startyear").append('

    ' + key + '

    (' + value + ')

    ') // } // else { // fullnum += value // } // } // }) // $("#startyear").append('

    سال 1395 و ماقبل

    (' + fullnum + ')

    ') // } function showyearfilter(num) { var showfilter = '

    ' + num + '

    x
    ' $("#card-tools").append(showfilter) } function showyearless(obj) { var fullnum = 0; console.log("obj", obj) $.each(obj, function (key, value) { if (value != 0) { if (parseInt(key) > 1395) { $("#startyear").append('
    ' + key + ' (' + value + ')
    ') } else { fullnum += value; } } }) if (fullnum == 0) { } else { $("#startyear").append('

    سال 1395 و ماقبل

    (' + fullnum + ')

    ') } } function showcountproject(obj) { $("#rookeshnegah").append( '

    (' + obj.maintenance_project_count + ')

    ' ) $("#hadesekhisz").append( '

    (' + obj.danger_prevention_count + ')

    ' ) $("#erteghayeimeni").append( '

    (' + obj.upgrade_safety_count + ')

    ' ) $("#abnienegah").append( '

    (' + obj.technical_building_count + ')

    ' ) $("#rahdarkhanebeh").append( '

    (' + obj.tollhouse_management_count + ')

    ' ) } function axisnumber(obj) { $.each(obj, function (key, value) { if (key == 1) { $("#sharyani").append('(' + value + ')') } if (key == 2) { $("#asli").append('(' + value + ')') } if (key == 3) { $("#faryi").append('(' + value + ')') } if (key == 4) { $("#roostayi").append('(' + value + ')') } }) } function projecttypebama(array) { $("#status0").append('(' + array[0] + ')') $("#status1").append('(' + array[1] + ')') $("#status2").append('(' + array[2] + ')') $("#status3").append('(' + array[3] + ')') $("#status4").append('(' + array[4] + ')') $("#status5").append('(' + array[5] + ')') $("#status6").append('(' + array[6] + ')') $("#status7").append('(' + array[7] + ')') $("#status8").append('(' + array[8] + ')') } function showprovincefilter() { var provincearray = []; var ostandata = []; $.ajax({ url: "https://rms.rmto.ir/public/contents/provinces", type: "GET", success: function (result) { provincearray = result.data for (var i = 0; i < provincearray.length; i++) { ostandata = ostandata + '
    ' + provincearray[i].name_fa + '
    ' } $("#appendostan").append(ostandata); }, error: function (error) { }, }); } function newsee(id) { if (flagquery == 1) { if (queryparams.indexOf("p_p") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_p=" + id } else { window.location.href = window.location.href + "&p_p=" + id } } else { window.location.href = window.location.href + "?p_p=" + id } } function showcityappend(data) { $("#appendcity").empty() var citydata = "" var citylist = []; $.ajax({ url: "https://rms.rmto.ir/public/contents/provinces/" + data, type: "GET", success: function (result) { citylist = result.data console.log("citylist", citylist) for (var i = 0; i < citylist.length; i++) { citydata = citydata + '
    ' + citylist[i].name_fa + '
    ' } console.log("citydata", citydata) $("#appendcity").append(citydata) }, error: function (error) { }, }); } for (var i = 0; i < 36; i++) { $("#province" + i).click(function () { alert("#province" + i) // console.log("jiiii") if (flagquery == 1) { if (queryparams.indexOf("p_p") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_p=" + i } else { window.location.href = window.location.href + "&p_p=" + i } } else { window.location.href = window.location.href + "?p_p=" + i } }); } function mehvartypefunc(num) { if (flagquery == 1) { if (queryparams.indexOf("r_t") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?r_t=" + num } else { window.location.href = window.location.href + "&r_t=" + num } } else { window.location.href = window.location.href + "?r_t=" + num } } function projectstatus(id) { if (flagquery == 1) { if (queryparams.indexOf("p_s") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_s=" + id } else { window.location.href = window.location.href + "&p_s=" + id } } else { window.location.href = window.location.href + "?p_s=" + id } } function showyearclick(num) { if (flagquery == 1) { if (queryparams.indexOf("p_y") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_y=" + num } else { window.location.href = window.location.href + "&p_y=" + num } } else { window.location.href = window.location.href + "?p_y=" + num } } function projectimportance(id) { if (flagquery == 1) { if (queryparams.indexOf("p_r") != -1) { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_r=" + id } else { window.location.href = window.location.href + "&p_r=" + id } } else { window.location.href = window.location.href + "?p_r=" + id } } function showheaderfilter(query) { if (urlParams.get('p_t') != null) { if (urlParams.get('p_t') == 1) { filterstring = filterstring + '
    \ روکش آسفالت (نگهداری راه ها )\ X\
    ' $("#dropdown-projecttypeid").empty() $("#dropdown-projecttypeid").append('
    \ روکش آسفالت (نگهداری راه ها)\ \
    ') } if (urlParams.get('p_t') == 2) { filterstring = filterstring + '
    \ رفع نقاط حادثه خیز / پرتصادف\ X\
    ' $("#dropdown-projecttypeid").empty() $("#dropdown-projecttypeid").append('
    \ رفع نقاط حادثه خیز / پرتصادف\ \
    ') } if (urlParams.get('p_t') == 3) { filterstring = filterstring + '
    \ ارتقای ایمنی راه\ X\
    ' $("#dropdown-projecttypeid").empty() $("#dropdown-projecttypeid").append('
    \ ارتقای ایمنی راه\ \
    ') } if (urlParams.get('p_t') == 4) { filterstring = filterstring + '
    \ ابنیه فنی (نگهداری ابنیه فنی ) \ X\
    ' $("#dropdown-projecttypeid").empty() $("#dropdown-projecttypeid").append('
    \ ابنیه فنی (نگهداری ابنیه فنی )\ \
    ') } if (urlParams.get('p_t') == 5) { filterstring = filterstring + '
    \ راهدارخانه ها (بهسازی و نوسازی )\ X\
    ' $("#dropdown-projecttypeid").empty() $("#dropdown-projecttypeid").append('
    \ راهدارخانه ها (بهسازی و نوسازی )\ \
    ') } // console.log("test" ,filterstring ) } if (urlParams.get('p_p') != null) { // alert("mn") showprovincefilteredit(urlParams.get('p_p')) } else { showprovincefilter() } if (urlParams.get('r_t') != null) { showmehvartype(urlParams.get('r_t')) } if (urlParams.get('p_s') != null) { showprojectstatus(urlParams.get('p_s')) } if (urlParams.get('p_y') != null) { showyearshownfilter(urlParams.get('p_y')) } if (urlParams.get('p_r') != null) { showimportance(urlParams.get('p_r')) } $(".projectchoose").append(filterstring) } function showprovincefilteredit(id) { var provincestring = "" var ostanstring = "" var provincearrayy = []; $.ajax({ url: "https://rms.rmto.ir/public/contents/provinces", type: "GET", success: function (result) { provincearrayy = result.data for (var i = 0; i < provincearrayy.length; i++) { if (provincearrayy[i].id == id) { showcityappend(id) console.log("lllll", provincearrayy[i].name_fa) provincestring = provincestring + '
    \ ' + provincearrayy[i].name_fa + '\ X\
    ' ostanstring = '
    ' + provincearrayy[i].name_fa + '
    ' } } $("#appendostan").empty() $("#appendostan").append(ostanstring) $(".projectchoose").append(provincestring) }, error: function (error) { }, }); } function getprovince() { $.ajax({ url: "https://rms.rmto.ir/public/contents/provinces", type: "GET", success: function (result) { provincesarray = result.data }, error: function (error) { }, }); } function cityclick(num) { if (flagquery == 1) { // console.log("pitikohearflag1") // console.log("quwery", queryparams.indexOf("p_c")) if (queryparams.indexOf("p_c") != -1) { // console.log("p_p;") var uri = window.location.toString(); if (uri.indexOf("?") > 0) { var clean_uri = uri.substring(0, uri.indexOf("?")); window.history.replaceState({}, document.title, clean_uri); } location.reload() window.location.href = window.location.href + "?p_c=" + num } else { // console.log("clickcitytest") window.location.href = window.location.href + "&p_c=" + num } } else { // console.log("pitikohearflagelse") window.location.href = window.location.href + "?p_c=" + num } } function showmehvartype(id) { var mehvarheader = "" var mehvarfilter = "" if (id == 1) { mehvarfilter = '
    شریانی
    ' mehvarheader = '
    شریانیX
    ' } else if (id == 2) { mehvarfilter = '
    اصلی
    ' mehvarheader = '
    اصلیX
    ' } else if (id == 3) { mehvarfilter = '
    فرعی
    ' mehvarheader = '
    فرعیX
    ' } else if (id == 4) { mehvarfilter = '
    روستایی
    ' mehvarheader = '
    روستاییX
    ' } $(".mehvarshowdiv").empty() $(".mehvarshowdiv").append(mehvarfilter) $(".projectchoose").append(mehvarheader) } function showprojectstatus(id) { var statusheader = "" var statusfilter = "" if (id == 0) { statusfilter = '
    توسط استان ها بروزرسانی نشده
    ' statusheader = '
    توسط استان ها بروزرسانی نشده X
    ' } else if (id == 1) { statusfilter = '
    در دست برنامه ریزی اولیه
    ' statusheader = '
    در دست برنامه ریزی اولیه X
    ' } else if (id == 2) { statusfilter = '
    در دست مطالعه و تهیه اسناد مناقصه
    ' statusheader = '
    در دست مطالعه و تهیه اسناد مناقصه X
    ' } else if (id == 3) { statusfilter = '
    در دست مناقصه
    ' statusheader = '
    در دست مناقصه X
    ' } else if (id == 4) { statusfilter = '
    در حال تجهیز کارگاه
    ' statusheader = '
    در حال تجهیز کارگاه X
    ' } else if (id == 5) { statusfilter = '
    در حال اجرا فعال
    ' statusheader = '
    در حال اجرا فعال X
    ' } else if (id == 6) { statusfilter = '
    در حال اجرا متوقف
    ' statusheader = '
    در حال اجرا متوقف X
    ' } else if (id == 7) { statusfilter = '
    در حال اجرا فعال
    ' statusheader = '
    در حال اجرا فعال X
    ' } else if (id == 8) { statusfilter = '
    در حال اجرا فعال
    ' statusheader = '
    در حال اجرا فعال X
    ' } $("#projectstatusshow").empty() $("#showstatussec").empty() $("#projectstatusshow").append(statusfilter) $(".projectchoose").append(statusheader) } function showyearshownfilter(id) { var stringyear = "" var stringfilter = "" if (id == 1395) { stringyear = '
    1395
    ' stringfilter = '
    1395 X
    ' } else if (id == 1396) { stringyear = '
    1396
    ' stringfilter = '
    1396 X
    ' } else if (id == 1397) { stringyear = '
    1397
    ' stringfilter = '
    1397 X
    ' } else if (id == 1398) { stringyear = '
    1398
    ' stringfilter = '
    1398 X
    ' } else if (id == 1399) { stringyear = '
    1399
    ' stringfilter = '
    1399 X
    ' } else if (id == 1400) { stringyear = '
    1400
    ' stringfilter = '
    1400 X
    ' } $(".startyear").empty() $(".startyear").append(stringyear) $(".projectchoose").append(stringfilter) } function showimportance(num) { var importancestring = "" var importancheader = "" if (num == 3) { importancestring = '
    بسیار حایز اهمیت
    ' importancheader = '
    بسیار حایز اهمیت X
    ' } else if (num == 2) { importancestring = '
    عادی
    ' importancheader = '
    عادی X
    ' } else if (num == 1) { importancestring = '
    پروژه با اهمیت کم
    ' importancheader = '
    پروژه با اهمیت کم X
    ' } $("#importancediv").empty() $("#importancediv").append(importancestring) $(".projectchoose").append(importancheader) } $(document).on('click', '#p_r1', function () { // alert("p_tremove1") // code here $("#importancediv").empty() var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_r') } // location.reload() }); $(document).on('click', '#p_r2', function () { // alert("p_tremove2") // code here $("#importancediv").empty() var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_r') } // location.reload() }); $(document).on('click', '#p_r3', function () { // alert("p_tremove3") // code here $("#importancediv").empty() var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_r') } // location.reload() }); $(document).on('click', '#p_tremove4', function () { // alert("p_tremove4") $("#p_t4").empty() var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_t') } // location.reload() // code here }); $(document).on('click', '#p_tremove5', function () { // alert("p_tremove5") $("#p_t5").empty() // location.reload() var uri = window.location.toString(); if (uri.indexOf("?") > 0) { // console.log("hipitikoo6666") // var clean_uri = uri.substring(0, uri.indexOf("?")); removeURLParameter(uri, 'p_t') // window.history.replaceState({}, document.title, clean_uri); } // location.reload() // code here }); function removeURLParameter(url, parameter) { console.log("hipitikoo", parameter) //prefer to use l.search if you have a location/link object var urlparts = url.split('?'); // console.log("urlparts", urlparts) if (urlparts.length >= 2) { console.log("lala") var prefix = encodeURIComponent(parameter) + '='; var pars = urlparts[1].split(/[&;]/g); // console.log("pars", pars) //reverse iteration as may be destructive for (var i = pars.length; i-- > 0;) { //idiom for string.startsWith if (pars[i].lastIndexOf(prefix, 0) !== -1) { pars.splice(i, 1); } } // console.log("parss", pars) if (pars.length > 0) { url = urlparts[0] + '?' + pars.join('&'); } else { url = urlparts[0] } // console.log("urlll", url) window.location.href = url // console.log("windowa", window.location.href) // location.reload() // return url; } else { console.log("urlllelse", url) return url; } } for (var i = 0; i <= 36; i++) { $(document).on('click', '#p_p' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_p') } // location.reload() // code here }); } for (var i = 0; i <= 23; i++) { $(document).on('click', '#p_s' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_s') } // location.reload() // code here }); } for (var i = 0; i <= 1000; i++) { $(document).on('click', '#p_c' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_c') } // location.reload() // code here }); } for (var i = 0; i <= 4; i++) { $(document).on('click', '#r_t' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'r_t') } // location.reload() // code here }); } for (var i = 0; i <= 5; i++) { $(document).on('click', '#p_t' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_t') } // location.reload() // code here }); } for (var i = 0; i <= 15; i++) { $(document).on('click', '#p_s' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_s') } // location.reload() // code here }); } for (var i = 0; i <= 5; i++) { $(document).on('click', '#p_r' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_r') } // location.reload() // code here }); } for (var i = 0; i <= 6; i++) { $(document).on('click', '#p_y' + i, function () { var uri = window.location.toString(); if (uri.indexOf("?") > 0) { removeURLParameter(uri, 'p_y') } // location.reload() // code here }); } function showcityname(id, name) { var cityfiltername = "" var cityfilterdiv = "" cityfiltername = '
    ' + name + '
    ' cityfilterdiv = '
    ' + name + 'X
    ' $("#dropdown-city").empty() $("#dropdown-city").append(cityfiltername) $(".projectchoose").append(cityfilterdiv) } function showprojectfa(str) { if (str == null) { // console.log("hi") return "توسط استان بروزرسانی نشده است " } else { // console.log("byy") return str } } function showrating(num) { // console.log("pitukooo") if (num == null) { return "-از 3" } else { return num + "از 3" } } function showimage(num) { if (num == 1) { return "../dist/images/bamaicons/rookesh-bama.svg" } else if (num == 2) { return "../dist/images/bamaicons/dangerpoint-bama.svg" } else if (num == 4) { return "../dist/images/bamaicons/abniefani-bama.svg" } else if (num == 5) { return "../dist/images/bamaicons/green-home-bama.svg" } else if (num == 3) { return "../dist/images/bamaicons/oprative-bama.svg" } } function showcitynumberproject(obj) { $.each(obj, function (key, value) { $("#province" + key).append('' + value + '') }) }