7369 lines
245 KiB
JavaScript
7369 lines
245 KiB
JavaScript
var map = null;
|
||
// change hamine start
|
||
var map2 = null;
|
||
// change hamine end
|
||
var table;
|
||
var startAbrarMarker = null;
|
||
var isSetStartAbrarMarker = false;
|
||
var endAbrarMarker = null;
|
||
var isSetEndAbrarMarker = false;
|
||
//change hamine start
|
||
var progressAbrarMarker = null;
|
||
var isSetprogressAbrarMarker = false;
|
||
//change hamine end
|
||
var mapshow = null;
|
||
var startAbrarMarkershow = null;
|
||
var isSetStartAbrarMarkershow = false;
|
||
var endAbrarMarkershow = null;
|
||
var isSetEndAbrarMarkershow = false;
|
||
//change hamine start
|
||
var staticMap = null;
|
||
var ekipAbrarMarkerJustShow = null;
|
||
var isSetEkipAbrarMarkerJustShow = false;
|
||
var startAbrarMarkerJustShow = null;
|
||
var isSetStartAbrarMarkerJustShow = false;
|
||
var endAbrarMarkerJustShow = null;
|
||
var isSetEndAbrarMarkerJustShow = false;
|
||
//change hamine end
|
||
var routeControls = [];
|
||
var routeControlsPath = [];
|
||
var popupArrays = [];
|
||
var popupArraysPath = [];
|
||
var polylinePath = null;
|
||
var project_distance_check = {};
|
||
var dataasli = [];
|
||
var datatablesec = null;
|
||
//change hamine start
|
||
var startLatlng;
|
||
var endLatlng;
|
||
var progressLatlng;
|
||
//change hamine end
|
||
//pooria
|
||
var list_province = [];
|
||
var list_citys = [];
|
||
var array_hold = [];
|
||
var array_hold_String = "";
|
||
var array_hold_String_edited;
|
||
var data_select_sec;
|
||
var array_hold_Axis_type = [];
|
||
var data_select_Axis_type;
|
||
var String_hold_Axis_type = "";
|
||
var String_edited_Axis_type;
|
||
var arry_select2_date;
|
||
var array_geted_date = [];
|
||
var hold_Data_p1 = "";
|
||
var pooriapo;
|
||
var edited_end_date;
|
||
var hold_Data_city1;
|
||
var city1_array = [];
|
||
var city1_String = "";
|
||
var city1_String_edited = "";
|
||
var hold_Data_city2;
|
||
var city2_array = [];
|
||
var city2_String = "";
|
||
var city2_String_edited = "";
|
||
var hold_Data_city3;
|
||
var city3_array = [];
|
||
var city3_String = "";
|
||
var city3_String_edited = "";
|
||
var hold_Data_province1;
|
||
var hold_Data_province2;
|
||
var hold_Data_province3;
|
||
var array_geted_date = [];
|
||
var edited_end_date;
|
||
//End pooria
|
||
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 flagshownmarker = 0;
|
||
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 progres1 = null;
|
||
var progres2 = null;
|
||
var progres3 = null;
|
||
var progres4 = null;
|
||
var progres5 = null;
|
||
var progres6 = null;
|
||
var progres7 = null;
|
||
var progres8 = null;
|
||
var progres9 = null;
|
||
var progres10 = null;
|
||
var progres11 = null;
|
||
var progres12 = null;
|
||
var progres13 = null;
|
||
var cansubmit;
|
||
//change hamine start
|
||
var projectupdateimage = [];
|
||
//change hamine end
|
||
var startAbrarDivIcon = 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 endAbrarDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-end" 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],
|
||
});
|
||
|
||
//change hamine start
|
||
var progressAbrarDivIcon = L.divIcon({
|
||
html: `
|
||
<div id="pin-marker-progress" 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],
|
||
});
|
||
//change hamine end
|
||
var projectEditId = null;
|
||
var projectEditData = [];
|
||
var abrarProjectSlider = null;
|
||
var datatable2 = [
|
||
{
|
||
1: ["0"],
|
||
2: ["0"],
|
||
3: ["0"],
|
||
4: ["0"],
|
||
5: ["0"],
|
||
6: ["0"],
|
||
7: ["0"],
|
||
8: ["0"],
|
||
9: ["0"],
|
||
10: ["0"],
|
||
11: ["0"],
|
||
12: ["0"],
|
||
13: ["0"],
|
||
},
|
||
];
|
||
var tablethird;
|
||
function showLoaderScreen() {
|
||
$(".divloader").css("display", "flex").hide().fadeIn();
|
||
}
|
||
|
||
function hideLoaderScreen() {
|
||
$(".divloader").fadeOut();
|
||
}
|
||
$(document).ready(function () {
|
||
getProvinces();
|
||
setTimeout(() => {
|
||
checkPosition();
|
||
}, 50);
|
||
contractDatePicker = $("input[name=contract-date]").persianDatepicker({
|
||
format: "YYYY",
|
||
initialValue: false,
|
||
autoClose: true,
|
||
initialValueType: "persian",
|
||
position: [-150, 10],
|
||
onSelect: function (unix) {
|
||
if ($("#contract-date-id").val() == "") {
|
||
$("#contract-date-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract-date-id").removeClass("is-invalid-input");
|
||
}
|
||
},
|
||
});
|
||
showLoaderScreen();
|
||
table = $("#example").DataTable({
|
||
dom: "<flB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
scrollX: true,
|
||
scrollY: "500px",
|
||
responsive: 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: ": فعال سازی نمایش به صورت نزولی",
|
||
},
|
||
},
|
||
order: [[0, "asc"][(1, "asc")], [2, "desc"], [3, "desc"], [4, "desc"]],
|
||
order: [[0, "desc"]],
|
||
processing: true,
|
||
select: true,
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/rahdari/road-technical-building/getlist",
|
||
type: "GET",
|
||
dataSrc: function (json) {
|
||
cansubmit = json.can_submit;
|
||
console.log("string", cansubmit);
|
||
return json.data;
|
||
},
|
||
},
|
||
columns: [
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function (data, type, row, meta) {
|
||
return meta.row + 1;
|
||
},
|
||
},
|
||
{ data: "province_fa" },
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
if (data.city_2_fa != null && data.city_3_fa != null)
|
||
return `${data.city_1_fa}-${data.city_2_fa}-${data.city_3_fa}`;
|
||
else if (data.city_2_fa != null)
|
||
return `${data.city_1_fa}-${data.city_2_fa}`;
|
||
else return `${data.city_1_fa}`;
|
||
},
|
||
},
|
||
{ data: "axis_name" },
|
||
{
|
||
data: "axis_type_fa",
|
||
},
|
||
{ data: "project_name" },
|
||
{ data: "contractor_name" },
|
||
|
||
{ data: "contract_date" },
|
||
|
||
{
|
||
data: "submited_at_fa",
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
if (data.latest_history?.previous_status == 0) {
|
||
return "<div class='line-empty-col'></div>";
|
||
}
|
||
return data.last_updated_at_fa;
|
||
},
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
if (data.latest_history?.previous_status == 0) {
|
||
return "<div class='line-empty-col'></div>";
|
||
}
|
||
return data.project_status_fa;
|
||
},
|
||
},
|
||
{
|
||
data: "project_distance",
|
||
render: function (data, type, row) {
|
||
var testdata = "";
|
||
if (data != null) {
|
||
$.each(data, function (index, value) {
|
||
if (testdata.length != 0) {
|
||
testdata += " ، ";
|
||
}
|
||
|
||
if (index == 1) {
|
||
testdata += "نصب حفاظ بتنی ";
|
||
} else if (index == 2) {
|
||
testdata += " نصب حفاظ فلزی /گاردریل";
|
||
} else if (index == 3) {
|
||
testdata += " اجرای روشنایی طولی ";
|
||
} else if (index == 4) {
|
||
testdata += " اجرای روشنایی نقطه ای ";
|
||
} else if (index == 5) {
|
||
testdata += "نصب علائم ایمنی (اخباری ) ";
|
||
} else if (index == 6) {
|
||
testdata += " نصب علائم ایمنی (سایر )";
|
||
} else if (index == 7) {
|
||
testdata += " خط کشی ";
|
||
} else if (index == 8) {
|
||
testdata += " اصلاح شیب شیروانی";
|
||
} else if (index == 9) {
|
||
testdata += " سایر اقدامات";
|
||
}
|
||
});
|
||
|
||
return "<p>" + testdata + "</p>";
|
||
} else return "_";
|
||
},
|
||
},
|
||
{
|
||
data: "project_distance",
|
||
render: function (data, type, row) {
|
||
var testdata = "";
|
||
var testarray = [];
|
||
var reversestring = "";
|
||
if (data != null) {
|
||
$.each(data, function (index, value) {
|
||
if (testdata.length != 0) {
|
||
testdata += " ، ";
|
||
testarray.push(" ، ");
|
||
}
|
||
if (index == 9) {
|
||
testdata += "_";
|
||
testarray.push(" _ ");
|
||
} else {
|
||
testdata += value[0];
|
||
testarray.push(value[0]);
|
||
}
|
||
});
|
||
for (var i = testarray.length - 1; i >= 0; i--) {
|
||
reversestring += testarray[i];
|
||
}
|
||
return "<p style='direction: ltr'>" + reversestring + "</p>";
|
||
} else return "_";
|
||
},
|
||
},
|
||
{
|
||
data: "project_distance_update",
|
||
render: function (data, type, row) {
|
||
var testdata = "";
|
||
var testarray = [];
|
||
var reversestring = "";
|
||
if (data != null) {
|
||
$.each(data, function (index, value) {
|
||
if (testdata.length == 0) {
|
||
testdata += " ، ";
|
||
testarray.push(" . ");
|
||
}
|
||
if (index == 9) {
|
||
testdata += value[0] + "%" + " ";
|
||
testarray.push(value[0] + "%" + " ");
|
||
} else {
|
||
testdata += value[1] + "%" + " ";
|
||
testarray.push(value[1] + "%" + " ");
|
||
}
|
||
|
||
});
|
||
for (var i = testarray.length - 1; i >= 0; i--) {
|
||
reversestring += testarray[i];
|
||
}
|
||
return "<p style='direction: ltr'>" + reversestring + "</p>";
|
||
} else return "_";
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
if (cansubmit == 1) {
|
||
if (data.status == 0) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button id="editButton${data.id}" class="btn-dataTable editor details-control" title="ویرایش"><i class="fa fa-edit icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable elsaghPro" title="الصاق به پروژه ها"><i class="fa fa-file-contract icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable projectdistance" title=" نوع عملیات "><i class="fa fa-road icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTab le finalsubmit" title=" ثبت نهایی " disabled ><i class="fa fa-check icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" disabled ><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable update-button" title="بروزرسانی" disabled><i class="fa fa-tasks icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" disabled ><i class="fa fa-eye icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable deletsubmit" title=" حذف " ><i class="fa fa-trash icon-btnTable"></i></button>
|
||
</div>`;
|
||
} else if (data.status == 1) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button id="editButton${data.id}" class="btn-dataTable editor details-control" title="ویرایش"><i class="fa fa-edit icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable elsaghPro" title="الصاق به پروژه ها"><i class="fa fa-file-contract icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable projectdistance" title=" نوع عملیات "><i class="fa fa-road icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable finalsubmit" title=" ثبت نهایی " ><i class="fa fa-check icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" disabled ><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable update-button" title="بروزرسانی" disabled><i class="fa fa-tasks icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" disabled ><i class="fa fa-eye icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable deletsubmit" title=" حذف " ><i class="fa fa-trash icon-btnTable"></i></button>
|
||
|
||
</div>`;
|
||
} else if (data.status == 2) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button id="editButton${data.id}" class="btn-dataTable editor details-control" title="ویرایش"><i class="fa fa-edit icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable elsaghPro" title="الصاق به پروژه ها"><i class="fa fa-file-contract icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable projectdistance" title=" نوع عملیات "><i class="fa fa-road icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable finalsubmit" title=" ثبت نهایی " disabled ><i class="fa fa-check icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" ><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable update-button" title="بروزرسانی"><i class="fa fa-tasks icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" ><i class="fa fa-eye icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable deletsubmit" title=" حذف " ><i class="fa fa-trash icon-btnTable"></i></button>
|
||
</div>`;
|
||
}
|
||
}
|
||
else {
|
||
if (data.status == 0) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" disabled ><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" disabled ><i class="fa fa-eye icon-btnTable"></i></button>
|
||
</div>`;
|
||
|
||
}
|
||
else if (data.status == 1) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" disabled><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" disabled><i class="fa fa-eye icon-btnTable"></i></button>
|
||
</div>`;
|
||
}
|
||
else if (data.status == 2) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button class="btn-dataTable image-show" title="مشاهده عکس ها" ><i class="fa fa-image icon-btnTable"></i></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable location-button" title="مشاهده مکانی پروژه" ><i class="fa fa-eye icon-btnTable"></i></button>
|
||
</div>`;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
},
|
||
},
|
||
],
|
||
columnDefs: [
|
||
{
|
||
targets: [11],
|
||
visible: false,
|
||
searchable: false,
|
||
},
|
||
{
|
||
targets: [12],
|
||
visible: false,
|
||
searchable: false,
|
||
},
|
||
{
|
||
targets: [13],
|
||
visible: false,
|
||
searchable: false,
|
||
},
|
||
],
|
||
|
||
buttons: [
|
||
//pooria
|
||
{
|
||
text:
|
||
'<div class="d-flex flex-column"><i class="fa mb-2 fa-filter icon-color"></i> فیلترینگ پیشرفته</div>',
|
||
action: function (e, dt, node, config) {
|
||
if ($(".parent-filter").css("display") == "none") {
|
||
$(".parent-filter").css("display", "block");
|
||
showLoaderScreen();
|
||
setTimeout(() => {
|
||
hideLoaderScreen();
|
||
}, 200);
|
||
} else if ($(".parent-filter").css("display") != "none") {
|
||
$(".parent-filter").css("display", "none");
|
||
}
|
||
},
|
||
},
|
||
//end pooria
|
||
{
|
||
// extend: "download",
|
||
// title: "Video",
|
||
text:
|
||
"<div class='d-flex flex-column'><i class='fa mb-2 fa-download icon-color'></i>دانلود فیلم راهنما</div>",
|
||
action: function (e, dt, node, config) {
|
||
window.open("/storage/video_2020-10-02_13-47-58.mp4", "_blank");
|
||
},
|
||
},
|
||
|
||
{
|
||
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],
|
||
},
|
||
customize: function (xlsx) {
|
||
var sheet = xlsx.xl.worksheets["sheet1.xml"];
|
||
|
||
// Loop over the cells in column `C`
|
||
$('row c[r^="M"]', sheet).each(function () {
|
||
// Get the value
|
||
|
||
$(this).attr("s", "52");
|
||
});
|
||
$('row c[r^="N"]', sheet).each(function () {
|
||
// Get the value
|
||
|
||
$(this).attr("s", "52");
|
||
});
|
||
},
|
||
},
|
||
],
|
||
//pooria
|
||
initComplete: function () {
|
||
// hideLoaderScreen();
|
||
$("body").find(".dataTables_scrollBody").addClass("scrollbar");
|
||
$(".dt-buttons").append(`<div class='parent-filter'>
|
||
|
||
<div class='container'>
|
||
<button onclick="pops()" class="btn-increase">+</button>
|
||
<div class="row mt-2">
|
||
<div class="col-12 mb-2"><select id="select-province1" class="js-example-basic-multiple form-control-me stylescroll"></select></div>
|
||
<div class="col-12 mb-2"><select id="select-city1" name="states[]" multiple="multiple" class="stylescroll js-example-basic-multiple-citys form-control"></select></div>
|
||
<div class="col-12" >
|
||
<div id="append-input-forFilter2" class="my-2 d-none">
|
||
<select id="select-province2" class="js-example-basic-multiple form-control-me mb-2 stylescroll"></select>
|
||
<select name="states[]" multiple="multiple" id="select-city2" class="js-example-basic-multiple-citys form-control"></select>
|
||
</div>
|
||
</div>
|
||
<div class="col-12">
|
||
<div id="append-input-forFilter3" class="my-2 d-none">
|
||
<select id="select-province3"
|
||
class="js-example-basic-multiple form-control-me mb-2 stylescroll"></select>
|
||
<select name="states[]" multiple="multiple" id="select-city3"
|
||
class="js-example-basic-multiple-citys form-control"></select>
|
||
</div>
|
||
</div>
|
||
<div class="col-12 mt-2 mb-2"> <select class="last_statusfilter form-control" name="states[]" multiple="multiple">
|
||
<option value="firststatus">
|
||
در دست برنامه ریزی اولیه
|
||
</option>
|
||
<option value="secondstatus">
|
||
در دست مطالعه و تهیه اسناد مناقصه
|
||
</option>
|
||
<option value="thirdstatus">
|
||
در دست مناقصه
|
||
</option>
|
||
<option value="fourthstatus">
|
||
در حال تجهیز کارگاه
|
||
</option>
|
||
<option value="fifthstatus">
|
||
در حال اجرا/فعال
|
||
</option>
|
||
<option value="sixstatus">
|
||
در حال اجرا/متوقف
|
||
</option>
|
||
<option value="sevenstatus">
|
||
در حال آماده سازی برای افتتاح
|
||
</option>
|
||
<option value="eightstatus">
|
||
تکمیل و خاتمه یافته و بهره برداری شده
|
||
</option>
|
||
</select>
|
||
</div>
|
||
<div class="col-12 mb-2">
|
||
<select class="typemehvar form-control" name="states[]" multiple="multiple">
|
||
<option value="typeroostayi">
|
||
روستایی
|
||
</option>
|
||
<option value="typefaryi">فرعی</option>
|
||
<option value="typeasli">اصلی</option>
|
||
<option value="typeshryani">شریانی</option>
|
||
</select>
|
||
</div>
|
||
<div class="col-12 mb-2">
|
||
<select name="states[]" multiple="multiple" class="yearfilter form-control">
|
||
</select>
|
||
</div>
|
||
<div class="col-12 text-center"><button id="btn_filter_show" class="btn-set-filter px-2 py-1">فیلتر</button></div>
|
||
</div>
|
||
</div>
|
||
</div>`);
|
||
$(".js-example-basic-multiple").append(
|
||
'<option value="0">انتخاب اداره کل</option>'
|
||
);
|
||
$(".btn-increase").prop("disabled", true);
|
||
init_row_filter();
|
||
$("#select-province1").on("change", function () {
|
||
init_data_filter1();
|
||
$(".btn-increase").prop("disabled", false);
|
||
});
|
||
$("#select-province2").on("change", function () {
|
||
init_data_filter2();
|
||
$(".btn-increase").prop("disabled", false);
|
||
});
|
||
$("#select-province3").on("change", function () {
|
||
init_data_filter3();
|
||
});
|
||
|
||
$(".last_statusfilter").select2({
|
||
multiple: true,
|
||
placeholder: "اخرین وضعیت پروژه",
|
||
width: "resolve",
|
||
dir: "rtl",
|
||
});
|
||
$("#select-city1").select2({
|
||
dir: "rtl",
|
||
placeholder: "انتخاب شهرستان",
|
||
width: "resolve",
|
||
});
|
||
$("#select-city2").select2({
|
||
dir: "rtl",
|
||
placeholder: "انتخاب شهرستان",
|
||
width: "resolve",
|
||
});
|
||
$("#select-city3").select2({
|
||
dir: "rtl",
|
||
placeholder: "انتخاب شهرستان",
|
||
width: "resolve",
|
||
});
|
||
$(".typemehvar").select2({
|
||
multiple: true,
|
||
placeholder: "نوع محور",
|
||
dir: "rtl",
|
||
width: "resolve",
|
||
});
|
||
$(".yearfilter").select2({
|
||
multiple: true,
|
||
placeholder: "سال شروع",
|
||
dir: "rtl",
|
||
width: "resolve",
|
||
});
|
||
var current_year;
|
||
current_year = new persianDate().year();
|
||
for (let i = 1396; i <= current_year; i++) {
|
||
$(".yearfilter").prepend(
|
||
"\
|
||
<option value=" +
|
||
i +
|
||
">" +
|
||
i.toString() +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
$(".yearfilter").append(`<option>سال 1395 و ما قبل</option>`);
|
||
$(".last_statusfilter").on("change", function () {
|
||
data_select_sec = null;
|
||
array_hold = [];
|
||
array_hold_String = "";
|
||
array_hold_String_edited = "";
|
||
data_select_sec = $(".last_statusfilter").select2("data");
|
||
});
|
||
$(".typemehvar").on("change", function () {
|
||
array_hold_Axis_type = [];
|
||
data_select_Axis_type = null;
|
||
String_hold_Axis_type = "";
|
||
String_edited_Axis_type = "";
|
||
data_select_Axis_type = $(".typemehvar").select2("data");
|
||
// console.log(typeof data_select_Axis_type);
|
||
});
|
||
$(".yearfilter").on("change", function () {
|
||
arry_select2_date = null;
|
||
array_geted_date = [];
|
||
hold_Data_p1 = "";
|
||
pooriapo = null;
|
||
edited_end_date = null;
|
||
arry_select2_date = $(".yearfilter").select2("data");
|
||
});
|
||
$("#select-city1").on("change", function () {
|
||
hold_Data_city1 = null;
|
||
city1_array = [];
|
||
city1_String = "";
|
||
city1_String_edited = "";
|
||
hold_Data_city1 = $("#select-city1").select2("data");
|
||
});
|
||
$("#select-city2").on("change", function () {
|
||
hold_Data_city2 = null;
|
||
city2_array = [];
|
||
city2_String = "";
|
||
city2_String_edited = "";
|
||
hold_Data_city1 = $("#select-city1").select2("data");
|
||
});
|
||
$("#select-city3").on("change", function () {
|
||
hold_Data_city3;
|
||
city3_array = [];
|
||
city3_String = "";
|
||
city3_String_edited = "";
|
||
hold_Data_city1 = $("#select-city1").select2("data");
|
||
});
|
||
$("#select-province1").on("change", function () {
|
||
hold_Data_province1 = null;
|
||
hold_Data_province1 = $("#select-province1 option:selected").text();
|
||
// console.log(typeof hold_Data_province1);
|
||
});
|
||
$("#select-province2").on("change", function () {
|
||
hold_Data_province2 = null;
|
||
hold_Data_province2 = $("#select-province2 option:selected").text();
|
||
});
|
||
$("#select-province3").on("change", function () {
|
||
hold_Data_province3 = null;
|
||
hold_Data_province3 = $("#select-province3 option:selected").text();
|
||
});
|
||
$("#btn_filter_show").on("click", function () {
|
||
if ($(".typemehvar").select2("data").length == 0) {
|
||
$("#example").DataTable().column(4).search("").draw();
|
||
}
|
||
if ($(".last_statusfilter").select2("data").length == 0) {
|
||
$("#example").DataTable().column(10).search("").draw();
|
||
}
|
||
if ($(".yearfilter").select2("data").length == 0) {
|
||
$("#example").DataTable().column(7).search("").draw();
|
||
}
|
||
var test = "|";
|
||
var hold_Data_p1 = "";
|
||
var pooriapo;
|
||
if (arry_select2_date) {
|
||
for (let i = 0; i < arry_select2_date.length; i++) {
|
||
array_geted_date.push(arry_select2_date[i].text);
|
||
}
|
||
}
|
||
if (
|
||
array_geted_date[array_geted_date.length - 1] == "سال 1395 و ما قبل"
|
||
) {
|
||
for (let i = 1300; i <= 1395; i++) {
|
||
array_geted_date.unshift(i.toString());
|
||
}
|
||
pooriapo = array_geted_date.slice(0, array_geted_date.length - 1);
|
||
for (let i = 0; i < pooriapo.length; i++) {
|
||
hold_Data_p1 += pooriapo[i].concat("|");
|
||
}
|
||
} else {
|
||
for (let i = 0; i < array_geted_date.length; i++) {
|
||
hold_Data_p1 += array_geted_date[i].concat("|");
|
||
}
|
||
}
|
||
if (hold_Data_p1[hold_Data_p1.length - 1] === "|") {
|
||
edited_end_date = hold_Data_p1.slice(0, hold_Data_p1.length - 1);
|
||
}
|
||
if (edited_end_date) {
|
||
$("#example")
|
||
.DataTable()
|
||
.column(7)
|
||
.search(edited_end_date, true, false)
|
||
.draw();
|
||
}
|
||
|
||
if (
|
||
($("#select-province1").val() && $("#select-province1").val() != 0) ||
|
||
($("#select-province2").val() && $("#select-province2").val() != 0) ||
|
||
($("#select-province3").val() && $("#select-province3").val() != 0)
|
||
) {
|
||
$("#example")
|
||
.DataTable()
|
||
.column(1)
|
||
.search(
|
||
hold_Data_province1 +
|
||
test +
|
||
hold_Data_province2 +
|
||
test +
|
||
hold_Data_province3,
|
||
true,
|
||
false
|
||
)
|
||
.draw();
|
||
}
|
||
|
||
if (hold_Data_city1) {
|
||
for (let i = 0; i < hold_Data_city1.length; i++) {
|
||
city1_array.push(hold_Data_city1[i].text.trim().concat("|"));
|
||
}
|
||
}
|
||
for (let i = 0; i < city1_array.length; i++) {
|
||
city1_String += city1_array[i];
|
||
}
|
||
if (city1_String[city1_String.length - 1] == "|") {
|
||
city1_String_edited = city1_String.slice(0, city1_String.length - 1);
|
||
}
|
||
|
||
hold_Data_city2 = $("#select-city2").select2("data");
|
||
for (let i = 0; i < hold_Data_city2.length; i++) {
|
||
city2_array.push(hold_Data_city2[i].text.trim().concat("|"));
|
||
}
|
||
for (let i = 0; i < city2_array.length; i++) {
|
||
city2_String += city2_array[i];
|
||
}
|
||
if (city2_String[city2_String.length - 1] == "|") {
|
||
city2_String_edited = city2_String.slice(0, city2_String.length - 1);
|
||
}
|
||
|
||
hold_Data_city3 = $("#select-city3").select2("data");
|
||
for (let i = 0; i < hold_Data_city3.length; i++) {
|
||
city3_array.push(hold_Data_city3[i].text.trim().concat("|"));
|
||
}
|
||
if (city3_array) {
|
||
for (let i = 0; i < city3_array.length; i++) {
|
||
city3_String += city3_array[i];
|
||
}
|
||
}
|
||
if (city3_String[city3_String.length - 1] == "|") {
|
||
city3_String_edited = city3_String.slice(0, city3_String.length - 1);
|
||
}
|
||
|
||
var farsamoner;
|
||
var farsamNum = 0;
|
||
if (city1_String_edited) {
|
||
farsamoner = city1_String_edited;
|
||
farsamNum++;
|
||
}
|
||
if (city2_String_edited) {
|
||
farsamNum != 0 ? (farsamoner += "|") : (farsamoner += "");
|
||
farsamoner += city2_String_edited;
|
||
farsamNum++;
|
||
}
|
||
if (city3_String_edited) {
|
||
farsamNum != 0 ? (farsamoner += "|") : (farsamoner += "");
|
||
farsamoner += city3_String_edited;
|
||
}
|
||
if (farsamoner) {
|
||
$("#example")
|
||
.DataTable()
|
||
.column(2)
|
||
.search(farsamoner, true, false)
|
||
.draw();
|
||
}
|
||
if (data_select_sec) {
|
||
for (let i = 0; i < data_select_sec.length; i++) {
|
||
array_hold.push(data_select_sec[i].text.trim());
|
||
}
|
||
for (var i = 0; i < array_hold.length; i++) {
|
||
array_hold_String += array_hold[i].concat("|");
|
||
}
|
||
|
||
if (array_hold_String[array_hold_String.length - 1] == "|") {
|
||
array_hold_String_edited = array_hold_String.slice(
|
||
0,
|
||
array_hold_String.length - 1
|
||
);
|
||
}
|
||
if (array_hold_String_edited) {
|
||
$("#example")
|
||
.DataTable()
|
||
.column(10)
|
||
.search(array_hold_String_edited, true, false)
|
||
.draw();
|
||
}
|
||
}
|
||
|
||
if (data_select_Axis_type) {
|
||
for (var i = 0; i < data_select_Axis_type.length; i++) {
|
||
array_hold_Axis_type.push(
|
||
data_select_Axis_type[i].text.trim().concat("|")
|
||
);
|
||
}
|
||
for (let i = 0; i < array_hold_Axis_type.length; i++) {
|
||
String_hold_Axis_type += array_hold_Axis_type[i];
|
||
}
|
||
|
||
if (String_hold_Axis_type[String_hold_Axis_type.length - 1] === "|") {
|
||
String_edited_Axis_type = String_hold_Axis_type.slice(
|
||
0,
|
||
String_hold_Axis_type.length - 1
|
||
);
|
||
}
|
||
|
||
if (String_edited_Axis_type) {
|
||
$("#example")
|
||
.DataTable()
|
||
.column(4)
|
||
.search(String_edited_Axis_type, true, false)
|
||
.draw();
|
||
}
|
||
}
|
||
$(".parent-filter").css("display", "none");
|
||
});
|
||
},
|
||
//End pooria
|
||
});
|
||
//pooria
|
||
|
||
function init_row_filter() {
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces",
|
||
type: "GET",
|
||
success: function (data) {
|
||
hideLoaderScreen();
|
||
list_province = data.data;
|
||
for (let index = 0; index < list_province.length; index++) {
|
||
$(".js-example-basic-multiple").append(
|
||
"\
|
||
<option value=" +
|
||
list_province[index].id +
|
||
">" +
|
||
list_province[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
function init_data_filter1() {
|
||
showLoaderScreen();
|
||
let hold_idSelect = $("#select-province1").val();
|
||
// console.log(hold_idSelect);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + hold_idSelect,
|
||
type: "GET",
|
||
success: function (data) {
|
||
hideLoaderScreen();
|
||
list_citys = data.data;
|
||
$("#select-city1").html("");
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#select-city1").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
function init_data_filter2() {
|
||
showLoaderScreen();
|
||
let hold_idSelect = $("#select-province2").val();
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + hold_idSelect,
|
||
type: "GET",
|
||
success: function (data) {
|
||
hideLoaderScreen();
|
||
list_citys = data.data;
|
||
$("#select-city2").html("");
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#select-city2").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
function init_data_filter3() {
|
||
showLoaderScreen();
|
||
let hold_idSelect = $("#select-province3").val();
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + hold_idSelect,
|
||
type: "GET",
|
||
success: function (data) {
|
||
hideshowLoaderScreen();
|
||
list_citys = data.data;
|
||
$("#select-city3").empty("");
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#select-city3").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
}
|
||
//End pooria
|
||
//yasi change end
|
||
});
|
||
|
||
// change hamine start
|
||
|
||
function createLeafletMap(startP, endP, update) {
|
||
// console.log("createLeafletMap");
|
||
|
||
let bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
|
||
let mapName;
|
||
|
||
if (!update) {
|
||
// console.log("hewre ");
|
||
|
||
map = new L.map("abrar-map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView(startP, 9);
|
||
mapName = map;
|
||
} else {
|
||
// console.log("hello map 22222");
|
||
|
||
map2 = new L.map("abrar-map-2", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView(startP, 9);
|
||
mapName = map2;
|
||
}
|
||
|
||
L.tileLayer("https://testmap.141.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
mapName
|
||
);
|
||
|
||
if (update) {
|
||
startAbrarMarker = new L.marker(startP, {
|
||
icon: startAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(mapName);
|
||
} else {
|
||
startAbrarMarker = new L.marker(startP, {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(mapName);
|
||
}
|
||
|
||
if (!edit) {
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
});
|
||
} else {
|
||
isSetStartAbrarMarker = true;
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
if (update) {
|
||
mapName = map2;
|
||
if (endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng(endP);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
checkMarkersAndDrawPath(update);
|
||
} else if (!endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: false,
|
||
});
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
checkMarkersAndDrawPath(update);
|
||
} else if (endAbrarMarker && endP[0] == "NaN") {
|
||
endAbrarMarker.remove();
|
||
}
|
||
|
||
progressAbrarMarker = new L.marker(
|
||
[parseFloat(startP[0]), parseFloat(startP[1]) + 1],
|
||
{
|
||
icon: progressAbrarDivIcon,
|
||
draggable: true,
|
||
}
|
||
).addTo(mapName);
|
||
|
||
progressAbrarMarker.on("click", function () {
|
||
// console.log("clickstart");
|
||
if (!isSetprogressAbrarMarker) {
|
||
progressAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
isSetprogressAbrarMarker = true;
|
||
|
||
$("#pin-marker-progress")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
|
||
// $("#stepModalmaintenance input[name=abrar-project-latlng-start]").val(
|
||
// progressAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
// progressAbrarMarker.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
// ).removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
mapName.on("move", function () {
|
||
if (!isSetprogressAbrarMarker) {
|
||
progressAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-progress").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
mapName.on("moveend", function () {
|
||
if (!isSetprogressAbrarMarker) {
|
||
progressAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-progress").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
|
||
progressAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-progress").addClass("pin-move");
|
||
// checkMarkersAndDrawPath(update);
|
||
});
|
||
|
||
progressAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-progress").removeClass("pin-move");
|
||
|
||
if (
|
||
$("#pin-marker-progress").hasClass("pin-set") ||
|
||
isSetprogressAbrarMarker
|
||
) {
|
||
// $("#stepModalmaintenance input[name=abrar-project-latlng-start]").val(
|
||
// startAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
// startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
// ).removeClass("is-invalid-input");
|
||
$("#pin-marker-progress").addClass("pin-set");
|
||
// checkMarkersAndDrawPath(update);
|
||
} else {
|
||
mapName.setView(progressAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
} else {
|
||
mapName = map;
|
||
|
||
if (endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng(endP);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
checkMarkersAndDrawPath(update);
|
||
// console.log("edit1");
|
||
} else if (!endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
});
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
// console.log("edit2");
|
||
// console.log(endP);
|
||
checkMarkersAndDrawPath(update);
|
||
} else if (endAbrarMarker && endP[0] == "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng([
|
||
parseFloat(startP[0]),
|
||
parseFloat(startP[1]) + 1,
|
||
]);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = false;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn pin-set");
|
||
// console.log("edit3");
|
||
} else {
|
||
endAbrarMarker = new L.marker(
|
||
[parseFloat(startP[0]), parseFloat(startP[1]) + 1],
|
||
{
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
}
|
||
);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = false;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn pin-set");
|
||
// console.log("edit4");
|
||
}
|
||
}
|
||
}
|
||
|
||
// if (!update) {
|
||
// if (endP[0] != "NaN") {
|
||
// endAbrarMarker = new L.marker(endP, {
|
||
// icon: endAbrarDivIcon,
|
||
// draggable: true,
|
||
// });
|
||
// } else {
|
||
// endAbrarMarker = new L.marker([
|
||
// parseFloat(startP[0]),
|
||
// parseFloat(startP[1]) + 1,
|
||
// ], {
|
||
// icon: endAbrarDivIcon,
|
||
// draggable: true,
|
||
// });
|
||
// }
|
||
// }
|
||
|
||
// if (edit) {
|
||
|
||
// if (endP[0] != "NaN") {
|
||
// avrLat = (parseFloat(startP[0]) + parseFloat(endP[0])) / 2;
|
||
// avrLng = (parseFloat(startP[1]) + parseFloat(endP[1])) / 2;
|
||
// }
|
||
|
||
// if (update) {
|
||
|
||
// if (endP[0] != "NaN") {
|
||
// progressAbrarMarker = new L.marker([avrLat, avrLng], {
|
||
// icon: progressAbrarDivIcon,
|
||
// draggable: true,
|
||
// }).addTo(mapName);
|
||
// } else {
|
||
// progressAbrarMarker = new L.marker([parseFloat(startP[0]),
|
||
// parseFloat(startP[1]) + 1
|
||
// ], {
|
||
// icon: progressAbrarDivIcon,
|
||
// draggable: true,
|
||
// }).addTo(mapName);
|
||
|
||
// }
|
||
|
||
// }
|
||
// if (endAbrarMarker) {
|
||
// if (update) {
|
||
// if (endP[0] != "NaN") {
|
||
// endAbrarMarker.addTo(mapName);
|
||
|
||
// } else {
|
||
// endAbrarMarker.remove()
|
||
// }
|
||
|
||
// }
|
||
// else {
|
||
// endAbrarMarker.addTo(mapName);
|
||
|
||
// }
|
||
// }
|
||
// // endAbrarMarker.addTo(mapName);
|
||
|
||
// isSetStartAbrarMarker = true;
|
||
// isSetEndAbrarMarker = true;
|
||
|
||
// if (update) {
|
||
// startAbrarMarker.dragging.disable();
|
||
// if (endP[0] != "NaN") {
|
||
// endAbrarMarker.dragging.disable();
|
||
// }
|
||
|
||
// }
|
||
|
||
// $("#pin-marker-start").addClass("pin-set");
|
||
// if (endP[0] != "NaN") {
|
||
|
||
// $("#pin-marker-end").addClass("pin-set");
|
||
// }
|
||
// else {
|
||
// $("#pin-marker-end").removeClass("pin-set");
|
||
// }
|
||
|
||
// checkMarkersAndDrawPath(update);
|
||
|
||
// if (endP[0] != "NaN") {
|
||
// mapName.setView([avrLat, avrLng], 6);
|
||
// } else {
|
||
// mapName.setView(startP, 6);
|
||
// }
|
||
|
||
// }
|
||
|
||
// map.on('move', function () {
|
||
// if (!isSetStartAbrarMarker) {
|
||
// startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
// $('#pin-marker-start').removeClass('pin-set pin-warn').addClass('pin-move');
|
||
// }
|
||
|
||
// });
|
||
|
||
mapName.on("move", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
||
endAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
mapName.on("moveend", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker && !update) {
|
||
endAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
|
||
startAbrarMarker.on("click", function () {
|
||
// console.log("clickstart");
|
||
if (!isSetStartAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
isSetStartAbrarMarker = true;
|
||
|
||
$("#pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
let markerLatLng = [
|
||
startAbrarMarker.getLatLng().lat,
|
||
startAbrarMarker.getLatLng().lng + 0.0008,
|
||
];
|
||
|
||
mapName.setView(markerLatLng);
|
||
|
||
// if(!endAbrarMarker){
|
||
// endAbrarMarker = new L.marker(endP, {
|
||
// icon: endAbrarDivIcon,
|
||
// draggable: true,
|
||
// });
|
||
// }
|
||
|
||
endAbrarMarker.setLatLng(markerLatLng);
|
||
endAbrarMarker.addTo(mapName);
|
||
}
|
||
});
|
||
|
||
if (endAbrarMarker) {
|
||
endAbrarMarker.on("click", function () {
|
||
// console.log("clickend");
|
||
if (!isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(mapName.getCenter()));
|
||
isSetEndAbrarMarker = true;
|
||
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
checkMarkersAndDrawPath(update);
|
||
}
|
||
});
|
||
|
||
endAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-end").addClass("pin-move");
|
||
checkMarkersAndDrawPath(update);
|
||
});
|
||
|
||
endAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-end").removeClass("pin-move");
|
||
|
||
if ($("#pin-marker-end").hasClass("pin-set") || isSetEndAbrarMarker) {
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
$("#pin-marker-end").addClass("pin-set");
|
||
checkMarkersAndDrawPath(update);
|
||
} else {
|
||
mapName.setView(endAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
}
|
||
|
||
startAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-start").addClass("pin-move");
|
||
checkMarkersAndDrawPath(update);
|
||
});
|
||
|
||
startAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-start").removeClass("pin-move");
|
||
|
||
if ($("#pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarker) {
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$("#pin-marker-start").addClass("pin-set");
|
||
checkMarkersAndDrawPath(update);
|
||
} else {
|
||
mapName.setView(startAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
}
|
||
|
||
$("#example").on("click", "button.image-show", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idkol = row.data().id;
|
||
console.log("idkol", idkol);
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/api/public/road-technical-building/" +
|
||
idkol +
|
||
"/getproject",
|
||
type: "GET",
|
||
success: function (result) {
|
||
console.log(result);
|
||
if (result.data[0].images.lengsth != 0) {
|
||
// var images = row.data().images
|
||
// var dates = row.date().images_dates
|
||
hideLoaderScreen();
|
||
opensliderforeachrow(result.data[0], 1);
|
||
// to do slider show
|
||
}
|
||
},
|
||
});
|
||
});
|
||
function opensliderforeachrow(row, main) {
|
||
console.log("rr", row);
|
||
// let row = table.row(tr);
|
||
// console.log("have u ever",row);
|
||
sliderImages = row.images;
|
||
let updated_at;
|
||
// if(main){
|
||
// updated_at = row.data().last_history.last_updated_at;
|
||
// }else{
|
||
// 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++) {
|
||
var imageUrl;
|
||
var updateDate;
|
||
if (main == 1) {
|
||
imageUrl = sliderImages[index];
|
||
updateDate = row.last_updated_at;
|
||
} else {
|
||
imageUrl =
|
||
"https://rms.rmto.ir/storage" + sliderImages[index].path.slice(6);
|
||
console.log("hatman", imageUrl);
|
||
console.log("hasman", row.updated_at);
|
||
|
||
updateDate = row.updated_at;
|
||
}
|
||
console.log("indexxx", index + 1);
|
||
var test = index + 1;
|
||
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="' +
|
||
imageUrl +
|
||
'"><div class="textt"> تصویر ' +
|
||
test +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updateDate +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + test + ')"></span>'
|
||
);
|
||
|
||
// if (sliderImages[index].path.includes("image-2")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 2 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-3")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 3 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-4")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 4 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-5")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 5 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-6")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 6 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-7")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 7 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-8")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 8 + ')"></span>'
|
||
// );
|
||
// }
|
||
}
|
||
|
||
if (dataLength > 0) {
|
||
slideindex = 1;
|
||
layerslidershow(slideindex);
|
||
$("#slideroverlay").css("display", "block");
|
||
}
|
||
}
|
||
|
||
function openSlidershowbutton(row, main) {
|
||
// let row = table.row(tr);
|
||
// console.log("have u ever",row);
|
||
sliderImages = row.data().images;
|
||
// console.log("have u ever", row.data());
|
||
|
||
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++) {
|
||
var imageUrl;
|
||
var updateDate;
|
||
if (main == 1) {
|
||
imageUrl = sliderImages[index];
|
||
updateDate = row.data().images_dates[index];
|
||
} else {
|
||
imageUrl =
|
||
"https://rms.rmto.ir/storage" + sliderImages[index].path.slice(6);
|
||
// console.log("hatman", imageUrl);
|
||
// console.log("hasman", row.data().updated_at);
|
||
// console.log("inside", imageUrl);
|
||
|
||
updateDate = row.data().updated_at;
|
||
}
|
||
// console.log("indexxx", index + 1);
|
||
var test = index + 1;
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="' +
|
||
imageUrl +
|
||
'"><div class="textt"> تصویر ' +
|
||
test +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updateDate +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + test + ')"></span>'
|
||
);
|
||
|
||
// if (sliderImages[index].path.includes("image-2")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 2 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-3")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 3 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-4")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 4 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-5")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 5 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-6")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 6 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-7")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 7 + ')"></span>'
|
||
// );
|
||
// }
|
||
// if (sliderImages[index].path.includes("image-8")) {
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src="https://rms.rmto.ir/' +
|
||
// sliderImages[index].path.replace("public", "storage") +
|
||
// '"><div class="textt"> تصویر ' +
|
||
// (index + 1) +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + 8 + ')"></span>'
|
||
// );
|
||
// }
|
||
}
|
||
|
||
if (dataLength > 0) {
|
||
slideindex = 1;
|
||
layerslidershow(slideindex);
|
||
$("#slideroverlay").css("display", "block");
|
||
}
|
||
}
|
||
//change hamine end
|
||
function createLeafletMapshow(startP, endP) {
|
||
// console.log("histart");
|
||
var latapi1 = startP[0];
|
||
var lngapi1 = startP[1];
|
||
var latapi2 = endP[0];
|
||
var lngapi2 = endP[1];
|
||
let bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
|
||
mapshow = new L.map("abrarshow-map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([latapi1, lngapi1], 9);
|
||
|
||
L.tileLayer("https://testmap.141.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
mapshow
|
||
);
|
||
|
||
startAbrarMarkershow = new L.marker(L.latLng(latapi1, lngapi1), {
|
||
icon: startAbrarDivIcon,
|
||
}).addTo(mapshow);
|
||
|
||
endAbrarMarkershow = new L.marker(L.latLng(latapi2, lngapi2), {
|
||
icon: endAbrarDivIcon,
|
||
}).addTo(mapshow);
|
||
|
||
isSetStartAbrarMarkershow = true;
|
||
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
isSetEndAbrarMarkershow = true;
|
||
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
checkMarkersAndDrawPathshow();
|
||
// var showlat = (parseFloat(startP[0]) + parseFloat(endP[0])) / 2
|
||
// var showlng = (parseFloat(startP[1]) + parseFloat(endP[1])) / 2
|
||
|
||
// mapshow.setView([showlat, showlng], 6);
|
||
|
||
// mapshow.on("move", function () {
|
||
// if (!isSetStartAbrarMarkershow && !isSetEndAbrarMarkershow) {
|
||
// startAbrarMarkershow.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// $("#pin-marker-start").removeClass("pin-set").addClass("pin-move");
|
||
// }
|
||
|
||
// if (isSetStartAbrarMarkershow && !isSetEndAbrarMarkershow) {
|
||
// endAbrarMarker.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// $("#pin-marker-end").removeClass("pin-set").addClass("pin-move");
|
||
// }
|
||
// });
|
||
|
||
// mapshow.on("moveend", function () {
|
||
// if (!isSetStartAbrarMarkershow && !isSetEndAbrarMarkershow) {
|
||
// startAbrarMarker.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// $("#pin-marker-start").removeClass("pin-move pin-set");
|
||
// }
|
||
|
||
// if (isSetStartAbrarMarkershow && !isSetEndAbrarMarkershow) {
|
||
// endAbrarMarker.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// $("#pin-marker-end").removeClass("pin-move pin-set");
|
||
// }
|
||
// });
|
||
|
||
// startAbrarMarkershow.on("click", function () {
|
||
// console.log("clickstart");
|
||
// if (!isSetStartAbrarMarkershow) {
|
||
// startAbrarMarkershow.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// isSetStartAbrarMarkershow = true;
|
||
|
||
// $("#pin-marker-start")
|
||
// .removeClass("pin-move pin-warn")
|
||
// .addClass("pin-set");
|
||
|
||
// $("#stepModalmaintenanceshow input[name=abrar-project-latlng-startshow]").val(
|
||
// startAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
// startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenanceshow input[name=abrar-project-latlng-startshow]"
|
||
// ).removeClass("is-invalid-input");
|
||
|
||
// let markerLatLng = [
|
||
// startAbrarMarkershow.getLatLng().lat,
|
||
// startAbrarMarkershow.getLatLng().lng + 0.0008,
|
||
// ];
|
||
|
||
// mapshow.setView(markerLatLng);
|
||
|
||
// // if(!endAbrarMarker){
|
||
// // endAbrarMarker = new L.marker(endP, {
|
||
// // icon: endAbrarDivIcon,
|
||
// // draggable: true,
|
||
// // });
|
||
// // }
|
||
|
||
// endAbrarMarkershow.setLatLng(markerLatLng);
|
||
// endAbrarMarkershow.addTo(mapshow);
|
||
// }
|
||
// });
|
||
|
||
// endAbrarMarkershow.on("click", function () {
|
||
// console.log("clickend");
|
||
// if (!isSetEndAbrarMarkershow) {
|
||
// endAbrarMarkershow.setLatLng(L.latLng(mapshow.getCenter()));
|
||
// isSetEndAbrarMarkershow = true;
|
||
|
||
// $("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
// $("#stepModalmaintenanceshow input[name=abrar-project-latlng-endshow]").val(
|
||
// endAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
// endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenanceshow input[name=abrar-project-latlng-endshow]"
|
||
// ).removeClass("is-invalid-input");
|
||
|
||
// checkMarkersAndDrawPath();
|
||
// }
|
||
// });
|
||
|
||
// startAbrarMarkershow.on("drag", function () {
|
||
// $("#pin-marker-start").addClass("pin-move");
|
||
// checkMarkersAndDrawPath();
|
||
// });
|
||
|
||
// endAbrarMarkershow.on("drag", function () {
|
||
// $("#pin-marker-end").addClass("pin-move");
|
||
// checkMarkersAndDrawPath();
|
||
// });
|
||
|
||
// startAbrarMarkershow.on("dragend", function () {
|
||
// $("#pin-marker-start").removeClass("pin-move");
|
||
|
||
// if ($("#pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarkershow) {
|
||
// $("#stepModalmaintenanceshow input[name=abrar-project-latlng-startshow]").val(
|
||
// startAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
// startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenanceshow input[name=abrar-project-latlng-startshow]"
|
||
// ).removeClass("is-invalid-input");
|
||
// $("#pin-marker-start").addClass("pin-set");
|
||
// checkMarkersAndDrawPath();
|
||
// } else {
|
||
// mapshow.setView(startAbrarMarkershow.getLatLng());
|
||
// }
|
||
// });
|
||
|
||
// endAbrarMarker.on("dragend", function () {
|
||
// $("#pin-marker-end").removeClass("pin-move");
|
||
|
||
// if ($("#pin-marker-end").hasClass("pin-set") || isSetEndAbrarMarkershow) {
|
||
// $("#stepModalmaintenanceshow input[name=abrar-project-latlng-endshow]").val(
|
||
// endAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
// endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
// );
|
||
// $(
|
||
// "#stepModalmaintenanceshow input[name=abrar-project-latlng-endshow]"
|
||
// ).removeClass("is-invalid-input");
|
||
// $("#pin-marker-end").addClass("pin-set");
|
||
// checkMarkersAndDrawPath();
|
||
// } else {
|
||
// mapshow.setView(endAbrarMarkershow.getLatLng());
|
||
// }
|
||
// });
|
||
}
|
||
function setmapshow(startp, endp) {
|
||
var latapi1 = startp[0];
|
||
var lngapi1 = startp[1];
|
||
var latapi2 = endp[0];
|
||
var lngapi2 = endp[1];
|
||
mapshow.removeLayer(startAbrarMarkershow);
|
||
mapshow.removeLayer(endAbrarMarkershow);
|
||
mapshow.setView([latapi1, lngapi1], 9);
|
||
|
||
startAbrarMarkershow = new L.marker(L.latLng(latapi1, lngapi1), {
|
||
icon: startAbrarDivIcon,
|
||
}).addTo(mapshow);
|
||
endAbrarMarkershow = new L.marker(L.latLng(latapi2, lngapi2), {
|
||
icon: endAbrarDivIcon,
|
||
}).addTo(mapshow);
|
||
isSetStartAbrarMarkershow = true;
|
||
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
isSetEndAbrarMarkershow = true;
|
||
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
checkMarkersAndDrawPathshow();
|
||
}
|
||
|
||
function initialField() {
|
||
$("#axis-name-id").val("");
|
||
$("#axis-type-id").val("0");
|
||
$("#project-title-id").val("");
|
||
$("#yearshown").val(0);
|
||
$("#contractor-id").val("");
|
||
$("#consultant-id").val("");
|
||
$("#contract-date-id").val("");
|
||
$("#contract-price-id").val("");
|
||
|
||
$("#province-id").removeClass("is-invalid-input");
|
||
$("#axis-name-id").removeClass("is-invalid-input");
|
||
$("#axis-type-id").removeClass("is-invalid-input");
|
||
$("#project-title-id").removeClass("is-invalid-input");
|
||
$("#yearshown").removeClass("is-invalid-input");
|
||
$("#contractor-id").removeClass("is-invalid-input");
|
||
$("#consultant-id").removeClass("is-invalid-input");
|
||
$("#contract-date-id").removeClass("is-invalid-input");
|
||
$("#contract-price-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
function initialMarkerMapValue(latP, lngP) {
|
||
// console.log("initialMarkerMapValue");
|
||
|
||
if (isSetStartAbrarMarker) {
|
||
endAbrarMarker.remove();
|
||
}
|
||
|
||
isSetEndAbrarMarker = false;
|
||
map.setView([latP, lngP], 9);
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
isSetStartAbrarMarker = false;
|
||
//change hamine start
|
||
removeStartToEndPath(0);
|
||
//change hamine end
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").val("");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").val("");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").removeClass(
|
||
"is-invalid-input"
|
||
);
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").removeClass(
|
||
"is-invalid-input"
|
||
);
|
||
}
|
||
|
||
//change hamine start
|
||
|
||
function initialMarkerMapValueEdit(startP, endP, update) {
|
||
// console.log("initialMarkerMapValueEdit");
|
||
|
||
// console.log("hello initial edit");
|
||
// console.log(endAbrarMarker);
|
||
// console.log("startP", startP);
|
||
// console.log("endP", endP);
|
||
// console.log("update", update);
|
||
|
||
startAbrarMarker.setLatLng(startP);
|
||
isSetStartAbrarMarker = true;
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
if (update) {
|
||
mapName = map2;
|
||
removeStartToEndPath(1);
|
||
|
||
if (endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng(endP);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
} else if (!endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: false,
|
||
});
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
} else if (endAbrarMarker && endP[0] == "NaN") {
|
||
endAbrarMarker.remove();
|
||
}
|
||
} else {
|
||
mapName = map;
|
||
removeStartToEndPath(0);
|
||
|
||
if (endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng(endP);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
} else if (!endAbrarMarker && endP[0] != "NaN") {
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
});
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = false;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn pin-set");
|
||
} else if (endAbrarMarker && endP[0] == "NaN") {
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng([
|
||
parseFloat(startP[0]),
|
||
parseFloat(startP[1]) + 1,
|
||
]);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = false;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn pin-set");
|
||
} else {
|
||
endAbrarMarker = new L.marker(
|
||
[parseFloat(startP[0]), parseFloat(startP[1]) + 1],
|
||
{
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
}
|
||
);
|
||
endAbrarMarker.addTo(mapName);
|
||
isSetEndAbrarMarker = false;
|
||
$("#pin-marker-end").removeClass("pin-move pin-warn pin-set");
|
||
}
|
||
}
|
||
}
|
||
//change hamine end
|
||
|
||
function initialMarkerMapValueEditshow(startP, endP) {
|
||
// console.log("initialMarkerMapValueEdit");
|
||
|
||
// console.log("hello initial edit");
|
||
// console.log(!endAbrarMarker);
|
||
|
||
//change hamine start
|
||
|
||
removeStartToEndPath(0);
|
||
|
||
//change hamine end
|
||
|
||
// if(endAbrarMarker){
|
||
endAbrarMarker.remove();
|
||
endAbrarMarker.setLatLng(endP);
|
||
endAbrarMarker.addTo(map);
|
||
|
||
// }else{
|
||
// endAbrarMarker = new L.marker(endP, {
|
||
// icon: endAbrarDivIcon,
|
||
// draggable: true,
|
||
// });
|
||
// endAbrarMarker.addTo(map);
|
||
// }
|
||
|
||
// endAbrarMarker.setLatLng(markerLatLng);
|
||
// endAbrarMarker.addTo(map);
|
||
|
||
startAbrarMarker.setLatLng(startP);
|
||
|
||
isSetStartAbrarMarker = true;
|
||
|
||
$("#pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
isSetEndAbrarMarker = true;
|
||
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
//change hamine start
|
||
|
||
checkMarkersAndDrawPath(0);
|
||
//change hamine end
|
||
|
||
avrLat = (parseFloat(startP[0]) + parseFloat(endP[0])) / 2;
|
||
avrLng = (parseFloat(startP[1]) + parseFloat(endP[1])) / 2;
|
||
|
||
map.setView([avrLat, avrLng], 6);
|
||
}
|
||
$("#add-project-button").on("click", function () {
|
||
$("#tool-main").css("display", "none");
|
||
$("#update-table").css("display", "none");
|
||
$("#submitNewRow").attr("disabled", false);
|
||
$("#btn-show-mask").animate({
|
||
top: "160px",
|
||
});
|
||
$(".parent-onmapButton p").css("right", "");
|
||
$(".parent-onmapButton p").animate({
|
||
left: "5px",
|
||
top: "210px",
|
||
});
|
||
$(".parent-Coordinates").addClass("d-none");
|
||
edit = false;
|
||
showModal(0);
|
||
initialField();
|
||
|
||
if (map == null) {
|
||
setTimeout(() => {
|
||
//change hamine start
|
||
createLeafletMap([35.6892, 51.389], [35.6892, 51.389], 0);
|
||
//change hamine end
|
||
}, 200);
|
||
} else {
|
||
initialMarkerMapValue(35.6892, 51.389);
|
||
}
|
||
$("#province-id").empty();
|
||
$("#province-id").append('<option value="0">انتخاب اداره کل</option>');
|
||
|
||
// console.log(provinces);
|
||
|
||
for (let index = 0; index < provinces.length; index++) {
|
||
$("#province-id").append(
|
||
"\
|
||
<option value=" +
|
||
provinces[index].id +
|
||
">" +
|
||
provinces[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
});
|
||
|
||
//yasi change start
|
||
$("#example").on("click", "tbody tr", function () {
|
||
if ($(this).hasClass("selected")) {
|
||
$(this).removeClass("selected");
|
||
$(this).css("color", "");
|
||
$(this).find("i").css("color", "");
|
||
} else {
|
||
table.$("tr.selected").find("i").css("color", "");
|
||
table.$("tr.selected").css("color", "");
|
||
table.$("tr.selected").removeClass("selected");
|
||
$(this).addClass("selected");
|
||
$(this).css("color", "white");
|
||
$(this).find("i").css("color", "white");
|
||
}
|
||
});
|
||
function scrolldown() {
|
||
// console.log("hi");
|
||
$("html, body").animate(
|
||
{
|
||
scrollTop: $(".up").offset().top,
|
||
},
|
||
50
|
||
);
|
||
}
|
||
function scrolldowntable() {
|
||
// console.log("hi");
|
||
$("html, body").animate(
|
||
{
|
||
scrollTop: $(".upnext").offset().top + 1000,
|
||
},
|
||
50
|
||
);
|
||
}
|
||
$("#example").on("click", "button.location-button", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idkol = row.data().id;
|
||
// console.log("idkol", idkol);
|
||
window.open("https://rms.rmto.ir/road-technical-building/showonmap?uid=" + idkol);
|
||
});
|
||
|
||
$("#example").on("click", "button.projectdistance", function () {
|
||
dataasli = [];
|
||
$("#update-table").css("display", "none");
|
||
// $("#tool-main").css("display", "block");
|
||
$("#noghte1").prop("checked", false);
|
||
$("#noghte2").prop("checked", false);
|
||
$("#noghte3").prop("checked", false);
|
||
$("#noghte4").prop("checked", false);
|
||
$("#noghte5").prop("checked", false);
|
||
$("#noghte6").prop("checked", false);
|
||
$("#tool-main").css("display", "block");
|
||
scrolldown();
|
||
$("#distance-title").empty();
|
||
$(".acclabel1").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte1").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte2").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte3").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte4").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte5").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte6").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte7").css("color", "rgba(0, 0, 0, 0.5)");
|
||
$(".noghte8").css("color", "rgba(0, 0, 0, 0.5)");
|
||
|
||
// pitikoo
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idkol = row.data().id;
|
||
// console.log(idkol);
|
||
status = row.data().status;
|
||
// console.log(row);
|
||
// console.log(row.data().id);
|
||
var projectTitle = row.data().project_name;
|
||
var axistype = row.data().axis_name;
|
||
var project_distance_check = row.data().project_distance;
|
||
var project_describe = row.data().project_description;
|
||
$("#tozihat").val(project_describe);
|
||
restrictInputOtherThanArabic($("#tozihat"));
|
||
var status = row.data().status;
|
||
/////// i delete disabled milad
|
||
// if (status == 2) {
|
||
|
||
// $("#submittool").attr('disabled', true);
|
||
// }
|
||
// else {
|
||
// $("#submittool").attr('disabled', false);
|
||
// }
|
||
dataasli.push(row.data());
|
||
// dataasli.push(project_describe)
|
||
// console.log("pitiko", project_distance_check)
|
||
// console.log("dataasli", dataasli);
|
||
var titlecard =
|
||
"طول پروژه" +
|
||
" " +
|
||
projectTitle +
|
||
" " +
|
||
"محور" +
|
||
" " +
|
||
axistype +
|
||
" " +
|
||
"به کیلومتر";
|
||
var note = '<h3 class="card-title">' + titlecard + "</h3>";
|
||
$("#distance-title").append(note);
|
||
for (var i = 0; i < 5; i++) {
|
||
$("#ehdas" + i).prop("checked", false);
|
||
}
|
||
$.each(project_distance_check, function (key, value) {
|
||
|
||
if (key == 1) {
|
||
$("#noghte1").prop("checked", true);
|
||
}
|
||
if (key == 2) {
|
||
$("#noghte2").prop("checked", true);
|
||
|
||
}
|
||
if (key == 3) {
|
||
$("#noghte3").prop("checked", true);
|
||
|
||
}
|
||
if (key == 4) {
|
||
$("#noghte4").prop("checked", true);
|
||
|
||
}
|
||
if (key == 5) {
|
||
$("#noghte5").prop("checked", true);
|
||
|
||
}
|
||
if (key == 6) {
|
||
$("#noghte6").prop("checked", true);
|
||
|
||
}
|
||
if (key == 7) {
|
||
$("#noghte7").prop("checked", true);
|
||
|
||
}
|
||
if (key == 8) {
|
||
$("#noghte8").prop("checked", true);
|
||
|
||
}
|
||
});
|
||
tabletool = $("#example-tool").DataTable({
|
||
dom: "rti",
|
||
scrollX: true,
|
||
destroy: true,
|
||
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, "desc"]],
|
||
processing: true,
|
||
// ajax: {
|
||
// url:
|
||
// "https://rms.rmto.ir/rahdari/road-danger-prevention/" +
|
||
// idkol +
|
||
// "/get-distance-update-list",
|
||
// type: "GET",
|
||
// dataSrc: function (json) {
|
||
|
||
// },
|
||
// },
|
||
data: dataasli,
|
||
columns: [
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//1
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 1;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox1" name="ehdas" value="2">\
|
||
<label for="checkbox1" class="checkbox1" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 1;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox1" name="ehdas" value="2">\
|
||
<label for="checkbox1" class="checkbox1" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox1" name="ehdas" value="2" checked>\
|
||
<label for="checkbox1" class="checkbox1" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//2
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 2;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox2" name="ehdas" value="2">\
|
||
<label for="checkbox2" class="checkbox2" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 2;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox2" name="ehdas" value="2">\
|
||
<label for="checkbox2" class="checkbox2" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox2" name="ehdas" value="2" checked>\
|
||
<label for="checkbox2" class="checkbox2" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//3
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 3;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox3" name="ehdas" value="2">\
|
||
<label for="checkbox3" class="checkbox3" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 3;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox3" name="ehdas" value="2">\
|
||
<label for="checkbox3" class="checkbox3" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox3" name="ehdas" value="2" checked>\
|
||
<label for="checkbox3" class="checkbox3" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//4
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 4;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox4" name="ehdas" value="2">\
|
||
<label for="checkbox4" class="checkbox4" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 4;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox4" name="ehdas" value="2">\
|
||
<label for="checkbox4" class="checkbox4" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox4" name="ehdas" value="2" checked>\
|
||
<label for="checkbox4" class="checkbox4" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//5
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 5;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox5" name="ehdas" value="2">\
|
||
<label for="checkbox5" class="checkbox5" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 5;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox5" name="ehdas" value="2">\
|
||
<label for="checkbox5" class="checkbox5" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox5" name="ehdas" value="2" checked>\
|
||
<label for="checkbox5" class="checkbox5" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//6
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 6;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return "-";
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<i class="fa fa-check" aria-hidden="true"></i>';
|
||
}
|
||
} else {
|
||
if (data.project_distance == null) {
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox6" name="ehdas" value="2">\
|
||
<label for="checkbox6" class="checkbox6" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
let keyIndex = Object.keys(data.project_distance).findIndex(
|
||
function (entry) {
|
||
return entry == 6;
|
||
}
|
||
);
|
||
console.log("key", keyIndex);
|
||
if (keyIndex == -1) {
|
||
console.log("hi");
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox6" name="ehdas" value="2">\
|
||
<label for="checkbox6" class="checkbox6" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
} else {
|
||
// console.log(Object.keys(data)[keyIndex]);
|
||
return '<div class="icheck-primary d-inline ml-2"> <input type="checkbox" id="checkbox6" name="ehdas" value="2" checked>\
|
||
<label for="checkbox6" class="checkbox6" style="color: rgba(0, 0, 0, 0.5);"></label>\
|
||
</div>';
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//8
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
// return '<textarea id="textshow" class="descripBox" name="" placeholder="توضیحات " rows="" cols="35" maxlength="200" disabled>' + data.project_describtion + '</textarea>'
|
||
if (data.project_describtion != null) {
|
||
return (
|
||
'<textarea id="textshow" class="descripBox" name="" placeholder="توضیحات " rows="" cols="35" maxlength="200" disabled>' +
|
||
data.project_describtion +
|
||
"</textarea>"
|
||
);
|
||
} else {
|
||
return '<textarea id="textshow" class="descripBox" name="" placeholder="توضیحات " rows="" cols="35" maxlength="200" disabled >-</textarea>';
|
||
}
|
||
} else {
|
||
if (data.project_describtion != null) {
|
||
return (
|
||
'<textarea id="textshow" class="descripBox" name="" placeholder="توضیحات " rows="" cols="35" maxlength="200" >' +
|
||
data.project_describtion +
|
||
"</textarea>"
|
||
);
|
||
} else {
|
||
return '<textarea id="textshow" class="descripBox" name="" placeholder="توضیحات " rows="" cols="35" maxlength="200" >-</textarea>';
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function (data, type, row, column) {
|
||
//9
|
||
console.log("hhh", data);
|
||
if (data.status == 2) {
|
||
/////// i delete disabled milad
|
||
|
||
return '<button type="button" class="btn btn-success submittool" id="submittool" >ثبت </button>';
|
||
} else {
|
||
return '<button type="button" class="btn btn-success submittool" id="submittool" >ثبت </button>';
|
||
}
|
||
},
|
||
},
|
||
],
|
||
});
|
||
});
|
||
$("#example-tool").on("click", "button.submittool", function () {
|
||
var objectedit = {};
|
||
if ($("#checkbox1").is(":checked")) {
|
||
objectedit[1] = ["1", " تعریض پل/آبرو"];
|
||
}
|
||
if ($("#checkbox2").is(":checked")) {
|
||
objectedit[2] = ["1", " تعمیرات اساسی پل"];
|
||
}
|
||
if ($("#checkbox3").is(":checked")) {
|
||
objectedit[3] = ["1", " تعمیرات تونل"];
|
||
}
|
||
if ($("#checkbox4").is(":checked")) {
|
||
objectedit[4] = ["1", " تعمیر یا احداث دیوار حائل"];
|
||
}
|
||
if ($("#checkbox5").is(":checked")) {
|
||
objectedit[5] = ["1", "احداث پل جدید"];
|
||
}
|
||
if ($("#checkbox6").is(":checked")) {
|
||
objectedit[6] = ["1", "احداث کنار گذر پل / تونل"];
|
||
}
|
||
if ($("#textshow").val() != "-") {
|
||
objectedit[7] = ["1", " سایر اقدامات"];
|
||
}
|
||
// alert(objectedit)
|
||
console.log("objectedit", objectedit);
|
||
Object.size = function (obj) {
|
||
var size = 0,
|
||
key;
|
||
for (key in obj) {
|
||
if (obj.hasOwnProperty(key)) size++;
|
||
}
|
||
return size;
|
||
};
|
||
|
||
// Get the size of an object
|
||
var size = Object.size(objectedit);
|
||
console.log(size);
|
||
if (size != 0) {
|
||
var texterae = $("#textshow").val();
|
||
|
||
// console.log("objectedit", objectedit)
|
||
let formData = new FormData();
|
||
let project_distance = JSON.stringify(objectedit);
|
||
console.log("project_distance", project_distance);
|
||
formData.append("project-distance", project_distance);
|
||
formData.append("project-describtion", texterae);
|
||
for (var value of formData.values()) {
|
||
console.log(value);
|
||
}
|
||
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
idkol +
|
||
"/edit-distance",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
// $("#show-projecttool").modal("hide");
|
||
// ajaxcalltablefirst();
|
||
// ajaxcalltablefirsttool(idkol);
|
||
location.reload();
|
||
// Swal.fire({
|
||
// icon: "success",
|
||
// title: "با موفقیت بروزرسانی شد",
|
||
// confirmButtonText: "بستن",
|
||
// preConfirm: () => {
|
||
|
||
// }
|
||
// });
|
||
//todo yasiii
|
||
},
|
||
error: function (error) {
|
||
console.log(error);
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
} else {
|
||
$(".acclabel1").css("color", "red");
|
||
$(".noghte1").css("color", "red");
|
||
$(".noghte2").css("color", "red");
|
||
$(".noghte3").css("color", "red");
|
||
$(".noghte4").css("color", "red");
|
||
$(".noghte5").css("color", "red");
|
||
$(".noghte6").css("color", "red");
|
||
$(".noghte7").css("color", "red");
|
||
$(".noghte8").css("color", "red");
|
||
}
|
||
// alert("hi")
|
||
});
|
||
|
||
$("#submitoolfinal").on("click", function () {
|
||
var objectedit = {};
|
||
var project1 = $("#project-distance-input-1").val();
|
||
var project2 = $("#project-distance-input-2").val();
|
||
var project3 = $("#project-distance-input-3").val();
|
||
var project4 = $("#project-distance-input-4").val();
|
||
var project5 = $("#project-distance-input-5").val();
|
||
var project6 = $("#project-distance-input-6").val();
|
||
var project7 = $("#project-distance-input-7").val();
|
||
var project8 = $("#project-distance-input-8").val();
|
||
var project9 = $("#project-distance-input-9").val();
|
||
if (project1 !== "" && project1 !== "0") {
|
||
objectedit[1] = [project1, "1", "نصب حفاظ بتنی "];
|
||
}
|
||
if (project2 !== "" && project2 !== "0") {
|
||
objectedit[2] = [project2, "1", "نصب حفاظ فلزی گاردریل"];
|
||
}
|
||
if (project3 !== "" && project3 !== "0") {
|
||
objectedit[3] = [project3, "1", " اجرای روشنایی طولی "];
|
||
}
|
||
if (project4 !== "" && project4 !== "0") {
|
||
objectedit[4] = [project4, "1", " اجرای روشنایی نقطه ای "];
|
||
}
|
||
if (project5 !== "" && project5 !== "0") {
|
||
objectedit[5] = [project5, "1", " نصب علائم ایمنی (اخباری ) "];
|
||
}
|
||
if (project6 !== "" && project6 !== "0") {
|
||
objectedit[6] = [project6, "1", " نصب علائم ایمنی (سایر ) "];
|
||
}
|
||
if (project7 !== "" && project7 !== "0") {
|
||
objectedit[7] = [project7, "1", "خط کشی"];
|
||
}
|
||
if (project8 !== "" && project8 !== "0") {
|
||
objectedit[8] = [project8, "1", "اصلاح شیب شیروانی "];
|
||
}
|
||
if (project9 !== "" && project9 !== "0") {
|
||
objectedit[9] = [project9, "1", "سایر اقدامات "];
|
||
}
|
||
// if ($("#noghte1").is(":checked")) {
|
||
// objectedit[1] = ["1", "نصب حفاظ بتنی "];
|
||
// }
|
||
// if ($("#noghte2").is(":checked")) {
|
||
// objectedit[2] = ["1", "نصب حفاظ فلزی گاردریل"];
|
||
// }
|
||
// if ($("#noghte3").is(":checked")) {
|
||
// objectedit[3] = ["1", " اجرای روشنایی طولی /نقطه ای "];
|
||
// }
|
||
// if ($("#noghte4").is(":checked")) {
|
||
// objectedit[4] = ["1", " نصب علائم ایمنی "];
|
||
// }
|
||
// if ($("#noghte5").is(":checked")) {
|
||
// objectedit[5] = ["1", "خط کشی"];
|
||
// }
|
||
// if ($("#noghte6").is(":checked")) {
|
||
// objectedit[6] = ["1", "سایر اقدامات ایمنی راه"];
|
||
// }
|
||
|
||
// console.log("objectedit", objectedit);
|
||
Object.size = function (obj) {
|
||
var size = 0,
|
||
key;
|
||
for (key in obj) {
|
||
if (obj.hasOwnProperty(key)) size++;
|
||
}
|
||
return size;
|
||
};
|
||
|
||
for (i = 1; i < 10; i++) {
|
||
if (
|
||
$("#project-distance-input-" + i)
|
||
.val()
|
||
.slice(0, 1) == 0 &&
|
||
$("#project-distance-input-" + i).val().length > 1 &&
|
||
$("#project-distance-input-" + i)
|
||
.val()
|
||
.slice(1, 2) != "."
|
||
) {
|
||
$("#project-distance-input-" + i).addClass("is-invalid");
|
||
} else {
|
||
$("#project-distance-input-" + i).removeClass("is-invalid");
|
||
}
|
||
}
|
||
if ($("#show-projecttool").find(".is-invalid").length) {
|
||
} else {
|
||
// Get the size of an object
|
||
var size = Object.size(objectedit);
|
||
// console.log(size);
|
||
if (size != 0) {
|
||
// console.log("objectedit", objectedit)
|
||
let formData = new FormData();
|
||
let project_distance = JSON.stringify(objectedit);
|
||
// console.log("project_distance", project_distance);
|
||
formData.append("project-distance", project_distance);
|
||
formData.append("project-description", "null");
|
||
for (var value of formData.values()) {
|
||
// console.log(value);
|
||
}
|
||
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
idkol +
|
||
"/edit-distance",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
// showLoaderScreen();
|
||
// $("#show-projecttool").modal("hide");
|
||
// ajaxcalltablefirst();
|
||
// ajaxcalltablefirsttool(idkol);
|
||
|
||
location.reload();
|
||
// Swal.fire({
|
||
// icon: "success",
|
||
// title: "با موفقیت بروزرسانی شد",
|
||
// confirmButtonText: "بستن",
|
||
// preConfirm: () => {
|
||
|
||
// }
|
||
// });
|
||
//todo yasiii
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
} else {
|
||
for (var i = 0; i < 10; i++) {
|
||
$("#project-distance-input-" + i).addClass("is-invalid");
|
||
}
|
||
// $(".acclabel1").css("color", "red");
|
||
// $(".noghte1").css("color", "red")
|
||
// $(".noghte2").css("color", "red")
|
||
// $(".noghte3").css("color", "red")
|
||
// $(".noghte4").css("color", "red")
|
||
// $(".noghte5").css("color", "red")
|
||
// $(".noghte6").css("color", "red")
|
||
// $(".noghte7").css("color", "red")
|
||
// $(".noghte8").css("color", "red")
|
||
}
|
||
}
|
||
});
|
||
$("#example").on("click", "button.finalsubmit", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idkol = row.data().id;
|
||
// console.log(idkol);
|
||
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-technical-building/" +
|
||
idkol +
|
||
"/submit",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
// console.log(result.data.redirect+idkol)
|
||
//yasiu
|
||
hideLoaderScreen();
|
||
window.open(result.data.redirect);
|
||
location.reload();
|
||
// Swal.fire({
|
||
// icon: "success",
|
||
// title: "با موفقیت بروزرسانی شد",
|
||
// confirmButtonText: "بستن",
|
||
// preConfirm: () => {
|
||
|
||
// // window.open("/dashboarderoad/form%20upload/pages/rmshowon.html?uid=" + idkol);
|
||
|
||
// },
|
||
// });
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
},
|
||
});
|
||
});
|
||
$("#example").on("click", "button.deletsubmit", function () {
|
||
// console.log("bokhoresh");
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idkol = row.data().id;
|
||
// console.log(idkol)
|
||
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-technical-building/" +
|
||
idkol +
|
||
"/delete",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
table.ajax.reload(null, false);
|
||
// ajaxcalltablefirst();
|
||
// showLoaderScreen();
|
||
// Swal.fire({
|
||
// icon: "success",
|
||
// title: "با موفقیت حذف شد ",
|
||
// confirmButtonText: "بستن",
|
||
// preConfirm: () => {
|
||
// location.reload();
|
||
// },
|
||
// });
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
},
|
||
});
|
||
});
|
||
|
||
function getProvinces() {
|
||
let reqUrl = "https://rms.rmto.ir/public/contents/provinces";
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: reqUrl,
|
||
type: "GET",
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
//console.log(result);
|
||
provinces = result.data;
|
||
},
|
||
error: function (error) {
|
||
// hideLoaderScreen();
|
||
//console.log(error);
|
||
},
|
||
});
|
||
}
|
||
|
||
function getTowns(id, num, val, defaultVal) {
|
||
let reqUrl = "https://rms.rmto.ir/public/contents/provinces/" + id;
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: reqUrl,
|
||
type: "GET",
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
// console.log(result);
|
||
towns = result.data;
|
||
if (num == 1) {
|
||
setTownSelect("", val[0]);
|
||
} else if (num == 2) {
|
||
setTownSelect("", val[0]);
|
||
setTownSelect("1", val[1]);
|
||
} else {
|
||
setTownSelect("", val[0]);
|
||
setTownSelect("1", val[1]);
|
||
setTownSelect("2", val[2]);
|
||
}
|
||
|
||
if (!edit || !defaultVal) {
|
||
if (towns.length) {
|
||
let provinceIndex = provinces.findIndex(function (entry) {
|
||
return entry.id == towns[0].province_id;
|
||
});
|
||
|
||
if (provinceIndex != -1) {
|
||
// console.log(provinces[provinceIndex]);
|
||
map.flyTo(
|
||
[
|
||
provinces[provinceIndex].center_lat,
|
||
provinces[provinceIndex].center_long,
|
||
],
|
||
10
|
||
);
|
||
}
|
||
initialMarkerMapValue(
|
||
provinces[provinceIndex].center_lat,
|
||
provinces[provinceIndex].center_long
|
||
);
|
||
}
|
||
}
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen();
|
||
//console.log(error);
|
||
},
|
||
complete: function () { },
|
||
});
|
||
}
|
||
|
||
function setTownSelect(box, selectedId) {
|
||
$("#town-id" + box).empty();
|
||
$("#town-id" + box).append('<option value="0">انتخاب شهرستان</option>');
|
||
|
||
for (let index = 0; index < towns.length; index++) {
|
||
if (selectedId == towns[index].id) {
|
||
$("#town-id" + box).append(
|
||
"\
|
||
<option value=" +
|
||
towns[index].id +
|
||
" selected>" +
|
||
towns[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
} else {
|
||
$("#town-id" + box).append(
|
||
"\
|
||
<option value=" +
|
||
towns[index].id +
|
||
">" +
|
||
towns[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
$("#province-id").change(function () {
|
||
let boxNum = $("#subTown").children().length;
|
||
if ($(this).val() > 0) {
|
||
if (boxNum == 1) {
|
||
getTowns($(this).val(), 1, [0], false);
|
||
} else if (boxNum == 2) {
|
||
getTowns($(this).val(), 2, [0, 0], false);
|
||
} else {
|
||
getTowns($(this).val(), 3, [0, 0, 0], false);
|
||
}
|
||
} else {
|
||
if (boxNum == 1) {
|
||
$("#town-id").empty();
|
||
$("#town-id").append('<option value="0">انتخاب شهرستان</option>');
|
||
} else if (boxNum == 2) {
|
||
$("#town-id").empty();
|
||
$("#town-id").append('<option value="0">انتخاب شهرستان</option>');
|
||
$("#town-id1").empty();
|
||
$("#town-id1").append('<option value="0">انتخاب شهرستان</option>');
|
||
} else {
|
||
$("#town-id").empty();
|
||
$("#town-id").append('<option value="0">انتخاب شهرستان</option>');
|
||
$("#town-id1").empty();
|
||
$("#town-id1").append('<option value="0">انتخاب شهرستان</option>');
|
||
$("#town-id2").empty();
|
||
$("#town-id2").append('<option value="0">انتخاب شهرستان</option>');
|
||
}
|
||
}
|
||
});
|
||
|
||
$("#example").on("click", "button.details-control", function () {
|
||
edit = true;
|
||
$(".form-control").removeClass("is-invalid-input");
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idEdit = row.data().id;
|
||
|
||
var startLatlng = row.data().start_latlng;
|
||
var endLatlng = row.data().end_latlng;
|
||
// console.log("endlatlnmg", endLatlng);
|
||
var endless = endLatlng[0] == "NaN";
|
||
// console.log("endddd", endless);
|
||
$(".parent-Coordinates").removeClass("d-none");
|
||
$("#btn-show-mask").animate({
|
||
top: "140px",
|
||
});
|
||
$(".parent-onmapButton p").css("left", "");
|
||
$(".parent-onmapButton p").animate({
|
||
right: "0px",
|
||
top: "220px",
|
||
});
|
||
$("#yearshown").val(row.data().contract_date);
|
||
|
||
//chnage hamine start
|
||
if (map == null) {
|
||
setTimeout(() => {
|
||
flagshownmarker = 0;
|
||
createLeafletMap(startLatlng, endLatlng, 0);
|
||
}, 200);
|
||
} else {
|
||
initialMarkerMapValueEdit(startLatlng, endLatlng, 0);
|
||
}
|
||
|
||
if (endless) {
|
||
|
||
isSetEndAbrarMarker = false;
|
||
|
||
removeStartToEndPath();
|
||
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
|
||
|
||
}
|
||
|
||
showModal(row.data().id);
|
||
|
||
$("#province-id").empty();
|
||
$("#province-id").append('<option value="0">انتخاب اداره کل</option>');
|
||
|
||
for (let index = 0; index < provinces.length; index++) {
|
||
$("#province-id").append(
|
||
"\
|
||
<option value=" +
|
||
provinces[index].id +
|
||
">" +
|
||
provinces[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
|
||
var provinceid = row.data().province_id;
|
||
var townMap = row.data().cities_id;
|
||
var townsArray = Object.keys(townMap);
|
||
var townsArrayValue = Object.values(townMap);
|
||
|
||
if (townsArray.length == 1) {
|
||
getTowns(row.data().province_id, 1, [townsArray[0]], true);
|
||
} else if (townsArray.length == 2) {
|
||
$("#subTown div").append(
|
||
`<div class="input-group mb-3">
|
||
|
||
<input type ="text" class="form-control" id="mosharekat1" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
|
||
</div>
|
||
`
|
||
);
|
||
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id1"
|
||
>
|
||
<option value="0" style="font-size:10px">انتخاب شهرستان</option>
|
||
</select>
|
||
<div class="input-group mb-3">
|
||
|
||
<input type ="text" class="form-control" id="mosharekat2" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>`);
|
||
|
||
getTowns(row.data().province_id, 2, [townsArray[0], townsArray[1]], true);
|
||
|
||
$("#mosharekat1").val(townsArrayValue[0]);
|
||
$("#mosharekat2").val(townsArrayValue[1]);
|
||
} else if (townsArray.length == 3) {
|
||
$("#subTown div").append(
|
||
`<div class="input-group mb-3">
|
||
|
||
<input type ="text" class="form-control" id="mosharekat1" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
|
||
</div>
|
||
`
|
||
);
|
||
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id1"
|
||
>
|
||
<option value="0" style="font-size:10px">انتخاب شهرستان</option>
|
||
</select>
|
||
<div class="input-group mb-3">
|
||
|
||
<input type ="text" class="form-control" id="mosharekat2" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>`);
|
||
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id2"
|
||
>
|
||
<option value="0" style="font-size:10px">انتخاب شهرستان</option>
|
||
</select>
|
||
<div class="input-group mb-3">
|
||
|
||
<input type ="text" class="form-control" id="mosharekat3" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>`);
|
||
|
||
getTowns(
|
||
row.data().province_id,
|
||
3,
|
||
[townsArray[0], townsArray[1], townsArray[2]],
|
||
true
|
||
);
|
||
|
||
$("#mosharekat1").val(townsArrayValue[0]);
|
||
$("#mosharekat2").val(townsArrayValue[1]);
|
||
$("#mosharekat3").val(townsArrayValue[2]);
|
||
}
|
||
|
||
$("[data-mask]").inputmask();
|
||
|
||
var Roadaxis = row.data().axis_name;
|
||
var axisName_type = row.data().axis_type;
|
||
var ProjectTitle = row.data().project_name;
|
||
var contractorName_id = row.data().contractor_name;
|
||
var consultantName_id = row.data().consultant_name;
|
||
var contractName_date = row.data().contract_date;
|
||
var contractName_credit = row.data().contract_credit;
|
||
|
||
onLocationChange();
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").val(
|
||
parseFloat(startLatlng[0]).toFixed(6) +
|
||
parseFloat(startLatlng[1]).toFixed(6)
|
||
);
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").val(
|
||
parseFloat(endLatlng[0]).toFixed(6) + parseFloat(endLatlng[1]).toFixed(6)
|
||
);
|
||
|
||
|
||
$("#province-id").val(provinceid);
|
||
$("#axis-name-id").val(Roadaxis);
|
||
$("#axis-type-id").val(axisName_type);
|
||
$("#project-title-id").val(ProjectTitle);
|
||
$("#contractor-id").val(contractorName_id);
|
||
$("#consultant-id").val(consultantName_id);
|
||
$("#contract-date-id").val(contractName_date);
|
||
$("#contract-price-id").val(contractName_credit);
|
||
});
|
||
$("#submittool").on("click", function () {
|
||
var objectedit = {};
|
||
if ($("#noghte1").is(":checked")) {
|
||
objectedit[1] = ["1", "نصب حفاظ بتنی "];
|
||
}
|
||
if ($("#noghte2").is(":checked")) {
|
||
objectedit[2] = ["1", "نصب حفاظ فلزی گاردریل"];
|
||
}
|
||
if ($("#noghte3").is(":checked")) {
|
||
objectedit[3] = ["1", " اجرای روشنایی طولی /نقطه ای "];
|
||
}
|
||
if ($("#noghte4").is(":checked")) {
|
||
objectedit[4] = ["1", " نصب علائم ایمنی "];
|
||
}
|
||
if ($("#noghte5").is(":checked")) {
|
||
objectedit[5] = ["1", "خط کشی"];
|
||
}
|
||
if ($("#noghte6").is(":checked")) {
|
||
objectedit[6] = ["1", "سایر اقدامات ایمنی راه"];
|
||
}
|
||
Object.size = function (obj) {
|
||
var size = 0,
|
||
key;
|
||
for (key in obj) {
|
||
if (obj.hasOwnProperty(key)) size++;
|
||
}
|
||
return size;
|
||
};
|
||
|
||
var size = Object.size(objectedit);
|
||
// console.log(size);
|
||
if (size != 0) {
|
||
var texterae = $("#tozihat").val();
|
||
let formData = new FormData();
|
||
let project_distance = JSON.stringify(objectedit);
|
||
console.log("project_distance", project_distance);
|
||
formData.append("project-distance", project_distance);
|
||
formData.append("project-description", texterae);
|
||
for (var value of formData.values()) {
|
||
// console.log(value);
|
||
}
|
||
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
idkol +
|
||
"/edit-distance",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
|
||
location.reload()
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
} else {
|
||
$(".acclabel1").css("color", "red");
|
||
$(".noghte1").css("color", "red");
|
||
$(".noghte2").css("color", "red");
|
||
$(".noghte3").css("color", "red");
|
||
$(".noghte4").css("color", "red");
|
||
$(".noghte5").css("color", "red");
|
||
$(".noghte6").css("color", "red");
|
||
$(".noghte7").css("color", "red");
|
||
$(".noghte8").css("color", "red");
|
||
}
|
||
});
|
||
//end
|
||
|
||
function showModal(id) {
|
||
$("#stepModalmaintenance").modal("show");
|
||
|
||
$("[data-mask]").inputmask();
|
||
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").on(
|
||
"keyup",
|
||
function () {
|
||
// console.log("he deals a card as a meditation :)");
|
||
checkStartMarkerValidation();
|
||
}
|
||
);
|
||
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").on(
|
||
"keyup",
|
||
function () {
|
||
checkEndMarkerValidation();
|
||
}
|
||
);
|
||
|
||
function checkStartMarkerValidation(forSaveData = false, pageOnLoad = false) {
|
||
let reg = /^([0-9]){2}\.([0-9])+$/;
|
||
let startLatLngVal = $(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
)
|
||
.val()
|
||
.split(" - ");
|
||
let startLatLng = startLatLngVal.map(function (e) {
|
||
e = e.replace(/_/g, "");
|
||
return parseFloat(e.slice(1, -1));
|
||
});
|
||
// console.log(startLatLng);
|
||
if (isNaN(startLatLng[0])) {
|
||
if (!forSaveData) {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
} else {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).addClass("is-invalid-input");
|
||
}
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").val("");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-start]").attr(
|
||
"placeholder",
|
||
"(شروع) => (طول جغرافیایی) - (عرض جغرافیایی)"
|
||
);
|
||
return false;
|
||
} else if (
|
||
!startLatLng == 2 ||
|
||
!reg.test(startLatLng[0]) ||
|
||
!reg.test(startLatLng[1])
|
||
) {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).addClass("is-invalid-input");
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
return false;
|
||
} else {
|
||
if (!forSaveData) {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
startAbrarMarker.setLatLng(startLatLng);
|
||
|
||
if (pageOnLoad) {
|
||
setTimeout(() => {
|
||
$("#pin-marker-start").removeClass("pin-move").addClass("pin-set");
|
||
startAbrarMarker.setLatLng(startLatLng);
|
||
}, 10);
|
||
} else {
|
||
$("#pin-marker-start").removeClass("pin-move").addClass("pin-set");
|
||
}
|
||
|
||
if (!isSetEndAbrarMarker) {
|
||
let markerLatLng = [
|
||
startAbrarMarker.getLatLng().lat,
|
||
startAbrarMarker.getLatLng().lng + 0.0008,
|
||
];
|
||
|
||
map.setView(markerLatLng);
|
||
endAbrarMarker.setLatLng(markerLatLng);
|
||
|
||
if (!isSetStartAbrarMarker) {
|
||
endAbrarMarker.addTo(map);
|
||
}
|
||
}
|
||
|
||
isSetStartAbrarMarker = true;
|
||
} else {
|
||
projectEditData["project-start-latlng"] = [
|
||
startAbrarMarker.getLatLng().lat.toFixed(6),
|
||
startAbrarMarker.getLatLng().lng.toFixed(6),
|
||
];
|
||
}
|
||
//change hamine start
|
||
checkMarkersAndDrawPath(0);
|
||
//change hamine end
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
function checkEndMarkerValidation(forSaveData = false, pageOnLoad = false) {
|
||
let reg = /^([0-9]){2}\.([0-9])+$/;
|
||
let endLatLngVal = $(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
)
|
||
.val()
|
||
.split(" - ");
|
||
let endLatLng = endLatLngVal.map(function (e) {
|
||
e = e.replace(/_/g, "");
|
||
return parseFloat(e.slice(1, -1));
|
||
});
|
||
|
||
if (isNaN(endLatLng[0])) {
|
||
if (!forSaveData) {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
} else {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
).addClass("is-invalid-input");
|
||
}
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").val("");
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").attr(
|
||
"placeholder",
|
||
"(پایان) => (طول جغرافیایی) - (عرض جغرافیایی)"
|
||
);
|
||
return false;
|
||
} else if (
|
||
!endLatLng == 2 ||
|
||
!reg.test(endLatLng[0]) ||
|
||
!reg.test(endLatLng[1])
|
||
) {
|
||
$("#stepModalmaintenance input[name=abrar-project-latlng-end]").addClass(
|
||
"is-invalid-input"
|
||
);
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
return false;
|
||
} else {
|
||
if (!forSaveData) {
|
||
$(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
endAbrarMarker.setLatLng(endLatLng);
|
||
isSetEndAbrarMarker = true;
|
||
|
||
if (pageOnLoad) {
|
||
setTimeout(() => {
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
endAbrarMarker.setLatLng(endLatLng);
|
||
}, 10);
|
||
} else {
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
}
|
||
} else {
|
||
projectEditData["project-end-latlng"] = [
|
||
endAbrarMarker.getLatLng().lat.toFixed(6),
|
||
endAbrarMarker.getLatLng().lng.toFixed(6),
|
||
];
|
||
}
|
||
//change hamine start
|
||
checkMarkersAndDrawPath(0);
|
||
//change hamine end
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
$("#subTown").empty();
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id"
|
||
>
|
||
<option value="0">انتخاب شهرستان</option>
|
||
</select>
|
||
|
||
</div>`);
|
||
|
||
$(".cancel").on("click", function () {
|
||
$("#stepModalmaintenance").modal("hide");
|
||
});
|
||
|
||
restrictInputOtherThanArabic($("#axis-name-id"));
|
||
restrictInputOtherThanArabic($("#project-title-id"));
|
||
restrictInputOtherThanArabic($("#contractor-id"));
|
||
restrictInputOtherThanArabic($("#consultant-id"));
|
||
|
||
$("#town-id").on("change", function () {
|
||
if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
$("#town-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
}
|
||
|
||
$("#submitNewRow").on("click", function () {
|
||
let url = "https://rms.rmto.ir/rahdari/road-technical-building/create";
|
||
|
||
if (edit) {
|
||
url = "https://rms.rmto.ir/rahdari/road-technical-building/" + idEdit + "/edit";
|
||
}
|
||
// First, get input values
|
||
const p2e = (s) => s.replace(/[۰-۹]/g, (d) => "۰۱۲۳۴۵۶۷۸۹".indexOf(d));
|
||
let startLatLngVal = $(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-start]"
|
||
)
|
||
.val()
|
||
.split(" - ");
|
||
let startLatLng = startLatLngVal.map(function (e) {
|
||
e = e.replace(/_/g, "");
|
||
return parseFloat(e.slice(1, -1));
|
||
});
|
||
|
||
let endLatLngVal = $(
|
||
"#stepModalmaintenance input[name=abrar-project-latlng-end]"
|
||
)
|
||
.val()
|
||
.split(" - ");
|
||
let endLatLng = endLatLngVal.map(function (e) {
|
||
e = e.replace(/_/g, "");
|
||
return parseFloat(e.slice(1, -1));
|
||
});
|
||
|
||
let provinceVal = $("#province-id").children("option:selected").val();
|
||
|
||
let axisNameVal = $("#axis-name-id").val();
|
||
|
||
let axisTypeVal = $("#axis-type-id").children("option:selected").val();
|
||
|
||
let town1Val = $("#town-id").children("option:selected").val();
|
||
let mosharekatTown1Val = $("#mosharekat1").val();
|
||
|
||
let town2Val = "";
|
||
let mosharekatTown2Val = "";
|
||
if ($("#town-id1").css("display") != "none") {
|
||
town2Val = $("#town-id1").children("option:selected").val();
|
||
mosharekatTown2Val = $("#mosharekat2").val();
|
||
}
|
||
|
||
let town3Val = "";
|
||
let mosharekatTown3Val = "";
|
||
if ($("#town-id2").css("display") != "none") {
|
||
town3Val = $("#town-id2").children("option:selected").val();
|
||
mosharekatTown3Val = $("#mosharekat3").val();
|
||
}
|
||
|
||
let projectTitleVal = $("#project-title-id").val();
|
||
|
||
let contractorNameVal = $("#contractor-id").val();
|
||
|
||
let consultantNameVal = $("#consultant-id").val();
|
||
|
||
let contractDateVal = $("#contract-date-id").val();
|
||
// console.log("contractDateVal", p2e(contractDateVal))
|
||
let contractPriceVal = $("#contract-price-id").val();
|
||
|
||
// Second, validate inputs
|
||
if (isNaN(startLatLng[0])) {
|
||
$("input[name='abrar-project-latlng-start']").addClass("is-invalid-input");
|
||
} else {
|
||
$("input[name='abrar-project-latlng-start']").removeClass(
|
||
"is-invalid-input"
|
||
);
|
||
}
|
||
|
||
if (parseInt(provinceVal) == 0) {
|
||
$("#province-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#province-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (axisNameVal == "") {
|
||
$("#axis-name-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis-name-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (parseInt(axisTypeVal) == 0) {
|
||
$("#axis-type-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis-type-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
// if (
|
||
// $("#yearshown").val().length < 4 ||
|
||
// $("#yearshown").val().slice(0, 1) == 0
|
||
// ) {
|
||
// $("#yearshown").addClass("is-invalid-input");
|
||
// } else {
|
||
// $("#yearshown").removeClass("is-invalid-input");
|
||
// }
|
||
if (parseInt(town1Val) == 0) {
|
||
$("#town-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (parseInt(town2Val) == 0) {
|
||
$("#town-id1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id1").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (parseInt(town3Val) == 0) {
|
||
$("#town-id2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id2").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#town-id2").length) {
|
||
if (mosharekatTown1Val == "") {
|
||
$("#mosharekat1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat1").removeClass("is-invalid-input");
|
||
}
|
||
if (mosharekatTown2Val == "") {
|
||
$("#mosharekat2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat2").removeClass("is-invalid-input");
|
||
}
|
||
if (mosharekatTown3Val == "") {
|
||
$("#mosharekat3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat3").removeClass("is-invalid-input");
|
||
}
|
||
|
||
let mosharekatSum =
|
||
parseInt(mosharekatTown1Val) +
|
||
parseInt(mosharekatTown2Val) +
|
||
parseInt(mosharekatTown3Val);
|
||
|
||
if (mosharekatSum != 100) {
|
||
$("#mosharekat1").addClass("is-invalid-input");
|
||
$("#mosharekat2").addClass("is-invalid-input");
|
||
$("#mosharekat3").addClass("is-invalid-input");
|
||
if ($(".invalid-feedback").length) {
|
||
$(".invalid-feedback").show();
|
||
} else {
|
||
$("#mosharekat1").parent().append(`
|
||
<div class="invalid-feedback">
|
||
مجموع درصد مشارکت ها باید 100 درصد باشد.
|
||
</div>
|
||
`);
|
||
$(".invalid-feedback").show();
|
||
}
|
||
} else {
|
||
if ($(".invalid-feedback").length) $(".invalid-feedback").hide();
|
||
}
|
||
} else if ($("#town-id1").length) {
|
||
if (mosharekatTown1Val == "") {
|
||
$("#mosharekat1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat1").removeClass("is-invalid-input");
|
||
}
|
||
if (mosharekatTown2Val == "") {
|
||
$("#mosharekat2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat2").removeClass("is-invalid-input");
|
||
}
|
||
|
||
let mosharekatSum =
|
||
parseInt(mosharekatTown1Val) + parseInt(mosharekatTown2Val);
|
||
|
||
if (mosharekatSum != 100) {
|
||
$("#mosharekat1").addClass("is-invalid-input");
|
||
$("#mosharekat2").addClass("is-invalid-input");
|
||
|
||
if ($(".invalid-feedback").length) {
|
||
$(".invalid-feedback").show();
|
||
} else {
|
||
$("#mosharekat1").parent().append(`
|
||
<div class="invalid-feedback">
|
||
مجموع درصد مشارکت ها باید 100 درصد باشد.
|
||
</div>
|
||
`);
|
||
$(".invalid-feedback").show();
|
||
}
|
||
} else {
|
||
if ($(".invalid-feedback").length) $(".invalid-feedback").hide();
|
||
}
|
||
}
|
||
|
||
if (projectTitleVal == "") {
|
||
$("#project-title-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project-title-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (contractorNameVal == "") {
|
||
$("#contractor-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contractor-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (consultantNameVal == "") {
|
||
$("#consultant-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#consultant-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (contractDateVal == "") {
|
||
$("#contract-date-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract-date-id").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if (contractPriceVal == "") {
|
||
$("#contract-price-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract-price-id").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#town-id").val() === $("#town-id1").val()) {
|
||
$("#town-id1").addClass("is-invalid-input");
|
||
}
|
||
if ($("#town-id").val() === $("#town-id2").val()) {
|
||
$("#town-id2").addClass("is-invalid-input");
|
||
}
|
||
if ($("#town-id1").val() === $("#town-id2").val()) {
|
||
$("#town-id2").addClass("is-invalid-input");
|
||
}
|
||
if ($("#stepModalmaintenance").find(".is-invalid-input").length) {
|
||
// has error
|
||
// alert("لطفا تمامی فیلدهای مرتبط را تکمیل کنید.");
|
||
// Swal.fire({
|
||
// icon: "error",
|
||
// title: "خطا",
|
||
// text: "لطفا تمامی فیلدهای مرتبط را تکمیل کنید.",
|
||
// confirmButtonText: "بستن",
|
||
// });
|
||
} else if (boundingbox) {
|
||
if (
|
||
boundingbox &&
|
||
parseFloat(startLatLng[0]) >= parseFloat(boundingbox[0]) &&
|
||
parseFloat(startLatLng[0]) <= parseFloat(boundingbox[1]) &&
|
||
parseFloat(startLatLng[1]) >= parseFloat(boundingbox[2]) &&
|
||
parseFloat(startLatLng[1]) <= parseFloat(boundingbox[3])
|
||
// &&
|
||
// parseFloat(endLatLng[0]) >= parseFloat(boundingbox[0]) &&
|
||
// parseFloat(endLatLng[0]) <= parseFloat(boundingbox[1]) &&
|
||
// parseFloat(endLatLng[1]) >= parseFloat(boundingbox[2]) &&
|
||
// parseFloat(endLatLng[1]) <= parseFloat(boundingbox[3])
|
||
) {
|
||
// console.log(startLatLng);
|
||
// console.log(endLatLng);
|
||
// console.log(boundingbox);
|
||
// ajax
|
||
let formData = new FormData();
|
||
|
||
let cities = {};
|
||
if ($("#town-id2").length) {
|
||
// console.log("We have three cities!");
|
||
cities[town1Val] = mosharekatTown1Val;
|
||
cities[town2Val] = mosharekatTown2Val;
|
||
cities[town3Val] = mosharekatTown3Val;
|
||
} else if ($("#town-id1").length) {
|
||
// console.log("We have 2 cities!");
|
||
cities[town1Val] = mosharekatTown1Val;
|
||
cities[town2Val] = mosharekatTown2Val;
|
||
} else {
|
||
// console.log("We have 1 city!");
|
||
cities[town1Val] = 100;
|
||
}
|
||
let contractDateMonth = contractDatePicker.getState().selected.month;
|
||
let contractDateDay = contractDatePicker.getState().selected.date;
|
||
let contractDateFormatted =
|
||
contractDatePicker.getState().selected.year +
|
||
"-" +
|
||
contractDateMonth +
|
||
"-" +
|
||
contractDateDay;
|
||
// console.log(
|
||
// " contractDatePicker.getState().selected",
|
||
// contractDatePicker
|
||
// );
|
||
// console.log("contractDateFormatted", contractDateFormatted);
|
||
// console.log(cities);
|
||
formData.append("province-id", provinceVal);
|
||
formData.append("cities-id", JSON.stringify(cities));
|
||
formData.append("axis-name", axisNameVal);
|
||
formData.append("axis-type", axisTypeVal);
|
||
formData.append("project-name", projectTitleVal);
|
||
formData.append("contractor-name", contractorNameVal);
|
||
formData.append("consultant-name", consultantNameVal);
|
||
// formData.append("contract-date", p2e(contractDateVal));
|
||
formData.append("contract-date", $("#yearshown").children("option:selected").val());
|
||
|
||
formData.append("contract-credit", contractPriceVal);
|
||
formData.append("start-latlng", startLatLng);
|
||
formData.append("end-latlng", endLatLng);
|
||
// for (var value of formData.values()) {
|
||
// console.log(value);
|
||
// }
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: url,
|
||
type: "POST",
|
||
data: formData,
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
// console.log(result);
|
||
ajaxcalltable();
|
||
// setTimeout(function () {
|
||
// location.reload();
|
||
// }, 2000);
|
||
hideLoaderScreen();
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "خطایی رخ داده است",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: ". لطفا در محدوده استان موقعیت را ثبت کنید ",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
}
|
||
} else {
|
||
// console.log(startLatLng);
|
||
// console.log(endLatLng);
|
||
// console.log(boundingbox);
|
||
// ajax
|
||
let formData = new FormData();
|
||
|
||
let cities = {};
|
||
if ($("#town-id2").length) {
|
||
// console.log("We have three cities!");
|
||
cities[town1Val] = mosharekatTown1Val;
|
||
cities[town2Val] = mosharekatTown2Val;
|
||
cities[town3Val] = mosharekatTown3Val;
|
||
} else if ($("#town-id1").length) {
|
||
// console.log("We have 2 cities!");
|
||
cities[town1Val] = mosharekatTown1Val;
|
||
cities[town2Val] = mosharekatTown2Val;
|
||
} else {
|
||
// console.log("We have 1 city!");
|
||
cities[town1Val] = 100;
|
||
}
|
||
let contractDateMonth = contractDatePicker.getState().selected.month;
|
||
let contractDateDay = contractDatePicker.getState().selected.date;
|
||
let contractDateFormatted =
|
||
contractDatePicker.getState().selected.year +
|
||
"-" +
|
||
contractDateMonth +
|
||
"-" +
|
||
contractDateDay;
|
||
// console.log(" contractDatePicker.getState().selected", contractDatePicker);
|
||
// console.log("contractDateFormatted", contractDateFormatted);
|
||
// console.log(cities);
|
||
formData.append("province-id", provinceVal);
|
||
formData.append("cities-id", JSON.stringify(cities));
|
||
formData.append("axis-name", axisNameVal);
|
||
formData.append("axis-type", axisTypeVal);
|
||
formData.append("project-name", projectTitleVal);
|
||
formData.append("contractor-name", contractorNameVal);
|
||
formData.append("consultant-name", consultantNameVal);
|
||
// formData.append("contract-date", p2e(contractDateVal));
|
||
formData.append("contract-date", $("#yearshown").children("option:selected").val());
|
||
formData.append("contract-credit", contractPriceVal);
|
||
formData.append("start-latlng", startLatLng);
|
||
formData.append("end-latlng", endLatLng);
|
||
// for (var value of formData.values()) {
|
||
// console.log(value);
|
||
// }
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: url,
|
||
type: "POST",
|
||
data: formData,
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
// console.log(result);
|
||
ajaxcalltable();
|
||
hideLoaderScreen();
|
||
// setTimeout(function () {
|
||
// location.reload();
|
||
// }, 2000);
|
||
},
|
||
error: function (error) {
|
||
// console.log(error);
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "خطایی رخ داده است",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
});
|
||
|
||
function ajaxcalltable() {
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/rahdari/road-technical-building/getlist",
|
||
type: "GET",
|
||
success: function (result) {
|
||
$("#example").dataTable().fnClearTable();
|
||
$("#example").dataTable().fnAddData(result.data);
|
||
|
||
hideLoaderScreen();
|
||
|
||
$("#stepModalmaintenance").modal("hide");
|
||
},
|
||
});
|
||
}
|
||
|
||
function onLocationChange() {
|
||
let lat, lng;
|
||
|
||
let provinceId = $("#province-id").children("option:selected").val();
|
||
let provinceIndex = provinces.findIndex(function (entry) {
|
||
return entry.id == provinceId;
|
||
});
|
||
|
||
if (provinceIndex != -1) {
|
||
lat = provinces[provinceIndex].center_lat;
|
||
lng = provinces[provinceIndex].center_long;
|
||
}
|
||
|
||
$.ajax({
|
||
url:
|
||
"https://testmap.141.ir/nominatim/reverse.php?format=json" +
|
||
"&lat=" +
|
||
lat +
|
||
"&lon=" +
|
||
lng +
|
||
"&accept-language=fa" +
|
||
"&zoom=5",
|
||
type: "GET",
|
||
success: function (result) {
|
||
boundingbox = result.boundingbox;
|
||
},
|
||
error: function (error) {
|
||
},
|
||
});
|
||
}
|
||
|
||
$("#province-id").on("change", function () {
|
||
if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
$("#province-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#province-id").removeClass("is-invalid-input");
|
||
|
||
onLocationChange();
|
||
}
|
||
});
|
||
|
||
$("#axis-name-id").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#axis-name-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis-name-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#axis-type-id").on("change", function () {
|
||
if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
$("#axis-type-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis-type-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
$("#yearshown").on("change", function () {
|
||
// if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
// $("#yearshown").addClass("is-invalid-input");
|
||
// } else {
|
||
$("#yearshown").removeClass("is-invalid-input");
|
||
// }
|
||
});
|
||
|
||
$("#project-title-id").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#project-title-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project-title-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#contractor-id").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#contractor-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contractor-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#consultant-id").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#consultant-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#consultant-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#contract-price-id").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#contract-price-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract-price-id").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
function restrictInputOtherThanArabic($field) {
|
||
// Arabic characters fall in the Unicode range 0600 - 06FF
|
||
var arabicCharUnicodeRange = /[\u0600-\u06FF-0-9-45]/;
|
||
|
||
$field.bind("keypress", function (event) {
|
||
var key = event.which;
|
||
// 0 = numpad
|
||
// 8 = backspace
|
||
// 32 = space
|
||
if (key == 8 || key == 0 || key === 32) {
|
||
return true;
|
||
}
|
||
|
||
var str = String.fromCharCode(key);
|
||
if (arabicCharUnicodeRange.test(str)) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
});
|
||
}
|
||
|
||
function addTownBox() {
|
||
let childNum = $("#subTown").children().length;
|
||
|
||
// console.log($("#town-id").val());
|
||
|
||
if (childNum == 1 && $("#town-id").val() != 0) {
|
||
$("#subTown div").append(
|
||
`
|
||
<div class="input-group mb-3">
|
||
<input type ="text" class="form-control" id="mosharekat1" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
</div>
|
||
`
|
||
);
|
||
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id${childNum}"
|
||
>
|
||
<option value="0" style="font-size:10px">انتخاب شهرستان</option>
|
||
</select>
|
||
<div class="input-group mb-3">
|
||
<input type ="text" class="form-control" id="mosharekat2" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
</div>
|
||
</div>`);
|
||
setTownSelect(childNum);
|
||
} else if (childNum == 2 && $("#town-id1").val() != 0) {
|
||
$("#subTown").append(`<div class="form-group col-md-4">
|
||
<label>
|
||
شهرستان
|
||
</label>
|
||
<select
|
||
class="form-control"
|
||
style="font-size:12px"
|
||
name="town"
|
||
id="town-id${childNum}"
|
||
>
|
||
<option value="0" style="font-size:10px">انتخاب شهرستان</option>
|
||
</select>
|
||
<div class="input-group mb-3">
|
||
<input type ="text" class="form-control" id="mosharekat3" min="1" max="100" data-inputmask="'mask': '99'" data-mask style="margin-top: 5px;" placeholder="درصد مشارکت"></input>
|
||
<div class="input-group-prepend p-0" style="margin-top:5px">
|
||
<span class="input-group-text" id="basic-addon2" style="padding:0px">%</span>
|
||
</div>
|
||
</div>
|
||
</div>`);
|
||
setTownSelect(childNum);
|
||
}
|
||
|
||
$("[data-mask]").inputmask();
|
||
|
||
$("#town-id1").on("change", function () {
|
||
if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
$("#town-id1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id1").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#town-id2").on("change", function () {
|
||
if (parseInt($(this).children("option:selected").val()) == 0) {
|
||
$("#town-id2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#town-id2").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#mosharekat1").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#mosharekat1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat1").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#mosharekat2").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#mosharekat2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat2").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
|
||
$("#mosharekat3").on("change", function () {
|
||
if ($(this).val() == "") {
|
||
$("#mosharekat3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#mosharekat3").removeClass("is-invalid-input");
|
||
}
|
||
});
|
||
}
|
||
|
||
function removeTownBox() {
|
||
let childNum = $("#subTown").children().length;
|
||
|
||
if (childNum == 3) {
|
||
$("#town-id2").parent().remove();
|
||
} else if (childNum == 2) {
|
||
$("#town-id1").parent().remove();
|
||
$("#subTown .input-group").remove();
|
||
}
|
||
}
|
||
//change hamine start
|
||
|
||
function checkMarkersAndDrawPath(update) {
|
||
if (
|
||
$("#pin-marker-start").hasClass("pin-set") &&
|
||
!$("#pin-marker-start").hasClass("pin-move") &&
|
||
$("#pin-marker-end").hasClass("pin-set") &&
|
||
!$("#pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawPath(update);
|
||
} else {
|
||
setTimeout(() => {
|
||
if (
|
||
$("#pin-marker-start").hasClass("pin-set") &&
|
||
!$("#pin-marker-start").hasClass("pin-move") &&
|
||
$("#pin-marker-end").hasClass("pin-set") &&
|
||
!$("#pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawPath(update);
|
||
} else {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapName = update ? map2 : map;
|
||
mapName.removeControl(control);
|
||
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
// if (polyline != null) {
|
||
// map.removeLayer(polyline);
|
||
// }
|
||
}
|
||
}, 20);
|
||
}
|
||
}
|
||
//change hamine end
|
||
function checkMarkersAndDrawPathshow() {
|
||
if (
|
||
$("#pin-marker-start").hasClass("pin-set") &&
|
||
!$("#pin-marker-start").hasClass("pin-move") &&
|
||
$("#pin-marker-end").hasClass("pin-set") &&
|
||
!$("#pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawPathshow();
|
||
} else {
|
||
setTimeout(() => {
|
||
if (
|
||
$("#pin-marker-start").hasClass("pin-set") &&
|
||
!$("#pin-marker-start").hasClass("pin-move") &&
|
||
$("#pin-marker-end").hasClass("pin-set") &&
|
||
!$("#pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawPathshow();
|
||
} else {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapshow.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
// if (polyline != null) {
|
||
// map.removeLayer(polyline);
|
||
// }
|
||
}
|
||
}, 20);
|
||
}
|
||
}
|
||
//change hamine start
|
||
function removeStartToEndPath(update) {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapName = update ? map2 : map;
|
||
|
||
mapName.removeControl(control);
|
||
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
}
|
||
//change hamine end
|
||
|
||
// function drawStartToEndPath(pathType, source, dest) {
|
||
// if (routeControlsPath.length) {
|
||
// $(routeControlsPath).each(function (index, control) {
|
||
// map.removeControl(control);
|
||
// routeControlsPath.splice(routeControlsPath.indexOf(index), 1);
|
||
// });
|
||
// }
|
||
// if (polylinePath != null) {
|
||
// map.removeLayer(polylinePath);
|
||
// }
|
||
// switch (pathType) {
|
||
// case "line": {
|
||
// polylinePath = L.polyline(
|
||
// [
|
||
// [source[0], source[1]],
|
||
// [dest[0], dest[1]],
|
||
// ],
|
||
// {
|
||
// color: "#0073e6",
|
||
// opacity: 0.6,
|
||
// weight: 5,
|
||
// }
|
||
// ).addTo(map);
|
||
// break;
|
||
// }
|
||
// case "axis": {
|
||
// $.get(
|
||
// `https://testmap.141.ir/route/v1/driving/${source[1]},${source[0]};${dest[1]},${dest[0]}?overview=false&alternatives=true&steps=true`,
|
||
// function (data) {
|
||
// routeControlsPath.push(
|
||
// L.Routing.control({
|
||
// waypoints: [
|
||
// L.latLng(parseFloat(source[0]), parseFloat(source[1])),
|
||
// L.latLng(parseFloat(dest[0]), parseFloat(dest[1])),
|
||
// ],
|
||
// fitSelectedRoutes: false,
|
||
// draggableWaypoints: true,
|
||
// createMarker: function () {
|
||
// return null;
|
||
// },
|
||
// lineOptions: {
|
||
// addWaypoints: false,
|
||
// styles: [
|
||
// {
|
||
// color: "#0073e6",
|
||
// opacity: 0.6,
|
||
// weight: 5,
|
||
// },
|
||
// ],
|
||
// },
|
||
// })
|
||
// .on("routesfound", function (e) {
|
||
// for (let index = 0; index < popupArraysPath.length; index++) {
|
||
// if (popupArraysPath[index] !== null) {
|
||
// map.removeLayer(popupArraysPath[index]);
|
||
// }
|
||
// }
|
||
|
||
// /*let popup = new L.Popup({
|
||
// 'maxWidth': '300',
|
||
// 'maxHeight': '150',
|
||
// 'className': 'customRouteEstimate'
|
||
// });
|
||
|
||
// let popupLocation = new L.LatLng(e.routes[0].coordinates[parseInt(e.routes[0]
|
||
// .coordinates
|
||
// .length /
|
||
// 2)].lat,
|
||
// e.routes[0].coordinates[parseInt(e.routes[0].coordinates.length / 2)]
|
||
// .lng);
|
||
// let popupContent = "<span style=\"color:#FF5630 ; font-size:11px\">مسافت : </span>" + parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2) + " کیلومتر";
|
||
// popup.setLatLng(popupLocation);
|
||
// popup.setContent(popupContent);
|
||
// popupArraysPath.push(popup);
|
||
// map.addLayer(popup);*/
|
||
// })
|
||
// .addTo(map)
|
||
// );
|
||
// }
|
||
// );
|
||
|
||
// $(".leaflet-control-container").css("display", "none");
|
||
// $(".leaflet-routing-container-hide").css("display", "none");
|
||
// break;
|
||
// }
|
||
// }
|
||
// }
|
||
//change hamine start
|
||
|
||
function drawPath(update) {
|
||
mapName = update ? map2 : map;
|
||
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapName.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
|
||
// routeControls.push(
|
||
// L.polyline(
|
||
// [
|
||
// L.latLng(
|
||
// parseFloat(startAbrarMarker.getLatLng().lat),
|
||
// parseFloat(startAbrarMarker.getLatLng().lng)
|
||
// ),
|
||
// L.latLng(
|
||
// parseFloat(endAbrarMarker.getLatLng().lat),
|
||
// parseFloat(endAbrarMarker.getLatLng().lng)
|
||
// ),
|
||
// ],
|
||
// {
|
||
// color: "blue",
|
||
// weight: 3,
|
||
// opacity: 0.5,
|
||
// smoothFactor: 1,
|
||
// }
|
||
// )
|
||
// );
|
||
|
||
// map.addLayer(routeControls[0]);
|
||
|
||
routeControls.push(
|
||
L.Routing.control({
|
||
waypoints: [
|
||
L.latLng(
|
||
parseFloat(startAbrarMarker.getLatLng().lat),
|
||
parseFloat(startAbrarMarker.getLatLng().lng)
|
||
),
|
||
L.latLng(
|
||
parseFloat(endAbrarMarker.getLatLng().lat),
|
||
parseFloat(endAbrarMarker.getLatLng().lng)
|
||
),
|
||
],
|
||
fitSelectedRoutes: false,
|
||
draggableWaypoints: true,
|
||
createMarker: function () {
|
||
return null;
|
||
},
|
||
lineOptions: {
|
||
addWaypoints: false,
|
||
styles: [
|
||
{
|
||
color: "#28a745",
|
||
opacity: 0.8,
|
||
weight: 5,
|
||
},
|
||
],
|
||
},
|
||
})
|
||
// .on("routesfound", function (e) {
|
||
// var divideBy = 2;
|
||
|
||
// for (let index = 0; index < popupArrays.length; index++) {
|
||
// map.removeLayer(popupArrays[index]);
|
||
// }
|
||
|
||
// var customOptions = {
|
||
// maxWidth: "300",
|
||
// maxHeight: "150",
|
||
// className: "customRouteEstimate",
|
||
// };
|
||
// var popup = new L.Popup(customOptions);
|
||
|
||
// var popupLocation = new L.LatLng(
|
||
// e.routes[0].coordinates[
|
||
// parseInt(e.routes[0].coordinates.length / divideBy)
|
||
// ].lat,
|
||
// e.routes[0].coordinates[
|
||
// parseInt(e.routes[0].coordinates.length / divideBy)
|
||
// ].lng
|
||
// );
|
||
|
||
// var popupContent =
|
||
// '<span style="color:#FF5630; font-size:11px; font-family: IRANSansFaNum;">مسافت: </span>' +
|
||
// parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2) +
|
||
// " کیلومتر";
|
||
|
||
// saveTotalDistance = parseFloat(
|
||
// parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2)
|
||
// );
|
||
|
||
// popup.setLatLng(popupLocation);
|
||
// popup.setContent(popupContent);
|
||
|
||
// popupArrays.push(popup);
|
||
// map.addLayer(popup);
|
||
|
||
// // showItemSelectionModal();
|
||
// })
|
||
.addTo(mapName)
|
||
);
|
||
$(".leaflet-control-container").css("display", "none");
|
||
$(".leaflet-routing-container-hide").css("display", "none");
|
||
}
|
||
//change hamine end
|
||
function drawPathshow() {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapshow.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
|
||
// routeControls.push(
|
||
// L.polyline(
|
||
// [
|
||
// L.latLng(
|
||
// parseFloat(startAbrarMarker.getLatLng().lat),
|
||
// parseFloat(startAbrarMarker.getLatLng().lng)
|
||
// ),
|
||
// L.latLng(
|
||
// parseFloat(endAbrarMarker.getLatLng().lat),
|
||
// parseFloat(endAbrarMarker.getLatLng().lng)
|
||
// ),
|
||
// ],
|
||
// {
|
||
// color: "blue",
|
||
// weight: 3,
|
||
// opacity: 0.5,
|
||
// smoothFactor: 1,
|
||
// }
|
||
// )
|
||
// );
|
||
|
||
// map.addLayer(routeControls[0]);
|
||
|
||
routeControls.push(
|
||
L.Routing.control({
|
||
waypoints: [
|
||
L.latLng(
|
||
parseFloat(startAbrarMarkershow.getLatLng().lat),
|
||
parseFloat(startAbrarMarkershow.getLatLng().lng)
|
||
),
|
||
L.latLng(
|
||
parseFloat(endAbrarMarkershow.getLatLng().lat),
|
||
parseFloat(endAbrarMarkershow.getLatLng().lng)
|
||
),
|
||
],
|
||
fitSelectedRoutes: false,
|
||
draggableWaypoints: true,
|
||
createMarker: function () {
|
||
return null;
|
||
},
|
||
lineOptions: {
|
||
addWaypoints: false,
|
||
styles: [
|
||
{
|
||
color: "#28a745",
|
||
opacity: 0.8,
|
||
weight: 5,
|
||
},
|
||
],
|
||
},
|
||
})
|
||
// .on("routesfound", function (e) {
|
||
// var divideBy = 2;
|
||
|
||
// for (let index = 0; index < popupArrays.length; index++) {
|
||
// map.removeLayer(popupArrays[index]);
|
||
// }
|
||
|
||
// var customOptions = {
|
||
// maxWidth: "300",
|
||
// maxHeight: "150",
|
||
// className: "customRouteEstimate",
|
||
// };
|
||
// var popup = new L.Popup(customOptions);
|
||
|
||
// var popupLocation = new L.LatLng(
|
||
// e.routes[0].coordinates[
|
||
// parseInt(e.routes[0].coordinates.length / divideBy)
|
||
// ].lat,
|
||
// e.routes[0].coordinates[
|
||
// parseInt(e.routes[0].coordinates.length / divideBy)
|
||
// ].lng
|
||
// );
|
||
|
||
// var popupContent =
|
||
// '<span style="color:#FF5630; font-size:11px; font-family: IRANSansFaNum;">مسافت: </span>' +
|
||
// parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2) +
|
||
// " کیلومتر";
|
||
|
||
// saveTotalDistance = parseFloat(
|
||
// parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2)
|
||
// );
|
||
|
||
// popup.setLatLng(popupLocation);
|
||
// popup.setContent(popupContent);
|
||
|
||
// popupArrays.push(popup);
|
||
// map.addLayer(popup);
|
||
|
||
// // showItemSelectionModal();
|
||
// })
|
||
.addTo(mapshow)
|
||
);
|
||
$(".leaflet-control-container").css("display", "none");
|
||
$(".leaflet-routing-container-hide").css("display", "none");
|
||
}
|
||
|
||
$("#rejectoolfinal").on("click", function () {
|
||
$("#show-projecttool").modal("hide");
|
||
});
|
||
|
||
$("#example").on("click", "button.update-button", function () {
|
||
$("#tool-main").css("display", "none");
|
||
$("#tool-main").css("display", "none");
|
||
$("#update-table").css("display", "block");
|
||
scrolldowntable();
|
||
$("#title-update").empty();
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
// console.log(row.data().id);
|
||
idkol = row.data().id;
|
||
var projecttitle = row.data().project_name;
|
||
var axisname = row.data().axis_name;
|
||
var ostan = row.data().province_fa;
|
||
// change hamine start
|
||
startLatlng = row.data().start_latlng;
|
||
endLatlng = row.data().end_latlng;
|
||
// change hamine end
|
||
var titleupdate =
|
||
"بروزرسانی آخرین وضعیت پروژه" +
|
||
" " +
|
||
projecttitle +
|
||
" " +
|
||
"محور" +
|
||
" " +
|
||
axisname +
|
||
" " +
|
||
"استان" +
|
||
" " +
|
||
ostan;
|
||
var note = '<h3 class="card-title" >' + titleupdate + "</h3> ";
|
||
$("#title-update").append(note);
|
||
showLoaderScreen();
|
||
tablethird = $("#example-update").DataTable({
|
||
// dom: "lfrtip",
|
||
dom: "<fl<t>p>",
|
||
scrollX: true,
|
||
destroy: true,
|
||
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, "desc"]],
|
||
processing: true,
|
||
ajax: {
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
idkol +
|
||
"/get-distance-update-list",
|
||
type: "GET",
|
||
dataSrc: function (json) {
|
||
console.log(json);
|
||
tooltipjson = json.data.distance;
|
||
if (json.data.distance_update.length) {
|
||
projectDistanceLastUpdate =
|
||
json.data.distance_update[json.data.distance_update.length - 1];
|
||
projectDistanceLastUpdatestatus =
|
||
projectDistanceLastUpdate.previous_status;
|
||
|
||
if (projectDistanceLastUpdatestatus == 0) {
|
||
$("#add-project-update").attr("disabled", true);
|
||
} else {
|
||
$("#add-project-update").attr("disabled", false);
|
||
}
|
||
|
||
console.log(
|
||
"projectDistanceLastUpdate",
|
||
projectDistanceLastUpdate.previous_status
|
||
);
|
||
} else {
|
||
projectDistanceLastUpdate = null;
|
||
projectDefaultDistances = json.data.distance;
|
||
}
|
||
hideLoaderScreen();
|
||
return json.data.distance_update;
|
||
},
|
||
},
|
||
columns: [
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, meta) {
|
||
return meta.row + 1;
|
||
},
|
||
},
|
||
{ data: "updated_at" },
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
// console.log("data", data[Object.keys(data)[1]][0])
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 1;
|
||
});
|
||
console.log("keyIndex", keyIndex);
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
console.log(Object.keys(data)[keyIndex]);
|
||
console.log(data[Object.keys(data)[keyIndex]][0]);
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 2;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 3;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 4;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 5;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 6;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_distance_update",
|
||
render: function (data, type, row, column) {
|
||
let keyIndex = Object.keys(data).findIndex(function (entry) {
|
||
return entry == 7;
|
||
});
|
||
if (keyIndex == -1) {
|
||
return "-";
|
||
} else {
|
||
return data[Object.keys(data)[keyIndex]][0];
|
||
}
|
||
},
|
||
},
|
||
{
|
||
data: "previous_project_status",
|
||
render: function (data, type, row) {
|
||
if (data == 1) {
|
||
return " در دست برنامه ریزی اولیه";
|
||
} else if (data == 2) {
|
||
return " در دست مطالعه و تهیه اسناد مناقصه";
|
||
} else if (data == 3) {
|
||
return "در دست مناقصه";
|
||
} else if (data == 4) {
|
||
return "در حال تجهیز کارگاه";
|
||
} else if (data == 5) {
|
||
return " در حال اجرا/فعال";
|
||
} else if (data == 6) {
|
||
return "در حال اجرا/متوقف ";
|
||
} else if (data == 7) {
|
||
return " در حال آماده سازی برای افتتاح";
|
||
} else if (data == 8) {
|
||
return " تکمیل و خاتمه یافته و بهره برداری شده";
|
||
} else return "توسط استان بروز رسانی نشده است";
|
||
},
|
||
},
|
||
|
||
{
|
||
data: null,
|
||
render: function (data, type, row, meta) {
|
||
let buttons = "";
|
||
buttons = ``;
|
||
buttons =
|
||
`
|
||
<div style="display: flex; flex-direction: row;">
|
||
<button type="button" class="btn-dataTable just-padding" style="margin-left: 5px;" onclick="showMapModalStatic(` +
|
||
data.previous_team_latlng +
|
||
`)" ><img src="../dist/images/new-design/iranMiniGreen.svg" /></button>
|
||
<div class="line-btn-table"></div>
|
||
<button class="btn-dataTable upload-image-button" title="آپلود عکس" style="margin-right: 5px;" ><i class="fa fa-images"></i></button>
|
||
</div>
|
||
`;
|
||
|
||
return buttons;
|
||
},
|
||
},
|
||
],
|
||
});
|
||
});
|
||
$("#image-upload-modal").on("click", "button.submit-update", function () {
|
||
console.log("history", historyId);
|
||
|
||
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-technical-building/" +
|
||
historyId +
|
||
"/submit-history",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
location.reload();
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen();
|
||
alert("خطا :(");
|
||
},
|
||
});
|
||
},
|
||
});
|
||
});
|
||
$("#example-update").on("click", "button.upload-image-button", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = tablethird.row(tr);
|
||
var updateDate = row.data().updated_at;
|
||
// var images = row.data().images
|
||
|
||
if (updateDate == "-") {
|
||
console.log("this situation 1");
|
||
prepareImageModal();
|
||
historyId = row.data().id;
|
||
|
||
$("#image-upload-modal").modal({
|
||
backdrop: "static",
|
||
keyboard: false,
|
||
});
|
||
$("#image-upload-modal").modal("show");
|
||
} else {
|
||
console.log("this situation 2");
|
||
openSlidershowbutton(row, 0);
|
||
}
|
||
});
|
||
$("#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-technical-building/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);
|
||
hideLoaderScreen();
|
||
},
|
||
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-technical-building/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) {
|
||
//change hamine start
|
||
ajaxcalltablethird3(idkol);
|
||
$("#deleteIcon" + index).css("display", "block");
|
||
//change hamine end
|
||
},
|
||
error: function (error) {
|
||
console.log(error);
|
||
hideLoaderScreen();
|
||
// alert("خطا در آپلود تصویر :(");
|
||
},
|
||
});
|
||
}
|
||
|
||
$("#add-project-update").on("click", function () {
|
||
console.log("projectDistanceLastUpdate", projectDistanceLastUpdate);
|
||
$("#stop-reason-text-div").css("display", "none");
|
||
$("#pin-marker-progress").removeClass("pin-warn pin-set");
|
||
|
||
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("درصد پیشرفت فیزیکی");
|
||
$("#alertshowprogress5").css("color", "black");
|
||
$("#alertshowprogress5").empty();
|
||
$("#alertshowprogress5").append("درصد پیشرفت فیزیکی");
|
||
$("#alertshowprogress6").css("color", "black");
|
||
$("#alertshowprogress6").empty();
|
||
$("#alertshowprogress6").append("درصد پیشرفت فیزیکی");
|
||
$("#alertshowprogress7").css("color", "black");
|
||
$("#alertshowprogress7").empty();
|
||
$("#alertshowprogress7").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);
|
||
|
||
edit = true;
|
||
if (map2 == null) {
|
||
console.log("my name is 11111111");
|
||
setTimeout(() => {
|
||
createLeafletMap(startLatlng, endLatlng, 1);
|
||
}, 200);
|
||
} else {
|
||
console.log("my name is 222222222");
|
||
initialMarkerMapValueEdit(startLatlng, endLatlng, 1);
|
||
}
|
||
|
||
console.log("this is me ", projectDefaultDistances);
|
||
|
||
if (projectDistanceLastUpdate != null) {
|
||
for (let index = 1; index <= 7; index++) {
|
||
let distanceIndex = Object.keys(
|
||
projectDistanceLastUpdate.previous_project_distance_update
|
||
).findIndex(function (entry) {
|
||
return entry == index;
|
||
});
|
||
console.log("distanceIndexdistanceIndex", distanceIndex)
|
||
// 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;
|
||
}
|
||
case 5: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
min5 =
|
||
projectDistanceLastUpdate.previous_project_distance_update[
|
||
Object.keys(
|
||
projectDistanceLastUpdate.previous_project_distance_update
|
||
)[distanceIndex]
|
||
][0];
|
||
projectProgressPercentage5 = $(
|
||
"#project-progress-percentage5"
|
||
).slider({
|
||
min: 0,
|
||
max: 100,
|
||
value: min5,
|
||
ticks: [0, 100],
|
||
ticks_snap_bounds: 1,
|
||
formatter: function (value) {
|
||
return value + "٪";
|
||
},
|
||
// tooltip: "always",
|
||
tooltip_position: "bottom",
|
||
});
|
||
break;
|
||
}
|
||
case 6: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
min6 =
|
||
projectDistanceLastUpdate.previous_project_distance_update[
|
||
Object.keys(
|
||
projectDistanceLastUpdate.previous_project_distance_update
|
||
)[distanceIndex]
|
||
][0];
|
||
projectProgressPercentage6 = $(
|
||
"#project-progress-percentage6"
|
||
).slider({
|
||
min: 0,
|
||
max: 100,
|
||
value: min6,
|
||
ticks: [0, 100],
|
||
ticks_snap_bounds: 1,
|
||
formatter: function (value) {
|
||
return value + "٪";
|
||
},
|
||
// tooltip: "always",
|
||
tooltip_position: "bottom",
|
||
});
|
||
break;
|
||
}
|
||
case 7: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
min7 =
|
||
projectDistanceLastUpdate.previous_project_distance_update[
|
||
Object.keys(
|
||
projectDistanceLastUpdate.previous_project_distance_update
|
||
)[distanceIndex]
|
||
][0];
|
||
projectProgressPercentage7 = $(
|
||
"#project-progress-percentage7"
|
||
).slider({
|
||
min: 0,
|
||
max: 100,
|
||
value: min7,
|
||
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 <= 7; 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;
|
||
}
|
||
case 5: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
projectProgressPercentage5 = $(
|
||
"#project-progress-percentage5"
|
||
).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 6: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
projectProgressPercentage6 = $(
|
||
"#project-progress-percentage6"
|
||
).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 7: {
|
||
$("#item" + index).show();
|
||
$("#item" + index + "-data").show();
|
||
projectProgressPercentage7 = $(
|
||
"#project-progress-percentage7"
|
||
).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;
|
||
}
|
||
}
|
||
$("#project_last_status").val(0);
|
||
// $("#contractor-fee").attr('max' , //todo yasi );
|
||
// console.log(
|
||
// projectDistanceLastUpdate[
|
||
// Object.keys(projectDistanceLastUpdate)[distanceIndex]
|
||
// ]
|
||
// );
|
||
}
|
||
}
|
||
}
|
||
if (projectDistanceLastUpdate != null) {
|
||
if (projectDistanceLastUpdate.previous_project_status == 6) {
|
||
$("#stop-reason-text-div").css("display", "block");
|
||
$("#stop-reason-text").val(
|
||
projectDistanceLastUpdate.previous_stop_reason
|
||
);
|
||
}
|
||
}
|
||
|
||
restrictInputOtherThanArabic($("#stop-reason-text"));
|
||
|
||
$("#project_last_status").on("change", function () {
|
||
if ($("#project_last_status").val() == 6) {
|
||
$("#stop-reason-text-div").css("display", "");
|
||
} else {
|
||
$("#stop-reason-text-div").css("display", "none");
|
||
}
|
||
});
|
||
$("#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, min5, min6);
|
||
// var minval = projectDistanceLastUpdate.previous_physical_progress
|
||
if ($("#item1").css("display") != "none") {
|
||
console.log("1")
|
||
console.log("min1", min1, projectProgressPercentage1.slider("getValue"))
|
||
if (projectProgressPercentage1.slider("getValue") < min1) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min1 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress1").empty();
|
||
$("#alertshowprogress1").append(data);
|
||
// $("#alertshowprogress1").append(data)
|
||
$("#alertshowprogress1").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
|
||
if ($("#item2").css("display") != "none") {
|
||
console.log("2")
|
||
console.log("min2", min2, projectProgressPercentage2.slider("getValue"))
|
||
|
||
if (projectProgressPercentage2.slider("getValue") < min2) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min2 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress2").append(data);
|
||
// $("#alertshowprogress2").append(data)
|
||
$("#alertshowprogress2").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item3").css("display") != "none") {
|
||
console.log("3")
|
||
console.log("min3", min3, projectProgressPercentage3.slider("getValue"))
|
||
|
||
if (projectProgressPercentage3.slider("getValue") < min3) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min3 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress3").empty();
|
||
$("#alertshowprogress3").append(data);
|
||
$("#alertshowprogress3").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item4").css("display") != "none") {
|
||
console.log("4")
|
||
console.log("min4", min4, projectProgressPercentage4.slider("getValue"))
|
||
|
||
if (projectProgressPercentage4.slider("getValue") < min4) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min4 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress4").empty();
|
||
$("#alertshowprogress4").append(data);
|
||
$("#alertshowprogress4").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item5").css("display") != "none") {
|
||
console.log("5")
|
||
console.log("min5", min5, projectProgressPercentage5.slider("getValue"))
|
||
|
||
if (projectProgressPercentage5.slider("getValue") < min5) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min5 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress5").empty();
|
||
$("#alertshowprogress5").append(data);
|
||
$("#alertshowprogress5").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item6").css("display") != "none") {
|
||
console.log("6")
|
||
console.log("min6", min6, projectProgressPercentage6.slider("getValue"))
|
||
|
||
if (projectProgressPercentage6.slider("getValue") < min6) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min6 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress6").empty();
|
||
$("#alertshowprogress6").append(data);
|
||
$("#alertshowprogress6").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item7").css("display") != "none") {
|
||
console.log("7")
|
||
console.log("min7", min7, projectProgressPercentage7.slider("getValue"))
|
||
|
||
if (projectProgressPercentage7.slider("getValue") < min7) {
|
||
var data =
|
||
'<small id="alertshow" style=";color: red;margin-right: 9px;"> درصد نمیتواند از ' +
|
||
min7 +
|
||
" کمتر باشد </small>";
|
||
$("#alertshowprogress7").empty();
|
||
$("#alertshowprogress7").append(data);
|
||
$("#alertshowprogress7").css("color", "red");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
// change hamine start
|
||
if (
|
||
$("#project_last_status").val() == 6 &&
|
||
$("#stop-reason-text").val().length == 0
|
||
) {
|
||
console.log("happend");
|
||
$("#stop-reason-text").addClass("is-invalid");
|
||
testflag = 1;
|
||
} else {
|
||
$("#stop-reason-text").removeClass("is-invalid");
|
||
}
|
||
// change hamine end
|
||
|
||
if ($("#project_last_status").val() == 0) {
|
||
$("#project_last_status").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if ($("#item1").css("display") != "none") {
|
||
var data = $("#project-distance-input-1-1").val();
|
||
var datamax = max1;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo1").css("display", "block");
|
||
$("#project-distance-input-1-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min1)) {
|
||
$("#kilomin1").css("display", "block");
|
||
$("#project-distance-input-1-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item2").css("display") != "none") {
|
||
var data = $("#project-distance-input-2-1").val();
|
||
var datamax = max2;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo2").css("display", "block");
|
||
$("#project-distance-input-2-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min2)) {
|
||
$("#kilomin2").css("display", "block");
|
||
$("#project-distance-input-2-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item3").css("display") != "none") {
|
||
var data = $("#project-distance-input-3-1").val();
|
||
var datamax = max3;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo3").css("display", "block");
|
||
$("#project-distance-input-3-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min3)) {
|
||
$("#kilomin3").css("display", "block");
|
||
$("#project-distance-input-3-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item4").css("display") != "none") {
|
||
var data = $("#project-distance-input-4-1").val();
|
||
var datamax = max4;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo4").css("display", "block");
|
||
$("#project-distance-input-4-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min4)) {
|
||
$("#kilomin4").css("display", "block");
|
||
$("#project-distance-input-4-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item5").css("display") != "none") {
|
||
var data = $("#project-distance-input-5-1").val();
|
||
var datamax = max5;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo5").css("display", "block");
|
||
$("#project-distance-input-5-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min5)) {
|
||
$("#kilomin5").css("display", "block");
|
||
$("#project-distance-input-5-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item6").css("display") != "none") {
|
||
var data = $("#project-distance-input-6-1").val();
|
||
var datamax = max6;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo6").css("display", "block");
|
||
$("#project-distance-input-6-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min6)) {
|
||
$("#kilomin6").css("display", "block");
|
||
$("#project-distance-input-6-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item7").css("display") != "none") {
|
||
var data = $("#project-distance-input-7-1").val();
|
||
var datamax = max7;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo7").css("display", "block");
|
||
$("#project-distance-input-7-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min7)) {
|
||
$("#kilomin7").css("display", "block");
|
||
$("#project-distance-input-7-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
if ($("#item8").css("display") != "none") {
|
||
var data = $("#project-distance-input-8-1").val();
|
||
var datamax = max8;
|
||
if (parseInt(data) > parseInt(datamax)) {
|
||
$("#kilo8").css("display", "block");
|
||
$("#project-distance-input-8-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
if (parseInt(data) < parseInt(min5)) {
|
||
$("#kilomin8").css("display", "block");
|
||
$("#project-distance-input-8-1").addClass("is-invalid");
|
||
testflag = 1;
|
||
}
|
||
}
|
||
|
||
for (let index = 1; index <= 9; 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(" تعمیر یا احداث دیوار حائل ");
|
||
} else if (index == 5) {
|
||
project_distance_update[index] = [];
|
||
|
||
project_distance_update[index].push(
|
||
projectProgressPercentage5.slider("getValue").toString()
|
||
);
|
||
project_distance_update[index].push(" احداث پل جدید ");
|
||
} else if (index == 6) {
|
||
project_distance_update[index] = [];
|
||
|
||
project_distance_update[index].push(
|
||
projectProgressPercentage6.slider("getValue").toString()
|
||
);
|
||
project_distance_update[index].push(" احداث کنارگذر پل / تونل");
|
||
} else if (index == 7) {
|
||
project_distance_update[index] = [];
|
||
|
||
project_distance_update[index].push(
|
||
projectProgressPercentage7.slider("getValue").toString()
|
||
);
|
||
project_distance_update[index].push("سایر ");
|
||
}
|
||
}
|
||
}
|
||
console.log("pitikoo", JSON.stringify(project_distance_update));
|
||
//change hamine start
|
||
if (isSetprogressAbrarMarker) {
|
||
progressLatlng = [
|
||
progressAbrarMarker.getLatLng().lat.toFixed(6),
|
||
progressAbrarMarker.getLatLng().lng.toFixed(6),
|
||
];
|
||
} else {
|
||
$("#pin-marker-progress").addClass("pin-warn");
|
||
testflag = 1;
|
||
}
|
||
//change hamine end
|
||
|
||
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()
|
||
);
|
||
|
||
//change hamine start
|
||
formData.append("team-latlng", progressLatlng);
|
||
if ($("#project_last_status").val() == 6) {
|
||
formData.append("stop-reason", $("#stop-reason-text").val());
|
||
}
|
||
//change hamine end
|
||
|
||
for (var value of formData.values()) {
|
||
console.log(value);
|
||
}
|
||
showLoaderScreen();
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
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) {
|
||
//change hamine start
|
||
$("#project-update-modal").modal("hide");
|
||
hideLoaderScreen();
|
||
prepareImageModal();
|
||
historyId = result.history_id;
|
||
$("#image-upload-modal").modal({
|
||
backdrop: "static",
|
||
keyboard: false,
|
||
});
|
||
$("#image-upload-modal").modal("show");
|
||
|
||
//change hamine end
|
||
// 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 =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
"1" +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 1 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-2")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 2 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-3")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 3 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-4")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 4 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-5")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 5 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-6")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 6 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-7")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 7 + ')"></span>'
|
||
);
|
||
}
|
||
if (sliderImages[index].path.includes("image-8")) {
|
||
let divSlide =
|
||
'<div class="mySlides"><div class="numbertext">' +
|
||
(index + 1) +
|
||
" / " +
|
||
sliderImages.length +
|
||
'</div><img src="https://rms.rmto.ir/' +
|
||
sliderImages[index].path.replace("public", "storage") +
|
||
'"><div class="textt"> تصویر ' +
|
||
(index + 1) +
|
||
":" +
|
||
" " +
|
||
"تاریخ :" +
|
||
updated_at +
|
||
"</div></div>";
|
||
$("#slideshow-slide").append(divSlide);
|
||
$("#slideshow-dot").append(
|
||
'<span class="dot" onclick="currentphotoshow(' + 8 + ')"></span>'
|
||
);
|
||
}
|
||
}
|
||
|
||
if (dataLength > 0) {
|
||
slideindex = 1;
|
||
layerslidershow(slideindex);
|
||
$("#slideroverlay").css("display", "block");
|
||
}
|
||
}
|
||
|
||
// change hamine start
|
||
|
||
// function openSlidershowbutton(tr) {
|
||
// let row = table.row(tr);
|
||
// sliderImages = row.data().images;
|
||
// let updated_at = row.data().last_history.last_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++) {
|
||
// console.log( "indexxx",index+1)
|
||
// var test=index+1
|
||
// let divSlide =
|
||
// '<div class="mySlides"><div class="numbertext">' +
|
||
// (index + 1) +
|
||
// " / " +
|
||
// sliderImages.length +
|
||
// '</div><img src=' + sliderImages[index] +'><div class="textt"> تصویر ' +
|
||
// test +
|
||
// ":" +
|
||
// " " +
|
||
// "تاریخ :" +
|
||
// updated_at +
|
||
// "</div></div>";
|
||
// $("#slideshow-slide").append(divSlide);
|
||
// $("#slideshow-dot").append(
|
||
// '<span class="dot" onclick="currentphotoshow(' + test + ')"></span>'
|
||
// );
|
||
|
||
// // if (sliderImages[index].path.includes("image-2")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 2 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-3")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 3 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-4")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 4 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-5")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 5 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-6")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 6 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-7")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 7 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// // if (sliderImages[index].path.includes("image-8")) {
|
||
// // let divSlide =
|
||
// // '<div class="mySlides"><div class="numbertext">' +
|
||
// // (index + 1) +
|
||
// // " / " +
|
||
// // sliderImages.length +
|
||
// // '</div><img src="https://rms.rmto.ir/' +
|
||
// // sliderImages[index].path.replace("public", "storage") +
|
||
// // '"><div class="textt"> تصویر ' +
|
||
// // (index + 1) +
|
||
// // ":" +
|
||
// // " " +
|
||
// // "تاریخ :" +
|
||
// // updated_at +
|
||
// // "</div></div>";
|
||
// // $("#slideshow-slide").append(divSlide);
|
||
// // $("#slideshow-dot").append(
|
||
// // '<span class="dot" onclick="currentphotoshow(' + 8 + ')"></span>'
|
||
// // );
|
||
// // }
|
||
// }
|
||
|
||
// if (dataLength > 0) {
|
||
// slideindex = 1;
|
||
// layerslidershow(slideindex);
|
||
// $("#slideroverlay").css("display", "block");
|
||
// }
|
||
// }
|
||
|
||
//change hamine end
|
||
|
||
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) {
|
||
console.log("pitkiooiiiiii", slideIndex);
|
||
layerslidershow((slideIndexlayer = slideIndex));
|
||
}
|
||
|
||
function ajaxcalltablesec(idkol) {
|
||
console.log("hi");
|
||
$.ajax({
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/" +
|
||
idkol +
|
||
// "/get-distance",
|
||
"/get-distance-update-list",
|
||
type: "GET",
|
||
success: function (result) {
|
||
// console.log(result.data[0]);
|
||
$("#example-tool").dataTable().fnClearTable();
|
||
$("#example-tool").dataTable().fnAddData(result.data);
|
||
// ajaxcalltablefirst();
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "success",
|
||
title: "با موفقیت بروزرسانی شد",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
function ajaxcalltablefirst() {
|
||
$.ajax({
|
||
// url: "https://rms.rmto.ir/rahdari/road-technical-building/getlist",
|
||
url:
|
||
"https://rms.rmto.ir/rahdari/road-technical-building/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-technical-building/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-technical-building/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-technical-building/" +
|
||
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-technical-building/" +
|
||
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-technical-building");
|
||
} 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-technical-building");
|
||
} 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");
|
||
}
|
||
}
|
||
|
||
// change hamine start
|
||
function showMapModalStatic(lat, lng) {
|
||
$("#exampleModalCenterStatic").modal("show");
|
||
if (staticMap == null) {
|
||
setTimeout(() => {
|
||
createLeafletMapStatic();
|
||
setNewView(lat, lng);
|
||
}, 500);
|
||
} else {
|
||
setNewView(lat, lng);
|
||
}
|
||
}
|
||
function createLeafletMapStatic() {
|
||
let bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
staticMap = new L.map("abrar-map-static", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([32.4279, 53.688], 9);
|
||
staticMap.dragging.disable();
|
||
L.tileLayer("https://testmap.141.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
staticMap
|
||
);
|
||
ekipAbrarMarkerJustShow = new L.marker(L.latLng(staticMap.getCenter()), {
|
||
icon: progressAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
// if(startLatlng){
|
||
startAbrarMarkerJustShow = new L.marker(startLatlng, {
|
||
icon: startAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
// }
|
||
|
||
if (endLatlng[0] != "NaN") {
|
||
endAbrarMarkerJustShow = new L.marker(endLatlng, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
}
|
||
}
|
||
function setNewView(lat, lng) {
|
||
staticMap.setView(new L.LatLng(lat, lng), 9);
|
||
if (ekipAbrarMarkerJustShow == null) {
|
||
ekipAbrarMarkerJustShow = new L.marker(L.latLng(staticMap.getCenter()), {
|
||
icon: progressAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
} else {
|
||
ekipAbrarMarkerJustShow.setLatLng([lat, lng]);
|
||
}
|
||
|
||
if (startAbrarMarkerJustShow == null) {
|
||
startAbrarMarkerJustShow = new L.marker(startLatlng, {
|
||
icon: startAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
} else {
|
||
startAbrarMarkerJustShow.setLatLng(startLatlng);
|
||
}
|
||
|
||
if (endAbrarMarkerJustShow == null && endLatlng[0] != "NaN") {
|
||
endAbrarMarkerJustShow = new L.marker(endLatlng, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: false,
|
||
}).addTo(staticMap);
|
||
} else {
|
||
endAbrarMarkerJustShow.setLatLng(endLatlng);
|
||
}
|
||
}
|
||
function prepareImageModal() {
|
||
//image part
|
||
// var tr = $(this).closest("tr");
|
||
// var row = tablethird.row(tr);
|
||
// historyId = row.data().id;
|
||
// console.log("history", historyId);
|
||
// let rowImages = projectupdateimage
|
||
// sliderImages = row.data().images;
|
||
// console.log("rowImages", rowImages, "sliderImages", sliderImages);
|
||
var test = "";
|
||
// if (rowImages.length >0) {
|
||
test = `<div class="form-row">`;
|
||
// let imageIndex1 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-1");
|
||
// });
|
||
// if (imageIndex1 != -1) {
|
||
// test += `<div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex1
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_first" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input " id="inputFile1" type="file"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(1)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox1">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="firstshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_first" class="zoomimage" alt="your image"
|
||
style=" display: none;" />
|
||
</div>
|
||
<input class="file-input " id="inputFile1" type="file" style="display: none !important;"
|
||
accept="image/*" >
|
||
</label>
|
||
<div id="deleteIcon1" class="remove-image-container501" onclick="removeImage(1)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// if (rowImages.length > 1) {
|
||
// let imageIndex2 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-2");
|
||
// });
|
||
// if (imageIndex2 != -1) {
|
||
// test += `<div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex2
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_second" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile2"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(2)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex1 != -1) {
|
||
// test += `<div class="form-group col-md-3" id="#uploadBox2">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="secondshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_second" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile2"
|
||
// accept="image/*" >
|
||
// </label>
|
||
// </div>
|
||
// `;
|
||
// }
|
||
// else {
|
||
test += `<div class="form-group col-md-3" id="uploadBox2" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="secondshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_second" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile2" style="display: none !important;"
|
||
accept="image/*" >
|
||
</label>
|
||
<div id="deleteIcon2" class="remove-image-container501" onclick="removeImage(2)" style="display: none;">✕</div>
|
||
</div>
|
||
`;
|
||
// }
|
||
// }
|
||
// }
|
||
// let imageIndex3 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-3");
|
||
// });
|
||
// if (imageIndex3 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex3
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_third" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile3"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(3)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex2 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="thirdshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_third" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile3"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox3" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="thirdshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_third" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile3" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon3" class="remove-image-container501" onclick="removeImage(3)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
// let imageIndex4 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-4");
|
||
// });
|
||
// if (imageIndex4 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex4
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_fourth" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile4"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(4)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex3 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox4">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="fourthshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_fourth" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile4"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox4" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="fourthshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_fourth" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile4" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon4" class="remove-image-container501" onclick="removeImage(4)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
// let imageIndex5 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-5");
|
||
// });
|
||
// if (imageIndex5 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex5
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_fifth" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile5"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(5)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex4 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox5">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="fifthshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_fifth" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile5"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox5" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="fifthshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_fifth" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile5" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon5" class="remove-image-container501" onclick="removeImage(5)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
// let imageIndex6 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-6");
|
||
// });
|
||
// if (imageIndex6 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex6
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_six" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile6"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(6)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex5 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox6">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="sixshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_six" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile6"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox6" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="sixshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_six" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile6" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon6" class="remove-image-container501" onclick="removeImage(6)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
// let imageIndex7 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-7");
|
||
// });
|
||
// if (imageIndex7 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex7
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_seven" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile7"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(7)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex6 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox7">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="sevenshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_seven" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile7"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox7" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="sevenshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_seven" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile7" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon7" class="remove-image-container501" onclick="removeImage(7)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
// let imageIndex8 = rowImages.findIndex(function (entry) {
|
||
// return entry.path.includes("image-8");
|
||
// });
|
||
// if (imageIndex8 != -1) {
|
||
// test += ` <div class="form-group col-md-3">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img src="https://rms.rmto.ir/${rowImages[
|
||
// imageIndex8
|
||
// ].path.replace(
|
||
// "public",
|
||
// "storage"
|
||
// )}" id="image_upload_eight" name="" class="zoomimage" alt="your image" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile8"
|
||
// accept="image/*">
|
||
// </label>
|
||
// <div class="remove-image-container501" onclick="removeImage(8)" style="">✕</div>
|
||
// </div>
|
||
// `;
|
||
// } else {
|
||
// if (imageIndex7 != -1) {
|
||
// test += ` <div class="form-group col-md-3" id="#uploadBox8">
|
||
// <label class="file-input-modal-container">
|
||
// <div class="file-input-modal">
|
||
// <img id="eightshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
// style="height: 20px; margin-top: 5px;" />
|
||
// <img id="image_upload_eight" name="" class="zoomimage" alt="your image"
|
||
// style=" display: none" />
|
||
// </div>
|
||
// <input class="file-input" type="file" id="inputFile8"
|
||
// accept="image/*">
|
||
// </label>
|
||
// </div>`;
|
||
// }
|
||
// else {
|
||
test += ` <div class="form-group col-md-3" id="uploadBox8" style="display: none;">
|
||
<label class="file-input-modal-container">
|
||
<div class="file-input-modal">
|
||
<img id="eightshow" src="../dist/images/icons/add-image.svg" alt="your image"
|
||
style="height: 20px; margin-top: 5px;" />
|
||
<img id="image_upload_eight" name="" class="zoomimage" alt="your image"
|
||
style=" display: none" />
|
||
</div>
|
||
<input class="file-input" type="file" id="inputFile8" style="display: none !important;"
|
||
accept="image/*">
|
||
</label>
|
||
<div id="deleteIcon8" class="remove-image-container501" onclick="removeImage(8)" style="display: none;">✕</div>
|
||
</div>`;
|
||
// }
|
||
// }
|
||
var additional = `<hr />
|
||
<button type="button" class="btn btn-success float-left submit-update" id="add-update-image" disabled>
|
||
ثبت و بروزرسانی
|
||
</button>`;
|
||
|
||
$("#image-upload-modal .modal-body").empty();
|
||
$("#image-upload-modal .modal-body").append(test);
|
||
$("#image-upload-modal .modal-body").append(additional);
|
||
$("#inputFile1").change(function () {
|
||
$("#firstshow").css("display", "none");
|
||
$("#uploadBox2").css("display", "block");
|
||
$("#add-update-image").attr("disabled", false);
|
||
readURL1(this);
|
||
});
|
||
$("#inputFile2").change(function () {
|
||
$("#secondshow").css("display", "none");
|
||
$("#uploadBox3").css("display", "block");
|
||
readURL2(this);
|
||
});
|
||
$("#inputFile3").change(function () {
|
||
$("#thirdshow").css("display", "none");
|
||
$("#uploadBox4").css("display", "block");
|
||
readURL3(this);
|
||
});
|
||
$("#inputFile4").change(function () {
|
||
$("#fourthshow").css("display", "none");
|
||
$("#uploadBox5").css("display", "block");
|
||
readURL4(this);
|
||
});
|
||
$("#inputFile5").change(function () {
|
||
$("#fifthshow").css("display", "none");
|
||
$("#uploadBox6").css("display", "block");
|
||
readURL5(this);
|
||
});
|
||
$("#inputFile6").change(function () {
|
||
$("#sixshow").css("display", "none");
|
||
$("#uploadBox7").css("display", "block");
|
||
readURL6(this);
|
||
});
|
||
$("#inputFile7").change(function () {
|
||
$("#sevenshow").css("display", "none");
|
||
$("#uploadBox8").css("display", "block");
|
||
readURL7(this);
|
||
});
|
||
$("#inputFile8").change(function () {
|
||
$("#eightshow").css("display", "none");
|
||
$("#uploadBox9").css("display", "block");
|
||
readURL8(this);
|
||
});
|
||
}
|
||
$("#btn-show-mask").on("click", function () {
|
||
if ($(".parent-Coordinates").hasClass("d-none")) {
|
||
$(this).animate({
|
||
top: "140px",
|
||
});
|
||
$(".parent-onmapButton p").css("left", "");
|
||
$(".parent-onmapButton p").animate({
|
||
right: "0px",
|
||
top: "220px",
|
||
});
|
||
$(".parent-Coordinates").removeClass("d-none");
|
||
} else {
|
||
$(this).animate({
|
||
top: "160px",
|
||
});
|
||
$(".parent-onmapButton p").css("right", "");
|
||
$(".parent-onmapButton p").animate({
|
||
left: "5px",
|
||
top: "210px",
|
||
});
|
||
$(".parent-Coordinates").addClass("d-none");
|
||
}
|
||
});
|
||
$(document).on("load", function () {
|
||
$(window).bind("resize", checkPosition);
|
||
});
|
||
|
||
function checkPosition() {
|
||
if ($(window).width() < 1100) {
|
||
$("#example_wrapper").css("margin-top", "50px");
|
||
} else {
|
||
$("#example_wrapper").css("margin-top", "");
|
||
}
|
||
if ($(window).width() < 555) {
|
||
$(".content-center-dataTable").css("width", "260px");
|
||
console.log("working");
|
||
} else {
|
||
$(".content-center-dataTable").css("width", "");
|
||
}
|
||
if ($(window).width() < 440) {
|
||
$(".dataTables_filter input").css("width", "94px");
|
||
$(".dataTables_filter").css("margin-bottom", "10px");
|
||
$(".dt-buttons").addClass("d-flex");
|
||
$(".dt-buttons").addClass("justify-content-center");
|
||
$(".dt-buttons button").css("font-size", "10px");
|
||
} else {
|
||
$(".dataTables_filter input").css("width", "");
|
||
$(".dataTables_filter").css("margin-bottom", "");
|
||
$(".dt-buttons").removeClass("d-flex");
|
||
$(".dt-buttons button").css("font-size", "");
|
||
$(".dt-buttons").removeClass("justify-content-center");
|
||
// pooria
|
||
}
|
||
}
|
||
function pops() {
|
||
$(".btn-increase").prop("disabled", true);
|
||
if ($("#select-province1").val() != 0) {
|
||
$("#append-input-forFilter2").removeClass("d-none");
|
||
$("#append-input-forFilter2")
|
||
.parent()
|
||
.css("border-top", "1px dashed orange");
|
||
}
|
||
if ($("#select-province2").val() != 0) {
|
||
$("#append-input-forFilter3").removeClass("d-none");
|
||
$("#append-input-forFilter3")
|
||
.parent()
|
||
.css("border-top", "1px dashed orange");
|
||
$("#append-input-forFilter3")
|
||
.parent()
|
||
.css("border-bottom", "1px dashed orange");
|
||
}
|
||
}
|