Files
backend/public/dist/js/danger-points-all.js
2024-02-01 09:53:53 +00:00

411 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var rishearray = ["قوس تند افقی", "ابهام در مسیر (نقص در نحوه مسیرنمایی)", "عدم رعایت سرعت مجاز", "قوس تند قائم", "دید ناکافی(مثلث دید-مسافتدید توفق یا سبقت)", "عدم رعایت سبقت مجاز", "قرارگیری قوس افقی در تاج قوس قائم", "(جانمایی/طرح تابلو ) نقص در علائم پیش آگاهی و هدایت مسیر", "عدم رعایت محدودیت/ممنوعیت عبور", "قوس افقی در سرازیری تند", "نقص در علائم اخطاری و انتظامی", "عدم رعایت فاصله طولی", "هندسه نامناسب ورودی و خروجی دسترسی-تقاطع-دوربرگردان", "نقص در اشکارسازی نواحی انتقال قبل پل ها و تونل ها که شانه حذف میشود", "افتادگی در لبه آسفالت و یا فقدان شانه", "تبدیل نامناسب نوع راه (جدا شده به جدا نشده)", "عدم روشنایی ضروری در نقطه (محل عبور عرضی عمده عابرین یا خودرو ها)", "منطقه مه گیر /کولاک/یخ زدگی/شن زدگی", "منطقه با تداخل ترافیکی (نواحی مسکونی،صنعتی،تفریحی،مدارس،و..)", "منطقه با عبور حیوانات اهلی / وحشی", "کاهش نامناسب تعداد خطوط (4 به 3 یا به 2)", "منطقه با افزایش ناگهانی تراکم ترافیک", "منطقه با ریزش از دیوار ترانشه", "نبود /نقص در خط سبقت در سربالایی برای وسایل نقلیه سنگین در نواحی ضروری", "دور مناسب در قوس", "نقص در آشکار سازی شرایط خاص یا غیر منتظره", "رویه نامناسب (ناهموار-قیرزده-صیقلی) یا آسیب دیده (وجود چاله )", "محل نامناسب دسترسی/دسترسی های متعدد و نا ایمن در حریم راه", "عرض کم سواره رو", "سرازیری تند"];
var accidentarray = ["شیروانی تند یا پرتگاه بدون حفاظت", "سر ازاد حفاظ", "مانع صلب بدون حفاظت در حاشیه راه", "نقص در ناحیه انتقالی اتصال انواع حفاظ (محل پل و ...)", "نقص یا عدم کفایت حفاظ کناری", "نقص یا عدم کفایت نرده پل", "نقص یا عدم کفایت حفاظ میانی", "فقدان جداکننده در میانه راه چهار خطه"];
$.fn.dataTable.ext.errMode = "none";
showLoaderScreen();
$("#miladTable").DataTable({
dom: "<flB<t>p>",
destroy: true,
scrollX: true,
responsive: true,
// "pagingType": "full_numbers",
pagingType: "simple_numbers",
language: {
sEmptyTable: "هیچ داده‌ای در جدول وجود ندارد",
sInfo: "نمایش _START_ تا _END_ از _TOTAL_ ردیف",
sInfoEmpty: "نمایش 0 تا 0 از 0 ردیف",
sInfoFiltered: "(فیلتر شده از _MAX_ ردیف)",
sInfoPostFix: "",
sInfoThousands: ",",
sLengthMenu: "نمایش _MENU_ ردیف",
sLoadingRecords: "در حال بارگزاری...",
sProcessing: "در حال پردازش...",
sSearch: "جستجو: ",
sZeroRecords: "رکوردی با این مشخصات پیدا نشد",
oPaginate: {
sFirst: "برگه‌ی نخست",
sLast: "برگه‌ی آخر",
sNext: "بعدی",
sPrevious: "قبلی",
},
oAria: {
sSortAscending: ": فعال سازی نمایش به صورت صعودی",
sSortDescending: ": فعال سازی نمایش به صورت نزولی",
},
},
order: [
[0, "asc"][(1, "asc")],
[2, "desc"],
[3, "desc"],
[4, "desc"]
],
order: [
[0, "desc"]
],
processing: true,
select: true,
ajax: {
url: "https://rms.rmto.ir/api/danger-point-new-report-danesh",
type: "GET",
dataSrc: function(json) {
hideLoaderScreen();
return json.data;
},
},
columns: [{
data: "province_fa",
className: "text-center",
},
{
data: "axis_name",
className: "text-center",
},
{
data: "code",
className: "text-center",
},
{
data: "axis_type_fa",
className: "text-center",
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
// console.log(data.accident_date);
if (data.accident_date_fa != null) {
return data.accident_date_fa.substring(8);
} else {
return ""
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
// console.log(data.accident_date);
if (data.accident_date_fa != null) {
return data.accident_date_fa.substring(5, 7);
} else {
return "";
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
// console.log(data.accident_date);
if (data.accident_date_fa != null) {
return data.accident_date_fa.substring(2, 4);
} else {
return "";
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.day == "1") {
return "شنبه";
} else if (data.day == "2") {
return "یکشنبه";
} else if (data.day == "3") {
return "دوشنبه";
} else if (data.day == "4") {
return "سه‌شنبه";
} else if (data.day == "5") {
return "چهارشنبه";
} else if (data.day == "6") {
return "پنج‌شنبه";
} else {
return "جمعه";
}
},
},
{
data: "time",
className: "text-center",
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.collision_type == 1) {
return "رخ به رخ";
} else if ((data.collision_type == 2)) {
return "واژگونی";
} else if ((data.collision_type == 3)) {
return "جلو به عقب";
} else if ((data.collision_type == 4)) {
return "جلو به پهلو";
} else if ((data.collision_type == 5)) {
return "برخورد با شی ثابت";
} else {
return "برخورد با عابر";
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.bi;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.pa;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.an;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.ob;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.li;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var z = JSON.parse(data.accident_factors);
return z.he;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_type == "1") {
return `<i class="fa fa-check" aria-hidden="true"></i>`;
} else if (data.accident_type == "2") {
return `<i class="fas fa-times" aria-hidden="true"></i>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_type == "1") {
return `دارد`;
} else if (data.accident_type == "2") {
return `ندارد`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_type == "2") {
return `<i class="fa fa-check" aria-hidden="true"></i>`;
} else if (data.accident_type == "1") {
return `<i class="fas fa-times" aria-hidden="true"></i>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_type == "2") {
return `دارد`;
} else if (data.accident_type == "1") {
return `ندارد`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var f = JSON.parse(data.accident_result);
return f.de;
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var f = JSON.parse(data.accident_result);
return f.in;
},
},
{
data: "speed_limit",
className: "text-center"
},
{
data: "speed_average",
className: "text-center"
},
{
data: "geometric_desc_fa",
className: "text-center"
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_possibility == "0") {
return `<i class="fa fa-check" aria-hidden="true"></i>`;
} else if (data.accident_possibility == "1") {
return `<i class="fas fa-times" aria-hidden="true"></i>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_possibility == "0") {
return `<P>دارد</P>`;
} else if (data.accident_possibility == "1") {
return `<P>ندارد</P>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_251 == "0") {
return `<i class="fa fa-check" aria-hidden="true"></i>`;
} else if (data.accident_251 == "1") {
return `<i class="fas fa-times" aria-hidden="true"></i>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
if (data.accident_251 == "0") {
return `<P>دارد</P>`;
} else if (data.accident_251 == "1") {
return `<P>ندارد</P>`;
}
},
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var XOfRishe;
var newstr = '';
var q;
if (data.accident_cause != null) {
XOfRishe = data.accident_cause;
for (j = 0; j < XOfRishe.length; j++) {
q = rishearray[XOfRishe[j] - 1];
newstr = newstr + '-' + q;
}
return newstr;
}
}
},
{
data: null,
className: "text-center",
render: function(data, type, row) {
var XOfAccident;
var newstr2 = '';
var f;
if (data.accident_severity != null) {
XOfAccident = data.accident_severity;
for (x = 0; x < XOfAccident.length; x++) {
f = accidentarray[XOfAccident[x] - 1];
newstr2 = newstr2 + '-' + f;
}
return newstr2;
}
}
},
{
data: "lat",
className: "text-center"
},
{
data: "lng",
className: "text-center"
},
],
columnDefs: [{
targets: [16],
visible: false,
searchable: false,
}, {
targets: [18],
visible: false,
searchable: false,
}, {
targets: [25],
visible: false,
searchable: false,
},
{
targets: [27],
visible: false,
searchable: false,
},
],
buttons: [{
extend: "excelHtml5",
title: "Excel",
text: '<div class="d-flex flex-column"><i class="fa mb-2 fa-book icon-color"></i>خروجی به اکسل</div>',
messageTop: " تاریخچه تصادفات نقطه دارای تصادف ",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, 19, 20, 21, 22, 23, 25, 27, 28, 29, 30, 31, 32],
},
customize: function(xlsx) {
var sheet = xlsx.xl.worksheets["sheet1.xml"];
// Loop over the cells in column `C`
$('row c[r^="A"]', sheet).each(function() {
// Get the value
$(this).attr("s", "52");
});
$('row c[r^="B"]', sheet).each(function() {
// Get the value
$(this).attr("s", "52");
});
},
}, ],
});
//for loader of page start
function showLoaderScreen() {
$(".divloader").css("display", "flex").hide().fadeIn();
}
function hideLoaderScreen() {
$(".divloader").fadeOut();
}
//for loader of page end