872 lines
31 KiB
JavaScript
872 lines
31 KiB
JavaScript
|
|
var citydata = []
|
|
var querylength = 0
|
|
var queryparams = ""
|
|
var urlParams
|
|
var filterstring = ""
|
|
var globalDataCount = {}
|
|
var globalData = []
|
|
var windoWidth
|
|
function showLoaderScreen() {
|
|
$(".divloader").css("display", "flex").hide().fadeIn();
|
|
}
|
|
|
|
function hideLoaderScreen() {
|
|
$(".divloader").fadeOut();
|
|
}
|
|
windoWidth = $(window).width()
|
|
$(document).ready(function () {
|
|
showLoaderScreen()
|
|
document.location.search.length != 0 ? querylength = 1 : querylength = 0
|
|
urlParams = new URLSearchParams(window.location.search);
|
|
queryparams = window.location.search;
|
|
$.ajax({
|
|
url: "https://rms.rmto.ir/bama-index" + window.location.search,
|
|
type: "GET",
|
|
success: function (result) {
|
|
globalDataCount = result.counts
|
|
globalData = result.data
|
|
hideLoaderScreen()
|
|
checkWindowSize()
|
|
showFilterBama(queryparams)
|
|
showcountall(globalDataCount.projects)
|
|
if (globalData.length != 0) {
|
|
showcountproject(globalDataCount.projectTypes)
|
|
status_num(globalDataCount.last_statuses)
|
|
showprovincefilter(globalDataCount.provinces)
|
|
axisfilter(globalDataCount.axis_types)
|
|
showyearfilter(globalDataCount.years)
|
|
prioritiesfilter(globalDataCount.priorities)
|
|
followupprioritiesfilter(globalDataCount.followup_priority)
|
|
}
|
|
// else {
|
|
// showFilterNone()
|
|
// hideLoaderScreen()
|
|
// }
|
|
},
|
|
error: function (error) {
|
|
Swal.fire({
|
|
icon: "error",
|
|
title: "خطا سرور",
|
|
text: "مشکل در دریافت اطلاعات ",
|
|
confirmButtonText: "بارگذاری مجدد",
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
location.reload(true);
|
|
return true;
|
|
}
|
|
});
|
|
},
|
|
});
|
|
|
|
})
|
|
|
|
// data-filter show/hide
|
|
$(".filter-type").on("click", function () {
|
|
var dataid = $(this).data('filter');
|
|
if ($('.filter-type-' + dataid).css("display") == "none") {
|
|
$('.filter-type-' + dataid).show(1000)
|
|
} else {
|
|
$('.filter-type-' + dataid).hide(1000)
|
|
|
|
}
|
|
})
|
|
|
|
//data-filter show/hide
|
|
function paginatepage() {
|
|
var width = $(window).width();
|
|
if (width < 766) {
|
|
// $('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 = 6;
|
|
// Total pages rounded upwards
|
|
var totalPages = Math.ceil(numberOfItems / limitPerPage);
|
|
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 => {
|
|
$("<li>").addClass("page-item")
|
|
.addClass(item ? "current-page" : "disabled")
|
|
.toggleClass("active", item === currentPage).append(
|
|
$("<a>").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(
|
|
$("<li>").addClass("page-item").attr({ id: "previous-page" }).append(
|
|
$("<a>").addClass("page-link").attr({
|
|
href: "javascript:void(0)"
|
|
}).text("<<")
|
|
),
|
|
$("<li>").addClass("page-item").attr({ id: "next-page" }).append(
|
|
$("<a>").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 listdata = ""
|
|
for (var index = 0; index < data.length; index++) {
|
|
listdata += `<div class="col-sm-6 content p-10"><a class="contentwidth" href="https://rms.rmto.ir/bama/${data[index].id}" target="_blank">
|
|
<div class="row card-div ">
|
|
<div class="col-sm-9 show-data">
|
|
<div class="col-sm-12 pb-2 start-text"><div class="row col-sm-12"><div class="col-sm-6">اداره کل :${data[index].province_fa}</div><div class="col-sm-6"> تاریخ انعقاد قرارداد : ${moment(data[index].contract_date_from_parent_contract).format("jYYYY/jMM/jDD")}</div></div>
|
|
<div class="col-sm-12">شهرستان : ${data[index].city_fa} </div>
|
|
<div class="col-sm-12"> نام محور : ${data[index].axis_name_fa} </div>
|
|
</div>
|
|
<div class="col-sm-12 pt-2"><div class="col-sm-12">نوع پروژه : ${data[index].project_type_fa}</div>
|
|
<div class="col-sm-12">عنوان پروژه:${data[index].project_title} </div>
|
|
<div class="col-sm-12"> آخرین وضعیت پروژه :${data[index].last_status_fa} </div>
|
|
</div>
|
|
</div><div class="col-sm-3 image-div"><img class="image-upload" src="${returnimage(data[index].image_path1)}">
|
|
</div>
|
|
</div>
|
|
</a></div>`
|
|
}
|
|
$("#projectcontent").append(listdata)
|
|
paginatepage()
|
|
}
|
|
function showResponsiveCard(data) {
|
|
var listdata = ""
|
|
for (var index = 0; index < data.length; index++) {
|
|
listdata += `<div class="content p-10"><a class="contentwidth" href="https://rms.rmto.ir/bama/${data[index].id}" target="_blank">
|
|
<div class="row card-div">
|
|
<div class="col-sm-9 show-data">
|
|
<div class="col-sm-12 pb-2 start-text"><div class="row col-sm-12"><div class="col-sm-6">اداره کل :${data[index].province_fa}</div><div class="col-sm-6"> تاریخ انعقاد قرارداد : ${moment(data[index].contract_date_from_parent_contract).format("jYYYY/jMM/jDD")}</div></div>
|
|
<div class="col-sm-12">شهرستان : ${data[index].city_fa} </div>
|
|
<div class="col-sm-12"> نام محور : ${data[index].axis_name_fa} </div>
|
|
</div>
|
|
<div class="col-sm-12 pt-2"><div class="col-sm-12">نوع پروژه : ${data[index].project_type_fa}</div>
|
|
<div c
|
|
lass="col-sm-12">عنوان پروژه:${data[index].project_title} </div>
|
|
<div class="col-sm-12"> آخرین وضعیت پروژه :${data[index].last_status_fa} </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a></div>`
|
|
}
|
|
$("#projectcontent").append(listdata)
|
|
paginatepage()
|
|
}
|
|
function returnimage(url) {
|
|
return url != null ? "https://rms.rmto.ir/" + url : "../dist/images/notavailable.jpg"
|
|
}
|
|
function projectfilter(num) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("project_type") != -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 + "?project_type=" + num
|
|
} else {
|
|
window.location.href = window.location.href + "&project_type=" + num
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?project_type=" + num
|
|
}
|
|
}
|
|
|
|
function showimagefilter(data) {
|
|
if (data != null) {
|
|
return "https://rms.rmto.ir/storage" + data.slice(6)
|
|
}
|
|
else {
|
|
return "../dist/images/notavailable.jpg"
|
|
}
|
|
}
|
|
function showcountall(num) {
|
|
$(".widthcounter").append(
|
|
'<span class="count-this filteritem counter-for-rahdari counter-for" >' + num + '</span>'
|
|
)
|
|
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 showyearfilter(obj) {
|
|
var filterYear = "";
|
|
$.each(obj, function (key, value) {
|
|
filterYear += `<div class="col-sm-4 pb-3 yearstyle" onclick="showyearclick(${key})">${key} <span class="laststatus">(${value})</span></div>`
|
|
})
|
|
$(".startyear").append(filterYear);
|
|
}
|
|
function showcountproject(array) {
|
|
var projectType = ""
|
|
for (var i = 0; i < array.length; i++) {
|
|
projectType += ` <div class="col-sm-6 project-list project-type-${array[i].project_type_id}" onclick="projectfilter(${array[i].project_type_id})">
|
|
<img src="${setprojectimage(array[i].project_type_id)}"
|
|
style="width: 20px; height: 20px;" />
|
|
<span>${array[i].project_type_fa}</span>
|
|
<p class="numtype">(${array[i].count})</p>
|
|
</div>`
|
|
}
|
|
$(".project-type").append(projectType)
|
|
}
|
|
function setprojectimage(num) {
|
|
switch (num) {
|
|
case 1:
|
|
return "../dist/images/bamaicons/rookesh-bama.svg"
|
|
break;
|
|
case 2:
|
|
return "../dist/images/bamaicons/dangerpoint-bama.svg"
|
|
break;
|
|
case 3:
|
|
return "../dist/images/bamaicons/oprative-bama.svg"
|
|
break;
|
|
case 4:
|
|
return "../dist/images/bamaicons/abniefani-bama.svg"
|
|
break;
|
|
case 5:
|
|
return "../dist/images/bamaicons/green-home-bama.svg"
|
|
break;
|
|
case 6:
|
|
return "../dist/images/bamaicons/green-home-bama.svg"
|
|
break;
|
|
|
|
}
|
|
}
|
|
function axisfilter(array) {
|
|
var axisFilter = ""
|
|
for (var i = 0; i < array.length; i++) {
|
|
axisFilter += `<div class="col-sm-4 axis-state axistype-${i}"
|
|
onclick="axistypenum(${array[i].axis_type_id})">
|
|
<span>${array[i].axis_type_fa}</span>
|
|
<p class="numtype">(${array[i].count})</p>
|
|
</div>`
|
|
|
|
}
|
|
$(".axisfilter").append(axisFilter)
|
|
}
|
|
|
|
function status_num(array) {
|
|
var statusfilter = ""
|
|
for (var i = 0; i < array.length; i++) {
|
|
statusfilter += `<div class="col-sm-6 status-state status-${array[i].last_status_id}"
|
|
onclick="projectstatus(${array[i].last_status_id})"> ${array[i].last_status_fa}<p class="numtype">(${array[i].count})</p> </div>`
|
|
|
|
}
|
|
$(".status-append").append(statusfilter)
|
|
}
|
|
|
|
function showprovincefilter(array) {
|
|
$(".appendcity").empty()
|
|
var ostandata = [];
|
|
$.each(array, function (key, value) {
|
|
ostandata = ostandata + '<div class="col-sm-4 provinceshow" onclick="newsee(' + value.province_id + ')" id="province' + value.province_id + '"> ' + value.province_fa + '<span class="numtype">(' + value.count + ')</span></div>'
|
|
})
|
|
$(".appendostan").append(ostandata);
|
|
if (array.length == 1) {
|
|
showCityFilter(array[0].province_id)
|
|
}
|
|
}
|
|
function showCityFilter(num) {
|
|
$.ajax({
|
|
url: "https://rms.rmto.ir/public/contents/provinces/" + num,
|
|
type: "GET",
|
|
success: function (result) {
|
|
showCityList(result.data)
|
|
},
|
|
error: function (error) {
|
|
Swal.fire({
|
|
icon: "error",
|
|
title: "خطا سرور",
|
|
text: " مشکل در دریافت اطلاعات شهرستان ",
|
|
confirmButtonText: "بارگذاری مجدد",
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
location.reload(true);
|
|
return true;
|
|
}
|
|
});
|
|
},
|
|
});
|
|
}
|
|
function showCityList(citylist) {
|
|
|
|
for (var i = 0; i < citylist.length; i++) {
|
|
citydata = citydata + '<div class="col-sm-4 provinceshow" onclick="cityclick(' + citylist[i].id + ')" id="city' + citylist[i].id + '"> ' + citylist[i].name_fa + '</div>'
|
|
}
|
|
$(".appendcity").append(citydata)
|
|
|
|
}
|
|
function newsee(id) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("province") != -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 + "?province=" + id
|
|
} else {
|
|
window.location.href = window.location.href + "&province=" + id
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?province=" + id
|
|
}
|
|
|
|
}
|
|
function axistypenum(num) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("axis") != -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 + "?axis=" + num
|
|
} else {
|
|
window.location.href = window.location.href + "&axis=" + num
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?axis=" + num
|
|
}
|
|
}
|
|
|
|
function projectstatus(id) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("last_status") != -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 + "?last_status=" + id
|
|
} else {
|
|
window.location.href = window.location.href + "&last_status=" + id
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?last_status=" + id
|
|
}
|
|
}
|
|
|
|
function showpriorities(num) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("priority") != -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 + "?priority=" + num
|
|
} else {
|
|
window.location.href = window.location.href + "&priority=" + num
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?priority=" + num
|
|
}
|
|
}
|
|
|
|
function showfollowuppriorities(num) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("followup") != -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 + "?followup=" + num
|
|
} else {
|
|
window.location.href = window.location.href + "&followup=" + num
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?followup=" + num
|
|
}
|
|
}
|
|
|
|
function showyearclick(num) {
|
|
var currentDate = {}
|
|
currentFilterYear = num
|
|
currentDate.from = moment(currentFilterYear, "jYYYY");
|
|
var currentFilterQueryfrom = currentDate.from
|
|
.locale("en")
|
|
.format("YYYY-MM-DD");
|
|
currentDate.to = moment(currentFilterYear, "jYYYY");
|
|
currentDate.to.add(1, "year");
|
|
var currentFilterQueryto = currentDate.to
|
|
.locale("en")
|
|
.format("YYYY-MM-DD");
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("from_date") != -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 + "?from_date=" + currentFilterQueryfrom + "&to_date=" + currentFilterQueryto
|
|
} else {
|
|
window.location.href = window.location.href + "&from_date=" + currentFilterQueryfrom + "&to_date=" + currentFilterQueryto
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?from_date=" + currentFilterQueryfrom + "&to_date=" + currentFilterQueryto
|
|
}
|
|
}
|
|
function showFilterBama(query) {
|
|
var filterlist = ""
|
|
if (urlParams.get('project_type') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showProjectType(urlParams.get('project_type'))}</span><div onclick="deletproject()"><span class="spandelet delet-project-${urlParams.get('project_type')} ">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('province') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showProvinceNum()}</span><div onclick="deletprovince()"><span class="spandelet delet-province-${urlParams.get('province')} ">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('axis') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showAxisNum()}</span><div onclick="deletaxis()"><span class="spandelet delet-axis-${urlParams.get('axis')} ">×<span></div></div>`
|
|
}
|
|
if (urlParams.get('last_status') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showlast_status()}</span><div onclick="deletstatus()"><span class="spandelet delet-status-${urlParams.get('last_status')} ">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('from_date') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showFilterChoose(urlParams.get('from_date'))}</span><div onclick="deletdate()"><span class="spandelet delet-date-${showFilterChoose(urlParams.get('from_date'))}">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('priority') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showpriority()}</span><div onclick="deleteprio()"><span class="spandelet delet-priority-${(urlParams.get('priority'))}">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('followup') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showfollowup()}</span><div onclick="deletefollowup()"><span class="spandelet delet-followup-${(urlParams.get('followup'))}">×</span></div></div>`
|
|
}
|
|
if (urlParams.get('city') != null) {
|
|
filterlist += `<div class="itemchoosen"><span class="spanfilter">${showCityChoosen()}</span><div onclick="deletCity()"><span class="spandelet delet-City-${(urlParams.get('city'))}">×</span></div></div>`
|
|
}
|
|
$(".projectFilterChoosen").append(filterlist)
|
|
|
|
}
|
|
function showProjectType(num) {
|
|
switch (num) {
|
|
case "1":
|
|
return "روکش آسفالت(نگهداری رویه راه)"
|
|
break;
|
|
case "2":
|
|
return "رفع نقاط حادثه خیز"
|
|
break;
|
|
case "3":
|
|
return "ایمنی راه"
|
|
break;
|
|
case "4":
|
|
return "ابنیه فنی(تعمیر و بازسازی)"
|
|
break;
|
|
case "5":
|
|
return "راهدارخانه"
|
|
break;
|
|
case "6":
|
|
return "راه روستایی"
|
|
break;
|
|
}
|
|
}
|
|
function showProvinceNum() {
|
|
var specificProName = ""
|
|
if (globalDataCount.provinces.length == 0) {
|
|
$.ajax({
|
|
url: `https://rms.rmto.ir/webapi/getuser/province-perm?type=all`,
|
|
type: "GET",
|
|
async: false,
|
|
success: function (result) {
|
|
for (var i = 0; i < result.data.length; i++) {
|
|
if (urlParams.get('province') == result.data[i].id) {
|
|
specificProName = result.data[i].name_fa
|
|
|
|
}
|
|
}
|
|
},
|
|
error: function (error) {
|
|
|
|
},
|
|
});
|
|
return specificProName
|
|
}
|
|
else {
|
|
return globalDataCount.provinces[0].province_fa
|
|
}
|
|
}
|
|
|
|
function showAxisNum() {
|
|
var axis
|
|
if (globalDataCount.axis_types.length == 0) {
|
|
axis = urlParams.get('axis')
|
|
switch (axis) {
|
|
case "1":
|
|
return "آزادراه"
|
|
break;
|
|
case "2":
|
|
return "بزرگراه"
|
|
break;
|
|
case "3":
|
|
return "اصلی"
|
|
break;
|
|
case "4":
|
|
return "فرعی"
|
|
break;
|
|
case "5":
|
|
return "روستایی"
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
return globalDataCount.axis_types[0].axis_type_fa
|
|
}
|
|
}
|
|
function showlast_status() {
|
|
var last_status
|
|
if (globalDataCount.last_statuses.length == 0) {
|
|
last_status = urlParams.get('last_status')
|
|
switch (last_status) {
|
|
case "1":
|
|
return "در حال تجهیز کارگاه"
|
|
break;
|
|
case "2":
|
|
return "در حال اجرا"
|
|
break;
|
|
case "3":
|
|
return "خاتمه یافته و بهره برداری شده"
|
|
break;
|
|
case "4":
|
|
return "در دست مناقصه"
|
|
break;
|
|
}
|
|
}
|
|
return globalDataCount.last_statuses[0].last_status_fa
|
|
}
|
|
function showFilterChoose(date) {
|
|
var selectedYear = moment(date).locale("fa").format("YYYY");
|
|
return selectedYear
|
|
}
|
|
function showpriority() {
|
|
if (globalDataCount.priorities.length == 0) {
|
|
priority = urlParams.get('priority')
|
|
switch (priority) {
|
|
case "1":
|
|
return "کم"
|
|
break;
|
|
case "2":
|
|
return "متوسط"
|
|
break;
|
|
case "3":
|
|
return "زیاد"
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
|
|
return globalDataCount.priorities[0].priority_project_fa
|
|
}
|
|
}
|
|
function showfollowup() {
|
|
var followup
|
|
if (globalDataCount.priorities.length == 0) {
|
|
followup = urlParams.get('followup')
|
|
switch (followup) {
|
|
case "1":
|
|
return "کم(ماهیت محلی و منطقه ای…ری های ویژه در سطح ملی)"
|
|
break;
|
|
case "2":
|
|
return "متوسط (ماهیت ملی یا استانی)"
|
|
break;
|
|
case "3":
|
|
return "زیاد (مورد تاکید و پیگیر…ژه مسیولین محلی یا ملی)"
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
|
|
return globalDataCount.followup_priority[0].followup_priority_project
|
|
}
|
|
}
|
|
function showCityChoosen() {
|
|
if (globalDataCount.cities.length == 0) {
|
|
var province = urlParams.get('province')
|
|
var city = urlParams.get('city')
|
|
var cityName
|
|
if (province != null) {
|
|
$.ajax({
|
|
url: "https://rms.rmto.ir/public/contents/provinces/" + province,
|
|
type: "GET",
|
|
async: false,
|
|
success: function (result) {
|
|
console.log(result)
|
|
for (var i = 0; i < result.data.length; i++) {
|
|
if (city == result.data[i].id) {
|
|
cityName = result.data[i].name_fa
|
|
}
|
|
}
|
|
},
|
|
error: function (error) {
|
|
},
|
|
});
|
|
}
|
|
else {
|
|
cityName = " شهرستان"
|
|
}
|
|
|
|
return cityName
|
|
|
|
}
|
|
else {
|
|
|
|
return globalDataCount.cities[0].city_fa
|
|
}
|
|
}
|
|
function cityclick(num) {
|
|
if (querylength == 1) {
|
|
if (queryparams.indexOf("city") != -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 + "?city=" + num
|
|
} else {
|
|
window.location.href = window.location.href + "&city=" + num
|
|
}
|
|
} else {
|
|
window.location.href = window.location.href + "?city=" + num
|
|
}
|
|
}
|
|
function removeURLParameter(url, parameter) {
|
|
var to_date
|
|
// prefer to use l.search if you have a location/link object
|
|
var urlparts = url.split('?');
|
|
if (urlparts.length >= 2) {
|
|
var prefix = encodeURIComponent(parameter) + '=';
|
|
if (parameter == 'from_date') {
|
|
to_date = encodeURIComponent('to_date') + '=';
|
|
|
|
}
|
|
var pars = urlparts[1].split(/[&;]/g);
|
|
for (var i = pars.length; i-- > 0;) {
|
|
if (parameter == 'from_date') {
|
|
if (pars[i].lastIndexOf(to_date, 0) !== -1) {
|
|
pars.splice(i, 1);
|
|
}
|
|
else if (pars[i].lastIndexOf(prefix, 0) !== -1) {
|
|
pars.splice(i, 1);
|
|
}
|
|
}
|
|
else {
|
|
if (pars[i].lastIndexOf(prefix, 0) !== -1) {
|
|
pars.splice(i, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pars.length > 0) {
|
|
url = urlparts[0] + '?' + pars.join('&');
|
|
} else {
|
|
url = urlparts[0]
|
|
}
|
|
window.location.href = url
|
|
} else {
|
|
|
|
return url;
|
|
}
|
|
}
|
|
|
|
function deletproject() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'project_type')
|
|
}
|
|
}
|
|
function deletprovince() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'province')
|
|
}
|
|
}
|
|
function deletCity() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'city')
|
|
}
|
|
}
|
|
function deletaxis() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'axis')
|
|
}
|
|
}
|
|
function deletstatus() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'last_status')
|
|
}
|
|
}
|
|
function deletdate() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'from_date')
|
|
}
|
|
}
|
|
function deleteprio() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'priority')
|
|
}
|
|
}
|
|
|
|
function deletefollowup() {
|
|
var uri = window.location.toString();
|
|
if (uri.indexOf("?") > 0) {
|
|
removeURLParameter(uri, 'followup')
|
|
}
|
|
}
|
|
|
|
function prioritiesfilter(array) {
|
|
var priorities = ""
|
|
for (var i = 0; i < array.length; i++) {
|
|
priorities += `<div class="col-sm-4 pb-3 yearstyle" onclick="showpriorities(${array[i].priority_project})">${array[i].priority_project_fa} <span class="numtype">(${array[i].count})</span></div>`
|
|
}
|
|
$(".importancediv").append(priorities)
|
|
}
|
|
|
|
function followupprioritiesfilter(array) {
|
|
var followuppriorities = ""
|
|
for (var i = 0; i < array.length; i++) {
|
|
followuppriorities += `<div class="col-sm-12 pb-3 yearstyle" onclick="showfollowuppriorities(${array[i].followup_priority_project_id})">${array[i].followup_priority_project} <span class="numtype">(${array[i].count})</span></div>`
|
|
}
|
|
$(".followup-priority").append(followuppriorities)
|
|
}
|
|
function checkWindowSize() {
|
|
if (windoWidth <= 768) {
|
|
$(".BamaFilter").addClass("d-none")
|
|
$(".showbama").addClass("col-sm-12").removeClass("col-sm-9")
|
|
showResponsiveCard(globalData)
|
|
}
|
|
else {
|
|
$(".BamaFilter").removeClass("d-none")
|
|
showeachcard(globalData)
|
|
|
|
}
|
|
}
|
|
|
|
function showFilterNone() {
|
|
if (urlParams.has('project_type')) {
|
|
|
|
};
|
|
if (urlParams.has('province')) {
|
|
|
|
};
|
|
if (urlParams.has('city')) {
|
|
|
|
};
|
|
if (urlParams.has('axis')) {
|
|
|
|
};
|
|
if (urlParams.has('last_status')) {
|
|
|
|
};
|
|
if (urlParams.has('priority')) {
|
|
|
|
};
|
|
if (urlParams.has('followup')) {
|
|
|
|
};
|
|
if (urlParams.has('from_date')) {
|
|
|
|
};
|
|
|
|
}
|
|
function findProvinces(num) {
|
|
console.log("num", num)
|
|
$.ajax({
|
|
url: `https://rms.rmto.ir/webapi/getuser/province-perm?type=all`,
|
|
type: "GET",
|
|
success: function (result) {
|
|
console.log(result)
|
|
for (var i = 0; i < result.data.length; i++) {
|
|
if (num == result.data[i].id) {
|
|
return result.data[i].name_fa
|
|
}
|
|
}
|
|
},
|
|
error: function (error) {
|
|
|
|
},
|
|
});
|
|
}
|