<?php
/**
 * Blog Status / Approval Modal
 * Reusable – controlled fully by JS
 */
?>
<div class="modal fade" id="blogStatusModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-md modal-dialog-centered">
        <div class="modal-content">

            <div class="modal-header">
                <h5 class="modal-title" id="blogStatusModalTitle">Update Blog</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <div class="modal-body">
                <input type="hidden" id="modal_blog_id">

                <!-- Rejection reason -->
                <div class="mb-3 d-none" id="rejectionBlock">
                    <label class="form-label">Rejection Reason <span class="text-danger">*</span></label>
                    <textarea class="form-control" id="rejection_reason" rows="3"
                              placeholder="Explain why this blog is rejected"></textarea>
                    <div class="invalid-feedback">Rejection reason is required</div>
                </div>

                <div class="alert alert-warning d-none" id="modalWarning"></div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-light" data-bs-dismiss="modal">Cancel</button>

                <!-- Approval buttons -->
                <button type="button" class="btn btn-success d-none" id="approveBtn"
                        onclick="approveBlog()">Approve</button>

                <button type="button" class="btn btn-danger d-none" id="rejectBtn"
                        onclick="rejectBlog()">Reject</button>
            </div>

        </div>
    </div>
</div>
