From 4947213081fe29eefa4dfefbf3b0c390ac1a1d16 Mon Sep 17 00:00:00 2001 From: frytimo Date: Tue, 15 Jul 2025 03:58:57 -0300 Subject: [PATCH] add hangup all button (#7425) Adjust the logic for handling the hangup when check boxes are used. Enable the Hangup All button. --- app/active_calls/active_calls.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/active_calls/active_calls.php b/app/active_calls/active_calls.php index eec9b21f7c..e458582729 100644 --- a/app/active_calls/active_calls.php +++ b/app/active_calls/active_calls.php @@ -142,10 +142,10 @@ if (!$settings->get('active_calls', 'remove_completed_calls', true)) { ]); } -if (permission_exists('call_active_hangup_disabled')) { +if (permission_exists('call_active_hangup')) { // Hangup selected calls echo button::create([ - 'id' => 'btn_hangup', + 'id' => 'btn_hangup_all', 'type' => 'button', 'label' => $text['label-hangup'], 'icon' => 'phone-slash', @@ -922,8 +922,8 @@ echo "\n"; function hangup_selected(button) { if (button) { - const checkbox = document.querySelector(`input[type="checkbox"][data-uuid="${button.dataset.row_id}"]`); - checkbox.checked = true; + client.request('active.calls', 'hangup', {unique_id: button.dataset.row_id}); + return; } const checked = document.querySelectorAll('#calls_active_body input[type="checkbox"]:checked'); @@ -937,6 +937,9 @@ echo "\n"; const row = checkbox.closest('tr'); if (row) client.request('active.calls', 'hangup', {unique_id: row.id}); }); + + const checkbox_all = document.getElementById('checkbox_all'); + if (checkbox_all) checkbox_all.checked = false; } function remove_button_by_id(button_id) {