|
|
|
@ -52,97 +52,10 @@ $(function () { |
|
|
|
sb_build_1.setNearbySelectBox("", sb_build_main); |
|
|
|
sb_build_1.setNearbySelectBox("", sb_build_main); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function createConstructionType(url) { |
|
|
|
|
|
|
|
sb_constr_main = new NoTreeSelect($('#sb-construction-type'), {url, visible: true}); |
|
|
|
|
|
|
|
sb_constr_main.setHeader("Вид строительства"); |
|
|
|
|
|
|
|
let select_constr_type = new SelectedContainer($('#selected-construction-type'), { |
|
|
|
|
|
|
|
obj: sb_constr_main, |
|
|
|
|
|
|
|
noTree: true, |
|
|
|
|
|
|
|
onlyOne: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
sb_constr_main.connectSelectedContainer(select_constr_type); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createLocations(url) { |
|
|
|
|
|
|
|
sb_loc_main = new TreeSelect($('#sb-location-1'), {url, visible: true}); |
|
|
|
|
|
|
|
sb_loc_main.setHeader("Местоположение"); |
|
|
|
|
|
|
|
let select_loc = new SelectedContainer($('#selected-location'), |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
obj: sb_loc_main, |
|
|
|
|
|
|
|
onlyOne: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
sb_loc_main.connectSelectedContainer(select_loc); |
|
|
|
|
|
|
|
let sb_loc_1 = new TreeSelect($('#sb-location-2'), {obj: sb_loc_main}); |
|
|
|
|
|
|
|
let sb_loc_2 = new TreeSelect($('#sb-location-3'), {obj: sb_loc_main}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb_loc_main.setNearbySelectBox(sb_loc_1); |
|
|
|
|
|
|
|
sb_loc_1.setNearbySelectBox(sb_loc_2, sb_loc_main); |
|
|
|
|
|
|
|
sb_loc_2.setNearbySelectBox("", sb_loc_1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createRealty(url) { |
|
|
|
|
|
|
|
let sb_realty = new SelectOrCreate($('#sb-realty'), {url, visible: true}); |
|
|
|
|
|
|
|
sb_realty.setHeader(" "); |
|
|
|
|
|
|
|
let select_realty = new SelectedContainerCreate($('#selected-realty'), |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
obj: sb_realty, |
|
|
|
|
|
|
|
noTree: true, |
|
|
|
|
|
|
|
onlyOne: true, |
|
|
|
|
|
|
|
noHeader: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
sb_realty.connectSelectedContainer(select_realty); |
|
|
|
|
|
|
|
sb_realty.setLinkBoxes([sb_loc_main, sb_constr_main, sb_build_main]); |
|
|
|
|
|
|
|
select_realty.on("add", () => { |
|
|
|
|
|
|
|
$('#checkbox-sb-realty').attr("disabled", true) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
select_realty.on("remove", () => { |
|
|
|
|
|
|
|
$('#checkbox-sb-realty').attr("disabled", false) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
sb_realty.dataPromise.then(function () { |
|
|
|
|
|
|
|
let $realty = $('#sb-realty'); |
|
|
|
|
|
|
|
let check = $('#checkbox-sb-realty'); |
|
|
|
|
|
|
|
if (!check.prop("checked")) { |
|
|
|
|
|
|
|
$realty.hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
let sb_realty_top = new NoTreeSelect($('#sb-realty-top'), {url, visible: true}); |
|
|
|
|
|
|
|
sb_realty_top.setHeader("Объект"); |
|
|
|
|
|
|
|
sb_realty_top.connectSelectedContainer(select_realty); |
|
|
|
|
|
|
|
sb_realty_top.dataPromise.then(function () { |
|
|
|
|
|
|
|
if (!sb_realty_top.dataTree.data.length) { |
|
|
|
|
|
|
|
sb_realty_top.hide() |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
let id = window.location.hash.replace("#", ""); |
|
|
|
|
|
|
|
if (id) sb_realty_top.setElementById(id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
select_realty.on("add", (args)=> { |
|
|
|
|
|
|
|
//TODO: Костыли!!!
|
|
|
|
|
|
|
|
$('#checkbox-sb-realty').prop("checked", true); |
|
|
|
|
|
|
|
sb_realty.show(); |
|
|
|
|
|
|
|
let id = args[0]; |
|
|
|
|
|
|
|
if (id.text) return; |
|
|
|
|
|
|
|
let el = sb_realty.dataTree.getElementById(id); |
|
|
|
|
|
|
|
sb_realty_top.dataPromise.then(function () { |
|
|
|
|
|
|
|
sb_realty_top.$searchInput.val(el.name); |
|
|
|
|
|
|
|
sb_realty_top.selectedEl.id = id; |
|
|
|
|
|
|
|
sb_realty_top.selectedEl.value = el.name; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb_realty.selectedEl.id = id; |
|
|
|
|
|
|
|
sb_realty._fillBoxes(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let sb_loc_main, sb_constr_main, sb_build_main; |
|
|
|
let sb_loc_main, sb_constr_main, sb_build_main; |
|
|
|
// Тип работы
|
|
|
|
// Тип работы
|
|
|
|
createSpecs('/api/specializations_flat'); |
|
|
|
createSpecs('/api/specializations_flat'); |
|
|
|
// Классификация здания
|
|
|
|
// Классификация здания
|
|
|
|
createBuildingClass('/api/building_classifications'); |
|
|
|
createBuildingClass('/api/building_classifications'); |
|
|
|
// createConstructionType('/api/construction_type');
|
|
|
|
|
|
|
|
// createLocations('/api/locations_flat');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// createRealty('/api/realties/current_user')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |