add station id to create user

This commit is contained in:
amirghasempoor
2026-05-18 08:55:12 +00:00
parent a5cf79cd1b
commit 08db103f26

View File

@@ -61,9 +61,6 @@ function errorHandler(error) {
break; break;
default: default:
console.error("Error trace object");
console.log("Error object:");
console.log(error);
Swal.fire({ Swal.fire({
icon: "error", icon: "error",
title: "خطا", title: "خطا",
@@ -433,7 +430,7 @@ function getTollhouseByCity(city_id, dom_id, selected_id = 0) {$.ajax({
for (let index = 0; index < cities.length; index++) { for (let index = 0; index < cities.length; index++) {
$(`#${dom_id}`).append( $(`#${dom_id}`).append(
`<option value=${cities[index].id}>${cities[index].name_fa}</option>` `<option value=${cities[index].id}>${cities[index].name}</option>`
); );
} }
@@ -960,7 +957,6 @@ $(document).on('click', '#report_btn', function () {
var tr = $(this).closest("tr"); var tr = $(this).closest("tr");
var row = table.row(tr); var row = table.row(tr);
$("#report_modal").modal('show'); $("#report_modal").modal('show');
console.log(row.data().id);
$("#selected_user_for_report").val(row.data().id); $("#selected_user_for_report").val(row.data().id);
}) })
@@ -1040,7 +1036,6 @@ $(document).on('click', '#activity_report', function () {
showLoaderScreen() showLoaderScreen()
}, },
success: function (result) { success: function (result) {
console.log(result);
$("#activity_time").text(result.activity_time); $("#activity_time").text(result.activity_time);
$("#average_activity_time").text(result.average_activity_time); $("#average_activity_time").text(result.average_activity_time);
@@ -1079,9 +1074,6 @@ $(document).on('click', '.permission-control', function () {
modal.find('.permission-label').removeClass('text-muted') modal.find('.permission-label').removeClass('text-muted')
modal.find('.all-permission-by-type').prop('checked', false) modal.find('.all-permission-by-type').prop('checked', false)
modal.find('#user_id').val(row.data().id) 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) => { modal.find('.permission-input').each((index, element) => {
if ($(element).data('needProvince') == 1) { if ($(element).data('needProvince') == 1) {
if (row.data().province_id == null) { if (row.data().province_id == null) {
@@ -1662,7 +1654,6 @@ $("table").on("click", "tbody tr", function () {
$('#user_data_table').on('change', ".user-finder-all", function () { $('#user_data_table').on('change', ".user-finder-all", function () {
console.log(checkedItemsId);
var thiz = $(this); var thiz = $(this);
if (thiz.is(':checked')) { if (thiz.is(':checked')) {
@@ -1679,7 +1670,6 @@ $('#user_data_table').on('change', ".user-finder-all", function () {
}); });
$('#user_data_table').on('change', ".user-finder", function () { $('#user_data_table').on('change', ".user-finder", function () {
console.log(checkedItemsId);
const checkedItemId = $(this).data("idUser"); const checkedItemId = $(this).data("idUser");
@@ -2141,7 +2131,6 @@ $("#edit_province_office").change(function () {
$("#edit_city_office").change(function () { $("#edit_city_office").change(function () {
console.log("this is ok");
setUserName("edit"); setUserName("edit");
}) })
@@ -2424,20 +2413,15 @@ $("#add_province_office").change(function () {
}) })
$("#add_simple_city").change(function () { $("#add_simple_city").change(function () {
console.log("add_simple_city change happend");
console.log("valuee:", $(this).val());
if ($("#add_simple_city").val() == -1) { if ($("#add_simple_city").val() == -1) {
console.log("value of city is or -1");
disableDOM("add_simple_tollhouse") disableDOM("add_simple_tollhouse")
$("#add_simple_tollhouse").empty(); $("#add_simple_tollhouse").empty();
} else { } else {
console.log("tolls should send reqest");
enableDOM("add_simple_tollhouse") enableDOM("add_simple_tollhouse")
getTollhouseByCity($("#add_simple_province").val(), "add_simple_tollhouse") getTollhouseByCity($("#add_simple_city").val(), "add_simple_tollhouse")
} }
}) })
@@ -2673,8 +2657,10 @@ $("#add_simple_province_office").change(function () {
disableDOM("add_simple_city") disableDOM("add_simple_city")
disableDOM("add_simple_city_office") disableDOM("add_simple_city_office")
disableDOM("add_simple_tollhouse")
$("#add_simple_city").empty(); $("#add_simple_city").empty();
$("#add_simple_city_office").empty(); $("#add_simple_city_office").empty();
$("#add_simple_tollhouse").empty();
} else { } else {
if ($("#add_simple_province").val() == 0 || $("#add_simple_province").val() == -1) { if ($("#add_simple_province").val() == 0 || $("#add_simple_province").val() == -1) {
@@ -2708,6 +2694,7 @@ $("#add_simple_submit_form").on("click", function () {
var edarate_shahri_id = $("#add_simple_city_office").children("option:selected").val(); var edarate_shahri_id = $("#add_simple_city_office").children("option:selected").val();
var national_code = $("#add_simple_national_code").val(); var national_code = $("#add_simple_national_code").val();
var city_id = $("#add_simple_city").children("option:selected").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) { if (edarate_ostani_id <= 0 && edarate_shahri_id <= 0) {
@@ -2746,6 +2733,12 @@ $("#add_simple_submit_form").on("click", function () {
} else { } else {
$("#add_simple_city").removeClass("validity-checker"); $("#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) { if (province_id < 0) {
$("#add_simple_province").addClass("validity-checker"); $("#add_simple_province").addClass("validity-checker");
@@ -2785,6 +2778,10 @@ $("#add_simple_submit_form").on("click", function () {
formData.append("city_id", city_id); formData.append("city_id", city_id);
} }
if (tollhouse_id != undefined) {
formData.append("station_id", tollhouse_id);
}
formData.append("password_confirmation", repass); formData.append("password_confirmation", repass);
if (edarate_ostani_id != 0) { if (edarate_ostani_id != 0) {
formData.append("edarate_ostani_id", edarate_ostani_id); formData.append("edarate_ostani_id", edarate_ostani_id);