from flask import Blueprint, render_template, abort

module_bp = Blueprint("module", __name__)

ALLOWED_MODULES = {
    "home",
    "yakinda",
    "storage",
    "sales",
    "customers",
    "payment",
    "sales_list",
    "rapor_donem",
    "ayarlar",
}

@module_bp.route("/modules/<n>")
def render_module(n):
    if n not in ALLOWED_MODULES:
        abort(404)

    try:
        return render_template(f"modules/{n}.html")
    except Exception:
        abort(404)
