Ingredient Management JavaScript Code Documentation

Function: window.onload

This function is called when the window has finished loading. It initializes the page by showing the form for adding a new ingredient.


/**
 * This function is called when the window has finished loading. It initializes the page by showing the form for adding a new ingredient.
 */
window.onload = function() {
    showNewIngredientForm();
};
        

Function: updateGraph

Updates the graph based on the selected item.

Parameters:


/**
 * Updates the graph based on the selected item.
 * @param {string} item_id - The ID of the selected item.
 */
function updateGraph(item_id) {
    // ... Function code ...
}
        

Function: showStockUpdate

Displays the stock update form for a specific item.

Parameters:


/**
 * Displays the stock update form for a specific item.
 * @param {string} item_id - The ID of the item to update.
 * @param {string} item_name - The name of the item.
 * @param {number} current_stock - The current stock value of the item.
 */
function showStockUpdate(item_id, item_name, current_stock) {
    // ... Function code ...
}
        

Function: updateStock

Updates the stock of a specific item based on user input.

Parameters:


/**
 * Updates the stock of a specific item based on user input.
 * @param {string} item_id - The ID of the item to update.
 */
function updateStock(item_id) {
    // ... Function code ...
}
        

Function: deleteIngredient

Deletes a specific ingredient.

Parameters:


/**
 * Deletes a specific ingredient.
 * @param {string} item_id - The ID of the item to delete.
 */
function deleteIngredient(item_id) {
    // ... Function code ...
}
        

Function: showNewIngredientForm

Displays the form for adding a new ingredient.


/**
 * Displays the form for adding a new ingredient.
 */
function showNewIngredientForm() {
    // ... Function code ...
}
        

Function: addNewIngredient

Adds a new ingredient based on user input.


/**
 * Adds a new ingredient based on user input.
 */
function addNewIngredient() {
    // ... Function code ...
}