7628 lines
325 KiB
JavaScript
7628 lines
325 KiB
JavaScript
var addNewSubitemStatus = false;
|
||
var imgUrl_show;
|
||
var vidpaiini;
|
||
var unstar;
|
||
var province_id3;
|
||
var map = null;
|
||
var map2 = null;
|
||
var table;
|
||
var mahiat_table;
|
||
var startAbrarMarker = null;
|
||
var isSetStartAbrarMarker = false;
|
||
var endAbrarMarker = null;
|
||
var isSetEndAbrarMarker = false;
|
||
|
||
var mapupdate = null;
|
||
var startAbrarMarkerupdate = null;
|
||
var isSetStartAbrarMarkerupdate = false;
|
||
var endAbrarMarkerupdate = null;
|
||
var isSetEndAbrarMarkerupdate = false;
|
||
|
||
|
||
var progressAbrarMarker = null;
|
||
var isSetprogressAbrarMarker = false;
|
||
var mapshow = null;
|
||
var startAbrarMarkershow = null;
|
||
var isSetStartAbrarMarkershow = false;
|
||
var endAbrarMarkershow = null;
|
||
var isSetEndAbrarMarkershow = false;
|
||
var staticMap = null;
|
||
var statusForPaiini;
|
||
var province_idpaiini;
|
||
|
||
var ekipAbrarMarkerJustShow = null;
|
||
var isSetEkipAbrarMarkerJustShow = false;
|
||
var startAbrarMarkerJustShow = null;
|
||
var isSetStartAbrarMarkerJustShow = false;
|
||
var endAbrarMarkerJustShow = null;
|
||
var isSetEndAbrarMarkerJustShow = false;
|
||
var routeControls = [];
|
||
var routeControlsPath = [];
|
||
|
||
var operation_type_fa = [];
|
||
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;
|
||
|
||
|
||
var table;
|
||
var provinces = [];
|
||
var timepicker;
|
||
var timepickeredit;
|
||
var tablemali;
|
||
var tablesetadi;
|
||
var tablesetadiedit;
|
||
|
||
var choosenidea = [];
|
||
var malistring = "-"
|
||
var meli_contract = ""
|
||
|
||
var choosentarh = [];
|
||
var melitarh = "-"
|
||
var meli_tarh = ""
|
||
|
||
|
||
|
||
var choosenmali = [];
|
||
var malitarh = "-"
|
||
var mali_tarh = ""
|
||
var idtable;
|
||
|
||
var choosenideaedit = [];
|
||
var malistringedit = "-"
|
||
var meli_contractedit = ""
|
||
|
||
var choosentarhedit = [];
|
||
var melitarhedit = "-"
|
||
var meli_tarhedit = ""
|
||
|
||
|
||
|
||
var choosenmaliedit = [];
|
||
var malitarhedit = "-"
|
||
var mali_tarhedit = ""
|
||
|
||
|
||
var choosesetadi = [];
|
||
var setadistring = "-"
|
||
var setadi_contract = ""
|
||
|
||
|
||
|
||
var choosesetadiedit = [];
|
||
var setadistringedit = "-"
|
||
var setadi_contractedit = ""
|
||
|
||
var choosenitem = "-"
|
||
var choosenlast = ""
|
||
|
||
|
||
var choosenitemedit = "-"
|
||
var choosenlastedit = ""
|
||
|
||
var choosenitemfa = "-"
|
||
var choosenlastfa = ""
|
||
|
||
|
||
var choosenitemfaedit = "-"
|
||
var choosenlastfaedit = ""
|
||
|
||
|
||
|
||
var melisadere = ""
|
||
var ostanisadere = ""
|
||
|
||
var relatedpost = [];
|
||
|
||
|
||
var relatedpostedit = [];
|
||
|
||
var subItemTable;
|
||
var historyTable;
|
||
|
||
var loginprovince
|
||
|
||
var tablemaliedit;
|
||
|
||
|
||
var eblaghmoney
|
||
var eblaghmoneyedit
|
||
|
||
var eblaghtarh = []
|
||
|
||
var etadmoney;
|
||
var etadmoneyedit;
|
||
var choosemahiatpro = 1;
|
||
|
||
var frommDate, toDate;
|
||
|
||
var candelete_sub;
|
||
|
||
var queryParemsExcel = [];
|
||
|
||
function showLoaderScreen() {
|
||
$(".divloader").css("display", "flex").hide().fadeIn();
|
||
}
|
||
|
||
function hideLoaderScreen() {
|
||
$(".divloader").fadeOut();
|
||
}
|
||
// set date
|
||
|
||
frommDate = $("#datepickfromdate").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
frommDate.touched = true;
|
||
|
||
$("#datepicktodate").prop("disabled", "");
|
||
|
||
if (
|
||
frommDate.getState().selected.unixDate >=
|
||
tooDate.getState().selected.unixDate
|
||
) {
|
||
tooDate.setDate(frommDate.getState().selected.unixDate);
|
||
}
|
||
|
||
if (tooDate && tooDate.options && tooDate.options.minDate != unix) {
|
||
let cachedValue = tooDate.getState().selected.unixDate;
|
||
|
||
tooDate.options = { minDate: unix };
|
||
|
||
if (tooDate.touched) {
|
||
tooDate.setDate(cachedValue);
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
tooDate = $("#datepicktodate").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
autoClose: true,
|
||
onSelect: function(unix) {
|
||
tooDate.touched = true;
|
||
},
|
||
});
|
||
|
||
$(document).bind('click', function(e) {
|
||
const clicked = $(e.target);
|
||
if (clicked.parents('.select2-selection__choice').length != 0) return false;
|
||
if (clicked.closest('.btn-table-filter').length == 0 && clicked.closest(".parent-filter").length == 0 && $(".parent-filter").css("display") != "none") {
|
||
$(".parent-filter").css("display", "none");
|
||
}
|
||
if (clicked.closest('.btn-table-excel').length == 0 && clicked.closest(".parent-excel").length == 0 && $(".parent-excel").css("display") != "none") {
|
||
$(".parent-excel").css("display", "none");
|
||
}
|
||
if (clicked.closest('.btn-table-word').length == 0 && clicked.closest(".parent-word").length == 0 && $(".parent-word").css("display") != "none") {
|
||
$(".parent-word").css("display", "none");
|
||
}
|
||
});
|
||
|
||
// set date
|
||
$(document).ready(function() {
|
||
|
||
//Maintenance Box
|
||
// Swal.fire({
|
||
// title: 'صفحه در دست تعمیر است',
|
||
// icon: 'info',
|
||
// input: 'password',
|
||
// inputAttributes: {
|
||
// autocapitalize: 'off'
|
||
// },
|
||
// showCancelButton: false,
|
||
// confirmButtonText: 'ثبت',
|
||
// allowOutsideClick: false,
|
||
// showLoaderOnConfirm: true,
|
||
// preConfirm: (admin) => {
|
||
// if (admin == 'witel') return true;
|
||
// return false
|
||
// },
|
||
// }).then((result) => {
|
||
// if (!result.isConfirmed) {
|
||
// showLoaderScreen();
|
||
// }
|
||
// })
|
||
// end Maintenance Box
|
||
|
||
appendtarhedit()
|
||
|
||
|
||
$(".js-example-basic-multipletarh").select2({
|
||
placeholder: "شماره طرح ",
|
||
multiple: true,
|
||
dir: "rtl",
|
||
});
|
||
|
||
$(".js-example-basic-multipletarhedit").select2({
|
||
placeholder: "شماره طرح ",
|
||
multiple: true,
|
||
dir: "rtl",
|
||
});
|
||
|
||
$(".select-province").select2({
|
||
placeholder: "انتخاب استان ",
|
||
multiple: true,
|
||
dir: "rtl",
|
||
});
|
||
|
||
$(".last_statusfilter").select2({
|
||
placeholder: "انتخاب وضعیت ",
|
||
multiple: true,
|
||
dir: "rtl",
|
||
});
|
||
|
||
$(".project-type").select2({
|
||
placeholder: "ماهیت پروژه ",
|
||
multiple: true,
|
||
dir: "rtl",
|
||
|
||
});
|
||
|
||
$("#dateofproject").keypress(function(e) {
|
||
if (String.fromCharCode(e.keyCode).match(/[^0-9]/g)) return false;
|
||
});
|
||
|
||
appendYearFilter()
|
||
timepicker = $("input[name=dateofproject]").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
initialValue: false,
|
||
autoClose: true,
|
||
initialValueType: "persian",
|
||
});
|
||
timepickeredit = $("input[name=dateofprojectedit]").persianDatepicker({
|
||
format: "YYYY/MM/DD",
|
||
initialValue: false,
|
||
autoClose: true,
|
||
initialValueType: "persian",
|
||
});
|
||
showprovince()
|
||
showLoaderScreen()
|
||
table = $("#examplefinance").DataTable({
|
||
dom: "<flB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
scrollX: true,
|
||
language: {
|
||
sEmptyTable: "هیچ دادهای در جدول وجود ندارد",
|
||
sInfo: "نمایش _START_ تا _END_ از _TOTAL_ ردیف",
|
||
sInfoEmpty: "نمایش 0 تا 0 از 0 ردیف",
|
||
sInfoFiltered: "(فیلتر شده از _MAX_ ردیف)",
|
||
sInfoPostFix: "",
|
||
sInfoThousands: ",",
|
||
sLengthMenu: "نمایش _MENU_ ردیف",
|
||
sLoadingRecords: "در حال بارگذاری...",
|
||
sProcessing: "در حال پردازش...",
|
||
sSearch: "جستجو: ",
|
||
sZeroRecords: "رکوردی با این مشخصات پیدا نشد",
|
||
oPaginate: {
|
||
sFirst: "برگهی نخست",
|
||
sLast: "برگهی آخر",
|
||
sNext: "بعدی",
|
||
sPrevious: "قبلی",
|
||
},
|
||
oAria: {
|
||
sSortAscending: ": فعال سازی نمایش به صورت صعودی",
|
||
sSortDescending: ": فعال سازی نمایش به صورت نزولی",
|
||
},
|
||
},
|
||
order: [
|
||
[0, "asc"][(1, "asc")],
|
||
[2, "desc"],
|
||
[3, "desc"],
|
||
[4, "desc"]
|
||
],
|
||
order: [
|
||
[0, "desc"]
|
||
],
|
||
processing: true,
|
||
select: true,
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/contracts/index",
|
||
type: "GET",
|
||
dataSrc: function(json) {
|
||
return json.data;
|
||
},
|
||
},
|
||
columns: [{
|
||
className: "text-nowrap text-center",
|
||
data: "unique_id",
|
||
|
||
},
|
||
{
|
||
className: "text-nowrap text-center",
|
||
data: "province_fa"
|
||
},
|
||
{
|
||
className: "text-nowrap text-center",
|
||
data: "office_fa",
|
||
},
|
||
{
|
||
data: "title",
|
||
className: "text-center",
|
||
},
|
||
{
|
||
data: "status_fa",
|
||
className: "text-center",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data) {
|
||
// if (data.contract_date != null) {
|
||
// return moment(data.contract_date).format('YYYY/MM/DD')
|
||
// return
|
||
// }
|
||
const dateFormatting = data.contract_date.split('-')
|
||
return dateFormatting
|
||
if (dateFormatting[1].length == 1) {}
|
||
|
||
}
|
||
},
|
||
{
|
||
data: "contract_peymankar",
|
||
className: "text-center",
|
||
},
|
||
{
|
||
data: "contract_moshaver_tarahi",
|
||
className: "text-center",
|
||
},
|
||
{
|
||
data: "contract_moshaver_nezarat",
|
||
className: "text-center",
|
||
},
|
||
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
var datafirst = ""
|
||
var datanofirst = ""
|
||
if (data.contract_mojavez_array != null) {
|
||
var nameArr = data.contract_mojavez_array.split(',');
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
if (nameArr[i] == "1") {
|
||
datafirst = "<i class='fa fa-check icon-btnTable'></i>"
|
||
} else {
|
||
datanofirst = "_"
|
||
}
|
||
|
||
}
|
||
if (datafirst.length != 0) {
|
||
return datafirst
|
||
} else {
|
||
return datanofirst
|
||
}
|
||
|
||
}
|
||
return ""
|
||
}
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
var datachecksec = ""
|
||
var datanosec = ""
|
||
if (data.contract_mojavez_array != null) {
|
||
var nameArr = data.contract_mojavez_array.split(',');
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
|
||
if (nameArr[i] == "2") {
|
||
|
||
datachecksec = "<i class='fa fa-check icon-btnTable'></i>"
|
||
} else {
|
||
datanosec = "_"
|
||
}
|
||
}
|
||
if (datachecksec.length != 0) {
|
||
return datachecksec
|
||
} else {
|
||
return datanosec
|
||
}
|
||
|
||
}
|
||
return ""
|
||
}
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
var datacheck3 = ""
|
||
var datano3 = ""
|
||
if (data.contract_mojavez_array != null) {
|
||
var nameArr = data.contract_mojavez_array.split(',');
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
if (nameArr[i] == "3") {
|
||
datacheck3 = "<i class='fa fa-check icon-btnTable'></i>"
|
||
} else {
|
||
datano3 = "_"
|
||
}
|
||
|
||
}
|
||
if (datacheck3.length != 0) {
|
||
return datacheck3
|
||
} else {
|
||
return datano3
|
||
}
|
||
|
||
}
|
||
return ""
|
||
}
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
var datacheck = ""
|
||
var datano = ""
|
||
if (data.contract_mojavez_array != null) {
|
||
var nameArr = data.contract_mojavez_array.split(',');
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
if (nameArr[i] == "4") {
|
||
|
||
datacheck = "<i class='fa fa-check icon-btnTable'></i>"
|
||
} else {
|
||
datano = "_"
|
||
}
|
||
|
||
}
|
||
if (datacheck.length != 0) {
|
||
|
||
return datacheck;
|
||
} else {
|
||
return datano
|
||
}
|
||
|
||
}
|
||
return ""
|
||
}
|
||
},
|
||
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
var datashown = ""
|
||
if (data.contract_tarh_array != null) {
|
||
var nameArr = data.contract_tarh_array.split(',');
|
||
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
datashown = datashown + nameArr[i] + "<br>"
|
||
}
|
||
return datashown
|
||
}
|
||
return ""
|
||
}
|
||
},
|
||
|
||
|
||
|
||
{
|
||
className: "text-center",
|
||
data: "contract_credit_province",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "contract_credit_national",
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: "contract_credit",
|
||
},
|
||
|
||
|
||
{
|
||
className: "text-nowrap testshow text-center",
|
||
data: "created_at_fa",
|
||
},
|
||
{
|
||
data: null,
|
||
className: "text-center",
|
||
render: function(data, type, row) {
|
||
return `<div class="setcontent"><button 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 deletsubmit" title=" حذف " ><i class="fa fa-trash icon-btnTable"></i></button>
|
||
</div>
|
||
`;
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return `<button class="btn-dataTable underprojectcontract" title="ثبت اطلاعات زیر پروژه"><i class="fa fa-plus icon-btnTable"></i></button>`
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function(data, type, row) {
|
||
return (row.status_rel == 2) ? `<button class="btn-dataTable showprojectcontract" title="نمایش زیر پروژه"><i class="far fa-eye icon-btnTable"></i></button><p>${data.projects_count}</p>` : `<button class="btn-dataTable showprojectcontract" disabled title="نمایش زیر پروژه"><i class="far fa-eye icon-btnTable"></i></button><p>${data.projects_count}</p>`
|
||
},
|
||
},
|
||
|
||
|
||
],
|
||
|
||
buttons: [{
|
||
text: '<div class="btn-table-excel"><div class="d-flex flex-column"><i class="fa fa-check-circle mb-2 icon-color"></i>خروجی به اکسل</div></div>',
|
||
action: function(e, dt, node, config) {
|
||
const url = `https://rms.rmto.ir/reports/contracts${queryParemsExcel.length != 0 ? `?${queryParemsExcel.join('&')}` : ''}`
|
||
window.open(url, '_blank')
|
||
},
|
||
},
|
||
{
|
||
text: '<div class="btn-table-word"><div class="d-flex flex-column"><i class="fas fa-file-word mb-2 icon-color"></i>خروجی به ورد</div></div>',
|
||
action: function (e, dt, node, config) {
|
||
if ($(".parent-word").css("display") == "none") {
|
||
$(".parent-word").css("display", "block");
|
||
} else if ($(".parent-word").css("display") != "none") {
|
||
$(".parent-word").css("display", "none");
|
||
}
|
||
},
|
||
|
||
},
|
||
{
|
||
text: '<div class="btn-table-filter"><div class="d-flex flex-column"><i class="fa mb-2 fa-filter icon-color"></i> فیلترینگ پیشرفته</div></div>',
|
||
action: function (e, dt, node, config) {
|
||
if ($(".parent-filter").css("display") == "none") {
|
||
$(".parent-filter").css("display", "block");
|
||
} else if ($(".parent-filter").css("display") != "none") {
|
||
$(".parent-filter").css("display", "none");
|
||
}
|
||
},
|
||
},
|
||
|
||
{
|
||
text: '<div class="btn-table-excel"><div class="d-flex flex-column"><i class="fa mb-2 fa-book icon-color"></i>گزارش آماری</div></div>',
|
||
action: function (e, dt, node, config) {
|
||
if ($(".parent-excel").css("display") == "none") {
|
||
$(".parent-excel").css("display", "block");
|
||
} else if ($(".parent-excel").css("display") != "none") {
|
||
$(".parent-excel").css("display", "none");
|
||
}
|
||
},
|
||
|
||
},
|
||
{
|
||
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/2021-07-03_13-24-331_1.mp4", "_blank");
|
||
},
|
||
},
|
||
],
|
||
initComplete: function () {
|
||
hideLoaderScreen()
|
||
$("body").find(".dataTables_scrollBody").addClass("scrollbar");
|
||
|
||
},
|
||
|
||
});
|
||
|
||
|
||
})
|
||
|
||
function scrolldowntable() {
|
||
$("html, body").animate({
|
||
scrollTop: $(".upnext").offset().top + 1000,
|
||
},
|
||
50
|
||
);
|
||
}
|
||
$("#add-project-button").on("click", function () {
|
||
$("#modalsecond input").removeClass("is-invalid-input")
|
||
$("#modalsecond select").removeClass("is-invalid-input")
|
||
$(".finance_fieldset2 input").val("");
|
||
$(".riali span").text("0");
|
||
choosenidea.length = 0;
|
||
choosentarh.length = 0;
|
||
choosenmali.length = 0;
|
||
relatedpost.length = 0;
|
||
choosesetadi.length = 0;
|
||
$("#modalsecond").modal("show")
|
||
$("#edarekol").val(0)
|
||
$("#province-id").val(0)
|
||
$("#project_title").val("")
|
||
$("#project_status").val(0)
|
||
$("#dateofproject").val("")
|
||
$("#count_money").val("")
|
||
$("#contract_money").val("")
|
||
$("#peymankar_name").val("")
|
||
$("#designer_name").val("")
|
||
$("#nezarat_name").val("")
|
||
$("#ostani_num").val("")
|
||
if ($('#checkbox1').is(':checked')) {
|
||
$('#checkbox1').prop('checked', false);
|
||
}
|
||
if ($('#checkbox2').is(':checked')) {
|
||
$('#checkbox2').prop('checked', false);
|
||
}
|
||
if ($('#checkbox3').is(':checked')) {
|
||
$('#checkbox3').prop('checked', false);
|
||
}
|
||
if ($('#checkbox4').is(':checked')) {
|
||
$('#checkbox4').prop('checked', false);
|
||
}
|
||
$("#meliwrapper").css("display", "none")
|
||
$("#setadiwrapper").css("display", "none")
|
||
$("#ostani_label").css("display", "none")
|
||
$("#ostani_num").css("display", "none")
|
||
$(".showspanostani").css("display", "none")
|
||
|
||
$("#ostani_num").val(" ")
|
||
|
||
|
||
});
|
||
|
||
function showprovince() {
|
||
let reqUrl = "https://rms.rmto.ir/webapi/getuser/userprovince";
|
||
$.ajax({
|
||
url: reqUrl,
|
||
type: "GET",
|
||
success: function (result) {
|
||
provinces = result.data.province_id;
|
||
appendprovince(provinces);
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
|
||
function appendprovince(data) {
|
||
$("#province-id").empty();
|
||
$("#select-province-excel").empty();
|
||
$("#select-province-word").empty();
|
||
$("#province-id").append('<option value="0">انتخاب استان </option>');
|
||
$("#select-province-excel").append('<option value="0">انتخاب استان </option>');
|
||
|
||
for (let index = 0; index < data.length; index++) {
|
||
$("#province-id").append(
|
||
"\
|
||
<option value=" +
|
||
data[index].id +
|
||
">" +
|
||
data[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
$(".select-province").append(
|
||
"\
|
||
<option value=" +
|
||
data[index].id +
|
||
">" +
|
||
data[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
$("#select-province-excel").append(
|
||
"\
|
||
<option value=" +
|
||
data[index].id +
|
||
">" +
|
||
data[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
$("#select-province-word").append(
|
||
"\
|
||
<option value=" +
|
||
data[index].id +
|
||
">" +
|
||
data[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
}
|
||
restrictInputOtherThanArabic($("#project_title"));
|
||
restrictInputOtherThanArabic($("#designer_name"));
|
||
restrictInputOtherThanArabic($("#nezarat_name"));
|
||
restrictInputOtherThanArabic($("#peymankar_name"));
|
||
|
||
|
||
function restrictInputOtherThanArabic($field) {
|
||
var arabicCharUnicodeRange = /[\u0600-\u06FF-0-9-45]/;
|
||
|
||
$field.bind("keypress", function (event) {
|
||
var key = event.which;
|
||
if (key == 8 || key == 0 || key === 32) {
|
||
return true;
|
||
}
|
||
|
||
var str = String.fromCharCode(key);
|
||
if (arabicCharUnicodeRange.test(str)) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
});
|
||
}
|
||
|
||
$('#project_entry').on('select2:select', function (e) {
|
||
var data = e.params.data;
|
||
if (data.id == 0) {
|
||
|
||
} else if (data.id == 1) {
|
||
showtabelemeli()
|
||
} else if (data.id == 2) {
|
||
showinputostani()
|
||
} else if (data.id == 3) {
|
||
melisadere = "مجوز"
|
||
showtablesetad()
|
||
} else if (data.id == 4) {
|
||
ostanisadere = "مجوز"
|
||
}
|
||
|
||
});
|
||
$('#project_entry').on('select2:select', function (e) {
|
||
var data = e.params.data;
|
||
if (data.id == 0) {
|
||
|
||
} else if (data.id == 1) {
|
||
showtabelemeli()
|
||
} else if (data.id == 2) {
|
||
showinputostani()
|
||
} else if (data.id == 3) {
|
||
melisadere = "مجوز"
|
||
showtablesetad()
|
||
} else if (data.id == 4) {
|
||
ostanisadere = "مجوز"
|
||
}
|
||
|
||
});
|
||
$('#checkbox1').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpost.push(1)
|
||
|
||
$("#meliwrapper").css("display", "block")
|
||
$(".js-example-basic-multipletarh").empty();
|
||
appendtarh()
|
||
|
||
} else {
|
||
$("#meliwrapper").css("display", "none")
|
||
relatedpost = jQuery.grep(relatedpost, function (value) {
|
||
return value != 1;
|
||
});
|
||
|
||
|
||
}
|
||
});
|
||
$('#checkbox3').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpost.push(3)
|
||
|
||
$("#setadiwrapper").css("display", "block")
|
||
|
||
} else {
|
||
$("#setadiwrapper").css("display", "none")
|
||
choosesetadi.length = 0
|
||
relatedpost = jQuery.grep(relatedpost, function (value) {
|
||
return value != 3;
|
||
});
|
||
|
||
}
|
||
|
||
})
|
||
$('#checkbox2').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpost.push(2)
|
||
|
||
showinputostani()
|
||
|
||
} else if ($(this).is(":not(:checked)")) {
|
||
$("#ostani_label").css("display", "none")
|
||
$("#ostani_num").css("display", "none")
|
||
$(".showspanostani").css("display", "none")
|
||
|
||
$("#ostani_num").val(" ")
|
||
$("#ostani_num_span").text("0")
|
||
relatedpost = jQuery.grep(relatedpost, function (value) {
|
||
return value != 2;
|
||
});
|
||
|
||
|
||
|
||
}
|
||
})
|
||
$('#checkbox4').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpost.push(4)
|
||
|
||
|
||
|
||
} else if ($(this).is(":not(:checked)")) {
|
||
relatedpost = jQuery.grep(relatedpost, function (value) {
|
||
return value != 4;
|
||
});
|
||
|
||
|
||
}
|
||
})
|
||
|
||
$('#checkbox1edit').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpostedit.push(1)
|
||
$("#meliwrapperedit").css("display", "block")
|
||
|
||
} else {
|
||
$("#meliwrapperedit").css("display", "none")
|
||
$("#eblagh_maliedit").val("")
|
||
$("#eblagh_maliedit_span").text("0")
|
||
$('.js-example-basic-multipletarhedit ').val([]).trigger('change');
|
||
|
||
|
||
|
||
relatedpostedit = jQuery.grep(relatedpostedit, function (value) {
|
||
return value != 1;
|
||
});
|
||
}
|
||
});
|
||
$('#checkbox3edit').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
$("#setadiwrapperedit").css("display", "block")
|
||
|
||
relatedpostedit.push(3)
|
||
|
||
} else {
|
||
$("#setadiwrapperedit").css("display", "none")
|
||
$("#setad_inputedit").val("")
|
||
$("#setad_inputedit_span").text("0")
|
||
relatedpostedit = jQuery.grep(relatedpostedit, function (value) {
|
||
return value != 3;
|
||
});
|
||
}
|
||
})
|
||
$('#checkbox2edit').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpostedit.push(2)
|
||
|
||
showinputostaniedit()
|
||
|
||
} else if ($(this).is(":not(:checked)")) {
|
||
$("#ostani_labeledit").css("display", "none")
|
||
$("#ostani_numedit").css("display", "none")
|
||
$("#ostani_numedit_span").css("display", "none")
|
||
$("#ostani_numedit").val("")
|
||
$("#ostani_numedit_span").text("0")
|
||
relatedpostedit = jQuery.grep(relatedpostedit, function (value) {
|
||
return value != 2;
|
||
});
|
||
|
||
|
||
|
||
}
|
||
})
|
||
$('#checkbox4edit').click(function () {
|
||
if ($(this).is(":checked")) {
|
||
relatedpostedit.push(4)
|
||
|
||
|
||
|
||
} else if ($(this).is(":not(:checked)")) {
|
||
relatedpostedit = jQuery.grep(relatedpostedit, function (value) {
|
||
return value != 4;
|
||
});
|
||
|
||
|
||
}
|
||
})
|
||
|
||
|
||
|
||
|
||
|
||
function showinputostani() {
|
||
$("#ostani_label").css("display", "block")
|
||
$("#ostani_num").css("display", "block")
|
||
$(".showspanostani").css("display", "block")
|
||
|
||
|
||
}
|
||
|
||
$("#ostani_labeledit").css("display", "none")
|
||
$("#ostani_numedit").css("display", "none")
|
||
$("#ostani_numedit_span").css("display", "none")
|
||
|
||
function showinputostaniedit() {
|
||
$("#ostani_labeledit").css("display", "block")
|
||
$("#ostani_numedit").css("display", "block")
|
||
$("#ostani_numedit_span").css("display", "block")
|
||
|
||
}
|
||
$("#submitNewRow").on("click", function () {
|
||
choosenlastfa = "";
|
||
choosenlast = "";
|
||
eblaghtarh.length = 0;
|
||
eblaghmoney = $("#eblagh_mali").val()
|
||
etadmoney = $("#setad_input").val()
|
||
$(".js-example-basic-multipletarh")
|
||
.select2("data")
|
||
.forEach((element) => {
|
||
eblaghtarh.push(element.text);
|
||
|
||
});
|
||
if ($("#edarekol").val() == 0) {
|
||
$("#edarekol").addClass("is-invalid-input");
|
||
} else {
|
||
$("#edarekol").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#province-id").val() == 0) {
|
||
$("#province-id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#province-id").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_title").val() == "") {
|
||
$("#project_title").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_title").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_status").val() == 0) {
|
||
$("#project_status").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_status").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#dateofproject").val() == "") {
|
||
$("#dateofproject").addClass("is-invalid-input");
|
||
} else {
|
||
$("#dateofproject").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#peymankar_name").val() == "") {
|
||
$("#peymankar_name").addClass("is-invalid-input");
|
||
} else {
|
||
$("#peymankar_name").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#designer_name").val() == "") {
|
||
$("#designer_name").addClass("is-invalid-input");
|
||
} else {
|
||
$("#designer_name").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#nezarat_name").val() == "") {
|
||
$("#nezarat_name").addClass("is-invalid-input");
|
||
} else {
|
||
$("#nezarat_name").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#contract_money").val() == "") {
|
||
$("#contract_money").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract_money").removeClass("is-invalid-input");
|
||
}
|
||
for (var i = 0; i < choosenidea.length; i++) {
|
||
malistring = malistring + choosenidea[i] + "-"
|
||
}
|
||
meli_contract = malistring
|
||
|
||
|
||
for (var i = 0; i < choosentarh.length; i++) {
|
||
melitarh = melitarh + choosentarh[i] + "-"
|
||
}
|
||
meli_tarh = melitarh
|
||
|
||
|
||
for (var i = 0; i < choosenmali.length; i++) {
|
||
malitarh = malitarh + choosenmali[i] + "-"
|
||
}
|
||
mali_tarh = malitarh
|
||
|
||
|
||
$("#modalsetadi").modal("hide")
|
||
|
||
for (var i = 0; i < choosesetadi.length; i++) {
|
||
setadistring = setadistring + choosesetadi[i] + "-"
|
||
}
|
||
setadi_contract = setadistring
|
||
|
||
|
||
|
||
var office = $("#edarekol").children("option:selected").val();
|
||
var officefa = $("#edarekol").children("option:selected").text();
|
||
var province = $("#province-id").children("option:selected").val();
|
||
var provincetext = $("#province-id").children("option:selected").text();
|
||
var projecttitle = $("#project_title").val();
|
||
var project_status = $("#project_status").children("option:selected").val();
|
||
var project_status_fa = $("#project_status").children("option:selected").text();
|
||
|
||
var dateofproject = $("#dateofproject").val();
|
||
var contarcts = $(".js-example-basic-multiple").children("option:selected").val();
|
||
var designer_name = $("#designer_name").val();
|
||
var tarh_num = $("#tarh_num").val();
|
||
var count_money = $("#count_money").val() + "-" + melisadere;
|
||
var contract_money = $("#contract_money").val();
|
||
var peymankar_name = $("#peymankar_name").val();
|
||
var nezarat_name = $("#nezarat_name").val();
|
||
|
||
var ostani_num = $("#ostani_num").val()
|
||
|
||
for (var i = 0; i < relatedpost.length; i++) {
|
||
choosenitem = choosenitem + relatedpost[i] + "-"
|
||
}
|
||
choosenlast = choosenitem
|
||
|
||
for (var i = 0; i < relatedpost.length; i++) {
|
||
if (relatedpost[i] == 1) {
|
||
choosenitemfa = choosenitemfa + "ابلاغ اعتبار ملی" + "-"
|
||
} else if (relatedpost[i] == 2) {
|
||
choosenitemfa = choosenitemfa + "ابلاغ اعتبار استانی" + "-"
|
||
} else if (relatedpost[i] == 3) {
|
||
choosenitemfa = choosenitemfa + "مجوز صادره از ستاد" + "-"
|
||
} else if (relatedpost[i] == 4) {
|
||
choosenitemfa = choosenitemfa + "مجوز صادره در استان" + "-"
|
||
}
|
||
|
||
}
|
||
choosenlastfa = choosenitemfa
|
||
|
||
let contractDateMonth = timepicker.getState().selected.month;
|
||
let contractDateDay = timepicker.getState().selected.date;
|
||
let contractDateFormatted = timepicker.getState().selected.year + "-" + contractDateMonth + "-" + contractDateDay;
|
||
var dateSplitted = contractDateFormatted.split("-")
|
||
if (office != 0) {
|
||
if (relatedpost.length != 0) {
|
||
if ($('#checkbox1').is(':checked')) {
|
||
if (eblaghmoney == "") {
|
||
alert(" لطفا مبلغ اعتبار ملی را وارد نمایید ")
|
||
$("#eblagh_mali").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
if (eblaghtarh.length > 0) {
|
||
if ($('#checkbox3').is(':checked')) {
|
||
if (etadmoney == "") {
|
||
alert("لطفا مبلغ مجوز صادره از ستاد (میلیون ریال) را وارد نمایید ")
|
||
$("#setad_input").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlast);
|
||
formData.append("contract_mojavez_array", relatedpost);
|
||
formData.append("contract_mojavez_fa", choosenlastfa);
|
||
formData.append("contract_mojavez_fa_array", relatedpost);
|
||
formData.append("contract_tarh", eblaghtarh);
|
||
formData.append("contract_tarh_array", eblaghtarh)
|
||
formData.append("contract_credit_national", eblaghmoney);
|
||
formData.append("contract_credit_national_array", eblaghmoney);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoney);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoney);
|
||
formData.append("contract_mojavez_data_setad", etadmoney);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoney);
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#modalsecond").hasClass("is-invalid-input")) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
} else {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/create",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modalsecond").modal("hide")
|
||
|
||
location.reload()
|
||
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
} else {
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlast);
|
||
formData.append("contract_mojavez_array", relatedpost);
|
||
formData.append("contract_mojavez_fa", choosenlastfa);
|
||
formData.append("contract_mojavez_fa_array", relatedpost);
|
||
formData.append("contract_tarh", eblaghtarh);
|
||
formData.append("contract_tarh_array", eblaghtarh)
|
||
formData.append("contract_credit_national", eblaghmoney);
|
||
formData.append("contract_credit_national_array", eblaghmoney);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoney);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoney);
|
||
formData.append("contract_mojavez_data_setad", etadmoney);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoney);
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#modalsecond").hasClass("is-invalid-input")) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
} else {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/create",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modalsecond").modal("hide")
|
||
|
||
location.reload()
|
||
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
} else {
|
||
alert(" لطفا شماره طرح را انتخاب نمایید ")
|
||
$(".select2-container").addClass("is-invalid-input");
|
||
}
|
||
|
||
}
|
||
} else {
|
||
if ($('#checkbox3').is(':checked')) {
|
||
if (etadmoney == "") {
|
||
alert("لطفا از موارد جدول انتخاب کنید ")
|
||
$("#setad_input").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlast);
|
||
formData.append("contract_mojavez_array", relatedpost);
|
||
formData.append("contract_mojavez_fa", choosenlastfa);
|
||
formData.append("contract_mojavez_fa_array", relatedpost);
|
||
formData.append("contract_tarh", eblaghtarh);
|
||
formData.append("contract_tarh_array", eblaghtarh)
|
||
formData.append("contract_credit_national", eblaghmoney);
|
||
formData.append("contract_credit_national_array", eblaghmoney);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoney);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoney);
|
||
formData.append("contract_mojavez_data_setad", etadmoney);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoney);
|
||
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#modalsecond").hasClass("is-invalid-input")) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
} else {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/create",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modalsecond").modal("hide")
|
||
|
||
location.reload()
|
||
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
}
|
||
} else {
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlast);
|
||
formData.append("contract_mojavez_array", relatedpost);
|
||
formData.append("contract_mojavez_fa", choosenlastfa);
|
||
formData.append("contract_mojavez_fa_array", relatedpost);
|
||
formData.append("contract_tarh", eblaghtarh);
|
||
formData.append("contract_tarh_array", eblaghtarh)
|
||
formData.append("contract_credit_national", eblaghmoney);
|
||
formData.append("contract_credit_national_array", eblaghmoney);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoney);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoney);
|
||
formData.append("contract_mojavez_data_setad", etadmoney);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoney);
|
||
for (var pair of formData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#modalsecond").hasClass("is-invalid-input")) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
} else {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/create",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modalsecond").modal("hide")
|
||
location.reload()
|
||
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
} else {
|
||
alert("لطفا از مجوز های انعقاد قرارداد یک مورد را انتخاب کنید . ")
|
||
}
|
||
} else {
|
||
alert(" لطفا اداره کل را انتخاب کنید ")
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
})
|
||
|
||
|
||
|
||
|
||
|
||
$("#examplefinance").on("click", "button.deletsubmit", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
var idkol = row.data().id;
|
||
let formData = new FormData();
|
||
formData.append("id", idkol);
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "آیا برای حذف مطمئن هستید؟",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
cancelButtonColor: "#d33",
|
||
confirmButtonText: "بله، تایید میشود",
|
||
cancelButtonText: "منصرف شدم!",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/delete",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
|
||
table.ajax.reload(null, false);
|
||
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
},
|
||
});
|
||
});
|
||
|
||
$(".cancel").on("click", function () {
|
||
$("#stepModalunderpro").modal("hide");
|
||
$("#stepmodaledit").modal("hide");
|
||
});
|
||
$(".cancel_choose").on("click", function () {
|
||
$("#modalAfterTable").modal("hide");
|
||
$("#tableProjectmodal").modal("show");
|
||
});
|
||
|
||
function createLeafletMap(startP, endP, update) {
|
||
let bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
map = new L.map("abrar-map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView(startP, 9);
|
||
|
||
L.tileLayer("https://rmsmap.rmto.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
map
|
||
);
|
||
startAbrarMarker = new L.marker(startP, {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(map);
|
||
endAbrarMarker = new L.marker(endP, {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
});
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
function createLeafletMapshow(map, startP, endP, isExist) {
|
||
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],
|
||
];
|
||
|
||
if (!isExist) {
|
||
mapshow = new L.map(map, {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([latapi1, lngapi1], 9);
|
||
|
||
L.tileLayer("https://rmsmap.rmto.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
mapshow
|
||
);
|
||
|
||
startAbrarMarkershow = new L.marker(L.latLng(latapi1, lngapi1), {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(mapshow);
|
||
|
||
endAbrarMarkershow = new L.marker(L.latLng(latapi2, lngapi2), {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(mapshow);
|
||
|
||
} else {
|
||
mapshow.setView([latapi1, lngapi1], 9);
|
||
startAbrarMarkershow.setLatLng(L.latLng(latapi1, lngapi1));
|
||
endAbrarMarkershow.setLatLng(L.latLng(latapi2, lngapi2));
|
||
}
|
||
isSetStartAbrarMarkershow = true;
|
||
$("#stepmodaledit input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
$("#stepmodaledit input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
|
||
$("#stepmodaledit #pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
isSetEndAbrarMarkershow = true;
|
||
|
||
$("#stepmodaledit #pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
startAbrarMarkershow.on("click", function () {
|
||
if (!isSetStartAbrarMarkershow) {
|
||
startAbrarMarkershow.setLatLng(L.latLng(mapshow.getCenter()));
|
||
isSetStartAbrarMarkershow = true;
|
||
|
||
$("#stepmodaledit #pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
|
||
$("#stepmodaledit input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepmodaledit input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
let markerLatLng = [
|
||
startAbrarMarkershow.getLatLng().lat,
|
||
startAbrarMarkershow.getLatLng().lng + 0.0008,
|
||
];
|
||
|
||
mapshow.setView(markerLatLng);
|
||
|
||
|
||
endAbrarMarkershow.setLatLng(markerLatLng);
|
||
endAbrarMarkershow.addTo(mapshow);
|
||
}
|
||
});
|
||
|
||
startAbrarMarkershow.on("drag", function () {
|
||
$("#stepmodaledit #pin-marker-start").addClass("pin-move");
|
||
checkMarkersAndDrawPathshow();
|
||
});
|
||
|
||
startAbrarMarkershow.on("dragend", function () {
|
||
$("#stepmodaledit #pin-marker-start").removeClass("pin-move");
|
||
|
||
if ($("#stepmodaledit #pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarkershow) {
|
||
$("#stepmodaledit input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepmodaledit input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$("#stepmodaledit #pin-marker-start").addClass("pin-set");
|
||
checkMarkersAndDrawPathshow();
|
||
} else {
|
||
mapshow.setView(startAbrarMarkershow.getLatLng());
|
||
}
|
||
});
|
||
|
||
endAbrarMarkershow.on("click", function () {
|
||
if (!isSetEndAbrarMarkershow) {
|
||
endAbrarMarkershow.setLatLng(L.latLng(mapshow.getCenter()));
|
||
isSetEndAbrarMarkershow = true;
|
||
|
||
$("#stepmodaledit #pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
$("#stepmodaledit input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepmodaledit input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
checkMarkersAndDrawPathshow();
|
||
}
|
||
});
|
||
|
||
endAbrarMarkershow.on("drag", function () {
|
||
$("#stepmodaledit #pin-marker-end").addClass("pin-move");
|
||
checkMarkersAndDrawPathshow();
|
||
});
|
||
|
||
endAbrarMarkershow.on("dragend", function () {
|
||
$("#stepmodaledit #pin-marker-end").removeClass("pin-move");
|
||
|
||
if ($("#stepmodaledit #pin-marker-end").hasClass("pin-set") || isSetEndAbrarMarker) {
|
||
$("#stepmodaledit input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkershow.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepmodaledit input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
$("#stepmodaledit #pin-marker-end").addClass("pin-set");
|
||
checkMarkersAndDrawPathshow();
|
||
} else {
|
||
mapshow.setView(endAbrarMarkershow.getLatLng());
|
||
}
|
||
});
|
||
|
||
checkMarkersAndDrawPathshow();
|
||
}
|
||
|
||
function checkmarkeranddrawupdate() {
|
||
if (
|
||
$("#modalAfterTable #pin-marker-start").hasClass("pin-set") &&
|
||
!$("#modalAfterTable #pin-marker-start").hasClass("pin-move") &&
|
||
$("#modalAfterTable #pin-marker-end").hasClass("pin-set") &&
|
||
!$("#modalAfterTable #pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawpathupdate();
|
||
} else {
|
||
setTimeout(() => {
|
||
if (
|
||
$("#modalAfterTable #pin-marker-start").hasClass("pin-set") &&
|
||
!$("#modalAfterTable #pin-marker-start").hasClass("pin-move") &&
|
||
$("#modalAfterTable #pin-marker-end").hasClass("pin-set") &&
|
||
!$("#modalAfterTable #pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawpathupdate();
|
||
} else {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapshow.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
}
|
||
}, 20);
|
||
}
|
||
}
|
||
|
||
function drawpathupdate() {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapupdate.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
routeControls.push(
|
||
L.Routing.control({
|
||
waypoints: [
|
||
L.latLng(
|
||
parseFloat(startAbrarMarkerupdate.getLatLng().lat),
|
||
parseFloat(startAbrarMarkerupdate.getLatLng().lng)
|
||
),
|
||
L.latLng(
|
||
parseFloat(endAbrarMarkerupdate.getLatLng().lat),
|
||
parseFloat(endAbrarMarkerupdate.getLatLng().lng)
|
||
),
|
||
],
|
||
fitSelectedRoutes: false,
|
||
draggableWaypoints: true,
|
||
createMarker: function () {
|
||
return null;
|
||
},
|
||
lineOptions: {
|
||
addWaypoints: false,
|
||
styles: [{
|
||
color: "#28a745",
|
||
opacity: 0.8,
|
||
weight: 5,
|
||
},],
|
||
},
|
||
})
|
||
.addTo(mapupdate)
|
||
);
|
||
$(".leaflet-control-container").css("display", "none");
|
||
$(".leaflet-routing-container-hide").css("display", "none");
|
||
}
|
||
|
||
function checkMarkersAndDrawPathshow() {
|
||
if (
|
||
$("#stepmodaledit #pin-marker-start").hasClass("pin-set") &&
|
||
!$("#stepmodaledit #pin-marker-start").hasClass("pin-move") &&
|
||
$("#stepmodaledit #pin-marker-end").hasClass("pin-set") &&
|
||
!$("#stepmodaledit #pin-marker-end").hasClass("pin-move")
|
||
) {
|
||
drawPathshow();
|
||
} else {
|
||
setTimeout(() => {
|
||
if (
|
||
$("#stepmodaledit #pin-marker-start").hasClass("pin-set") &&
|
||
!$("#stepmodaledit #pin-marker-start").hasClass("pin-move") &&
|
||
$("#stepmodaledit #pin-marker-end").hasClass("pin-set") &&
|
||
!$("#stepmodaledit #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);
|
||
});
|
||
}
|
||
}
|
||
}, 20);
|
||
}
|
||
}
|
||
|
||
function removeStartToEndPath(update) {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapName = update ? map2 : map;
|
||
mapName.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
}
|
||
|
||
function initialMarkerMapValue(latP, lngP, update) {
|
||
|
||
if (!update) {
|
||
if (isSetStartAbrarMarker) {
|
||
endAbrarMarker.remove();
|
||
}
|
||
|
||
isSetEndAbrarMarker = false;
|
||
map.setView([latP, lngP], 9);
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
isSetStartAbrarMarker = false;
|
||
|
||
removeStartToEndPath(0);
|
||
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
|
||
$(".modal_same_work input[name=abrar-project-latlng-start]").val("");
|
||
$(".modal_same_work input[name=abrar-project-latlng-end]").val("");
|
||
$(".modal_same_work input[name=abrar-project-latlng-start]").removeClass(
|
||
"is-invalid-input"
|
||
);
|
||
$(".modal_same_work input[name=abrar-project-latlng-end]").removeClass(
|
||
"is-invalid-input"
|
||
);
|
||
} else {
|
||
isSetEndAbrarMarker = true;
|
||
map2.setView([latP, lngP], 9);
|
||
startAbrarMarker.setLatLng(L.latLng(map2.getCenter()));
|
||
}
|
||
}
|
||
|
||
$("#examplefinance").on("click", ".underprojectcontract", function () {
|
||
$("#last_status_id").on("change", function () {
|
||
if ($("#last_status_id").val() == 0) {
|
||
$("#progress_project").css("display", "block")
|
||
$("#progress_project4").css("display", "none");
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
$("#progress_project5").css("display", "none");
|
||
}
|
||
|
||
if ($("#last_status_id").val() == 1) {
|
||
$("#progress_project5").css("display", "block");
|
||
$("#progress_project5").val("10");
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project4").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
$("#progress_project").css("display", "none");
|
||
} else if ($("#last_status_id").val() == 2) {
|
||
$("#progress_project3").css("display", "block");
|
||
$("#progress_project5").css("display", "none");
|
||
$("#progress_project4").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
$("#progress_project").css("display", "none");
|
||
} else if ($("#last_status_id").val() == 3) {
|
||
$("#progress_project4").css("display", "block");
|
||
$("#progress_project4").val("100");
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project5").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
$("#progress_project").css("display", "none");
|
||
}
|
||
});
|
||
$("#project_type").val(0);
|
||
$("#operation_type_id1").val(0);
|
||
$("#operation_type_id2").val(0);
|
||
$("#operation_type_id3").val(0);
|
||
$("#operation_type_id4").val(0);
|
||
$("#operation_type_amount1").val("");
|
||
$(".input_modal_table").prop("disabled", false);
|
||
$("#operation_type_amount2").val("");
|
||
$("#operation_type_amount2").prop("disabled", false);
|
||
$("#operation_type_amount3").val("");
|
||
$("#operation_type_amount3").prop("disabled", false);
|
||
$("#operation_type_amount4").val("");
|
||
$("#operation_type_amount4").prop("disabled", false);
|
||
$("#operation_type_unit1").val("");
|
||
$("#operation_type_unit1").prop("disabled", false);
|
||
$("#operation_type_unit2").val("");
|
||
$("#operation_type_unit2").prop("disabled", false);
|
||
$("#operation_type_unit3").val("");
|
||
$("#operation_type_unit3").prop("disabled", false);
|
||
$("#operation_type_unit4").val("");
|
||
$("#operation_type_unit4").prop("disabled", false);
|
||
$("#operation_type_amount1").val("-");
|
||
$(".input_modal_table").prop("disabled", false);
|
||
$("#operation_type_amount2").val("-");
|
||
$("#operation_type_amount2").prop("disabled", false);
|
||
$("#operation_type_amount3").val("-");
|
||
$("#operation_type_amount3").prop("disabled", false);
|
||
$("#operation_type_amount4").val("-");
|
||
$("#operation_type_amount4").prop("disabled", false);
|
||
$("#operation_type_unit1").val("-");
|
||
$("#operation_type_unit1").prop("disabled", false);
|
||
$("#operation_type_unit2").val("-");
|
||
$("#operation_type_unit2").prop("disabled", false);
|
||
$("#operation_type_unit3").val("-");
|
||
$("#operation_type_unit3").prop("disabled", false);
|
||
$("#operation_type_unit4").val("-");
|
||
$("#operation_type_unit4").prop("disabled", false);
|
||
$("#operator_name").val("");
|
||
$("#operator_phone").val("");
|
||
$("#projectrateid").val(0);
|
||
$("#axis_name_fa").val("");
|
||
$("#axis_type_id").val(0);
|
||
$("#followup_priority_project").val(0);
|
||
$("#progress_project").val("");
|
||
$("#last_status_id").val(0);
|
||
|
||
$("#operation_type_unit11").val("");
|
||
$("#operation_type_unit22").val("");
|
||
$("#operation_type_unit33").val("");
|
||
$("#operation_type_unit44").val("");
|
||
|
||
$("#operation_type_id11").val("");
|
||
$("#operation_type_id22").val("");
|
||
$("#operation_type_id33").val("");
|
||
$("#operation_type_id44").val("");
|
||
|
||
$("#operation_type_amount11").val("");
|
||
$("#ooperation_type_amount22").val("");
|
||
$("#operation_type_amount33").val("");
|
||
$("#operation_type_amount44").val("");
|
||
|
||
$("#operation_type_progress1").val("");
|
||
$("#operation_type_progress2").val("");
|
||
$("#operation_type_progress3").val("");
|
||
$("#operation_type_progress4").val("");
|
||
$("#operation_type_tonaj1").val("");
|
||
$("#operation_type_tonaj2").val("");
|
||
$("#operation_type_tonaj3").val("");
|
||
$("#operation_type_tonaj4").val("");
|
||
|
||
$("#riali1").val("");
|
||
$("#riali2").val("");
|
||
$("#riali3").val("");
|
||
$("#riali4").val("");
|
||
|
||
$("#deviceImg1Preview").removeAttr("src");
|
||
$("#deviceImg2Preview").removeAttr("src");
|
||
$("#deviceImg1").val('');
|
||
$("#deviceImg2").val('');
|
||
|
||
$('#deviceImg1Title').css('display', '');
|
||
$('#deviceImg2Title').css('display', '');
|
||
|
||
$("#deleteDeviceImg1").prop("disabled", true);
|
||
$("#deleteDeviceImg2").prop("disabled", true);
|
||
|
||
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idselectedrow = row.data();
|
||
vidpaiini = row.data().id;
|
||
province_idpaiini = row.data().province_id;
|
||
center_lat_paiin = row.data().center_lat;
|
||
center_lng_paiin = row.data().center_long;
|
||
titleForPaiini = row.data().title;
|
||
statusForPaiini = row.data().status_id;
|
||
|
||
var textheadermodal = "ثبت اطلاعات پروژه های قرار داد شماره(" + idselectedrow.unique_id + ")";
|
||
$("#project_name").val(titleForPaiini);
|
||
if (statusForPaiini == 1) {
|
||
$("#last_status_id").removeAttr("disabled");
|
||
$("#last_status_id").css("display", "");
|
||
$("#last_status_id3").css("display", "none");
|
||
$("#last_status_id2").css("display", "none");
|
||
|
||
$("#progress_project").css("display", "block")
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project4").css("display", "none");
|
||
$("#progress_project5").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
|
||
} else if (statusForPaiini == 2) {
|
||
$("#last_status_id").attr("disabled", true);
|
||
$("#last_status_id").css("display", "none");
|
||
$("#last_status_id3").css("display", "");
|
||
$("#last_status_id2").css("display", "none");
|
||
|
||
$("#progress_project6").css("display", "block");
|
||
$("#progress_project6").val("5");
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project4").css("display", "none");
|
||
$("#progress_project5").css("display", "none");
|
||
$("#progress_project").css("display", "none");
|
||
|
||
} else if (statusForPaiini == 3) {
|
||
$("#last_status_id").attr("disabled", true);
|
||
$("#last_status_id").css("display", "none");
|
||
$("#last_status_id2").css("display", "");
|
||
$("#last_status_id3").css("display", "none");
|
||
|
||
$("#progress_project4").css("display", "block");
|
||
$("#progress_project4").val("100");
|
||
$("#progress_project").css("display", "none");
|
||
$("#progress_project3").css("display", "none");
|
||
$("#progress_project5").css("display", "none");
|
||
$("#progress_project6").css("display", "none");
|
||
}
|
||
|
||
var textheadermodal = "ثبت اطلاعات زیر پروژه قرارداد شماره(" + idselectedrow.unique_id + ")";
|
||
$(".exampleModalLongTitle").text(textheadermodal)
|
||
$("#tool-main").css("display", "none");
|
||
$("#update-table").css("display", "none");
|
||
$("#submitNewRow").attr("disabled", false);
|
||
|
||
edit = false;
|
||
showModal(0);
|
||
initialField();
|
||
$("#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 tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
var idselectedrow = row.data().id;
|
||
province_id3 = row.data().province_id;
|
||
$("#city_id").empty();
|
||
$("#city_id").append(
|
||
'<option value="0">انتخاب شهرستان </option>'
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + province_id3,
|
||
type: "GET",
|
||
success: function (data) {
|
||
list_citys = data.data;
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#city_id").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
if ($("#select-province3").val() != 0) {
|
||
$(".btn-increase").prop("disabled", false);
|
||
}
|
||
});
|
||
|
||
function creatmapfirst(first, last) {
|
||
var bounds = [
|
||
[42.9130026312, 75.6166317076],
|
||
[20.5782370061, 35.5092252948],
|
||
];
|
||
|
||
map = L.map("abrar-map", {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView([first, last], 9);
|
||
|
||
L.tileLayer("https://rmsmap.rmto.ir/141map/{z}/{x}/{y}.png", {}).addTo(map);
|
||
startAbrarMarker = new L.marker(L.latLng(map.getCenter()), {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(map);
|
||
map.on("move", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
map.on("moveend", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
startAbrarMarker.on("click", function () {
|
||
sourceLat = map.getCenter().lat;
|
||
sourceLng = map.getCenter().lng;
|
||
if (!isSetStartAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
isSetStartAbrarMarker = true;
|
||
$("#pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
}
|
||
endAbrarMarker.addTo(map);
|
||
|
||
$(this).hide();
|
||
$("#pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
})
|
||
startAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-start").addClass("pin-move");
|
||
});
|
||
startAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-start").removeClass("pin-move");
|
||
if ($("#pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarker) {
|
||
|
||
$("#pin-marker-start").addClass("pin-set");
|
||
checkMarkersAndDrawPath();
|
||
} else {
|
||
map.setView(startAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
}
|
||
|
||
function setmapview(first, last) {
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-end]").val("")
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-start]").val("")
|
||
|
||
|
||
isSetStartAbrarMarker = false;
|
||
isSetEndAbrarMarker = false;
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
map.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
map.removeLayer(startAbrarMarker);
|
||
if (endAbrarMarker != null) {
|
||
map.removeLayer(endAbrarMarker);
|
||
|
||
}
|
||
|
||
|
||
map.setView([first, last], 9);
|
||
startAbrarMarker = new L.marker(L.latLng(map.getCenter()), {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(map);
|
||
endAbrarMarker = new L.marker(L.latLng(map.getCenter()), {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
})
|
||
map.on("move", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-set").addClass("pin-move");
|
||
}
|
||
});
|
||
|
||
map.on("moveend", function () {
|
||
if (!isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
}
|
||
|
||
if (isSetStartAbrarMarker && !isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
}
|
||
});
|
||
startAbrarMarker.on("click", function () {
|
||
sourceLat = map.getCenter().lat;
|
||
sourceLng = map.getCenter().lng;
|
||
if (!isSetStartAbrarMarker) {
|
||
startAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
isSetStartAbrarMarker = true;
|
||
$("#pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
}
|
||
endAbrarMarker.addTo(map);
|
||
|
||
$(this).hide();
|
||
$("#pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
})
|
||
startAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-start").addClass("pin-move");
|
||
});
|
||
startAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-start").removeClass("pin-move");
|
||
|
||
if ($("#pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarker) {
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$("#pin-marker-start").addClass("pin-set");
|
||
checkMarkersAndDrawPath();
|
||
} else {
|
||
map.setView(startAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
endAbrarMarker.on("drag", function () {
|
||
$("#pin-marker-end").addClass("pin-move");
|
||
checkMarkersAndDrawPath();
|
||
});
|
||
|
||
endAbrarMarker.on("dragend", function () {
|
||
$("#pin-marker-end").removeClass("pin-move");
|
||
|
||
if ($("#pin-marker-end").hasClass("pin-set") || isSetEndAbrarMarker) {
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
$("#pin-marker-end").addClass("pin-set");
|
||
checkMarkersAndDrawPath();
|
||
} else {
|
||
map.setView(endAbrarMarker.getLatLng());
|
||
}
|
||
});
|
||
|
||
|
||
endAbrarMarker.on("click", function () {
|
||
var destLat = map.getCenter().lat;
|
||
var destLng = map.getCenter().lng;
|
||
|
||
if (!isSetEndAbrarMarker) {
|
||
endAbrarMarker.setLatLng(L.latLng(map.getCenter()));
|
||
isSetEndAbrarMarker = true;
|
||
$("#pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
$("#stepModalunderpro input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarker.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarker.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
}
|
||
checkMarkersAndDrawPath();
|
||
})
|
||
|
||
|
||
|
||
}
|
||
|
||
function showModal(id) {
|
||
$("#riz_project_select").modal("show");
|
||
|
||
$("[data-mask]").inputmask();
|
||
|
||
$(".modal_same_work input[name=abrar-project-latlng-start]").on(
|
||
"keyup",
|
||
function () {
|
||
checkStartMarkerValidation();
|
||
}
|
||
);
|
||
|
||
$(".modal_same_work 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 = $(
|
||
".modal_same_work input[name=abrar-project-latlng-start]"
|
||
)
|
||
.val()
|
||
.split(" - ");
|
||
let startLatLng = startLatLngVal.map(function (e) {
|
||
e = e.replace(/_/g, "");
|
||
return parseFloat(e.slice(1, -1));
|
||
});
|
||
if (isNaN(startLatLng[0])) {
|
||
if (!forSaveData) {
|
||
$(
|
||
".modal_same_work input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
} else {
|
||
$(
|
||
".modal_same_work input[name=abrar-project-latlng-start]"
|
||
).addClass("is-invalid-input");
|
||
}
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
$(".modal_same_work input[name=abrar-project-latlng-start]").val("");
|
||
$(".modal_same_work input[name=abrar-project-latlng-start]").attr(
|
||
"placeholder",
|
||
"(شروع) => (طول جغرافیایی) - (عرض جغرافیایی)"
|
||
);
|
||
return false;
|
||
} else if (!startLatLng == 2 ||
|
||
!reg.test(startLatLng[0]) ||
|
||
!reg.test(startLatLng[1])
|
||
) {
|
||
$(
|
||
".modal_same_work input[name=abrar-project-latlng-start]"
|
||
).addClass("is-invalid-input");
|
||
$("#pin-marker-start").removeClass("pin-move pin-set");
|
||
return false;
|
||
} else {
|
||
if (!forSaveData) {
|
||
$(
|
||
".modal_same_work 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),
|
||
];
|
||
}
|
||
|
||
checkMarkersAndDrawPath(0);
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
function checkEndMarkerValidation(forSaveData = false, pageOnLoad = false) {
|
||
let reg = /^([0-9]){2}\.([0-9])+$/;
|
||
let endLatLngVal = $(
|
||
".modal_same_work 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) {
|
||
$(
|
||
".modal_same_work input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
} else {
|
||
$(
|
||
".modal_same_work input[name=abrar-project-latlng-end]"
|
||
).addClass("is-invalid-input");
|
||
}
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
$(".modal_same_work input[name=abrar-project-latlng-end]").val("");
|
||
$(".modal_same_work input[name=abrar-project-latlng-end]").attr(
|
||
"placeholder",
|
||
"(پایان) => (طول جغرافیایی) - (عرض جغرافیایی)"
|
||
);
|
||
return false;
|
||
} else if (!endLatLng == 2 ||
|
||
!reg.test(endLatLng[0]) ||
|
||
!reg.test(endLatLng[1])
|
||
) {
|
||
$(".modal_same_work input[name=abrar-project-latlng-end]").addClass(
|
||
"is-invalid-input"
|
||
);
|
||
$("#pin-marker-end").removeClass("pin-move pin-set");
|
||
return false;
|
||
} else {
|
||
if (!forSaveData) {
|
||
$(
|
||
".modal_same_work 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),
|
||
];
|
||
}
|
||
|
||
checkMarkersAndDrawPath(0);
|
||
|
||
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 () {
|
||
$("#stepModalunderpro").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");
|
||
}
|
||
});
|
||
}
|
||
|
||
function initialField() {
|
||
$("#axis-name-id").val("");
|
||
$("#axis-type-id").val("0");
|
||
$("#project-title-id").val("");
|
||
$("#yearshown").val("14");
|
||
$("#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");
|
||
}
|
||
|
||
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],
|
||
});
|
||
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],
|
||
});
|
||
|
||
function checkMarkersAndDrawPath() {
|
||
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();
|
||
} 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();
|
||
} else {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
|
||
map.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
|
||
}
|
||
}, 20);
|
||
}
|
||
}
|
||
|
||
function drawPath() {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
map.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
|
||
|
||
|
||
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,
|
||
},],
|
||
},
|
||
})
|
||
|
||
.addTo(map)
|
||
);
|
||
$(".leaflet-control-container").css("display", "none");
|
||
$(".leaflet-routing-container-hide").css("display", "none");
|
||
}
|
||
|
||
function drawPathshow() {
|
||
if (routeControls.length) {
|
||
$(routeControls).each(function (index, control) {
|
||
mapshow.removeControl(control);
|
||
routeControls.splice(routeControls.indexOf(index), 1);
|
||
});
|
||
}
|
||
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,
|
||
},],
|
||
},
|
||
})
|
||
.addTo(mapshow)
|
||
);
|
||
$(".leaflet-control-container").css("display", "none");
|
||
$(".leaflet-routing-container-hide").css("display", "none");
|
||
}
|
||
$(document).on('change', '.img-input', function () {
|
||
var input = this;
|
||
var parent = $(input).parents('.img-box');
|
||
if (input.files && input.files[0]) {
|
||
var reader = new FileReader();
|
||
|
||
reader.onload = function (e) {
|
||
parent.find('.img-title').css('display', 'none')
|
||
parent.find('.btn-delete-img').removeAttr('disabled');
|
||
parent.find('.img-preview')
|
||
.attr('src', e.target.result);
|
||
|
||
};
|
||
|
||
reader.readAsDataURL(input.files[0]);
|
||
}
|
||
})
|
||
|
||
$('.btn-delete-img').on('click', function () {
|
||
var parent = $(this).parents('.img-box');
|
||
parent.find('.img-input').val('');
|
||
parent.find('.img-preview').removeAttr('src');
|
||
parent.find('.img-title').css('display', '');
|
||
$(this).attr('disabled', 'disabled')
|
||
});
|
||
$(".input_modal_table1").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$("#project_type").on("change", function () {
|
||
$(".input_modal_table").val("")
|
||
$(".input_modal_table1").empty();
|
||
$(".input_modal_table2").val("");
|
||
var project_type_id = $("#project_type").val();
|
||
$(".input_modal_table1").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/operation/" + project_type_id,
|
||
type: "GET",
|
||
cache: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen()
|
||
},
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (res) {
|
||
hideLoaderScreen()
|
||
$.each(res, function (key, value) {
|
||
var unit = (value.unit != "") ? value.unit : "-";
|
||
$(".input_modal_table1").append(
|
||
"\
|
||
<option unit='" + unit + "' value='" +
|
||
key +
|
||
"'>" +
|
||
value.farsi +
|
||
"</option>\
|
||
"
|
||
);
|
||
});
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen()
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
});
|
||
$("#project_type2").on("change", function () {
|
||
$(".input_modal_table12").empty();
|
||
$(".input_modal_table22").val("");
|
||
var project_type_id = $("#project_type2").val();
|
||
$(".input_modal_table12").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/operation/" + project_type_id,
|
||
type: "GET",
|
||
cache: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen()
|
||
},
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (res) {
|
||
hideLoaderScreen()
|
||
$.each(res, function (key, value) {
|
||
var unit = (value.unit != "") ? value.unit : "-";
|
||
$(".input_modal_table12").append(
|
||
"\
|
||
<option unit='" + unit + "' value='" +
|
||
key +
|
||
"'>" +
|
||
value.farsi +
|
||
"</option>\
|
||
"
|
||
);
|
||
});
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen()
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
});
|
||
|
||
$(".input_modal_table1").on("change", function () {
|
||
var parentModal = $(this).parents('.input_modal_parent');
|
||
var unit = $(this).find('option:selected').attr('unit');
|
||
parentModal.find(".input_modal_table").val("")
|
||
parentModal.find('.input_modal_table2').val(unit)
|
||
});
|
||
$(".input_modal_table12").on("change", function () {
|
||
var parentModal = $(this).parents('.input_modal_parent');
|
||
var unit = $(this).find('option:selected').attr('unit');
|
||
parentModal.find(".input_modal_table").val("")
|
||
parentModal.find('.input_modal_table2').val(unit)
|
||
});
|
||
$(".sabte_satr").on("click", function () {
|
||
|
||
if ($("#project_type").val() == 1) {
|
||
if ($("#operation_type_amount1").val() != "") {
|
||
if ($("#operation_type_id1").val() == 0) {
|
||
$("#operation_type_id1").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id1").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj1").attr("disabled", false);
|
||
if ($("#operation_type_tonaj1").val() == "") {
|
||
$("#operation_type_tonaj1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj1").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj1").attr("disabled", true)
|
||
$("#operation_type_tonaj1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2").val() != "") {
|
||
if ($("#operation_type_id2").val() == 0) {
|
||
$("#operation_type_id2").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id2").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj2").attr("disabled", false);
|
||
if ($("#operation_type_tonaj2").val() == "") {
|
||
$("#operation_type_tonaj2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj2").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj2").attr("disabled", true)
|
||
$("#operation_type_tonaj2").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount3").val() != "") {
|
||
if ($("#operation_type_id3").val() == 0) {
|
||
$("#operation_type_id3").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id3").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj3").attr("disabled", false);
|
||
if ($("#operation_type_tonaj3").val() == "") {
|
||
$("#operation_type_tonaj3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj3").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj3").attr("disabled", true)
|
||
$("#operation_type_tonaj3").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount4").val() != "") {
|
||
if ($("#operation_type_id4").val() == 0) {
|
||
$("#operation_type_id4").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id4").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj4").attr("disabled", false);
|
||
if ($("#operation_type_tonaj4").val() == "") {
|
||
$("#operation_type_tonaj4").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj4").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj4").attr("disabled", true)
|
||
$("#operation_type_tonaj4").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
|
||
if ($("#operation_type_amount1").val() != "") {
|
||
if ($("#operation_type_id1").val() == 0) {
|
||
$("#operation_type_id1").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id1").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress1").attr("disabled", false);
|
||
if ($("#operation_type_progress1").val() == "") {
|
||
$("#operation_type_progress1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress1").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress1").attr("disabled", true);
|
||
$("#operation_type_progress1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2").val() != "") {
|
||
if ($("#operation_type_id2").val() == 0) {
|
||
$("#operation_type_id2").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id2").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress2").attr("disabled", false);
|
||
if ($("#operation_type_progress2").val() == "") {
|
||
$("#operation_type_progress2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress2").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress2").attr("disabled", true);
|
||
$("#operation_type_progress2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount3").val() != "") {
|
||
if ($("#operation_type_id3").val() == 0) {
|
||
$("#operation_type_id3").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id3").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress3").attr("disabled", false);
|
||
if ($("#operation_type_progress3").val() == "") {
|
||
$("#operation_type_progress3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress3").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress3").attr("disabled", true);
|
||
$("#operation_type_progress3").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount4").val() != "") {
|
||
if ($("#operation_type_id4").val() == 0) {
|
||
$("#operation_type_id4").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id4").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress4").attr("disabled", false);
|
||
if ($("#operation_type_progress4").val() == "") {
|
||
$("#operation_type_progress4").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress4").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress4").attr("disabled", true);
|
||
$("#operation_type_progress4").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_type").val() == 2 || $("#project_type").val() == 4 || $("#project_type").val() == 5) {
|
||
$("#stepModalunderpro #operation_type_id11").val($("#stepModalunderpro #operation_type_id1 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id22").val($("#stepModalunderpro #operation_type_id2 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id33").val($("#stepModalunderpro #operation_type_id3 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id44").val($("#stepModalunderpro #operation_type_id4 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_unit11").val($('#stepModalunderpro #operation_type_unit1').val());
|
||
$("#stepModalunderpro #operation_type_unit22").val($('#stepModalunderpro #operation_type_unit2').val());
|
||
$("#stepModalunderpro #operation_type_unit33").val($('#stepModalunderpro #operation_type_unit3').val());
|
||
$("#stepModalunderpro #operation_type_unit44").val($('#stepModalunderpro #operation_type_unit4').val());
|
||
$("#stepModalunderpro #operation_type_amount11").val($('#stepModalunderpro #operation_type_amount1').val());
|
||
$("#stepModalunderpro #operation_type_amount22").val($('#stepModalunderpro #operation_type_amount2').val());
|
||
$("#stepModalunderpro #operation_type_amount33").val($('#stepModalunderpro #operation_type_amount3').val());
|
||
$("#stepModalunderpro #operation_type_amount44").val($('#stepModalunderpro #operation_type_amount4').val());
|
||
|
||
if ($("#operation_type_id1").val() != 0) {
|
||
$("#operation_type_progress1").attr("disabled", false);
|
||
} else {
|
||
$("#operation_type_progress1").attr("disabled", true);
|
||
}
|
||
if ($("#operation_type_id2").val() != 0) {
|
||
$("#operation_type_progress2").attr("disabled", false);
|
||
} else {
|
||
$("#operation_type_progress2").attr("disabled", true);
|
||
}
|
||
if ($("#operation_type_id3").val() != 0) {
|
||
$("#operation_type_progress3").attr("disabled", false);
|
||
} else {
|
||
$("#operation_type_progress3").attr("disabled", true);
|
||
}
|
||
if ($("#operation_type_id4").val() != 0) {
|
||
$("#operation_type_progress4").attr("disabled", false);
|
||
} else {
|
||
$("#operation_type_progress4").attr("disabled", true);
|
||
}
|
||
} else {
|
||
if ($("#operation_type_amount1").val() == "" && $("#operation_type_id1").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepModalunderpro #operation_type_id11").val($("#stepModalunderpro #operation_type_id1 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id22").val($("#stepModalunderpro #operation_type_id2 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id33").val($("#stepModalunderpro #operation_type_id3 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id44").val($("#stepModalunderpro #operation_type_id4 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_unit11").val($('#stepModalunderpro #operation_type_unit1').val());
|
||
$("#stepModalunderpro #operation_type_unit22").val($('#stepModalunderpro #operation_type_unit2').val());
|
||
$("#stepModalunderpro #operation_type_unit33").val($('#stepModalunderpro #operation_type_unit3').val());
|
||
$("#stepModalunderpro #operation_type_unit44").val($('#stepModalunderpro #operation_type_unit4').val());
|
||
$("#stepModalunderpro #operation_type_amount11").val($('#stepModalunderpro #operation_type_amount1').val());
|
||
$("#stepModalunderpro #operation_type_amount22").val($('#stepModalunderpro #operation_type_amount2').val());
|
||
$("#stepModalunderpro #operation_type_amount33").val($('#stepModalunderpro #operation_type_amount3').val());
|
||
$("#stepModalunderpro #operation_type_amount44").val($('#stepModalunderpro #operation_type_amount4').val());
|
||
}
|
||
if ($("#operation_type_amount2").val() == "" && $("#operation_type_id2").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepModalunderpro #operation_type_id11").val($("#stepModalunderpro #operation_type_id1 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id22").val($("#stepModalunderpro #operation_type_id2 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id33").val($("#stepModalunderpro #operation_type_id3 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id44").val($("#stepModalunderpro #operation_type_id4 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_unit11").val($('#stepModalunderpro #operation_type_unit1').val());
|
||
$("#stepModalunderpro #operation_type_unit22").val($('#stepModalunderpro #operation_type_unit2').val());
|
||
$("#stepModalunderpro #operation_type_unit33").val($('#stepModalunderpro #operation_type_unit3').val());
|
||
$("#stepModalunderpro #operation_type_unit44").val($('#stepModalunderpro #operation_type_unit4').val());
|
||
$("#stepModalunderpro #operation_type_amount11").val($('#stepModalunderpro #operation_type_amount1').val());
|
||
$("#stepModalunderpro #operation_type_amount22").val($('#stepModalunderpro #operation_type_amount2').val());
|
||
$("#stepModalunderpro #operation_type_amount33").val($('#stepModalunderpro #operation_type_amount3').val());
|
||
$("#stepModalunderpro #operation_type_amount44").val($('#stepModalunderpro #operation_type_amount4').val());
|
||
}
|
||
if ($("#operation_type_amount3").val() == "" && $("#operation_type_id3").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepModalunderpro #operation_type_id11").val($("#stepModalunderpro #operation_type_id1 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id22").val($("#stepModalunderpro #operation_type_id2 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id33").val($("#stepModalunderpro #operation_type_id3 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id44").val($("#stepModalunderpro #operation_type_id4 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_unit11").val($('#stepModalunderpro #operation_type_unit1').val());
|
||
$("#stepModalunderpro #operation_type_unit22").val($('#stepModalunderpro #operation_type_unit2').val());
|
||
$("#stepModalunderpro #operation_type_unit33").val($('#stepModalunderpro #operation_type_unit3').val());
|
||
$("#stepModalunderpro #operation_type_unit44").val($('#stepModalunderpro #operation_type_unit4').val());
|
||
$("#stepModalunderpro #operation_type_amount11").val($('#stepModalunderpro #operation_type_amount1').val());
|
||
$("#stepModalunderpro #operation_type_amount22").val($('#stepModalunderpro #operation_type_amount2').val());
|
||
$("#stepModalunderpro #operation_type_amount33").val($('#stepModalunderpro #operation_type_amount3').val());
|
||
$("#stepModalunderpro #operation_type_amount44").val($('#stepModalunderpro #operation_type_amount4').val());
|
||
}
|
||
if ($("#operation_type_amount4").val() == "" && $("#operation_type_id4").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepModalunderpro #operation_type_id11").val($("#stepModalunderpro #operation_type_id1 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id22").val($("#stepModalunderpro #operation_type_id2 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id33").val($("#stepModalunderpro #operation_type_id3 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_id44").val($("#stepModalunderpro #operation_type_id4 option:selected").text());
|
||
$("#stepModalunderpro #operation_type_unit11").val($('#stepModalunderpro #operation_type_unit1').val());
|
||
$("#stepModalunderpro #operation_type_unit22").val($('#stepModalunderpro #operation_type_unit2').val());
|
||
$("#stepModalunderpro #operation_type_unit33").val($('#stepModalunderpro #operation_type_unit3').val());
|
||
$("#stepModalunderpro #operation_type_unit44").val($('#stepModalunderpro #operation_type_unit4').val());
|
||
$("#stepModalunderpro #operation_type_amount11").val($('#stepModalunderpro #operation_type_amount1').val());
|
||
$("#stepModalunderpro #operation_type_amount22").val($('#stepModalunderpro #operation_type_amount2').val());
|
||
$("#stepModalunderpro #operation_type_amount33").val($('#stepModalunderpro #operation_type_amount3').val());
|
||
$("#stepModalunderpro #operation_type_amount44").val($('#stepModalunderpro #operation_type_amount4').val());
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
$(".sabte_satr2").on("click", function () {
|
||
if ($("#project_type2").val() == 1) {
|
||
if ($("#operation_type_amount12").val() != "") {
|
||
if ($("#operation_type_id12").val() == 0) {
|
||
$("#operation_type_id12").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id12").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj12").attr("disabled", false);
|
||
if ($("#operation_type_tonaj12").val() == "") {
|
||
$("#operation_type_tonaj12").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj12").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj12").attr("disabled", true)
|
||
$("#operation_type_tonaj12").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount22").val() != "") {
|
||
if ($("#operation_type_id2").val() == 0) {
|
||
$("#operation_type_id2").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id2").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj22").attr("disabled", false);
|
||
if ($("#operation_type_tonaj22").val() == "") {
|
||
$("#operation_type_tonaj22").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj22").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj22").attr("disabled", true)
|
||
$("#operation_type_tonaj22").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount32").val() != "") {
|
||
if ($("#operation_type_id32").val() == 0) {
|
||
$("#operation_type_id32").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id32").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj32").attr("disabled", false);
|
||
if ($("#operation_type_tonaj32").val() == "") {
|
||
$("#operation_type_tonaj32").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj32").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj32").attr("disabled", true)
|
||
$("#operation_type_tonaj32").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount42").val() != "") {
|
||
if ($("#operation_type_id42").val() == 0) {
|
||
$("#operation_type_id42").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id42").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj42").attr("disabled", false);
|
||
if ($("#operation_type_tonaj42").val() == "") {
|
||
$("#operation_type_tonaj42").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj42").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj42").attr("disabled", true)
|
||
$("#operation_type_tonaj42").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
|
||
|
||
if ($("#operation_type_amount12").val() != "") {
|
||
if ($("#operation_type_id12").val() == 0) {
|
||
$("#operation_type_id12").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id12").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress12").attr("disabled", false);
|
||
if ($("#operation_type_progress12").val() == "") {
|
||
$("#operation_type_progress12").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress12").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress12").attr("disabled", true);
|
||
$("#operation_type_progress12").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount22").val() != "") {
|
||
if ($("#operation_type_id22").val() == 0) {
|
||
$("#operation_type_id22").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id22").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress22").attr("disabled", false);
|
||
if ($("#operation_type_progress22").val() == "") {
|
||
$("#operation_type_progress22").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress22").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress22").attr("disabled", true);
|
||
$("#operation_type_progress22").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount32").val() != "") {
|
||
if ($("#operation_type_id32").val() == 0) {
|
||
$("#operation_type_id32").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id32").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress32").attr("disabled", false);
|
||
if ($("#operation_type_progress32").val() == "") {
|
||
$("#operation_type_progress32").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress32").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress32").attr("disabled", true);
|
||
$("#operation_type_progress32").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount42").val() != "") {
|
||
if ($("#operation_type_id42").val() == 0) {
|
||
$("#operation_type_id42").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id42").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress42").attr("disabled", false);
|
||
if ($("#operation_type_progress42").val() == "") {
|
||
$("#operation_type_progress42").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress42").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress42").attr("disabled", true);
|
||
$("#operation_type_progress42").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_type2").val() == 2 || $("#project_type2").val() == 4 || $("#project_type2").val() == 5) {
|
||
$("#stepmodaledit #operation_type_fa122").val($("#stepmodaledit #operation_type_id12").val() != 0 ? $("#stepmodaledit #operation_type_id12 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa222").val($("#stepmodaledit #operation_type_id223").val() != 0 ? $("#stepmodaledit #operation_type_id223 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa322").val($("#stepmodaledit #operation_type_id32").val() != 0 ? $("#stepmodaledit #operation_type_id32 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa422").val($("#stepmodaledit #operation_type_id42").val() != 0 ? $("#stepmodaledit #operation_type_id42 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_unit122").val($('#stepmodaledit #operation_type_unit12').val());
|
||
$("#stepmodaledit #operation_type_unit222").val($('#stepmodaledit #operation_type_unit223').val());
|
||
$("#stepmodaledit #operation_type_unit322").val($('#stepmodaledit #operation_type_unit32').val());
|
||
$("#stepmodaledit #operation_type_unit422").val($('#stepmodaledit #operation_type_unit42').val());
|
||
$("#stepmodaledit #operation_type_amount122").val($('#stepmodaledit #operation_type_amount12').val());
|
||
$("#stepmodaledit #operation_type_amount222").val($('#stepmodaledit #operation_type_amount223').val());
|
||
$("#stepmodaledit #operation_type_amount322").val($('#stepmodaledit #operation_type_amount32').val());
|
||
$("#stepmodaledit #operation_type_amount422").val($('#stepmodaledit #operation_type_amount42').val());
|
||
} else {
|
||
if ($("#operation_type_amount12").val() == "" && $("#operation_type_id12").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepmodaledit #operation_type_fa122").val($("#stepmodaledit #operation_type_id12").val() != 0 ? $("#stepmodaledit #operation_type_id12 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa222").val($("#stepmodaledit #operation_type_id223").val() != 0 ? $("#stepmodaledit #operation_type_id223 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa322").val($("#stepmodaledit #operation_type_id32").val() != 0 ? $("#stepmodaledit #operation_type_id32 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa422").val($("#stepmodaledit #operation_type_id42").val() != 0 ? $("#stepmodaledit #operation_type_id42 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_unit122").val($('#stepmodaledit #operation_type_unit12').val());
|
||
$("#stepmodaledit #operation_type_unit222").val($('#stepmodaledit #operation_type_unit223').val());
|
||
$("#stepmodaledit #operation_type_unit322").val($('#stepmodaledit #operation_type_unit32').val());
|
||
$("#stepmodaledit #operation_type_unit422").val($('#stepmodaledit #operation_type_unit42').val());
|
||
$("#stepmodaledit #operation_type_amount122").val($('#stepmodaledit #operation_type_amount12').val());
|
||
$("#stepmodaledit #operation_type_amount222").val($('#stepmodaledit #operation_type_amount223').val());
|
||
$("#stepmodaledit #operation_type_amount322").val($('#stepmodaledit #operation_type_amount32').val());
|
||
$("#stepmodaledit #operation_type_amount422").val($('#stepmodaledit #operation_type_amount42').val());
|
||
}
|
||
if ($("#operation_type_amount223").val() == "" && $("#operation_type_id223").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepmodaledit #operation_type_fa122").val($("#stepmodaledit #operation_type_id12").val() != 0 ? $("#stepmodaledit #operation_type_id12 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa222").val($("#stepmodaledit #operation_type_id223").val() != 0 ? $("#stepmodaledit #operation_type_id223 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa322").val($("#stepmodaledit #operation_type_id32").val() != 0 ? $("#stepmodaledit #operation_type_id32 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa422").val($("#stepmodaledit #operation_type_id42").val() != 0 ? $("#stepmodaledit #operation_type_id42 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_unit122").val($('#stepmodaledit #operation_type_unit12').val());
|
||
$("#stepmodaledit #operation_type_unit222").val($('#stepmodaledit #operation_type_unit223').val());
|
||
$("#stepmodaledit #operation_type_unit322").val($('#stepmodaledit #operation_type_unit32').val());
|
||
$("#stepmodaledit #operation_type_unit422").val($('#stepmodaledit #operation_type_unit42').val());
|
||
$("#stepmodaledit #operation_type_amount122").val($('#stepmodaledit #operation_type_amount12').val());
|
||
$("#stepmodaledit #operation_type_amount222").val($('#stepmodaledit #operation_type_amount223').val());
|
||
$("#stepmodaledit #operation_type_amount322").val($('#stepmodaledit #operation_type_amount32').val());
|
||
$("#stepmodaledit #operation_type_amount422").val($('#stepmodaledit #operation_type_amount42').val());
|
||
}
|
||
if ($("#operation_type_amount32").val() == "" && $("#operation_type_id32").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepmodaledit #operation_type_fa122").val($("#stepmodaledit #operation_type_id12").val() != 0 ? $("#stepmodaledit #operation_type_id12 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa222").val($("#stepmodaledit #operation_type_id223").val() != 0 ? $("#stepmodaledit #operation_type_id223 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa322").val($("#stepmodaledit #operation_type_id32").val() != 0 ? $("#stepmodaledit #operation_type_id32 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_fa422").val($("#stepmodaledit #operation_type_id42").val() != 0 ? $("#stepmodaledit #operation_type_id42 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_unit122").val($('#stepmodaledit #operation_type_unit12').val());
|
||
$("#stepmodaledit #operation_type_unit222").val($('#stepmodaledit #operation_type_unit223').val());
|
||
$("#stepmodaledit #operation_type_unit322").val($('#stepmodaledit #operation_type_unit32').val());
|
||
$("#stepmodaledit #operation_type_unit422").val($('#stepmodaledit #operation_type_unit42').val());
|
||
$("#stepmodaledit #operation_type_amount122").val($('#stepmodaledit #operation_type_amount12').val());
|
||
$("#stepmodaledit #operation_type_amount222").val($('#stepmodaledit #operation_type_amount223').val());
|
||
$("#stepmodaledit #operation_type_amount322").val($('#stepmodaledit #operation_type_amount32').val());
|
||
$("#stepmodaledit #operation_type_amount422").val($('#stepmodaledit #operation_type_amount42').val());
|
||
}
|
||
if ($("#operation_type_amount42").val() == "" && $("#operation_type_id42").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#stepmodaledit #operation_type_id122").val($("#stepmodaledit #operation_type_id12").val() != 0 ? $("#stepmodaledit #operation_type_id12 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_id222").val($("#stepmodaledit #operation_type_id223").val() != 0 ? $("#stepmodaledit #operation_type_id223 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_id322").val($("#stepmodaledit #operation_type_id32").val() != 0 ? $("#stepmodaledit #operation_type_id32 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_id422").val($("#stepmodaledit #operation_type_id42").val() != 0 ? $("#stepmodaledit #operation_type_id42 option:selected").text() : '');
|
||
$("#stepmodaledit #operation_type_unit122").val($('#stepmodaledit #operation_type_unit12').val());
|
||
$("#stepmodaledit #operation_type_unit222").val($('#stepmodaledit #operation_type_unit223').val());
|
||
$("#stepmodaledit #operation_type_unit322").val($('#stepmodaledit #operation_type_unit32').val());
|
||
$("#stepmodaledit #operation_type_unit422").val($('#stepmodaledit #operation_type_unit42').val());
|
||
$("#stepmodaledit #operation_type_amount122").val($('#stepmodaledit #operation_type_amount12').val());
|
||
$("#stepmodaledit #operation_type_amount222").val($('#stepmodaledit #operation_type_amount223').val());
|
||
$("#stepmodaledit #operation_type_amount322").val($('#stepmodaledit #operation_type_amount32').val());
|
||
$("#stepmodaledit #operation_type_amount422").val($('#stepmodaledit #operation_type_amount42').val());
|
||
}
|
||
}
|
||
if ($("#stepmodaledit #operation_type_id12").val() == 0) {
|
||
$("#operation_type_progress122").attr("disabled", true);
|
||
$("#operation_type_tonaj122").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress122").attr("disabled", false);
|
||
$("#operation_type_tonaj122").attr("disabled", false);
|
||
}
|
||
if ($("#stepmodaledit #operation_type_id223").val() == 0) {
|
||
$("#operation_type_progress222").attr("disabled", true);
|
||
$("#operation_type_tonaj222").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress222").attr("disabled", false);
|
||
$("#operation_type_tonaj222").attr("disabled", false);
|
||
}
|
||
if ($("#stepmodaledit #operation_type_id32").val() == 0) {
|
||
$("#operation_type_progress322").attr("disabled", true);
|
||
$("#operation_type_tonaj322").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress322").attr("disabled", false);
|
||
$("#operation_type_tonaj322").attr("disabled", false);
|
||
}
|
||
if ($("#stepmodaledit #operation_type_id42").val() == 0) {
|
||
$("#operation_type_progress422").attr("disabled", true);
|
||
$("#operation_type_tonaj422").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress422").attr("disabled", false);
|
||
$("#operation_type_tonaj422").attr("disabled", false);
|
||
}
|
||
});
|
||
|
||
$("#operation_type_id1").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1 option').css('display', '');
|
||
$('#operation_type_id2 option').css('display', '');
|
||
$('#operation_type_id3 option').css('display', '');
|
||
$('#operation_type_id4 option').css('display', '');
|
||
var operation_type_saved = [];
|
||
operation_type_saved[0] = $('#operation_type_id1').val();
|
||
operation_type_saved[1] = $('#operation_type_id2').val();
|
||
operation_type_saved[2] = $('#operation_type_id3').val();
|
||
operation_type_saved[3] = $('#operation_type_id4').val();
|
||
for (var i = 0; i < operation_type_saved.length; i++) {
|
||
$('#operation_type_id1 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1 option[value="0"]').css('display', '');
|
||
$('#operation_type_id2 option[value="0"]').css('display', '');
|
||
$('#operation_type_id3 option[value="0"]').css('display', '');
|
||
$('#operation_type_id4 option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id2").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1 option').css('display', '');
|
||
$('#operation_type_id2 option').css('display', '');
|
||
$('#operation_type_id3 option').css('display', '');
|
||
$('#operation_type_id4 option').css('display', '');
|
||
var operation_type_saved = [];
|
||
operation_type_saved[0] = $('#operation_type_id1').val();
|
||
operation_type_saved[1] = $('#operation_type_id2').val();
|
||
operation_type_saved[2] = $('#operation_type_id3').val();
|
||
operation_type_saved[3] = $('#operation_type_id4').val();
|
||
for (var i = 0; i < operation_type_saved.length; i++) {
|
||
$('#operation_type_id1 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1 option[value="0"]').css('display', '');
|
||
$('#operation_type_id2 option[value="0"]').css('display', '');
|
||
$('#operation_type_id3 option[value="0"]').css('display', '');
|
||
$('#operation_type_id4 option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id3").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1 option').css('display', '');
|
||
$('#operation_type_id2 option').css('display', '');
|
||
$('#operation_type_id3 option').css('display', '');
|
||
$('#operation_type_id4 option').css('display', '');
|
||
var operation_type_saved = [];
|
||
operation_type_saved[0] = $('#operation_type_id1').val();
|
||
operation_type_saved[1] = $('#operation_type_id2').val();
|
||
operation_type_saved[2] = $('#operation_type_id3').val();
|
||
operation_type_saved[3] = $('#operation_type_id4').val();
|
||
for (var i = 0; i < operation_type_saved.length; i++) {
|
||
$('#operation_type_id1 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1 option[value="0"]').css('display', '');
|
||
$('#operation_type_id2 option[value="0"]').css('display', '');
|
||
$('#operation_type_id3 option[value="0"]').css('display', '');
|
||
$('#operation_type_id4 option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id4").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1 option').css('display', '');
|
||
$('#operation_type_id2 option').css('display', '');
|
||
$('#operation_type_id3 option').css('display', '');
|
||
$('#operation_type_id4 option').css('display', '');
|
||
var operation_type_saved = [];
|
||
operation_type_saved[0] = $('#operation_type_id1').val();
|
||
operation_type_saved[1] = $('#operation_type_id2').val();
|
||
operation_type_saved[2] = $('#operation_type_id3').val();
|
||
operation_type_saved[3] = $('#operation_type_id4').val();
|
||
for (var i = 0; i < operation_type_saved.length; i++) {
|
||
$('#operation_type_id1 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4 option[value="' + operation_type_saved[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1 option[value="0"]').css('display', '');
|
||
$('#operation_type_id2 option[value="0"]').css('display', '');
|
||
$('#operation_type_id3 option[value="0"]').css('display', '');
|
||
$('#operation_type_id4 option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
|
||
$(".btn-applyChangeNew").on("click", function () {
|
||
if ($("#project_type").val() == 1) {
|
||
if ($("#operation_type_amount1").val() != "") {
|
||
if ($("#operation_type_tonaj1").val() == "") {
|
||
$("#operation_type_tonaj1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj1").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj1").attr("disabled", true)
|
||
$("#operation_type_tonaj1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2").val() != "") {
|
||
if ($("#operation_type_tonaj2").val() == "") {
|
||
$("#operation_type_tonaj2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj2").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj2").attr("disabled", true)
|
||
$("#operation_type_tonaj2").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount3").val() != "") {
|
||
if ($("#operation_type_tonaj3").val() == "") {
|
||
$("#operation_type_tonaj3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj3").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj3").attr("disabled", true)
|
||
$("#operation_type_tonaj3").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount4").val() != "") {
|
||
if ($("#operation_type_tonaj4").val() == "") {
|
||
$("#operation_type_tonaj4").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj4").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj4").attr("disabled", true)
|
||
$("#operation_type_tonaj4").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
|
||
|
||
if ($("#operation_type_amount1").val() != "") {
|
||
|
||
$("#operation_type_progress1").attr("disabled", false);
|
||
if ($("#operation_type_progress1").val() == "") {
|
||
$("#operation_type_progress1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress1").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress1").attr("disabled", false);
|
||
$("#operation_type_progress1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2").val() != "") {
|
||
$("#operation_type_progress2").attr("disabled", false);
|
||
if ($("#operation_type_progress2").val() == "") {
|
||
$("#operation_type_progress2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress2").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress2").attr("disabled", true);
|
||
$("#operation_type_progress2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount3").val() != "") {
|
||
$("#operation_type_progress3").attr("disabled", false);
|
||
if ($("#operation_type_progress3").val() == "") {
|
||
$("#operation_type_progress3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress3").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress3").attr("disabled", true);
|
||
$("#operation_type_progress3").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount4").val() != "") {
|
||
$("#operation_type_progress4").attr("disabled", false);
|
||
if ($("#operation_type_progress4").val() == "") {
|
||
$("#operation_type_progress4").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress4").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress4").attr("disabled", true);
|
||
$("#operation_type_progress4").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#last_status_id").val() == 2) {
|
||
|
||
if (parseInt($("#progress_project3").val()) > 10 && parseInt($("#progress_project3").val()) < 100) {
|
||
$("#progress_project3").removeClass("is-invalid-input");
|
||
$("#progress_project3_span").addClass("d-none");
|
||
} else {
|
||
$("#progress_project3").addClass("is-invalid-input");
|
||
$("#progress_project3_span").removeClass("d-none");
|
||
}
|
||
}
|
||
|
||
if ($("#project_type").val() == 0) {
|
||
$("#project_type").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_type").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_type").val() == 2 || $("#project_type").val() == 4 || $("#project_type").val() == 5) {
|
||
$("#operation_type_amount1").removeClass("is-invalid-input");
|
||
$("#operation_type_amount2").removeClass("is-invalid-input");
|
||
$("#operation_type_amount3").removeClass("is-invalid-input");
|
||
$("#operation_type_amount4").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_id1").val() == 0) {
|
||
$("#operation_type_id1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_id1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_name").val() == "") {
|
||
$("#operator_name").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_name").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_phone").val().length != 11) {
|
||
$("#operator_phone").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_phone").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#projectrateid").val() == 0) {
|
||
$("#projectrateid").addClass("is-invalid-input");
|
||
} else {
|
||
$("#projectrateid").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#city_id").val() == 0) {
|
||
$("#city_id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#city_id").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_name_fa").val() == "") {
|
||
$("#axis_name_fa").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_name_fa").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_type_id").val() == 0) {
|
||
$("#axis_type_id").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_type_id").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#followup_priority_project").val() == 0) {
|
||
$("#followup_priority_project").addClass("is-invalid-input");
|
||
} else {
|
||
$("#followup_priority_project").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali1").val() == "") {
|
||
$("#riali1").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali1").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali2").val() == "") {
|
||
$("#riali2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali3").val() == "") {
|
||
$("#riali3").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali3").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali4").val() == "") {
|
||
$("#riali4").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali4").removeClass("is-invalid-input");
|
||
}
|
||
if ($("input[name=abrar-project-latlng-start]").val() == "") {
|
||
$("input[name=abrar-project-latlng-start]").addClass("is-invalid-input");
|
||
} else {
|
||
$("input[name=abrar-project-latlng-start]").removeClass("is-invalid-input");
|
||
}
|
||
if ($("input[name=abrar-project-latlng-end]").val() == "") {
|
||
$("input[name=abrar-project-latlng-end]").addClass("is-invalid-input");
|
||
} else {
|
||
$("input[name=abrar-project-latlng-end]").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#deviceImg1Title").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
if ($("#deviceImg2Title").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
var project_title = $("#project_name").val();
|
||
var project_type = $("#project_type").val();
|
||
var axis_name_fa = $("#axis_name_fa").val();
|
||
var axis_type_id = $("#axis_type_id").val();
|
||
var last_digit_project = $("#riali1").val();
|
||
var last_function_operator = $("#riali2").val();
|
||
var last_payable_operator = $("#riali3").val();
|
||
var complete_payable = $("#riali4").val();
|
||
var city_id = $("#city_id").val();
|
||
var operator_name = $("#operator_name").val();
|
||
var operator_phone = $("#operator_phone").val();
|
||
if ($("#last_status_id").css("display") == "none") {
|
||
$("#last_status_id").removeClass("is-invalid-input");
|
||
} else if ($("#last_status_id").css("display") != "none" && $("#last_status_id").val() == 0) {
|
||
$("#last_status_id").addClass("is-invalid-input");
|
||
} else if ($("#last_status_id").css("display") != "none" && $("#last_status_id").val() != 0) {
|
||
$("#last_status_id").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#last_status_id").css("display") == "none" && $("#last_status_id3").css("display") == "none") {
|
||
var last_status_id = $("#last_status_id2").val();
|
||
} else if ($("#last_status_id2").css("display") == "none" && $("#last_status_id").css("display") == "none") {
|
||
var last_status_id = $("#last_status_id3").val();
|
||
} else {
|
||
var last_status_id = $("#last_status_id").val();
|
||
}
|
||
var followup_priority_project = $("#followup_priority_project").val();
|
||
if ($("#progress_project").css("display") != "none") {
|
||
var progress_project = $("#progress_project").val();
|
||
} else if ($("#progress_project3").css("display") != "none") {
|
||
var progress_project = $("#progress_project3").val();
|
||
} else if ($("#progress_project4").css("display") != "none") {
|
||
var progress_project = $("#progress_project4").val();
|
||
} else if ($("#progress_project5").css("display") != "none") {
|
||
var progress_project = $("#progress_project5").val();
|
||
} else if ($("#progress_project6").css("display") != "none") {
|
||
var progress_project = $("#progress_project6").val();
|
||
}
|
||
var operation_type_id1 = $("#operation_type_id1").val();
|
||
var operation_type_id2 = $("#operation_type_id2").val();
|
||
var operation_type_id3 = $("#operation_type_id3").val();
|
||
var operation_type_id4 = $("#operation_type_id4").val();
|
||
var operation_type_amount1 = $("#operation_type_amount1").val();
|
||
var operation_type_amount2 = $("#operation_type_amount2").val();
|
||
var operation_type_amount3 = $("#operation_type_amount3").val();
|
||
var operation_type_amount4 = $("#operation_type_amount4").val();
|
||
var operation_type_progress1 = $("#operation_type_progress1").val();
|
||
var operation_type_progress2 = $("#operation_type_progress2").val();
|
||
var operation_type_progress3 = $("#operation_type_progress3").val();
|
||
var operation_type_progress4 = $("#operation_type_progress4").val();
|
||
var operation_type_tonaj1 = $("#operation_type_tonaj1").val();
|
||
var operation_type_tonaj2 = $("#operation_type_tonaj2").val();
|
||
var operation_type_tonaj3 = $("#operation_type_tonaj3").val();
|
||
var operation_type_tonaj4 = $("#operation_type_tonaj4").val();
|
||
var projectrateid = $("#projectrateid").val();
|
||
var image1 = $("#deviceImg1").get(0).files[0];
|
||
var image2 = $("#deviceImg2").get(0).files[0];
|
||
|
||
var start_lat = startAbrarMarker.getLatLng().lat.toFixed(6)
|
||
var start_lng = startAbrarMarker.getLatLng().lng.toFixed(6)
|
||
var end_lat = endAbrarMarker.getLatLng().lat.toFixed(6)
|
||
var end_lng = endAbrarMarker.getLatLng().lng.toFixed(6)
|
||
|
||
var requestDa = new FormData();
|
||
|
||
requestDa.append('addNewSubitemStatus', addNewSubitemStatus);
|
||
requestDa.append('contract_id', vidpaiini);
|
||
requestDa.append('city_id', city_id);
|
||
requestDa.append('province_id', province_idpaiini);
|
||
requestDa.append('project_type_id', project_type);
|
||
requestDa.append('axis_type_id', axis_type_id);
|
||
requestDa.append('last_status_id', last_status_id);
|
||
requestDa.append('project_title', project_title);
|
||
requestDa.append('operation_type_id1', operation_type_id1);
|
||
requestDa.append('operation_type_id2', operation_type_id2);
|
||
requestDa.append('operation_type_id3', operation_type_id3);
|
||
requestDa.append('operation_type_id4', operation_type_id4);
|
||
requestDa.append('operation_type_amount1', operation_type_amount1);
|
||
requestDa.append('operation_type_amount2', operation_type_amount2);
|
||
requestDa.append('operation_type_amount3', operation_type_amount3);
|
||
requestDa.append('operation_type_amount4', operation_type_amount4);
|
||
requestDa.append('operation_type_progress1', operation_type_progress1);
|
||
requestDa.append('operation_type_progress2', operation_type_progress2);
|
||
requestDa.append('operation_type_progress3', operation_type_progress3);
|
||
requestDa.append('operation_type_progress4', operation_type_progress4);
|
||
requestDa.append('operation_type_tonaj1', operation_type_tonaj1);
|
||
requestDa.append('operation_type_tonaj2', operation_type_tonaj2);
|
||
requestDa.append('operation_type_tonaj3', operation_type_tonaj3);
|
||
requestDa.append('operation_type_tonaj4', operation_type_tonaj4);
|
||
requestDa.append('axis_name_fa', axis_name_fa);
|
||
requestDa.append('start_lat', start_lat);
|
||
requestDa.append('start_lng', start_lng);
|
||
requestDa.append('end_lat', end_lat);
|
||
requestDa.append('end_lng', end_lng);
|
||
requestDa.append('followup_priority_project_id', followup_priority_project);
|
||
requestDa.append('priority_project', projectrateid);
|
||
requestDa.append('operator_name', operator_name);
|
||
requestDa.append('operator_phone', operator_phone);
|
||
requestDa.append('progress_project', progress_project);
|
||
requestDa.append('last_digit_project', last_digit_project);
|
||
requestDa.append('last_function_operator', last_function_operator);
|
||
requestDa.append('last_payable_operator', last_payable_operator);
|
||
requestDa.append('complete_payable', complete_payable);
|
||
requestDa.append('image1', image1);
|
||
requestDa.append('image2', image2);
|
||
for (var pair of requestDa.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#stepModalunderpro").find(".is-invalid-input").length || $("#deviceImg1Title").css("display") != "none" || $("#deviceImg2Title").css("display") != "none") {
|
||
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تمامی فیلدهای مرتبط را تکمیل کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
showLoaderScreen()
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/store",
|
||
type: "POST",
|
||
data: requestDa,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
$("#stepModalunderpro").modal("hide");
|
||
table.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
});
|
||
$(".under_project_edit").on("click", function () {
|
||
if ($("#project_type2").val() == 0) {
|
||
$("#project_type2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_type2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_id12").val() == 0) {
|
||
$("#operation_type_id12").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_id12").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_name2").val() == "") {
|
||
$("#operator_name2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_name2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_phone2").val().length != 11) {
|
||
$("#operator_phone2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_phone2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#projectrateid2").val() == 0) {
|
||
$("#projectrateid2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#projectrateid2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#city_id2").val() == 0) {
|
||
$("#city_id2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#city_id2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_name_fa2").val() == "") {
|
||
$("#axis_name_fa2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_name_fa2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_type_id2").val() == 0) {
|
||
$("#axis_type_id2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_type_id2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#followup_priority_project2").val() == 0) {
|
||
$("#followup_priority_project2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#followup_priority_project2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#last_status_id2").val() == 0) {
|
||
$("#last_status_id2").addClass("is-invalid-input");
|
||
} else {
|
||
$("#last_status_id2").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali12").val() == "") {
|
||
$("#riali12").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali12").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali22").val() == "") {
|
||
$("#riali22").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali22").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali32").val() == "") {
|
||
$("#riali32").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali3").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali42").val() == "") {
|
||
$("#riali42").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali42").removeClass("is-invalid-input");
|
||
}
|
||
if ($(".input_modal_table6").css("display") != "none") {
|
||
if (!$("#operation_type_progress122").attr("disabled")) {
|
||
if ($("#operation_type_progress122").val() == "") {
|
||
$("#operation_type_progress122").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress122").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_progress222").attr("disabled")) {
|
||
if ($("#operation_type_progress222").val() == "") {
|
||
$("#operation_type_progress222").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress222").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_progress322").attr("disabled")) {
|
||
if ($("#operation_type_progress322").val() == "") {
|
||
$("#operation_type_progress322").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress322").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_progress422").attr("disabled")) {
|
||
if ($("#operation_type_progress422").val() == "") {
|
||
$("#operation_type_progress422").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress422").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if ($("#project_type2").val() == 1) {
|
||
if (!$("#operation_type_tonaj122").attr("disabled")) {
|
||
if ($("#operation_type_tonaj122").val() == "") {
|
||
$("#operation_type_tonaj122").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj122").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_tonaj222").attr("disabled")) {
|
||
if ($("#operation_type_tonaj222").val() == "") {
|
||
$("#operation_type_tonaj222").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj222").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_tonaj322").attr("disabled")) {
|
||
if ($("#operation_type_tonaj322").val() == "") {
|
||
$("#operation_type_tonaj322").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj322").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if (!$("#operation_type_tonaj422").attr("disabled")) {
|
||
if ($("#operation_type_tonaj422").val() == "") {
|
||
$("#operation_type_tonaj422").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj422").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj122").removeClass("is-invalid-input");
|
||
$("#operation_type_tonaj222").removeClass("is-invalid-input");
|
||
$("#operation_type_tonaj322").removeClass("is-invalid-input");
|
||
$("#operation_type_tonaj422").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
if ($("#deviceImg12Title").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
if ($("#deviceImg22Title").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
|
||
|
||
if ($("#last_status_id12").val() == 2) {
|
||
if (parseInt($("#progress_project2").val()) > 10 && parseInt($("#progress_project2").val()) < 100) {
|
||
$("#progress_project2").removeClass("is-invalid-input");
|
||
$("#progress_project2_span").addClass("d-none");
|
||
} else {
|
||
$("#progress_project2").addClass("is-invalid-input");
|
||
$("#progress_project2_span").removeClass("d-none");
|
||
}
|
||
}
|
||
var idpush = unstar.id;
|
||
|
||
var project_name2 = $("#project_name2").val();
|
||
var project_type2 = $("#project_type2").val();
|
||
|
||
var operation_type_id12 = $("#stepmodaledit #operation_type_id12").val();
|
||
var operation_type_id22 = $("#stepmodaledit #operation_type_id223").val();
|
||
var operation_type_id32 = $("#stepmodaledit #operation_type_id32").val();
|
||
var operation_type_id42 = $("#stepmodaledit #operation_type_id42").val();
|
||
|
||
var operation_type_amount12 = $("#stepmodaledit #operation_type_amount12").val();
|
||
var operation_type_amount22 = $("#stepmodaledit #operation_type_amount223").val();
|
||
var operation_type_amount32 = $("#stepmodaledit #operation_type_amount32").val();
|
||
var operation_type_amount42 = $("#stepmodaledit #operation_type_amount42").val();
|
||
|
||
var operation_type_unit12 = $("#stepmodaledit #operation_type_unit12").val();
|
||
var operation_type_unit22 = $("#stepmodaledit #operation_type_unit223").val();
|
||
var operation_type_unit32 = $("#stepmodaledit #operation_type_unit32").val();
|
||
var operation_type_unit42 = $("#stepmodaledit #operation_type_unit42").val();
|
||
|
||
var operation_type_progress122 = $("#stepmodaledit #operation_type_progress122").val();
|
||
var operation_type_progress222 = $("#stepmodaledit #operation_type_progress222").val();
|
||
var operation_type_progress322 = $("#stepmodaledit #operation_type_progress322").val();
|
||
var operation_type_progress422 = $("#stepmodaledit #operation_type_progress422").val();
|
||
|
||
var operation_type_tonaj122 = $("#stepmodaledit #operation_type_tonaj122").val();
|
||
var operation_type_tonaj222 = $("#stepmodaledit #operation_type_tonaj222").val();
|
||
var operation_type_tonaj322 = $("#stepmodaledit #operation_type_tonaj322").val();
|
||
var operation_type_tonaj422 = $("#stepmodaledit #operation_type_tonaj422").val();
|
||
|
||
var operator_name2 = $("#stepmodaledit #operator_name2").val();
|
||
var operator_phone2 = $("#stepmodaledit #operator_phone2").val();
|
||
var projectrateid2 = $("#stepmodaledit #projectrateid2").val();
|
||
var city_id2 = $("#stepmodaledit #city_id2").val();
|
||
var axis_name_fa2 = $("#stepmodaledit #axis_name_fa2").val();
|
||
var axis_type_id2 = $("#stepmodaledit #axis_type_id2").val();
|
||
var followup_priority_project2 = $("#stepmodaledit #followup_priority_project2").val();
|
||
var progress_project2 = $("#stepmodaledit #progress_project2").val();
|
||
if ($("#stepmodaledit #last_status_id12").css("display") == "none" && $("#stepmodaledit #last_status_id32").css("display") == "none") {
|
||
var last_status_id12 = $("#stepmodaledit #last_status_id22").val();
|
||
} else if ($("#stepmodaledit #last_status_id22").css("display") == "none" && $("#stepmodaledit #last_status_id12").css("display") == "none") {
|
||
var last_status_id12 = $("#stepmodaledit #last_status_id32").val();
|
||
} else {
|
||
var last_status_id12 = $("#stepmodaledit #last_status_id12").val();
|
||
}
|
||
var riali12 = $("#stepmodaledit #riali12").val();
|
||
var riali22 = $("#stepmodaledit #riali22").val();
|
||
var riali32 = $("#stepmodaledit #riali32").val();
|
||
var riali42 = $("#stepmodaledit #riali42").val();
|
||
|
||
var deviceImg12 = $("#stepmodaledit #deviceImg12").get(0).files[0];
|
||
var deviceImg22 = $("#stepmodaledit #deviceImg22").get(0).files[0];
|
||
var start_lat2 = startAbrarMarkershow.getLatLng().lat.toFixed(6)
|
||
var start_lng2 = startAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
var end_lat2 = endAbrarMarkershow.getLatLng().lat.toFixed(6)
|
||
var end_lng2 = endAbrarMarkershow.getLatLng().lng.toFixed(6)
|
||
|
||
var requnderpro = new FormData();
|
||
|
||
requnderpro.append('project_title', project_name2);
|
||
requnderpro.append('project_type_id', project_type2);
|
||
requnderpro.append('operation_type_id1', operation_type_id12);
|
||
requnderpro.append('operation_type_id2', operation_type_id22);
|
||
requnderpro.append('operation_type_id3', operation_type_id32);
|
||
requnderpro.append('operation_type_id4', operation_type_id42);
|
||
requnderpro.append('operation_type_amount1', operation_type_amount12);
|
||
requnderpro.append('operation_type_amount2', operation_type_amount22);
|
||
requnderpro.append('operation_type_amount3', operation_type_amount32);
|
||
requnderpro.append('operation_type_amount4', operation_type_amount42);
|
||
requnderpro.append('operation_type_unit1', operation_type_unit12);
|
||
requnderpro.append('operation_type_unit2', operation_type_unit22);
|
||
requnderpro.append('operation_type_unit3', operation_type_unit32);
|
||
requnderpro.append('operation_type_unit4', operation_type_unit42);
|
||
requnderpro.append('operation_type_progress1', operation_type_progress122);
|
||
requnderpro.append('operation_type_progress2', operation_type_progress222);
|
||
requnderpro.append('operation_type_progress3', operation_type_progress322);
|
||
requnderpro.append('operation_type_progress4', operation_type_progress422);
|
||
requnderpro.append('operation_type_tonaj1', operation_type_tonaj122);
|
||
requnderpro.append('operation_type_tonaj2', operation_type_tonaj222);
|
||
requnderpro.append('operation_type_tonaj3', operation_type_tonaj322);
|
||
requnderpro.append('operation_type_tonaj4', operation_type_tonaj422);
|
||
requnderpro.append('operator_name', operator_name2);
|
||
requnderpro.append('operator_phone', operator_phone2);
|
||
requnderpro.append('priority_project', projectrateid2);
|
||
requnderpro.append('city_id', city_id2);
|
||
requnderpro.append('province_id', province_id3);
|
||
requnderpro.append('axis_name_fa', axis_name_fa2);
|
||
requnderpro.append('axis_type_id', axis_type_id2);
|
||
requnderpro.append('followup_priority_project', followup_priority_project2);
|
||
requnderpro.append('progress_project', progress_project2);
|
||
requnderpro.append('last_status_id', last_status_id12);
|
||
requnderpro.append('last_digit_project', riali12);
|
||
requnderpro.append('last_function_operator', riali22);
|
||
requnderpro.append('last_payable_operator', riali32);
|
||
requnderpro.append('complete_payable', riali42);
|
||
requnderpro.append('start_lat', start_lat2);
|
||
requnderpro.append('start_lng', start_lng2);
|
||
requnderpro.append('end_lat', end_lat2);
|
||
requnderpro.append('end_lng', end_lng2);
|
||
if (typeof deviceImg12 !== "undefined")
|
||
requnderpro.append('image1', deviceImg12);
|
||
if (typeof deviceImg22 !== "undefined")
|
||
requnderpro.append('image2', deviceImg22);
|
||
|
||
for (var pair of requnderpro.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#stepmodaledit").find(".is-invalid-input").length || $("#deviceImg12Title").css("display") != "none" || $("#deviceImg22Title").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تمامی فیلدهای مرتبط را تکمیل کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
showLoaderScreen()
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/update/"+ idpush,
|
||
type: "POST",
|
||
data: requnderpro,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
$("#stepmodaledit").modal("hide");
|
||
subItemTable.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
});
|
||
|
||
|
||
$("#examplefinance").on("click", "button.details-control", function () {
|
||
$(".select2-container").removeClass("is-invalid-input");
|
||
$('#checkbox1edit').prop('checked', false);
|
||
$('#checkbox2edit').prop('checked', false);
|
||
$('#checkbox3edit').prop('checked', false);
|
||
$('#checkbox4edit').prop('checked', false);
|
||
$("#meliwrapperedit").css('display', 'none')
|
||
$("#setadiwrapperedit").css('display', 'none')
|
||
choosenideaedit.length = 0;
|
||
choosentarhedit.length = 0;
|
||
choosenmaliedit.length = 0;
|
||
choosesetadiedit.length = 0;
|
||
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
idtable = row.data().id;
|
||
var mojavezshow = row.data().contract_mojavez_array;
|
||
var office_id = row.data().office_id;
|
||
var province_id = row.data().province_id;
|
||
var provincefa = row.data().province_fa;
|
||
|
||
var title = row.data().title;
|
||
var status_id = row.data().status_id;
|
||
var contract_date = row.data().contract_date;
|
||
var contract_peymankar = row.data().contract_peymankar;
|
||
var contract_moshaver_tarahi = row.data().contract_moshaver_tarahi;
|
||
var contract_moshaver_nezarat = row.data().contract_moshaver_nezarat;
|
||
var contract_credit = row.data().contract_credit;
|
||
var contract_credit_province = row.data().contract_credit_province;
|
||
var contract_mojavez_data_meli_array = row.data().contract_mojavez_data_meli_array;
|
||
var contract_mojavez_data_setad_array = row.data().contract_mojavez_data_setad_array;
|
||
var contract_credit_national_array = row.data().contract_credit_national_array;
|
||
var contract_tarh_array = row.data().contract_tarh_array;
|
||
var contract_mojavez_array = row.data().contract_mojavez_array;
|
||
|
||
showprovincename(province_id)
|
||
if (contract_mojavez_array != null) {
|
||
|
||
var nameArr = mojavezshow.split(',');
|
||
for (var i = 0; i < nameArr.length; i++) {
|
||
if (nameArr[i] == 1) {
|
||
$('#checkbox1edit').prop('checked', true);
|
||
showtable1(provincefa, contract_mojavez_data_meli_array, contract_credit_national_array, contract_tarh_array)
|
||
relatedpostedit.push(1)
|
||
} else if (nameArr[i] == 2) {
|
||
$('#checkbox2edit').prop('checked', true);
|
||
showinput(contract_credit_province)
|
||
relatedpostedit.push(2)
|
||
|
||
} else if (nameArr[i] == 3) {
|
||
$('#checkbox3edit').prop('checked', true);
|
||
showtable3(contract_mojavez_data_setad_array)
|
||
relatedpostedit.push(3)
|
||
|
||
} else {
|
||
$('#checkbox4edit').prop('checked', true);
|
||
relatedpostedit.push(4)
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
$("#modaledit").modal("show")
|
||
$("#province-idedit").val(province_id)
|
||
$("#edarekoledit").val(office_id)
|
||
$("#project_titleedit").val(title)
|
||
$("#project_statusedit").val(status_id)
|
||
$("#dateofprojectedit").val(contract_date)
|
||
$("#peymankar_nameedit").val(contract_peymankar)
|
||
$("#designer_nameedit").val(contract_moshaver_tarahi)
|
||
$("#nezarat_nameedit").val(contract_moshaver_nezarat)
|
||
$("#contract_moneyedit").val(contract_credit)
|
||
$("#contract_moneyedit_span").text(contract_credit)
|
||
|
||
|
||
})
|
||
|
||
function showprovincename(num) {
|
||
$("#province-idedit").empty();
|
||
$("#province-idedit").append('<option value="0">انتخاب اداره کل</option>');
|
||
|
||
for (let index = 0; index < provinces.length; index++) {
|
||
if (index + 1 == num) {
|
||
$("#province-idedit").append(
|
||
"\
|
||
<option selected value=" +
|
||
provinces[index].id +
|
||
">" +
|
||
provinces[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
} else {
|
||
$("#province-idedit").append(
|
||
"\
|
||
<option value=" +
|
||
provinces[index].id +
|
||
">" +
|
||
provinces[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
function showtable1(pro, datameliarr, nationalarr, tarharr) {
|
||
var tarhshow = tarharr.split(',');
|
||
|
||
$("#meliwrapperedit").css("display", "block")
|
||
$("#eblagh_maliedit").val(datameliarr)
|
||
$("#eblagh_maliedit_span").text(datameliarr)
|
||
$('.js-example-basic-multipletarhedit ').val(tarhshow).trigger('change');
|
||
}
|
||
|
||
function showtable3(setadarray) {
|
||
|
||
$("#setadiwrapperedit").css("display", "block")
|
||
|
||
$("#setad_inputedit").val(setadarray)
|
||
$("#setad_inputedit_span").text(setadarray)
|
||
}
|
||
|
||
function showinput(name) {
|
||
$("#ostani_numedit").css("display", "block")
|
||
$("#ostani_labeledit").css("display", "block")
|
||
$("#ostani_numedit_span").css("display", "block")
|
||
|
||
$("#ostani_numedit").val(name)
|
||
$("#ostani_numedit_span").text(name)
|
||
}
|
||
|
||
$("#submitedit").on("click", function () {
|
||
if ($("#edarekoledit").val() == 0) {
|
||
$("#edarekoledit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#edarekoledit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#province-idedit").val() == 0) {
|
||
$("#province-idedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#province-idedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_titleedit").val() == "") {
|
||
$("#project_titleedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_titleedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_statusedit").val() == 0) {
|
||
$("#project_statusedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_statusedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#dateofprojectedit").val() == "") {
|
||
$("#dateofprojectedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#dateofprojectedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#peymankar_nameedit").val() == "") {
|
||
$("#peymankar_nameedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#peymankar_nameedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#designer_nameedit").val() == "") {
|
||
$("#designer_nameedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#designer_nameedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#nezarat_nameedit").val() == "") {
|
||
$("#nezarat_nameedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#nezarat_nameedit").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#contract_moneyedit").val() == "") {
|
||
$("#contract_moneyedit").addClass("is-invalid-input");
|
||
} else {
|
||
$("#contract_moneyedit").removeClass("is-invalid-input");
|
||
}
|
||
eblaghmoneyedit = $("#eblagh_maliedit").val()
|
||
etadmoneyedit = $("#setad_inputedit").val()
|
||
var eblaghtarhedit = []
|
||
var eblaghtarhedit = []
|
||
$(".js-example-basic-multipletarhedit")
|
||
.select2("data")
|
||
.forEach((element) => {
|
||
eblaghtarhedit.push(element.text);
|
||
});
|
||
for (var i = 0; i < choosenideaedit.length; i++) {
|
||
malistringedit = malistringedit + choosenideaedit[i] + "-"
|
||
}
|
||
meli_contractedit = malistringedit
|
||
|
||
for (var i = 0; i < choosentarhedit.length; i++) {
|
||
melitarhedit = melitarhedit + choosentarhedit[i] + "-"
|
||
}
|
||
meli_tarhedit = melitarhedit
|
||
|
||
|
||
for (var i = 0; i < choosenmaliedit.length; i++) {
|
||
malitarhedit = malitarhedit + choosenmaliedit[i] + "-"
|
||
}
|
||
mali_tarhedit = malitarhedit
|
||
|
||
|
||
for (var i = 0; i < choosesetadiedit.length; i++) {
|
||
setadistringedit = setadistringedit + choosesetadiedit[i] + "-"
|
||
}
|
||
setadi_contractedit = setadistringedit
|
||
|
||
|
||
|
||
var office = $("#edarekoledit").children("option:selected").val();
|
||
var officefa = $("#edarekoledit").children("option:selected").text();
|
||
var province = $("#province-idedit").children("option:selected").val();
|
||
var provincetext = $("#province-idedit").children("option:selected").text();
|
||
var projecttitle = $("#project_titleedit").val();
|
||
var project_status = $("#project_statusedit").children("option:selected").val();
|
||
var project_status_fa = $("#project_statusedit").children("option:selected").text();
|
||
|
||
var dateofproject = $("#dateofprojectedit").val();
|
||
var designer_name = $("#designer_nameedit").val();
|
||
var contract_money = $("#contract_moneyedit").val();
|
||
var peymankar_name = $("#peymankar_nameedit").val();
|
||
var nezarat_name = $("#nezarat_nameedit").val();
|
||
|
||
var ostani_num = $("#ostani_numedit").val()
|
||
|
||
for (var i = 0; i < relatedpostedit.length; i++) {
|
||
choosenitemedit = choosenitemedit + relatedpostedit[i] + "-"
|
||
}
|
||
choosenlastedit = choosenitemedit
|
||
|
||
|
||
for (var i = 0; i < relatedpostedit.length; i++) {
|
||
if (relatedpostedit[i] == 1) {
|
||
choosenitemfaedit = choosenitemfaedit + "ابلاغ اعتبار ملی" + "-"
|
||
} else if (relatedpostedit[i] == 2) {
|
||
choosenitemfaedit = choosenitemfaedit + "ابلاغ اعتبار استانی" + "-"
|
||
} else if (relatedpostedit[i] == 3) {
|
||
choosenitemfaedit = choosenitemfaedit + "مجوز صادره از ستاد" + "-"
|
||
} else if (relatedpostedit[i] == 4) {
|
||
choosenitemfaedit = choosenitemfaedit + "مجوز صادره در استان" + "-"
|
||
}
|
||
|
||
}
|
||
choosenlastfaedit = choosenitemfaedit
|
||
|
||
|
||
|
||
let contractDateMonth = timepickeredit.getState().selected.month;
|
||
let contractDateDay = timepickeredit.getState().selected.date;
|
||
let contractDateFormatted =
|
||
timepickeredit.getState().selected.year +
|
||
"-" +
|
||
contractDateMonth +
|
||
"-" +
|
||
contractDateDay;
|
||
|
||
var dateSplitted = contractDateFormatted.split("-")
|
||
|
||
|
||
|
||
if (relatedpostedit.length != 0) {
|
||
|
||
if ($('#checkbox1edit').is(':checked')) {
|
||
if (eblaghmoneyedit == "") {
|
||
alert(" لطفا مبلغ اعتبار ملی را وارد نمایید ")
|
||
$("#eblagh_maliedit").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
if (eblaghtarhedit.length > 0) {
|
||
if ($('#checkbox3edit').is(':checked')) {
|
||
if (etadmoneyedit == "") {
|
||
alert("لطفا مبلغ مجوز صادره از ستاد (میلیون ریال) را وارد نمایید ")
|
||
$("#setad_inputedit").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlastedit);
|
||
formData.append("contract_mojavez_array", relatedpostedit);
|
||
formData.append("contract_mojavez_fa", choosenlastfaedit);
|
||
formData.append("contract_mojavez_fa_array", relatedpostedit);
|
||
formData.append("contract_tarh", eblaghtarhedit);
|
||
formData.append("contract_tarh_array", eblaghtarhedit)
|
||
formData.append("contract_credit_national", eblaghmoneyedit);
|
||
formData.append("contract_credit_national_array", eblaghmoneyedit);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_setad", etadmoneyedit);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoneyedit);
|
||
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/update/" + idtable,
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modaledit").modal("hide")
|
||
table.ajax.reload(null, false);
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
|
||
}
|
||
} else {
|
||
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlastedit);
|
||
formData.append("contract_mojavez_array", relatedpostedit);
|
||
formData.append("contract_mojavez_fa", choosenlastfaedit);
|
||
formData.append("contract_mojavez_fa_array", relatedpostedit);
|
||
formData.append("contract_tarh", eblaghtarhedit);
|
||
formData.append("contract_tarh_array", eblaghtarhedit)
|
||
formData.append("contract_credit_national", eblaghmoneyedit);
|
||
formData.append("contract_credit_national_array", eblaghmoneyedit);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_setad", etadmoneyedit);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoneyedit);
|
||
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/update/" + idtable,
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modaledit").modal("hide")
|
||
table.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
|
||
}
|
||
} else {
|
||
alert(" لطفا شماره طرح را انتخاب نمایید ")
|
||
$(".select2-container").addClass("is-invalid-input");
|
||
}
|
||
|
||
}
|
||
} else {
|
||
if ($('#checkbox3edit').is(':checked')) {
|
||
if (etadmoneyedit == "") {
|
||
alert("لطفا از موارد جدول انتخاب کنید ")
|
||
$("#setad_inputedit").addClass("is-invalid-input");
|
||
|
||
} else {
|
||
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlastedit);
|
||
formData.append("contract_mojavez_array", relatedpostedit);
|
||
formData.append("contract_mojavez_fa", choosenlastfaedit);
|
||
formData.append("contract_mojavez_fa_array", relatedpostedit);
|
||
formData.append("contract_tarh", eblaghtarhedit);
|
||
formData.append("contract_tarh_array", eblaghtarhedit)
|
||
formData.append("contract_credit_national", eblaghmoneyedit);
|
||
formData.append("contract_credit_national_array", eblaghmoneyedit);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_setad", etadmoneyedit);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoneyedit);
|
||
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/update/" + idtable,
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modaledit").modal("hide")
|
||
table.ajax.reload(null, false);
|
||
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
} else {
|
||
|
||
let formData = new FormData();
|
||
formData.append("province_id", province);
|
||
formData.append("province_fa", provincetext);
|
||
formData.append("office_id", office);
|
||
formData.append("office_fa", officefa);
|
||
formData.append("title", projecttitle);
|
||
formData.append("status_id", project_status);
|
||
formData.append("status_fa", project_status_fa);
|
||
formData.append("contract_date", contractDateFormatted);
|
||
formData.append("contract_mojavez", choosenlastedit);
|
||
formData.append("contract_mojavez_array", relatedpostedit);
|
||
formData.append("contract_mojavez_fa", choosenlastfaedit);
|
||
formData.append("contract_mojavez_fa_array", relatedpostedit);
|
||
formData.append("contract_tarh", eblaghtarhedit);
|
||
formData.append("contract_tarh_array", eblaghtarhedit)
|
||
formData.append("contract_credit_national", eblaghmoneyedit);
|
||
formData.append("contract_credit_national_array", eblaghmoneyedit);
|
||
formData.append("contract_credit_province", ostani_num);
|
||
formData.append("contract_credit", contract_money);
|
||
formData.append("contract_peymankar", peymankar_name);
|
||
formData.append("contract_moshaver_tarahi", designer_name);
|
||
formData.append("contract_moshaver_nezarat", nezarat_name);
|
||
formData.append("contract_mojavez_data_meli", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_meli_array", eblaghmoneyedit);
|
||
formData.append("contract_mojavez_data_setad", etadmoneyedit);
|
||
formData.append("contract_mojavez_data_setad_array", etadmoneyedit);
|
||
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/update/" + idtable,
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#modaledit").modal("hide")
|
||
table.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
} else {
|
||
alert("لطفا از مجوز های انعقاد قرارداد یک مورد را انتخاب کنید . ")
|
||
}
|
||
|
||
})
|
||
|
||
|
||
|
||
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");
|
||
}
|
||
}
|
||
|
||
$("#examplefinance").on('click', '.showprojectcontract', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = table.row(tr);
|
||
var id = row.data().id;
|
||
province_id3 = row.data().province_id;
|
||
|
||
statusForPaiini = row.data().status_id;
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/show/" + id,
|
||
type: "GET",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (data) {
|
||
console.log(data.canDelete);
|
||
candelete_sub = data.canDelete;
|
||
},
|
||
error: function (error) {
|
||
alert("خطا");
|
||
},
|
||
});
|
||
|
||
$('#title-update-unique').text("(" + row.data().unique_id + ")");
|
||
$("#tool-main").css("display", "none");
|
||
$("#tool-ehdas").css("display", "none");
|
||
$("#update-table").css("display", "block");
|
||
scrolldowntable()
|
||
|
||
subItemTable = $("#example-update").DataTable({
|
||
dom: "<fB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
paging: true,
|
||
searching: false,
|
||
scrollX: true,
|
||
destroy: true,
|
||
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, "desc"]
|
||
],
|
||
processing: true,
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/contracts/show/" + id,
|
||
type: "GET",
|
||
dataSrc: function (json) {
|
||
return json.data;
|
||
},
|
||
},
|
||
initComplete: function () {
|
||
$("body").find(".dataTables_scrollBody").addClass("scrollbar");
|
||
},
|
||
columns: [{
|
||
data: 'unique_code',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'project_title',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'project_type_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-sm btnSubItemModal">...</button>';
|
||
},
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'city_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'axis_type_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'axis_name_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'followup_priority_project',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'priority_project',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'progress_project',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'last_status_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'last_digit_project',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'last_function_operator',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'last_payable_operator',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'complete_payable',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-sm btnSubItemOpratorModal">...</button>';
|
||
},
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return row.start_lat + ', ' + row.start_lng;
|
||
},
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-show-img-subitem"><i class="fas fa-image"></i></button>';
|
||
},
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: 'updated_at_fa',
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return (candelete_sub == 1) ? '<div class="setcontent"><button class="btn-dataTable btn-edit-subitem"><i class="fas fa-edit"></i></button><div class="line-btn-table"></div><button class="btn-dataTable btn-history-subitem"><i class="fas fa-history"></i></button><div class="line-btn-table"></div><button class="btn-dataTable btn-delete-subitem"><i class="fa fa-trash"></i></button></div>' : '<div class="setcontent"><button class="btn-dataTable btn-edit-subitem"><i class="fas fa-edit"></i></button><div class="line-btn-table"></div><button class="btn-dataTable btn-history-subitem"><i class="fas fa-history"></i></button></div>';
|
||
},
|
||
className: 'text-center text-nowrap'
|
||
},
|
||
],
|
||
|
||
buttons: [],
|
||
|
||
});
|
||
})
|
||
|
||
$(document).on('click', '.btnSubItemModal', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
|
||
(row.data().project_type_id == "1") ?
|
||
$('.modal-op-tonaj').removeClass('d-none') :
|
||
$('.modal-op-tonaj').addClass('d-none')
|
||
|
||
$('#subItemModal_type_fa1').val('')
|
||
$('#subItemModal_type_amount1').val('')
|
||
$('#subItemModal_type_unit1').val('')
|
||
$('#subItemModal_type_progress1').val('')
|
||
$('#subItemModal_type_tonaj1').val('')
|
||
|
||
$('#subItemModal_type_fa2').val('')
|
||
$('#subItemModal_type_amount2').val('')
|
||
$('#subItemModal_type_unit2').val('')
|
||
$('#subItemModal_type_progress2').val('')
|
||
$('#subItemModal_type_tonaj2').val('')
|
||
|
||
$('#subItemModal_type_fa3').val('')
|
||
$('#subItemModal_type_amount3').val('')
|
||
$('#subItemModal_type_unit3').val('')
|
||
$('#subItemModal_type_progress3').val('')
|
||
$('#subItemModal_type_tonaj3').val('')
|
||
|
||
$('#subItemModal_type_fa4').val('')
|
||
$('#subItemModal_type_amount4').val('')
|
||
$('#subItemModal_type_unit4').val('')
|
||
$('#subItemModal_type_progress4').val('')
|
||
$('#subItemModal_type_tonaj4').val('')
|
||
|
||
$('#subItemModal_type_fa1').val(row.data().operation_type_fa1)
|
||
$('#subItemModal_type_amount1').val(row.data().operation_type_amount1)
|
||
$('#subItemModal_type_unit1').val(row.data().operation_type_unit1)
|
||
$('#subItemModal_type_progress1').val(row.data().operation_type_progress1)
|
||
$('#subItemModal_type_tonaj1').val(row.data().operation_type_tonaj1)
|
||
|
||
$('#subItemModal_type_fa2').val(row.data().operation_type_fa2)
|
||
$('#subItemModal_type_amount2').val(row.data().operation_type_amount2)
|
||
$('#subItemModal_type_unit2').val(row.data().operation_type_unit2)
|
||
$('#subItemModal_type_progress2').val(row.data().operation_type_progress2)
|
||
$('#subItemModal_type_tonaj2').val(row.data().operation_type_tonaj2)
|
||
|
||
$('#subItemModal_type_fa3').val(row.data().operation_type_fa3)
|
||
$('#subItemModal_type_amount3').val(row.data().operation_type_amount3)
|
||
$('#subItemModal_type_unit3').val(row.data().operation_type_unit3)
|
||
$('#subItemModal_type_progress3').val(row.data().operation_type_progress3)
|
||
$('#subItemModal_type_tonaj3').val(row.data().operation_type_tonaj3)
|
||
$('#subItemModal_type_tonaj3').val(row.data().operation_type_tonaj3)
|
||
|
||
$('#subItemModal_type_fa4').val(row.data().operation_type_fa4)
|
||
$('#subItemModal_type_amount4').val(row.data().operation_type_amount4)
|
||
$('#subItemModal_type_unit4').val(row.data().operation_type_unit4)
|
||
$('#subItemModal_type_progress4').val(row.data().operation_type_progress4)
|
||
$('#subItemModal_type_tonaj4').val(row.data().operation_type_tonaj4)
|
||
|
||
$('#subItemModal').modal('show')
|
||
})
|
||
|
||
$(document).on('click', '.btnSubItemOpratorModal', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
|
||
$('#subItemOpratorModal_operator_name').val('')
|
||
$('#subItemOpratorModal_operator_phone').val('')
|
||
|
||
$('#subItemOpratorModal_operator_name').val(row.data().operator_name)
|
||
$('#subItemOpratorModal_operator_phone').val(row.data().operator_phone)
|
||
|
||
$('#subItemOpratorModal').modal('show')
|
||
})
|
||
$(document).on('click', '.btnSubItemOpratorHistoryModal', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = historyTable.row(tr);
|
||
|
||
$('#subItemOpratorModal_operator_name').val('')
|
||
$('#subItemOpratorModal_operator_phone').val('')
|
||
|
||
$('#subItemOpratorModal_operator_name').val(row.data().operator_name)
|
||
$('#subItemOpratorModal_operator_phone').val(row.data().operator_phone)
|
||
|
||
$('#subItemOpratorModal').modal('show')
|
||
})
|
||
$(document).on('click', '.btnSubItemHistoryModal', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = historyTable.row(tr);
|
||
|
||
(row.data().project_type_id == "1") ?
|
||
$('.modal-op-tonaj').removeClass('d-none') :
|
||
$('.modal-op-tonaj').addClass('d-none')
|
||
|
||
$('#subItemModal_type_fa1').val('')
|
||
$('#subItemModal_type_amount1').val('')
|
||
$('#subItemModal_type_unit1').val('')
|
||
$('#subItemModal_type_progress1').val('')
|
||
$('#subItemModal_type_tonaj1').val('')
|
||
|
||
$('#subItemModal_type_fa2').val('')
|
||
$('#subItemModal_type_amount2').val('')
|
||
$('#subItemModal_type_unit2').val('')
|
||
$('#subItemModal_type_progress2').val('')
|
||
$('#subItemModal_type_tonaj2').val('')
|
||
|
||
$('#subItemModal_type_fa3').val('')
|
||
$('#subItemModal_type_amount3').val('')
|
||
$('#subItemModal_type_unit3').val('')
|
||
$('#subItemModal_type_progress3').val('')
|
||
$('#subItemModal_type_tonaj3').val('')
|
||
|
||
$('#subItemModal_type_fa4').val('')
|
||
$('#subItemModal_type_amount4').val('')
|
||
$('#subItemModal_type_unit4').val('')
|
||
$('#subItemModal_type_progress4').val('')
|
||
$('#subItemModal_type_tonaj4').val('')
|
||
|
||
$('#subItemModal_type_fa1').val(row.data().operation_type_fa1)
|
||
$('#subItemModal_type_amount1').val(row.data().operation_type_amount1)
|
||
$('#subItemModal_type_unit1').val(row.data().operation_type_unit1)
|
||
$('#subItemModal_type_progress1').val(row.data().operation_type_progress1)
|
||
$('#subItemModal_type_tonaj1').val(row.data().operation_type_tonaj1)
|
||
|
||
|
||
|
||
$('#subItemModal_type_fa2').val(row.data().operation_type_fa2)
|
||
$('#subItemModal_type_amount2').val(row.data().operation_type_amount2)
|
||
$('#subItemModal_type_unit2').val(row.data().operation_type_unit2)
|
||
$('#subItemModal_type_progress2').val(row.data().operation_type_progress2)
|
||
$('#subItemModal_type_tonaj2').val(row.data().operation_type_tonaj2)
|
||
|
||
$('#subItemModal_type_fa3').val(row.data().operation_type_fa3)
|
||
$('#subItemModal_type_amount3').val(row.data().operation_type_amount3)
|
||
$('#subItemModal_type_unit3').val(row.data().operation_type_unit3)
|
||
$('#subItemModal_type_progress3').val(row.data().operation_type_progress3)
|
||
$('#subItemModal_type_tonaj3').val(row.data().operation_type_tonaj3)
|
||
|
||
$('#subItemModal_type_fa4').val(row.data().operation_type_fa4)
|
||
$('#subItemModal_type_amount4').val(row.data().operation_type_amount4)
|
||
$('#subItemModal_type_unit4').val(row.data().operation_type_unit4)
|
||
$('#subItemModal_type_progress4').val(row.data().operation_type_progress4)
|
||
$('#subItemModal_type_tonaj4').val(row.data().operation_type_tonaj4)
|
||
|
||
$('#subItemModal').modal('show')
|
||
})
|
||
$(document).on('click', '.btn-show-img-subitem', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
|
||
$('#imgSubItem1').attr('src', 'https://rms.rmto.ir/' + row.data().image_path1)
|
||
$('#imgSubItem2').attr('src', 'https://rms.rmto.ir/' + row.data().image_path2)
|
||
|
||
$('#subItemImgModal').modal('show')
|
||
})
|
||
|
||
$(document).on('click', '.btn-show-img-history-subitem', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = historyTable.row(tr);
|
||
|
||
$('#imgSubItem1').attr('src', 'https://rms.rmto.ir/' + row.data().image_path1)
|
||
$('#imgSubItem2').attr('src', 'https://rms.rmto.ir/' + row.data().image_path2)
|
||
|
||
$('#subItemImgModal').modal('show')
|
||
})
|
||
|
||
$(document).on('click', '.btn-history-subitem', function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
var ths = $('#example-update .th-head')
|
||
$('.internal-table').remove()
|
||
internalTable(tr, "example-history", 20)
|
||
.then(
|
||
(onResolved) => {
|
||
historyTable = $("#example-history").DataTable({
|
||
dom: "<flB<t>p>",
|
||
pagingType: "simple_numbers",
|
||
paging: false,
|
||
searching: false,
|
||
scrollX: true,
|
||
destroy: true,
|
||
responsive: true,
|
||
autoWidth: false,
|
||
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: [
|
||
[18, "desc"]
|
||
],
|
||
processing: true,
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/csi/history/"+ row.data().id,
|
||
type: "GET",
|
||
dataSrc: function (json) {
|
||
return json.data;
|
||
},
|
||
},
|
||
columns: [{
|
||
data: 'unique_code',
|
||
className: 'text-center',
|
||
width: ths.eq(0).css('width')
|
||
},
|
||
{
|
||
data: 'project_title',
|
||
className: 'text-center',
|
||
width: ths.eq(1).css('width')
|
||
},
|
||
{
|
||
data: 'project_type_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(2).css('width')
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-sm btnSubItemHistoryModal" style="color: #fff;">...</button>';
|
||
},
|
||
className: 'text-center',
|
||
width: ths.eq(3).css('width')
|
||
},
|
||
{
|
||
data: 'city_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(4).css('width')
|
||
},
|
||
{
|
||
data: 'axis_type_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(5).css('width')
|
||
|
||
},
|
||
{
|
||
data: 'axis_name_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(6).css('width')
|
||
},
|
||
{
|
||
data: 'followup_priority_project',
|
||
className: 'text-center',
|
||
width: ths.eq(7).css('width')
|
||
},
|
||
{
|
||
data: 'priority_project',
|
||
className: 'text-center',
|
||
width: ths.eq(8).css('width')
|
||
},
|
||
{
|
||
data: 'progress_project',
|
||
className: 'text-center',
|
||
width: ths.eq(9).css('width')
|
||
},
|
||
{
|
||
data: 'last_status_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(10).css('width')
|
||
},
|
||
{
|
||
data: 'last_digit_project',
|
||
className: 'text-center',
|
||
width: ths.eq(11).css('width')
|
||
},
|
||
{
|
||
data: 'last_function_operator',
|
||
className: 'text-center',
|
||
width: ths.eq(12).css('width')
|
||
},
|
||
{
|
||
data: 'last_payable_operator',
|
||
className: 'text-center',
|
||
width: ths.eq(13).css('width')
|
||
},
|
||
{
|
||
data: 'complete_payable',
|
||
className: 'text-center',
|
||
width: ths.eq(14).css('width')
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-sm btnSubItemOpratorHistoryModal" style="color: #fff;">...</button>';
|
||
},
|
||
className: 'text-center',
|
||
width: ths.eq(15).css('width')
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return row.start_lat + ', ' + row.start_lng;
|
||
},
|
||
className: 'text-center',
|
||
width: ths.eq(16).css('width')
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '<button class="btn-dataTable btn-show-img-history-subitem"><i class="fas fa-image" style="color: white;"></i></button>';
|
||
},
|
||
className: 'text-center',
|
||
width: ths.eq(17).css('width')
|
||
},
|
||
{
|
||
data: 'updated_at_fa',
|
||
className: 'text-center',
|
||
width: ths.eq(18).css('width')
|
||
},
|
||
{
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return '-';
|
||
},
|
||
className: 'text-center',
|
||
width: ths.eq(19).css('width')
|
||
},
|
||
],
|
||
|
||
buttons: [],
|
||
|
||
});
|
||
}
|
||
);
|
||
|
||
})
|
||
|
||
function internalTable(tr, id, column) {
|
||
var ths = ''
|
||
var initTable;
|
||
for (var i = 1; i <= column; i++) {
|
||
ths += '<th style="background-color: #fff"></th>'
|
||
}
|
||
initTable = `<tr class="internal-table">
|
||
<td class = "p-0 pb-2 bg-white" style="border-width:0px;"
|
||
colspan = "${column}">
|
||
<table table class = "table"
|
||
style = "background-color: #84b6de; color:#fff"
|
||
id = "${id}"
|
||
style = "width: 100%;">
|
||
<thead style="height:0px">
|
||
<tr>
|
||
${ths}
|
||
</tr>
|
||
</thead>
|
||
</table>
|
||
</td>
|
||
</tr>`
|
||
$(initTable).insertAfter(tr);
|
||
|
||
return Promise.resolve("Success");
|
||
}
|
||
|
||
$("#examplefinance").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");
|
||
}
|
||
});
|
||
|
||
$("#project_type").on("change", function () {
|
||
arrDisableOpration = ["2", "4", "5"]
|
||
if ($.inArray($("#project_type").val(), arrDisableOpration) !== -1) {
|
||
$('.input_modal_table').prop('disabled', true);
|
||
$('.input_modal_table2').prop('disabled', true);
|
||
} else {
|
||
$('.input_modal_table').prop('disabled', false);
|
||
$('.input_modal_table2').prop('disabled', false);
|
||
}
|
||
|
||
if ($("#project_type").val() == 1) {
|
||
$(".abrar-map-title2").text("موقعیت شروع و پایان اجباری است");
|
||
$(".showtonaj").css("display", "table-cell")
|
||
} else {
|
||
$(".abrar-map-title2").text("موقعیت پایان اختیاری است");
|
||
$(".showtonaj").css("display", "none")
|
||
}
|
||
if ($("#project_type").val() == 6) {
|
||
$("#axis_type_id").val(5);
|
||
} else {
|
||
$("#axis_type_id").val(0);
|
||
}
|
||
})
|
||
$("#project_type2").on("change", function () {
|
||
arrDisableOpration = ["2", "4", "5"]
|
||
if ($.inArray($("#project_type2").val(), arrDisableOpration) !== -1) {
|
||
$('.input_modal_table').prop('disabled', true);
|
||
$('.input_modal_table2').prop('disabled', true);
|
||
} else {
|
||
$('.input_modal_table').prop('disabled', false);
|
||
$('.input_modal_table2').prop('disabled', false);
|
||
}
|
||
$(".input_modal_table").val("");
|
||
$(".input_modal_table2").val("");
|
||
if ($("#project_type2").val() == 1) {
|
||
$(".abrar-map-title22").text("موقعیت شروع و پایان اجباری است");
|
||
$(".showtonaj").css("display", "table-cell")
|
||
} else {
|
||
$(".abrar-map-title22").text("موقعیت پایان اختیاری است");
|
||
$(".showtonaj").css("display", "none")
|
||
}
|
||
if ($("#project_type2").val() == 6) {
|
||
$("#axis_type_id2").val(5);
|
||
}
|
||
})
|
||
restrictInputOtherThanArabic($("#project_name"));
|
||
restrictInputOtherThanArabic($("#axis_name_fa"));
|
||
restrictInputOtherThanArabic($("#operator_name"));
|
||
|
||
$("#cancelsubmitedit").on("click", function () {
|
||
$("#modaledit").modal("hide")
|
||
})
|
||
$("#cancelsubmit").on("click", function () {
|
||
$("#modalsecond").modal("hide")
|
||
})
|
||
$("#example-update").on("click", ".btn-edit-subitem", function () {
|
||
$("[data-mask]").inputmask();
|
||
|
||
|
||
$(".showtonaj").css("display", "none")
|
||
$("#stepmodaledit #deviceImg12").val('')
|
||
$("#stepmodaledit #deviceImg22").val('')
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
var needall = row.data();
|
||
unstar = needall;
|
||
$("#stepmodaledit").modal("show");
|
||
$("#exampleModalshortTitle").text("ویرایش زیر پروژه شماره(" + needall.unique_code + ")");
|
||
var progress_project2 = needall.progress_project
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + province_id3,
|
||
type: "GET",
|
||
success: function (data) {
|
||
list_citys = data.data;
|
||
$("#city_id2").empty();
|
||
$("#city_id2").append(
|
||
'<option value="0">انتخاب شهرستان </option>'
|
||
);
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#city_id2").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
var city_id2 = unstar.city_id
|
||
$("#stepmodaledit #city_id2").val(city_id2);
|
||
},
|
||
});
|
||
|
||
|
||
if (statusForPaiini == 1) {
|
||
$("#last_status_id12").removeAttr("disabled");
|
||
$("#last_status_id12").css("display", "");
|
||
$("#last_status_id32").css("display", "none");
|
||
$("#last_status_id22").css("display", "none");
|
||
$("#last_status_id12").val(needall.last_status_id)
|
||
} else if (statusForPaiini == 2) {
|
||
$("#last_status_id12").attr("disabled", true);
|
||
$("#last_status_id12").css("display", "none");
|
||
$("#last_status_id32").css("display", "");
|
||
$("#last_status_id22").css("display", "none");
|
||
} else if (statusForPaiini == 3) {
|
||
$("#last_status_id12").attr("disabled", true);
|
||
$("#last_status_id12").css("display", "none");
|
||
$("#last_status_id22").css("display", "");
|
||
$("#last_status_id32").css("display", "none");
|
||
}
|
||
|
||
var axis_type_id2 = needall.axis_type_id
|
||
var axis_name_fa2 = needall.axis_name_fa
|
||
var priority_project2 = needall.priority_project
|
||
var followup_priority_project2 = needall.followup_priority_project_id
|
||
var operator_name2 = needall.operator_name
|
||
var operator_phone2 = needall.operator_phone
|
||
var project_type2 = needall.project_type_id
|
||
var project_title2 = needall.project_title
|
||
var operation_type_progress12 = needall.operation_type_progress1
|
||
var operation_type_progress12 = needall.operation_type_progress1
|
||
var operation_type_fa12 = needall.operation_type_fa1
|
||
var operation_type_amount12 = needall.operation_type_amount1
|
||
var operation_type_unit12 = needall.operation_type_unit1
|
||
var operation_type_tonaj12 = needall.operation_type_tonaj1
|
||
var operation_type_progress22 = needall.operation_type_progress2
|
||
var operation_type_fa22 = needall.operation_type_fa2
|
||
var operation_type_amount22 = needall.operation_type_amount2
|
||
var operation_type_unit22 = needall.operation_type_unit2
|
||
var operation_type_tonaj22 = needall.operation_type_tonaj2
|
||
var operation_type_progress32 = needall.operation_type_progress3
|
||
var operation_type_fa32 = needall.operation_type_fa3
|
||
var operation_type_amount32 = needall.operation_type_amount3
|
||
var operation_type_unit32 = needall.operation_type_unit3
|
||
var operation_type_tonaj32 = needall.operation_type_tonaj3
|
||
var operation_type_progress42 = needall.operation_type_progress4
|
||
var operation_type_fa42 = needall.operation_type_fa4
|
||
var operation_type_amount42 = needall.operation_type_amount4
|
||
var operation_type_unit42 = needall.operation_type_unit4
|
||
var operation_type_tonaj42 = needall.operation_type_tonaj4
|
||
var last_digit_project2 = needall.last_digit_project
|
||
var last_function_operator2 = needall.last_function_operator
|
||
var last_payable_operator2 = needall.last_payable_operator
|
||
var complete_payable2 = needall.complete_payable
|
||
var deviceImg12Preview = needall.image_path1
|
||
var deviceImg22Preview = needall.image_path2
|
||
console.log(deviceImg1Preview);
|
||
console.log(deviceImg2Preview);
|
||
var city_id2 = needall.city_id
|
||
|
||
edit = true;
|
||
var start_lat = needall.start_lat
|
||
var start_lng = needall.start_lng
|
||
var end_lat = needall.end_lat
|
||
var end_lng = needall.end_lng
|
||
if (mapshow == null) {
|
||
setTimeout(() => {
|
||
createLeafletMapshow('abrar-map-2', [start_lat, start_lng], [end_lat, end_lng], 0)
|
||
}, 200);
|
||
} else {
|
||
createLeafletMapshow('abrar-map-2', [start_lat, start_lng], [end_lat, end_lng], 1)
|
||
}
|
||
|
||
if (project_type2 == 1) {
|
||
$(".showtonaj").css("display", "table-cell")
|
||
}
|
||
|
||
initshowmodal(project_type2)
|
||
if (project_type2 == "1") {
|
||
$(".abrar-map-title22").text("موقعیت شروع و پایان اجباری است");
|
||
} else {
|
||
$(".abrar-map-title22").text("موقعیت پایان اختیاری است");
|
||
}
|
||
|
||
|
||
$("#stepmodaledit #operation_type_amount12").val(operation_type_amount12);
|
||
$("#stepmodaledit #operation_type_unit12").val(operation_type_unit12);
|
||
$("#stepmodaledit #operation_type_amount223").val(operation_type_amount22);
|
||
$("#stepmodaledit #operation_type_unit223").val(operation_type_unit22);
|
||
$("#stepmodaledit #operation_type_amount32").val(operation_type_amount32);
|
||
$("#stepmodaledit #operation_type_unit32").val(operation_type_unit32);
|
||
$("#stepmodaledit #operation_type_amount42").val(operation_type_amount42);
|
||
$("#stepmodaledit #operation_type_unit42").val(operation_type_unit42);
|
||
|
||
$("#stepmodaledit #deviceImg12Title").css('display', 'none');
|
||
$("#stepmodaledit #deviceImg22Title").css('display', 'none');
|
||
$("#stepmodaledit #deviceImg12Preview").attr("src", "https://rms.rmto.ir/" + deviceImg12Preview);
|
||
$("#stepmodaledit #deviceImg22Preview").attr("src", "https://rms.rmto.ir/" + deviceImg22Preview);
|
||
$("#stepmodaledit #deleteDeviceImg12").removeAttr('disabled');
|
||
$("#stepmodaledit #deleteDeviceImg22").removeAttr('disabled');
|
||
$("#stepmodaledit #deviceImg12").val('');
|
||
$("#stepmodaledit #deviceImg22").val('');
|
||
|
||
$("#stepmodaledit #axis_type_id2").val(axis_type_id2);
|
||
$("#stepmodaledit #axis_name_fa2").val(axis_name_fa2);
|
||
$("#stepmodaledit #projectrateid2").val(priority_project2);
|
||
$("#stepmodaledit #followup_priority_project2").val(followup_priority_project2);
|
||
$("#stepmodaledit #operator_name2").val(operator_name2);
|
||
$("#stepmodaledit #operator_phone2").val(operator_phone2);
|
||
$("#stepmodaledit #project_type2").val(project_type2);
|
||
$("#stepmodaledit #project_name2").val(project_title2);
|
||
$("#stepmodaledit #city_id2").val(city_id2);
|
||
$("#stepmodaledit #progress_project2").val(progress_project2);
|
||
if (progress_project2 == 10) {
|
||
$("#stepmodaledit #progress_project2").attr("disabled", true);
|
||
} else if (progress_project2 == 5) {
|
||
$("#stepmodaledit #progress_project2").attr("disabled", true);
|
||
} else if (progress_project2 == 100) {
|
||
$("#stepmodaledit #progress_project2").attr("disabled", true);
|
||
} else {
|
||
$("#stepmodaledit #progress_project2").attr("disabled", false);
|
||
}
|
||
$("#stepmodaledit #operation_type_progress122").val(operation_type_progress12);
|
||
$("#stepmodaledit #operation_type_fa122").val(operation_type_fa12);
|
||
$("#stepmodaledit #operation_type_amount122").val(operation_type_amount12);
|
||
$("#stepmodaledit #operation_type_unit122").val(operation_type_unit12);
|
||
$("#stepmodaledit #operation_type_tonaj122").val(operation_type_tonaj12);
|
||
$("#stepmodaledit #operation_type_progress222").val(operation_type_progress22);
|
||
$("#stepmodaledit #operation_type_fa222").val(operation_type_fa22);
|
||
$("#stepmodaledit #operation_type_amount222").val(operation_type_amount22);
|
||
$("#stepmodaledit #operation_type_unit222").val(operation_type_unit22);
|
||
$("#stepmodaledit #operation_type_tonaj222").val(operation_type_tonaj22);
|
||
$("#stepmodaledit #operation_type_progress322").val(operation_type_progress32);
|
||
$("#stepmodaledit #operation_type_fa322").val(operation_type_fa32);
|
||
$("#stepmodaledit #operation_type_amount322").val(operation_type_amount32);
|
||
$("#stepmodaledit #operation_type_unit322").val(operation_type_unit32);
|
||
$("#stepmodaledit #operation_type_tonaj322").val(operation_type_tonaj32);
|
||
$("#stepmodaledit #operation_type_progress422").val(operation_type_progress42);
|
||
$("#stepmodaledit #operation_type_fa422").val(operation_type_fa42);
|
||
$("#stepmodaledit #operation_type_amount422").val(operation_type_amount42);
|
||
$("#stepmodaledit #operation_type_unit422").val(operation_type_unit42);
|
||
$("#stepmodaledit #operation_type_tonaj422").val(operation_type_tonaj42);
|
||
$("#stepmodaledit #riali12").val(last_digit_project2);
|
||
$("#stepmodaledit #riali22").val(last_function_operator2);
|
||
$("#stepmodaledit #riali32").val(last_payable_operator2);
|
||
$("#stepmodaledit #riali42").val(complete_payable2);
|
||
$("#stepmodaledit #riali_edit_span1").text(parseInt($("#stepmodaledit #riali12").val()).toLocaleString('en'));
|
||
$("#stepmodaledit #riali_edit_span2").text(parseInt($("#stepmodaledit #riali22").val()).toLocaleString('en'));
|
||
$("#stepmodaledit #riali_edit_span3").text(parseInt($("#stepmodaledit #riali32").val()).toLocaleString('en'));
|
||
$("#stepmodaledit #riali_edit_span4").text(parseInt($("#stepmodaledit #riali42").val()).toLocaleString('en'));
|
||
arrDisableOpration = ["2", "4", "5"]
|
||
if ($.inArray($("#project_type2").val(), arrDisableOpration) !== -1) {
|
||
$('.input_modal_table').prop('disabled', true);
|
||
$('.input_modal_table2').prop('disabled', true);
|
||
} else {
|
||
$('.input_modal_table').prop('disabled', false);
|
||
$('.input_modal_table2').prop('disabled', false);
|
||
}
|
||
});
|
||
|
||
function initshowmodal(num) {
|
||
$(".input_modal_table12").empty();
|
||
$(".input_modal_table223").val("");
|
||
$(".input_modal_table12").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/operation/" + num,
|
||
type: "GET",
|
||
cache: false,
|
||
beforeSend: function () {
|
||
showLoaderScreen()
|
||
},
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (res) {
|
||
hideLoaderScreen()
|
||
$.each(res, function (key, value) {
|
||
var unit = (value.unit != "") ? value.unit : "-";
|
||
$(".input_modal_table12").append(
|
||
"\
|
||
<option unit='" + unit + "' value='" +
|
||
key +
|
||
"'>" +
|
||
value.farsi +
|
||
"</option>\
|
||
"
|
||
);
|
||
});
|
||
var operation_type_id12 = unstar.operation_type_id1
|
||
var operation_type_id22 = unstar.operation_type_id2
|
||
var operation_type_id32 = unstar.operation_type_id3
|
||
var operation_type_id42 = unstar.operation_type_id4
|
||
$("#stepmodaledit #operation_type_id12").val(operation_type_id12);
|
||
$("#stepmodaledit #operation_type_id223").val(operation_type_id22);
|
||
$("#stepmodaledit #operation_type_id32").val(operation_type_id32);
|
||
$("#stepmodaledit #operation_type_id42").val(operation_type_id42);
|
||
$("#stepmodaledit #operation_type_progress122").prop('disabled', operation_type_id12 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_progress222").prop('disabled', operation_type_id22 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_progress322").prop('disabled', operation_type_id32 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_progress422").prop('disabled', operation_type_id42 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_tonaj122").prop('disabled', operation_type_id12 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_tonaj222").prop('disabled', operation_type_id22 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_tonaj322").prop('disabled', operation_type_id32 == '0' ? true : false);
|
||
$("#stepmodaledit #operation_type_tonaj422").prop('disabled', operation_type_id42 == '0' ? true : false);
|
||
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen()
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
$(".btn_edit_sub").on("click", function () {
|
||
var progress_project2 = $("#progress_project2").val();
|
||
var last_status_id22 = $("#last_status_id22").val();
|
||
var operation_type_progress122 = $("#operation_type_progress122").val();
|
||
var operation_type_progress222 = $("#operation_type_progress222").val();
|
||
var operation_type_progress322 = $("#operation_type_progress322").val();
|
||
var operation_type_progress422 = $("#operation_type_progress422").val();
|
||
var last_digit_project2 = $("#riali12").val();
|
||
var last_function_operator2 = $("#riali22").val();
|
||
var last_payable_operator2 = $("#riali32").val();
|
||
var complete_payable2 = $("#riali42").val();
|
||
|
||
|
||
let formData = new FormData();
|
||
formData.append("progress_project", progress_project2);
|
||
|
||
if ($("#last_status_id12").css("display") == "none" && $("#last_status_id32").css("display") == "none") {
|
||
var last_status_id = $("#last_status_id22").val();
|
||
} else if ($("#last_status_id22").css("display") == "none" && $("#last_status_id12").css("display") == "none") {
|
||
var last_status_id = $("#last_status_id32").val();
|
||
} else {
|
||
var last_status_id = $("#last_status_id12").val();
|
||
}
|
||
|
||
formData.append("last_status_id", last_status_id);
|
||
formData.append("operation_type_progress1", operation_type_progress122);
|
||
formData.append("operation_type_progress2", operation_type_progress222);
|
||
formData.append("operation_type_progress3", operation_type_progress322);
|
||
formData.append("operation_type_progress4", operation_type_progress422);
|
||
formData.append("last_digit_project", last_digit_project2);
|
||
formData.append("last_function_operator", last_function_operator2);
|
||
formData.append("last_payable_operator", last_payable_operator2);
|
||
formData.append("complete_payable", complete_payable2);
|
||
|
||
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/update/"+ unstar,
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
$("#stepmodaledit").modal("hide");
|
||
|
||
subItemTable.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
alert("لطفا تمامی مقادیر را درست وارد کنید ")
|
||
},
|
||
});
|
||
})
|
||
|
||
function appendtarh() {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/eblagh",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
success: function (data) {
|
||
|
||
|
||
var tarhnum = data.data;
|
||
var arrayeblagh = [];
|
||
for (let index = 0; index < tarhnum.length; index++) {
|
||
arrayeblagh.push(tarhnum[index].tarh_number)
|
||
}
|
||
var arraykol = []
|
||
arraykol = cleanarray(arrayeblagh)
|
||
for (let index = 0; index < arraykol.length; index++) {
|
||
$(".js-example-basic-multipletarh").append(
|
||
"\
|
||
<option value=" +
|
||
index +
|
||
">" +
|
||
arraykol[index] +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
|
||
},
|
||
});
|
||
}
|
||
|
||
function cleanarray(list) {
|
||
var result = [];
|
||
$.each(list, function (i, e) {
|
||
if ($.inArray(e, result) == -1) result.push(e);
|
||
});
|
||
return result;
|
||
|
||
|
||
}
|
||
|
||
function appendtarhedit() {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/contracts/eblagh",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
success: function (data) {
|
||
var tarhnum = data.data;
|
||
var arrayeblagh = [];
|
||
arrayeblagh.length = 0;
|
||
for (let index = 0; index < tarhnum.length; index++) {
|
||
arrayeblagh.push(tarhnum[index].tarh_number)
|
||
}
|
||
var arraykol = []
|
||
arraykol.length = 0;
|
||
arraykol = cleanarray(arrayeblagh)
|
||
|
||
$(".js-example-basic-multipletarhedit").empty()
|
||
|
||
|
||
for (let index = 0; index < arraykol.length; index++) {
|
||
|
||
|
||
$(".js-example-basic-multipletarhedit").append(
|
||
"\
|
||
<option value=" +
|
||
arraykol[index] +
|
||
">" +
|
||
arraykol[index] +
|
||
"</option>\
|
||
"
|
||
);
|
||
|
||
}
|
||
|
||
|
||
},
|
||
});
|
||
}
|
||
$(document).on("click", ".btnnewpro", function () {
|
||
addNewSubitemStatus = true;
|
||
$("#operation_type_amount22").val("")
|
||
$(".showtonaj").css("display", "none")
|
||
$("#riali1_span").text("0");
|
||
$("#riali2_span").text("0");
|
||
$("#riali3_span").text("0");
|
||
$("#riali4_span").text("0");
|
||
$("#stepModalunderpro input").removeClass("is-invalid-input");
|
||
$("#stepModalunderpro select").removeClass("is-invalid-input");
|
||
$("#operator_phone").val("09")
|
||
$("#riz_project_select").modal("hide");
|
||
$("#stepModalunderpro").modal("show");
|
||
setTimeout(() => {
|
||
if (map == null) {
|
||
creatmapfirst(center_lat_paiin, center_lng_paiin);
|
||
setTimeout(() => {
|
||
setmapview(center_lat_paiin, center_lng_paiin);
|
||
}, 100);
|
||
} else {
|
||
setmapview(center_lat_paiin, center_lng_paiin);
|
||
}
|
||
}, 200);
|
||
});
|
||
$(".btnchoosepro").on("click", function () {
|
||
addNewSubitemStatus = false;
|
||
$("#riz_project_select").modal("hide");
|
||
$("#tableProjectmodal").modal("show");
|
||
mahiat_table = $("#mahiat_tables").DataTable({
|
||
dom: "<fl<t>p>",
|
||
pagingType: "simple_numbers",
|
||
responsive: true,
|
||
"pageLength": 8,
|
||
destroy: 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,
|
||
destroy: true,
|
||
ajax: {
|
||
url: "https://rms.rmto.ir/api/finance/maintenance?project_id=" + vidpaiini,
|
||
type: "GET",
|
||
dataSrc: function (json) {
|
||
canSubmit = json.can_submit;
|
||
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: null,
|
||
render: function (data, type, row) {
|
||
if (data.submited_at_fa == null) {
|
||
return "<div class='line-empty-col'></div>";
|
||
} else {
|
||
return data.submited_at_fa;
|
||
}
|
||
},
|
||
},
|
||
{
|
||
className: "text-center",
|
||
data: null,
|
||
render: function (data, type, row) {
|
||
return `<div class="d-flex justify-content-center parent-btn">
|
||
<button class="btn-dataTable elsaghPro" title="الصاق به زیر پروژه قرارداد"><i class="fa fa-plus icon-btnTable"></i></button>
|
||
</div>`;
|
||
|
||
|
||
},
|
||
},
|
||
],
|
||
});
|
||
});
|
||
$(document).on("change", "#choosemahiatpro", function () {
|
||
var option = parseInt($(this).children("option:selected").val())
|
||
var url = "";
|
||
var url_image = "";
|
||
if (option == 1) {
|
||
url = "https://rms.rmto.ir/api/finance/maintenance?project_id=" + vidpaiini
|
||
|
||
} else if (option == 2) {
|
||
url = "https://rms.rmto.ir/api/finance/danger?project_id=" + vidpaiini
|
||
} else if (option == 3) {
|
||
url = "https://rms.rmto.ir/api/finance/upgradeSafety?project_id=" + vidpaiini
|
||
} else if (option == 4) {
|
||
url = "https://rms.rmto.ir/api/finance/technical?project_id=" + vidpaiini
|
||
|
||
} else if (option == 5) {
|
||
url = "https://rms.rmto.ir/api/finance/tollhouse?project_id=" + vidpaiini
|
||
|
||
}
|
||
showgozareshtable(url)
|
||
});
|
||
|
||
function showgozareshtable(urllink) {
|
||
$.ajax({
|
||
url: urllink,
|
||
type: "GET",
|
||
success: function (result) {
|
||
$("#mahiat_tables").dataTable().fnClearTable();
|
||
$("#mahiat_tables").dataTable().fnAddData(result.data);
|
||
|
||
|
||
},
|
||
});
|
||
}
|
||
|
||
$("#mahiat_tables").on("click", "tbody tr", function () {
|
||
if ($(this).hasClass("selected")) {
|
||
$(this).removeClass("selected");
|
||
$(this).css("color", "");
|
||
$(this).find("i").css("color", "");
|
||
} else {
|
||
mahiat_table.$("tr.selected").find("i").css("color", "");
|
||
mahiat_table.$("tr.selected").css("color", "");
|
||
mahiat_table.$("tr.selected").removeClass("selected");
|
||
$(this).addClass("selected");
|
||
$(this).css("color", "white");
|
||
$(this).find("i").css("color", "white");
|
||
}
|
||
});
|
||
|
||
$("#mahiat_tables").on("click", ".elsaghPro", function () {
|
||
$("#operation_type_progress1_choose").attr("disabled", true);
|
||
$("#operation_type_progress2_choose").attr("disabled", true);
|
||
$("#operation_type_progress3_choose").attr("disabled", true);
|
||
$("#operation_type_progress4_choose").attr("disabled", true);
|
||
$("#modalAfterTable input").removeClass("is-invalid-input");
|
||
$("#modalAfterTable select").removeClass("is-invalid-input");
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
|
||
|
||
$("#last_status_id_choose").on("change", function () {
|
||
if ($("#last_status_id_choose").val() == 0) {
|
||
$("#progress_project_choose").css("display", "block")
|
||
$("#progress_project4_choose").css("display", "none");
|
||
$("#progress_project3_choose").css("display", "none");
|
||
$("#progress_project6_choose").css("display", "none");
|
||
$("#progress_project5_choose").css("display", "none");
|
||
}
|
||
|
||
if ($("#last_status_id_choose").val() == 1) {
|
||
$("#progress_project5_choose").css("display", "block");
|
||
$("#progress_project5_choose").val("10");
|
||
$("#progress_project3_choose").css("display", "none");
|
||
$("#progress_project4_choose").css("display", "none");
|
||
$("#progress_project6_choose").css("display", "none");
|
||
$("#progress_project_choose").css("display", "none");
|
||
} else if ($("#last_status_id_choose").val() == 2) {
|
||
$("#progress_project3_choose").css("display", "block");
|
||
$("#progress_project5_choose").css("display", "none");
|
||
$("#progress_project4_choose").css("display", "none");
|
||
$("#progress_project6_choose").css("display", "none");
|
||
$("#progress_project_choose").css("display", "none");
|
||
} else if ($("#last_status_id_choose").val() == 3) {
|
||
$("#progress_project4_choose").css("display", "block");
|
||
$("#progress_project4_choose").val("100");
|
||
$("#progress_project3_choose").css("display", "none");
|
||
$("#progress_project5_choose").css("display", "none");
|
||
$("#progress_project6_choose").css("display", "none");
|
||
$("#progress_project_choose").css("display", "none");
|
||
}
|
||
});
|
||
|
||
|
||
|
||
$(".showtonaj_choose").css("display", "none")
|
||
|
||
$("#project_type_choose").val(0);
|
||
$("#operation_type_id1_choose").val(0);
|
||
$("#operation_type_id2_choose").val(0);
|
||
$("#operation_type_id3_choose").val(0);
|
||
$("#operation_type_id4_choose").val(0);
|
||
$("#operation_type_amount1_choose").val("");
|
||
$(".input_modal_table_choose").prop("disabled", false);
|
||
$("#operation_type_amount2_choose").val("");
|
||
$("#operation_type_amount2_choose").prop("disabled", false);
|
||
$("#operation_type_amount3_choose").val("");
|
||
$("#operation_type_amount3_choose").prop("disabled", false);
|
||
$("#operation_type_amount4_choose").val("");
|
||
$("#operation_type_amount4_choose").prop("disabled", false);
|
||
$("#operation_type_unit1_choose").val("");
|
||
$("#operation_type_unit1_choose").prop("disabled", false);
|
||
$("#operation_type_unit2_choose").val("");
|
||
$("#operation_type_unit2_choose").prop("disabled", false);
|
||
$("#operation_type_unit3_choose").val("");
|
||
$("#operation_type_unit3_choose").prop("disabled", false);
|
||
$("#operation_type_unit4_choose").val("");
|
||
$("#operation_type_unit4_choose").prop("disabled", false);
|
||
$("#operation_type_amount1_choose").val("-");
|
||
$(".input_modal_table_choose").prop("disabled", false);
|
||
$("#operation_type_amount2_choose").val("-");
|
||
$("#operation_type_amount2_choose").prop("disabled", false);
|
||
$("#operation_type_amount3_choose").val("-");
|
||
$("#operation_type_amount3_choose").prop("disabled", false);
|
||
$("#operation_type_amount4_choose").val("-");
|
||
$("#operation_type_amount4_choose").prop("disabled", false);
|
||
$("#operation_type_unit1_choose").val("-");
|
||
$("#operation_type_unit1_choose").prop("disabled", false);
|
||
$("#operation_type_unit2_choose").val("-");
|
||
$("#operation_type_unit2_choose").prop("disabled", false);
|
||
$("#operation_type_unit3_choose").val("-");
|
||
$("#operation_type_unit3_choose").prop("disabled", false);
|
||
$("#operation_type_unit4_choose").val("-");
|
||
$("#operation_type_unit4_choose").prop("disabled", false);
|
||
$("#operator_name_choose").val("");
|
||
$("#operator_phone_choose").val("09");
|
||
$("#projectrateid_choose").val(0);
|
||
$("#axis_name_fa_choose").val("");
|
||
$("#axis_type_id_choose").val(0);
|
||
$("#followup_priority_project_choose").val(0);
|
||
$("#progress_project_choose").val("");
|
||
$("#last_status_id_choose").val(0);
|
||
|
||
$("#operation_type_unit11_choose").val("");
|
||
$("#operation_type_unit22_choose").val("");
|
||
$("#operation_type_unit33_choose").val("");
|
||
$("#operation_type_unit44_choose").val("");
|
||
|
||
$("#operation_type_id11_choose").val("");
|
||
$("#operation_type_id22_choose").val("");
|
||
$("#operation_type_id33_choose").val("");
|
||
$("#operation_type_id44_choose").val("");
|
||
|
||
$("#operation_type_amount11_choose").val("");
|
||
$("#operation_type_amount22_choose").val("");
|
||
$("#operation_type_amount33_choose").val("");
|
||
$("#operation_type_amount44_choose").val("");
|
||
|
||
$("#operation_type_progress1_choose").val("");
|
||
$("#operation_type_progress2_choose").val("");
|
||
$("#operation_type_progress3_choose").val("");
|
||
$("#operation_type_progress4_choose").val("");
|
||
$("#operation_type_tonaj1_choose").val("");
|
||
$("#operation_type_tonaj2_choose").val("");
|
||
$("#operation_type_tonaj3_choose").val("");
|
||
$("#operation_type_tonaj4_choose").val("");
|
||
|
||
$("#riali1_choose").val("");
|
||
$("#riali2_choose").val("");
|
||
$("#riali3_choose").val("");
|
||
$("#riali4_choose").val("");
|
||
|
||
$("#deviceImg1Preview_choose").removeAttr("src");
|
||
$("#deviceImg2Preview_choose").removeAttr("src");
|
||
$("#deviceImg1_choose").val('');
|
||
$("#deviceImg2_choose").val('');
|
||
|
||
$('#deviceImg1Title_choose').css('display', '');
|
||
$('#deviceImg2Title_choose').css('display', '');
|
||
|
||
$('#deviceImg1load_choose').css('display', 'none')
|
||
$('#deviceImg2load_choose').css('display', 'none')
|
||
|
||
|
||
$("#deleteDeviceImg1_choose").prop("disabled", true);
|
||
$("#deleteDeviceImg2_choose").prop("disabled", true);
|
||
|
||
var tr = $(this).closest("tr");
|
||
var row = mahiat_table.row(tr);
|
||
idselectedrow = row.data().id;
|
||
mahiat_title = row.data().project_name;
|
||
mahiat_prov_id = row.data().province_id;
|
||
mahiat_axis_name = row.data().axis_name;
|
||
mahiat_axis_type = row.data().axis_type;
|
||
mehvar_name_past = row.data().axis_type_fa;
|
||
shahr_name_past1 = row.data().city_1_fa;
|
||
shahr_name_past2 = row.data().city_2_fa;
|
||
shahr_name_past3 = row.data().city_3_fa;
|
||
status_last_past = row.data().project_status_fa
|
||
|
||
var startlatlng = row.data().start_latlng
|
||
var endlatlng = row.data().end_latlng
|
||
if (row.data().end_latlng[0] == "NaN") {
|
||
setTimeout(() => {
|
||
if (mapshow == null) {
|
||
setTimeout(() => {
|
||
createLeafletMapshow('abrar-map_choose', [row.data().start_latlng, row.data().start_latlng], [row.data().end_latlng, row.data().end_latlng], 0)
|
||
}, 200);
|
||
} else {
|
||
createLeafletMapshow('abrar-map_choose', [row.data().start_latlng, row.data().start_latlng], [row.data().end_latlng, row.data().end_latlng], 1)
|
||
}
|
||
if (mapupdate == null) {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, startlatlng, 0);
|
||
setTimeout(() => {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, startlatlng, 0);
|
||
}, 100);
|
||
} else {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, startlatlng, 1);
|
||
}
|
||
}, 200);
|
||
|
||
} else {
|
||
setTimeout(() => {
|
||
if (mapshow == null) {
|
||
setTimeout(() => {
|
||
createLeafletMapshow('abrar-map_choose', [row.data().start_latlng, row.data().start_latlng], [row.data().end_latlng, row.data().end_latlng], 0)
|
||
}, 200);
|
||
} else {
|
||
createLeafletMapshow('abrar-map_choose', [row.data().start_latlng, row.data().start_latlng], [row.data().end_latlng, row.data().end_latlng], 1)
|
||
}
|
||
if (mapupdate == null) {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, endlatlng, 0);
|
||
setTimeout(() => {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, endlatlng, 0);
|
||
}, 100);
|
||
} else {
|
||
createLeafletMapshowupdate('abrar-map_choose', startlatlng, endlatlng, 1);
|
||
}
|
||
}, 200);
|
||
}
|
||
|
||
$("#mehvar_name_past").text(mehvar_name_past);
|
||
$("#status_last_past").text(status_last_past)
|
||
if (shahr_name_past2 == null && shahr_name_past3 == null) {
|
||
$("#shahr_name_past").text(shahr_name_past1);
|
||
} else if (shahr_name_past3 == null) {
|
||
$("#shahr_name_past").text(shahr_name_past1 + "," + shahr_name_past2);
|
||
} else {
|
||
$("#shahr_name_past").text(shahr_name_past1 + "," + shahr_name_past2 + "," + shahr_name_past3);
|
||
}
|
||
|
||
if (choosemahiatpro == 1) {
|
||
imgUrl_show = "https://rms.rmto.ir/api/finance/maintanance/show?id=" + idselectedrow
|
||
} else if (choosemahiatpro == 2) {
|
||
imgUrl_show = "https://rms.rmto.ir/api/finance/danger/show?id=" + idselectedrow
|
||
} else if (choosemahiatpro == 3) {
|
||
imgUrl_show = "https://rms.rmto.ir/api/finance/upgradesafety/show?id=" + idselectedrow
|
||
} else if (choosemahiatpro == 4) {
|
||
imgUrl_show = "https://rms.rmto.ir/api/finance/technical/show?id=" + idselectedrow
|
||
} else if (choosemahiatpro == 5) {
|
||
imgUrl_show = "https://rms.rmto.ir/api/finance/tollhouse/show?id=" + idselectedrow
|
||
}
|
||
if (choosemahiatpro == 2 || choosemahiatpro == 4 || choosemahiatpro == 5) {
|
||
$("#operation_type_amount1_choose").attr("disabled", true);
|
||
$("#operation_type_amount2_choose").attr("disabled", true);
|
||
$("#operation_type_amount3_choose").attr("disabled", true);
|
||
$("#operation_type_amount4_choose").attr("disabled", true);
|
||
$("#operation_type_unit1_choose").attr("disabled", true);
|
||
$("#operation_type_unit2_choose").attr("disabled", true);
|
||
$("#operation_type_unit3_choose").attr("disabled", true);
|
||
$("#operation_type_unit4_choose").attr("disabled", true);
|
||
}
|
||
$.ajax({
|
||
url: imgUrl_show,
|
||
type: "GET",
|
||
success: function (result) {
|
||
if (result.data[0].images.length != 0) {
|
||
if (result.data[0].images.length > 1) {
|
||
$("#deviceImg1Preview_choose").attr("src", result.data[0].images[0]);
|
||
$('#deviceImg1Title_choose').css('display', 'none')
|
||
$('#deviceImg1load_choose').css('display', '')
|
||
$('#deleteDeviceImg1_choose').removeAttr('disabled')
|
||
$("#deviceImg2Preview_choose").attr("src", result.data[0].images[1]);
|
||
$('#deviceImg2Title_choose').css('display', 'none')
|
||
$('#deviceImg2load_choose').css('display', '')
|
||
$('#deleteDeviceImg2_choose').removeAttr('disabled')
|
||
} else {
|
||
$("#deviceImg1Preview_choose").attr("src", result.data[0].images[0]);
|
||
$('#deviceImg1Title_choose').css('display', 'none')
|
||
$('#deviceImg1load_choose').css('display', '')
|
||
$('#deleteDeviceImg1_choose').removeAttr('disabled')
|
||
}
|
||
}
|
||
},
|
||
});
|
||
|
||
$("#tableProjectmodal").modal("hide");
|
||
$("#modalAfterTable").modal("show");
|
||
$("#project_name_choose").val(mahiat_title);
|
||
$("#project_type_choose").val(choosemahiatpro);
|
||
// if () {
|
||
|
||
// }
|
||
$("#axis_name_fa_choose").val(mahiat_axis_name);
|
||
if (choosemahiatpro == 1) {
|
||
$(".showtonaj_choose").css("display", "table-cell")
|
||
}
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/public/contents/provinces/" + mahiat_prov_id,
|
||
type: "GET",
|
||
success: function (data) {
|
||
list_citys = data.data;
|
||
$("#city_id_choose").empty();
|
||
$("#city_id_choose").append(
|
||
'<option value="0">انتخاب شهرستان </option>'
|
||
);
|
||
for (let index = 0; index < list_citys.length; index++) {
|
||
$("#city_id_choose").append(
|
||
"\
|
||
<option value=" +
|
||
list_citys[index].id +
|
||
">" +
|
||
list_citys[index].name_fa +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
},
|
||
});
|
||
});
|
||
|
||
function createLeafletMapshowupdate(id, startP, endP, isExist) {
|
||
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],
|
||
];
|
||
|
||
if (!isExist) {
|
||
mapupdate = new L.map(id, {
|
||
maxBounds: bounds,
|
||
minZoom: 6,
|
||
}).setView(startP, 9);
|
||
|
||
L.tileLayer("https://rmsmap.rmto.ir/141map/{z}/{x}/{y}.png", {}).addTo(
|
||
mapupdate
|
||
);
|
||
|
||
startAbrarMarkerupdate = new L.marker(L.latLng(latapi1, lngapi1), {
|
||
icon: startAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(mapupdate);
|
||
|
||
endAbrarMarkerupdate = new L.marker(L.latLng(latapi2, lngapi2), {
|
||
icon: endAbrarDivIcon,
|
||
draggable: true,
|
||
}).addTo(mapupdate);
|
||
|
||
checkmarkeranddrawupdate();
|
||
|
||
} else {
|
||
mapupdate.setView([latapi1, lngapi1], 9);
|
||
startAbrarMarkerupdate.setLatLng(L.latLng(latapi1, lngapi1));
|
||
endAbrarMarkerupdate.setLatLng(L.latLng(latapi2, lngapi2));
|
||
checkmarkeranddrawupdate();
|
||
}
|
||
isSetStartAbrarMarkerupdate = true;
|
||
$("#modalAfterTable input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
$("#modalAfterTable input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
|
||
$("#modalAfterTable #pin-marker-start").removeClass("pin-move pin-warn").addClass("pin-set");
|
||
|
||
isSetEndAbrarMarkerupdate = true;
|
||
|
||
$("#modalAfterTable #pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
startAbrarMarkerupdate.on("click", function () {
|
||
if (!isSetStartAbrarMarkerupdate) {
|
||
startAbrarMarkerupdate.setLatLng(L.latLng(mapupdate.getCenter()));
|
||
isSetStartAbrarMarkerupdate = true;
|
||
|
||
$("#modalAfterTable #pin-marker-start")
|
||
.removeClass("pin-move pin-warn")
|
||
.addClass("pin-set");
|
||
|
||
$("#modalAfterTable input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
let markerLatLng = [
|
||
startAbrarMarkerupdate.getLatLng().lat,
|
||
startAbrarMarkerupdate.getLatLng().lng + 0.0008,
|
||
];
|
||
|
||
mapupdate.setView(markerLatLng);
|
||
|
||
|
||
endAbrarMarkerupdate.setLatLng(markerLatLng);
|
||
endAbrarMarkerupdate.addTo(mapupdate);
|
||
}
|
||
});
|
||
|
||
startAbrarMarkerupdate.on("drag", function () {
|
||
$("#modalAfterTable #pin-marker-start").addClass("pin-move");
|
||
checkmarkeranddrawupdate();
|
||
});
|
||
|
||
startAbrarMarkerupdate.on("dragend", function () {
|
||
$("#modalAfterTable #pin-marker-start").removeClass("pin-move");
|
||
|
||
if ($("#modalAfterTable #pin-marker-start").hasClass("pin-set") || isSetStartAbrarMarkerupdate) {
|
||
$("#modalAfterTable input[name=abrar-project-latlng-start]").val(
|
||
startAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
startAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$("#modalAfterTable #pin-marker-start").addClass("pin-set");
|
||
checkmarkeranddrawupdate();
|
||
} else {
|
||
mapupdate.setView(startAbrarMarkerupdate.getLatLng());
|
||
}
|
||
});
|
||
|
||
endAbrarMarkerupdate.on("click", function () {
|
||
if (!isSetEndAbrarMarkerupdate) {
|
||
endAbrarMarkerupdate.setLatLng(L.latLng(mapupdate.getCenter()));
|
||
isSetEndAbrarMarkerupdate = true;
|
||
|
||
$("#modalAfterTable #pin-marker-end").removeClass("pin-move").addClass("pin-set");
|
||
|
||
$("#modalAfterTable input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
|
||
checkmarkeranddrawupdate();
|
||
}
|
||
});
|
||
|
||
endAbrarMarkerupdate.on("drag", function () {
|
||
$("#modalAfterTable #pin-marker-end").addClass("pin-move");
|
||
checkmarkeranddrawupdate();
|
||
});
|
||
|
||
endAbrarMarkerupdate.on("dragend", function () {
|
||
$("#modalAfterTable #pin-marker-end").removeClass("pin-move");
|
||
|
||
if ($("#modalAfterTable #pin-marker-end").hasClass("pin-set") || isSetEndAbrarMarkerupdate) {
|
||
$("#modalAfterTable input[name=abrar-project-latlng-end]").val(
|
||
endAbrarMarkerupdate.getLatLng().lat.toFixed(6) +
|
||
endAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
);
|
||
$(
|
||
"#modalAfterTable input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
$("#modalAfterTable #pin-marker-end").addClass("pin-set");
|
||
checkmarkeranddrawupdate();
|
||
} else {
|
||
mapupdate.setView(endAbrarMarkerupdate.getLatLng());
|
||
}
|
||
});
|
||
|
||
checkmarkeranddrawupdate();
|
||
}
|
||
|
||
$(document).on("change", "#choosemahiatpro", function () {
|
||
choosemahiatpro = $("#choosemahiatpro").val();
|
||
if (choosemahiatpro == 2 || choosemahiatpro == 4 || choosemahiatpro == 5) {
|
||
$('.input_modal_table_Choose').prop('disabled', true);
|
||
$('.input_modal_table2_choose').prop('disabled', true);
|
||
} else {
|
||
$('.input_modal_table_choose').prop('disabled', false);
|
||
$('.input_modal_table2_choose').prop('disabled', false);
|
||
}
|
||
|
||
if (choosemahiatpro == 1) {
|
||
$(".abrar-map-title2_Choose").text("موقعیت شروع و پایان اجباری است");
|
||
$(".showtonaj_choose").css("display", "table-cell")
|
||
} else {
|
||
$(".abrar-map-title2_Choose").text("موقعیت پایان اختیاری است");
|
||
$(".showtonaj_choose").css("display", "none")
|
||
}
|
||
|
||
});
|
||
if (choosemahiatpro == 2 || choosemahiatpro == 4 || choosemahiatpro == 5) {
|
||
$('.input_modal_table_Choose').prop('disabled', true);
|
||
$('.input_modal_table2_choose').prop('disabled', true);
|
||
} else {
|
||
$('.input_modal_table_choose').prop('disabled', false);
|
||
$('.input_modal_table2_choose').prop('disabled', false);
|
||
}
|
||
|
||
if (choosemahiatpro == 1) {
|
||
$(".abrar-map-title2_Choose").text("موقعیت شروع و پایان اجباری است");
|
||
$(".showtonaj_choose").css("display", "table-cell")
|
||
} else {
|
||
$(".abrar-map-title2_Choose").text("موقعیت پایان اختیاری است");
|
||
$(".showtonaj_choose").css("display", "none")
|
||
}
|
||
$(".input_modal_table1_choose").empty();
|
||
$(".input_modal_table2_choose").val("");
|
||
$(".input_modal_table1_choose").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/operation/" + choosemahiatpro,
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (res) {
|
||
$.each(res, function (key, value) {
|
||
var unit = (value.unit != "") ? value.unit : "-";
|
||
$(".input_modal_table1_choose").append(
|
||
"\
|
||
<option unit='" + unit + "' value='" +
|
||
key +
|
||
"'>" +
|
||
value.farsi +
|
||
"</option>\
|
||
"
|
||
);
|
||
});
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
|
||
$(document).on("change", "#choosemahiatpro", function () {
|
||
|
||
$(".input_modal_table1_choose").empty();
|
||
$(".input_modal_table2_choose").val("");
|
||
$(".input_modal_table1_choose").append(
|
||
"\
|
||
<option value='0'> انتخاب نوع عملیات </option>\
|
||
"
|
||
);
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/operation/" + choosemahiatpro,
|
||
type: "GET",
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (res) {
|
||
$.each(res, function (key, value) {
|
||
var unit = (value.unit != "") ? value.unit : "-";
|
||
$(".input_modal_table1_choose").append(
|
||
"\
|
||
<option unit='" + unit + "' value='" +
|
||
key +
|
||
"'>" +
|
||
value.farsi +
|
||
"</option>\
|
||
"
|
||
);
|
||
});
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
});
|
||
$(".input_modal_table1_choose").on("change", function () {
|
||
var parentModal = $(this).parents('.input_modal_parent_choose');
|
||
var unit = $(this).find('option:selected').attr('unit');
|
||
parentModal.find(".input_modal_table_choose").val("")
|
||
parentModal.find('.input_modal_table2_choose').val(unit)
|
||
});
|
||
$(".sabte_satr_choose").on("click", function () {
|
||
if ($("#project_type_choose").val() == 1) {
|
||
if ($("#operation_type_amount1_choose").val() != "") {
|
||
if ($("#operation_type_id1_choose").val() == 0) {
|
||
$("#operation_type_id1_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id1_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj1_choose").attr("disabled", false);
|
||
if ($("#operation_type_tonaj1_choose").val() == "") {
|
||
$("#operation_type_tonaj1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj1_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj1_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2_choose").val() != "") {
|
||
if ($("#operation_type_id2_choose").val() == 0) {
|
||
$("#operation_type_id2_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id2_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj2_choose").attr("disabled", false);
|
||
if ($("#operation_type_tonaj2_choose").val() == "") {
|
||
$("#operation_type_tonaj2_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj2_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj2_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj2_choose").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount3_choose").val() != "") {
|
||
if ($("#operation_type_id3_choose").val() == 0) {
|
||
$("#operation_type_id3_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id3_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj3_choose").attr("disabled", false);
|
||
if ($("#operation_type_tonaj3_choose").val() == "") {
|
||
$("#operation_type_tonaj3_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj3_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj3_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj3_choose").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount4_choose").val() != "") {
|
||
if ($("#operation_type_id4_choose").val() == 0) {
|
||
$("#operation_type_id4_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id4_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_tonaj4_choose").attr("disabled", false);
|
||
if ($("#operation_type_tonaj4_choose").val() == "") {
|
||
$("#operation_type_tonaj4_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj4_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj4_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj4_choose").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
|
||
|
||
if ($("#operation_type_amount1_choose").val() != "") {
|
||
if ($("#operation_type_id1_choose").val() == 0) {
|
||
$("#operation_type_id1_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id1_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress1_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress1_choose").val() == "") {
|
||
$("#operation_type_progress1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress1_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress1_choose").attr("disabled", true);
|
||
$("#operation_type_progress1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2_choose").val() != "") {
|
||
if ($("#operation_type_id2_choose").val() == 0) {
|
||
$("#operation_type_id2_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id2_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress2_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress2_choose").val() == "") {
|
||
$("#operation_type_progress2_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress2_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress2_choose").attr("disabled", true);
|
||
$("#operation_type_progress2_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount3_choose").val() != "") {
|
||
if ($("#operation_type_id3_choose").val() == 0) {
|
||
$("#operation_type_id3_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id3_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress3_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress3_choose").val() == "") {
|
||
$("#operation_type_progress3_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress3_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress3_choose").attr("disabled", true);
|
||
$("#operation_type_progress3_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount4_choose").val() != "") {
|
||
if ($("#operation_type_id4_choose").val() == 0) {
|
||
$("#operation_type_id4_choose").addClass("is-invalid-input")
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا نوع عملیات خود را مشخص کنید",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#operation_type_id4_choose").removeClass("is-invalid-input")
|
||
}
|
||
$("#operation_type_progress4_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress4_choose").val() == "") {
|
||
$("#operation_type_progress4_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress4_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress4_choose").attr("disabled", true);
|
||
$("#operation_type_progress4_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#project_type_choose").val() == 2 || $("#project_type_choose").val() == 4 || $("#project_type_choose").val() == 5) {
|
||
$("#modalAfterTable #operation_type_id11_choose").val($("#modalAfterTable #operation_type_id1_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id22_choose").val($("#modalAfterTable #operation_type_id2_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id33_choose").val($("#modalAfterTable #operation_type_id3_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id44_choose").val($("#modalAfterTable #operation_type_id4_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_unit11_choose").val($('#modalAfterTable #operation_type_unit1_choose').val());
|
||
$("#modalAfterTable #operation_type_unit22_choose").val($('#modalAfterTable #operation_type_unit2_choose').val());
|
||
$("#modalAfterTable #operation_type_unit33_choose").val($('#modalAfterTable #operation_type_unit3_choose').val());
|
||
$("#modalAfterTable #operation_type_unit44_choose").val($('#modalAfterTable #operation_type_unit4_choose').val());
|
||
$("#modalAfterTable #operation_type_amount11_choose").val($('#modalAfterTable #operation_type_amount1_choose').val());
|
||
$("#modalAfterTable #operation_type_amount22_choose").val($('#modalAfterTable #operation_type_amount2_choose').val());
|
||
$("#modalAfterTable #operation_type_amount33_choose").val($('#modalAfterTable #operation_type_amount3_choose').val());
|
||
$("#modalAfterTable #operation_type_amount44_choose").val($('#modalAfterTable #operation_type_amount4_choose').val());
|
||
} else {
|
||
if ($("#operation_type_amount1_choose").val() == "" && $("#operation_type_id1_choose").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#modalAfterTable #operation_type_id11_choose").val($("#modalAfterTable #operation_type_id1_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id22_choose").val($("#modalAfterTable #operation_type_id2_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id33_choose").val($("#modalAfterTable #operation_type_id3_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id44_choose").val($("#modalAfterTable #operation_type_id4_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_unit11_choose").val($('#modalAfterTable #operation_type_unit1_choose').val());
|
||
$("#modalAfterTable #operation_type_unit22_choose").val($('#modalAfterTable #operation_type_unit2_choose').val());
|
||
$("#modalAfterTable #operation_type_unit33_choose").val($('#modalAfterTable #operation_type_unit3_choose').val());
|
||
$("#modalAfterTable #operation_type_unit44_choose").val($('#modalAfterTable #operation_type_unit4_choose').val());
|
||
$("#modalAfterTable #operation_type_amount11_choose").val($('#modalAfterTable #operation_type_amount1_choose').val());
|
||
$("#modalAfterTable #operation_type_amount22_choose").val($('#modalAfterTable #operation_type_amount2_choose').val());
|
||
$("#modalAfterTable #operation_type_amount33_choose").val($('#modalAfterTable #operation_type_amount3_choose').val());
|
||
$("#modalAfterTable #operation_type_amount44_choose").val($('#modalAfterTable #operation_type_amount4_choose').val());
|
||
}
|
||
if ($("#operation_type_amount2_choose").val() == "" && $("#operation_type_id2_choose").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#modalAfterTable #operation_type_id11_choose").val($("#modalAfterTable #operation_type_id1_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id22_choose").val($("#modalAfterTable #operation_type_id2_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id33_choose").val($("#modalAfterTable #operation_type_id3_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id44_choose").val($("#modalAfterTable #operation_type_id4_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_unit11_choose").val($('#modalAfterTable #operation_type_unit1_choose').val());
|
||
$("#modalAfterTable #operation_type_unit22_choose").val($('#modalAfterTable #operation_type_unit2_choose').val());
|
||
$("#modalAfterTable #operation_type_unit33_choose").val($('#modalAfterTable #operation_type_unit3_choose').val());
|
||
$("#modalAfterTable #operation_type_unit44_choose").val($('#modalAfterTable #operation_type_unit4_choose').val());
|
||
$("#modalAfterTable #operation_type_amount11_choose").val($('#modalAfterTable #operation_type_amount1_choose').val());
|
||
$("#modalAfterTable #operation_type_amount22_choose").val($('#modalAfterTable #operation_type_amount2_choose').val());
|
||
$("#modalAfterTable #operation_type_amount33_choose").val($('#modalAfterTable #operation_type_amount3_choose').val());
|
||
$("#modalAfterTable #operation_type_amount44_choose").val($('#modalAfterTable #operation_type_amount4_choose').val());
|
||
}
|
||
if ($("#operation_type_amount3_choose").val() == "" && $("#operation_type_id3_choose").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#modalAfterTable #operation_type_id11_choose").val($("#modalAfterTable #operation_type_id1_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id22_choose").val($("#modalAfterTable #operation_type_id2_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id33_choose").val($("#modalAfterTable #operation_type_id3_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id44_choose").val($("#modalAfterTable #operation_type_id4_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_unit11_choose").val($('#modalAfterTable #operation_type_unit1_choose').val());
|
||
$("#modalAfterTable #operation_type_unit22_choose").val($('#modalAfterTable #operation_type_unit2_choose').val());
|
||
$("#modalAfterTable #operation_type_unit33_choose").val($('#modalAfterTable #operation_type_unit3_choose').val());
|
||
$("#modalAfterTable #operation_type_unit44_choose").val($('#modalAfterTable #operation_type_unit4_choose').val());
|
||
$("#modalAfterTable #operation_type_amount11_choose").val($('#modalAfterTable #operation_type_amount1_choose').val());
|
||
$("#modalAfterTable #operation_type_amount22_choose").val($('#modalAfterTable #operation_type_amount2_choose').val());
|
||
$("#modalAfterTable #operation_type_amount33_choose").val($('#modalAfterTable #operation_type_amount3_choose').val());
|
||
$("#modalAfterTable #operation_type_amount44_choose").val($('#modalAfterTable #operation_type_amount4_choose').val());
|
||
}
|
||
if ($("#operation_type_amount4_choose").val() == "" && $("#operation_type_id4_choose").val() != 0) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا مقدار عملیات های انتخابی را وارد نمایید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
$("#modalAfterTable #operation_type_id11_choose").val($("#modalAfterTable #operation_type_id1_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id22_choose").val($("#modalAfterTable #operation_type_id2_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id33_choose").val($("#modalAfterTable #operation_type_id3_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_id44_choose").val($("#modalAfterTable #operation_type_id4_choose option:selected").text());
|
||
$("#modalAfterTable #operation_type_unit11_choose").val($('#modalAfterTable #operation_type_unit1_choose').val());
|
||
$("#modalAfterTable #operation_type_unit22_choose").val($('#modalAfterTable #operation_type_unit2_choose').val());
|
||
$("#modalAfterTable #operation_type_unit33_choose").val($('#modalAfterTable #operation_type_unit3_choose').val());
|
||
$("#modalAfterTable #operation_type_unit44_choose").val($('#modalAfterTable #operation_type_unit4_choose').val());
|
||
$("#modalAfterTable #operation_type_amount11_choose").val($('#modalAfterTable #operation_type_amount1_choose').val());
|
||
$("#modalAfterTable #operation_type_amount22_choose").val($('#modalAfterTable #operation_type_amount2_choose').val());
|
||
$("#modalAfterTable #operation_type_amount33_choose").val($('#modalAfterTable #operation_type_amount3_choose').val());
|
||
$("#modalAfterTable #operation_type_amount44_choose").val($('#modalAfterTable #operation_type_amount4_choose').val());
|
||
}
|
||
}
|
||
if ($("#operation_type_amount1_choose").attr("disabled")) {
|
||
if ($("#operation_type_id1_choose").val() == 0) {
|
||
$("#operation_type_progress1_choose").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress1_choose").attr("disabled", false);
|
||
}
|
||
if ($("#operation_type_id2_choose").val() == 0) {
|
||
$("#operation_type_progress2_choose").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress2_choose").attr("disabled", false);
|
||
}
|
||
if ($("#operation_type_id3_choose").val() == 0) {
|
||
$("#operation_type_progress3_choose").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress3_choose").attr("disabled", false);
|
||
}
|
||
if ($("#operation_type_id4_choose").val() == 0) {
|
||
$("#operation_type_progress4_choose").attr("disabled", true);
|
||
} else {
|
||
$("#operation_type_progress4_choose").attr("disabled", false);
|
||
}
|
||
}
|
||
});
|
||
|
||
$("#operation_type_id1_choose").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1_choose option').css('display', '');
|
||
$('#operation_type_id2_choose option').css('display', '');
|
||
$('#operation_type_id3_choose option').css('display', '');
|
||
$('#operation_type_id4_choose option').css('display', '');
|
||
var operation_type_saved_choose = [];
|
||
operation_type_saved_choose[0] = $('#operation_type_id1_choose').val();
|
||
operation_type_saved_choose[1] = $('#operation_type_id2_choose').val();
|
||
operation_type_saved_choose[2] = $('#operation_type_id3_choose').val();
|
||
operation_type_saved_choose[3] = $('#operation_type_id4_choose').val();
|
||
for (var i = 0; i < operation_type_saved_choose.length; i++) {
|
||
$('#operation_type_id1_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id2_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id3_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id4_choose option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id2_choose").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1_choose option').css('display', '');
|
||
$('#operation_type_id2_choose option').css('display', '');
|
||
$('#operation_type_id3_choose option').css('display', '');
|
||
$('#operation_type_id4_choose option').css('display', '');
|
||
var operation_type_saved_choose = [];
|
||
operation_type_saved_choose[0] = $('#operation_type_id1_choose').val();
|
||
operation_type_saved_choose[1] = $('#operation_type_id2_choose').val();
|
||
operation_type_saved_choose[2] = $('#operation_type_id3_choose').val();
|
||
operation_type_saved_choose[3] = $('#operation_type_id4_choose').val();
|
||
for (var i = 0; i < operation_type_saved_choose.length; i++) {
|
||
$('#operation_type_id1_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id2_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id3_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id4_choose option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id3_choose").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1_choose option').css('display', '');
|
||
$('#operation_type_id2_choose option').css('display', '');
|
||
$('#operation_type_id3_choose option').css('display', '');
|
||
$('#operation_type_id4_choose option').css('display', '');
|
||
var operation_type_saved_choose = [];
|
||
operation_type_saved_choose[0] = $('#operation_type_id1_choose').val();
|
||
operation_type_saved_choose[1] = $('#operation_type_id2_choose').val();
|
||
operation_type_saved_choose[2] = $('#operation_type_id3_choose').val();
|
||
operation_type_saved_choose[3] = $('#operation_type_id4_choose').val();
|
||
for (var i = 0; i < operation_type_saved_choose.length; i++) {
|
||
$('#operation_type_id1_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id2_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id3_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id4_choose option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$("#operation_type_id4_choose").on("change", function () {
|
||
if ($(this).val() != 0) {
|
||
$('#operation_type_id1_choose option').css('display', '');
|
||
$('#operation_type_id2_choose option').css('display', '');
|
||
$('#operation_type_id3_choose option').css('display', '');
|
||
$('#operation_type_id4_choose option').css('display', '');
|
||
var operation_type_saved_choose = [];
|
||
operation_type_saved_choose[0] = $('#operation_type_id1_choose').val();
|
||
operation_type_saved_choose[1] = $('#operation_type_id2_choose').val();
|
||
operation_type_saved_choose[2] = $('#operation_type_id3_choose').val();
|
||
operation_type_saved_choose[3] = $('#operation_type_id4_choose').val();
|
||
for (var i = 0; i < operation_type_saved_choose.length; i++) {
|
||
$('#operation_type_id1_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id2_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id3_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
$('#operation_type_id4_choose option[value="' + operation_type_saved_choose[i] + '"]').css('display', 'none');
|
||
}
|
||
$('#operation_type_id1_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id2_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id3_choose option[value="0"]').css('display', '');
|
||
$('#operation_type_id4_choose option[value="0"]').css('display', '');
|
||
}
|
||
});
|
||
$(".btn-applyChangeNew_choose").on("click", function () {
|
||
if ($("#project_type_choose").val() == 1) {
|
||
if ($("#operation_type_amount1_choose").val() != "") {
|
||
if ($("#operation_type_tonaj1_choose").val() == "") {
|
||
$("#operation_type_tonaj1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj1_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj1_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2_choose").val() != "") {
|
||
if ($("#operation_type_tonaj2_choose").val() == "") {
|
||
$("#operation_type_tonaj2_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj2_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj2_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj2_choose").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount3_choose").val() != "") {
|
||
if ($("#operation_type_tonaj3_choose").val() == "") {
|
||
$("#operation_type_tonaj3_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj3_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj3_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj3_choose").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#operation_type_amount4_choose").val() != "") {
|
||
if ($("#operation_type_tonaj4_choose").val() == "") {
|
||
$("#operation_type_tonaj4_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_tonaj4_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_tonaj4_choose").attr("disabled", true)
|
||
$("#operation_type_tonaj4_choose").removeClass("is-invalid-input");
|
||
}
|
||
}
|
||
|
||
|
||
if ($("#operation_type_amount1_choose").val() != "") {
|
||
if ($("#operation_type_progress1_choose").val() == "") {
|
||
$("#operation_type_progress1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress1_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress1_choose").attr("disabled", true);
|
||
$("#operation_type_progress1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount2_choose").val() != "") {
|
||
$("#operation_type_progress2_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress2_choose").val() == "") {
|
||
$("#operation_type_progress2_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress2_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress2_choose").attr("disabled", true);
|
||
$("#operation_type_progress2_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount3_choose").val() != "") {
|
||
$("#operation_type_progress3_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress3_choose").val() == "") {
|
||
$("#operation_type_progress3_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress3_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress3_choose").attr("disabled", true);
|
||
$("#operation_type_progress3_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_amount4_choose").val() != "") {
|
||
$("#operation_type_progress4_choose").attr("disabled", false);
|
||
if ($("#operation_type_progress4_choose").val() == "") {
|
||
$("#operation_type_progress4_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_progress4_choose").removeClass("is-invalid-input");
|
||
}
|
||
} else {
|
||
$("#operation_type_progress4_choose").attr("disabled", true);
|
||
$("#operation_type_progress4_choose").removeClass("is-invalid-input");
|
||
}
|
||
|
||
if ($("#last_status_id_choose").val() == 2) {
|
||
|
||
if (parseInt($("#progress_project3_choose").val()) > 10 && parseInt($("#progress_project3_choose").val()) < 100) {
|
||
$("#progress_project3_choose").removeClass("is-invalid-input");
|
||
$("#progress_project3_choose_span").addClass("d-none");
|
||
} else {
|
||
$("#progress_project3_choose").addClass("is-invalid-input");
|
||
$("#progress_project3_choose_span").removeClass("d-none");
|
||
}
|
||
}
|
||
|
||
if ($("#project_type_choose").val() == 0) {
|
||
$("#project_type_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#project_type_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operation_type_id1_choose").val() == 0) {
|
||
$("#operation_type_id1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operation_type_id1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_name_choose").val() == "") {
|
||
$("#operator_name_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_name_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#operator_phone_choose").val().length != 11) {
|
||
$("#operator_phone_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#operator_phone_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#projectrateid_choose").val() == 0) {
|
||
$("#projectrateid_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#projectrateid_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#city_id_choose").val() == 0) {
|
||
$("#city_id_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#city_id_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_name_fa_choose").val() == "") {
|
||
$("#axis_name_fa_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_name_fa_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#axis_type_id_choose").val() == 0) {
|
||
$("#axis_type_id_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#axis_type_id_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#followup_priority_project_choose").val() == 0) {
|
||
$("#followup_priority_project_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#followup_priority_project_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#last_status_id_choose").val() == 0) {
|
||
$("#last_status_id_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#last_status_id_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali1_choose").val() == "") {
|
||
$("#riali1_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali1_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali2_choose").val() == "") {
|
||
$("#riali2_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali2_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali3_choose").val() == "") {
|
||
$("#riali3_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali3_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#riali4_choose").val() == "") {
|
||
$("#riali4_choose").addClass("is-invalid-input");
|
||
} else {
|
||
$("#riali4_choose").removeClass("is-invalid-input");
|
||
}
|
||
if ($("#deviceImg1Title_choose").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
if ($("#deviceImg2Title_choose").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "لطفا فیلد مربوط به عکس را تکمیل نمایید",
|
||
showCancelButton: false,
|
||
confirmButtonColor: "#d33",
|
||
confirmButtonText: "بستن",
|
||
showLoaderOnConfirm: false,
|
||
});
|
||
}
|
||
|
||
var project_title_choose = $("#project_name_choose").val();
|
||
var project_type_choose = $("#project_type_choose").val();
|
||
var axis_name_fa_choose = $("#axis_name_fa_choose").val();
|
||
var axis_type_id_choose = $("#axis_type_id_choose").val();
|
||
var last_digit_project_choose = $("#riali1_choose").val();
|
||
var last_function_operator_choose = $("#riali2_choose").val();
|
||
var last_payable_operator_choose = $("#riali3_choose").val();
|
||
var complete_payable_choose = $("#riali4_choose").val();
|
||
var city_id_choose = $("#city_id_choose").val();
|
||
var operator_name_choose = $("#operator_name_choose").val();
|
||
var operator_phone_choose = $("#operator_phone_choose").val();
|
||
if ($("#last_status_id_choose").css("display") == "none" && $("#last_status_id3_choose").css("display") == "none") {
|
||
var last_status_id_choose = $("#last_status_id2_Choose").val();
|
||
} else if ($("#last_status_id2_choose").css("display") == "none" && $("#last_status_id_choose").css("display") == "none") {
|
||
var last_status_id_choose = $("#last_status_id3_choose").val();
|
||
} else {
|
||
var last_status_id_choose = $("#last_status_id_choose").val();
|
||
}
|
||
var followup_priority_project_choose = $("#followup_priority_project_choose").val();
|
||
if ($("#progress_project_choose").css("display") != "none") {
|
||
var progress_project_choose = $("#progress_project_choose").val();
|
||
} else if ($("#progress_project3_choose").css("display") != "none") {
|
||
var progress_project_choose = $("#progress_project3_choose").val();
|
||
} else if ($("#progress_project4_choose").css("display") != "none") {
|
||
var progress_project_choose = $("#progress_project4_choose").val();
|
||
} else if ($("#progress_project5_choose").css("display") != "none") {
|
||
var progress_project_choose = $("#progress_project5_choose").val();
|
||
} else if ($("#progress_project6_choose").css("display") != "none") {
|
||
var progress_project_choose = $("#progress_project6_choose").val();
|
||
}
|
||
var operation_type_id1_choose = $("#operation_type_id1_choose").val();
|
||
var operation_type_id2_choose = $("#operation_type_id2_choose").val();
|
||
var operation_type_id3_choose = $("#operation_type_id3_choose").val();
|
||
var operation_type_id4_choose = $("#operation_type_id4_choose").val();
|
||
var operation_type_amount1_choose = $("#operation_type_amount1_choose").val();
|
||
var operation_type_amount2_choose = $("#operation_type_amount2_choose").val();
|
||
var operation_type_amount3_choose = $("#operation_type_amount3_choose").val();
|
||
var operation_type_amount4_choose = $("#operation_type_amount4_choose").val();
|
||
var operation_type_progress1_choose = $("#operation_type_progress1_choose").val();
|
||
var operation_type_progress2_choose = $("#operation_type_progress2_choose").val();
|
||
var operation_type_progress3_choose = $("#operation_type_progress3_choose").val();
|
||
var operation_type_progress4_choose = $("#operation_type_progress4_choose").val();
|
||
var operation_type_tonaj1_choose = $("#operation_type_tonaj1_choose").val();
|
||
var operation_type_tonaj2_choose = $("#operation_type_tonaj2_choose").val();
|
||
var operation_type_tonaj3_choose = $("#operation_type_tonaj3_choose").val();
|
||
var operation_type_tonaj4_choose = $("#operation_type_tonaj4_choose").val();
|
||
var projectrateid_choose = $("#projectrateid_choose").val();
|
||
var image1_choose = $("#deviceImg1_choose").get(0).files[0];
|
||
var image2_choose = $("#deviceImg2_choose").get(0).files[0];
|
||
|
||
var start_lat_choose = startAbrarMarkerupdate.getLatLng().lat.toFixed(6)
|
||
var start_lng_choose = startAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
var end_lat_choose = endAbrarMarkerupdate.getLatLng().lat.toFixed(6)
|
||
var end_lng_choose = endAbrarMarkerupdate.getLatLng().lng.toFixed(6)
|
||
|
||
|
||
|
||
var requestData = new FormData();
|
||
requestData.append('projectData_id', idselectedrow);
|
||
requestData.append('contract_id', vidpaiini);
|
||
requestData.append('city_id', city_id_choose);
|
||
requestData.append('province_id', province_idpaiini);
|
||
requestData.append('project_type_id', project_type_choose);
|
||
requestData.append('axis_type_id', axis_type_id_choose);
|
||
requestData.append('project_title', project_title_choose);
|
||
requestData.append('operation_type_id1', operation_type_id1_choose);
|
||
requestData.append('operation_type_id2', operation_type_id2_choose);
|
||
requestData.append('operation_type_id3', operation_type_id3_choose);
|
||
requestData.append('operation_type_id4', operation_type_id4_choose);
|
||
requestData.append('operation_type_amount1', operation_type_amount1_choose);
|
||
requestData.append('operation_type_amount2', operation_type_amount2_choose);
|
||
requestData.append('operation_type_amount3', operation_type_amount3_choose);
|
||
requestData.append('operation_type_amount4', operation_type_amount4_choose);
|
||
requestData.append('operation_type_progress1', operation_type_progress1_choose);
|
||
requestData.append('operation_type_progress2', operation_type_progress2_choose);
|
||
requestData.append('operation_type_progress3', operation_type_progress3_choose);
|
||
requestData.append('operation_type_progress4', operation_type_progress4_choose);
|
||
requestData.append('operation_type_tonaj1', operation_type_tonaj1_choose);
|
||
requestData.append('operation_type_tonaj2', operation_type_tonaj2_choose);
|
||
requestData.append('operation_type_tonaj3', operation_type_tonaj3_choose);
|
||
requestData.append('operation_type_tonaj4', operation_type_tonaj4_choose);
|
||
requestData.append('axis_name_fa', axis_name_fa_choose);
|
||
requestData.append('start_lat', start_lat_choose);
|
||
requestData.append('start_lng', start_lng_choose);
|
||
requestData.append('end_lat', end_lat_choose);
|
||
requestData.append('end_lng', end_lng_choose);
|
||
requestData.append('followup_priority_project_id', followup_priority_project_choose);
|
||
requestData.append('priority_project', projectrateid_choose);
|
||
requestData.append('operator_name', operator_name_choose);
|
||
requestData.append('operator_phone', operator_phone_choose);
|
||
requestData.append('progress_project', progress_project_choose);
|
||
requestData.append('last_status_id', last_status_id_choose);
|
||
requestData.append('last_digit_project', last_digit_project_choose);
|
||
requestData.append('last_function_operator', last_function_operator_choose);
|
||
requestData.append('last_payable_operator', last_payable_operator_choose);
|
||
requestData.append('complete_payable', complete_payable_choose);
|
||
if (typeof image1_choose !== "undefined")
|
||
requestData.append('image1', image1_choose);
|
||
if (typeof image2_choose !== "undefined")
|
||
requestData.append('image2', image2_choose);
|
||
requestData.append('addNewSubitemStatus', addNewSubitemStatus)
|
||
for (var pair of requestData.entries()) {
|
||
console.log(pair[0] + ', ' + pair[1]);
|
||
}
|
||
if ($("#modalAfterTable").find(".is-invalid-input").length != 0 || $("#deviceImg1Title_choose").css("display") != "none" || $("#deviceImg2Title_choose").css("display") != "none") {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تمامی فیلدهای مرتبط را تکمیل کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
} else {
|
||
showLoaderScreen()
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/store",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: requestData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
hideLoaderScreen();
|
||
$("#modalAfterTable").modal("hide");
|
||
table.ajax.reload(null, false);
|
||
},
|
||
error: function (error) {
|
||
hideLoaderScreen();
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "مشکل در ثبت",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
}
|
||
});
|
||
|
||
function phone_checker() {
|
||
if ($("#operator_phone").val().length == 11) {
|
||
$(".attent_num").fadeOut("100")
|
||
} else {
|
||
$(".attent_num").fadeIn("100")
|
||
}
|
||
}
|
||
|
||
function phone_checker_choose() {
|
||
if ($("#operator_phone_choose").val().length == 11) {
|
||
$(".attent_num_choose").fadeOut("100")
|
||
} else {
|
||
$(".attent_num_choose").fadeIn("100")
|
||
}
|
||
}
|
||
|
||
function phone_checker2() {
|
||
if ($("#operator_phone2").val().length == 11) {
|
||
$(".attent_num2").fadeOut("100")
|
||
} else {
|
||
$(".attent_num2").fadeIn("100")
|
||
}
|
||
}
|
||
$('#stepModalunderpro').on('hidden.bs.modal', function (e) {
|
||
$(".input_modal_table1").empty();
|
||
$(".input_modal_table1").append(
|
||
'<option value="0">انتخاب نوع عملیات </option>'
|
||
);
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-start]"
|
||
).removeClass("is-invalid-input");
|
||
$(
|
||
"#stepModalunderpro input[name=abrar-project-latlng-end]"
|
||
).removeClass("is-invalid-input");
|
||
});
|
||
$('#modalAfterTable').on('hidden.bs.modal', function (e) {
|
||
$("#operation_type_id1_choose option").css("display", "")
|
||
});
|
||
$('.riali input').on('input', function () {
|
||
var parent = $(this).closest('.riali')
|
||
if ($(this).val() == '') {
|
||
parent.find('span').text('0')
|
||
return false;
|
||
}
|
||
parent.find('span').text(parseInt($(this).val()).toLocaleString('en'))
|
||
});
|
||
$(".pre_distance_choose").on("click", function () {
|
||
var url_distance1 = "https://rms.rmto.ir/rahdari/road-maintenance-project/" + idselectedrow + "/get-distance-update-list";
|
||
var url_distance2 = "https://rms.rmto.ir/rahdari/road-danger-prevention/" + idselectedrow + "/get-distance-update-list";
|
||
var url_distance3 = "https://rms.rmto.ir/rahdari/road-upgrade-safety/" + idselectedrow + "/get-distance-update-list";
|
||
var url_distance4 = "https://rms.rmto.ir/rahdari/road-technical-building/" + idselectedrow + "/get-distance-update-list";
|
||
var url_distance5 = "https://rms.rmto.ir/rahdari/road-tollhouse-management/" + idselectedrow + "/get-distance-update-list";
|
||
$("#modal_distance").modal("show");
|
||
if (choosemahiatpro == 1) {
|
||
$(".appendhead").empty();
|
||
$(".appendbody").empty();
|
||
$(".appendheadsecond").empty()
|
||
$.ajax({
|
||
url: url_distance1,
|
||
type: "GET",
|
||
success: function (data) {
|
||
pre_distance = data.data.distance_update;
|
||
appendheadmaintan(pre_distance[0].previous_project_distance_update)
|
||
for (let index = 0; index < pre_distance.length; index++) {
|
||
after_distance = pre_distance[index].previous_project_distance_update;
|
||
appendbodymaintan(after_distance)
|
||
}
|
||
},
|
||
});
|
||
} else if (choosemahiatpro == 2) {
|
||
$(".appendhead").empty();
|
||
$(".appendbody").empty();
|
||
$(".appendheadsecond").empty()
|
||
|
||
$.ajax({
|
||
url: url_distance2,
|
||
type: "GET",
|
||
success: function (data) {
|
||
pre_distance = data.data.distance_update;
|
||
appendheaddanger(pre_distance[0].previous_project_distance_update)
|
||
for (let index = 0; index < pre_distance.length; index++) {
|
||
after_distance = pre_distance[index].previous_project_distance_update;
|
||
appendbodydanger(after_distance)
|
||
}
|
||
},
|
||
});
|
||
} else if (choosemahiatpro == 3) {
|
||
$(".appendhead").empty();
|
||
$(".appendbody").empty();
|
||
$(".appendheadsecond").empty()
|
||
$.ajax({
|
||
url: url_distance3,
|
||
type: "GET",
|
||
success: function (data) {
|
||
pre_distance = data.data.distance_update;
|
||
appendheadimeni(pre_distance.length, pre_distance[0].previous_project_distance_update)
|
||
for (let index = 0; index < pre_distance.length; index++) {
|
||
after_distance = pre_distance[index].previous_project_distance_update;
|
||
appendbodyimeni(after_distance)
|
||
}
|
||
},
|
||
});
|
||
} else if (choosemahiatpro == 4) {
|
||
$(".appendhead").empty();
|
||
$(".appendbody").empty();
|
||
$(".appendheadsecond").empty();
|
||
$.ajax({
|
||
url: url_distance4,
|
||
type: "GET",
|
||
success: function (data) {
|
||
pre_distance = data.data.distance_update;
|
||
appendheadtechnic(pre_distance[0].previous_project_distance_update)
|
||
for (let index = 0; index < pre_distance.length; index++) {
|
||
after_distance = pre_distance[index].previous_project_distance_update;
|
||
appendbodytechnic(after_distance)
|
||
}
|
||
},
|
||
});
|
||
} else if (choosemahiatpro == 5) {
|
||
$(".appendhead").empty();
|
||
$(".appendbody").empty();
|
||
$(".appendheadsecond").empty();
|
||
$.ajax({
|
||
url: url_distance5,
|
||
type: "GET",
|
||
success: function (data) {
|
||
pre_distance = data.data.distance_update;
|
||
appendheadtoll(pre_distance[0].previous_project_distance_update)
|
||
for (let index = 0; index < pre_distance.length; index++) {
|
||
after_distance = pre_distance[index].previous_project_distance_update;
|
||
appendbodytoll(after_distance)
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
});
|
||
|
||
function appentableprojecttitlemain(num) {
|
||
if (num == 1) {
|
||
return "روکش آسفالت"
|
||
} else if (num == 2) {
|
||
return "ماسه آسفالت و رگلاژی"
|
||
} else if (num == 3) {
|
||
return "بازیافت سرد و گرم"
|
||
} else if (num == 4) {
|
||
return "میکروسرفیسینگ"
|
||
} else if (num == 5) {
|
||
return "چیپ سیل"
|
||
} else if (num == 6) {
|
||
return "اسلاری سیل"
|
||
|
||
} else if (num == 7) {
|
||
return "اسکراب سیل"
|
||
|
||
} else if (num == 8) {
|
||
return "فوگ سیل"
|
||
|
||
} else if (num == 9) {
|
||
return "سیل کت"
|
||
|
||
} else if (num == 10) {
|
||
return "کیپ سیل"
|
||
|
||
} else if (num == 11) {
|
||
return "آسفالت سرد / ردمیکس"
|
||
|
||
} else if (num == 12) {
|
||
return "لکه گیری"
|
||
|
||
} else if (num == 13) {
|
||
return "درزگیری"
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
function appendtonazhmain(num, obj) {
|
||
|
||
if (num == 12) {
|
||
return obj[2]
|
||
} else if (num == 13) {
|
||
return "_"
|
||
} else {
|
||
return obj[1]
|
||
}
|
||
}
|
||
|
||
function appendmetremain(num, obj) {
|
||
if (num == 12) {
|
||
return obj[1]
|
||
} else {
|
||
return "_"
|
||
}
|
||
}
|
||
|
||
function appenddarsadmain(num, obj) {
|
||
if (num == 12) {
|
||
return obj[3]
|
||
} else if (num == 13) {
|
||
return obj[1]
|
||
} else {
|
||
return obj[2]
|
||
|
||
}
|
||
}
|
||
|
||
function appendheadmaintan(obj) {
|
||
showeachtr = "<th>مقدار</th><th>تناژ</th><th>درصد پیشرفت</th>"
|
||
showeachtr2 = "<th>مقدار</th><th>متر مربع</th><th>تناژ</th><th>درصد پیشرفت</th>"
|
||
showeachtr3 = "<th>مقدار</th><th>درصد پیشرفت</th>"
|
||
|
||
|
||
for (var key in obj) {
|
||
if (key == 12) {
|
||
var showtabeldanger = "<th colspan='4'>لکه گیری </th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr2)
|
||
} else if (key == 13) {
|
||
var showtabeldanger = "<th colspan='2'>درزگیری</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr3)
|
||
} else {
|
||
var showtabeldanger = "<th colspan='3'>" + appentableprojecttitlemain(key) + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr)
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function appendbodymaintan(pp) {
|
||
var test = ""
|
||
var showtabeldanger = ""
|
||
for (var key in pp) {
|
||
if (key == 13) {
|
||
showtabeldanger = "<td>" + pp[key][0] + "</td><td>" + pp[key][1] + "</td>"
|
||
test = test + showtabeldanger
|
||
} else if (key == 12) {
|
||
showtabeldanger = "<td>" + pp[key][0] + "</td><td>" + pp[key][2] + "</td><td>" + pp[key][1] + "</td><td>" + pp[key][3] + "</td>"
|
||
test = test + showtabeldanger
|
||
} else {
|
||
showtabeldanger = "<td>" + pp[key][0] + "</td><td>" + pp[key][1] + "</td><td>" + pp[key][2] + "</td>"
|
||
test = test + showtabeldanger
|
||
}
|
||
|
||
|
||
}
|
||
$(".appendbody").append("<tr>" + test + "</tr>")
|
||
}
|
||
|
||
function appendheaddanger(obj) {
|
||
showeachtr = "<th>درصد پیشرفت</th>"
|
||
|
||
for (var key in obj) {
|
||
var showtabeldanger = "<th>" + obj[key][1] + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr)
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function appendbodydanger(pp) {
|
||
var test = ""
|
||
var showtabeldanger = ""
|
||
for (var key in pp) {
|
||
showtabeldanger = "<td>" + pp[key][0] + "</td>"
|
||
test = test + showtabeldanger
|
||
|
||
}
|
||
$(".appendbody").append("<tr>" + test + "</tr>")
|
||
}
|
||
|
||
function appendheadimeni(num, obj) {
|
||
var colspanshow = ""
|
||
showeachtr = "<th>کیلومتر</th><th>درصد پیشرفت</th>"
|
||
showeachtr2 = "<th>درصد پیشرفت</th>"
|
||
for (var key in obj) {
|
||
if (key == 9) {
|
||
var showtabeldanger = "<th colspan='2'>" + obj[key][1] + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr2)
|
||
} else {
|
||
var showtabeldanger = "<th colspan='2'>" + obj[key][2] + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr)
|
||
}
|
||
}
|
||
}
|
||
|
||
function appendbodyimeni(pp) {
|
||
var test = ""
|
||
var showtabeldanger = ""
|
||
for (var key in pp) {
|
||
showtabeldanger = "<td>" + pp[key][0] + "</td><td> " + pp[key][1] + "</td>"
|
||
test = test + showtabeldanger
|
||
|
||
}
|
||
$(".appendbody").append("<tr>" + test + "</tr>")
|
||
}
|
||
|
||
function appendbodytechnic(pp) {
|
||
var test = ""
|
||
var showtabeltechnic = ""
|
||
for (var key in pp) {
|
||
showtabeltechnic = "<td>" + pp[key][0] + "</td>"
|
||
test = test + showtabeltechnic
|
||
|
||
}
|
||
$(".appendbody").append("<tr>" + test + "</tr>")
|
||
}
|
||
|
||
function appendheadtechnic(obj) {
|
||
showeachtr = "<th>درصد پیشرفت</th>"
|
||
|
||
for (var key in obj) {
|
||
var showtabeldanger = "<th>" + obj[key][1] + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr)
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function appendbodytoll(pp) {
|
||
var test = ""
|
||
var showtabeltoll = ""
|
||
for (var key in pp) {
|
||
showtabeltoll = "<td>" + pp[key][0] + "</td>"
|
||
test = test + showtabeltoll
|
||
|
||
}
|
||
$(".appendbody").append("<tr>" + test + "</tr>")
|
||
}
|
||
|
||
function appendheadtoll(obj) {
|
||
showeachtr = "<th>درصد پیشرفت</th>"
|
||
|
||
for (var key in obj) {
|
||
var showtabeldanger = "<th>" + obj[key][1] + "</th>"
|
||
$(".appendhead").append(showtabeldanger)
|
||
$(".appendheadsecond").append(showeachtr)
|
||
|
||
|
||
}
|
||
|
||
}
|
||
$("#last_status_id12").on("change", function () {
|
||
$("#progress_project2").val("");
|
||
$("#stepmodaledit #progress_project2").attr("disabled", false);
|
||
if ($("#last_status_id12").val() == 1) {
|
||
$("#progress_project2").removeClass("is-invalid-input");
|
||
$("#progress_project2_span").addClass("d-none");
|
||
$("#progress_project2").val("10");
|
||
$("#stepmodaledit #progress_project2").attr("disabled", true);
|
||
} else if ($("#last_status_id12").val() == 2) {
|
||
$("#stepmodaledit #progress_project2").attr("disabled", false);
|
||
} else if ($("#last_status_id12").val() == 3) {
|
||
$("#progress_project2").val("100");
|
||
$("#stepmodaledit #progress_project2").attr("disabled", true);
|
||
$("#progress_project2").removeClass("is-invalid-input");
|
||
$("#progress_project2_span").addClass("d-none");
|
||
}
|
||
});
|
||
$("#peyman_button").on("click", function () {
|
||
$("#peymankar_name").val("امانی");
|
||
});
|
||
$("#moshaver_button").on("click", function () {
|
||
$("#designer_name").val("ندارد");
|
||
});
|
||
$("#nazer_button").on("click", function () {
|
||
$("#nezarat_name").val("ندارد");
|
||
});
|
||
|
||
function appendYearFilter() {
|
||
var current_year;
|
||
$(".yearfilter").append(`<option value="0">انتخاب سال </option>`)
|
||
current_year = new persianDate().year();
|
||
for (let i = 1396; i <= current_year; i++) {
|
||
$(".yearfilter").append(
|
||
"\
|
||
<option value=" +
|
||
i +
|
||
">" +
|
||
i.toString() +
|
||
"</option>\
|
||
"
|
||
);
|
||
}
|
||
|
||
}
|
||
|
||
$("#btn_filter_show").on("click", function () {
|
||
let queryParems = []
|
||
var currentFilterQueryto = ""
|
||
var currentFilterQueryfrom = ""
|
||
var currentDate = {};
|
||
var provinceFiletr = [];
|
||
var statusFilter = [];
|
||
var TypeFiletr = [];
|
||
var containProject = $(".contain_project").val()
|
||
currentFilterYear = $('select[name="yearfilter"]').val();
|
||
if (currentFilterYear != 0) {
|
||
currentDate.from = moment(currentFilterYear, "jYYYY");
|
||
currentFilterQueryfrom = currentDate.from
|
||
.locale("fa")
|
||
.format("YYYY-MM-DD");
|
||
currentDate.to = moment(currentFilterYear, "jYYYY");
|
||
currentDate.to.add(1, "year");
|
||
currentFilterQueryto = currentDate.to
|
||
.locale("fa")
|
||
.format("YYYY-MM-DD");
|
||
queryParems.push(`fromDate=${currentFilterQueryfrom}`)
|
||
queryParems.push(`toDate=${currentFilterQueryto}`)
|
||
|
||
}
|
||
|
||
if (containProject != 0) {
|
||
queryParems.push(`status_rel=${containProject}`)
|
||
|
||
}
|
||
$("#select-province")
|
||
.select2("data")
|
||
.forEach((element) => {
|
||
provinceFiletr.push(element.id);
|
||
});
|
||
if (provinceFiletr.length != 0)
|
||
queryParems.push(`province=${provinceFiletr}`)
|
||
|
||
$(".last_statusfilter")
|
||
.select2("data")
|
||
.forEach((element) => {
|
||
statusFilter.push(element.id);
|
||
|
||
});
|
||
if (statusFilter.length != 0)
|
||
queryParems.push(`status=${statusFilter}`)
|
||
|
||
console.log({ statusFilter })
|
||
$(".project-type")
|
||
.select2("data")
|
||
.forEach((element) => {
|
||
TypeFiletr.push(element.id);
|
||
|
||
});
|
||
if (TypeFiletr.length != 0)
|
||
queryParems.push(`projectType=${TypeFiletr}`)
|
||
const url = `https://rms.rmto.ir/contracts/index${queryParems.length != 0 ? `?${queryParems.join('&')}` : ''}`
|
||
|
||
queryParemsExcel = queryParems
|
||
|
||
$.ajax({
|
||
url: url,
|
||
type: "GET",
|
||
success: function (result) {
|
||
if (result.data.length != 0) {
|
||
$("#examplefinance").dataTable().fnClearTable();
|
||
$("#examplefinance").dataTable().fnAddData(result.data);
|
||
} else {
|
||
$("#examplefinance").dataTable().fnClearTable();
|
||
|
||
}
|
||
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
text: "لطفا تمامی فیلدهای مرتبط را تکمیل کنید.",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
|
||
},
|
||
});
|
||
})
|
||
|
||
$("#btn_excel-download").on("click", function () {
|
||
let currentDate = {}
|
||
let queryParems = []
|
||
const project_type = $('select[name="select-project-type-excel"]').val()
|
||
const province = $('select[name="select-province-excel"]').val()
|
||
const status = $('select[name="select-status-excel"]').val()
|
||
const year = $('select[name="select-year-excel"]').val()
|
||
if (year != 0) {
|
||
currentDate.from = moment(year, "jYYYY").format("YYYY-MM-DD")
|
||
currentDate.to = moment(year, "jYYYY");
|
||
currentDate.to.locale("fa");
|
||
currentDate.to.add(1, "year");
|
||
currentDate.to = currentDate.to.locale("en").format("YYYY-MM-DD");
|
||
}
|
||
if (province != 0)
|
||
queryParems.push(`province=${province}`)
|
||
if (status != 0)
|
||
queryParems.push(`last_status_id=${status}`)
|
||
if (!jQuery.isEmptyObject(currentDate)) {
|
||
queryParems.push(`fromDate=${currentDate.from}`)
|
||
queryParems.push(`toDate=${currentDate.to}`)
|
||
}
|
||
const url = `https://rms.rmto.ir/reports/${project_type}${queryParems.length != 0 ? `?${queryParems.join('&')}` : ''}`
|
||
window.open(url, '_blank')
|
||
});
|
||
$("#example-update").on("click", ".btn-delete-subitem", function () {
|
||
var tr = $(this).closest("tr");
|
||
var row = subItemTable.row(tr);
|
||
var idkol = row.data().id;
|
||
let formData = new FormData();
|
||
formData.append("id", idkol);
|
||
Swal.fire({
|
||
icon: "warning",
|
||
title: "آیا برای حذف مطمئن هستید؟",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
cancelButtonColor: "#d33",
|
||
confirmButtonText: "بله، تایید میشود",
|
||
cancelButtonText: "منصرف شدم!",
|
||
showLoaderOnConfirm: true,
|
||
preConfirm: () => {
|
||
$.ajax({
|
||
url: "https://rms.rmto.ir/csi/delete",
|
||
type: "POST",
|
||
headers: {
|
||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||
},
|
||
data: formData,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
success: function (result) {
|
||
|
||
subItemTable.ajax.reload(null, false);
|
||
|
||
},
|
||
error: function (error) {
|
||
Swal.fire({
|
||
icon: "error",
|
||
title: "خطا",
|
||
confirmButtonText: "بستن",
|
||
});
|
||
},
|
||
});
|
||
},
|
||
});
|
||
});
|
||
$(document).on("click", "#btn_word_download", function () {
|
||
const provinceWordVal = $("#select-province-word option:selected").val();
|
||
window.open("https://rms.rmto.ir/contracts/word?province=" + provinceWordVal, "_blank");
|
||
}); |