| @@ -1,135 +1,135 @@ | ||
| 1 | -jQuery(document).ready(function($){ | |
| 2 | - "use strict"; | |
| 3 | - $('#wpbot_checked_all').on('click', function(){ | |
| 4 | - if($(this).is(':checked')){ | |
| 5 | - $('.wpbot_sessions_checkbox').prop('checked', true); | |
| 6 | - }else{ | |
| 7 | - $('.wpbot_sessions_checkbox').prop('checked', false); | |
| 8 | - } | |
| 9 | - }) | |
| 10 | - | |
| 11 | - // $('#wpbot_submit_delcs_form').on('click', function(e){ | |
| 12 | - // e.preventDefault(); | |
| 13 | - // $( "#wpcs_form_sessions" ).submit(); | |
| 14 | - // }) | |
| 15 | - | |
| 16 | - | |
| 17 | - // Get the modal | |
| 18 | - var modal = document.getElementById("wpcsmyModal"); | |
| 19 | - | |
| 20 | - | |
| 21 | - // Get the <span> element that closes the modal | |
| 22 | - var span = document.getElementsByClassName("wpcsclose")[0]; | |
| 23 | - | |
| 24 | - $('.wpcsmyBtn').on('click', function(e){ | |
| 25 | - e.preventDefault(); | |
| 26 | - $('#wpcs_to_email_address').val($(this).attr('data-email')); | |
| 27 | - $('#wpcs_show_email').html($(this).attr('data-email')); | |
| 28 | - $('#wpcsmyModal').show(); | |
| 29 | - }) | |
| 30 | - | |
| 31 | - // When the user clicks on <span> (x), close the modal | |
| 32 | - span.onclick = function() { | |
| 33 | - modal.style.display = "none"; | |
| 34 | - $('#wpcs_show_email').html(''); | |
| 35 | - } | |
| 36 | - | |
| 37 | - // When the user clicks anywhere outside of the modal, close it | |
| 38 | - window.onclick = function(event) { | |
| 39 | - if (event.target == modal) { | |
| 40 | - modal.style.display = "none"; | |
| 41 | - $('#wpcs_show_email').html(''); | |
| 42 | - } | |
| 43 | - } | |
| 44 | - | |
| 45 | - | |
| 46 | - jQuery( "#wpcs_email_form" ).submit(function( event ) { | |
| 47 | - | |
| 48 | - event.preventDefault(); | |
| 49 | - jQuery('#wpcs_email_loading').hide(); | |
| 50 | - jQuery( "#wpcs_email_status" ).html(''); | |
| 51 | - var subject = jQuery('#wpcs_email_subject').val(); | |
| 52 | - | |
| 53 | - var message = jQuery('#wpcs_email_message').val(); | |
| 54 | - var to = jQuery('#wpcs_to_email_address').val(); | |
| 55 | - | |
| 56 | - var error = false; | |
| 57 | - | |
| 58 | - if(subject==''){ | |
| 59 | - alert('please provide the subject'); | |
| 60 | - error = true; | |
| 61 | - } | |
| 62 | - if(message==''){ | |
| 63 | - alert('please provide the message content'); | |
| 64 | - error = true; | |
| 65 | - } | |
| 66 | - | |
| 67 | - if(error==false){ | |
| 68 | - jQuery('#wpcs_email_loading').show(); | |
| 69 | - | |
| 70 | - | |
| 71 | - var data = { | |
| 72 | - 'to': to, | |
| 73 | - 'subject': subject, | |
| 74 | - 'message': message, | |
| 75 | - } | |
| 76 | - $.post( | |
| 77 | - ajax_object.ajax_url, | |
| 78 | - { | |
| 79 | - action : 'wpcs_send_email', | |
| 80 | - security: ajax_object.ajax_nonce, | |
| 81 | - data: data, | |
| 82 | - }, | |
| 83 | - function(data){ | |
| 84 | - jQuery('#wpcs_email_loading').hide(); | |
| 85 | - var json = $.parseJSON(data); | |
| 86 | - jQuery( "#wpcs_email_status" ).html(json.message); | |
| 87 | - jQuery('#wpcs_email_subject').val(''); | |
| 88 | - jQuery('#wpcs_email_message').val(''); | |
| 89 | - jQuery('#wpcs_to_email_address').val(''); | |
| 90 | - | |
| 91 | - } | |
| 92 | - ); | |
| 93 | - | |
| 94 | - | |
| 95 | - } | |
| 96 | - | |
| 97 | - }); | |
| 98 | - | |
| 99 | - $('#qcld_session_min_interaction').change(function() { | |
| 100 | - this.form.submit(); | |
| 101 | - }); | |
| 102 | - | |
| 103 | - $('#qcld_session_wp_user').change(function() { | |
| 104 | - this.form.submit(); | |
| 105 | - }); | |
| 106 | - | |
| 107 | - | |
| 108 | - | |
| 109 | - $( "#session_s_date" ).datepicker({dateFormat: 'yy-mm-dd'}); | |
| 110 | - $( "#session_e_date" ).datepicker({dateFormat: 'yy-mm-dd'}); | |
| 111 | - $('.wpvo_filter_session').on('click','.filter_session_button',function(){ | |
| 112 | - var session_s_date = $( "#session_s_date" ).val(); | |
| 113 | - var session_e_date = $( "#session_e_date" ).val(); | |
| 114 | - $.post( | |
| 115 | - ajax_object.ajax_url, | |
| 116 | - { | |
| 117 | - action : 'qcld_chatbot_session_date_filter', | |
| 118 | - security: ajax_object.ajax_nonce, | |
| 119 | - start_date: session_s_date, | |
| 120 | - end_date: session_e_date, | |
| 121 | - }, | |
| 122 | - function(data){ | |
| 123 | - var datas = JSON.parse(data); | |
| 124 | - var sure = "'are you sure'"; | |
| 125 | - $('.sld_payment_row.body').empty(); | |
| 126 | - $.each( datas, function( key, value ) { | |
| 127 | - var row = '<div class="sld_payment_row body"><div class="sld_payment_cell"><input type="checkbox" name="sessions[]" class="wpbot_sessions_checkbox" value="'+value.id+'"></div><div class="sld_payment_cell">'+value.date+'</div><div class="sld_payment_cell">'+value.interaction+'</div><div class="sld_payment_cell">'+value.session_id+'</div><div class="sld_payment_cell">'+value.name+'</div><div class="sld_payment_cell">'+value.email+'</div><div class="sld_payment_cell">'+value.phone+'</div><div class="sld_payment_cell"><div class="sld_responsive_head">Action</div><a href="/wp-admin/admin.php?page=wbcs-botsessions-page&userid='+value.id+'" class="button-primary">View Chat</a> <a href="/wp-admin/admin.php?page=wbcs-botsessions-page&userid='+value.id+'&act=delete" class="button-primary" onclick="return confirm('+sure+')">Delete</a></div></div>'; | |
| 128 | - $('.sld_payment_table').append(row); | |
| 129 | - }); | |
| 130 | - | |
| 131 | - } | |
| 132 | - ); | |
| 133 | - }); | |
| 134 | - | |
| 1 | +jQuery(document).ready(function($){ | |
| 2 | + "use strict"; | |
| 3 | + $('#wpbot_checked_all').on('click', function(){ | |
| 4 | + if($(this).is(':checked')){ | |
| 5 | + $('.wpbot_sessions_checkbox').prop('checked', true); | |
| 6 | + }else{ | |
| 7 | + $('.wpbot_sessions_checkbox').prop('checked', false); | |
| 8 | + } | |
| 9 | + }) | |
| 10 | + | |
| 11 | + // $('#wpbot_submit_delcs_form').on('click', function(e){ | |
| 12 | + // e.preventDefault(); | |
| 13 | + // $( "#wpcs_form_sessions" ).submit(); | |
| 14 | + // }) | |
| 15 | + | |
| 16 | + | |
| 17 | + // Get the modal | |
| 18 | + var modal = document.getElementById("wpcsmyModal"); | |
| 19 | + | |
| 20 | + | |
| 21 | + // Get the <span> element that closes the modal | |
| 22 | + var span = document.getElementsByClassName("wpcsclose")[0]; | |
| 23 | + | |
| 24 | + $('.wpcsmyBtn').on('click', function(e){ | |
| 25 | + e.preventDefault(); | |
| 26 | + $('#wpcs_to_email_address').val($(this).attr('data-email')); | |
| 27 | + $('#wpcs_show_email').html($(this).attr('data-email')); | |
| 28 | + $('#wpcsmyModal').show(); | |
| 29 | + }) | |
| 30 | + | |
| 31 | + // When the user clicks on <span> (x), close the modal | |
| 32 | + span.onclick = function() { | |
| 33 | + modal.style.display = "none"; | |
| 34 | + $('#wpcs_show_email').html(''); | |
| 35 | + } | |
| 36 | + | |
| 37 | + // When the user clicks anywhere outside of the modal, close it | |
| 38 | + window.onclick = function(event) { | |
| 39 | + if (event.target == modal) { | |
| 40 | + modal.style.display = "none"; | |
| 41 | + $('#wpcs_show_email').html(''); | |
| 42 | + } | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 46 | + jQuery( "#wpcs_email_form" ).submit(function( event ) { | |
| 47 | + | |
| 48 | + event.preventDefault(); | |
| 49 | + jQuery('#wpcs_email_loading').hide(); | |
| 50 | + jQuery( "#wpcs_email_status" ).html(''); | |
| 51 | + var subject = jQuery('#wpcs_email_subject').val(); | |
| 52 | + | |
| 53 | + var message = jQuery('#wpcs_email_message').val(); | |
| 54 | + var to = jQuery('#wpcs_to_email_address').val(); | |
| 55 | + | |
| 56 | + var error = false; | |
| 57 | + | |
| 58 | + if(subject==''){ | |
| 59 | + alert('please provide the subject'); | |
| 60 | + error = true; | |
| 61 | + } | |
| 62 | + if(message==''){ | |
| 63 | + alert('please provide the message content'); | |
| 64 | + error = true; | |
| 65 | + } | |
| 66 | + | |
| 67 | + if(error==false){ | |
| 68 | + jQuery('#wpcs_email_loading').show(); | |
| 69 | + | |
| 70 | + | |
| 71 | + var data = { | |
| 72 | + 'to': to, | |
| 73 | + 'subject': subject, | |
| 74 | + 'message': message, | |
| 75 | + } | |
| 76 | + $.post( | |
| 77 | + ajax_object.ajax_url, | |
| 78 | + { | |
| 79 | + action : 'wpcs_send_email', | |
| 80 | + security: ajax_object.ajax_nonce, | |
| 81 | + data: data, | |
| 82 | + }, | |
| 83 | + function(data){ | |
| 84 | + jQuery('#wpcs_email_loading').hide(); | |
| 85 | + var json = $.parseJSON(data); | |
| 86 | + jQuery( "#wpcs_email_status" ).html(json.message); | |
| 87 | + jQuery('#wpcs_email_subject').val(''); | |
| 88 | + jQuery('#wpcs_email_message').val(''); | |
| 89 | + jQuery('#wpcs_to_email_address').val(''); | |
| 90 | + | |
| 91 | + } | |
| 92 | + ); | |
| 93 | + | |
| 94 | + | |
| 95 | + } | |
| 96 | + | |
| 97 | + }); | |
| 98 | + | |
| 99 | + $('#qcld_session_min_interaction').change(function() { | |
| 100 | + this.form.submit(); | |
| 101 | + }); | |
| 102 | + | |
| 103 | + $('#qcld_session_wp_user').change(function() { | |
| 104 | + this.form.submit(); | |
| 105 | + }); | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + $( "#session_s_date" ).datepicker({dateFormat: 'yy-mm-dd'}); | |
| 110 | + $( "#session_e_date" ).datepicker({dateFormat: 'yy-mm-dd'}); | |
| 111 | + $('.wpvo_filter_session').on('click','.filter_session_button',function(){ | |
| 112 | + var session_s_date = $( "#session_s_date" ).val(); | |
| 113 | + var session_e_date = $( "#session_e_date" ).val(); | |
| 114 | + $.post( | |
| 115 | + ajax_object.ajax_url, | |
| 116 | + { | |
| 117 | + action : 'qcld_chatbot_session_date_filter', | |
| 118 | + security: ajax_object.ajax_nonce, | |
| 119 | + start_date: session_s_date, | |
| 120 | + end_date: session_e_date, | |
| 121 | + }, | |
| 122 | + function(data){ | |
| 123 | + var datas = JSON.parse(data); | |
| 124 | + var sure = "'are you sure'"; | |
| 125 | + $('.sld_payment_row.body').empty(); | |
| 126 | + $.each( datas, function( key, value ) { | |
| 127 | + var row = '<div class="sld_payment_row body"><div class="sld_payment_cell"><input type="checkbox" name="sessions[]" class="wpbot_sessions_checkbox" value="'+value.id+'"></div><div class="sld_payment_cell">'+value.date+'</div><div class="sld_payment_cell">'+value.interaction+'</div><div class="sld_payment_cell">'+value.session_id+'</div><div class="sld_payment_cell">'+value.name+'</div><div class="sld_payment_cell">'+value.email+'</div><div class="sld_payment_cell">'+value.phone+'</div><div class="sld_payment_cell"><div class="sld_responsive_head">Action</div><a href="/wp-admin/admin.php?page=wbcs-botsessions-page&userid='+value.id+'" class="button-primary">View Chat</a> <a href="/wp-admin/admin.php?page=wbcs-botsessions-page&userid='+value.id+'&act=delete" class="button-primary" onclick="return confirm('+sure+')">Delete</a></div></div>'; | |
| 128 | + $('.sld_payment_table').append(row); | |
| 129 | + }); | |
| 130 | + | |
| 131 | + } | |
| 132 | + ); | |
| 133 | + }); | |
| 134 | + | |
| 135 | 135 | }) |