Sha256: 510726dbdc8fa0b11348645559fc927702409537f17163dcaf209a9db41bfffe

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

//= require_self
//= require spree/frontend/checkout/address
//= require spree/frontend/checkout/payment

Solidus.disableSaveOnClick = () => {
  const form = document.querySelector('form.edit_order');
  form.addEventListener('submit', () => {
    const elements = form.querySelectorAll('[type="submit"], [type="image"]');
    elements.forEach(element => {
      element.setAttribute('disabled', true);
      element.classList.remove('primary');
      element.classList.add('disabled');
    });
  });
};

window.addEventListener('DOMContentLoaded', () => {
  const termsCheckbox = document.getElementById('accept_terms_and_conditions');

  if (termsCheckbox) {
    termsCheckbox.addEventListener('change', () => {
      const submitButton = termsCheckbox.closest('form')
        .querySelector('[type="submit"]');

      if (termsCheckbox.checked) {
        submitButton.removeAttribute('disabled');
        submitButton.classList.remove('disabled');
      } else {
        submitButton.setAttribute('disabled', true);
        submitButton.classList.add('disabled');
      }
    });
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 app/assets/javascripts/spree/frontend/checkout.js