var map = null;
var table;
var startAbrarMarker = null;
var isSetStartAbrarMarker = false;
var endAbrarMarker = null;
var isSetEndAbrarMarker = false;
var mapshow = null;
var startAbrarMarkershow = null;
var isSetStartAbrarMarkershow = false;
var endAbrarMarkershow = null;
var isSetEndAbrarMarkershow = false;
var routeControls = [];
var routeControlsPath = [];
var popupArrays = [];
var popupArraysPath = [];
var polylinePath = null;
var project_distance_check = {}
var edit;
var idEdit;
var cost;
var mapCenterLat = null;
var mapCenterLng = null;
var tablesecond;
var hasError = false;
var province,
town,
axisName,
axisType,
projectTitle,
contractor,
consultant,
contractDate,
contractPrice,
contractDatePicker;
var provinces = [];
var towns = [];
var projectDistance = {};
var editProjectDistance = null;
var projectDistanceLastUpdate = null;
var projectDistanceLastUpdatestatus = null
var projectDefaultDistances = null;
var project_distance_edit = {};
var project_title = "";
var rowId = 0;
var historyId = 0;
var sliderImages = null;
var slideIndexlayer = 1;
var idkol;
var objectshow = {};
var status;
var locationStartLatLng, locationEndLatLng;
var boundingbox;
var tooltipjson;
var max1 = null
var max2 = null
var max3 = null
var max4 = null
var max5 = null
var max6 = null
var max7 = null
var max8 = null
var max9 = null
var max10 = null
var max11 = null
var max12 = null
var max13 = null
var min1 = null
var min2 = null
var min3 = null
var min4 = null
var min5 = null
var min6 = null
var min7 = null
var min8 = null
var min9 = null
var min10 = null
var min11 = null
var min12 = null
var min13 = null
var startAbrarDivIcon = L.divIcon({
html: `
`;
let imageIndex1 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-1");
});
if (imageIndex1 != -1) {
test += `
`;
} else {
test += `
`;
}
// if (rowImages.length > 1) {
let imageIndex2 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-2");
});
if (imageIndex2 != -1) {
test += `
`;
} else {
if (imageIndex1 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
// }
let imageIndex3 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-3");
});
if (imageIndex3 != -1) {
test += `
`;
} else {
if (imageIndex2 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
let imageIndex4 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-4");
});
if (imageIndex4 != -1) {
test += `
`;
} else {
if (imageIndex3 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
let imageIndex5 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-5");
});
if (imageIndex5 != -1) {
test += `
`;
} else {
if (imageIndex4 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
let imageIndex6 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-6");
});
if (imageIndex6 != -1) {
test += `
`;
} else {
if (imageIndex5 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
let imageIndex7 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-7");
});
if (imageIndex7 != -1) {
test += `
`;
} else {
if (imageIndex6 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
let imageIndex8 = rowImages.findIndex(function (entry) {
return entry.path.includes("image-8");
});
if (imageIndex8 != -1) {
test += `
`;
} else {
if (imageIndex7 != -1) {
test += `
`;
}
else {
test += `
`;
}
}
// } else {
// test += `
// `;
// // }
$("#image-upload-modal .modal-body").empty();
$("#image-upload-modal .modal-body").append(test);
$("#inputFile1").change(function () {
$("#firstshow").css("display", "none");
readURL1(this);
});
$("#inputFile2").change(function () {
$("#secondshow").css("display", "none");
readURL2(this);
});
$("#inputFile3").change(function () {
$("#thirdshow").css("display", "none");
readURL3(this);
});
$("#inputFile4").change(function () {
$("#fourthshow").css("display", "none");
readURL4(this);
});
$("#inputFile5").change(function () {
$("#fifthshow").css("display", "none");
readURL5(this);
});
$("#inputFile6").change(function () {
$("#sixshow").css("display", "none");
readURL6(this);
});
$("#inputFile7").change(function () {
$("#sevenshow").css("display", "none");
readURL7(this);
});
$("#inputFile8").change(function () {
$("#eightshow").css("display", "none");
readURL8(this);
});
$("#image-upload-modal").modal("show");
});
$("#example-update").on("click", "button.upload-image-buttonslider", function () {
var tr = $(this).closest("tr");
openSlider(tr)
var row = tablethird.row(tr);
historyId = row.data().id;
})
function readURL1(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_first").css("display", "block");
$("#image_upload_first").attr("src", e.target.result);
uploadUpdateImage(1, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL2(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_second").css("display", "block");
$("#image_upload_second").attr("src", e.target.result);
uploadUpdateImage(2, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL3(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_third").css("display", "block");
$("#image_upload_third").attr("src", e.target.result);
uploadUpdateImage(3, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL4(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_fourth").css("display", "block");
$("#image_upload_fourth").attr("src", e.target.result);
uploadUpdateImage(4, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL5(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_fifth").css("display", "block");
$("#image_upload_fifth").attr("src", e.target.result);
uploadUpdateImage(5, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL6(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_six").css("display", "block");
$("#image_upload_six").attr("src", e.target.result);
uploadUpdateImage(6, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL7(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_seven").css("display", "block");
$("#image_upload_seven").attr("src", e.target.result);
uploadUpdateImage(7, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function readURL8(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$("#image_upload_eight").css("display", "block");
$("#image_upload_eight").attr("src", e.target.result);
uploadUpdateImage(8, input);
};
reader.readAsDataURL(input.files[0]);
}
}
function removeImage(index) {
console.log("index", index);
let formData = new FormData();
formData.append("history-id", historyId);
formData.append("name", "image-" + index);
for (var value of formData.values()) {
console.log("valll",value);
}
Swal.fire({
icon: "warning",
title: "آیا برای حذف مطمئن هستید؟",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "بله، تایید میشود",
cancelButtonText: "منصرف شدم!",
showLoaderOnConfirm: true,
preConfirm: () => {
// showLoaderScreen()
$.ajax({
url: `https://rms.rmto.ir/rahdari/road-construction-rural/history-images/delete-image`,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (result) {
console.log(result);
$("#image-upload-modal").modal("hide");
ajaxcalltablethird2(idkol);
},
error: function (error) {
console.log(error);
Swal.fire({
icon: "error",
title: "خطا",
confirmButtonText: "بستن",
});
},
});
},
});
}
function uploadUpdateImage(index, input) {
let formData = new FormData();
formData.append("history-id", historyId);//pitikoooooooooo
formData.append("image", input.files[0]);
formData.append("name", "image-" + index);
for (var value of formData.values()) {
console.log(value);
}
showLoaderScreen();
$.ajax({
url: `https://rms.rmto.ir/rahdari/road-construction-rural/history-images/upload`,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (result) {
hideLoaderScreen();
$("#image-upload-modal").modal("hide");
console.log(result);
ajaxcalltablethird3(idkol);
},
error: function (error) {
console.log(error);
hideLoaderScreen();
// alert("خطا در آپلود تصویر :(");
},
});
}
$("#add-project-update").on("click", function () {
console.log("projectDistanceLastUpdate", projectDistanceLastUpdate)
var kilofirst;
$("#project_last_status").removeClass('is-invalid')
$("#alertshowprogress1").css('color', 'black')
$("#alertshowprogress1").empty()
$("#alertshowprogress1").append("درصد پیشرفت فیزیکی")
$("#alertshowprogress2").css('color', 'black')
$("#alertshowprogress2").empty()
$("#alertshowprogress2").append("درصد پیشرفت فیزیکی")
$("#alertshowprogress3").css('color', 'black')
$("#alertshowprogress3").empty()
$("#alertshowprogress3").append("درصد پیشرفت فیزیکی")
$("#alertshowprogress4").css('color', 'black')
$("#alertshowprogress4").empty()
$("#alertshowprogress4").append("درصد پیشرفت فیزیکی")
for (let index = 1; index <= 12; index++) {
if ($("#item" + index).css("display") != "none") {
$("#project-distance-input-" + index + "-2").removeClass("is-invalid");
}
}
console.log("projectDistanceLastUpdateyasi", projectDistanceLastUpdate);
if (projectDistanceLastUpdate != null) {
for (let index = 1; index <= 4; index++) {
let distanceIndex = Object.keys(
projectDistanceLastUpdate.previous_project_distance_update
).findIndex(function (entry) {
return entry == index;
});
// console.log(index + " -> " + distanceIndex);
if (distanceIndex == -1) {
$("#item" + index).hide();
$("#item" + index + "-data").hide();
} else {
switch (index) {
case 1: {
$("#item" + index).show();
$("#item" + index + "-data").show();
min1 = projectDistanceLastUpdate.previous_project_distance_update[
Object.keys(
projectDistanceLastUpdate.previous_project_distance_update
)[distanceIndex]
][0]
projectProgressPercentage1 = $("#project-progress-percentage1").slider({
min: 0,
max: 100,
value: min1,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 2: {
$("#item" + index).show();
$("#item" + index + "-data").show();
min2 = projectDistanceLastUpdate.previous_project_distance_update[
Object.keys(
projectDistanceLastUpdate.previous_project_distance_update
)[distanceIndex]
][0]
projectProgressPercentage2 = $("#project-progress-percentage2").slider({
min: 0,
max: 100,
value: min2,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 3: {
$("#item" + index).show();
$("#item" + index + "-data").show();
// console.log("kilofirsttetsttttttttttttttttttttt", kilofirst[0])
min3 = projectDistanceLastUpdate.previous_project_distance_update[
Object.keys(
projectDistanceLastUpdate.previous_project_distance_update
)[distanceIndex]
][0]
projectProgressPercentage3 = $("#project-progress-percentage3").slider({
min: 0,
max: 100,
value: min3,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 4: {
$("#item" + index).show();
$("#item" + index + "-data").show();
min4 = projectDistanceLastUpdate.previous_project_distance_update[
Object.keys(
projectDistanceLastUpdate.previous_project_distance_update
)[distanceIndex]
][0]
projectProgressPercentage4 = $("#project-progress-percentage4").slider({
min: 0,
max: 100,
value: min4,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
}
$("#project_last_status").val(
projectDistanceLastUpdate.previous_project_status
);
}
}
} else {
for (let index = 1; index <= 4; index++) {
// console.log("ji",projectDefaultDistances)
let distanceIndex = Object.keys(projectDefaultDistances).findIndex(
function (entry) {
// console.log("entry" , entry )
// kilofirst = projectDefaultDistances[index];
// console.log("kilofirst", kilofirst)
return entry == index;
}
);
// console.log(index + " -> " + distanceIndex);
if (distanceIndex == -1) {
$("#item" + index).hide();
$("#item" + index + "-data").hide();
} else {
switch (index) {
case 1: {
$("#item" + index).show();
$("#item" + index + "-data").show();
// console.log(kilofirst)
projectProgressPercentage1 = $("#project-progress-percentage1").slider({
min: 0,
max: 100,
value: 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 2: {
$("#item" + index).show();
$("#item" + index + "-data").show();
projectProgressPercentage2 = $("#project-progress-percentage2").slider({
min: 0,
max: 100,
value: 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 3: {
$("#item" + index).show();
$("#item" + index + "-data").show();
projectProgressPercentage3 = $("#project-progress-percentage3").slider({
min: 0,
max: 100,
value: 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
case 4: {
$("#item" + index).show();
$("#item" + index + "-data").show();
projectProgressPercentage4 = $("#project-progress-percentage4").slider({
min: 0,
max: 100,
value: 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + "٪";
},
// tooltip: "always",
tooltip_position: "bottom",
});
break;
}
}
// $("#contractor-fee").attr('max' , //todo yasi );
// console.log(
// projectDistanceLastUpdate[
// Object.keys(projectDistanceLastUpdate)[distanceIndex]
// ]
// );
}
}
}
$("#project-update-modal").modal("show");
});
$("#add-update-button").on("click", function () {
var testflag = 0;
let formData = new FormData();
let project_distance_update = {};
if (projectDistanceLastUpdate != null) {
console.log(min1, min2, min3, min4)
// var minval = projectDistanceLastUpdate.previous_physical_progress
if ($("#item1").css("display") != "none") {
if (projectProgressPercentage1.slider("getValue") < min1) {
var data = '
درصد نمیتواند از ' + min1 + ' کمتر باشد '
$("#alertshowprogress1").empty()
$("#alertshowprogress1").append(data)
$("#alertshowprogress1").css('color', 'red')
testflag = 1;
}
}
if ($("#item2").css("display") != "none") {
if (projectProgressPercentage2.slider("getValue") < min2) {
var data = '
درصد نمیتواند از ' + min2 + ' کمتر باشد '
$("#alertshowprogress2").empty()
$("#alertshowprogress2").append(data)
$("#alertshowprogress2").css('color', 'red')
testflag = 1;
}
}
if ($("#item3").css("display") != "none") {
if (projectProgressPercentage3.slider("getValue") < min3) {
var data = '
درصد نمیتواند از ' + min3 + ' کمتر باشد '
$("#alertshowprogress3").empty()
$("#alertshowprogress3").append(data)
$("#alertshowprogress3").css('color', 'red')
testflag = 1;
}
}
if ($("#item4").css("display") != "none") {
if (projectProgressPercentage4.slider("getValue") < min4) {
var data = '
درصد نمیتواند از ' + min4 + ' کمتر باشد '
$("#alertshowprogress4").empty()
$("#alertshowprogress4").append(data)
$("#alertshowprogress4").css('color', 'red')
testflag = 1;
}
}
}
if ($("#project_last_status").val() == 0) {
$("#project_last_status").addClass('is-invalid')
testflag = 1
}
for (let index = 1; index <= 4; index++) {
if ($("#item" + index).css("display") != "none") {
if (index == 1) {
project_distance_update[index] = [];
project_distance_update[index].push(
projectProgressPercentage1.slider("getValue").toString()
);
project_distance_update[index].push(
"احداث ابنیه فنی"
);
} else if (index == 2) {
project_distance_update[index] = [];
project_distance_update[index].push(
projectProgressPercentage2.slider("getValue").toString()
);
project_distance_update[index].push(
"عملیات خاکی"
);
} else if (index == 3) {
project_distance_update[index] = [];
project_distance_update[index].push(
projectProgressPercentage3.slider("getValue").toString()
);
project_distance_update[index].push(
"روسازی"
);
} else if (index == 4) {
project_distance_update[index] = [];
project_distance_update[index].push(
projectProgressPercentage4.slider("getValue").toString()
);
project_distance_update[index].push(
"آسفالت"
);
}
}
}
console.log("pitikoo", JSON.stringify(project_distance_update))
console.log("testflag", testflag)
if (testflag == 0) {
console.log("project_distance_update", project_distance_update);
formData.append(
"project-distance-update",
JSON.stringify(project_distance_update)
);
formData.append(
"project-status",
$("#project_last_status").children("option:selected").val()
);
for (var value of formData.values()) {
console.log(value);
}
showLoaderScreen();
$.ajax({
url:
"https://rms.rmto.ir/rahdari/road-construction-rural/" +
idkol +
"/edit-distance-update",
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (result) {
$("#project-update-modal").modal("hide");
// hideLoaderScreen();
// ajaxcalltablethird2(idkol)
location.reload()
// ajaxcalltablefirstupdate(idkol);
// Swal.fire({
// icon: "success",
// title: "با موفقیت بروزرسانی شد",
// confirmButtonText: "بستن",
// preConfirm: () => {
// location.reload();
// },
// });
},
error: function (error) {
hideLoaderScreen();
console.log(error);
Swal.fire({
icon: "error",
title: "خطا",
text: "پر کردن صحیح تمامی عناوین خواسته شده الزامی است",
confirmButtonText: "بستن",
});
},
});
} else {
Swal.fire({
icon: "error",
title: "خطا",
text: "پر کردن صحیح تمامی عناوین خواسته شده الزامی است",
confirmButtonText: "بستن",
});
}
});
function openSlider(tr) {
let row = tablethird.row(tr);
sliderImages = row.data().images;
let updated_at = row.data().updated_at;
let dataLength = sliderImages.length;
console.log(sliderImages);
$("#slideshow-slide").find(".mySlides").remove();
$("#slideshow-dot").find(".dot").remove();
for (let index = 0; index < sliderImages.length; index++) {
if (sliderImages[index].path.includes("image-1")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
"1" +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-2")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-3")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-4")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-5")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-6")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-7")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
if (sliderImages[index].path.includes("image-8")) {
let divSlide =
'
' +
(index + 1) +
" / " +
sliderImages.length +
'

تصویر ' +
(index + 1) +
":" +
" " +
"تاریخ :" +
updated_at +
"
";
$("#slideshow-slide").append(divSlide);
$("#slideshow-dot").append(
'
'
);
}
}
if (dataLength > 0) {
slideindex = 1;
layerslidershow(slideindex);
$("#slideroverlay").css("display", "block");
}
}
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");
}
$("#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 ajaxcalltablesec(idkol) {
console.log("hi");
$.ajax({
url:
"https://rms.rmto.ir/rahdari/road-construction-rural/" +
idkol +
"/get-distance",
type: "GET",
success: function (result) {
// console.log(result.data[0]);
$("#exampletool").dataTable().fnClearTable();
$("#exampletool").dataTable().fnAddData(result.data);
// ajaxcalltablefirst();
hideLoaderScreen();
Swal.fire({
icon: "success",
title: "با موفقیت بروزرسانی شد",
confirmButtonText: "بستن",
});
},
});
}
function ajaxcalltablefirst() {
$.ajax({
url: "https://rms.rmto.ir/rahdari/road-construction-rural/getlist",
type: "GET",
success: function (result) {
// console.log(result.data[0]);
$("#example").dataTable().fnClearTable();
$("#example").dataTable().fnAddData(result.data);
hideLoaderScreen();
// Swal.fire({
// icon: "success",
// title: "با موفقیت بروزرسانی شد",
// confirmButtonText: "بستن",
// });
},
});
}
function ajaxcalltablefirsttool(idkol) {
$.ajax({
url: "https://rms.rmto.ir/rahdari/road-construction-rural/getlist",
type: "GET",
success: function (result) {
// console.log(result.data[0]);
$("#example").dataTable().fnClearTable();
$("#example").dataTable().fnAddData(result.data);
// hideLoaderScreen();
ajaxcalltablesec(idkol);
},
});
}
function ajaxcalltablefirstupdate(idkol) {
$.ajax({
url: "https://rms.rmto.ir/rahdari/road-construction-rural/getlist",
type: "GET",
success: function (result) {
// console.log(result.data[0]);
$("#example").dataTable().fnClearTable();
$("#example").dataTable().fnAddData(result.data);
// hideLoaderScreen();
ajaxcalltablethird2(idkol);
},
});
}
function ajaxcalltablethird2(idkol) {
$.ajax({
url:
"https://rms.rmto.ir/rahdari/road-construction-rural/" +
idkol +
"/get-distance-update-list",
type: "GET",
success: function (result) {
console.log(result.data.distance_update);
$("#example-update").dataTable().fnClearTable();
$("#example-update").dataTable().fnAddData(result.data.distance_update);
hideLoaderScreen();
$("#image-upload-modal").modal('hide')
Swal.fire({
icon: "success",
title: "با موفقیت بروزرسانی شد",
confirmButtonText: "بستن",
});
},
});
}
function ajaxcalltablethird3(idkol) {
$.ajax({
url:
"https://rms.rmto.ir/rahdari/road-construction-rural/" +
idkol +
"/get-distance-update-list",
type: "GET",
success: function (result) {
console.log(result.data.distance_update);
$("#example-update").dataTable().fnClearTable();
$("#example-update").dataTable().fnAddData(result.data.distance_update);
hideLoaderScreen();
},
});
}
function showprojecttype() {
$("#stepModalprojecttype").modal('show')
}
$("#approveprojecttype").on("click", function () {
//to do yasi
if ($("#roadmaintanace").is(":checked")) {
window.open("https://rms.rmto.ir/road-maintenance-project");
} else if ($("#reviewdangerpoint").is(":checked")) {
window.open("https://rms.rmto.ir/road-danger-prevention");
}
else if ($("#improveroad").is(":checked")) {
window.open("https://rms.rmto.ir/road-upgrade-safety");
}
else if ($("#faniproject").is(":checked")) {
window.open("https://rms.rmto.ir/road-technical-building");
}
else if ($("#rahdarkhane").is(":checked")) {
window.open("https://rms.rmto.ir/road-tollhouse-management");
}
else if ($("#projectbuild").is(":checked")) {
window.open("https://rms.rmto.ir/road-construction-rural");
}
$("#stepModalprojecttype").modal('hide')
})
function showprojecttest(index) {
if (index == 1) {
window.open("https://rms.rmto.ir/road-maintenance-project");
// to do next page
}
else if (index == 2) {
window.open("https://rms.rmto.ir/road-danger-prevention");
}
else if (index == 3) {
window.open("https://rms.rmto.ir/road-upgrade-safety");
}
else if (index == 4) {
window.open("https://rms.rmto.ir/road-technical-building");
}
else if (index == 5) {
window.open("https://rms.rmto.ir/road-tollhouse-management");
}
else if (index == 6) {
window.open("https://rms.rmto.ir/road-construction-rural");
}
}