added UI for burg group filter

- Code for filtering burgs.
- Added new pop up menu when clicking the button "reassign burgs".
This commit is contained in:
Ángel Montero Lamas 2024-08-20 20:00:35 +02:00
parent 9c206a3813
commit 64bc701809
4 changed files with 151 additions and 30 deletions

View file

@ -98,14 +98,10 @@ function editBurg(id) {
// select group
const group = elSelected.node().parentNode.id;
const select = byId("burgSelectGroup");
select.options.length = 0; // remove all options
burgLabels.selectAll("g").each(function () {
select.options.add(new Option(this.id, this.id, false, this.id === group));
});
updateBurgsGroupFilter("burgSelectGroup", group);
// set emlem image
// set emblem image
const coaID = "burgCOA" + id;
COArenderer.trigger(coaID, b.coa);
byId("burgEmblem").setAttribute("href", "#" + coaID);
@ -144,6 +140,15 @@ function editBurg(id) {
byId("burgSelectGroup").style.display = "inline-block";
}
function updateBurgsGroupFilter(id, alreadySelectedGroup) {
const select = document.getElementById(id);
select.options.length = 0; // remove all options
burgLabels.selectAll("g").each(function () {
select.options.add(new Option(this.id, this.id, false, this.id === alreadySelectedGroup));
});
}
function changeGroup() {
const id = +elSelected.attr("data-id");
moveBurgToGroup(id, this.value);