diff --git a/public/version2/js/dashboard_pages/user_management/list.js b/public/version2/js/dashboard_pages/user_management/list.js index 497d4261..0e3abf43 100644 --- a/public/version2/js/dashboard_pages/user_management/list.js +++ b/public/version2/js/dashboard_pages/user_management/list.js @@ -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(''); + cities = result.data; + + for (let index = 0; index < cities.length; index++) { + + $(`#${dom_id}`).append( + `` + ); + } + + 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(''); + enableDOM("add_simple_tollhouse") + $("#add_simple_tollhouse").empty(); + $("#add_simple_tollhouse").append(''); enableDOM("add_simple_city_office") $("#add_simple_city_office").empty(); $("#add_simple_city_office").append(''); @@ -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) { diff --git a/resources/views/version2/dashboard_pages/user_management/list.blade.php b/resources/views/version2/dashboard_pages/user_management/list.blade.php index 868495d7..a77469ca 100644 --- a/resources/views/version2/dashboard_pages/user_management/list.blade.php +++ b/resources/views/version2/dashboard_pages/user_management/list.blade.php @@ -675,6 +675,11 @@ id="add_simple_city_office"> +