// ============ SINGLE CLIENT APPROVE ============ $(document).on('click', '.open-approve-modal', function() { var clientId = $(this).data('id'); // Set modal for single mode $('.confirm-approve').data('id', clientId).data('mode', 'single'); $('#approve-modal-text').text('You are about to approve this client addition request. Once approved, the client will be added to the system and available for future transactions.'); $('.approve-client-request').modal('show'); }); // ============ SINGLE CLIENT REJECT ============ $(document).on('click', '.open-reject-modal', function() { var clientId = $(this).data('id'); var reason = $(this).data('reason'); // Set modal for single mode $('.confirm-reject').data('id', clientId).data('mode', 'single'); $('#reject_reason').val(reason || ''); $('#reject-modal-text').text('You are about to reject this client addition request. Please provide a reason for rejection so the requester can be notified.'); $('.reject-client-request').modal('show'); }); // ============ CONFIRM APPROVE (Handles both single and bulk) ============ $(document).on('click', '.confirm-approve', function() { const mode = $(this).data('mode'); const button = $(this); button.prop('disabled', true).text('Processing...'); if (mode === 'single') { // Single client approve var clientId = $(this).data('id'); if (!clientId) { alert('Client ID is missing'); button.prop('disabled', false).text('Approve Request'); return; } $.ajax({ url: "