export const entityForm = () => {
    // Initialization
    initializeSubmitForm();
};

function initializeSubmitForm() {
    let form = document.getElementById('entity_form');
    let submitButtons = document.querySelector('.submit-actions');
    let submitButtonFake = document.getElementById('submit_fake');

    if (form && submitButtons && submitButtonFake) {
        submitButtons.classList.remove('d-flex');
        submitButtons.classList.add('d-none');
        submitButtonFake.addEventListener('click', function (e) {
            e.preventDefault();
            form.submit();
        });
    } else if (submitButtonFake) {
        submitButtonFake.title = 'Sauvegarde automatique';
        submitButtonFake.classList.add('btn-secondary');
        submitButtonFake.classList.remove('btn-success');
        submitButtonFake.style.cursor = 'not-allowed';
        submitButtonFake.addEventListener('click', function (e) {
            e.preventDefault();
        });
    }
}
