// Fusion Accounting - Bank Reconciliation Global Info
// Copyright (C) 2026 Nexa Systems Inc.

import { Component, onWillStart } from "@odoo/owl";
import { user } from "@web/core/user";

/**
 * BankRecGlobalInfo - Displays journal-level summary information
 * including balance amounts during bank reconciliation.
 */
export class BankRecGlobalInfo extends Component {
    static template = "fusion_accounting.BankRecGlobalInfo";
    static props = {
        journalId: { type: Number },
        journalBalanceAmount: { type: String },
    };

    setup() {
        this.hasGroupReadOnly = false;
        onWillStart(async () => {
            this.hasGroupReadOnly = await user.hasGroup("account.group_account_readonly");
        })
    }

    /** Open the bank reconciliation report. **/
    actionOpenBankGL() {
        this.env.methods.actionOpenBankGL(this.props.journalId);
    }

}
