Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
SOD/public/javascripts/orders.js

25 lines
730 B
JavaScript

const date = document.getElementById("date");
function collapse(e, subDiv) {
e.addEventListener("click", ev => {
ev.stopPropagation();
let action;
if (e.classList.contains("collapse"))
action = "remove";
else
action = "add";
e.querySelectorAll("."+subDiv).forEach(e => e.classList[action]("hide"));
e.classList[action]("collapse");
})
}
document.querySelectorAll(".department").forEach(e => collapse(e, "user"));
document.querySelectorAll(".user").forEach(e => collapse(e, "order"));
document.querySelectorAll(".order").forEach(e => collapse(e, "sandwich"));
date.addEventListener("change", () => window.location.href = "?date="+date.value);