testing progress
This commit is contained in:
@@ -1488,7 +1488,6 @@ class TWP_Admin {
|
||||
</td>
|
||||
<td>
|
||||
<button class="button" onclick="editWorkflow(<?php echo $workflow->id; ?>)">Edit</button>
|
||||
<button class="button" onclick="testWorkflow(<?php echo $workflow->id; ?>)">Test</button>
|
||||
<button class="button" onclick="deleteWorkflow(<?php echo $workflow->id; ?>)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -2970,29 +2969,6 @@ class TWP_Admin {
|
||||
wp_send_json_success(array('success' => $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX handler for test call
|
||||
*/
|
||||
public function ajax_test_call() {
|
||||
check_ajax_referer('twp_ajax_nonce', 'nonce');
|
||||
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_die('Unauthorized');
|
||||
}
|
||||
|
||||
$to_number = sanitize_text_field($_POST['to_number']);
|
||||
$workflow_id = intval($_POST['workflow_id']);
|
||||
|
||||
$twilio = new TWP_Twilio_API();
|
||||
|
||||
$twiml_url = home_url('/wp-json/twilio-webhook/v1/voice');
|
||||
$twiml_url = add_query_arg('workflow_id', $workflow_id, $twiml_url);
|
||||
|
||||
$result = $twilio->make_call($to_number, $twiml_url);
|
||||
|
||||
wp_send_json_success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX handler for getting phone numbers
|
||||
*/
|
||||
|
@@ -1156,25 +1156,6 @@ jQuery(document).ready(function($) {
|
||||
});
|
||||
};
|
||||
|
||||
window.testWorkflow = function(workflowId) {
|
||||
var testNumber = prompt('Enter phone number to test (e.g., +1234567890):');
|
||||
|
||||
if (testNumber) {
|
||||
$.post(twp_ajax.ajax_url, {
|
||||
action: 'twp_test_call',
|
||||
to_number: testNumber,
|
||||
workflow_id: workflowId,
|
||||
nonce: twp_ajax.nonce
|
||||
}, function(response) {
|
||||
if (response.success && response.data.success) {
|
||||
alert('Test call initiated successfully!');
|
||||
} else {
|
||||
alert('Error initiating test call: ' + (response.data.error || 'Unknown error'));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.deleteWorkflow = function(workflowId) {
|
||||
if (confirm('Are you sure you want to delete this workflow?')) {
|
||||
$.post(twp_ajax.ajax_url, {
|
||||
|
@@ -116,7 +116,6 @@ class TWP_Core {
|
||||
$this->loader->add_action('wp_ajax_twp_update_workflow', $plugin_admin, 'ajax_save_workflow');
|
||||
$this->loader->add_action('wp_ajax_twp_get_workflow', $plugin_admin, 'ajax_get_workflow');
|
||||
$this->loader->add_action('wp_ajax_twp_delete_workflow', $plugin_admin, 'ajax_delete_workflow');
|
||||
$this->loader->add_action('wp_ajax_twp_test_call', $plugin_admin, 'ajax_test_call');
|
||||
|
||||
// Phone number management AJAX
|
||||
$this->loader->add_action('wp_ajax_twp_get_phone_numbers', $plugin_admin, 'ajax_get_phone_numbers');
|
||||
|
Reference in New Issue
Block a user