core/api/modules/lk-perevozka/p006_mod.js

80 lines
2.4 KiB
JavaScript

/* ----------------------------------------------------------------------
27.10.2022
Добавление города обитания
---------------------------------------------------------------------- */
function addCityList(data, city){
if (data=='0'){
var cityText=$("#sel-children-city option:selected").text();
$("#cityList").append('<span class="badge bg-secondary" style="margin: 3px;"> ' + cityText + ' <span class="badge text-bg-secondary"><img src="/api/img/gray/gif/del.gif" style="cursor: pointer;" class="delCityWork" data-id="' + city + '"></span> </span>')
}
}
$("#AddCityPerevozka").click(function(event) {
var city=$("#sel-children-city option:selected").val();
$.ajax({
type: 'POST',
url: '/act/lk-perevozka',
data: 'act=AddCityPerevozka&city=' + city,
success: function(data) {addCityList(data, city)}
});
})
/* ----------------------------------------------------------------------
30.10.2022
Удаление города обитания
---------------------------------------------------------------------- */
$(document).on("click", ".delCityWork", function(event){
var city_id=$(this).data('id');
$(this).parent().parent().hide('4000');
$.ajax({
type: 'POST',
url: '/act/lk-perevozka',
data: 'act=RemoveCityPerevozka&city_id=' + city_id,
success: function(data) {}
});
});
/* ----------------------------------------------------------------------
30.10.2022
Включаем режим организации
---------------------------------------------------------------------- */
$('#onOrg').click(function(event) {
if($(this).is(":checked")) {
var org = 1;
$('.a-' + tip).removeClass('hidden');
$('.a-' + tip).addClass('d-flex');
}else{
var org = 0;
$('.a-' + tip).addClass('hidden');
$('.a-' + tip).removeClass('d-flex');
}
$.ajax({
type: 'POST',
url: '/act/lk',
data: 'act=onOrg&do=' + org,
success: function(data) {/*p006ResultLD(data)*/}
});
//return false;
})
/* ----------------------------------------------------------------------
15.10.2022
Селект
---------------------------------------------------------------------- */
$("#sel-children-city").chained("#sel-parent-region");