| 1 |
(function ($) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
$(document).on('click', '[data-slug="survey-maker"] .deactivate a', function () { |
| 5 |
swal({ |
| 6 |
html:"<h2>Do you want to upgrade to Pro version or permanently delete the plugin?</h2><ul><li>Upgrade: Your data will be saved for upgrade.</li><li>Uninstall: Your data will be deleted completely.</li></ul>", |
| 7 |
type: 'question', |
| 8 |
showCancelButton: true, |
| 9 |
allowOutsideClick: false, |
| 10 |
allowEscapeKey: false, |
| 11 |
allowEnterKey: false, |
| 12 |
confirmButtonColor: '#3085d6', |
| 13 |
cancelButtonColor: '#d33', |
| 14 |
confirmButtonText: 'Upgrade', |
| 15 |
cancelButtonText: 'Deactivate' |
| 16 |
}).then(function(result) { |
| 17 |
var upgrade_plugin = false; |
| 18 |
if (result.value) upgrade_plugin = true; |
| 19 |
var data = { |
| 20 |
action: 'deactivate_plugin_option_sm', |
| 21 |
upgrade_plugin: upgrade_plugin |
| 22 |
}; |
| 23 |
|
| 24 |
$.ajax({ |
| 25 |
url: SurveyMakerAdmin.ajaxUrl, |
| 26 |
method: 'post', |
| 27 |
dataType: 'json', |
| 28 |
data: data, |
| 29 |
success:function () { |
| 30 |
window.location = $(document).find('[data-slug="survey-maker"]').find('.deactivate').find('a').attr('href'); |
| 31 |
} |
| 32 |
}); |
| 33 |
}); |
| 34 |
return false; |
| 35 |
}); |
| 36 |
})(jQuery); |