2023-05-15 13:53:34 +02:00
|
|
|
async function load() {
|
2023-05-23 11:21:48 +02:00
|
|
|
const items = await loadItems();
|
2023-05-23 20:07:26 +02:00
|
|
|
const chartDom = document.querySelector("#chart");
|
|
|
|
newSearchComponent(document.querySelector("#search"), items,
|
|
|
|
(hits) => {
|
|
|
|
items.forEach(item => item.chart = false);
|
|
|
|
showChart(chartDom, []);
|
|
|
|
return hits;
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
(header) => {
|
|
|
|
header.append(dom("th", ""));
|
|
|
|
return header;
|
|
|
|
}, (item, itemDom, items) => {
|
|
|
|
const chartCheckbox = dom("input");
|
|
|
|
chartCheckbox.setAttribute("type", "checkbox");
|
|
|
|
const cell = dom("td", "");
|
|
|
|
cell.appendChild(chartCheckbox);
|
|
|
|
itemDom.appendChild(cell);
|
|
|
|
|
|
|
|
chartCheckbox.addEventListener("click", () => {
|
|
|
|
item.chart = chartCheckbox.checked;
|
|
|
|
const data = [];
|
|
|
|
items.forEach(i => { if (i.chart) data.push(i) });
|
|
|
|
if (data.length == 0) {
|
|
|
|
chartDom.style.display = "none";
|
|
|
|
} else {
|
|
|
|
chartDom.style.display = "block";
|
|
|
|
showChart(chartDom, data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return itemDom;
|
|
|
|
});
|
2023-05-15 13:53:34 +02:00
|
|
|
}
|
|
|
|
|
2023-05-18 13:39:58 +02:00
|
|
|
load();
|