2002 lines
72 KiB
JavaScript
2002 lines
72 KiB
JavaScript
var handledCount;
|
||
var pendingCount;
|
||
var table_inprogress;
|
||
var table_handled;
|
||
var locationMap = null;
|
||
var submitMap = null;
|
||
var locationMap_handled = null;
|
||
var submitMap_handled = null;
|
||
var mapUrl = "https://rmsmap.rmto.ir/141map/";
|
||
var MarkerAdd = null;
|
||
var MarkerSubmit = null;
|
||
var MarkerAdd_handled = null;
|
||
var MarkerSubmit_handled = null;
|
||
var isSetMarkerAdd = false;
|
||
var isSetMarkerSubmit = false;
|
||
var isSetMarkerAddHandled = false;
|
||
var isSetMarkerSubmitHandled = false;
|
||
var province_choosen;
|
||
var city_refrence = [];
|
||
var selectd_checkbox;
|
||
var Tracking_code;
|
||
var slideIndexlayer = 1;
|
||
var submit_done = 0;
|
||
var submit_not_done = 0;
|
||
var excelDatepickerFirstTable = {};
|
||
var excelDatepickerSecondTable = {};
|
||
var filterDatepickerFirstTable = {};
|
||
var filterDatepickerSecondTable = {};
|
||
var filterMainDate = {};
|
||
var PERMISSIONS = [];
|
||
var selected_id;
|
||
var previous_id;
|
||
var setId;
|
||
var flagIsSetMarker = false;
|
||
var handled_latlng;
|
||
var handled_num;
|
||
$("[data-mask]").inputmask();
|
||
var startDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-start" class="pin-marker">
|
||
<div class="map-pin-marker">
|
||
<div class="pin-main-circle"></div>
|
||
<div class="pin-white-circle"></div>
|
||
<div class="pin-title-circle">
|
||
<span class="title-circle-text">شروع</span>
|
||
</div>
|
||
<div class="pin-main-line"></div>
|
||
</div>
|
||
<div class="pin-main-shadow">
|
||
<div class="shadow-dot">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`,
|
||
iconSize: [55, 75],
|
||
iconAnchor: [33, 64],
|
||
});
|
||
var submitDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-submit" class="pin-marker">
|
||
<div class="map-pin-marker">
|
||
<div class="pin-main-circle"></div>
|
||
<div class="pin-white-circle"></div>
|
||
<div class="pin-title-circle">
|
||
<span class="title-circle-text">شروع</span>
|
||
</div>
|
||
<div class="pin-main-line"></div>
|
||
</div>
|
||
<div class="pin-main-shadow">
|
||
<div class="shadow-dot">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`,
|
||
iconSize: [55, 75],
|
||
iconAnchor: [33, 64],
|
||
});
|
||
var handledDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-handled" class="pin-marker">
|
||
<div class="map-pin-marker">
|
||
<div class="pin-main-circle"></div>
|
||
<div class="pin-white-circle"></div>
|
||
<div class="pin-title-circle">
|
||
<span class="title-circle-text">شروع</span>
|
||
</div>
|
||
<div class="pin-main-line"></div>
|
||
</div>
|
||
<div class="pin-main-shadow">
|
||
<div class="shadow-dot">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`,
|
||
iconSize: [55, 75],
|
||
iconAnchor: [33, 64],
|
||
});
|
||
var handledSubmitDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-handled-submited" class="pin-marker">
|
||
<div class="map-pin-marker">
|
||
<div class="pin-main-circle"></div>
|
||
<div class="pin-white-circle"></div>
|
||
<div class="pin-title-circle">
|
||
<span class="title-circle-text">شروع</span>
|
||
</div>
|
||
<div class="pin-main-line"></div>
|
||
</div>
|
||
<div class="pin-main-shadow">
|
||
<div class="shadow-dot">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`,
|
||
iconSize: [55, 75],
|
||
iconAnchor: [33, 64],
|
||
});
|
||
excelDatepickerFirstTable.from = $(
|
||
"#datapicker-from-excel-table-progress"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
excelDatepickerFirstTable.from.touched = true;
|
||
|
||
$("#datapicker-to-excel-table-progress").prop("disabled", "");
|
||
|
||
if (
|
||
excelDatepickerFirstTable.from.getState().selected.unixDate >=
|
||
excelDatepickerFirstTable.to.getState().selected.unixDate
|
||
) {
|
||
excelDatepickerFirstTable.to.setDate(
|
||
excelDatepickerFirstTable.from.getState().selected.unixDate
|
||
);
|
||
}
|
||
|
||
if (
|
||
excelDatepickerFirstTable.to &&
|
||
excelDatepickerFirstTable.to.options &&
|
||
excelDatepickerFirstTable.to.options.minDate != unix
|
||
) {
|
||
let cachedValue =
|
||
excelDatepickerFirstTable.to.getState().selected.unixDate;
|
||
|
||
excelDatepickerFirstTable.to.options = { minDate: unix };
|
||
|
||
if (excelDatepickerFirstTable.from.touched) {
|
||
excelDatepickerFirstTable.to.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
excelDatepickerFirstTable.to = $(
|
||
"#datapicker-to-excel-table-progress"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
excelDatepickerFirstTable.to.touched = true;
|
||
},
|
||
});
|
||
//excel done
|
||
excelDatepickerSecondTable.from = $(
|
||
"#datapicker-from-excel-table-done"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
excelDatepickerSecondTable.from.touched = true;
|
||
|
||
$("#datapicker-to-excel-table-done").prop("disabled", "");
|
||
|
||
if (
|
||
excelDatepickerSecondTable.from.getState().selected.unixDate >=
|
||
excelDatepickerSecondTable.to.getState().selected.unixDate
|
||
) {
|
||
excelDatepickerSecondTable.to.setDate(
|
||
excelDatepickerSecondTable.from.getState().selected.unixDate
|
||
);
|
||
}
|
||
|
||
if (
|
||
excelDatepickerSecondTable.to &&
|
||
excelDatepickerSecondTable.to.options &&
|
||
excelDatepickerSecondTable.to.options.minDate != unix
|
||
) {
|
||
let cachedValue =
|
||
excelDatepickerSecondTable.to.getState().selected.unixDate;
|
||
|
||
excelDatepickerSecondTable.to.options = { minDate: unix };
|
||
|
||
if (excelDatepickerSecondTable.from.touched) {
|
||
excelDatepickerSecondTable.to.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
excelDatepickerSecondTable.to = $(
|
||
"#datapicker-to-excel-table-done"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
excelDatepickerSecondTable.to.touched = true;
|
||
},
|
||
});
|
||
// filter table
|
||
filterDatepickerFirstTable.from = $(
|
||
"#datapicker-from-filter-table"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterDatepickerFirstTable.from.touched = true;
|
||
|
||
$("#datapicker-to-filter-table").prop("disabled", "");
|
||
|
||
if (
|
||
filterDatepickerFirstTable.from.getState().selected.unixDate >=
|
||
filterDatepickerFirstTable.to.getState().selected.unixDate
|
||
) {
|
||
filterDatepickerFirstTable.to.setDate(
|
||
filterDatepickerFirstTable.from.getState().selected.unixDate
|
||
);
|
||
}
|
||
|
||
if (
|
||
filterDatepickerFirstTable.to &&
|
||
filterDatepickerFirstTable.to.options &&
|
||
filterDatepickerFirstTable.to.options.minDate != unix
|
||
) {
|
||
let cachedValue =
|
||
filterDatepickerFirstTable.to.getState().selected.unixDate;
|
||
|
||
filterDatepickerFirstTable.to.options = { minDate: unix };
|
||
|
||
if (filterDatepickerFirstTable.from.touched) {
|
||
filterDatepickerFirstTable.to.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
filterDatepickerFirstTable.to = $(
|
||
"#datapicker-to-filter-table"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterDatepickerFirstTable.to.touched = true;
|
||
},
|
||
});
|
||
//filter done
|
||
filterDatepickerSecondTable.from = $(
|
||
"#datapicker-from-filter-table-done"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterDatepickerSecondTable.from.touched = true;
|
||
|
||
$("#datapicker-to-filter-table-done").prop("disabled", "");
|
||
|
||
if (
|
||
filterDatepickerSecondTable.from.getState().selected.unixDate >=
|
||
filterDatepickerSecondTable.to.getState().selected.unixDate
|
||
) {
|
||
filterDatepickerSecondTable.to.setDate(
|
||
filterDatepickerSecondTable.from.getState().selected.unixDate
|
||
);
|
||
}
|
||
|
||
if (
|
||
filterDatepickerSecondTable.to &&
|
||
filterDatepickerSecondTable.to.options &&
|
||
filterDatepickerSecondTable.to.options.minDate != unix
|
||
) {
|
||
let cachedValue =
|
||
filterDatepickerSecondTable.to.getState().selected.unixDate;
|
||
|
||
filterDatepickerSecondTable.to.options = { minDate: unix };
|
||
|
||
if (filterDatepickerSecondTable.from.touched) {
|
||
filterDatepickerSecondTable.to.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
filterDatepickerSecondTable.to = $(
|
||
"#datapicker-to-filter-table-done"
|
||
).persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterDatepickerSecondTable.to.touched = true;
|
||
},
|
||
});
|
||
//filter main
|
||
filterMainDate.from = $("#date-main-from").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterMainDate.from.touched = true;
|
||
|
||
$("#date-main-to").prop("disabled", "");
|
||
|
||
if (
|
||
filterMainDate.from.getState().selected.unixDate >=
|
||
filterMainDate.to.getState().selected.unixDate
|
||
) {
|
||
filterMainDate.to.setDate(
|
||
filterMainDate.from.getState().selected.unixDate
|
||
);
|
||
}
|
||
|
||
if (
|
||
filterMainDate.to &&
|
||
filterMainDate.to.options &&
|
||
filterMainDate.to.options.minDate != unix
|
||
) {
|
||
let cachedValue = filterMainDate.to.getState().selected.unixDate;
|
||
|
||
filterMainDate.to.options = { minDate: unix };
|
||
|
||
if (filterMainDate.from.touched) {
|
||
filterMainDate.to.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
filterMainDate.to = $("#date-main-to").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
filterMainDate.to.touched = true;
|
||
},
|
||
});
|
||
|
||
$(document).bind("click", function(e) {
|
||
const clicked = $(e.target);
|
||
if (clicked.parents(".toolbox").length != 0) return false;
|
||
if (clicked.parents(".datepicker-grid-view").length != 0) return false;
|
||
if (clicked.parents(".datepicker-navigator").length != 0) return false;
|
||
if (clicked.parents(".datepicker-container").length != 0) return false;
|
||
if (clicked.parents(".select2-selection__choice").length != 0) return false;
|
||
if (
|
||
clicked.closest(".btn-table-filter-progress").length == 0 &&
|
||
clicked.closest(".filter-progress").length == 0 &&
|
||
$(".filter-progress").css("display") != "none"
|
||
) {
|
||
$(".filter-progress").css("display", "none");
|
||
}
|
||
if (
|
||
clicked.closest(".btn-table-excel-progress").length == 0 &&
|
||
clicked.closest(".excel-progress").length == 0 &&
|
||
$(".excel-progress").css("display") != "none"
|
||
) {
|
||
$(".excel-progress").css("display", "none");
|
||
}
|
||
if (
|
||
clicked.closest(".btn-table-filter-done").length == 0 &&
|
||
clicked.closest(".filter-done").length == 0 &&
|
||
$(".filter-done").css("display") != "none"
|
||
) {
|
||
$(".filter-done").css("display", "none");
|
||
}
|
||
if (
|
||
clicked.closest(".btn-table-excel-done").length == 0 &&
|
||
clicked.closest(".excel-done").length == 0 &&
|
||
$(".excel-done").css("display") != "none"
|
||
) {
|
||
$(".excel-done").css("display", "none");
|
||
}
|
||
});
|
||
|
||
function showLoaderScreen() {
|
||
$(".divloader").css("display", "flex").hide().fadeIn();
|
||
}
|
||
|
||
function hideLoaderScreen() {
|
||
$(".divloader").fadeOut();
|
||
}
|
||
(function() {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/webapi/user/get-permission",
|
||
type: "GET",
|
||
cache: false,
|
||
async: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function(result) {
|
||
PERMISSIONS = result.data;
|
||
},
|
||
error: function() {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت سطح دسترسی",
|
||
confirmButtonText: "بروزرسانی صفحه",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
location.reload(true);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
// province via users
|
||
if (
|
||
$.inArray("show-fast-react", PERMISSIONS) != -1 ||
|
||
$.inArray("show-fast-react-province", PERMISSIONS) != -1
|
||
) {
|
||
$.ajax({
|
||
url: `https://rms.rmto.ir/webapi/getuser/province-perm${
|
||
$.inArray("show-fast-react", PERMISSIONS) != -1 ? "?type=all" : ""
|
||
}`,
|
||
type: "GET",
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
success: function(result) {
|
||
const provinces = result.data;
|
||
console.log("pro", provinces);
|
||
$("#select-province-filter-progress").empty();
|
||
$("#select-province-excel-table-progress").empty();
|
||
$("#select-province-excel-table-done").empty();
|
||
$("#select-province-filter-done").empty();
|
||
$("#province-main-filter").empty();
|
||
if (provinces.length == 35) {
|
||
$("#select-province-filter-progress").append(`<option value="0">کل کشور</option>`)
|
||
$("#select-province-excel-table-progress").append(`<option value="0">کل کشور</option>`)
|
||
$("#select-province-excel-table-done").append(`<option value="0">کل کشور</option>`)
|
||
$("#select-province-filter-done").append(`<option value="0">کل کشور</option>`)
|
||
$("#province-main-filter").append(`<option value="0">کل کشور</option>`)
|
||
}
|
||
for (let index = 0; index < provinces.length; index++) {
|
||
$("#select-province-filter-progress").append(
|
||
`<option value="${provinces[index].id}">${provinces[index].name_fa}</option>`
|
||
);
|
||
$("#select-province-excel-table-progress").append(
|
||
`<option value="${provinces[index].id}">${provinces[index].name_fa}</option>`
|
||
);
|
||
$("#select-province-excel-table-done").append(
|
||
`<option value="${provinces[index].id}">${provinces[index].name_fa}</option>`
|
||
);
|
||
$("#select-province-filter-done").append(
|
||
`<option value="${provinces[index].id}">${provinces[index].name_fa}</option>`
|
||
);
|
||
$("#province-main-filter").append(
|
||
`<option value="${provinces[index].id}">${provinces[index].name_fa}</option>`
|
||
);
|
||
}
|
||
},
|
||
error: function(error) {
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت استان ها",
|
||
confirmButtonText: "بروزرسانی صفحه",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
location.reload(true);
|
||
},
|
||
});
|
||
},
|
||
});
|
||
}
|
||
getCounterValue();
|
||
showInprogressTable();
|
||
// showHandledTable();
|
||
})();
|
||
|
||
function getCounterValue() {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/webapi/road-observed/count",
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
success: function(res) {
|
||
handled_num = res.data.handled
|
||
$("#progress_num").append(`<div class="incremental-counter incremental-counter0" data-value="${res.data.pending}">`)
|
||
$(".incremental-counter0").incrementalCounter();
|
||
|
||
},
|
||
error: function(error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت تعداد",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
console.log(error);
|
||
},
|
||
complete: function(data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
}
|
||
|
||
function counterFastReact(data) {
|
||
handledCount = data.handled;
|
||
pendingCount = data.pending;
|
||
$(".handled").each(function() {
|
||
$(this)
|
||
.prop("Counter", 0)
|
||
.animate({
|
||
Counter: handledCount,
|
||
}, {
|
||
duration: 3500,
|
||
easing: "swing",
|
||
step: function(now) {
|
||
$(this).text(Math.ceil(now));
|
||
},
|
||
});
|
||
});
|
||
$(".in_progress").each(function() {
|
||
$(this)
|
||
.prop("Counter", 0)
|
||
.animate({
|
||
Counter: pendingCount,
|
||
}, {
|
||
duration: 3500,
|
||
easing: "swing",
|
||
step: function(now) {
|
||
$(this).text(Math.ceil(now));
|
||
},
|
||
});
|
||
});
|
||
}
|
||
|
||
function showInprogressTable() {
|
||
table_inprogress = $("#complain-in-progress").DataTable({
|
||
dom: "<flB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
scrollX: true,
|
||
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: ": فعال سازی نمایش به صورت نزولی",
|
||
},
|
||
},
|
||
serverSide: false,
|
||
processing: true,
|
||
select: true,
|
||
ordering: true,
|
||
order: [
|
||
[0, 'asc'],
|
||
[1, 'asc']
|
||
],
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/webapi/road-observed/pending",
|
||
type: "GET",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
dataSrc: function(json) {
|
||
hideLoaderScreen();
|
||
return json.data;
|
||
},
|
||
error: function(jqXHR, textStatus, errorThrown) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا در دریافت اطلاعات",
|
||
text: jqXHR.status,
|
||
confirmButtonText: "بستن",
|
||
});
|
||
hideLoaderScreen();
|
||
},
|
||
},
|
||
columns: [{
|
||
className: "text-center",
|
||
data: "a",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "d",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "f",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "b",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "i",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<button class="btn-dataTable btn-sm report_type">...</button>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return '<div class="show_location_submited"><img class="image-hover" src="../dist/images/new-design/iranTempGreen.svg"></div>';
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "k",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "c",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<div class="d-flex flex-column"><div class="d-flex justify-content-start mb-3 mt-2"><input class="radio-control radio_table" type="radio" value="1" name="radio-control${data.a}" data-selected="1"><label class="pr-1 mb-0">انجام شد</label></div><div class="d-flex justify-content-start"><input class="radio-control radio_table" type="radio" value="2" name="radio-control${data.a}" data-selected="2"><label class="pr-1 mb-0">انجام نشد</label></div></div>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<div class="submited_location submited_location${data.a} active_awsome_disable before_submit_globe_loc"><img class="image-hover" src="../dist/images/new-design/iranTemp3.svg"></div>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<div class="img-box col d-flex justify-content-center">
|
||
<div class="d-flex flex-column">
|
||
<label
|
||
class="imgbox d-flex align-items-center justify-content-center"
|
||
for="before-Img${data.a}">
|
||
<span class="img-title">تصویر</span>
|
||
<img class="img-preview"
|
||
src="" />
|
||
</label>
|
||
<button
|
||
class="btn-delete-img btn-delete-img-${data.a} btn btn-secondary btn-sm" disabled><i
|
||
class="fa fa-trash"
|
||
style="color: #fff;"></i></button>
|
||
</div>
|
||
<input type="file"
|
||
id="before-Img${data.a}" class="img-input befor-img fastReact-img${data.a} d-none"
|
||
accept=".jpg, .png" disabled>
|
||
</div>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<div class="img-box col d-flex justify-content-center">
|
||
<div class="d-flex flex-column">
|
||
<label
|
||
class="imgbox d-flex align-items-center justify-content-center"
|
||
for="after-Img${data.a}">
|
||
<span class="img-title">تصویر</span>
|
||
<img class="img-preview" src="" />
|
||
</label>
|
||
<button
|
||
class="btn-delete-img btn-delete-img-${data.a} btn btn-secondary btn-sm" disabled><i
|
||
class="fa fa-trash"
|
||
style="color: #fff;"></i></button>
|
||
</div>
|
||
<input type="file"
|
||
id="after-Img${data.a}" class="img-input after-img fastReact-img${data.a} d-none"
|
||
accept=".jpg, .png" disabled>
|
||
</div>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<textarea id="description_box${data.a}" class="descripBox description_box${data.a}" name="" placeholder="توضیحات " rows="" cols="15" maxlength="250"></textarea> `;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `
|
||
<div class="text-center d-flex justify-content-center">
|
||
<div class="d-inline pr-1 pl-1">
|
||
<button class="btn-dataTable refrence_btn" title="ارجاع"><i class="fa fa-share" aria-hidden="true"></i><span>ارجاع</span></button>
|
||
</div>
|
||
<div class="d-inline pr-1 pl-1">
|
||
<button class="btn-dataTable submit_fast_react_btn submit_fast_react${data.a}" title="ارجاع" disabled><i class="fa fa-paper-plane" aria-hidden="true"></i><span>ثبت</span></button>
|
||
</div>
|
||
</div>`;
|
||
},
|
||
},
|
||
],
|
||
columnDefs: [
|
||
{ width: "5%", targets: 0 },
|
||
{ width: "6%", targets: 1 },
|
||
{ width: "6%", targets: 2 },
|
||
{ width: "19%", targets: 3 },
|
||
{ width: "11%", targets: 4 },
|
||
{ width: "5%", targets: 5 },
|
||
{ width: "5%", targets: 6 },
|
||
{ width: "6%", targets: 7 },
|
||
{ width: "6%", targets: 8 },
|
||
{ width: "6%", targets: 9 },
|
||
{ width: "5%", targets: 10 },
|
||
{ width: "4%", targets: 11 },
|
||
{ width: "4%", targets: 12 },
|
||
],
|
||
buttons: [{
|
||
text: '<div class="btn-table-filter-progress"><div class="d-flex flex-column"><i class="fa mb-2 fa-filter icon-color"></i> فیلترینگ پیشرفته</div></div>',
|
||
action: function(e, dt, node, config) {
|
||
$(".filter-progress").css("display", "block");
|
||
},
|
||
},
|
||
{
|
||
text: '<div class="btn-table-excel-progress"><div class="d-flex flex-column"><i class="fa mb-2 fa-book icon-color"></i>خروجی به اکسل </div></div>',
|
||
action: function(e, dt, node, config) {
|
||
$(".excel-progress").css("display", "block");
|
||
},
|
||
},
|
||
],
|
||
});
|
||
}
|
||
|
||
function showHandledTable() {
|
||
table_handled = $("#complain-handled").DataTable({
|
||
dom: "<flB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
scrollX: true,
|
||
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: ": فعال سازی نمایش به صورت نزولی",
|
||
},
|
||
},
|
||
processing: true,
|
||
select: true,
|
||
ordering: true,
|
||
order: [],
|
||
ajax: {
|
||
url: " https://rms.rmto.ir/webapi/road-observed/done",
|
||
type: "GET",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
dataSrc: function(json) {
|
||
hideLoaderScreen();
|
||
return json.data;
|
||
},
|
||
error: function(jqXHR, textStatus, errorThrown) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا در دریافت اطلاعات",
|
||
text: jqXHR.status,
|
||
confirmButtonText: "بستن",
|
||
});
|
||
hideLoaderScreen();
|
||
},
|
||
},
|
||
columns: [{
|
||
className: "text-center",
|
||
data: "a",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "d",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "f",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "b",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "i",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<button class="btn-dataTable btn-sm explain_report">...</button>`;
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return '<div class="complaint_location"><img class="image-hover" src="../dist/images/new-design/iranTempGreen.svg"></div>';
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "k",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "c",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
switch (data.l) {
|
||
case 1:
|
||
{
|
||
return `<div class="d-flex flex-column"><div class="d-flex justify-content-start mb-3 mt-2"><input class="radio-control radio_table_handled" type="radio" value="1" name="radio-control${data.a}" data-selected="1" checked disabled><label class="pr-1 mb-0">انجام شد</label></div><div class="d-flex justify-content-start"><input class="radio-control radio_table_handled" type="radio" value="2" name="radio-control${data.a}" data-selected="2" disabled><label class="pr-1 mb-0">انجام نشد</label></div></div>`;
|
||
}
|
||
case 2:
|
||
{
|
||
return `<div class="d-flex flex-column"><div class="d-flex justify-content-start mb-3 mt-2"><input class="radio-control radio_table_handled" type="radio" value="1" name="radio-control${data.a}" data-selected="1" disabled><label class="pr-1 mb-0">انجام شد</label></div><div class="d-flex justify-content-start"><input class="radio-control radio_table_handled" type="radio" value="2" name="radio-control${data.a}" data-selected="2" checked disabled><label class="pr-1 mb-0">انجام نشد</label></div></div>`;
|
||
}
|
||
default:
|
||
{
|
||
return `<div class="d-flex flex-column"><div class="d-flex justify-content-start mb-3 mt-2"><input class="radio-control radio_table_handled" type="radio" value="1" name="radio-control${data.a}" data-selected="1" disabled><label class="pr-1 mb-0">انجام شد</label></div><div class="d-flex justify-content-start"><input class="radio-control radio_table_handled" type="radio" value="2" name="radio-control${data.a}" data-selected="2" disabled><label class="pr-1 mb-0">انجام نشد</label></div></div>`;
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return '<div class="complaint_location_handled submit_globe_loc"><img class="image-hover" src="../dist/images/new-design/iranTempOrange.svg"></div>';
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
if (data.p != null) {
|
||
return `<div class="img-box image_befor_submited col d-flex justify-content-center"><i style="font-size: 28px;color: #28a745;" class="fa fa-image"></i></div>`;
|
||
} else {
|
||
return `_`;
|
||
}
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
if (data.q != null) {
|
||
return `<div class="img-box image_befor_submited col d-flex justify-content-center"><i style="font-size: 28px;color: #28a745;" class="fa fa-image"></i></div>`;;
|
||
} else {
|
||
return `_`;
|
||
}
|
||
},
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: "o",
|
||
},
|
||
{
|
||
orderable: false,
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
if (data.n == null) {
|
||
return `<textarea class="descripBox" name="" placeholder="توضیحات " rows="" cols="15" maxlength="250" disabled></textarea> `;
|
||
}
|
||
return `<textarea class="descripBox" name="" placeholder="توضیحات " rows="" cols="15" maxlength="250" disabled>${data.n}</textarea> `;
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
orderable: false,
|
||
className: "location",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return (
|
||
`
|
||
<div class="text-center" style="display: flex;justify-content: center;">
|
||
<div style=" display: inline;padding: 0 5px 0 5px;">
|
||
<img class="previewClass" src="../dist/images/new-design/preview.svg" onclick="window.open('/webapi/fast-reaction/` +
|
||
data.a +
|
||
`/preview/print')">
|
||
<div> pdf</div>
|
||
</div>
|
||
</div>`
|
||
);
|
||
},
|
||
},
|
||
],
|
||
columnDefs: [
|
||
{ width: "5%", targets: 0 },
|
||
{ width: "6%", targets: 1 },
|
||
{ width: "6%", targets: 2 },
|
||
{ width: "19%", targets: 3 },
|
||
{ width: "11%", targets: 4 },
|
||
{ width: "5%", targets: 5 },
|
||
{ width: "5%", targets: 6 },
|
||
{ width: "6%", targets: 7 },
|
||
{ width: "6%", targets: 8 },
|
||
{ width: "6%", targets: 9 },
|
||
{ width: "5%", targets: 10 },
|
||
{ width: "4%", targets: 11 },
|
||
{ width: "4%", targets: 12 },
|
||
],
|
||
buttons: [{
|
||
text: '<div class="btn-table-filter-done"><div class="d-flex flex-column"><i class="fa mb-2 fa-filter icon-color"></i> فیلترینگ پیشرفته</div></div>',
|
||
action: function(e, dt, node, config) {
|
||
$(".filter-done").css("display", "block");
|
||
},
|
||
},
|
||
{
|
||
text: '<div class="btn-table-excel-done"><div class="d-flex flex-column"><i class="fa mb-2 fa-book icon-color"></i>خروجی به اکسل </div></div>',
|
||
action: function(e, dt, node, config) {
|
||
$(".excel-done").css("display", "block");
|
||
},
|
||
},
|
||
],
|
||
});
|
||
}
|
||
$(".btn-done-table").on("click", function() {
|
||
$(".done-table").removeClass("hide-done-table").addClass("show-done-table");
|
||
$("#handled_num").append(`<div class="incremental-counter incremental-counter1" data-value="${handled_num}">`)
|
||
$(".incremental-counter1").incrementalCounter();
|
||
showHandledTable();
|
||
});
|
||
$(document).on("click", ".report_type", function() {
|
||
$(".textarea_explain_report").val();
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
$("#explain_report").modal("show");
|
||
$(".textarea_explain_report").val(row.data().j);
|
||
});
|
||
$(document).on("click", ".explain_report", function() {
|
||
$(".text_complaint_explain").val();
|
||
var tr = $(this).closest("tr");
|
||
var row = table_handled.row(tr);
|
||
$("#complaint_explain").modal("show");
|
||
$(".text_complaint_explain").val(row.data().j);
|
||
});
|
||
$(document).on("click", ".submit_description", function() {
|
||
$("#description_modal").modal("show");
|
||
});
|
||
$(document).on("click", ".show_location_submited", function() {
|
||
$("#location_modal").modal("show");
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
if (locationMap == null) {
|
||
setTimeout(() => {
|
||
createLocationMap(row.data().h, row.data().g);
|
||
}, 600);
|
||
} else {
|
||
setTimeout(() => {
|
||
clearLocationMap(row.data().h, row.data().g);
|
||
}, 600);
|
||
}
|
||
});
|
||
$(document).on("click", ".refrence_btn", function() {
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
province_choosen = row.data().e;
|
||
Tracking_code = row.data().a;
|
||
refrence_city(province_choosen);
|
||
$("#Reference_modal").modal("show");
|
||
});
|
||
|
||
function refrence_city(id) {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + id,
|
||
type: "GET",
|
||
success: function(data) {
|
||
city_refrence = data.data;
|
||
$(".refrence_select").empty();
|
||
$(".refrence_select").append(
|
||
`<option value="0" disabled selected>انتخاب شهرستان</option>`
|
||
);
|
||
for (let i = 0; i < city_refrence.length; i++) {
|
||
$(".refrence_select").append(
|
||
`<option value="${city_refrence[i].id}">${city_refrence[i].name_fa}</option>`
|
||
);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
function createLocationMap(lat, lng) {
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
if (lat != null) {
|
||
locationMap = L.map("add_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([lat, lng], 7);
|
||
} else {
|
||
locationMap = L.map("add_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([35.7065, 51.3477], 7);
|
||
}
|
||
L.tileLayer(`${mapUrl}{z}/{x}/{y}.png`, {}).addTo(locationMap);
|
||
setMarkerDefaultAdd(lat, lng);
|
||
}
|
||
|
||
function clearLocationMap(lat, lng) {
|
||
isSetMarkerAdd = false;
|
||
|
||
locationMap.removeLayer(MarkerAdd);
|
||
if (lat != null) {
|
||
locationMap.setView([lat, lng], 7);
|
||
} else {
|
||
locationMap.setView([35.7065, 51.3477], 7);
|
||
}
|
||
setMarkerDefaultAdd(lat, lng);
|
||
}
|
||
|
||
function setMarkerDefaultAdd(lat, lng) {
|
||
isSetMarkerAdd = false;
|
||
$("#pin-marker-start").removeClass("pin-set");
|
||
$("#add_project_start_map").val("");
|
||
if (lat != null) {
|
||
MarkerAdd = new L.marker([lat, lng], {
|
||
icon: startDivIcon,
|
||
draggable: false,
|
||
}).addTo(locationMap);
|
||
$("#add_project_start_map").val(
|
||
parseFloat(lat).toFixed(6) + parseFloat(lng).toFixed(6)
|
||
);
|
||
isSetMarkerAdd = true;
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
}
|
||
locationMap.on("move", function() {
|
||
if (!isSetMarkerAdd) {
|
||
MarkerAdd.setLatLng(L.latLng(locationMap.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
locationMap.on("moveend", function() {
|
||
if (!isSetMarkerAdd) {
|
||
MarkerAdd.setLatLng(L.latLng(locationMap.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
}
|
||
$(document).on("click", ".submited_location", function() {
|
||
$("#submit_location_modal").modal("show");
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
// setId = row.data().a;
|
||
// if (previous_id == setId) {
|
||
// flagIsSetMarker = true;
|
||
// previous_id = setId;
|
||
// } else {
|
||
// flagIsSetMarker = false;
|
||
// previous_id = setId;
|
||
// }
|
||
if (submitMap == null) {
|
||
setTimeout(() => {
|
||
createSubmitLocation(row.data().h, row.data().g);
|
||
}, 600);
|
||
} else {
|
||
setTimeout(() => {
|
||
clearSubmitLocation(row.data().h, row.data().g);
|
||
}, 600);
|
||
}
|
||
});
|
||
|
||
function createSubmitLocation(lat, lng) {
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
if (lat != null) {
|
||
submitMap = L.map("submit_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([lat, lng], 7);
|
||
} else {
|
||
submitMap = L.map("submit_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([35.7065, 51.3477], 7);
|
||
}
|
||
MarkerSubmit = new L.marker(L.latLng(submitMap.getCenter()), {
|
||
icon: submitDivIcon,
|
||
draggable: true,
|
||
}).addTo(submitMap);
|
||
L.tileLayer(`${mapUrl}{z}/{x}/{y}.png`, {}).addTo(submitMap);
|
||
setMarkerDefaultSubmit();
|
||
}
|
||
|
||
function clearSubmitLocation(lat, lng) {
|
||
if (lat != null) {
|
||
submitMap.setView([lat, lng], 7);
|
||
} else {
|
||
submitMap.setView([35.7065, 51.3477], 7);
|
||
}
|
||
setMarkerDefaultSubmit();
|
||
}
|
||
|
||
function setMarkerDefaultSubmit() {
|
||
submitMap.on("move", function() {
|
||
if (!isSetMarkerSubmit) {
|
||
MarkerSubmit.setLatLng(L.latLng(submitMap.getCenter()));
|
||
$("#pin-marker-submit").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
submitMap.on("moveend", function() {
|
||
if (!isSetMarkerSubmit) {
|
||
MarkerSubmit.setLatLng(L.latLng(submitMap.getCenter()));
|
||
$("#pin-marker-submit").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
|
||
MarkerSubmit.on("click", function() {
|
||
if (!isSetMarkerSubmit) {
|
||
MarkerSubmit.setLatLng(L.latLng(submitMap.getCenter()));
|
||
isSetMarkerSubmit = true;
|
||
$("#pin-marker-submit")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
$("#submit_project_start_map").val(
|
||
MarkerSubmit.getLatLng().lat.toFixed(6) +
|
||
MarkerSubmit.getLatLng().lng.toFixed(6)
|
||
);
|
||
}
|
||
$("#pin-marker-submit")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
});
|
||
|
||
MarkerSubmit.on("drag", function() {
|
||
$("#pin-marker-submit").addClass("pin-move");
|
||
});
|
||
|
||
MarkerSubmit.on("dragend", function() {
|
||
$("#pin-marker-submit").removeClass("pin-move");
|
||
if ($("#pin-marker-submit").hasClass("pin-set") || isSetMarkerSubmit) {
|
||
$("#pin-marker-submit").addClass("pin-set");
|
||
$("#submit_project_start_map").val(
|
||
MarkerSubmit.getLatLng().lat.toFixed(6) +
|
||
MarkerSubmit.getLatLng().lng.toFixed(6)
|
||
);
|
||
} else {
|
||
submitMap.setView(MarkerSubmit.getLatLng());
|
||
}
|
||
});
|
||
}
|
||
// uploading file input
|
||
$(document).on("change", ".img-input", function() {
|
||
var input = this;
|
||
var parent = $(input).parents(".img-box");
|
||
if (input.files && input.files[0]) {
|
||
var reader = new FileReader();
|
||
|
||
reader.onload = function(e) {
|
||
parent.find(".img-title").css("display", "none");
|
||
parent.find(".btn-delete-img").removeAttr("disabled");
|
||
parent.find(".img-preview").attr("src", e.target.result);
|
||
};
|
||
|
||
reader.readAsDataURL(input.files[0]);
|
||
}
|
||
});
|
||
|
||
$(document).on("click", ".btn-delete-img", function() {
|
||
var parent = $(this).parents(".img-box");
|
||
parent.find(".img-input").val("");
|
||
parent.find(".img-preview").removeAttr("src");
|
||
parent.find(".img-title").css("display", "");
|
||
$(this).attr("disabled", "disabled");
|
||
});
|
||
$(document).on("change", ".radio_table", function() {
|
||
selectd_checkbox = $(this).data("selected");
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
setId = row.data().a;
|
||
switch (selectd_checkbox) {
|
||
case 1:
|
||
{
|
||
$(".fastReact-img" + row.data().a).prop("disabled", "");
|
||
$(".submit_fast_react" + row.data().a).prop("disabled", "");
|
||
$(".btn-delete-img-" + row.data().a).css({
|
||
"background-color": "#007bff",
|
||
});
|
||
$(".submited_location" + row.data().a).removeClass(
|
||
"active_awsome_disable"
|
||
);
|
||
$(".submited_location" + row.data().a)
|
||
.children("img")
|
||
.attr("src", "../dist/images/new-design/iranTempDone.svg");
|
||
if (previous_id == setId) {
|
||
flagIsSetMarker = true;
|
||
previous_id = setId;
|
||
} else {
|
||
flagIsSetMarker = false;
|
||
previous_id = setId;
|
||
if (MarkerSubmit != null) {
|
||
isSetMarkerSubmit = false;
|
||
$("#pin-marker-submit").removeClass("pin-set");
|
||
MarkerSubmit.setLatLng([row.data().h, row.data().g]);
|
||
$("#submit_project_start_map").val("");
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
case 2:
|
||
{
|
||
$(".fastReact-img" + row.data().a).prop("disabled", true);
|
||
$(".submit_fast_react" + row.data().a).prop("disabled", "");
|
||
$(".btn-delete-img-" + row.data().a).css({
|
||
"background-color": "#6c757d",
|
||
});
|
||
$(".submited_location" + row.data().a).addClass("active_awsome_disable");
|
||
$(".submited_location" + row.data().a)
|
||
.children("img")
|
||
.attr("src", "../dist/images/new-design/iranTemp3.svg");
|
||
var parent = $(".btn-delete-img-" + row.data().a).parents(".img-box");
|
||
parent.find(".img-input").val("");
|
||
parent.find(".img-preview").removeAttr("src");
|
||
parent.find(".img-title").css("display", "");
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
$(document).on("click", ".refrence_submit", function() {
|
||
var city_id = $(".refrence_select").children("option:selected").val();
|
||
var city_fa = $(".refrence_select").children("option:selected").text();
|
||
formData = new FormData();
|
||
formData.append("id", Tracking_code);
|
||
formData.append("city_id", city_id);
|
||
formData.append("city_fa", city_fa);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/webapi/fast-reaction/fwd",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
success: function(result) {
|
||
$("#Reference_modal").modal("hide");
|
||
Swal.fire({
|
||
icon: "success",
|
||
text: "ارجاع با موفقیت انجام شد.",
|
||
confirmButtonText: "بستن",
|
||
preConfirm: () => {
|
||
location.reload();
|
||
},
|
||
});
|
||
},
|
||
error: function(error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
timer: 1500,
|
||
showConfirmButton: false,
|
||
});
|
||
},
|
||
complete: function(data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
});
|
||
$(document).on("click", ".submit_fast_react_btn", function() {
|
||
var tr = $(this).closest("tr");
|
||
var row = table_inprogress.row(tr);
|
||
selected_id = row.data().a;
|
||
var description = $(".description_box" + row.data().a).val();
|
||
formData = new FormData();
|
||
formData.append("rms-status", selectd_checkbox);
|
||
switch (selectd_checkbox) {
|
||
case 1:
|
||
{
|
||
if (isSetMarkerSubmit != false) {
|
||
const start_lat = MarkerSubmit.getLatLng().lat.toFixed(6);
|
||
const start_lng = MarkerSubmit.getLatLng().lng.toFixed(6);
|
||
|
||
formData.append("rms-start-latlng", [start_lat, start_lng]);
|
||
}
|
||
var image1 = $("#before-Img" + row.data().a).get(0).files[0];
|
||
if (image1 != undefined) {
|
||
formData.append("image-before-1", image1);
|
||
}
|
||
var image2 = $("#after-Img" + row.data().a).get(0).files[0];
|
||
if (image2 != undefined) {
|
||
formData.append("image-after-1", image2);
|
||
}
|
||
if (description != "") {
|
||
formData.append("rms-description", description);
|
||
}
|
||
if (!formData.has("rms-start-latlng")) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا موقعیت مکانی را انتخاب کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
if (!formData.has("image-before-1")) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا عکس قبل را انتخاب کنید .",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
if (!formData.has("image-after-1")) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا عکس بعد را انتخاب کنید .",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
submitPendingTable(formData);
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
case 2:
|
||
{
|
||
formData.append("rms-status", selectd_checkbox);
|
||
if (description != "") {
|
||
formData.append("rms-description", description);
|
||
}
|
||
if (!formData.has("rms-description")) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا توضیحات را وارد کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
submitPendingTable(formData);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
$(document).on("click", ".complaint_location", function() {
|
||
$("#handled_location_modal").modal("show");
|
||
var tr = $(this).closest("tr");
|
||
var row = table_handled.row(tr);
|
||
if (locationMap_handled == null) {
|
||
setTimeout(() => {
|
||
createHandledMapComplaintRange(row.data().h, row.data().g);
|
||
}, 600);
|
||
} else {
|
||
setTimeout(() => {
|
||
clearHandledMapComplaintRange(row.data().h, row.data().g);
|
||
}, 600);
|
||
}
|
||
});
|
||
$(document).on("click", ".complaint_location_handled", function() {
|
||
$("#handled_submited_modal ").modal("show");
|
||
var tr = $(this).closest("tr");
|
||
var row = table_handled.row(tr);
|
||
handled_latlng = JSON.parse(row.data().m);
|
||
if (submitMap_handled == null) {
|
||
setTimeout(() => {
|
||
createLocationMapSubmited(handled_latlng);
|
||
}, 600);
|
||
} else {
|
||
setTimeout(() => {
|
||
clearLocationMapSubmited(handled_latlng);
|
||
}, 600);
|
||
}
|
||
});
|
||
|
||
function createHandledMapComplaintRange(lat, lng) {
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
if (lat != null) {
|
||
locationMap_handled = L.map("complaint_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([lat, lng], 7);
|
||
} else {
|
||
locationMap_handled = L.map("complaint_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([35.7065, 51.3477], 7);
|
||
}
|
||
L.tileLayer(`${mapUrl}{z}/{x}/{y}.png`, {}).addTo(locationMap_handled);
|
||
setMarkerDefaultHandled(lat, lng);
|
||
}
|
||
|
||
function clearHandledMapComplaintRange(lat, lng) {
|
||
locationMap_handled.removeLayer(MarkerAdd_handled);
|
||
if (lat != null) {
|
||
locationMap_handled.setView([parseFloat(lat), parseFloat(lng)], 7);
|
||
} else {
|
||
locationMap_handled.setView([35.7065, 51.3477], 7);
|
||
}
|
||
setMarkerDefaultHandled(lat, lng);
|
||
}
|
||
|
||
function setMarkerDefaultHandled(lat, lng) {
|
||
isSetMarkerAddHandled = false;
|
||
$("#complaint_area_start_map").val("");
|
||
if (lat != null) {
|
||
MarkerAdd_handled = new L.marker([lat, lng], {
|
||
icon: handledDivIcon,
|
||
draggable: false,
|
||
}).addTo(locationMap_handled);
|
||
$("#complaint_area_start_map").val(
|
||
parseFloat(lat).toFixed(6) + parseFloat(lng).toFixed(6)
|
||
);
|
||
isSetMarkerAddHandled = true;
|
||
$("#pin-marker-handled")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
}
|
||
MarkerAdd_handled.on("move", function() {
|
||
if (!isSetMarkerAddHandled) {
|
||
MarkerAdd_handled.setLatLng(L.latLng(locationMap_handled.getCenter()));
|
||
$("#pin-marker-handled").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
locationMap_handled.on("moveend", function() {
|
||
if (!isSetMarkerAddHandled) {
|
||
MarkerAdd_handled.setLatLng(L.latLng(locationMap_handled.getCenter()));
|
||
$("#pin-marker-handled").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
}
|
||
|
||
function createLocationMapSubmited(latlng) {
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
if (latlng[0] != null) {
|
||
submitMap_handled = L.map("complaint_submited_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView(latlng, 7);
|
||
} else {
|
||
submitMap_handled = L.map("complaint_submited_map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([35.7065, 51.3477], 7);
|
||
}
|
||
L.tileLayer(`${mapUrl}{z}/{x}/{y}.png`, {}).addTo(submitMap_handled);
|
||
setMarkerDefaultHandledSubmited(latlng);
|
||
}
|
||
|
||
function clearLocationMapSubmited(latlng) {
|
||
submitMap_handled.removeLayer(MarkerSubmit_handled);
|
||
if (latlng[0] != null) {
|
||
submitMap_handled.setView(
|
||
[parseFloat(latlng[0]), parseFloat(latlng[1])],
|
||
7
|
||
);
|
||
} else {
|
||
submitMap_handled.setView([35.7065, 51.3477], 7);
|
||
}
|
||
setMarkerDefaultHandledSubmited(latlng);
|
||
}
|
||
|
||
function setMarkerDefaultHandledSubmited(latlng) {
|
||
isSetMarkerSubmitHandled = false;
|
||
$("#complaint_submited_map_start_map").val("");
|
||
if (latlng[0] != null) {
|
||
MarkerSubmit_handled = new L.marker(latlng, {
|
||
icon: handledSubmitDivIcon,
|
||
draggable: false,
|
||
}).addTo(submitMap_handled);
|
||
$("#complaint_submited_map_start_map").val(
|
||
parseFloat(latlng[0]).toFixed(6) + parseFloat(latlng[1]).toFixed(6)
|
||
);
|
||
isSetMarkerSubmitHandled = true;
|
||
$("#pin-marker-handled-submited")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
}
|
||
submitMap_handled.on("move", function() {
|
||
if (!isSetMarkerSubmitHandled) {
|
||
MarkerSubmit_handled.setLatLng(L.latLng(submitMap_handled.getCenter()));
|
||
$("#pin-marker-handled-submited")
|
||
.removeClass("pin-set")
|
||
.addClass("pin-move");
|
||
}
|
||
});
|
||
submitMap_handled.on("moveend", function() {
|
||
if (!isSetMarkerSubmitHandled) {
|
||
MarkerSubmit_handled.setLatLng(L.latLng(submitMap_handled.getCenter()));
|
||
$("#pin-marker-handled-submited").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
}
|
||
//photo slider
|
||
$(document).on("click", ".image_befor_submited", function() {
|
||
var tr = $(this).closest("tr");
|
||
var row = table_handled.row(tr);
|
||
var image_before = row.data().p;
|
||
var image_after = row.data().q;
|
||
var imageArray = [];
|
||
imageArray.push(image_before);
|
||
imageArray.push(image_after);
|
||
showimagealert(1, imageArray);
|
||
});
|
||
$(document).on("click", ".image_after_submited", function() {
|
||
var tr = $(this).closest("tr");
|
||
var row = table_handled.row(tr);
|
||
var image_before = row.data().p;
|
||
var image_after = row.data().q;
|
||
var imageArray = [];
|
||
imageArray.push(image_before);
|
||
imageArray.push(image_after);
|
||
showimagealert(2, imageArray);
|
||
});
|
||
|
||
function showimagealert(num, imageArray) {
|
||
slideIndexlayer = num;
|
||
let dataLength = 2;
|
||
$("#slideshow-slide").find(".mySlides").remove();
|
||
$("#slideshow-dot").find(".dot").remove();
|
||
|
||
for (let index = 0; index < 2; index++) {
|
||
var currentId = index + 1;
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
2 +
|
||
'</div><img src="' +
|
||
imageArray[index] +
|
||
'"> ' +
|
||
"</div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + currentId + ')"></span>'
|
||
);
|
||
}
|
||
if (dataLength > 0) {
|
||
slideindex = 1;
|
||
layerslidershow(slideindex);
|
||
$("#slideroverlay").css("display", "block");
|
||
}
|
||
}
|
||
$("#slideroverlay .close").on("click", function() {
|
||
$(this).parent().parent().css("display", "none");
|
||
$("#slideshow-slide").find(".mySlides").remove();
|
||
$("#slideshow-dot").find(".dot").remove();
|
||
});
|
||
|
||
$("#slideroverlay #slideshow-slide .prev").on("click", function() {
|
||
layerslidershow((slideIndexlayer -= 1));
|
||
});
|
||
|
||
$("#slideroverlay #slideshow-slide .next").on("click", function() {
|
||
layerslidershow((slideIndexlayer += 1));
|
||
});
|
||
|
||
function currentphotoshow(slideIndex) {
|
||
layerslidershow((slideIndexlayer = slideIndex));
|
||
}
|
||
|
||
function layerslidershow(n) {
|
||
let slides = $("#slideroverlay #slideshow-slide .mySlides");
|
||
let dots = $("#slideroverlay #slideshow-dot .dot");
|
||
if (n > slides.length) {
|
||
slideIndexlayer = 1;
|
||
}
|
||
if (n < 1) {
|
||
slideIndexlayer = slides.length;
|
||
}
|
||
$(slides).each(function() {
|
||
$(this).css("display", "none");
|
||
});
|
||
$(dots).each(function() {
|
||
$(this).removeClass("active");
|
||
});
|
||
$(slides[slideIndexlayer - 1]).css("display", "block");
|
||
$(dots[slideIndexlayer - 1]).addClass("active");
|
||
}
|
||
// submit pending table
|
||
function submitPendingTable(formData) {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "آیا مطمئن هستید؟",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
cancelButtonColor: "#d33",
|
||
confirmButtonText: "بله، تایید میشود",
|
||
cancelButtonText: "منصرف شدم!",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/webapi/road-observation-problems/" +
|
||
selected_id +
|
||
"/edit",
|
||
type: "POST",
|
||
data: formData,
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function() {
|
||
showLoaderScreen();
|
||
},
|
||
success: function(result) {
|
||
location.reload();
|
||
},
|
||
error: function(error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "خطایی رخ داده است.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
complete: function(data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
},
|
||
});
|
||
}
|
||
$(document).on("click", "#btn_excel_download_progress", function() {
|
||
let currentDate = {};
|
||
let queryParems = [];
|
||
const route = $(this).data("table");
|
||
const province = $("#select-province-excel-table-progress").val();
|
||
|
||
if (province != 0) queryParems.push(`province=${province}`);
|
||
if (
|
||
excelDatepickerFirstTable.from != "" &&
|
||
excelDatepickerFirstTable.to != ""
|
||
) {
|
||
currentDate.from = moment(
|
||
excelDatepickerFirstTable.from.getState().selected.year +
|
||
"/" +
|
||
excelDatepickerFirstTable.from.getState().selected.month +
|
||
"/" +
|
||
excelDatepickerFirstTable.from.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
currentDate.to = moment(
|
||
excelDatepickerFirstTable.to.getState().selected.year +
|
||
"/" +
|
||
excelDatepickerFirstTable.to.getState().selected.month +
|
||
"/" +
|
||
excelDatepickerFirstTable.to.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
queryParems.push(`fromDate=${currentDate.from}`);
|
||
queryParems.push(`toDate=${currentDate.to}`);
|
||
} else {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تاریخ مناسب برای دریافت فایل اکسل وارد کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
return false;
|
||
}
|
||
|
||
const url = `https://rms.rmto.ir/reports/fastnewreact/pending${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
|
||
window.open(url, "_blank");
|
||
});
|
||
$(document).on("click", "#btn_filter_progress", function () {
|
||
let currentDate = {};
|
||
let queryParems = [];
|
||
const province = $("#select-province-filter-progress").val();
|
||
const subject = $("#select-subject-progress").val();
|
||
if ((province != null) && (province!=0)) queryParems.push(`province=${province}`);
|
||
if ((subject != null) && (subject!=0)) queryParems.push(`subject=${subject}`);
|
||
if (
|
||
filterDatepickerFirstTable.from != "" &&
|
||
filterDatepickerFirstTable.to != ""
|
||
) {
|
||
currentDate.from = moment(
|
||
filterDatepickerFirstTable.from.getState().selected.year +
|
||
"/" +
|
||
filterDatepickerFirstTable.from.getState().selected.month +
|
||
"/" +
|
||
filterDatepickerFirstTable.from.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
currentDate.to = moment(
|
||
filterDatepickerFirstTable.to.getState().selected.year +
|
||
"/" +
|
||
filterDatepickerFirstTable.to.getState().selected.month +
|
||
"/" +
|
||
filterDatepickerFirstTable.to.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
queryParems.push(`from_date=${currentDate.from}`);
|
||
queryParems.push(`to_date=${currentDate.to}`);
|
||
}
|
||
|
||
const url = `https://rms.rmto.ir/webapi/road-observed/pending${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
$.ajax({
|
||
url: url,
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen();
|
||
},
|
||
success: function (res) {
|
||
table_inprogress.clear().rows.add(res.data).draw();
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت نوع عملیات.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
complete: function (data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
});
|
||
$(document).on("click", "#btn_filter_done", function () {
|
||
let currentDate = {};
|
||
let queryParems = [];
|
||
const province = $("#select-province-filter-done").val();
|
||
const subject = $("#select-subject-handled").val();
|
||
const rms_status = $("#select-status-handled").val();
|
||
|
||
if ((province != null)&& (province!=0)) queryParems.push(`province=${province}`);
|
||
if ((subject != null)&& (subject!=0)) queryParems.push(`subject=${subject}`);
|
||
if (rms_status != 0) queryParems.push(`rms_status=${rms_status}`);
|
||
|
||
if (
|
||
filterDatepickerSecondTable.from != "" &&
|
||
filterDatepickerSecondTable.to != ""
|
||
) {
|
||
currentDate.from = moment(
|
||
filterDatepickerSecondTable.from.getState().selected.year +
|
||
"/" +
|
||
filterDatepickerSecondTable.from.getState().selected.month +
|
||
"/" +
|
||
filterDatepickerSecondTable.from.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
currentDate.to = moment(
|
||
filterDatepickerSecondTable.to.getState().selected.year +
|
||
"/" +
|
||
filterDatepickerSecondTable.to.getState().selected.month +
|
||
"/" +
|
||
filterDatepickerSecondTable.to.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
queryParems.push(`from_date=${currentDate.from}`);
|
||
queryParems.push(`to_date=${currentDate.to}`);
|
||
}
|
||
|
||
const url = `https://rms.rmto.ir/webapi/road-observed/done${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
$.ajax({
|
||
url: url,
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen();
|
||
},
|
||
success: function (res) {
|
||
table_handled.clear().rows.add(res.data).draw();
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت نوع عملیات.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
complete: function (data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
});
|
||
$(document).on("click", "#btn_excel_download_done", function () {
|
||
let currentDate = {};
|
||
let queryParems = [];
|
||
const province = $("#select-province-excel-table-done").val();
|
||
|
||
if (province != 0) queryParems.push(`province=${province}`);
|
||
|
||
if (
|
||
excelDatepickerSecondTable.from != "" &&
|
||
excelDatepickerSecondTable.to != ""
|
||
) {
|
||
currentDate.from = moment(
|
||
excelDatepickerSecondTable.from.getState().selected.year +
|
||
"/" +
|
||
excelDatepickerSecondTable.from.getState().selected.month +
|
||
"/" +
|
||
excelDatepickerSecondTable.from.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
currentDate.to = moment(
|
||
excelDatepickerSecondTable.to.getState().selected.year +
|
||
"/" +
|
||
excelDatepickerSecondTable.to.getState().selected.month +
|
||
"/" +
|
||
excelDatepickerSecondTable.to.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
queryParems.push(`fromDate=${currentDate.from}`);
|
||
queryParems.push(`toDate=${currentDate.to}`);
|
||
} else {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تاریخ مناسب برای دریافت فایل اکسل وارد کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
return false;
|
||
}
|
||
|
||
const url = `https://rms.rmto.ir/reports/fastnewreact/done${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
window.open(url, "_blank");
|
||
});
|
||
$(document).on("click", "#main-filter-fast-react", function () {
|
||
let currentDate = {};
|
||
let queryParems = [];
|
||
const province = $("#province-main-filter").val();
|
||
var tableNum = $("#select-main-table").val();
|
||
var url;
|
||
if ((province != null)&&(province!=0)) queryParems.push(`province=${province}`);
|
||
if (filterMainDate.from != "" && filterMainDate.to != "") {
|
||
currentDate.from = moment(
|
||
filterMainDate.from.getState().selected.year +
|
||
"/" +
|
||
filterMainDate.from.getState().selected.month +
|
||
"/" +
|
||
filterMainDate.from.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
currentDate.to = moment(
|
||
filterMainDate.to.getState().selected.year +
|
||
"/" +
|
||
filterMainDate.to.getState().selected.month +
|
||
"/" +
|
||
filterMainDate.to.getState().selected.date,
|
||
"jYYYY/jM/jD"
|
||
).format("YYYY-MM-DD");
|
||
|
||
queryParems.push(`from_date=${currentDate.from}`);
|
||
queryParems.push(`to_date=${currentDate.to}`);
|
||
}
|
||
if (tableNum == 1) {
|
||
url = `https://rms.rmto.ir/webapi/road-observed/pending${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
mainFilterTable(table_inprogress, url);
|
||
} else if (tableNum == 2) {
|
||
url = `https://rms.rmto.ir/webapi/road-observed/done${
|
||
queryParems.length != 0 ? `?${queryParems.join("&")}` : ""
|
||
}`;
|
||
mainFilterTable(table_handled, url);
|
||
} else {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع جدول را انتخاب کنید. ",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
$("#select-main-table").addClass("is-invalid");
|
||
}
|
||
});
|
||
function mainFilterTable(table, url) {
|
||
$.ajax({
|
||
url: url,
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen();
|
||
},
|
||
success: function (res) {
|
||
table.clear().rows.add(res.data).draw();
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در دریافت نوع عملیات.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
complete: function (data) {
|
||
hideLoaderScreen();
|
||
},
|
||
});
|
||
}
|
||
$("#select-main-table").change(function () {
|
||
var selectedNum = $(this).val();
|
||
if (selectedNum != 0) {
|
||
$("#select-main-table").removeClass("is-invalid");
|
||
}
|
||
}); |