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/zelfverkopen.komma.pro/resources/assets/js/site/startSaleFormHandler.js
/* ==========================================================================
 Navigation handler
 ========================================================================== */

/**
 * Main navigation
 */
var StartSaleFormHandler = {

    form: [],
    sellerOtherAddressToSell: '',
    sellerOtherAddressToSellArea: '',
    submitButton: '',

    // Initialize click event
    init : function()
    {
        // Bind Start Sale Form to Handler
        StartSaleFormHandler.form = document.getElementById('startSaleForm');

        if(isset(StartSaleFormHandler.form)){

            // Get bind element for other selling address to the handler
            StartSaleFormHandler.sellerOtherAddressToSell = document.getElementById('sellerOtherAddressToSell');
            StartSaleFormHandler.sellerOtherAddressToSellArea = document.querySelector('#startSaleForm .seller .other-selling-address');

            // Bind change event of the other address for selling checkbox
            StartSaleFormHandler.sellerOtherAddressToSell.addEventListener('change', function () {
               StartSaleFormHandler.toggleOtherSellingAddressArea();
            });

            // Bind click on submit p element
            StartSaleFormHandler.submitButton = document.querySelector('#startSaleForm .confirmOrder .submit p');
            StartSaleFormHandler.submitButton.addEventListener('click', function(){
                StartSaleFormHandler.form.submit();
            });

        }

    },

    // Toggle faq
    toggleOtherSellingAddressArea : function()
    {
        // Determine if currently open or closed
        var boolean = true;

        if(StartSaleFormHandler.sellerOtherAddressToSellArea.getAttribute('data-open') === 'true'){
            boolean = false;
        }

        StartSaleFormHandler.sellerOtherAddressToSellArea.setAttribute('data-open', boolean);

    },
};

StartSaleFormHandler.init();