<div class="position-relative d-none if-edit mx-2 border-left border-right" id="note-rx-actions">
    <div class="d-flex align-items-center px-2">
        <a href="/patients/view/{{$patient->uid}}/tickets/erx?popupmode=1"
           native target="_blank"
           class="ticket-popup-trigger rx-action d-block text-nowrap">
            Erx/Orders
        </a>
    </div>
</div>
<div class="stag-popup stag-popup-lg ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
<script>
    (function() {
        function init() {
            // refresh once ticket popup is closed
            $('body').off('stag-popup-closed')
            /*$('body').on('stag-popup-closed', function() {
                if($('#client-rx-container').length) {
                    fastReload();
                }
            });*/
            // ticket-popup
            $(document)
                .off('click', '.ticket-popup-trigger.rx-action')
                .on('click', '.ticket-popup-trigger.rx-action', function() {
                    showMask();
                    window.noMc = true;
                    $.get(this.href, (_data) => {
                        $('.ticket-popup').html(_data);
                        showStagPopup('ticket-popup', true);
                        // $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
                        runMCInitializer('patient-tickets'); // run specific mc initer
                        hideMask();
                    });
                    return false;
                });

        }
        addMCInitializer('note-rx-actions', init, '#note-rx-actions');
    }).call(window);
</script>

