proj2.Flask_app
Generate a deterministic, pleasant color palette for item IDs. Args: item_ids (Iterable[int]): The menu item IDs to colorize. Returns: dict: Mapping itm_id -> hex color string (e.g., '#a1b2c3').
Build month-view calendar cells enriched with menu items per day. Args: gen_map (dict): Mapping 'YYYY-MM-DD' -> [{'itm_id': int, 'meal': 1|2|3}, ...]. year (int): The calendar year. month (int): The calendar month (1–12). items_by_id (dict): Mapping itm_id -> item detail dict from DB. Returns: list: A flat list of calendar cell dicts with day number and a 'meals' list.
Render the calendar home view for the current or specified month. Args: year (int | None): Optional year path parameter. month (int | None): Optional month path parameter (1–12). Returns: Response: HTML page showing the monthly plan and today's meals (requires login).
Display the login form (GET) and authenticate user credentials (POST). Args: None Returns: Response: Renders login page, or redirects to home on successful login.
Clear the user session and redirect to the login page. Args: None Returns: Response: Redirect to the login route.
Display the registration form (GET) and create a new user (POST). Args: None Returns: Response: Renders registration page or redirects to login on success.
Show the logged-in user's profile, including recent orders. Args: None Returns: Response: HTML profile page (requires login).
Display and process the profile edit form (phone, preferences, allergies). Args: None Returns: Response: Renders form (GET) or updates and redirects to profile (POST).
Change the current user's password after validating the current password. Args: None Returns: Response: Redirect back to profile with success or error flags.
Place an order via JSON (POST) or handle legacy single-item GET flow. Args: None Returns: Response: JSON with {'ok', 'ord_id'} on POST; redirects/HTML for legacy GET.
List restaurants and in-stock menu items for browsing. Args: None Returns: Response: HTML page showing restaurants and items (requires login).
Browse restaurants with details and currently in-stock items. Args: None Returns: Response: HTML page listing restaurants and their items (requires login).
Stream a PDF receipt for an order owned by the logged-in user. Args: ord_id (int): The order identifier in the path. Returns: Response: PDF file download or an error status (404/403) if inaccessible.
Display a simple, paginated database table viewer. Args: None Returns: Response: HTML page showing rows/columns for a selected table (requires login).