|
|
|
|
@@ -61,9 +61,6 @@ function errorHandler(error) {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
console.error("Error trace object");
|
|
|
|
|
console.log("Error object:");
|
|
|
|
|
console.log(error);
|
|
|
|
|
Swal.fire({
|
|
|
|
|
icon: "error",
|
|
|
|
|
title: "خطا",
|
|
|
|
|
@@ -417,6 +414,43 @@ function getCityByProvince(province_id, dom_id, selected_id = 0) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getTollhouseByCity(city_id, dom_id, selected_id = 0) {$.ajax({
|
|
|
|
|
url: `/api/v3/road_maintenance_station/search_by_city?city_id=${city_id}`,
|
|
|
|
|
type: "GET",
|
|
|
|
|
async: false,
|
|
|
|
|
beforeSend: function () {
|
|
|
|
|
$(`#${dom_id}`).empty();
|
|
|
|
|
showLoaderScreen()
|
|
|
|
|
},
|
|
|
|
|
success: function (result) {
|
|
|
|
|
$(`#${dom_id}`).append('<option value="0"></option>');
|
|
|
|
|
cities = result.data;
|
|
|
|
|
|
|
|
|
|
for (let index = 0; index < cities.length; index++) {
|
|
|
|
|
|
|
|
|
|
$(`#${dom_id}`).append(
|
|
|
|
|
`<option value=${cities[index].id}>${cities[index].name}</option>`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (selected_id == null) {
|
|
|
|
|
disableDOM(dom_id);
|
|
|
|
|
} else if (selected_id != 0) {
|
|
|
|
|
enableDOM(dom_id);
|
|
|
|
|
$(`#${dom_id} option[value="${selected_id}"]`).attr("selected", true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hideLoaderScreen();
|
|
|
|
|
},
|
|
|
|
|
error: function (error) {
|
|
|
|
|
errorHandler(error);
|
|
|
|
|
hideLoaderScreen();
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCityOfficeByCity(city_id, dom_id, selected_id = 0) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/public/contents/edarateShahri/" + city_id,
|
|
|
|
|
@@ -923,7 +957,6 @@ $(document).on('click', '#report_btn', function () {
|
|
|
|
|
var tr = $(this).closest("tr");
|
|
|
|
|
var row = table.row(tr);
|
|
|
|
|
$("#report_modal").modal('show');
|
|
|
|
|
console.log(row.data().id);
|
|
|
|
|
$("#selected_user_for_report").val(row.data().id);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
@@ -1003,7 +1036,6 @@ $(document).on('click', '#activity_report', function () {
|
|
|
|
|
showLoaderScreen()
|
|
|
|
|
},
|
|
|
|
|
success: function (result) {
|
|
|
|
|
console.log(result);
|
|
|
|
|
|
|
|
|
|
$("#activity_time").text(result.activity_time);
|
|
|
|
|
$("#average_activity_time").text(result.average_activity_time);
|
|
|
|
|
@@ -1042,9 +1074,6 @@ $(document).on('click', '.permission-control', function () {
|
|
|
|
|
modal.find('.permission-label').removeClass('text-muted')
|
|
|
|
|
modal.find('.all-permission-by-type').prop('checked', false)
|
|
|
|
|
modal.find('#user_id').val(row.data().id)
|
|
|
|
|
|
|
|
|
|
console.log(row.data().province_id);
|
|
|
|
|
console.log(row.data().edarate_shahri_id);
|
|
|
|
|
modal.find('.permission-input').each((index, element) => {
|
|
|
|
|
if ($(element).data('needProvince') == 1) {
|
|
|
|
|
if (row.data().province_id == null) {
|
|
|
|
|
@@ -1625,7 +1654,6 @@ $("table").on("click", "tbody tr", function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#user_data_table').on('change', ".user-finder-all", function () {
|
|
|
|
|
console.log(checkedItemsId);
|
|
|
|
|
|
|
|
|
|
var thiz = $(this);
|
|
|
|
|
if (thiz.is(':checked')) {
|
|
|
|
|
@@ -1642,7 +1670,6 @@ $('#user_data_table').on('change', ".user-finder-all", function () {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#user_data_table').on('change', ".user-finder", function () {
|
|
|
|
|
console.log(checkedItemsId);
|
|
|
|
|
|
|
|
|
|
const checkedItemId = $(this).data("idUser");
|
|
|
|
|
|
|
|
|
|
@@ -2104,7 +2131,6 @@ $("#edit_province_office").change(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#edit_city_office").change(function () {
|
|
|
|
|
console.log("this is ok");
|
|
|
|
|
setUserName("edit");
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
@@ -2386,6 +2412,19 @@ $("#add_province_office").change(function () {
|
|
|
|
|
setUserName();
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$("#add_simple_city").change(function () {
|
|
|
|
|
|
|
|
|
|
if ($("#add_simple_city").val() == -1) {
|
|
|
|
|
|
|
|
|
|
disableDOM("add_simple_tollhouse")
|
|
|
|
|
$("#add_simple_tollhouse").empty();
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
enableDOM("add_simple_tollhouse")
|
|
|
|
|
getTollhouseByCity($("#add_simple_city").val(), "add_simple_tollhouse")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// $("#edit_city").change(function () {
|
|
|
|
|
|
|
|
|
|
// if ($(this).val() == 0) {
|
|
|
|
|
@@ -2396,15 +2435,6 @@ $("#add_province_office").change(function () {
|
|
|
|
|
// setUserName("edit");
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// $("#add_simple_city").change(function () {
|
|
|
|
|
|
|
|
|
|
// if ($(this).val() == 0) {
|
|
|
|
|
// $("#add_simple_city_office").empty();
|
|
|
|
|
// } else {
|
|
|
|
|
// getCityOfficeByCity($(this).val(), "add_simple_city_office")
|
|
|
|
|
// }
|
|
|
|
|
// setUserName();
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// $("#add_city").change(function () {
|
|
|
|
|
|
|
|
|
|
@@ -2581,6 +2611,9 @@ $('#add_simple_user_show_modal').on('click', function () {
|
|
|
|
|
enableDOM("add_simple_city")
|
|
|
|
|
$("#add_simple_city").empty();
|
|
|
|
|
$("#add_simple_city").append('<option value="0" selected disabled>ابتدا استان را انتخاب کنید</option>');
|
|
|
|
|
enableDOM("add_simple_tollhouse")
|
|
|
|
|
$("#add_simple_tollhouse").empty();
|
|
|
|
|
$("#add_simple_tollhouse").append('<option value="0" selected disabled>ابتدا شهر را انتخاب کنید</option>');
|
|
|
|
|
enableDOM("add_simple_city_office")
|
|
|
|
|
$("#add_simple_city_office").empty();
|
|
|
|
|
$("#add_simple_city_office").append('<option value="0" selected disabled></option>');
|
|
|
|
|
@@ -2594,8 +2627,10 @@ $("#add_simple_province").change(function () {
|
|
|
|
|
|
|
|
|
|
disableDOM("add_simple_city")
|
|
|
|
|
disableDOM("add_simple_city_office")
|
|
|
|
|
disableDOM("add_simple_tollhouse")
|
|
|
|
|
$("#add_simple_city").empty();
|
|
|
|
|
$("#add_simple_city_office").empty();
|
|
|
|
|
$("#add_simple_tollhouse").empty();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if ($("#add_simple_province_office").val() == 0) {
|
|
|
|
|
@@ -2622,8 +2657,10 @@ $("#add_simple_province_office").change(function () {
|
|
|
|
|
|
|
|
|
|
disableDOM("add_simple_city")
|
|
|
|
|
disableDOM("add_simple_city_office")
|
|
|
|
|
disableDOM("add_simple_tollhouse")
|
|
|
|
|
$("#add_simple_city").empty();
|
|
|
|
|
$("#add_simple_city_office").empty();
|
|
|
|
|
$("#add_simple_tollhouse").empty();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if ($("#add_simple_province").val() == 0 || $("#add_simple_province").val() == -1) {
|
|
|
|
|
@@ -2657,6 +2694,7 @@ $("#add_simple_submit_form").on("click", function () {
|
|
|
|
|
var edarate_shahri_id = $("#add_simple_city_office").children("option:selected").val();
|
|
|
|
|
var national_code = $("#add_simple_national_code").val();
|
|
|
|
|
var city_id = $("#add_simple_city").children("option:selected").val();
|
|
|
|
|
var tollhouse_id = $("#add_simple_tollhouse").children("option:selected").val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (edarate_ostani_id <= 0 && edarate_shahri_id <= 0) {
|
|
|
|
|
@@ -2695,6 +2733,12 @@ $("#add_simple_submit_form").on("click", function () {
|
|
|
|
|
} else {
|
|
|
|
|
$("#add_simple_city").removeClass("validity-checker");
|
|
|
|
|
}
|
|
|
|
|
if (tollhouse_id == 0) {
|
|
|
|
|
$("#add_simple_tollhouse").addClass("validity-checker");
|
|
|
|
|
form_validation_status = false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#add_simple_tollhouse").removeClass("validity-checker");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (province_id < 0) {
|
|
|
|
|
$("#add_simple_province").addClass("validity-checker");
|
|
|
|
|
@@ -2734,6 +2778,10 @@ $("#add_simple_submit_form").on("click", function () {
|
|
|
|
|
formData.append("city_id", city_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tollhouse_id != undefined) {
|
|
|
|
|
formData.append("station_id", tollhouse_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
formData.append("password_confirmation", repass);
|
|
|
|
|
if (edarate_ostani_id != 0) {
|
|
|
|
|
formData.append("edarate_ostani_id", edarate_ostani_id);
|
|
|
|
|
|