HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/doccure-wp-market/wp-content/themes/doccure/assets/js/doccure-ajax.js

jQuery(document).ready(function ($) {
    $(document).on('click', '.remove-doctor-btn', function (e) {
        e.preventDefault();

        const doctorId = $(this).data('doctor-id');
        const button = $(this);

        if (!doctorId) {
            alert('Invalid doctor ID');
            return;
        }

        $.ajax({
            url: doccure_ajax_obj.ajax_url,
            type: 'POST',
            data: {
                action: 'remove_saved_doctor',
                doctor_id: doctorId,
                security: doccure_ajax_obj.security,
            },
             success: function (response) {
                if (response.success) {
                    alert(response.data.message);
                    button.closest('.profile-widget').remove(); // Remove the doctor from the DOM
                    location.reload(); 
                } else {
                    alert(response.data.message);
                }
            },
            error: function () {
                alert('An error occurred. Please try again.');
            },
            complete: function () {
                button.text('Remove');
            },
        });
    });
});


jQuery(document).ready(function ($) {
    $('.view-invoice').on('click', function () {
        var orderId = $(this).data('order-id');

        // AJAX request to fetch order details
        $.ajax({
            url: doccure_ajax_obj.ajax_url,
            method: 'POST',
            data: {
                action: 'fetch_invoice_details',
                order_id: orderId,
                security: doccure_ajax_obj.security,
            },
            success: function (response) {
               // $('#invoice-modal-body').html(response);
               $('#invoice-modal-body').html(response.data);
               $('#invoice_view').modal('show'); // Ensure the modal is visible
            },
            error: function () {
                $('#invoice-modal-body').html('<p class="text-danger">Unable to load invoice details.</p>');
            }
        });
    });
});