var ssdelid = 0; var ssrepid = 0; var ssaddqid = 0; var curr_service = ''; var curr_tabtype = 'Sent'; //re load ----------------------- function reload(search){ jQuery.ajax({ // url: postrefunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'earn_ajax_post', type : type, populate_website: populate_website }, success: function(response){ jQuery('.earn-tabs-box').html(response); } }); } //end re load ------------------- reload('reload'); // var dateToday = new Date(); // jQuery( "#sr_datepicker" ).datepicker({ // minDate: dateToday // }); // jQuery( document ).on( 'click', '.test-load', function() { // // alert(1); // jQuery.ajax({ // url: '/wp-admin/admin-ajax.php', // type:'POST', // dataType: 'json', // data : { // action : 'reajaxpost' // }, // success: function(response){ // jQuery('.re-tabs-box').html(response); // var modal = document.getElementById('repeatModal'); // modal.style.display = "none"; // var modal = document.getElementById('deleteModal'); // modal.style.display = "none"; // var modal = document.getElementById('resendschedModal'); // modal.style.display = "none"; // var modal = document.getElementById('reschedModal'); // modal.style.display = "none"; // var modal = document.getElementById('addqueueModal'); // modal.style.display = "none"; // var modal = document.getElementById('successModal'); // modal.style.display = "none"; // } // }); // return false; // }); jQuery( document ).on( 'click', '.qsearch-btn', function() { jQuery('.qsearch-btn').html('Searching..'); reload( jQuery('.q-search').val() ); }); jQuery( document ).on( 'click', '.repeat-btn', function() { // ssrepid = $(this).attr('queueid'); // var this_ssrepid = $(this).attr('queueid'); // if( this_ssrepid > 0 ) // { // ssrepid = this_ssrepid; // } var modal = document.getElementById('reschedModal'); modal.style.display = "block"; return false; }); var resend_ary = []; jQuery( document ).on( 'click', '.resend-btn', function() { resend_ary = []; // alert(curr_tabtype); $('.'+curr_tabtype.toLowerCase()+'_checkbox').each(function(i, obj) { if (jQuery(this).is(':checked')) { // alert( jQuery(this).attr('thischeckid') ); resend_ary.push(jQuery(this).attr('thischeckid')); } }); ssrepid = $(this).attr('queueid'); curr_service = $(this).attr('status'); var this_ssrepid = $(this).attr('queueid'); if( this_ssrepid > 0 ) { ssrepid = this_ssrepid; } var modal = document.getElementById('repeatModal'); modal.style.display = "block"; return false; }); var resched_ary = []; jQuery( document ).on( 'click', '.resched-btn', function() { ssrepid = $(this).attr('queueid'); var this_ssrepid = $(this).attr('queueid'); if( this_ssrepid > 0 ) { ssrepid = this_ssrepid; } resched_ary = []; // alert(curr_tabtype); $('.'+curr_tabtype.toLowerCase()+'_checkbox').each(function(i, obj) { if (jQuery(this).is(':checked')) { // alert( jQuery(this).attr('thischeckid') ); resched_ary.push(jQuery(this).attr('thischeckid')); } }); var modal = document.getElementById('resendschedModal'); modal.style.display = "block"; return false; }); // document.getElementsByClassName('tablinks')[0].click(); jQuery( document ).on( 'click', '.ss-confirm-repeat', function() { jQuery(this).html('Please wait..'); var queueid = ssrepid; var rs_time = jQuery('.rs-time').val(); var rs_date = jQuery('.rs-date').val(); // alert(queueid); jQuery.ajax({ // url: postqpfunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'reajaxpost', repeat : queueid, repeat_ary : resend_ary, rs_time: rs_time, rs_date: rs_date }, success: function(response){ //pop up notification; // alert(response); // console.log(response); // response.forEach(function(response) { // var color = ''; // var status = ''; // var repeatbtn = ' '; // var deletebtn = ''; // alert(1); // if( response['label_status'] == 'Pending' ) // { // color = ' style="color:#FFC642;font-weight:bold;"'; // status = response['label_status']; // } // else if( response['label_status'] == 'Scheduled' ) // { // color = ' style="color:#943536;font-weight:bold;"'; // status = response['label_status'] + '
' + response['process_message'] + '
'); // } // reload(); // if( curr_status == 'deleted' ) // { // ssaddqid = response['queue_id']; // } // else // { // ssadelid = response['queue_id']; // ssarepid = response['queue_id']; // } // }); reload(''); // var modal = document.getElementById('successModal'); // modal.style.display = "block"; // setTimeout(function () { // var modal = document.getElementById('successModal'); // modal.style.display = "none"; // var modal = document.getElementById('repeatModal'); // modal.style.display = "block"; // }, 3000); } }); return false; }); jQuery( document ).on( 'click', '.ss-confirm-resched', function() { jQuery(this).html('Please wait..'); var queueid = ssrepid; var rsc_time = jQuery('.rsc-time').val(); var rsc_date = jQuery('.rsc-date').val(); // alert(queueid); jQuery.ajax({ // url: postqpfunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'reajaxpost', resched : queueid, resched_ary : resched_ary, rsc_time: rsc_time, rsc_date: rsc_date }, success: function(response){ //pop up notification; // alert(response); // console.log(response); // response.forEach(function(response) { // var color = ''; // var status = ''; // var repeatbtn = ' '; // var deletebtn = ''; // alert(1); // if( response['label_status'] == 'Pending' ) // { // color = ' style="color:#FFC642;font-weight:bold;"'; // status = response['label_status']; // } // else if( response['label_status'] == 'Scheduled' ) // { // color = ' style="color:#943536;font-weight:bold;"'; // status = response['label_status'] + '' + response['process_message'] + '
'); // } // if( curr_status == 'deleted' ) // { // ssaddqid = response['queue_id']; // } // else // { // ssadelid = response['queue_id']; // ssarepid = response['queue_id']; // } // }); reload(''); // var modal = document.getElementById('successModal'); // modal.style.display = "block"; // setTimeout(function () { // var modal = document.getElementById('successModal'); // modal.style.display = "none"; // var modal = document.getElementById('reschedModal'); // modal.style.display = "block"; // }, 3000); } }); return false; }); jQuery( document ).on( 'click', '.ss-close', function() { // alert(1); jQuery(this).parent().parent().parent().fadeOut(); // var rmodal = document.getElementById('repeatModal'); // rmodal.style.display = "none"; // var dmodal = document.getElementById('deleteModal'); // dmodal.style.display = "none"; // var amodal = document.getElementById('addqueueModal'); // amodal.style.display = "none"; // var smodal = document.getElementById('successModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('viewModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('generateconfirmModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('sendconfirmModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('passsuccessModal'); // smodal.style.display = "none"; return false; }); jQuery( document ).on( 'click', '.ss-cancel', function() { jQuery(this).parent().parent().parent().fadeOut(); // var rmodal = document.getElementById('repeatModal'); // rmodal.style.display = "none"; // var dmodal = document.getElementById('deleteModal'); // dmodal.style.display = "none"; // var amodal = document.getElementById('addqueueModal'); // amodal.style.display = "none"; // var smodal = document.getElementById('successModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('viewModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('generateconfirmModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('sendconfirmModal'); // smodal.style.display = "none"; // var smodal = document.getElementById('passsuccessModal'); // smodal.style.display = "none"; return false; }); var delete_ary = []; jQuery( document ).on( 'click', '.delete-btn', function() { // jQuery('#delete-popup').css('visibility','visible'); // return false; delete_ary = []; // alert(curr_tabtype); $('.'+curr_tabtype.toLowerCase()+'_checkbox').each(function(i, obj) { if (jQuery(this).is(':checked')) { // alert( jQuery(this).attr('thischeckid') ); delete_ary.push(jQuery(this).attr('thischeckid')); } }); ssdelid = $(this).attr('queueid'); curr_service = $(this).attr('status'); var this_ssdelid = $(this).attr('queueid'); if( this_ssdelid > 0 ) { ssdelid = this_ssdelid; } var modal = document.getElementById('deleteModal'); modal.style.display = "block"; return false; }); jQuery( document ).on( 'click', '.ss-confirm-delete', function() { // var queueid = jQuery(this).attr('queueid'); var queueid = ssdelid; jQuery(this).html('Please wait..'); jQuery.ajax({ // url: postqpfunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'reajaxpost', deleteid : queueid, delete_ary : delete_ary }, success: function(response){ reload(''); //pop up notification; // jQuery('.ss-confirm-delete').html('Yes'); // var modal = document.getElementById('deleteModal'); // modal.style.display = "none"; // response.forEach(function(response) { // if( response['success'] == "true" ) // { // jQuery('.q-' + queueid).closest("tr").fadeOut(); // } // var color = ''; // var status = ''; // var repeatbtn = ' '; // var deletebtn = ''; // // alert(1); // if( response['data'][0]['status'] == 'Pending' ) // { // color = ' style="color:#FFC642;font-weight:bold;"'; // status = response['data'][0]['status']; // } // else if( response['data'][0]['status'] == 'Scheduled' ) // { // color = ' style="color:#943536;font-weight:bold;"'; // status = response['data'][0]['status'] + '' + response['process_message'] + '
'); // } // if( response['process_status'] == 'Deleted' ) // { // ssaddqid = response['queue_id']; // } // else // { // ssadelid = response['queue_id']; // ssarepid = response['queue_id']; // } // }); // var modal = document.getElementById('successModal'); // modal.style.display = "block"; // setTimeout(function () { // var modal = document.getElementById('successModal'); // modal.style.display = "none"; // }, 3000); reload(''); }, error: function(errorThrown){ alert(errorThrown); } }); return false; }); jQuery( document ).on( 'click', '.view-btn', function() { var modal = document.getElementById('viewModal'); modal.style.display = "block"; return false; }); jQuery( document ).on( 'click', '.sent_selectall', function() { // $('.sent_selectall').click(function() { if (jQuery(this).is(':checked')) { // jQuery('.sent_checkbox').attr('checked', true); jQuery('.sent_checkbox').prop('checked', true); // jQuery('.sent_checkbox').checked = true; } else { // jQuery('.sent_checkbox').attr('checked', false); jQuery('.sent_checkbox').prop('checked', false); // jQuery('.sent_checkbox').checked = false; } }); jQuery( document ).on( 'click', '.pending_selectall', function() { // $('.pending_selectall').click(function() { if (jQuery(this).is(':checked')) { jQuery('.pending_checkbox').prop('checked', true); } else { jQuery('.pending_checkbox').prop('checked', false); } }); jQuery( document ).on( 'click', '.scheduled_selectall', function() { // $('.scheduled_selectall').click(function() { if (jQuery(this).is(':checked')) { jQuery('.scheduled_checkbox').prop('checked', true); } else { jQuery('.scheduled_checkbox').prop('checked', false); } }); jQuery( document ).on( 'click', '.deleted_selectall', function() { // $('.deleted_selectall').click(function() { if (jQuery(this).is(':checked')) { jQuery('.deleted_checkbox').prop('checked', true); } else { jQuery('.deleted_checkbox').prop('checked', false); } }); // jQuery( document ).on( 'click', '.ss-close', function($e) { // $e.preventDefault(); // return true; // }); // generate new password click var curr_passgen_service = ''; var curr_passgen_partner_id = 0; jQuery( document ).on( 'click', '.sp-generatepass-btn', function() { curr_passgen_service = jQuery(this).attr('service'); curr_passgen_partner_id = jQuery(this).attr('accountid'); jQuery('.ss-passgen-modal-text').html('Are you sure you want to generate new ' + curr_passgen_service + ' password? Do you understand that your old password will no longer work?'); var modal = document.getElementById('generateconfirmModal'); modal.style.display = "block"; return false; }); jQuery( document ).on( 'click', '.ss-generatepass-confirm', function() { jQuery(this).html('Please wait..'); jQuery.ajax({ // url: postqpfunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'passajaxpost', pass_type: 'generate', accountid: curr_passgen_partner_id, pass_service : curr_passgen_service }, success: function(response){ var modal = document.getElementById('generateconfirmModal'); modal.style.display = "none"; jQuery('.ss-pass-successnotif').html( response['message'] ); jQuery('.qs_' + curr_passgen_service + '_password').val( response['pass'] ); jQuery('.' + curr_passgen_service + '_pass_created').html( 'Created ' + response['update_date'] ); jQuery('.ss-generatepass-confirm').html('Yes'); var modal = document.getElementById('passsuccessModal'); modal.style.display = "block"; setTimeout(function () { var modal = document.getElementById('passsuccessModal'); modal.style.display = "none"; }, 3000); } }); return false; }); // end generate new password click // send sms password click var curr_passsend_service = ''; var curr_passsend_partner_id = 0 jQuery( document ).on( 'click', '.sp-sendpass-btn', function() { curr_passsend_service = jQuery(this).attr('service'); curr_passsend_partner_id = jQuery(this).attr('accountid'); var sendvia = jQuery(this).attr('sendvia'); $('.ss-sendpass-confirm').attr('sendvia', sendvia); jQuery('.ss-passsend-modal-text').html('Are you sure you want to send ' + curr_passsend_service + ' password?'); var modal = document.getElementById('sendconfirmModal'); modal.style.display = "block"; return false; }); jQuery( document ).on( 'click', '.ss-sendpass-confirm', function() { jQuery(this).html('Please wait..'); var sendvia = jQuery(this).attr('sendvia'); jQuery.ajax({ // url: postqpfunction.ajax_url, url: '/wp-admin/admin-ajax.php', type:'POST', dataType: 'json', data : { action : 'passajaxpost', pass_type: 'send', accountid: curr_passsend_partner_id, pass_service : curr_passsend_service, sendvia : sendvia }, success: function(response){ var modal = document.getElementById('sendconfirmModal'); modal.style.display = "none"; jQuery('.ss-pass-successnotif').html( response['message'] ); jQuery('.' + curr_passgen_service + '_pass_created').html( 'Created ' + response['update_date'] ); jQuery('.ss-sendpass-confirm').html('Yes'); var modal = document.getElementById('passsuccessModal'); modal.style.display = "block"; setTimeout(function () { var modal = document.getElementById('passsuccessModal'); modal.style.display = "none"; }, 3000); } }); return false; }); //end send sms password click jQuery( document ).on( 'click', '.q-tablinks', function() { curr_tabtype = jQuery(this).attr('tabtype'); // alert(curr_tabtype); return false; }); function openCity(evt, cityName) { // Declare all variables var i, tabcontent, tablinks; // Get all elements with class="tabcontent" and hide them tabcontent = document.getElementsByClassName("q-tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } // Get all elements with class="tablinks" and remove the class "active" tablinks = document.getElementsByClassName("q-tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" q-active", ""); } // Show the current tab, and add an "active" class to the link that opened the tab document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " q-active"; } function settab(cityName){ // Get all elements with class="tabcontent" and hide them tabcontent = document.getElementsByClassName("q-tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } // Get all elements with class="tablinks" and remove the class "active" tablinks = document.getElementsByClassName("q-tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" q-active", ""); } // Show the current tab, and add an "active" class to the link that opened the tab document.getElementById(cityName).style.display = "block"; jQuery('.'+cityName+'-tab').addClass('q-active'); } if( document.getElementById('defaultOpen') !== null ) { document.getElementById("defaultOpen").click(); }