Skip to content

Commit

Permalink
Checkout events - removed jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Oct 16, 2023
1 parent d4ed5e0 commit fbf2ca8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _dev/js/checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
import prestashop from 'prestashop';
import useEvent from '../theme/components/event/useEvent';

const { on } = useEvent();

function setUpCheckout() {
$(prestashop.selectors.checkout.termsLink).on('click', (event) => {
Expand All @@ -44,6 +47,13 @@ function setUpCheckout() {
$(prestashop.selectors.modal).modal('show');
});

on(prestashop.selectors.checkout.giftCheckbox, 'change', ({ target }) => {
const isChecked = target.checked;
const giftBlock = document.querySelector('#gift');
const collapseInstance = bootstrap.Collapse.getOrCreateInstance(giftBlock);

Check failure on line 53 in _dev/js/checkout/index.js

View workflow job for this annotation

GitHub Actions / Code quality - ESLint

'bootstrap' is not defined

Check failure on line 53 in _dev/js/checkout/index.js

View workflow job for this annotation

GitHub Actions / Code quality - ESLint

'bootstrap' is not defined

collapseInstance.toggle(isChecked);
});
$(prestashop.selectors.checkout.giftCheckbox).on('click', () => {
$('#gift').slideToggle();
});
Expand Down

0 comments on commit fbf2ca8

Please sign in to comment.