diff --git a/templates/index.html b/templates/index.html
index 1cb1d75..2fece35 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -420,6 +420,30 @@
+
+
+
+
+
+
+
+
+
+
@@ -1074,17 +1098,30 @@
const list = $("#jobs-list");
const showUploaded = $("#show-uploaded") && $("#show-uploaded").checked;
const searchQuery = ($("#jobs-search") && $("#jobs-search").value) || "";
- // Filtriraj: če iskanje aktivno → ignore hidden_after_upload (iskanje vidi vse)
+ const stationFilter = (window._stationFilter !== undefined ? window._stationFilter : "");
+
+ // 1) Posodobi števce ob tabih — samo ne-potrjeni (!hidden_after_upload) joby
+ updateStationCounts(data.jobs);
+
+ // 2) Filtriraj za prikaz
const visible = data.jobs.filter(j => {
+ // Iskanje IGNORIRA hidden filter (vrne tudi naložene), TUDI station filter
if (searchQuery.trim()) return jobMatchesSearch(j, searchQuery);
- return showUploaded || !j.hidden_after_upload;
+ // Sicer: skrij potrjene (razen če je showUploaded)
+ if (!showUploaded && j.hidden_after_upload) return false;
+ // Station filter: prazen string = "Vse", drugače uskladi
+ if (stationFilter === "") return true;
+ if (stationFilter === "__none__") return !j.tv_station;
+ return (j.tv_station || "") === stationFilter;
});
if (!visible.length) {
list.innerHTML = searchQuery.trim()
? `Ni zadetkov za "${escapeHtml(searchQuery)}"
`
- : (showUploaded
- ? 'Še ni obdelav
'
- : 'Vse obdelano in naloženo. Klikni "Pokaži tudi že naložene" če želiš popraviti.
');
+ : (stationFilter
+ ? `Ni nepotrjenih reelov za ${escapeHtml(stationFilter === "__none__" ? "(brez postaje)" : stationFilter)}.
`
+ : (showUploaded
+ ? 'Še ni obdelav
'
+ : 'Vse obdelano in naloženo. Klikni "Pokaži tudi že naložene" če želiš popraviti.
'));
return;
}
list.innerHTML = "";
@@ -1096,6 +1133,30 @@
}
});
}
+
+ // Posodobi števce ob station-filter tabih.
+ // Šteje samo še-ne-potrjene jobe (!hidden_after_upload).
+ function updateStationCounts(jobs) {
+ const tabs = $("#station-filter-tabs");
+ if (!tabs) return;
+ const pending = jobs.filter(j => !j.hidden_after_upload);
+ const counts = {};
+ pending.forEach(j => {
+ const k = j.tv_station || "__none__";
+ counts[k] = (counts[k] || 0) + 1;
+ });
+ // Vse
+ const allEl = tabs.querySelector("[data-cnt-all]");
+ if (allEl) allEl.textContent = pending.length;
+ // Posamezne postaje
+ tabs.querySelectorAll("[data-cnt]").forEach(el => {
+ const key = el.dataset.cnt;
+ el.textContent = counts[key] || 0;
+ });
+ // Skrij/show "(brez postaje)" tab — samo če imamo kakšen brez postaje
+ const noneTab = tabs.querySelector('[data-station="__none__"]');
+ if (noneTab) noneTab.style.display = (counts["__none__"] || 0) > 0 ? "" : "none";
+ }
// Toggle pokaži/skrij že naložene + iskalnik
document.addEventListener("DOMContentLoaded", () => {
@@ -1109,6 +1170,38 @@
searchTimer = setTimeout(refreshJobs, 150);
});
}
+ // Station filter tabs
+ const stationTabs = $$(".station-filter-tab");
+ // Restore from localStorage
+ try {
+ const saved = localStorage.getItem("reels_jobs_station_filter");
+ if (saved !== null) window._stationFilter = saved;
+ } catch (e) {}
+ // Apply visual active state
+ stationTabs.forEach(t => {
+ const isActive = (t.dataset.station || "") === (window._stationFilter || "");
+ t.classList.toggle("active", isActive);
+ t.style.borderColor = isActive ? "var(--accent)" : "#444";
+ t.style.background = isActive ? "var(--accent)" : "transparent";
+ t.style.color = isActive ? "#fff" : (t.dataset.station === "__none__" ? "#888" : "#ccc");
+ });
+ // Click handler
+ stationTabs.forEach(tab => {
+ tab.addEventListener("click", () => {
+ const station = tab.dataset.station || "";
+ window._stationFilter = station;
+ try { localStorage.setItem("reels_jobs_station_filter", station); } catch(e) {}
+ // Vizualno označi
+ stationTabs.forEach(t => {
+ const active = t === tab;
+ t.classList.toggle("active", active);
+ t.style.borderColor = active ? "var(--accent)" : "#444";
+ t.style.background = active ? "var(--accent)" : "transparent";
+ t.style.color = active ? "#fff" : (t.dataset.station === "__none__" ? "#888" : "#ccc");
+ });
+ refreshJobs();
+ });
+ });
});
function updateJobInList(job) {