Files
backend/public/dist/js/project-submit.js
2024-02-01 09:53:53 +00:00

3121 lines
135 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// Pages: Project Submit
//
var progressStep = 0;
var projectStep = 0;
var projectSubStep = 1;
var projectMaxSubStep = [5, 7, 1]; // Max sub step
var projectFromInputValue = [];
var projectFromInputValueReview = [];
var changeStepLock = false;
var persianDatepickerInput = null;
var persianDatepickerInputSubmit = null;
var stepBackup = projectStep;
var subStepBackUp = projectSubStep;
// Map variables
var map = null;
var mapReview = null;
var sourceLat = '';
var sourceLng = '';
var destLat = '';
var destLng = '';
var countMarker = 0;
var sourceMarker = null;
var destMarker = null;
var sourceReviewMarker = null;
var destReviewMarker = null;
var routeControls = [];
var popupArrays = [];
var polyline = null;
var originPlaceName = '';
var destinationPlaceName = '';
// Sliders
var projectRialSlider,
projectPhysicalSlider1,
projectPhysicalSlider2,
projectPhysicalSlider3,
projectPhysicalSlider4,
projectPhysicalSlider5,
projectPhysicalSlider6;
//:: Handler Variables
var OstanList = [];
var filespath = [];
var myDropzone;
function changeProgressStep(step, selected = null) {
if (step > 0) {
if (selected) {
let selectedProgressStep = $('.project-timeline > .card-timeline > .card-header ul > li:nth-child(' + (selected + 2) + ')');
selectedProgressStep.addClass('is-active').removeClass('is-completed');
selectedProgressStep.prevAll('li').each(function (index, element) {
$(element).addClass('is-completed');
});
} else {
let currentProgressStep = $('.project-timeline > .card-timeline > .card-header .is-active').addClass('is-completed').removeClass('is-active');
currentProgressStep.next().addClass('is-active');
}
} else {
if (selected) {
let selectedProgressStep = $('.project-timeline > .card-timeline > .card-header ul > li:nth-child(' + (selected + 2) + ')');
selectedProgressStep.addClass('is-active').removeClass('is-completed');
selectedProgressStep.nextAll('li').each(function (index, element) {
$(element).removeClass('is-completed is-active');
});
} else {
let currentProgressStep = $('.project-timeline > .card-timeline > .card-header .is-active').removeClass('is-active');
currentProgressStep.prev().addClass('is-active').removeClass('is-completed');
}
}
progressStep += (step * 25);
$('.project-timeline > .card-timeline > .card-header .step-progress').width(progressStep + '%');
}
function checkFormValidation() {
let message = [];
if (projectStep === 0) {
return 1;
} else {
switch (projectStep) {
case 1:
break;
case 2:
break;
case 3:
break;
}
if (message.length > 0) {
showFormErrorMessage(message);
return 0;
} else {
return 1;
}
}
}
function checkSubFormValidation() {
let message = [];
if (projectStep === 0) {
return 1;
} else {
switch (projectStep) {
case 1:
switch (projectSubStep) {
case 1: {
if ($('#modalOperationType1').is(':checked')) {
setFormInputValue('operationType', 'احداث');
setFormInputValue('operationType_DB', 0);
let constructionSubOperations = $('#modalConstructionSubOperation input:checked');
if (constructionSubOperations.length) {
let checkedSubOperations = [];
let checkedSubOperationsDB = [];
for (let index = 0; index < constructionSubOperations.length; index++) {
checkedSubOperations.push(returnSubOperation(constructionSubOperations[index].id));
checkedSubOperationsDB.push(parseInt((constructionSubOperations[index].id).substr(-1)));
}
setFormInputValue('operationSubType', checkedSubOperations);
setFormInputValue('operationSubType_DB', checkedSubOperationsDB);
} else {
message.push('نوع زیر عملیات را انتخاب کنید.');
}
} else if ($('#modalOperationType2').is(':checked')) {
setFormInputValue('operationType', 'نگهداری');
setFormInputValue('operationType_DB', 1);
let maintenanceSubOperations = $('#modalMaintenanceSubOperation input:checked');
if (maintenanceSubOperations.length) {
let checkedSubOperations = [];
let checkedSubOperationsDB = [];
for (let index = 0; index < maintenanceSubOperations.length; index++) {
checkedSubOperations.push(returnSubOperation(maintenanceSubOperations[index].id));
checkedSubOperationsDB.push(parseInt((maintenanceSubOperations[index].id).substr(-1)) + 6);
}
setFormInputValue('operationSubType', checkedSubOperations);
setFormInputValue('operationSubType_DB', checkedSubOperationsDB);
} else {
message.push('نوع زیر عملیات را انتخاب کنید.');
}
} else {
message.push('نوع عملیات را انتخاب کنید.');
}
break;
}
case 2: {
if (!$('input[name=sourceCord]').val()) {
message.push('مختصات ابتدای پروژه را وارد کنید.');
} else {
let sourceCord = $('input[name=sourceCord]').val().split(' - ');
setFormInputValue('projectSourceCord', [sourceCord[0].slice(1, -1), sourceCord[1].slice(1, -1)]);
setFormInputValue('projectSourceCordLat_DB', parseFloat(sourceCord[0].slice(1, -1)));
setFormInputValue('projectSourceCordLng_DB', parseFloat(sourceCord[1].slice(1, -1)));
}
if (!$('input[name=destCord]').val()) {
message.push('مختصات انتهای پروژه را وارد کنید.');
} else {
let destCord = $('input[name=destCord]').val().split(' - ');
setFormInputValue('projectDestCord', [destCord[0].slice(1, -1), destCord[1].slice(1, -1)]);
setFormInputValue('projectDestCordLat_DB', parseFloat(destCord[0].slice(1, -1)));
setFormInputValue('projectDestCordLng_DB', parseFloat(destCord[1].slice(1, -1)));
}
if (!$('input[name=calcDistance]').val()) {
message.push('طول پروژه را به درستی وارد کنید.');
} else {
let calcDistance = $('input[name=calcDistance]').val();
setFormInputValue('projectCalcDistance', calcDistance);
setFormInputValue('projectCalcDistance_DB', parseFloat(calcDistance));
}
break;
}
case 3: {
if (!$('select[name=selectOstan] > option:selected').val()) {
message.push('انتخاب اداره کل ضروری است.');
} else {
setFormInputValue('selectedProvince', $('select[name=selectOstan] > option:selected').val());
setFormInputValue('selectedProvinceString', $('select[name=selectOstan] > option:selected').text());
setFormInputValue('selectedProvince_DB', parseInt($('select[name=selectOstan] > option:selected').val()));
}
if (!$("#subOstan").val() || $("#subOstan").val() == 0) {
message.push('نام شهرستان ضروری است.');
} else {
setFormInputValue('selectedTown', $("#subOstan :selected").val());
setFormInputValue('selectedTownString', $("#subOstan :selected").text());
setFormInputValue('selectedTown_DB', parseInt($('#subOstan :selected').val()));
}
break;
}
case 4: {
if (value = $('input[name=projectAxis]').val()) {
let keepVal = value;
setFormInputValue('projectAxis', keepVal);
setFormInputValue('projectAxis_DB', keepVal);
}
if (value = $('input[name=projectName]').val()) {
let keepVal = value;
setFormInputValue('projectName', keepVal);
setFormInputValue('projectName_DB', keepVal);
}
break;
}
case 5: {
if ($('#axisType1').is(':checked')) {
setFormInputValue('projectAxisType', 'اصلی شریانی');
setFormInputValue('projectAxisType_DB', 0);
} else if ($('#axisType2').is(':checked')) {
setFormInputValue('projectAxisType', 'اصلی غیرشریانی');
setFormInputValue('projectAxisType_DB', 1);
} else if ($('#axisType3').is(':checked')) {
setFormInputValue('projectAxisType', 'فرعی');
setFormInputValue('projectAxisType_DB', 2);
} else if ($('#axisType4').is(':checked')) {
setFormInputValue('projectAxisType', 'روستایی');
setFormInputValue('projectAxisType_DB', 3);
} else {
message.push('نوع محور را تعیین کنید.');
}
break;
}
}
break;
case 2:
switch (projectSubStep) {
case 1: {
if (value = $('input[name=projectStartDate]').val()) {
setFormInputValue('projectStartDate', value);
setFormInputValue('projectStartDate_DB', persianDatepickerInput.getState().selected.unixDate);
} else {
message.push('تاریخ شروع به کار را تعیین کنید.');
}
break;
}
case 2: {
if ($('#projectType1').is(':checked')) {
setFormInputValue('projectType', 'امانی');
setFormInputValue('projectType_DB', 0);
} else if ($('#projectType2').is(':checked')) {
setFormInputValue('projectType', 'پیمانی');
setFormInputValue('projectType_DB', 1);
} else if ($('#projectType3').is(':checked')) {
setFormInputValue('projectType', 'امانی - پیمانی');
setFormInputValue('projectType_DB', 2);
} else {
message.push('نوع پروژه را انتخاب کنید.');
}
if (value = $('input[name=projectConsultantName]').val()) {
let keepVal = value;
setFormInputValue('projectConsultantName', keepVal);
setFormInputValue('projectConsultantName_DB', keepVal);
}
if (value = $('input[name=projectContractorName]').val()) {
let keepVal = value;
setFormInputValue('projectContractorName', keepVal);
setFormInputValue('projectContractorName_DB', keepVal);
}
break;
}
case 3: {
if (value = $('input[name=orderCredit]').val()) {
let keepVal = value;
setFormInputValue('amountOrderCredit', keepVal);
setFormInputValue('amountOrderCredit_DB', parseInt(keepVal));
} else {
message.push('میزان اعتبار قرارداد باید وارد شود.');
}
if (value = $('input[name=absorbedCredit]').val()) {
let keepVal = value;
setFormInputValue('amountAbsorbedCredit', keepVal);
setFormInputValue('amountAbsorbedCredit_DB', parseInt(keepVal));
} else {
message.push('میزان اعتبار جذب شده باید وارد شود.');
}
if (value = $('input[name=endCredit]').val()) {
let keepVal = value;
setFormInputValue('amountEndCredit', keepVal);
setFormInputValue('amountEndCredit_DB', parseInt(keepVal));
}
if ($('input[name=orderCredit]').val() && $('input[name=absorbedCredit]').val()) {
let keepVal = parseInt((parseInt(projectFromInputValue['amountAbsorbedCredit']) / parseInt(projectFromInputValue['amountOrderCredit'])) * 100);
setFormInputValue('projectRialSlider', keepVal);
setFormInputValue('projectRialSlider_DB', keepVal);
}
break;
}
case 4: {
if (value = $('select[name=announcedNumber] > option:selected').val()) {
let keepVal = value;
setFormInputValue('projectPlanNumber', keepVal);
setFormInputValue('projectPlanNumber_DB', keepVal);
}
if (value = $('input[name=announcedDate]').val()) {
setFormInputValue('projectAnnouncedDate', value);
setFormInputValue('projectAnnouncedDate_DB', persianDatepickerInput.getState().selected.unixDate);
}
}
case 5: {
let dbIndex = 0;
let dbSlider = [];
for (let index = 1; index < 7; index++) {
if ($('#projectPhysicalSlider' + index).length) {
setFormInputValue('projectPhysicalSlider' + index, window['projectPhysicalSlider' + index].slider('getValue'));
dbSlider[dbIndex++] = window['projectPhysicalSlider' + index].slider('getValue');
}
}
if (dbSlider.length > 0) {
setFormInputValue('projectPhysicalSlider_DB', dbSlider);
}
break;
}
case 6: {
setFormInputValue('projectRialSlider', projectRialSlider.slider('getValue'));
setFormInputValue('projectRialSlider_DB', projectRialSlider.slider('getValue'));
break;
}
case 7: {
if (value = $('textarea[name=projectProblem]').val()) {
let keepVal = value;
setFormInputValue('projectProblem', keepVal);
setFormInputValue('projectProblem_DB', keepVal);
}
setFormInputValue('projectProblemUploadedFiles_DB', $('input[name=modalUpFileSubmit]')[0]);
// filespath = [];
// myDropzone.files.forEach(function (item) {
// //filespath.push(item.dataURL);
// filespath.push(item.name);
// });
// //==================================================maxter
// if (filespath.length > 0) {
// setFormInputValue('projectProblemUploadedFiles', filespath);
// setFormInputValue('projectProblemUploadedFiles_DB', filespath);
// }
//=======================================
break;
}
}
break;
case 3:
switch (projectSubStep) {
case 1: {
if ($('#projectStatus1').is(':checked')) {
setFormInputValue('projectStatus', 'فعال');
setFormInputValue('projectStatus_DB', 0);
} else if ($('#projectStatus2').is(':checked')) {
setFormInputValue('projectStatus', 'متوقف');
setFormInputValue('projectStatus_DB', 1);
let projectStatusStop = $('#projectStatus2Box input:checked');
if (projectStatusStop.length) {
let checkedStatusStop = [];
let checkedStatusStop_DB = [];
for (let index = 0; index < projectStatusStop.length; index++) {
checkedStatusStop.push(projectStatusStop[index].id);
checkedStatusStop_DB.push(parseInt((projectStatusStop[index].id).substr(-1)));
}
setFormInputValue('projectStopReasons', checkedStatusStop);
setFormInputValue('projectStopReasons_DB', checkedStatusStop_DB);
}
else {
message.push('دلایل توقف را تعیین کنید.');
}
} else if ($('#projectStatus3').is(':checked')) {
setFormInputValue('projectStatus', 'خاتمه‌یافته');
setFormInputValue('projectStatus_DB', 2);
} else {
message.push('وضعیت فعلی پروژه را تعیین کنید.');
}
if ($('#projectCanOpening1').is(':checked')) {
setFormInputValue('projectCanOpening', 1);
setFormInputValue('projectCanOpening_DB', 1);
if (value = $('input[name=projectOpening]').val()) {
setFormInputValue('projectOpeningDate', value);
setFormInputValue('projectOpeningDate_DB', persianDatepickerInput.getState().selected.unixDate);
} else {
message.push('تاریخ افتتاح پروژه را تعیین کنید.');
}
} else {
setFormInputValue('projectCanOpening', 0);
setFormInputValue('projectCanOpening_DB', 0);
}
$('input[name=projectNazerName]').val('نام ناظر پروژه');
$('input[name=projectMasName]').val('نام مسئول پروژه');
//$('input[name=projectReportDate]').val();
setFormInputValue('projectNazerName_DB', 'نام ناظر پروژه');
setFormInputValue('projectMasName_DB', 'نام مسئول پروژه');
setFormInputValue('projectReportDate', $('input[name=projectReportDate]').val());
setFormInputValue('projectReportDate_DB', persianDatepickerInputSubmit.getState().selected.unixDate);
break;
}
case 2: {
if (!$('input[name=projectNazerName]').val()) {
message.push('نام ناظر پروژه اجباری است.');
} else {
setFormInputValue('projectNazerName', $('input[name=projectNazerName]').val());
}
if (!$('input[name=projectMasName]').val()) {
message.push('نام مسئول پروژه اجباری است.');
} else {
setFormInputValue('projectMasName', $('input[name=projectMasName]').val());
}
break;
}
case 3: {
if (!$('input[name=projectReportDate]').val()) {
message.push('تاریخ ثبت گزارش را انتخاب کنید.');
} else {
setFormInputValue('projectReportDate', $('input[name=projectReportDate]').val());
}
break;
}
}
break;
}
if (message.length > 0) {
showSubFormErrorMessage(message);
return 0;
} else {
return 1;
}
}
}
function returnSubOperation(id) {
switch (id) {
case 'constructionSubOperation1': {
return 'خاکی';
}
case 'constructionSubOperation2': {
return 'ابنیه';
}
case 'constructionSubOperation3': {
return 'زیراساس';
}
case 'constructionSubOperation4': {
return 'اساس';
}
case 'constructionSubOperation5': {
return 'آسفالت';
}
case 'constructionSubOperation6': {
return 'ایمن سازی';
}
case 'maintenanceSubOperation1': {
return 'لکه گیری';
}
case 'maintenanceSubOperation2': {
return 'روکش گرم';
}
case 'maintenanceSubOperation3': {
return 'ماسه آسفالت';
}
case 'maintenanceSubOperation4': {
return 'روکش حفاظتی';
}
case 'maintenanceSubOperation5': {
return 'تثبیت';
}
case 'maintenanceSubOperation6': {
return 'ایمن سازی';
}
}
}
function setFormInputValue(name, value) {
projectFromInputValue[name] = value;
$('input[name=' + name + 'Review]').val(value);
checkShowFromReview();
console.log(projectFromInputValue);
}
function getFormInputValue(name) {
if (value = projectFromInputValue[name]) {
return value;
} else {
return false;
}
}
function checkShowFromReview() {
for (let i = 1; i <= 12; i++) {
if ($('#physical' + i).parent().find('input').val()) {
showOrHideFromReview($('#physical' + i).parent().parent(), 1);
} else {
showOrHideFromReview($('#physical' + i).parent().parent(), 0);
}
}
if ($('input[name=projectStopReasonsReview]').val()) {
showOrHideFromReview($('input[name=projectStopReasonsReview]').parent().parent(), 1);
let projectStopReasonsFa = [];
for (let i = 0; i < (projectFromInputValue['projectStopReasons']).length; i++) {
switch (projectFromInputValue['projectStopReasons'][i]) {
case "stopReason1": {
projectStopReasonsFa.push('کمبود اعتبارات');
break;
}
case "stopReason2": {
projectStopReasonsFa.push('کمبود نیروی انسانی');
break;
}
case "stopReason3": {
projectStopReasonsFa.push('نبود ماشین آلات');
break;
}
case "stopReason4": {
projectStopReasonsFa.push('شرایط جوی');
break;
}
case "stopReason5": {
projectStopReasonsFa.push('قیر');
break;
}
}
}
$('input[name=projectStopReasonsReview]').val(projectStopReasonsFa);
} else {
showOrHideFromReview($('input[name=projectStopReasonsReview]').parent().parent(), 0);
}
if (getFormInputValue('projectSourceCord').length > 0) {
//console.log('Update Map');
}
if ($('input[name=projectConsultantNameReview]').val()) {
showOrHideFromReview($('input[name=projectConsultantNameReview]').parent().parent(), 1);
} else {
showOrHideFromReview($('input[name=projectConsultantNameReview]').parent().parent(), 0);
}
if ($('input[name=projectContractorNameReview]').val()) {
showOrHideFromReview($('input[name=projectContractorNameReview]').parent().parent(), 1);
} else {
showOrHideFromReview($('input[name=projectContractorNameReview]').parent().parent(), 0);
}
if ($('input[name=projectPlanNumberReview]').val()) {
showOrHideFromReview($('input[name=projectPlanNumberReview]').parent().parent(), 1);
} else {
showOrHideFromReview($('input[name=projectPlanNumberReview]').parent().parent(), 0);
}
if ($('input[name=projectAnnouncedDateReview]').val()) {
showOrHideFromReview($('input[name=projectAnnouncedDateReview]').parent().parent(), 1);
} else {
showOrHideFromReview($('input[name=projectAnnouncedDateReview]').parent().parent(), 0);
}
}
function showOrHideFromReview(element, show) {
if (show) {
$(element).show();
} else {
$(element).hide();
}
}
function showFormErrorMessage(msg) {
alert(msg);
}
function showSubFormErrorMessage(msg) {
let stepModalBodyErrorMenu = $(".project-timeline > .card-timeline > .card-body #stepModal .modal-body >.row ul.step-modal-error");
if (stepModalBodyErrorMenu.length) {
stepModalBodyErrorMenu.empty();
msg.forEach(element => {
stepModalBodyErrorMenu.append('<li>' + element + '</li>');
});
} else {
let stepModalBody = $(".project-timeline > .card-timeline > .card-body #stepModal .modal-body >.row");
let stepModalBodyErrorCol = $('<div class="col-sm-12 alert alert-danger fade in alert-dismissible show"></div>');
let stepModalBodyErrorMenu = $('<ul class="step-modal-error"></ul>');
stepModalBodyErrorCol.append('\
<button type="button" class="close" data-dismiss="alert" aria-label="Close">\
<span aria-hidden="true" style="font-size:20px">×</span>\
</button>\
');
msg.forEach(element => {
stepModalBodyErrorMenu.append('<li>' + element + '</li>');
});
stepModalBody.prepend(stepModalBodyErrorCol.append(stepModalBodyErrorMenu));
}
}
function addSubStepInput(subStep) {
let rowElement = $('<div class="row justify-content-center mb-3"></div>');
showInputModal(rowElement.append(fetchOrCreateSubStepInput(subStep)), subStep);
}
function fetchOrCreateSubStepInput(subStep) {
let inputElement = '<p>New Input Element</p>';
switch (projectStep) {
case 1:
switch (subStep) {
case 1: {
if (projectFromInputValue['operationType']) {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">نوع عملیات</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="modalOperationType1" name="operationType" ng-model="operationType" ng-value="احداث" ' +
((projectFromInputValue['operationType'] == "احداث") ? 'checked' : '')
+ '>\
<label for="modalOperationType1">\
احداث\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="modalOperationType2" name="operationType" ng-model="operationType" ng-value="نگهداری" ' +
((projectFromInputValue['operationType'] == "نگهداری") ? 'checked' : '')
+ '>\
<label for="modalOperationType2">\
نگهداری\
</label>\
</div>\
</div>\
</div>\
<div class="col-sm-12" id="modalConstructionSubOperation" style="display: ' +
((projectFromInputValue['operationType'] == "احداث") ? 'block' : 'none')
+ '">\
<div class="form-group">\
<label class="d-block required-label mb-3">نوع زیرعملیات</label>\
<div class="row mb-2">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation1" name="constructionSubOperation" ng-model="operationType.ehdas.t1" ng-true-value="خاکی" ' +
((projectFromInputValue['operationSubType'].indexOf("خاکی") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation1">\
خاکی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation2" name="constructionSubOperation" ng-model="operationType.ehdas.t2" ng-true-value="ابنیه" ' +
((projectFromInputValue['operationSubType'].indexOf("ابنیه") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation2">\
ابنیه\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation3" name="constructionSubOperation" ng-model="operationType.ehdas.t3" ng-true-value="زیراساس" ' +
((projectFromInputValue['operationSubType'].indexOf("زیراساس") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation3">\
زیراساس\
</label>\
</div>\
</div>\
</div>\
<div class="row">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation4" name="constructionSubOperation" ng-model="operationType.ehdas.t4" ng-true-value="اساس" ' +
((projectFromInputValue['operationSubType'].indexOf("اساس") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation4">\
اساس\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation5" name="constructionSubOperation" ng-model="operationType.ehdas.t5" ng-true-value="آسفالت" ' +
((projectFromInputValue['operationSubType'].indexOf("آسفالت") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation5">\
آسفالت\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation6" name="constructionSubOperation" ng-model="operationType.ehdas.t6" ng-true-value="ایمن سازی" ' +
((projectFromInputValue['operationSubType'].indexOf("ایمن سازی") >= 0) ? 'checked' : '')
+ '>\
<label for="constructionSubOperation6">\
ایمن سازی\
</label>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div class="col-sm-12" id="modalMaintenanceSubOperation" style="display: ' +
((projectFromInputValue['operationType'] == "نگهداری") ? 'block' : 'none')
+ '">\
<div class="form-group">\
<label class="d-block required-label mb-3">نوع زیرعملیات</label>\
<div class="row mb-2">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation1" name="maintenanceSubOperation" ng-model="operationType.ngd.t1" ng-true-value="لکه گیری" ' +
((projectFromInputValue['operationSubType'].indexOf("لکه گیری") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation1">\
لکه گیری\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation2" name="maintenanceSubOperation" ng-model="operationType.ngd.t2" ng-true-value="روکش گرم" ' +
((projectFromInputValue['operationSubType'].indexOf("روکش گرم") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation2">\
روکش گرم\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation3" name="maintenanceSubOperation" ng-model="operationType.ngd.t2" ng-true-value="روکش گرم" ' +
((projectFromInputValue['operationSubType'].indexOf("ماسه آسفالت") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation3">\
ماسه آسفالت\
</label>\
</div>\
</div>\
</div>\
<div class="row">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation4" name="maintenanceSubOperation" ng-model="operationType.ngd.t2" ng-true-value="روکش گرم" ' +
((projectFromInputValue['operationSubType'].indexOf("روکش حفاظتی") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation4">\
روکش حفاظتی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation5" name="maintenanceSubOperation" ng-model="operationType.ngd.t2" ng-true-value="روکش گرم" ' +
((projectFromInputValue['operationSubType'].indexOf("تثبیت") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation5">\
تثبیت\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation6" name="maintenanceSubOperation" ng-model="operationType.ngd.t2" ng-true-value="روکش گرم" ' +
((projectFromInputValue['operationSubType'].indexOf("ایمن سازی") >= 0) ? 'checked' : '')
+ '>\
<label for="maintenanceSubOperation6">\
ایمن سازی\
</label>\
</div>\
</div>\
</div>\
</div>\
</div>\
';
} else {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">نوع عملیات</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="modalOperationType1" name="operationType" ng-model="step1sub1operationType" ng-value="احداث">\
<label for="modalOperationType1">\
احداث\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="modalOperationType2" name="operationType" ng-model="step1sub1operationType" ng-value="نگهداری">\
<label for="modalOperationType2">\
نگهداری\
</label>\
</div>\
</div>\
</div>\
<div class="col-sm-12" id="modalConstructionSubOperation" style="display: none">\
<div class="form-group">\
<label class="d-block required-label mb-3">نوع زیرعملیات</label>\
<div class="row mb-2">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation1" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t1" ng-true-value="خاکی" >\
<label for="constructionSubOperation1">\
خاکی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation2" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t2" ng-true-value="ابنیه">\
<label for="constructionSubOperation2">\
ابنیه\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation3" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t3" ng-true-value="زیراساس">\
<label for="constructionSubOperation3">\
زیراساس\
</label>\
</div>\
</div>\
</div>\
<div class="row">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation4" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t4" ng-true-value="اساس">\
<label for="constructionSubOperation4">\
اساس\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation5" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t5" ng-true-value="آسفالت">\
<label for="constructionSubOperation5">\
آسفالت\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="constructionSubOperation6" name="constructionSubOperation" ng-model="step1.sub1.operationType.ehdas.t6" ng-true-value="ایمن سازی">\
<label for="constructionSubOperation6">\
ایمن سازی\
</label>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div class="col-sm-12" id="modalMaintenanceSubOperation" style="display: none">\
<div class="form-group">\
<label class="d-block required-label mb-3">نوع زیرعملیات</label>\
<div class="row mb-2">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation1" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t1" ng-true-value="لکه گیری">\
<label for="maintenanceSubOperation1">\
لکه گیری\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation2" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t2" ng-true-value="روکش گرم">\
<label for="maintenanceSubOperation2">\
روکش گرم\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation3" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t2" ng-true-value="روکش گرم">\
<label for="maintenanceSubOperation3">\
ماسه آسفالت\
</label>\
</div>\
</div>\
</div>\
<div class="row">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation4" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t2" ng-true-value="روکش گرم">\
<label for="maintenanceSubOperation4">\
روکش حفاظتی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation5" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t2" ng-true-value="روکش گرم">\
<label for="maintenanceSubOperation5">\
تثبیت\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="maintenanceSubOperation6" name="maintenanceSubOperation" ng-model="step1.sub1.operationType.ngd.t2" ng-true-value="روکش گرم">\
<label for="maintenanceSubOperation6">\
ایمن سازی\
</label>\
</div>\
</div>\
</div>\
</div>\
</div>\
';
}
break;
}
case 2: {
if (projectFromInputValue['projectSourceCord']) {
inputElement = '\
<div class="col-sm-12">\
<div class="map-layout">\
<div class="map-overlay" style="display: none">\
<div class="map-description-container">\
<div class="map-description">\
<p class="map-description-header-text mt-4">تعیین مختصات جغرافیایی پروژه</p>\
<p class="map-description-body-text">\
برای دسترسی سریع تر به موقعیت مکانی پروژه روی نقشه، می توانید نزدیک ترین\
شهر یا روستا را جستجو کنید:\
</p>\
<form autocomplete="off" class="place-search-container">\
<div class="autocomplete" style="width:85%;">\
<input id="myInput" type="text" name="myCountry" placeholder="جستجوی نزدیک ترین شهر یا روستا">\
</div>\
</form>\
<div class="show-map-button-container">\
<div class="show-map-button" onclick="clearInstructionBox()">\
<span class="show-map-button-text">انتخاب دستی از روی نقشه</span>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div class="pin-container">\
<img id="org-pin" src="../dist/images/origin.png" width="55" height="75">\
</div>\
<div class="pin-container">\
<img id="dest-pin" src="../dist/images/destination.png" width="55" height="75" style="display: none;">\
</div>\
<div id="map-layout"></div>\
</div>\
</div>\
<div class="col-sm-12">\
<div class="map-info">\
<form role="form">\
<div class="row">\
<div class="col-lg-6 col-md-6 col-sm-6">\
<div class="form-group">\
<label class="required-label">ابتدای پروژه</label>\
<input name="sourceCord" type="text" class="form-control"\
data-inputmask=\'"mask": "(99.9999999) - (99.9999999)"\' data-mask\
placeholder="(طول جغرافیایی) - (عرض جغرافیایی)" value="' +
(projectFromInputValue['projectSourceCord'][0] + projectFromInputValue['projectSourceCord'][1])
+ '">\
</div>\
</div>\
<div class="col-lg-6 col-md-6 col-sm-6">\
<div class="form-group">\
<label class="required-label">انتهای پروژه</label>\
<input name="destCord" type="text" class="form-control"\
data-inputmask=\'"mask": "(99.9999999) - (99.9999999)"\' data-mask\
placeholder="(طول جغرافیایی) - (عرض جغرافیایی)" value="' +
(projectFromInputValue['projectDestCord'][0] + projectFromInputValue['projectDestCord'][1])
+ '">\
</div>\
</div>\
<div class="col-lg-6 col-md-6 col-sm-12">\
<div class="form-group">\
<label class="required-label">طول پروژه (کیلومتر)</label>\
<input name="calcDistance" type="number" class="form-control"\
placeholder="کیلومتر" ' +
((projectFromInputValue['operationType'] == 'احداث') ? '' : 'disabled')
+ ' min="0" value="' +
(projectFromInputValue['projectCalcDistance'])
+ '">\
</div>\
</div>\
</div>\
</form>\
</div>\
</div>\
';
} else {
inputElement = '\
<div class="col-sm-12">\
<div class="map-layout">\
<div class="map-overlay">\
<div class="map-description-container">\
<div class="map-description">\
<p class="map-description-header-text mt-4">تعیین مختصات جغرافیایی پروژه</p>\
<p class="map-description-body-text">\
برای دسترسی سریع تر به موقعیت مکانی پروژه روی نقشه، می توانید نزدیک ترین\
شهر یا روستا را جستجو کنید:\
</p>\
<form autocomplete="off" class="place-search-container">\
<div class="autocomplete" style="width:85%;">\
<input id="myInput" type="text" name="myCountry" placeholder="جستجوی نزدیک ترین شهر یا روستا">\
</div>\
</form>\
<div class="show-map-button-container">\
<div class="show-map-button" onclick="clearInstructionBox()">\
<span class="show-map-button-text">انتخاب دستی از روی نقشه</span>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div class="pin-container">\
<img id="org-pin" src="../dist/images/origin.png" width="55" height="75">\
</div>\
<div class="pin-container">\
<img id="dest-pin" src="../dist/images/destination.png" width="55" height="75" style="display: none;">\
</div>\
<div id="map-layout"></div>\
</div>\
</div>\
<div class="col-sm-12">\
<div class="map-info">\
<form role="form">\
<div class="row">\
<div class="col-lg-6 col-md-6 col-sm-6">\
<div class="form-group">\
<label class="required-label">ابتدای پروژه</label>\
<input name="sourceCord" type="text" class="form-control"\
data-inputmask=\'"mask": "(99.9999999) - (99.9999999)"\' data-mask\
placeholder="(طول جغرافیایی) - (عرض جغرافیایی)">\
</div>\
</div>\
<div class="col-lg-6 col-md-6 col-sm-6">\
<div class="form-group">\
<label class="required-label">انتهای پروژه</label>\
<input name="destCord" type="text" class="form-control"\
data-inputmask=\'"mask": "(99.9999999) - (99.9999999)"\' data-mask\
placeholder="(طول جغرافیایی) - (عرض جغرافیایی)">\
</div>\
</div>\
<div class="col-lg-6 col-md-6 col-sm-12">\
<div class="form-group">\
<label class="required-label">طول پروژه (کیلومتر)</label>\
<input name="calcDistance" type="number" class="form-control"\
placeholder="کیلومتر" disabled min="0">\
</div>\
</div>\
</div>\
</form>\
</div>\
</div>\
';
}
break;
}
case 3: {
inputElement = '\
<div class="col-lg-6">\
<div class="form-group">\
<label class="required-label">اداره کل</label>\
<select class="form-control" name="selectOstan" id="selectOstan">\
<option value="">انتخاب کنید</option>\
<option name="آذربایجان شرقی" value="1">آذربایجان شرقی</option>\
<option name="آذربایجان غربی" value="2">آذربایجان غربی</option>\
<option name="اردبیل" value="3">اردبیل</option>\
<option name="اصفهان" value="4">اصفهان</option>\
<option name="البرز" value="5">البرز</option>\
<option name="ایلام" value="6">ایلام</option>\
<option name="بوشهر" value="7">بوشهر</option>\
<option name="تهران" value="8">تهران</option>\
<option name="چهارمحال و بختیاری" value="9">چهارمحال و بختیاری</option>\
<option name="خراسان جنوبی" value="10">خراسان جنوبی</option>\
<option name="خراسان رضوی" value="11">خراسان رضوی</option>\
<option name="خراسان شمالی" value="12">خراسان شمالی</option>\
<option name="خوزستان" value="13">خوزستان</option>\
<option name="زنجان" value="14">زنجان</option>\
<option name="سمنان" value="15">سمنان شرق</option>\
<option name="سمنان" value="16">سمنان غرب</option>\
<option name="سیستان و بلوچستان" value="17">سیستان و بلوچستان</option>\
<option name="سیستان و بلوچستان" value="18">ایرانشهر</option>\
<option name="فارس" value="19">فارس</option>\
<option name="فارس" value="20">لار</option>\
<option name="قزوین" value="21">قزوین</option>\
<option name="قم" value="22">قم</option>\
<option name="کردستان" value="23">کردستان</option>\
<option name="کرمان" value="24">کرمان شمال</option>\
<option name="کرمان" value="25">کرمان جنوب</option>\
<option name="کرمانشاه" value="26">کرمانشاه</option>\
<option name="کهگیلویه و بویر احمد" value="27">کهگیلویه و بویر احمد</option>\
<option name="گلستان" value="28">گلستان</option>\
<option name="گیلان" value="29">گیلان</option>\
<option name="لرستان" value="30">لرستان</option>\
<option name="مازندران" value="31">مازندران</option>\
<option name="مرکزی" value="32">مرکزی</option>\
<option name="هرمزگان" value="33">هرمزگان</option>\
<option name="همدان" value="34">همدان</option>\
<option name="یزد" value="35">یزد</option>\
</select>\
</div>\
</div>\
<div class="col-lg-6">\
<div class="form-group">\
<label class="required-label">شهرستان</label>\
<select class="form-control" name="subOstan" id="subOstan">\
</select>\
</div>\
</div>\
';
break;
}
case 4: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label>نام محور را وارد کنید:</label>\
<input name="projectAxis" type="text" class="form-control mb-2" placeholder="نام محور" ' +
((projectFromInputValue['projectAxis']) ? ('value="' + projectFromInputValue['projectAxis'] + '"') : '')
+ '>\
<label>نام پروژه را وارد کنید:</label>\
<input name="projectName" type="text" class="form-control" placeholder="نام پروژه" ' +
((projectFromInputValue['projectName']) ? ('value="' + projectFromInputValue['projectName'] + '"') : '')
+ '>\
</div>\
</div>\
';
break;
}
case 5: {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">نوع محور</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="axisType1" name="axisType" ' +
((projectFromInputValue['projectAxisType'] == 'اصلی شریانی') ? 'checked' : '')
+ '>\
<label for="axisType1">\
اصلی شریانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="axisType2" name="axisType" ' +
((projectFromInputValue['projectAxisType'] == 'اصلی غیرشریانی') ? 'checked' : '')
+ '>\
<label for="axisType2">\
اصلی غیرشریانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="axisType3" name="axisType" ' +
((projectFromInputValue['projectAxisType'] == 'فرعی') ? 'checked' : '')
+ '>\
<label for="axisType3">\
فرعی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="axisType4" name="axisType" ' +
((projectFromInputValue['projectAxisType'] == 'روستایی') ? 'checked' : '')
+ '>\
<label for="axisType4">\
روستایی\
</label>\
</div>\
</div>\
</div>\
';
break;
}
}
break;
case 2:
switch (subStep) {
case 1: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label class="required-label">تاریخ شروع به کار را تعیین کنید:</label>\
<input class="form-control" name="projectStartDate" placeholder="برای انتخاب تاریخ کلیک کنید" ' +
((projectFromInputValue['projectStartDate']) ? ('value="' + projectFromInputValue['projectStartDate'] + '"') : '')
+ '>\
</div>\
</div>\
';
break;
}
case 2: {
if (!projectFromInputValue['projectType']) {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">نوع پروژه را انتخاب کنید:</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="projectType1" name="projectType">\
<label for="projectType1">\
امانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectType2" name="projectType">\
<label for="projectType2">\
پیمانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectType3" name="projectType">\
<label for="projectType3">\
امانی - پیمانی\
</label>\
</div>\
</div>\
</div>\
<div class="col-sm-12">\
<div class="form-group">\
<label>نام مشاور پروژه را وارد کنید:</label>\
<input name="projectConsultantName" type="text" class="form-control" placeholder="نام مشاور">\
</div>\
<div id="contractorNameBox" class="form-group" style="display: none">\
<label>نام پیمانکار پروژه را وارد کنید:</label>\
<input name="projectContractorName" type="text" class="form-control" placeholder="نام پیمانکار">\
</div>\
</div>\
';
} else {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">نوع پروژه را انتخاب کنید:</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="projectType1" name="projectType" ' +
((projectFromInputValue['projectType'] == 'امانی') ? 'checked' : '')
+ '>\
<label for="projectType1">\
امانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectType2" name="projectType" ' +
((projectFromInputValue['projectType'] == 'پیمانی') ? 'checked' : '')
+ '>\
<label for="projectType2">\
پیمانی\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectType3" name="projectType" ' +
((projectFromInputValue['projectType'] == 'امانی - پیمانی') ? 'checked' : '')
+ '>\
<label for="projectType3">\
امانی - پیمانی\
</label>\
</div>\
</div>\
</div>\
<div class="col-sm-12">\
<div class="form-group">\
<label>نام مشاور پروژه را وارد کنید:</label>\
<input name="projectConsultantName" type="text" class="form-control" placeholder="نام مشاور" ' +
((projectFromInputValue['projectConsultantName']) ? ('value="' + projectFromInputValue['projectConsultantName'] + '"') : '')
+ '>\
</div>\
<div id="contractorNameBox" class="form-group" style="display: ' +
((['پیمانی', 'امانی - پیمانی'].includes(projectFromInputValue['projectType'])) ? 'block' : 'none')
+ '">\
<label>نام پیمانکار پروژه را وارد کنید:</label>\
<input name="projectContractorName" type="text" class="form-control" placeholder="نام پیمانکار" ' +
((projectFromInputValue['projectContractorName']) ? ('value="' + projectFromInputValue['projectContractorName'] + '"') : '')
+ '>\
</div>\
</div>\
';
}
break;
}
case 3: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label class="required-label">میزان اعتبار قرارداد: (میلیون ریال)</label>\
<input name="orderCredit" type="number" min="0" class="form-control" placeholder="میلیون ریال" ' +
((projectFromInputValue['amountOrderCredit']) ? ('value="' + projectFromInputValue['amountOrderCredit'] + '"') : '')
+ '>\
</div>\
<div class="form-group">\
<label class="required-label">میزان اعتبار جذب شده: (میلیون ریال)</label>\
<input name="absorbedCredit" type="number" min="0" class="form-control" placeholder="میلیون ریال" ' +
((projectFromInputValue['amountAbsorbedCredit']) ? ('value="' + projectFromInputValue['amountAbsorbedCredit'] + '"') : '')
+ '>\
</div>\
<div class="form-group">\
<label>میزان اعتبار موردنیاز جهت اتمام: (میلیون ریال)</label>\
<input name="endCredit" type="number" min="0" class="form-control" placeholder="میلیون ریال" ' +
((projectFromInputValue['amountEndCredit']) ? ('value="' + projectFromInputValue['amountEndCredit'] + '"') : '')
+ '>\
</div>\
</div>\
';
break;
}
case 4: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label>شماره طرح را انتخاب کنید:</label>\
<select class="form-control" name="announcedNumber" id="subOstan">\
<option value="">انتخاب کنید</option>\
<option value="1303016137" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016137') ? 'selected' : '') + '>R1303016137</option>\
<option value="1303016138" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016138') ? 'selected' : '') + '>R1303016138</option>\
<option value="1303016219" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016219') ? 'selected' : '') + '>R1303016219</option>\
<option value="1303016223" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016223') ? 'selected' : '') + '>R1303016223</option>\
<option value="1303016224" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016224') ? 'selected' : '') + '>F1303016224</option>\
<option value="1303016248" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016248') ? 'selected' : '') + '>R1303016248</option>\
<option value="1303016249" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016249') ? 'selected' : '') + '>R1303016249</option>\
<option value="1303016250" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016250') ? 'selected' : '') + '>R1303016250</option>\
<option value="1303016251" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016251') ? 'selected' : '') + '>R1303016251</option>\
<option value="1303016252" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016252') ? 'selected' : '') + '>R1303016252</option>\
<option value="1303016255" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016255') ? 'selected' : '') + '>F1303016255</option>\
<option value="1303016263" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016263') ? 'selected' : '') + '>R1303016263</option>\
<option value="1303016291" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016291') ? 'selected' : '') + '>R1303016291</option>\
<option value="1303016292" ' + ((projectFromInputValue['projectPlanNumber'] && projectFromInputValue['projectPlanNumber'] == '1303016292') ? 'selected' : '') + '>R1303016292</option>\
</select>\
<label>تاریخ ابلاغ را وارد کنید:</label>\
<input name="announcedDate" class="form-control" placeholder="تاریخ ابلاغ" ' +
((projectFromInputValue['projectAnnouncedDate']) ? ('value="' + projectFromInputValue['projectAnnouncedDate'] + '"') : '')
+ '>\
</div>\
</div>\
';
break;
}
case 5: {
if (getFormInputValue('operationType') === 'احداث') {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label d-block">\
درصد پیشرفت فیزیکی هر مرحله را تعیین کنید (احداث):\
</div>\
';
if ((getFormInputValue('operationSubType')).indexOf("خاکی") >= 0) {
inputElement += '\
<div class="radio-header">\
خاکی:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider1" type="text" data-slider-id="projectPhysicalSlider1"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("ابنیه") >= 0) {
inputElement += '\
<div class="radio-header">\
ابنیه:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider2" type="text" data-slider-id="projectPhysicalSlider2"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("زیراساس") >= 0) {
inputElement += '\
<div class="radio-header">\
زیراساس:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider3" type="text" data-slider-id="projectPhysicalSlider3"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("اساس") >= 0) {
inputElement += '\
<div class="radio-header">\
اساس:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider4" type="text" data-slider-id="projectPhysicalSlider4"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("آسفالت") >= 0) {
inputElement += '\
<div class="radio-header">\
آسفالت:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider5" type="text" data-slider-id="projectPhysicalSlider5"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("ایمن سازی") >= 0) {
inputElement += '\
<div class="radio-header">\
ایمن سازی:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-2">\
<input id="projectPhysicalSlider6" type="text" data-slider-id="projectPhysicalSlider6"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
} else {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label d-block">\
درصد پیشرفت فیزیکی هر مرحله را تعیین کنید (نگهداری):\
</div>\
';
if ((getFormInputValue('operationSubType')).indexOf("لکه گیری") >= 0) {
inputElement += '\
<div class="radio-header">\
لکه گیری:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider1" type="text" data-slider-id="projectPhysicalSlider1"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("روکش گرم") >= 0) {
inputElement += '\
<div class="radio-header">\
روکش گرم:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider2" type="text" data-slider-id="projectPhysicalSlider2"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("ماسه آسفالت") >= 0) {
inputElement += '\
<div class="radio-header">\
ماسه آسفالت:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider3" type="text" data-slider-id="projectPhysicalSlider3"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("روکش حفاظتی") >= 0) {
inputElement += '\
<div class="radio-header">\
روکش حفاظتی:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider4" type="text" data-slider-id="projectPhysicalSlider4"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("تثبیت") >= 0) {
inputElement += '\
<div class="radio-header">\
تثبیت:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectPhysicalSlider5" type="text" data-slider-id="projectPhysicalSlider5"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
if ((getFormInputValue('operationSubType')).indexOf("ایمن سازی") >= 0) {
inputElement += '\
<div class="radio-header">\
ایمن سازی:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-2">\
<input id="projectPhysicalSlider6" type="text" data-slider-id="projectPhysicalSlider6"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
';
}
}
inputElement += '\
</div>\
';
break;
}
case 6: {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">\
درصد پیشرفت ریالی پروژه را تعیین کنید:\
</div>\
<div class="project-slider status-slider-body pr-3 pl-3 mb-5">\
<input id="projectRialSlider" type="text" data-slider-id="dataProjectRialSlider"\
data-slider-ticks="[0, 100]" data-slider-ticks-snap-bounds="1">\
</div>\
<div class="project-slider-button d-flex justify-content-center" slider="projectRialSlider">\
<span class="slider-button-down"><i class="fas fa-minus"></i></span>\
<div class="slider-button-div"><span>٪</span><span class="slider-button-value">' +
((projectFromInputValue['projectRialSlider']) ? projectFromInputValue['projectRialSlider'] : 0)
+ '</span></div>\
<span class="slider-button-up"><i class="fas fa-plus"></i></span>\
</div>\
</div>\
';
break;
}
case 7: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label>نقاط قوت پروژه و پیشنهادات:</label>\
<textarea class="form-control" name="projectProblem" rows="5"\
placeholder="متن خود را وارد کنید..." style="resize: none;">' +
((projectFromInputValue['projectProblem']) ? projectFromInputValue['projectProblem'] : '')
+ '</textarea>\
</div>\
<div class="form-group">\
<label>مستندات پروژه:</label>\
<div class="input-group">\
<input class="file-input" type="file" name="modalUpFileSubmit" multiple>\
</div>\
</div>\
</div>\
';
break;
}
case 8: {
// <div class="form-group">\
// <label>مستندات پروژه:</label>\
// <div class="input-group">\
// <input class="file-input" type="file" name="modalUpFileSubmit" multiple>\
// </div>\
// </div>\
// inputElement = '\
// <div class="col-sm-12">\
// پایان مرحله دوم\
// </div>\
// ';
break;
}
}
break;
case 3:
switch (subStep) {
case 1: {
inputElement = '\
<div class="col-sm-12">\
<div class="radio-header required-label">وضعیت فعلی پروژه را تعیین کنید:</div>\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="radio" id="projectStatus1" name="projectStatus" ' +
((projectFromInputValue['projectStatus'] == 'فعال') ? 'checked' : '')
+ '>\
<label for="projectStatus1">\
فعال\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectStatus2" name="projectStatus" ' +
((projectFromInputValue['projectStatus'] == 'متوقف') ? 'checked' : '')
+ '>\
<label for="projectStatus2">\
متوقف\
</label>\
</div>\
<div class="icheck-primary d-inline mr-lg-3 mr-0">\
<input type="radio" id="projectStatus3" name="projectStatus" ' +
((projectFromInputValue['projectStatus'] == 'خاتمه‌یافته') ? 'checked' : '')
+ '>\
<label for="projectStatus3">\
خاتمه‌یافته\
</label>\
</div>\
</div>\
</div>\
<div class="col-sm-12" id="projectStatus2Box" style="display: ' +
((projectFromInputValue['projectStatus'] == 'متوقف') ? 'block' : 'none')
+ '">\
<div class="form-group">\
<label class="required-label">دلایل توقف را انتخاب کنید:</label>\
<div class="row mb-2 mt-2">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="stopReason1" name="stopReasons" ' +
((projectFromInputValue['projectStopReasons'] && projectFromInputValue['projectStopReasons'].indexOf("stopReason1") >= 0) ? 'checked' : '')
+ '>\
<label for="stopReason1">\
کمبود اعتبارات\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="stopReason2" name="stopReasons" ' +
((projectFromInputValue['projectStopReasons'] && projectFromInputValue['projectStopReasons'].indexOf("stopReason2") >= 0) ? 'checked' : '')
+ '>\
<label for="stopReason2">\
کمبود نیروی انسانی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="stopReason3" name="stopReasons" ' +
((projectFromInputValue['projectStopReasons'] && projectFromInputValue['projectStopReasons'].indexOf("stopReason3") >= 0) ? 'checked' : '')
+ '>\
<label for="stopReason3">\
نبود ماشین آلات\
</label>\
</div>\
</div>\
</div>\
<div class="row mb-4">\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="stopReason4" name="stopReasons" ' +
((projectFromInputValue['projectStopReasons'] && projectFromInputValue['projectStopReasons'].indexOf("stopReason4") >= 0) ? 'checked' : '')
+ '>\
<label for="stopReason4">\
شرایط جوی\
</label>\
</div>\
</div>\
<div class="col-lg-4 col-md-4 col-sm-4">\
<div class="icheck-primary d-inline ml-2">\
<input type="checkbox" id="stopReason5" name="stopReasons" ' +
((projectFromInputValue['projectStopReasons'] && projectFromInputValue['projectStopReasons'].indexOf("stopReason5") >= 0) ? 'checked' : '')
+ '>\
<label for="stopReason5">\
قیر\
</label>\
</div>\
</div>\
</div>\
</div>\
</div>\
<div class="col-sm-12">\
<div class="row">\
<div class="col-sm-6">\
<div class="form-group radio-body clearfix">\
<div class="icheck-primary d-inline">\
<input type="checkbox" id="projectCanOpening1" name="projectCanOpening" ' +
((projectFromInputValue['projectCanOpening']) ? 'checked' : '')
+ '>\
<label for="projectCanOpening1">\
این پروژه قابل افتتاح است.\
</label>\
</div>\
</div>\
</div>\
<div id="projectOpeningBox" class="col-sm-6" style="display: ' +
((projectFromInputValue['projectCanOpening']) ? 'block' : 'none')
+ '">\
<div class="form-group">\
<label class="required-label">تاریخ افتتاح پروژه را وارد کنید:</label>\
<input class="form-control" name="projectOpening" ' +
((projectFromInputValue['projectOpeningDate']) ? ('value="' + projectFromInputValue['projectOpeningDate'] + '"') : '')
+ '>\
</div>\
</div>\
</div>\
</div>\
';
break;
}
/*case 2: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label class="required-label">نام ناظر پروژه را وارد کنید:</label>\
<input name="projectNazerName" type="text" class="form-control" placeholder="نام ناظر">\
</div>\
<div class="form-group">\
<label class="required-label">نام مسئول استانی پروژه را وارد کنید:</label>\
<input name="projectMasName" type="text" class="form-control" placeholder="نام مسئول">\
</div>\
</div>\
';
break;
}
case 3: {
inputElement = '\
<div class="col-sm-12">\
<div class="form-group">\
<label class="required-label">تاریخ و ساعت ثبت گزارش را وارد کنید:</label>\
<input class="form-control" name="projectReportDate">\
</div>\
</div>\
';
break;
}*/
//case 4: {
// inputElement = '\
// <div class="col-sm-12">\
// پایان مرحله سوم\
// </div>\
// ';
//break;
//}
}
break;
default:
//
}
return inputElement;
}
function showInputModal(element, subStep) {
let stepModal = $(".project-timeline > .card-timeline > .card-body #stepModal");
let stepModalBody = stepModal.find('.modal-body');
stepModalBody.empty();
stepModalBody.append(element);
stepModal.modal({ backdrop: 'static', keyboard: false });
stepModal.modal('hide');
stepModal.modal('show');
someActionAfterShowModal(subStep);
}
function changeProjectSliderColor(sliderId, sliderVal) {
if (sliderVal < 34) {
sliderId.find('.slider-selection').css('background', '#c82333');
sliderId.find('.slider-handle').css('background', '#c82333');
sliderId.find('.slider-tick.in-selection').css('background', '#c82333');
} else if (sliderVal < 67) {
sliderId.find('.slider-selection').css('background', '#ffc107');
sliderId.find('.slider-handle').css('background', '#ffc107');
sliderId.find('.slider-tick.in-selection').css('background', '#ffc107');
} else {
sliderId.find('.slider-selection').css('background', '#28a745');
sliderId.find('.slider-handle').css('background', '#28a745');
sliderId.find('.slider-tick.in-selection').css('background', '#28a745');
}
}
function someActionAfterShowModal(subStep) {
switch (projectStep) {
case 1:
switch (subStep) {
case 1: {
// When one radio button is checked
$('#modalOperationType1').on('click', function () {
if ($(this).is(':checked')) {
$('#modalMaintenanceSubOperation').hide();
$('#modalConstructionSubOperation').show();
} else {
$('#modalConstructionSubOperation').hide();
}
});
$('#modalOperationType2').on('click', function () {
if ($(this).is(':checked')) {
$('#modalConstructionSubOperation').hide();
$('#modalMaintenanceSubOperation').show();
} else {
$('#modalMaintenanceSubOperation').hide();
}
});
break;
}
case 2: {
// Coordinates input mask
$('[data-mask]').inputmask();
// Location search autocomplete
/*initiate the autocomplete function on the "myInput" element, and pass along the countries array as possible autocomplete values:*/
inputAutoComplete(document.getElementById("myInput"));
// Show map
showMap();
// getUserCurrentLocation();
if (projectFromInputValue['projectSourceCord'] && projectFromInputValue['projectDestCord']) {
initialMapRouting(getFormInputValue('operationType'));
} else {
handleMapRouting(getFormInputValue('operationType'));
}
break;
}
case 3: {
$.get('https://testmap.141.ir/nominatim/reverse.php?format=json&lat=' + sourceLat + '&lon=' + sourceLng + '&zoom=12&accept-language=fa', function (result) {
//console.log(result.address.county.substring(8));
//maxterix
it = 0;
var txt;
var cindex;
var crtown;
$("#selectOstan > option").each(function () {
txt = $(this).attr("name");
OstanList.push({ value: it, name: txt });
it = it + 1;
});
txt = result.address.state.substring(6);
crtown = result.address.county.substring(8);
//console.log(OstanList);
for (var i = 1; i < OstanList.length; i++) {
var oname = OstanList[i].name;
var qx = oname.localeCompare(txt);
if (qx == 0) {
cindex = i;
if (projectFromInputValue['selectedProvince']) {
cindex = parseInt(projectFromInputValue['selectedProvince']);
}
$("#selectOstan").val(cindex);
$('#selectOstan').change();
applyctx(cindex);
// alert(cindex);
break;
}
}
//=================CtSelect maxwind==============
$('#selectOstan').on('change', function (e) {
var optionSelected = $("option:selected", this);
var valueSelected = this.value;
applyctx(this, 1);
});
//=======================================
function applyctx(th, onChange = 0) {
var tx = 0;
var nct = 0;
var listtxt;
var crx;
selected_city = $('#selectOstan').val() || null;
nct = parseInt(selected_city);
//==========================
// alert(crtown);
//===================================
$('#subOstan').html('').fadeIn(800).append('<option value="0">لطفا کمی صبر کنید ...</option>');
//console.log(citix);
var cities = JSON.stringify(citix);
if (projectFromInputValue['selectedTown']) {
$('#subOstan').html('').fadeIn(800).append('<option value="0">انتخاب شهر</option>');
} else {
$('#subOstan').html('').fadeIn(800).append('<option value="0" selected>انتخاب شهر</option>');
}
$.each(citix, function (i, city) {
if (nct == city.ID) {
for (let ii = 0; ii < city.sub.length; ++ii) {
tx = tx + 1;
listtxt = city.sub[ii].name;
$('#subOstan').append('<option value="' + tx + '" ' + ((parseInt(projectFromInputValue['selectedTown']) == tx) ? 'selected' : '') + '>' + listtxt + '</option>');
if (crtown.localeCompare(listtxt) == 0 || crtown == listtxt) {
crx = ii + 1;
// $('#subOstan').val(ii+1);
// $('#subOstan').change();
}
}
}
});
if (projectFromInputValue['selectedTown']) {
$('#subOstan').val(parseInt(projectFromInputValue['selectedTown']));
$('#subOstan').change();
} else if (onChange) {
$('#subOstan').val(0);
$('#subOstan').change();
} else {
$('#subOstan').val(crx);
$('#subOstan').change();
}
};
//maxterix=========================================
//$('select option[name=' + '"' + result.address.state.substring(6) + '"' + ']').attr('selected', 'selected');
//$('input[name="town"]').attr('value', result.address.county.substring(8));
});
$.get('https://testmap.141.ir/nominatim/reverse.php?format=json&lat=' + sourceLat + '&lon=' + sourceLng + '&zoom=14&accept-language=fa', function (result) {
//console.log(result);
if ('village' in result.address) {
originPlaceName = result.address.village;
} else if ('town' in result.address) {
originPlaceName = result.address.town;
} else if ('city' in result.address) {
originPlaceName = result.address.city;
}
});
$.get('https://testmap.141.ir/nominatim/reverse.php?format=json&lat=' + destLat + '&lon=' + destLng + '&zoom=14&accept-language=fa', function (result) {
//console.log(result);
if ('village' in result.address) {
destinationPlaceName = result.address.village;
} else if ('town' in result.address) {
destinationPlaceName = result.address.town;
} else if ('city' in result.address) {
destinationPlaceName = result.address.city;
}
});
break;
}
case 4: {
if (!projectFromInputValue['projectAxis']) {
$('input[name=projectAxis]').val(originPlaceName + '-' + destinationPlaceName);
}
break;
}
}
break;
case 2:
switch (subStep) {
case 1: {
persianDatepickerInput = $('input[name=projectStartDate]').persianDatepicker({
format: 'YYYY/MM/DD',
initialValue: false,
autoClose: true
});
break;
}
case 2: {
$('#projectType1').on('click', function () {
$('#contractorNameBox').hide();
});
$('#projectType2').on('click', function () {
$('#contractorNameBox').show();
});
$('#projectType3').on('click', function () {
$('#contractorNameBox').show();
});
break;
}
case 3: {
break;
}
case 4: {
persianDatepickerInput = $('input[name=announcedDate]').persianDatepicker({
format: 'YYYY/MM/DD',
initialValue: false,
autoClose: true
});
}
case 5: {
if (getFormInputValue('operationType') == 'احداث') {
$('#physical1').text('خاکی');
$('#physical2').text('ابنیه');
$('#physical3').text('زیراساس');
$('#physical4').text('اساس');
$('#physical5').text('آسفالت');
$('#physical6').text('ایمن سازی');
} else {
$('#physical1').text('لکه گیری');
$('#physical2').text('روکش گرم');
$('#physical3').text('ماسه آسفالت');
$('#physical4').text('روکش حفاظتی');
$('#physical5').text('تثبیت');
$('#physical6').text('ایمن سازی');
}
if ($("#projectPhysicalSlider1").length > 0) {
projectPhysicalSlider1 = $("#projectPhysicalSlider1").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider1']) ? (projectFromInputValue['projectPhysicalSlider1']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
if ($("#projectPhysicalSlider2").length > 0) {
projectPhysicalSlider2 = $("#projectPhysicalSlider2").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider2']) ? (projectFromInputValue['projectPhysicalSlider2']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
if ($("#projectPhysicalSlider3").length > 0) {
projectPhysicalSlider3 = $("#projectPhysicalSlider3").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider3']) ? (projectFromInputValue['projectPhysicalSlider3']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
if ($("#projectPhysicalSlider4").length > 0) {
projectPhysicalSlider4 = $("#projectPhysicalSlider4").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider4']) ? (projectFromInputValue['projectPhysicalSlider4']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
if ($("#projectPhysicalSlider5").length > 0) {
projectPhysicalSlider5 = $("#projectPhysicalSlider5").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider5']) ? (projectFromInputValue['projectPhysicalSlider5']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
if ($("#projectPhysicalSlider6").length > 0) {
projectPhysicalSlider6 = $("#projectPhysicalSlider6").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectPhysicalSlider6']) ? (projectFromInputValue['projectPhysicalSlider6']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
}
for (let index = 1; index < 7; index++) {
if ($('#projectPhysicalSlider' + index).length) {
let getValue = window['projectPhysicalSlider' + index].slider('getValue');
let sliderEl = $("#projectPhysicalSlider" + index);
changeProjectSliderColor(sliderEl, getValue);
}
}
$("#projectPhysicalSlider1").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
$("#projectPhysicalSlider2").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
$("#projectPhysicalSlider3").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
$("#projectPhysicalSlider4").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
$("#projectPhysicalSlider5").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
$("#projectPhysicalSlider6").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
});
break;
}
case 6: {
projectRialSlider = $("#projectRialSlider").slider({
min: 0,
max: 100,
value: (projectFromInputValue['projectRialSlider']) ? (projectFromInputValue['projectRialSlider']) : 0,
ticks: [0, 100],
ticks_snap_bounds: 1,
formatter: function (value) {
return value + '٪';
},
tooltip: 'always',
tooltip_position: 'bottom'
});
if (projectFromInputValue['projectRialSlider']) {
changeProjectSliderColor($("#dataProjectRialSlider"), projectFromInputValue['projectRialSlider']);
}
$("#dataProjectRialSlider").on("slide", function (slideEvt) {
changeProjectSliderColor($(this), slideEvt.value);
$('.project-slider-button > div > .slider-button-value').text(slideEvt.value);
});
$('.project-slider-button > span.slider-button-up').on('click', function () {
let sliderValue = parseInt($('.project-slider-button > div > .slider-button-value').text());
if (sliderValue < 100) {
sliderValue++;
}
$('#projectRialSlider').slider('setValue', sliderValue);
changeProjectSliderColor($("#dataProjectRialSlider"), sliderValue);
$('.project-slider-button > div > .slider-button-value').text(sliderValue);
});
$('.project-slider-button > span.slider-button-down').on('click', function () {
let sliderValue = parseInt($('.project-slider-button > div > .slider-button-value').text());
if (sliderValue > 0) {
sliderValue--;
}
$('#projectRialSlider').slider('setValue', sliderValue);
changeProjectSliderColor($("#dataProjectRialSlider"), sliderValue);
$('.project-slider-button > div > .slider-button-value').text(sliderValue);
});
break;
}
case 7: {
$('.custom-file-input[name=projectProblemFile]').on("change", function () {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
//==========================Maxter111
// myDropzone = new Dropzone("div#upzone", { url: "/upload" });
// Dropzone.options.myDropzone = {
// paramName: "file",
// autoProcessQueue: false,
// autoQueue: false,
// clickable: true,
// maxFilesize: 10, //in mb
// addRemoveLinks: true,
// // acceptedFiles: '.png,.jpg',
// dictDefaultMessage: "فایل های بکشید و اینجا رها کنید",
// };
//============================================mixbox
/*myDropzone.on('selectedfiles', function (files) {
$(files).each(function (index) {
this.delay = index * 100;
});
});*/
//=============================
$('#upbox').on('click', function (e) {
//myDropzone.processQueue();
});
break;
}
}
break;
case 3:
switch (subStep) {
case 1: {
if (getFormInputValue('operationType') == 'احداث') {
$('#physical7').text('خاکی');
$('#physical8').text('ابنیه');
$('#physical9').text('زیراساس');
$('#physical10').text('اساس');
$('#physical11').text('آسفالت');
$('#physical12').text('ایمن سازی');
} else {
$('#physical7').text('لکه گیری');
$('#physical8').text('روکش گرم');
$('#physical9').text('ماسه آسفالت');
$('#physical10').text('روکش حفاظتی');
$('#physical11').text('تثبیت');
$('#physical12').text('ایمن سازی');
}
$('#projectStatus1').on('click', function () {
$('#projectStatus2Box').hide();
if ($('input[name=projectCanOpening]').is(':checked')) {
$('input[name=projectCanOpening]').click();
}
});
$('#projectStatus2').on('click', function () {
$('#projectStatus2Box').show();
if ($('input[name=projectCanOpening]').is(':checked')) {
$('input[name=projectCanOpening]').click();
}
});
$('#projectStatus3').on('click', function () {
$('#projectStatus2Box').hide();
if (!$('input[name=projectCanOpening]').is(':checked')) {
$('input[name=projectCanOpening]').click();
}
});
$('input[name=projectCanOpening]').on('click', function () {
if ($(this).is(':checked')) {
$('#projectOpeningBox').show();
} else {
$('#projectOpeningBox').hide();
}
});
persianDatepickerInput = $('input[name=projectOpening]').persianDatepicker({
format: 'YYYY/MM/DD',
initialValue: (projectFromInputValue['projectOpeningDate']) ? false : true,
autoClose: true
});
persianDatepickerInputSubmit = $('input[name=projectReportDate]').persianDatepicker({
format: 'YYYY/MM/DD HH:MM',
autoClose: true,
timePicker: {
enabled: true
}
});
break;
}
case 3: {
$('input[name=projectReportDate]').persianDatepicker({
format: 'YYYY/MM/DD HH:MM',
autoClose: true,
timePicker: {
enabled: true
}
});
break;
}
}
break;
default:
//
}
}
function changeCardStep(currentProjectStep = null, stepArrow) {
if (!currentProjectStep) {
currentProjectStep = $('.project-timeline > .card-timeline > .card-body .submit-step.active');
}
if (stepArrow === 1) {
if (projectStep === 3) {
let formData = new FormData();
if (projectFromInputValue['operationType_DB'] != null)
formData.append('operationType_DB', projectFromInputValue['operationType_DB']);
if (projectFromInputValue['operationSubType_DB'] != null)
formData.append('operationSubType_DB', projectFromInputValue['operationSubType_DB']);
if (projectFromInputValue['projectSourceCordLat_DB'] != null)
formData.append('projectSourceCordLat_DB', projectFromInputValue['projectSourceCordLat_DB']);
if (projectFromInputValue['projectSourceCordLng_DB'] != null)
formData.append('projectSourceCordLng_DB', projectFromInputValue['projectSourceCordLng_DB']);
if (projectFromInputValue['projectDestCordLat_DB'] != null)
formData.append('projectDestCordLat_DB', projectFromInputValue['projectDestCordLat_DB']);
if (projectFromInputValue['projectDestCordLng_DB'] != null)
formData.append('projectDestCordLng_DB', projectFromInputValue['projectDestCordLng_DB']);
if (projectFromInputValue['projectCalcDistance_DB'] != null)
formData.append('projectCalcDistance_DB', projectFromInputValue['projectCalcDistance_DB']);
if (projectFromInputValue['selectedProvince_DB'] != null)
formData.append('selectedProvince_DB', projectFromInputValue['selectedProvince_DB']);
if (projectFromInputValue['selectedTown_DB'] != null)
formData.append('selectedTown_DB', projectFromInputValue['selectedTown_DB']);
if (projectFromInputValue['projectAxis_DB'] != null)
formData.append('projectAxis_DB', projectFromInputValue['projectAxis_DB']);
if (projectFromInputValue['projectAxisType_DB'] != null)
formData.append('projectAxisType_DB', projectFromInputValue['projectAxisType_DB']);
if (projectFromInputValue['projectName_DB'] != null)
formData.append('projectName_DB', projectFromInputValue['projectName_DB']);
if (projectFromInputValue['projectType_DB'] != null)
formData.append('projectType_DB', projectFromInputValue['projectType_DB']);
if (projectFromInputValue['projectStartDate'] != null)
formData.append('projectStartDate_DB', projectFromInputValue['projectStartDate']);
if (projectFromInputValue['projectConsultantName_DB'] != null)
formData.append('projectConsultantName_DB', projectFromInputValue['projectConsultantName_DB']);
if (projectFromInputValue['projectContractorName_DB'] != null)
formData.append('projectContractorName_DB', projectFromInputValue['projectContractorName_DB']);
if (projectFromInputValue['amountOrderCredit_DB'] != null)
formData.append('amountOrderCredit_DB', projectFromInputValue['amountOrderCredit_DB']);
if (projectFromInputValue['amountAbsorbedCredit_DB'] != null)
formData.append('amountAbsorbedCredit_DB', projectFromInputValue['amountAbsorbedCredit_DB']);
if (projectFromInputValue['amountEndCredit_DB'] != null)
formData.append('amountEndCredit_DB', projectFromInputValue['amountEndCredit_DB']);
if (projectFromInputValue['projectPlanNumber_DB'] != null)
formData.append('projectPlanNumber_DB', projectFromInputValue['projectPlanNumber_DB']);
//formData.append('Planoffice', projectFromInputValue['Planoffice']);
if (projectFromInputValue['projectAnnouncedDate'] != null)
formData.append('projectAnnouncedDate_DB', projectFromInputValue['projectAnnouncedDate']);
if (projectFromInputValue['projectRialSlider_DB'] != null)
formData.append('projectRialSlider_DB', projectFromInputValue['projectRialSlider_DB']);
if (projectFromInputValue['projectPhysicalSlider_DB'] != null)
formData.append('projectPhysicalSlider_DB', projectFromInputValue['projectPhysicalSlider_DB']);
if (projectFromInputValue['projectProblem_DB'] != null)
formData.append('projectProblem_DB', projectFromInputValue['projectProblem_DB']);
for (let i = 0; i < projectFromInputValue['projectProblemUploadedFiles_DB'].files.length; i++) {
formData.append('item_files_' + i, projectFromInputValue['projectProblemUploadedFiles_DB'].files[i]);
}
if (projectFromInputValue['projectStatus_DB'] != null)
formData.append('projectStatus_DB', projectFromInputValue['projectStatus_DB']);
if (projectFromInputValue['projectStopReasons_DB'] != null)
formData.append('projectStopReasons_DB', projectFromInputValue['projectStopReasons_DB']);
if (projectFromInputValue['projectCanOpening'] != null)
formData.append('projectCanOpening', projectFromInputValue['projectCanOpening']);
if (projectFromInputValue['projectOpeningDate'] != null)
formData.append('projectOpeningDate_DB', projectFromInputValue['projectOpeningDate']);
if (projectFromInputValue['projectNazerName_DB'] != null)
formData.append('projectNazerName_DB', projectFromInputValue['projectNazerName_DB']);
if (projectFromInputValue['projectMasName_DB'] != null)
formData.append('projectMasName_DB', projectFromInputValue['projectMasName_DB']);
if (projectFromInputValue['projectReportDate'] != null)
formData.append('projectReportDate_DB', projectFromInputValue['projectReportDate']);
// Go to first page
changeProgressStep(1);
showLoaderScreen();
setTimeout(function () {
$.ajax({
url: '/road-construction',
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (result) {
console.log(result);
alert('پروژه با موفقیت ثبت شد');
hideLoaderScreen();
window.open("../rmto?operationType=" + getFormInputValue('operationType') + "&projectStatus=" + getFormInputValue('projectStatus') + "&selectedProvince=" + getFormInputValue('selectedProvinceString') + "&selectedTown=" + getFormInputValue('selectedTownString') + "&sourceLat=" + sourceLat + "&sourceLng=" + sourceLng, "_self");
},
error: function (error) {
console.log(error);
hideLoaderScreen();
window.open("../rmto", _self);
}
});
}, 500);
} else {
if (checkFormValidation() && !changeStepLock) {
changeStepLock = true;
changeProgressStep(1);
currentProjectStep.removeClass('active');
currentProjectStep.next().addClass('active');
currentProjectStep.fadeOut(300, function () {
if (projectStep < 3) {
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('مرحله بعدی');
$('.project-timeline > .card-timeline > .card-body > button.btn-prev').text('مرحله قبلی');
} else {
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('تایید و ثبت پروژه');
//$('.project-timeline > .card-timeline > .card-body > button.btn-prev').hide();
}
currentProjectStep.next().fadeIn(300, function () {
changeStepLock = false;
addSubStepInput(projectSubStep = 1);
});
});
projectStep++;
}
}
} else if (stepArrow === -1) {
if (projectStep === 0) {
window.open('/rmto', '_self');
} else {
if (!changeStepLock) {
changeStepLock = true;
if (projectStep === 1) {
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('شروع ثبت پروژه');
$('.project-timeline > .card-timeline > .card-body > button.btn-prev').text('بازگشت به صفحه اصلی');
} else {
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('مرحله بعدی');
$('.project-timeline > .card-timeline > .card-body > button.btn-prev').text('مرحله قبلی');
}
changeProgressStep(-1);
currentProjectStep.removeClass('active');
currentProjectStep.prev().addClass('active');
currentProjectStep.fadeOut(300, function () {
currentProjectStep.prev().fadeIn(300, function () {
changeStepLock = false;
projectSubStep = projectMaxSubStep[projectStep - 1];
});
});
projectStep--;
}
}
}
}
$('.project-timeline > .card-timeline > .card-body > button').on('click', function () {
let currentProjectStep = $(this).parent().find('.submit-step.active');
if ($(this).hasClass('btn-next')) {
changeCardStep(currentProjectStep, 1);
} else if ($(this).hasClass('btn-prev')) {
changeCardStep(currentProjectStep, -1);
}
});
$('.project-timeline > .card-timeline > .card-body #stepModal .modal-footer > button').on('click', function () {
if ($(this).hasClass('btn-next')) {
switch (projectStep) {
case 1: {
if (projectSubStep === projectMaxSubStep[0]) {
//alert('شروع مرحله ۲');
if (checkSubFormValidation()) {
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
}
// changeCardStep(null, 1);
} else {
if (checkSubFormValidation()) {
projectSubStep++;
addSubStepInput(projectSubStep);
}
}
break;
}
case 2: {
if (projectSubStep === projectMaxSubStep[1]) {
//alert('شروع مرحله ۳');
if (checkSubFormValidation()) {
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
}
// changeCardStep(null, 1);
} else {
if (checkSubFormValidation()) {
projectSubStep++;
addSubStepInput(projectSubStep);
}
}
break;
}
case 3: {
if (projectSubStep === projectMaxSubStep[2]) {
//alert('پایان');
if (checkSubFormValidation()) {
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
}
//changeCardStep(null, 1);
} else {
if (checkSubFormValidation()) {
projectSubStep++;
addSubStepInput(projectSubStep);
}
}
break;
}
}
} else if ($(this).hasClass('btn-prev')) {
switch (projectStep) {
case 1: {
if (projectSubStep === 1) {
//alert('برگشت به شروع');
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('شروع ثبت پروژه');
$('.project-timeline > .card-timeline > .card-body > button.btn-prev').text('بازگشت به صفحه اصلی');
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
changeCardStep(null, -1);
} else {
projectSubStep--;
addSubStepInput(projectSubStep);
}
break;
}
case 2: {
if (projectSubStep === 1) {
//alert('برگشت به مرحله ۱');
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
changeCardStep(null, -1);
} else {
projectSubStep--;
addSubStepInput(projectSubStep);
}
break;
}
case 3: {
if (projectSubStep === 1) {
//alert('برگشت به مرحله ۲');
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
changeCardStep(null, -1);
} else {
projectSubStep--;
addSubStepInput(projectSubStep);
}
break;
}
}
} else if ($(this).hasClass('btn-applyChange')) {
if (checkSubFormValidation()) {
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
let stepModalFooter = $('#stepModal .modal-content > .modal-footer');
stepModalFooter.find('button.btn-applyChange').hide();
stepModalFooter.find('button.btn-applyChangeCancel').hide();
stepModalFooter.find('button.btn-prev').show();
stepModalFooter.find('button.btn-next').show();
projectStep = stepBackup;
projectSubStep = subStepBackUp;
}
} else if ($(this).hasClass('btn-applyChangeCancel')) {
$(".project-timeline > .card-timeline > .card-body #stepModal").modal('hide');
let stepModalFooter = $('#stepModal .modal-content > .modal-footer');
stepModalFooter.find('button.btn-applyChange').hide();
stepModalFooter.find('button.btn-applyChangeCancel').hide();
stepModalFooter.find('button.btn-prev').show();
stepModalFooter.find('button.btn-next').show();
projectStep = stepBackup;
projectSubStep = subStepBackUp;
}
});
function inputAutoComplete(inp) {
/*the autocomplete function takes two arguments,
the text field element and an array of possible autocompleted values:*/
var currentFocus;
/*execute a function when someone writes in the text field:*/
inp.addEventListener("input", function (e) {
var a, b, i, val = this.value;
// console.log(val);
/*close any already open lists of autocompleted values*/
closeAllLists();
if (!val) { return false; }
currentFocus = -1;
/*create a DIV element that will contain the items (values):*/
a = document.createElement("DIV");
a.setAttribute("id", this.id + "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
/*append the DIV element as a child of the autocomplete container:*/
this.parentNode.appendChild(a);
/*for each item in the array...*/
if (val.length > 1) {
// Request for location name
let url = 'https://testmap.141.ir/nominatim/search?city=' + val + '&limit=10&format=json&addressdetails=1&accept-language=fa';
$.get(url, function (result) {
// console.log(result);
if (result.length) {
for (i = 0; i < result.length; i++) {
/*create a DIV element for each matching element:*/
b = document.createElement("DIV");
/*make the matching letters bold:*/
b.innerHTML = "<strong>" + result[i].display_name.substr(0, val.length) + "</strong>";
b.innerHTML += result[i].display_name.substr(val.length);
/*insert a input field that will hold the current array item's value:*/
b.innerHTML += "<input type='hidden' value='" + result[i].display_name + "'>";
b.setAttribute('id', result[i].lat + ',' + result[i].lon);
$(b).css('font-size', '12px');
/*execute a function when someone clicks on the item value (DIV element):*/
b.addEventListener("click", function (e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/
closeAllLists();
// Hide instruction box & zoom to selected place
$('.map-overlay').hide();
let placeCoordinates = this.id.split(',');
map.flyTo([parseFloat(placeCoordinates[0]), parseFloat(placeCoordinates[1])], 13);
});
a.appendChild(b);
}
}
});
}
});
/*execute a function presses a key on the keyboard:*/
inp.addEventListener("keydown", function (e) {
var x = document.getElementById(this.id + "autocomplete-list");
if (x) x = x.getElementsByTagName("div");
// if (e.keyCode == 40) {
// /*If the arrow DOWN key is pressed,
// increase the currentFocus variable:*/
// currentFocus++;
// /*and and make the current item more visible:*/
// addActive(x);
// } else if (e.keyCode == 38) { //up
// /*If the arrow UP key is pressed,
// decrease the currentFocus variable:*/
// currentFocus--;
// /*and and make the current item more visible:*/
// addActive(x);
// } else
if (e.keyCode == 13) {
/*If the ENTER key is pressed, prevent the form from being submitted,*/
e.preventDefault();
if (currentFocus > -1) {
/*and simulate a click on the "active" item:*/
if (x) x[currentFocus].click();
}
}
});
// function addActive(x) {
// /*a function to classify an item as "active":*/
// if (!x) return false;
// /*start by removing the "active" class on all items:*/
// removeActive(x);
// if (currentFocus >= x.length) currentFocus = 0;
// if (currentFocus < 0) currentFocus = (x.length - 1);
// /*add class "autocomplete-active":*/
// x[currentFocus].classList.add("autocomplete-active");
// }
// function removeActive(x) {
// /*a function to remove the "active" class from all autocomplete items:*/
// for (var i = 0; i < x.length; i++) {
// x[i].classList.remove("autocomplete-active");
// }
// }
function closeAllLists(elmnt) {
/*close all autocomplete lists in the document,
except the one passed as an argument:*/
var x = document.getElementsByClassName("autocomplete-items");
for (var i = 0; i < x.length; i++) {
if (elmnt != x[i] && elmnt != inp) {
x[i].parentNode.removeChild(x[i]);
}
}
}
/*execute a function when someone clicks in the document:*/
document.addEventListener("click", function (e) {
closeAllLists(e.target);
});
}
function clearInstructionBox() {
$('.map-overlay').hide();
}
function showMap() {
var bounds = [
[42.9130026312, 75.6166317076],
[20.5782370061, 35.5092252948]
];
map = L.map('map-layout', {
maxBounds: bounds,
minZoom: 6
}).setView([35.620, 51.471], 9);
L.tileLayer('https://testmap.141.ir/141map/{z}/{x}/{y}.png', {}).addTo(map);
if (!mapReview) {
mapReview = L.map('map-layout-review', {
maxBounds: bounds,
minZoom: 6
}).setView([35.620, 51.471], 9);
L.tileLayer('https://testmap.141.ir/141map/{z}/{x}/{y}.png', {}).addTo(mapReview);
}
}
// function getUserCurrentLocation() {
// map.locate()
// .on('locationfound', function (e) {
// map.flyTo([e.latitude, e.longitude], 17);
// $('.map-overlay').css('display', 'none');
// // var marker = L.marker([e.latitude, e.longitude], {
// // icon: L.icon({
// // iconUrl: '../dist/images/source-ico.png',
// // iconSize: [32, 32],
// // iconAnchor: [16, 30]
// // })
// // }).bindPopup('شما اینجا هستید!');
// // map.addLayer(marker);
// })
// .on('locationerror', function (e) {
// // alert("امکان دریافت موقعیت فعلی وجود ندارد.");
// showIRANMap();
// });
// }
// function showIRANMap() {
// $.ajax({
// url: "https://141.ir/iranmap",
// type: 'GET'
// }).done(function (data) {
// $('.map-overlay').html('<span class="tooltiptextmap">Tooltip text</span>' + data);
// $(".map-overlay > svg #iran > path").mousemove(function (event) {
// let left = event.pageX - $('.map-overlay').offset().left + 20;
// let top = event.pageY - $('.map-overlay').offset().top;
// let mapSelectedId = $(this).attr('id').substring(3);
// $('.map-overlay > .tooltiptextmap').text(returnProvinceName(mapSelectedId));
// $('.map-overlay > .tooltiptextmap').css({ top: top, left: left }).show();
// });
// $('.map-overlay > svg #iran > path').mouseout(function () {
// $('.map-overlay > .tooltiptextmap').hide();
// });
// $(".map-overlay > svg #iran path").on('click', function () {
// $(".map-overlay > svg #iran .map-selected").removeClass('map-selected');
// $(this).addClass('map-selected');
// // Hide SVG map, then Zoom to selected province
// $('.map-overlay').css('display', 'none');
// let mapSelectedId = $(this).attr('id').substring(3);
// map.flyTo(returnProvinceLatLng(mapSelectedId), 7);
// });
// });
// }
// function returnProvinceName(provinceId) {
// switch (provinceId) {
// case '01': return 'آذربایجان شرقی';
// case '02': return 'آذربایجان غربی';
// case '03': return 'اردبیل';
// case '04': return 'اصفهان';
// case '05': return 'ایلام';
// case '06': return 'بوشهر';
// case '07': return 'تهران';
// case '08': return 'چهارمحال و بختیاری';
// // case '09': return '';
// case '10': return 'خوزستان';
// case '11': return 'زنجان';
// case '12': return 'سمنان';
// case '13': return 'سیستان و بلوچستان';
// case '14': return 'فارس';
// case '15': return 'کرمان';
// case '16': return 'کردستان';
// case '17': return 'کرمانشاه';
// case '18': return 'کهگیلویه و بویر احمد';
// case '19': return 'گیلان';
// case '20': return 'لرستان';
// case '21': return 'مازندران';
// case '22': return 'مرکزی';
// case '23': return 'هرمزگان';
// case '24': return 'همدان';
// case '25': return 'یزد';
// case '26': return 'قم';
// case '27': return 'گلستان';
// case '28': return 'قزوین';
// case '29': return 'خراسان جنوبی';
// case '30': return 'خراسان رضوی';
// case '31': return 'خراسان شمالی';
// case '32': return 'البرز';
// }
// }
// function returnProvinceLatLng(provinceId) {
// switch (provinceId) {
// case '01': return [37.9211202, 46.6821517];
// case '02': return [37.7416484, 45.0207638];
// case '03': return [38.4583983, 47.9313001];
// case '04': return [33.196733, 50.7884216];
// case '05': return [33.1545696, 46.7576343];
// case '06': return [28.8936645, 51.3204877];
// case '07': return [35.50219455, 51.3269098];
// case '08': return [32.0163307, 50.685709];
// // case '09': return '';
// case '10': return [31.5535141, 49.0077168];
// case '11': return [36.515854, 48.4777616];
// case '12': return [35.4380386, 54.8626294];
// case '13': return [28.1292481, 60.8236848];
// case '14': return [29.299051, 53.218456];
// case '15': return [29.571858, 57.301047];
// case '16': return [35.672803, 47.0124376];
// case '17': return [34.3789744, 46.7010122];
// case '18': return [30.8143476, 50.8661454];
// case '19': return [37.5115476, 49.355442];
// case '20': return [33.5372643, 48.2435197];
// case '21': return [36.3159159, 51.8968597];
// case '22': return [34.5302705, 49.7864561];
// case '23': return [27.7198095, 56.335807];
// case '24': return [34.973321, 48.6555779];
// case '25': return [32.2452686, 55.105172];
// case '26': return [34.7191915, 51.0122844];
// case '27': return [37.1984436, 55.070672];
// case '28': return [36.0156291, 49.8398161];
// case '29': return [33.0006776, 58.3262335];
// case '30': return [35.756361, 59.1280992];
// case '31': return [37.5378855, 56.9526137];
// case '32': return [35.9413239, 52.504026];
// }
// }
function handleMapRouting(operationType) {
$('#org-pin').on('click', function () {
// Set source coordinates into local vars & text field
sourceLat = map.getCenter().lat;
sourceLng = map.getCenter().lng;
$('input[name=sourceCord]').val('(' + sourceLat.toFixed(7) + ')' + ' - ' + '(' + sourceLng.toFixed(7) + ')');
// Drop origin marker onto map
sourceMarker = new L.marker(L.latLng(map.getCenter()), {
icon: L.icon({
iconUrl: '../dist/images/origin.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: true
}).addTo(map);
// Hide origin image
$(this).hide();
// Show destination image
$('#dest-pin').show();
// What if user wants to change its location?
sourceMarker.on('dragend', function (event) {
var marker = event.target;
var position = marker.getLatLng();
$('input[name=sourceCord]').val('(' + position.lat.toFixed(7) + ')' + ' - ' + '(' + position.lng.toFixed(7) + ')');
sourceLat = position.lat;
sourceLng = position.lng;
if (destLat != '')
drawPath(operationType);
});
});
$('#dest-pin').on('click', function () {
// Set destination coordinates into local vars & text field
destLat = map.getCenter().lat;
destLng = map.getCenter().lng;
$('input[name=destCord]').val('(' + destLat.toFixed(7) + ')' + ' - ' + '(' + destLng.toFixed(7) + ')');
// Drop origin marker onto map
destMarker = new L.marker(L.latLng(map.getCenter()), {
icon: L.icon({
iconUrl: '../dist/images/destination.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: true
}).addTo(map);
// Hide destination image
$(this).hide();
// What if user wants to change its location?
destMarker.on('dragend', function (event) {
var marker = event.target;
var position = marker.getLatLng();
$('input[name=destCord]').val('(' + position.lat.toFixed(7) + ')' + ' - ' + '(' + position.lng.toFixed(7) + ')');
destLat = position.lat;
destLng = position.lng;
if (sourceLat != '')
drawPath(operationType);
});
// Draw path from origin to destination
drawPath(operationType);
});
}
function initialMapRouting(operationType) {
// Drop origin marker onto map
sourceMarker = new L.marker(L.latLng([sourceLat, sourceLng]), {
icon: L.icon({
iconUrl: '../dist/images/origin.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: true
}).addTo(map);
sourceMarker.on('dragend', function (event) {
var marker = event.target;
var position = marker.getLatLng();
$('input[name=sourceCord]').val('(' + position.lat.toFixed(7) + ')' + ' - ' + '(' + position.lng.toFixed(7) + ')');
sourceLat = position.lat;
sourceLng = position.lng;
if (destLat != '')
drawPath(operationType);
});
// Hide origin image
$('#org-pin').hide();
// Drop origin marker onto map
destMarker = new L.marker(L.latLng(destLat, destLng), {
icon: L.icon({
iconUrl: '../dist/images/destination.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: true
}).addTo(map);
destMarker.on('dragend', function (event) {
var marker = event.target;
var position = marker.getLatLng();
$('input[name=destCord]').val('(' + position.lat.toFixed(7) + ')' + ' - ' + '(' + position.lng.toFixed(7) + ')');
destLat = position.lat;
destLng = position.lng;
if (sourceLat != '')
drawPath(operationType);
});
// Draw path from origin to destination
drawPath(operationType);
initialMapRoutingReview(operationType);
}
function initialMapRoutingReview(operationType) {
if (sourceReviewMarker) {
mapReview.removeLayer(sourceReviewMarker);
mapReview.removeLayer(destReviewMarker);
}
// Drop origin marker onto map review
sourceReviewMarker = new L.marker(L.latLng([sourceLat, sourceLng]), {
icon: L.icon({
iconUrl: '../dist/images/origin.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: false
}).addTo(mapReview);
// Drop origin marker onto map review
destReviewMarker = new L.marker(L.latLng(destLat, destLng), {
icon: L.icon({
iconUrl: '../dist/images/destination.png',
iconSize: [55, 75],
iconAnchor: [30, 70]
}),
draggable: false
}).addTo(mapReview);
}
function drawPath(operationType) {
if (routeControls.length) {
$(routeControls).each(function (index, control) {
map.removeControl(control);
routeControls.splice(routeControls.indexOf(index), 1);
});
}
if (polyline != null) {
map.removeLayer(polyline);
}
switch (operationType) {
case 'احداث': {
// Construction
$('input[name="calcDistance"]').prop('disabled', false);
polyline = L.polyline(
[
[sourceLat, sourceLng], [destLat, destLng]
],
{
color: '#28a745',
opacity: .8,
weight: 5
}
).addTo(map);
//console.log(polyline);
break;
}
case 'نگهداری': {
// Maintenance
$.get(`https://testmap.141.ir/route/v1/driving/${sourceLng},${sourceLat};${destLng},${destLat}?overview=false&alternatives=true&steps=true`,
function (data) {
routeControls.push(
L.Routing.control({
waypoints: [
L.latLng(parseFloat(sourceLat), parseFloat(sourceLng)),
L.latLng(parseFloat(destLat), parseFloat(destLng))
],
fitSelectedRoutes: false,
draggableWaypoints: true,
createMarker: function () { return null; },
lineOptions: {
addWaypoints: false,
styles: [{
color: '#28a745',
opacity: .8,
weight: 5
}]
},
}).on('routesfound', function (e) {
var divideBy = 2;
for (let index = 0; index < popupArrays.length; index++) {
if (popupArrays[index] !== null) {
map.removeLayer(popupArrays[index]);
}
}
var customOptions = {
'maxWidth': '300',
'maxHeight': '150',
'className': 'customRouteEstimate'
}
// for (let index = 0; index < e.routes.length; index++) {
var popup = new L.Popup(customOptions);
var popupLocation = new L.LatLng(e.routes[0].coordinates[parseInt(e.routes[0]
.coordinates
.length /
divideBy)].lat,
e.routes[0].coordinates[parseInt(e.routes[0].coordinates.length / divideBy)]
.lng);
var popupContent = "<span style=\"color:#FF5630 ; font-size:11px\">مسافت : </span>" + parseFloat(e.routes[0].summary.totalDistance / 1000.0).toFixed(2) + " کیلومتر";
popup.setLatLng(popupLocation);
popup.setContent(popupContent);
popupArrays.push(popup);
map.addLayer(popup);
// }
}).addTo(map)
);
$('input[name=calcDistance]').val((data.routes[0].distance / 1000).toFixed(2));
$('input[name=routeName]').val(data.routes[0].legs[0].summary);
$('select[name=selectOstan]').val(1);
$('input[name=selectCity]').val('تهران');
});
$('.leaflet-control-container').css('display', 'none');
$('.leaflet-routing-container-hide').css('display', 'none');
break;
}
}
}
$('.project-timeline .timeline-item').on('click', function () {
if ($(this).hasClass('is-completed')) {
let projectSelectedStep = parseInt($(this).find('span').text());
$('.project-timeline > .card-timeline > .card-body > button.btn-next').text('مرحله بعدی');
$('.project-timeline > .card-timeline > .card-body > button.btn-prev').text('مرحله قبلی');
changeStepLock = true;
changeProgressStep(projectSelectedStep - projectStep, projectSelectedStep);
let currentProjectStep = $('.submit-step.active').removeClass('active');
let SelectedProjectStep = $('#submit-step-' + projectSelectedStep).addClass('active');
currentProjectStep.fadeOut(300, function () {
SelectedProjectStep.fadeIn(300, function () {
changeStepLock = false;
});
});
projectStep = projectSelectedStep;
projectSubStep = projectMaxSubStep[projectStep - 1];
}
});
$(document).ready(function () {
$('.select2Construction').select2();
$('.select2Maintenance').select2();
// When one radio button is checked
$('#operationType1').on('click', function () {
if ($(this).is(':checked')) {
$('#maintenanceSubOperation').hide();
$('#constructionSubOperation').show();
} else {
$('#constructionSubOperation').hide();
}
});
$('#operationType2').on('click', function () {
if ($(this).is(':checked')) {
$('#constructionSubOperation').hide();
$('#maintenanceSubOperation').show();
} else {
$('#maintenanceSubOperation').hide();
}
});
$('.submit-step .form-group').on('click', function () {
let step = $(this).find('input').attr('stepid');
if (step != '0') {
let subStep = $(this).find('input').attr('stepid');
showSpecificModal(parseInt(step.substr(0, 1)), parseInt(subStep.substr(-1)));
}
});
});
function showSpecificModal(step, subStep) {
let stepModalFooter = $('#stepModal .modal-content > .modal-footer');
stepModalFooter.find('button.btn-applyChange').show();
stepModalFooter.find('button.btn-applyChangeCancel').show();
stepModalFooter.find('button.btn-prev').hide();
stepModalFooter.find('button.btn-next').hide();
stepBackup = projectStep;
subStepBackUp = projectSubStep;
projectStep = step;
addSubStepInput(projectSubStep = subStep);
}
//=========mixstar11
// Dropzone.autoDiscover = false;
// var myDropzone = new Dropzone(".dropzone", {
// autoProcessQueue: false,
// parallelUploads: 10 // Number of files process at a time (default 2)
// });
// $('#uploadfiles').click(function(){
// myDropzone.processQueue();
// });
// //======================================
// var myDropzone = new Dropzone("div#upfiles", {
// url: "/file/post"
// });
// $("div#upfiles").dropzone({
// url: "/file/post"
// });
function showLoaderScreen() {
$('.starter-loader-container').css('display', 'flex').hide().fadeIn();
}
function hideLoaderScreen() {
$('.starter-loader-container').fadeOut();
}