let table = document.querySelector('.orders_table');
let footings = document.querySelectorAll('.footing');
let headings = document.querySelector('.heading')
let backBtn = document.querySelector('.back');
let divOrder = document.querySelector('div.order');
let scroller = document.querySelector('.scrollmenu');
let scrollersquare = document.querySelector('.scrollersquare');

table.addEventListener('click', function(e) {
    let target = e.target;
    if (target.classList.contains('heading') || target.parentElement.classList.contains('heading') || target == table) {
        return;
    }
    let order = target.closest('.order');
    let footing = order.querySelector('.footing');
    
    footing.style.display = 'flex';

    backBtn.classList.remove('disabled');
});

backBtn.addEventListener('click', function() { 
    if (backBtn.classList.contains('disabled')) {
        return;
    } else {
        footings.forEach(function(footing) {
            footing.style.display = 'none';
            backBtn.classList.add('disabled');
          });
    }
});


table.onmouseover = function() {
    headings.style.borderColor = 'white';
  };

table.onmouseout = function() {
    headings.style.border = '';
    
};

// scroller.addEventListener('scroll', function() {
//     scrollersquare.style.display = 'block';
//   });