mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 15:26:10 -06:00
#3290 [advs] Admin list make city select2
This commit is contained in:
parent
8eab51e20e
commit
713c2d5987
@ -146,11 +146,32 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Country filter
|
// Country filter
|
||||||
$("select[name=filter_country]").select2({
|
const locationFilter = $("select[name=filter_country]")
|
||||||
|
locationFilter.select2({
|
||||||
placeholder: $('select[name=filter_country] option:first-child').text()
|
placeholder: $('select[name=filter_country] option:first-child').text()
|
||||||
});
|
});
|
||||||
|
locationFilter.change(function () {
|
||||||
|
if ($(this).val()) {
|
||||||
|
getCities($(this).val())
|
||||||
|
}
|
||||||
|
}).trigger('change');
|
||||||
|
|
||||||
|
// City filter
|
||||||
|
$("select[name=filter_City]").select2({
|
||||||
|
placeholder: $('select[name=filter_City] option:first-child').text()
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getCities(country) {
|
||||||
|
return crudAjax(`id=${country}`, '/ajax/getCities', 'POST', () => {}, true)
|
||||||
|
.then(function (cities) {
|
||||||
|
$('select[name="filter_City"]').html("<option value=''>" + $('select[name=filter_City] option:first-child').text() + "</option>");
|
||||||
|
$.each(cities, function (index, value) {
|
||||||
|
$('select[name="filter_City"]').append("<option value='" + value.id + "'>" + value.name + "</option>");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
$("#listFilterForm").submit(function(e) {
|
$("#listFilterForm").submit(function(e) {
|
||||||
// Disable unselected inputs
|
// Disable unselected inputs
|
||||||
const inputs = $('#listFilterForm :input');
|
const inputs = $('#listFilterForm :input');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user