<?php
/**
 * Add these menu actions to /rooms/modules/calendar/calendar.php
 * where your booking right-click menu is built.
 *
 * Your booking bars already have:
 * data-order-id="..."
 */
?>

<script>
function openEmailProforma(orderId, type) {
    type = type || 'standard';

    if (!orderId || parseInt(orderId, 10) <= 0) {
        alert('Booking was not selected.');
        return;
    }

    window.open(
        '/rooms/modules/payments/email_proforma.php?order_id=' + encodeURIComponent(orderId) + '&type=' + encodeURIComponent(type),
        '_blank',
        'noopener'
    );
}

/*
Add these options to your right-click menu:

Email Proforma              -> openEmailProforma(selectedOrderId, 'standard')
Email Main Folio Proforma   -> openEmailProforma(selectedOrderId, 'master')
Email Room Proforma         -> openEmailProforma(selectedOrderId, 'room')
Email Guest Folio Proforma  -> openEmailProforma(selectedOrderId, 'guest')
*/
</script>
