add toll house to user management

This commit is contained in:
amirghasempoor
2026-05-18 08:09:27 +00:00
parent 048219f92e
commit 6a1513a72f
2 changed files with 65 additions and 9 deletions

View File

@@ -417,6 +417,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_fa}</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,
@@ -2386,6 +2423,24 @@ $("#add_province_office").change(function () {
setUserName();
})
$("#add_simple_city").change(function () {
console.log("add_simple_city change happend");
console.log("valuee:", $(this).val());
if ($("#add_simple_city").val() == -1) {
console.log("value of city is or -1");
disableDOM("add_simple_tollhouse")
$("#add_simple_tollhouse").empty();
} else {
console.log("tolls should send reqest");
enableDOM("add_simple_tollhouse")
getTollhouseByCity($("#add_simple_province").val(), "add_simple_tollhouse")
}
})
// $("#edit_city").change(function () {
// if ($(this).val() == 0) {
@@ -2396,15 +2451,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 +2627,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 +2643,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) {

View File

@@ -675,6 +675,11 @@
id="add_simple_city_office">
</select>
</div>
<div class="form-group col-md-12">
<label>راهدارخانه</label>
<select class="form-control tollhouse" name="add_simple_tollhouse" id="add_simple_tollhouse">
</select>
</div>
<div class="form-group col-md-6">
<label> نام کاربری</label>
<span style="color: crimson">*</span>