import 'admin-lte/plugins/ekko-lightbox/ekko-lightbox.min.js';
import 'admin-lte/plugins/ekko-lightbox/ekko-lightbox.css';

export default () => {
    const wrapper = $('#images-wrapper');

    wrapper.on('click', '[data-toggle="lightbox"]', function (e) {
        e.preventDefault();

        $(this).ekkoLightbox({
            alwaysShowClose: true,
        });
    });

    wrapper.on('click', '.btn-select-image', function (e) {
        e.preventDefault();

        let btn = $(this);
        let imageURL = btn.attr('href');
        let imageFile = btn.attr('data-file');

        if (window.opener) {
            window.opener.onSelectImage(imageURL, imageFile);
        }
    });
};
