chart.js
6 days ago
check-mail-jsPdf.js
6 days ago
check_mail_push.js
6 days ago
check_mail_wizard.js
6 days ago
check_mail_wizard.min.js
6 days ago
checkemail.js
6 days ago
checkemail.min.js
6 days ago
checkmail-dashboard-chart.js
6 days ago
checkmail-dashboard-chart.min.js
6 days ago
checkmail-sw.js
6 days ago
ck_mail-newsletter-script.js
6 days ago
ck_mail-newsletter-script.min.js
6 days ago
export-logs.js
6 days ago
export-logs.min.js
6 days ago
feedback.js
6 days ago
feedback.min.js
6 days ago
firebase-app.js
6 days ago
firebase-messaging.js
6 days ago
support-settings.js
6 days ago
support-settings.min.js
6 days ago
view-logs.js
6 days ago
view-logs.min.js
6 days ago
check_mail_wizard.js
77 lines
| 1 | let currentStep = 1; |
| 2 | var steps = ck_mail_wizard_data.steps; |
| 3 | const ck_mail_security_nonce = ck_mail_wizard_data.ck_mail_security_nonce; |
| 4 | |
| 5 | function cm_showStep(step) { |
| 6 | const stepContent = document.getElementById('step-content'); |
| 7 | const progressSteps = document.querySelectorAll('.cm_progress div'); |
| 8 | |
| 9 | progressSteps.forEach((stepDiv, index) => { |
| 10 | if (index < step) { |
| 11 | stepDiv.classList.add('active'); |
| 12 | } else { |
| 13 | stepDiv.classList.remove('active'); |
| 14 | } |
| 15 | }); |
| 16 | |
| 17 | stepContent.innerHTML = ` |
| 18 | <div class="cm_step">${steps[step - 1].title}</div> |
| 19 | <h2 class="cm_H2">${steps[step - 1].heading}</h2> |
| 20 | <div><form id="cm_step_form"> |
| 21 | <input type="hidden" name="action" value="check_mail_save_wizard_data" /> |
| 22 | <input type="hidden" name="ck_mail_security_nonce" value="${ck_mail_security_nonce}"> |
| 23 | ${steps[step - 1].content}</form></div> |
| 24 | `; |
| 25 | document.getElementById('cm_prevBtn').style.visibility = step === 1 ? 'hidden' : 'visible'; |
| 26 | document.getElementById('cm_nextBtn').innerText = step === steps.length ? 'Finish' : 'Save and Continue →'; |
| 27 | } |
| 28 | |
| 29 | function cm_nextStep() { |
| 30 | if (currentStep < steps.length) { |
| 31 | document.getElementById('cm-container-loader').style.display = 'block'; |
| 32 | currentStep++; |
| 33 | cm_save_wizard(); |
| 34 | cm_showStep(currentStep); |
| 35 | } else { |
| 36 | cm_save_wizard(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | function cm_prevStep() { |
| 41 | if (currentStep > 1) { |
| 42 | currentStep--; |
| 43 | cm_showStep(currentStep); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | document.addEventListener('DOMContentLoaded', function() { |
| 48 | cm_showStep(currentStep); |
| 49 | }); |
| 50 | |
| 51 | function cm_save_wizard(){ |
| 52 | var t = jQuery("body" ).find("#cm_nextBtn"); |
| 53 | var data = jQuery("body" ).find("#cm_step_form").serialize(); |
| 54 | jQuery.ajax({ |
| 55 | url:ajaxurl, |
| 56 | method:'post', |
| 57 | dataType: "json", |
| 58 | data:data, |
| 59 | beforeSend: function(response){ |
| 60 | t.prop('disabled',true); |
| 61 | }, |
| 62 | success:function(response){ |
| 63 | if (response.status == 200) { |
| 64 | steps = response.steps_data; |
| 65 | if (response.step == 'last') { |
| 66 | window.location = "admin.php?page=check-email-logs"; |
| 67 | } |
| 68 | }else{ |
| 69 | console.log('something went wrong'); |
| 70 | } |
| 71 | }, |
| 72 | complete:function(response){ |
| 73 | document.getElementById('cm-container-loader').style.display = 'none'; |
| 74 | t.prop('disabled',false); |
| 75 | } |
| 76 | }); |
| 77 | } |