{% include "django/forms/widgets/checkbox.html" %}

<div class="modal fade" id="modal-{{ widget.name }}" style="display: none;" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" style="height: 80vh; padding: 0">
                <div class="embed-responsive" style="height: 100%">
                    <iframe id="{{ widget.name }}-iframe"></iframe>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    function open{{ widget.name }}Modal(url_value) {
        $('#modal-{{ widget.name }}').modal('show');
        const dataIframe = document.getElementById('{{ widget.name }}-iframe');

        dataIframe.setAttribute('src', url_value);
        dataIframe.addEventListener('load', () => {
            let doc = dataIframe.contentDocument;
            doc.body.innerHTML = doc.body.innerHTML +
                `<style>
                    #lang-form, .login-logo {display: none;}
                    body {background-color: #fff !important; justify-content: start !important;}
                </style>`;
        });
    }
</script>