Sales Report JavaScript Code Documentation

Function: window.onload

Sets up the initial state of the page when it loads. Calls the 'changeCategory' function to set the category to 'piadas' on page load.

Parameters:


window.onload = function() {
    // run change category to be set to piadas when page loads
    changeCategory('piadas');
};
        

Function: changeCategory

Changes the displayed items based on the selected category. Hides all items that do not belong to the selected category and shows those that do.

Parameters:


function changeCategory(category) {
    // ... Function code ...
}
        

Function: updateGraph

Makes an AJAX request to fetch graph data for the selected item. Updates the graph container with the received graph data on success. Logs an error message on failure.

Parameters:


function updateGraph(item_id) {
    // ... Function code ...
}