document.addEventListener('DOMContentLoaded', function () {
    var printButton = document.getElementById('printInvoiceBtn');
    var whatsappButton = document.getElementById('whatsappInvoiceBtn');

    if (printButton) {
        printButton.addEventListener('click', function () {
            window.print();
        });
    }

    if (whatsappButton) {
        whatsappButton.addEventListener('click', function () {
            var invoiceId = this.dataset.invoiceId;
            if (invoiceId) {
                window.location.href = 'send_whatsapp.php?id=' + encodeURIComponent(invoiceId);
            }
        });
    }
});
