HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/netwerkbrabant.komma.pro/resources/assets/js/site/paymentFormHandler.js
import { isset } from "../global/helpers";

/* ==========================================================================
   Payment forms Handler
 ========================================================================== */

const PaymentFormHandler = {

    registerForm: null,
    otherInvoiceAddress: false,

    init: function () {

        PaymentFormHandler.registerForm = document.querySelector('.payment-form'); 

        if(isset(PaymentFormHandler.registerForm)){

            // Shipping Address area checkbox
            const invoiceAddressCheckbox = PaymentFormHandler.registerForm.querySelector('#other_invoice_address');
            invoiceAddressCheckbox.addEventListener('change', function () {

                const invoiceAreaFieldsWrapper = PaymentFormHandler.registerForm.querySelector('.invoice-information');

                if(invoiceAddressCheckbox.checked){
                    invoiceAreaFieldsWrapper.classList.remove('invoice-information--hidden');
                    PaymentFormHandler.otherInvoiceAddress = true;
                }
                else{
                    invoiceAreaFieldsWrapper.classList.add('invoice-information--hidden');
                    PaymentFormHandler.otherInvoiceAddress = false;
                }
            });

        }
    },
};

export default PaymentFormHandler;