/** @odoo-module
 *
 * Navbar patch — gate the POS-logo "register" click so cashiers can't
 * silently abandon a settle-due order by clicking back to the home/
 * register screen.
 *
 * The original onClickRegister is sync; we make ours async and the
 * existing OWL bindings still work (they fire-and-forget).
 */
import { patch } from "@web/core/utils/patch";
import { Navbar } from "@point_of_sale/app/components/navbar/navbar";

patch(Navbar.prototype, {
    async onClickRegister() {
        const allowed = await this.pos.confirmExitSettleIfNeeded(null);
        if (!allowed) {
            return;
        }
        return super.onClickRegister();
    },
});
